Search completed in 1.31 seconds.
<address>: The Contact Address element - HTML: Hypertext Markup Language
the html <
address> element indicates that the enclosed html provides contact information for a person or people, or for an organization. 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 contact information provided by an <
address> element's contents can take whatever form is appropriate for the context, and may include any type of contact information that is needed, such as a physical
address, url, email
address, phone number, social media handle, geographic coordinates, and so forth. the <
address> element should include the name of the person, people, or organization to which the contact information refers. <...
...an <
address> element's contents can take whatever form is appropriate for the context, and may include any type of contact information that is needed, such as a physical
address, url, email
address, phone number, social media handle, geographic coordinates, and so forth. the <
address> element should include the name of the person, people, or organization to which the contact information refers. <
address> can be used in a variety of contexts, such as providing a business's contact information in the page header, or indicating the author of an article by including an <
address> element within the <article>. content categories flow content, palpable content. ...
...or organization to which the contact information refers. <
address> can be used in a variety of contexts, such as providing a business's contact information in the page header, or indicating the author of an article by including an <
address> element within the <article>. content categories flow content, palpable content. permitted content flow content, but with no nested <
address> element, no heading content (<hgroup>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>), no sectioning content (<article>, <aside>, <section>, <nav>), and no <header> or <footer> element. tag omission none, both the starting and ending tag are mandatory. ...
...And 6 more matches
PaymentAddress.addressLine - Web APIs
the
addressline read-only property of the payment
address interface is an array of domstring objects, each specifying a line of the
address that is not covered by one of the other properties of payment
address. these lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. syntax var payment
addresslines = payment
address.
addressline; value an array of domstring objects, each containing one line of the
address. ...
...ifying a line of the
address that is not covered by one of the other properties of payment
address. these lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. syntax var payment
addresslines = payment
address.
addressline; value an array of domstring objects, each containing one line of the
address. ...
...e lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. syntax var payment
addresslines = payment
address.
addressline; value an array of domstring objects, each containing one line of the
address. ...
...And 3 more matches
AddressErrors.addressLine - Web APIs
an object based on
addresserrors includes an
addressline property when validation of the
address finds one or more errors in the array of strings in the
address's
addressline. the returned string explains the error and should offer suggestions for how to correct it. syntax var
addresslineerror =
addresserrors.
addressline; value if an error occurred during validation of the
address due to one of the strings in the
addressline array having an invalid value, this property is set to a domstring providing a human-readable error message explaining the validation error. the text should also include, when possible, advice about how to go about correcting the error. ...
...slineerror =
addresserrors.
addressline; value if an error occurred during validation of the
address due to one of the strings in the
addressline array having an invalid value, this property is set to a domstring providing a human-readable error message explaining the validation error. the text should also include, when possible, advice about how to go about correcting the error. if the payment
address object's
addressline property was determined to be valid, this property is not included in the
addresserrors dictionary. specifications specification status comment payment request apithe definition of '
addresserrors.
addressline' in that specification. candidate recommendation initial definition. ...
AddonManager
the
addonmanager object is the global api used to access information about
add-ons installed in the application and to manipulate them. the majority of the methods are asynchronous meaning that results are delivered through callbacks passed to the method. the callbacks will be called just once but that may be before or after the method returns. one of the forces of the
addonmanager is that it deals with any kind (type) of
add-on in a generic manner. to do so many methods of the
addonmanager take the
add-on types as parameters. the existing
add-on types are defined in xpiprovider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...before or after the method returns. one of the forces of the
addonmanager is that it deals with any kind (type) of
add-on in a generic manner. to do so many methods of the
addonmanager take the
add-on types as parameters. the existing
add-on types are defined in xpiprovider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...returns. one of the forces of the
addonmanager is that it deals with any kind (type) of
add-on in a generic manner. to do so many methods of the
addonmanager take the
add-on types as parameters. the existing
add-on types are defined in xpiprovider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...And 72 more matches
Address Book examples
note: thunderbird and seamonkey user interfaces now reference 'contacts' not 'cards' however, as the backend still uses the 'cards' terminology, that is what is used here this article provides examples on accessing and manipulating thunderbird
address books.
address book interfaces provides an overview of the related interfaces. see an overview of thunderbird components for a general description of the thunderbird user interface and related programmatic interfaces. how do i get all
address books? use the
address book manager to get an nsisimpleenumerator, then progress through the enumerator, looking for nsiabitem, nsiabcollection or nsiabdirectory interfaces as you require. let abmanager = components.classes["@mozilla.org/abmanager;1"] .getservice(compon...
...and related programmatic interfaces. how do i get all
address books? use the
address book manager to get an nsisimpleenumerator, then progress through the enumerator, looking for nsiabitem, nsiabcollection or nsiabdirectory interfaces as you require. let abmanager = components.classes["@mozilla.org/abmanager;1"] .getservice(components.interfaces.nsiabmanager); let all
addressbooks = abmanager.directories; while (all
addressbooks.hasmoreelements()) { let
addressbook = all
addressbooks.getnext() .queryinterface(components.interfaces.nsiabdirectory); if (
addressbook instanceof components.interfaces.nsiabdirectory) { // or nsiabitem or nsiabcollection // alert ("directory name:" +
addressbook.dirname); ... } } how do i...
... = abmanager.directories; while (all
addressbooks.hasmoreelements()) { let
addressbook = all
addressbooks.getnext() .queryinterface(components.interfaces.nsiabdirectory); if (
addressbook instanceof components.interfaces.nsiabdirectory) { // or nsiabitem or nsiabcollection // alert ("directory name:" +
addressbook.dirname); ... } } how do i get one
address book? ...
...And 47 more matches
EventTarget.addEventListener() - Web APIs
the eventtarget method
addeventlistener() sets up a function that will be called whenever the specified event is delivered to the target. common targets are element, document, and window, but the target may be any object that supports events (such as xmlhttprequest).
addeventlistener() works by
adding a function or an object that implements eventlistener to the list of event listeners for the specified event type on the eventtarget on which it's called. syntax target.
addeventlistener(type, listener [, options]); target.
addeventlistener(type, listener [, usecapture]); target.
addeventlistener(type, listener [, usecapture, wantsuntrusted ]); // gecko/mozilla only parameters type a case-sensitive string representing the event type to listen for. listener the object that receives a not...
...allback itself. options optional an options object specifies characteristics about the event listener. the available options are: capture a boolean indicating that events 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 preventdefault(). if a passive listener does call preventdefault(), the user agent will do nothing other than generate a console warning. see improving scrolling performance with passive listeners to learn more. mozsystemg...
... when invoked. passive a boolean that, if true, indicates that the function specified by listener will never call preventdefault(). if a passive listener does call preventdefault(), 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 optional a boolean indicating whether events of this type will be dispatched to the registered listener before being dispatched to any eventtarget beneath it in the dom tree. events that are bubbling upward through the tree will not trigger a listener designated to use capture. e...
...And 42 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
ous overview: client-side javascript frameworks next we now have sample data in place, and a loop that takes each 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. 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. 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 underly...
...you'll need a terminal with node + npm installed. objective: to learn about handling forms in vue, and by association, events, models, and methods. creating a new to-do form we now have an app that displays a list of to-do items. however, we can't update our list of items without manually changing our code! let's fix that. let's create a new component that will allow us to
add a new to-do item. in your components folder, create a new file called todoform.vue.
add a blank <template> and a <script> tag like before: <template></template> <script> export default {}; </script> let's
add in an html form that lets you enter a new todo item and submit it into the app. we need a <form> with a <label>, an <input>, and a <button>. update your template as f...
...m that lets you enter a new todo item and submit it into the app. we need a <form> with a <label>, an <input>, and a <button>. ...
...And 27 more matches
AddressErrors - Web APIs
the
addresserrors dictionary is used by the payment request api to to report validation errors in a physical
address (typically a billing
address or a shipping
address). any members which is present indicates that a validation error occurred for the member of the same name in an
address described using payment
address.
addresserrors is the type of the object returned by shipping
addresserrors in the paymentdetailsupdate passed into paymentrequestupdateevent.updatewith() by the shipping
addresschange event handler if a change to the
address resulted in a validation error occurring. see the examples below to see how this works. properties
addressline a domstring which, if present, indicates that the
addressline property of the payment
address could not be validated. the contents of the stri...
...s below to see how this works. properties
addressline a domstring which, if present, indicates that the
addressline property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. city a domstring which, if present, indicates that the city property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. country a domstring which, if present, indicates that the country property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and ideally sugges...
...ns to correct the problem. country a domstring which, if present, indicates that the country property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. dependentlocality a domstring which, if present, indicates that the dependentlocality property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. organization a domstring which, if present, indicates that the organization property of the payment
address could not be validated. the contents of the string provide a human-readable explanation of the validation failure, and idea...
...And 24 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
using eval in
add-ons is almost always unnecessary, and many times even a security vulnerability. moreover, code using eval is harder to parse for a human mind, is often pretty complex, and relies on assumptions that are not necessarily true in the future or even now. this article is 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 b...
...ll 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 location becomes a security vulnerability when parsed with the eval function. basically, you are executing remote code with full chrome access; that is, introducing a re...
... just another script tag containing generated, remotely retrieved code, is generally not secure. ...
...And 23 more matches
JS_Add*Root
obsolete since jsapi 31this 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. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...lthough it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...iscouraged since it could be removed at any time. try to avoid using it. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...And 23 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
the logical properties and values specification defines flow-relative mappings for the various margin, border, and p
adding properties and their shorthands. in this guide we take a look at these. if you have looked at the main page for css logical properties and values you will see there are a huge number of properties listed. this is mostly due to the fact that there are four longhand values each for margin, border, and p
adding side, plus all the shorthand values. mappings for margins, borders, and p
adding the specification details mappings for each logical value to a physical counterpart. in the table below i have given these mapped values assuming that the writing-mode in use is horizontal-tb — with a left to right direction. the inline direction therefore runs horizontally — left t...
...these shorthands have no physical equivalent. property purp...
...these shorthands have no physical equivalent. property purpose bord...
...And 23 more matches
Paddle and keyboard controls - Game development
« previousnext » this is the 4th step out of 10 of the gamedev canvas tutorial. 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. ...
... » this is the 4th step out of 10 of the gamedev canvas tutorial. 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 p
addle. ...
...th step out of 10 of the gamedev canvas tutorial. 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 p
addle. defining a p
addle to hit the ball so, we need a p
addle to hit the ball. ...
...And 22 more matches
Addon
api consumers should take care to verify the existence of these methods or properties before relying on them. ...
...api consumers should take care to verify the existence of these methods or properties before relying on them. ...
...api consumers should take care to verify the existence of these methods or properties before relying on them. ...
...And 21 more matches
JS::Add*Root
still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...uld be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...cle covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...And 20 more matches
Interfacing with the Add-on Repository
the
add-on repository javascript code module makes it easy for your extension to interface with the amo repository. you an use the code module to get lists of
add-ons and even install new
add-ons. this article provides some sample code that queries the recommended
add-ons list on amo and lets the user click a button to install an
add-on from the list. importing the repository code module before you can use the
add-on repository api, you need to import the code module: components.utils.import("resource://gre/modules/
addonrepository.jsm"); having done this, you can then access the api through the resulting
addonrepository object. enabling the recommendation feature in current builds of firefox 4, the recommendation api doesn't work because the preference for the url to query to get reco...
...e the
add-on repository api, you need to import the code module: components.utils.import("resource://gre/modules/
addonrepository.jsm"); having done this, you can then access the api through the resulting
addonrepository object. enabling the recommendation feature in current builds of firefox 4, the recommendation api doesn't work because the preference for the url to query to get recommended
add-ons is not included by default; see bug 628785. to make the service work for the time being, you can use code like this when your extension starts up: var prefsservice = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); var prefbranch = prefsservice.getbranch("extensions."); var recurl = ""; try { recurl = pref...
... default; see bug 628785. ...
...And 18 more matches
Add to Home screen - Progressive web apps (PWAs)
this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it. why a2hs? a2hs is thought to be part of the progressive web app philosophy — giving web apps the same user experience advantages as native apps so they can compete in today's ecosystem wars. part of this is the simple gesture of accessing an app by tapping its icon on your home screen, and then having it appear neatly in its own window. a2hs makes this possible. ...
...ile browsers, except ios webview. it's also supported in some chromium desktop browsers. firefox has had mobile support since v58 and is working on desktop support. see caniuse.com for exact details. ...
...essary code to allow it to be
added to a home screen, as well as a service worker to enable it to be used offline. the example displays a series of fox pictures. if you have firefox for android available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. you'll see fox pictures, but more important, you'll see a "home" icon with a plus (+) icon inside it — this is the "
add to home screen" icon displayed for any site that has the necessary features in place. tapping this will show a confirmation banner — pressing the big +
add to home screen button completes the action,
adding the app to the home screen. ...
...And 18 more matches
Adding captions and subtitles to HTML5 video - Developer guides
in other articles we looked at how to build a cross browser video player using the htmlmediaelement and window.fullscreen apis, and also at how to style the player. this article will take the same player and show how to
add captions and subtitles to it, using the webvtt format and the <track> element. captioned video example in this article, we will refer to the video player with captions example. this example uses an excerpt from the sintel open movie, created by the blender foundation. note: you can find the source on github, and also view the example live. html5 and video captions before diving into how to
add captions to the video player, there are a number of things that we will first mention, which you should be aware of before we start. captions versus subtitles ca...
...refer to the text tracks displayed as subtitles, as their content is aimed at hearing people who have difficulty understanding the language of the film, rather than deaf or hard-of-hearing people. the <track> element html5 allows us to specify subtitles for a video using the <track> element. the various attributes of this element allow us to specify such things as the type of content that we're
adding, the language it's in, and of course a reference to the text file that contains the actual subtitle information. webvtt the files that contain the actual subtitle data are simple text files that follow a specified format, in this case the web video text tracks (webvtt) format. the webvtt specification is still being worked on, but major parts of it are stable so we can use it today. video p...
...oday. 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 previous 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 markup as mentioned above, we need to make use of ...
...And 15 more matches
Player paddle and controls - Game development
« previousnext » this is the 7th 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/lesson07.html. ...
... the gamedev phaser tutorial. 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 p
addle to move around and hit the ball with. ...
...e 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 p
addle to move around and hit the ball with. rendering the p
addle from the framework point of view the p
addle 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. loading the p
addle first,
add the p
addle variable we will be using in our game, right after the ball variable: var p
addle; then, in the preload function, load the p
addle image by
adding the following new load.image() call: function preload() { // ... gam...
...And 14 more matches
AddonListener
addonlisteners can be registered with
addaddonlistener() and will then receive notification of changes to the
add-ons currently installed. these notifications come in the form of calls to methods on the listener object. a listener only needs to implement the methods corresponding to the events it cares about; missing methods will not cause any problems. ...
...donlisteners can be registered with
addaddonlistener() and will then receive notification of changes to the
add-ons currently installed. these notifications come in the form of calls to methods on the listener object. a listener only needs to implement the methods corresponding to the events it cares about; missing methods will not cause any problems. ...
...teners can be registered with
addaddonlistener() and will then receive notification of changes to the
add-ons currently installed. these notifications come in the form of calls to methods on the listener object. a listener only needs to implement the methods corresponding to the events it cares about; missing methods will not cause any problems. ...
...And 14 more matches
Add to iPhoto
this extension for mac os x serves as a demonstration of how to use js-ctypes to call mac os x carbon, core foundation, and other system frameworks from an extension written entirely in javascript. note: this extension uses carbon routines, which can no longer be used in firefox
add-ons now that firefox is a 64-bit application. you can download an installable version of this extension on amo. once installed, when you right-click on an image, you'll see among the options in the contextual menu an option to "
add image to iphoto". choose it, and iphoto will start up (if it's not already running) and import the image. declaring the apis the first thing we have to do is declare the mac os x apis we'll be using. this extension uses a number of methods and data types, as well as constants, f...
...ity was introduced in that build. cfmutablearray one thing about core foundation types that is interesting is the use of regular and mutable versions of the same data types. for example, the cfarray type describes an array, but cfarray objects can't be changed once they've been created. however, obviously there are cases in which you'll want to be able to manipulate the contents of an array by
adding and removing items, sorting them, and so forth. that's where the cfmutablearray type comes into play. all cfarray functions accept cfmutablearray objects, so you can use cfmutablearray with any routine that accepts a cfarray as input, but cfmutablearray supports
additional functions that let you change the contents of the array. there's nothing particularly interesting about how we declare th...
...ucture: this.klsrolesnone = 1; this.klsrolesviewer = 2; this.klsroleseditor = 4; this.klsrolesall = 0xffffffff; implementing the extension now that the mac os x apis we'll be using have been declared, we can write the core of the extension itself. this is done in the iphoto object in the extension's code. ...
...And 14 more matches
IDBObjectStore.add() - Web APIs
if a record already exists in the object store with the key parameter as its key, then an error constrainerror event is fired on the returned request object. ...
...if a record already exists in the object store with the key parameter as its key, then an error constrainerror event is fired on the returned request object. ...
...if a record already exists in the object store with the key parameter as its key, then an error constrainerror event is fired on the returned request object. ...
...And 14 more matches
Network Addresses
this chapter describes the nspr types and functions used to manipulate network
addresses. network
address types and constants network
address functions the api described in this chapter recognizes the emergence of internet protocol version 6 (ipv6). to facilitate the transition to ipv6, it is recommended that clients treat all structures containing network
addresses as transparent objects and use the functions documented here to manipulate the information. if used consistently, this api also eliminates the need to deal with the byte ordering of network
addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnet
addr structure. ...
...d that clients treat all structures containing network
addresses as transparent objects and use the functions documented here to manipulate the information. if used consistently, this api also eliminates the need to deal with the byte ordering of network
addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnet
addr structure. network
address types and constants prhostent prprotoent pr_netdb_buf_size network
address functions initializing a network
address pr_initializenet
addr facilitates the use of prnet
addr, the basic network
address structure, in a polymorphic manner. by using these functions with other network
address functions, clients can support either version 4 or version 6 of the internet protocol transparently. ...
... prprotoent pr_netdb_buf_size network
address functions initializing a network
address pr_initializenet
addr facilitates the use of prnet
addr, the basic network
address structure, in a polymorphic manner. by using these functions with other network
address functions, clients can support either version 4 or version 6 of the internet protocol transparently. all nspr functions that require prnet
addr as an argument accept either an ipv4 or ipv6 version of the
address. ...
...And 12 more matches
RTCPeerConnection.addTrack() - Web APIs
the specified track doesn't necessarily have to already be part of any of the specified streams. ...
... the specified track doesn't necessarily have to already be part of any of the specified streams. ...
... the specified track doesn't necessarily have to already be part of any of the specified streams. ...
...And 12 more matches
Adding a new CSS property
this page describes how to
add a new css property to the style system. the style system is the part of the code in gecko that is responsible for producing a computed value for every property for every element. see the gecko overview for more information about the style system. this document assumes that you have a specifcation for the property available. issues about how to write such a specification (including things such as whether it is appropriate to use prefixes or when properties should be inherited by default) are not covered here. if you need more details on any of the points mentioned here, a good place to find them is by looking at other changes in the version control history of the files mentioned. ...
...ues about how to write such a specification (including things such as whether it is appropriate to use prefixes or when properties should be inherited by default) are not covered here. if you need more details on any of the points mentioned here, a good place to find them is by looking at other changes in the version control history of the files mentioned. getting started first, you'll want to
add an appropriate test entry to property_database.js. see the documentation at the top of the file and the other entries for examples. this will cause tests of your new property to be
added to many of the mochitests in layout/style/test, which can be run with the command "./mach mochitest -f plain layout/style/". then, unless you're implementing a shorthand property, you need to decide which styl...
... again, see the documentation at the top of the file and the other entries for examples, and also see the next section for details about parsing. parsing to start implementing the parsing, first read ...
...And 11 more matches
Add-on Manager
the
add-on manager is responsible for managing all of the
add-ons installed in the application. through its apis information about all installed
add-ons can be retrieved and new
add-ons can be installed. the apis are designed to be generic and support many different types of
add-ons. many functions in the
add-on manager interface operate asynchronously returning results through callbacks passed to the functions. the callbacks may be called immediately while the initial function is still executing or shortly after, depending on when the requested data becomes available. accessing installed
add-ons information about installed
add-ons can be retrieved through the main
addonmanager api. ...
...d to the functions. the callbacks may be called immediately while the initial function is still executing or shortly after, depending on when the requested data becomes available. accessing installed
add-ons information about installed
add-ons can be retrieved through the main
addonmanager api. all of its functions are asynchronous, meaning that a callback function must be passed to receive the
addon instances. the callback may well only be called after the api function returns. ...
...quested data becomes available. accessing installed
add-ons information about installed
add-ons can be retrieved through the main
addonmanager api. all of its functions are asynchronous, meaning that a callback function must be passed to receive the
addon instances. the callback may well only be called after the api function returns. for example: components.utils.import("resource://gre/modules/
addonmanager.jsm");
addonmanager.getall
addons(function(a
addons) { // here a
addons is an array of
addon objects }); // this code will execute before the code inside the callback notifications about changes to installed
add-ons are dispatched to any registered
addonlisteners. they must be registered through the
addaddonlistener() method. ...
...And 11 more matches
padding - CSS: Cascading Style Sheets
the p
adding css shorthand property sets the p
adding area on all four sides of an element at once. 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. an element's p
adding area is the space between its content and its border. note: p
adding creates extra space within an element. in contrast, margin creates extra space around an element. ...
...e interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. an element's p
adding area is the space between its content and its border. note: p
adding creates extra space within an element. in contrast, margin creates extra space around an element. ...
...amples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. an element's p
adding area is the space between its content and its border. note: p
adding creates extra space within an element. in contrast, margin creates extra space around an element. ...
...And 11 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
« previousnext »
adding a new toolbar
adding new toolbars to firefox is easy, but
adding them the wrong way is very easy as well. 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. to
add your buttons, all you need to do is overlay the palette in your main browser overlay. <...
...--> </toolbarpalette> <!-- more overlay stuff. ...
...on on different systems, and also consider the different button states, but we'll get into that further ahead. the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. this is very important because the toolbar customization dialog won't work correctly without this. ...
...And 10 more matches
Firefox addons developer guide - Archive of obsolete content
so there may be still some reference to the xuldev website (we want to host source code on mdc, not on xuldev), and to japanese things (like some specific locales, which have been translated to french since non-latin characters are not well supported). ...
...ranslated to french since non-latin characters are not well supported). there are a few things that could be done to make this fit the site better, and for general cleaning up: tables should use the "standard-table" css class so they're styled the same as those on the rest of mdc. ...
...he "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 previous, next, and prevnext 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 apostrophes instead of straight ones as is done eve...
...And 10 more matches
Adding preferences to an extension - Archive of obsolete content
as before, concepts covered in the previous articles in this series won't be rehashed here, so if you haven't already seen them: creating a status bar extension creating a dynamic status bar extension also, for reference, you may want to take a look at preferences system and the preferences api. ...
... take a look at preferences system and the preferences api. download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. get the code here: download the sample update the manifests the install manifest and chrome manifest need to be updated. by and large, the changes are simply changing the id of the extension. ...
...t and chrome manifest need to be updated. by and large, the changes are simply changing the id of the extension. however, we do need to
add one new line to the install.rdf file: <em:optionsurl>chrome://stockwatcher2/content/options.xul</em:optionsurl> this line establishes the url of the xul file that describes the options dialog. please note that if you are using code from this tutorial to
add to an existing extension, you must uninstall and reinstall your extension to enable the preferences button for your extension in the
add-ons list. establish the defaults in order to set a default preference for the stock to monitor, we need to
add a new folder to our extension's package, called "defaults", which in turn contains another folder called "preferences". inside that, we create a fil...
...And 10 more matches
PR_InitializeNetAddr
returns the function returns one of the following values: if successful, pr_success. ...
... returns the function returns one of the following values: if successful, pr_success. ...
... returns the function returns one of the following values: if successful, pr_success. ...
...And 10 more matches
RTCIceCandidate.relatedAddress - Web APIs
the rtcicecandidate interface's read-only related
address property is a string indicating the related
address of a relay or reflexive candidate. if the candidate is a host candidate (that is, its ip is in fact the real ip
address of the remote peer), related
address is null. the related
address field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of related
address in the options object, but the
address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-
address field. ...
...hat is, its ip is in fact the real ip
address of the remote peer), related
address is null. the related
address field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of related
address in the options object, but the
address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-
address field. the related
address and port (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var rel
address = rtcicecandidate.related
address; value a domstring which contains the candidate's related
address. for both peer and server reflexive candidates, ...
...t (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var rel
address = rtcicecandidate.related
address; value a domstring which contains the candidate's related
address. for both peer and server reflexive candidates, the related
address (and related port) are the base for that server or peer reflexive candidate. ...
...And 10 more matches
Adding Event Handlers - Archive of obsolete content
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. ...
...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. ...
...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. ...
...And 9 more matches
RTCPeerConnection.addStream() - Web APIs
the obsolete rtcpeerconnection method
addstream()
adds a mediastream as a local source of audio or video. instead of using this obsolete method, you should instead use
addtrack() once for each track you wish to send to the remote peer. if the signalingstate is set to closed, an invalidstateerror is raised. if the signalingstate is set to stable, the event negotiationneeded is sent on the rtcpeerconnection to indicate that ice negotiation must be repeated to consider the new stream. syntax rtcpeerconnection.
addstream(mediastream); parameters mediastream a mediastream object indicating the stream to
add to the webrtc peer connection. return value none. example this simple example
adds the audio and video stream coming from the user's camera to the connection. navigator.mediadev...
...connection.
addstream(mediastream); parameters mediastream a mediastream object indicating the stream to
add to the webrtc peer connection. return value none. example this simple example
adds the audio and video stream coming from the user's camera to the connection. ...
...arameters mediastream a mediastream object indicating the stream to
add to the webrtc peer connection. return value none. example this simple example
adds the audio and video stream coming from the user's camera to the connection. ...
...And 9 more matches
Appendix A: Add-on Performance - Archive of obsolete content
note: see the newer article performance best practices in extensions for more up-to-date information about how to optimize the performance of your
add-on.
add-ons can have a noticeable performance impact on firefox. this is evident when opening a firefox profile that has many
add-ons installed; some profiles can take minutes to load, which is a serious inconvenience for users that gives them a negative view of firefox.
add-on developers need to make sure that they minimize their
add-ons' performance impact, and here are a few simple guidelines that should be followed to achieve that. ...
...evident when opening a firefox profile that has many
add-ons installed; some profiles can take minutes to load, which is a serious inconvenience for users that gives them a negative view of firefox.
add-on developers need to make sure that they minimize their
add-ons' performance impact, and here are a few simple guidelines that should be followed to achieve that. startup this is the area where
add-ons have the most noticeable impact. most
add-ons use the load event handler in the main overlay to initialize their objects and sometimes read files or even fetch remote data. the problem with the onload event is that it runs before the main window becomes visible, so all handlers need to complete before the user can see the window. ...
...llowed to achieve that. startup this is the area where
add-ons have the most noticeable impact. most
add-ons use the load event handler in the main overlay to initialize their objects and sometimes read files or even fetch remote data. the problem with the onload event is that it runs before the main window becomes visible, so all handlers need to complete before the user can see the window. an
add-on can normally
add a few hundred milliseconds to startup time because of the load handler, and it's not hard to figure out what having several
add-ons will do. luckily, minimizing your startup time is easy, if you follow these guidelines: do not load or run code before it’s needed. ...
...And 8 more matches
Creating a spell check dictionary add-on
such a dictionary consists of two files, one with a .dic and one with an .aff file extension. a locale code to describe the language of the dictionary. for example en-us, de-de or da. ...
...such a dictionary consists of two files, one with a .dic and one with an .aff file extension. a locale code to describe the language of the dictionary. for example en-us, de-de or da. ...
...ionary against the language of a web page in order to select the right dictionary to use. if you are creating a new dictionary, as opposed to updating an existing one, please make sure that there is not already a dictionary available for your locale. if there already is one, try contacting the author to get it updated, or contact amo editors if the author does not respond. packaging a firefox
add-on is a zip file renamed to use an .xpi file extension instead of the normal .zip file extension. to create a dictionary
add-on, simply create a zip file which contains the following files and folders: my-dictionary.xpi install.rdf dictionaries/ locale-code.dic locale-code.aff the .dic and .aff files must be placed in a subfolder named dictionaries within the zip file. both f...
...And 8 more matches
Cache.addAll() - Web APIs
you can specify the request object instead of the url. return value a promise that resolves with undefined. ...
...you can specify the request object instead of the url. return value a promise that resolves with undefined. ...
...you can specify the request object instead of the url. return value a promise that resolves with undefined. ...
...And 8 more matches
PaymentRequest.shippingAddress - Web APIs
// initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
... // initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
... // initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
...And 8 more matches
Add-ons - Archive of obsolete content
bookmarks.export() exports bookmarks to an html bookmark file. bookmarks.import() imports bookmarks from an html bookmark file. bootstrapped extensions browser.bookmarks.export( function() {...} // optional function ) code snippets … creating custom firefox extensions with the mozilla build system there is a wealth of material on creating extensions for firefox. ...
...( function() {...} // optional function ) code snippets … creating custom firefox extensions with the mozilla build system there is a wealth of material on creating extensions for firefox. all of these documents currently assume, however, that you are developing your extension using xul and javascript only. for complex extensions, it may be necessary to create components in c++ that provide
additional functionality. extension etiquette this article describes best practices when making extensions, including how to be kind to your users. it assumes that you are already familiar with building an extension. extension packaging extensions are packaged in a form of installable bundle which can be downloaded and installed by a user, or provided pre-packaged with an application or by an ext...
...al program. extensions use a directory structure which can provide chrome, components, and other files to extend the functionality of an xul program. extensions support in seamonkey 2 starting with seamonkey 2 alpha 1 seamonkey supports toolkit/-style extensions. these type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. firefox
addons developer guide the original document is in japanese and distributed via the xuldev.org website. so there may be still some reference to the xuldev website (we want to host source code on mdc, not on xuldev), and to japanese things (like some specific locales, which have been translated to french since non-latin characters are not well supported). hotfix extension this document has been mov...
...And 7 more matches
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. ...
...his assessment is quite challenging. read the whole assessment before you start coding, and take each step slowly and carefully. it might be a good idea to save a separate copy of the demo after you get each stage working, so you can refer back to it if you find yourself in trouble later on. project brief our bouncy ball demo is fun, but now we want to make it a little bit more interactive by
adding a user-controlled evil circle, which will eat the balls if it catches them. we also want to test your object-building skills by creating a generic shape() object that our balls and evil circle can inherit from. finally, we want to
add a score counter to track the number of balls left to capture. the following screenshot gives you an idea of what the finished program should look like: to...
...ture. the following screenshot gives you an idea of what the finished program should look like: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do. creating our new objects first of all, change your existing ball() constructor so that it becomes a shape() constructor and
add a new ball() constructor: the shape() constructor should define the x, y, velx, and vely properties in the same way as the ball() constructor did originally, but not the color and size properties. it should also define a new property called exists, which is used to track whether the balls exist in the program (have not been eaten by the evil circle). this should be a boolean (true/false). th...
...And 7 more matches
Add-on Repository
the
add-on repository is responsible for finding available
add-ons; it provides an interface for interacting with the
addons.mozilla.org (amo) site. its api provides urls that can be visited to browse the repository's
add-ons. the api also offers two ways to search for and retrieve an array of
addon instances: retrieverecommended
addons(), which returns a list of recommended
add-ons, and search
addons(), which performs a search of the repository. these searches are asynchronous; results are passed to the provided searchcallback object when the search is completed. results passed to the searchcallback object only include
add-ons that are compatible with the current application and are not already installed or in the process of being installed. ...
...ns a list of recommended
add-ons, and search
addons(), which performs a search of the repository. these searches are asynchronous; results are passed to the provided searchcallback object when the search is completed. results passed to the searchcallback object only include
add-ons that are compatible with the current application and are not already installed or in the process of being installed.
addonrepository can only process one search at a time. a new search will immediately fail if the
addonrepository is already handling another search request. ...
...callback object when the search is completed. results passed to the searchcallback object only include
add-ons that are compatible with the current application and are not already installed or in the process of being installed.
addonrepository can only process one search at a time. a new search will immediately fail if the
addonrepository is already handling another search request. ...
...And 7 more matches
padding-block - CSS: Cascading Style Sheets
the p
adding-block css shorthand property defines the logical block start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
... the p
adding-block css shorthand property defines the logical block start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
... the p
adding-block css shorthand property defines the logical block start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
...And 7 more matches
padding-inline - CSS: Cascading Style Sheets
the p
adding-inline css shorthand property defines the logical inline start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
... the p
adding-inline css shorthand property defines the logical inline start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
... the p
adding-inline css shorthand property defines the logical inline start and end p
adding of an element, which maps to physical p
adding properties depending on the element's writing mode, directionality, and text orientation. ...
...And 7 more matches
Testing the Add-on SDK - Archive of obsolete content
from
add-on sdk repository with a checkout of the mozilla/
addon-sdk repository (or a checkout of the m-c repo and cd into the
addon-sdk/source directory) there are many means to run the
addon-sdk tests. with cfx cfx tests use the deprecated sdk/loader/cuddlefish, which is being replaced by toolkit/loader. with cfx (which is part of the
addon-sdk repo), we can run the first test suite which was produced for the
add-on sdk. this includes: cfx testcfx: a suite of python tests which test cfx itself (which is written in python). this suite basically tests cfx xpi's ability to produce the xpi files that we expect it to. cfx testex --filter <
addon_example_folder_name>: a suite of tests which run test code for some example
add-ons. this suite builds the example code, then runs these exam...
...ced for the
add-on sdk. this includes: cfx testcfx: a suite of python tests which test cfx itself (which is written in python). this suite basically tests cfx xpi's ability to produce the xpi files that we expect it to. cfx testex --filter <
addon_example_folder_name>: a suite of tests which run test code for some example
add-ons. this suite builds the example code, then runs these example
add-on's test code. cfx test
addons --filter <
addon_folder_name>: a suite of tests which run
add-ons, which are themseleves tests. this suite builds
add-ons which are tests (ie: their main.js script's merely run tests and close firefox when their tests are done), and runs them as cfx run would. cfx testpkgs --filter <file_name>:<test_name>: a suite of tests which run sdk module unit tests. this su...
...test
addons --filter <
addon_folder_name>: a suite of tests which run
add-ons, which are themseleves tests. this suite builds
add-ons which are tests (ie: their main.js script's merely run tests and close firefox when their tests are done), and runs them as cfx run would. cfx testpkgs --filter <file_name>:<test_name>: a suite of tests which run sdk module unit tests. this suite builds the entire
addon-sdk repo as an
add-on, like cfx xpi would, then runs the
add-on like cfx test would. the majority of the tests run here are module unit tests, but there are various other tests included here as well. note: you must remember to run source bin/activate in order to enable cfx first. with jpm jpm tests all use the new toolkit/loader. ...
...And 6 more matches
Add a Context Menu Item - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to
add items and submenus to the firefox context menu, use the context-menu module. here's an
add-on that
adds a new context menu item. the item is displayed whenever something in the page is selected. ...
... to follow this tutorial you'll need to have learned the basics of jpm. to
add items and submenus to the firefox context menu, use the context-menu module. here's an
add-on that
adds a new context menu item. the item is displayed whenever something in the page is selected. ...
...-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', onmessage: function (selectiontext) { console.log(selectiontext); } }); try it: run the
add-on, load a web page, select some text and right-click. you should see the new item appear: click it, and the selection is logged to the console (or the shell, if you're running an instance of firefox from the command line): info: elephantine lizard details all this
add-on does is to construct a context menu item. you don't need to
add it: once you have constructed the item, it is automatic...
...And 6 more matches
Adding Events and Commands - Archive of obsolete content
« previousnext » event handlers just like with html, most javascript code execution is triggered by event handlers attached to dom elements. 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. another way to attach event handlers, just like html, is to place the handler in the xul code: <overlay id="...
...ance impact on firefox. another way to attach event handlers, just like html, is to place the handler in the xul code: <overlay id="xulschoolhello-browser-overlay" onload="xulschoolchrome.browseroverlay.init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> we prefer the first method because it keeps a better separation of content and behavior. also, note that the
addeventlistener method receives the event name without the "on" prefix, while element attributes do have the prefix. there's a long list of events you can listen to, and which you use depend on the situation. elements only implement the events that are relevant to them, but there are several events that are implemented for most elements. these are some notable events you should keep in mind: onco...
... the selection in a tree or listbox changes. onclick. triggered when the user clicks on the element, including right clicks. you shouldn't normally use this event to trigger actions on input controls such as buttons. use oncommand instead. onfocus and onblur. used when an element receives or loses focus when the user is navigating with the keyboard. you can combine these with -moz-user-focus to
add custom focus behavior to elements that normally wouldn't have it. drag and drop. drag and drop operations involve several events. since drag and drop is a complicated thing to manage, there are some high level wrappers that facilitate working with it. also keep in mind that there are 2 drag and drop apis, the newest (and preferred) one introduced in firefox 3.5. event handlers can take an even...
...And 6 more matches
addFile - Archive of obsolete content
addfile unpacks a single subcomponent into a temporary location. queues the subcomponent for
addition to the client version registry and installation to its final destination. ...
...
addfile unpacks a single subcomponent into a temporary location. queues the subcomponent for
addition to the client version registry and installation to its final destination. ...
...
addfile unpacks a single subcomponent into a temporary location. queues the subcomponent for
addition to the client version registry and installation to its final destination. ...
...And 6 more matches
PaymentAddress - Web APIs
the payment
address interface of the payment request api is used to store shipping or payment
address information. it may be useful to refer to the universal postal union web site's
addressing s42 standard materials, which provide information about international standards for postal
addresses. properties payment
address.
addressline read only an array of domstring objects providing each line of the
address not included among the other properties. the exact size and content varies by country or location and can include, for example, a street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box number. ...
... for postal
addresses. properties payment
address.
addressline read only an array of domstring objects providing each line of the
address not included among the other properties. the exact size and content varies by country or location and can include, for example, a street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box number. payment
address.country read only a domstring specifying the country in which the
address is located, using the iso-3166-1 alpha-2 standard. the string is always given in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". payment
address.city read only a domstring which contains the city or town portion of the
address. ...
... office box number. payment
address.country read only a domstring specifying the country in which the
address is located, using the iso-3166-1 alpha-2 standard. the string is always given in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". payment
address.city read only a domstring which contains the city or town portion of the
address. payment
address.dependentlocality read only a domstring giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or uk dependent locality. payment
address.organization read only a domstring specifying the name of the organization, firm, company, or institution at the payment
address. ...
...And 6 more matches
RTCPeerConnection.addIceCandidate() - Web APIs
when a web site or app using rtcpeerconnection receives a new ice candidate from the remote peer over its signaling channel, it delivers the newly-received candidate to the browser's ice agent by calling rtcpeerconnection.
addicecandidate(). this
adds this new remote candidate to the rtcpeerconnection's remote description, which describes the state of the remote end of the connection. if the candidate parameter is missing or a value of null is given when calling
addicecandidate(), the
added ice candidate is an "end-of-candidates" indicator. the same is the case if the value of the specified object's candidate is either missing or an empty string (""), it signals that all remote candidates have been delivered. the end-of-candidates notification is transmitted to the remote peer using a candi...
... is transmitted to the remote peer using a candidate with an a-line value of end-of-candidates. during negotiation, your app will likely receive many candidates which you'll deliver to the ice agent in this way, allowing it to build up a list of potential connection methods. this is covered in more detail in the articles webrtc connectivity and signaling and video calling. ...
... peer using a candidate with an a-line value of end-of-candidates. during negotiation, your app will likely receive many candidates which you'll deliver to the ice agent in this way, allowing it to build up a list of potential connection methods. this is covered in more detail in the articles webrtc connectivity and signaling and video calling. syntax apromise = pc.
addicecandidate(candidate);
addicecandidate(candidate, successcallback, failurecallback); parameters candidate optional an object conforming to the rtcicecandidateinit dictionary, or an rtcicecandidate object; the contents of the object should be constructed from a message received over the signaling channel, describing a newly received ice candidate that's ready to be delivered to the local ice agent. if no candida...
...And 6 more matches
RTCPeerConnectionIceErrorEvent.address - Web APIs
this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. ...
... this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. ...
... this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. ...
...And 6 more matches
Adding a Button to the Toolbar - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to
add a button to the toolbar, use the action button or toggle button modules. create a new directory, navigate to it, and execute jpm init, accepting all the defaults. ...
...to the toolbar, use the action button or toggle button modules. create a new directory, navigate to it, and execute jpm init, accepting all the defaults. ...
...the action button or toggle button modules. create a new directory, navigate to it, and execute jpm init, accepting all the defaults. ...
...And 5 more matches
Adding HTML Elements - Archive of obsolete content
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. ...
...d 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. xhtml namespace in order to use html elements in a xul file, you must declare that you are doing so using the xhtml namespace. this way, mozilla can distinguish the html tags from the xul ones. ...
...elow should be
added to the window tag of the xul file, or to the outermost html element. xmlns:html="http://www.w3.org/1999/xhtml" this is a declaration of html much like the one we used to declare xul. this must be entered exactly as shown or it won't work correctly. note that mozilla does not actually download this url, but it does recognize it as being html. ...
...And 5 more matches
AddonInstall
an
addoninstall instance tracks download and installation process of an
add-on. instances can be created using the getinstallforfile() or getinstallforurl() methods on the
addonmanager. once you have an instance the install() method is used to start automatic download and installation. this can be canceled at any time with the cancel() method. method overview void install() void cancel() void
addlistener(in installlistener listener) void removelistener(in installlistener listener) properties attribute type description name string the name of the
add-on being installed. version string the version of the
add-on being installed. iconurl string the icon of the
add-on being installed. ...
...ner) properties attribute type description name string the name of the
add-on being installed. version string the version of the
add-on being installed. iconurl string the icon of the
add-on being installed. releasenotesuri nsiuri the uri of release notes for this install. type string the type of the
add-on being installed. state integer the state of the installation. error integer if an error has been encountered during the download or install this will hold the error code. sourceuri nsiuri the uri that the
add-on is being installed from. ...
...tes for this install. type string the type of the
add-on being installed. state integer the state of the installation. error integer if an error has been encountered during the download or install this will hold the error code. sourceuri nsiuri the uri that the
add-on is being installed from. file nsifile the file that the
add-on is being installed from. this may be null if the
add-on is coming from the internet and has yet to be downloaded. progress integer the progress of any necessary downloads. maxprogress integer the expected size of any necessary downloads or -1 if unknown. ...
...And 5 more matches
AddonUpdateChecker
the
addonupdatechecker is used to download and parse update information for an
add-on's update manifest. if all you care about is finding the newest version for an
addon then you probably want to use findupdates() instead. ...
... the
addonupdatechecker is used to download and parse update information for an
add-on's update manifest. if all you care about is finding the newest version for an
addon then you probably want to use findupdates() instead. ...
... the
addonupdatechecker is used to download and parse update information for an
add-on's update manifest. if all you care about is finding the newest version for an
addon then you probably want to use findupdates() instead. ...
...And 5 more matches
PR FreeAddrInfo
returns the function doesn't return anything. ...
... returns the function doesn't return anything. ...
... returns the function doesn't return anything. ...
...And 5 more matches
JS_AddFinalizeCallback
cb jsfinalizecallback pointer to the new callback function to use. data void * passed to data parameter for jsfinalizecallback. ...
... cb jsfinalizecallback pointer to the new callback function to use. data void * passed to data parameter for jsfinalizecallback. ...
... cb jsfinalizecallback pointer to the new callback function to use. data void * passed to data parameter for jsfinalizecallback. ...
...And 5 more matches
Address book sync client design
warning: the content of this article may be out of date. it was imported from mozilla.org and last updated in 2000. by richard h. pizzarro <rhp@netscape.com> contents overview client side sync logic public interfaces overview there is an component available in the mozilla tree for performing synchronization operations against a server based
address book. the general architecture for the sync component is the following: mozilla ui ab sync logic mork ab database sync protocol encoding sync protocol decoding http "post" api ...
...ol encoding sync protocol decoding http "post" api mozilla networking client side sync logic the client synchronization logic defers to the server peforming some intelligence in handling duplicate entries for the sync process. the static information that is held on the client for
address book sync operations is stored in a file called absync.dat which is located in the root directory of the users profile information. // // the client keeps a sync mapping table which holds the following: // // serverrecordid - unique id for a record provided by the // uab server. // localrecordid - local unique id, for mobile devices this // ...
...nt keeps a sync mapping table which holds the following: // // serverrecordid - unique id for a record provided by the // uab server. // localrecordid - local unique id, for mobile devices this // is assigned by the mobile device. // crc - crc of the record last time we synced. // flags - operation to apply to this record. ...
...And 5 more matches
DataTransferItemList.add() - Web APIs
type a string of the drag item's type. some example types are text/html and text/plain. file a file object. no type needs to be given in this case. return value a datatransferitem containing the specified data. ...
... type a string of the drag item's type. some example types are text/html and text/plain. file a file object. no type needs to be given in this case. return value a datatransferitem containing the specified data. ...
... type a string of the drag item's type. some example types are text/html and text/plain. file a file object. no type needs to be given in this case. return value a datatransferitem containing the specified data. ...
...And 5 more matches
HTMLSelectElement.add() - Web APIs
if this parameter is null (or the index does not exist), the new element is appended to the end of the collection. exceptions a domerror of the type hierarchyrequesterror if the item passed to the method is an ancestor of the htmlselectelement. ...
...domerror of the type hierarchyrequesterror if the item passed to the method is an ancestor of the htmlselectelement. examples creating elements from scratch var sel = document.createelement("select"); var opt1 = document.createelement("option"); var opt2 = document.createelement("option"); opt1.value = "1"; opt1.text = "option: value 1"; opt2.value = "2"; opt2.text = "option: value 2"; sel.
add(opt1, null); sel.
add(opt2, null); /* produces the following, conceptually: <select> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional. so the following is accepted. ... sel.
add(opt1); sel.
add(opt2); ... append to an existing collection var sel = document.getelementbyid("existinglist"); var opt ...
...t> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional. so the following is accepted. ... sel.
add(opt1); sel.
add(opt2); ... ...
...And 5 more matches
padding-block-end - CSS: Cascading Style Sheets
the p
adding-block-end css property defines the logical block end p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...k end p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...
adding depending on the element's writing mode, directionality, and text orientation. 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 /* <length> values */ p
adding-block-end: 10px; /* an absolute length */ p
adding-block-end: 1em; /* a length relative to the text size */ /* <percentage> value */ p
adding-block-end: 5%; /* a p
adding relative to the block container's width */ /* global values */ p
adding-block-end: inherit; p
adding-block-end: initial; p
adding-block-end: unset; values the p
adding-block-end property takes the same values as the p
adding-left property. description this proper...
...And 5 more matches
padding-block-start - CSS: Cascading Style Sheets
the p
adding-block-start css property defines the logical block start p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...start p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...ding depending on the element's writing mode, directionality, and text orientation. 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 /* <length> values */ p
adding-block-start: 10px; /* an absolute length */ p
adding-block-start: 1em; /* a length relative to the text size */ /* <percentage> value */ p
adding-block-start: 5%; /* a p
adding relative to the block container's width */ /* global values */ p
adding-block-start: inherit; p
adding-block-start: initial; p
adding-block-start: unset; values the p
adding-block-start property takes the same values as the p
adding-left property. description ...
...And 5 more matches
padding-inline-end - CSS: Cascading Style Sheets
the p
adding-inline-end css property defines the logical inline end p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...e end p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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
adding depending on the element's writing mode, directionality, and text orientation. 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 /* <length> values */ p
adding-inline-end: 10px; /* an absolute length */ p
adding-inline-end: 1em; /* a length relative to the text size */ /* <percentage> value */ p
adding-inline-end: 5%; /* a p
adding relative to the block container's width */ /* global values */ p
adding-inline-end: inherit; p
adding-inline-end: initial; p
adding-inline-end: unset; values the p
adding-inline-end property takes the same values as the p
adding-left property. description this proper...
...And 5 more matches
padding-inline-start - CSS: Cascading Style Sheets
the p
adding-inline-start css property defines the logical inline start p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...start p
adding of an element, which maps to a physical p
adding depending on the element's writing mode, directionality, and text orientation. 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. ...
...
adding depending on the element's writing mode, directionality, and text orientation. 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 /* <length> values */ p
adding-inline-start: 10px; /* an absolute length */ p
adding-inline-start: 1em; /* a length relative to the text size */ /* <percentage> value */ p
adding-inline-start: 5%; /* a p
adding relative to the block container's width */ /* global values */ p
adding-inline-start: inherit; p
adding-inline-start: initial; p
adding-inline-start: unset; values the p
adding-inline-start property takes the same values as the p
adding-left property. description...
...And 5 more matches
addDirectory - Archive of obsolete content
adddirectory unpacks an entire directory into a temporary location. ...
...
adddirectory unpacks an entire directory into a temporary location. ...
...
adddirectory unpacks an entire directory into a temporary location. ...
...And 4 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
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. ...
... 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. ...
... fields are used to hold a simple value. ...
...And 4 more matches
Adding a new event
what type of event do you want? roughly, there are 3 types of event. first, you need to choose which type you need. a simple dom event which can be implemented with webidl and widgetevent or something. this type of event is useful if the event isn't handled by c++ code. a dom event which represents a native event like a user action such as keyboard or mouse input. this type of event allows c++ code to handle it easier. it's not a dom event. however, c++ code may need to dispatch an event to dom tree and handle it with c++ event handler. this is useful for widget notifying dom tree of something or retrieving something from dom tree. ...
...se input. this type of event allows c++ code to handle it easier. it's not a dom event. however, c++ code may need to dispatch an event to dom tree and handle it with c++ event handler. this is useful for widget notifying dom tree of something or retrieving something from dom tree. how to implement an internal event class if you're in case 1 (a simple dom event), you can skip this section.
add event messages you need to
add event messages which are stored by widgetevent::message. all messages are defined by macro in "messages" section of basicevents.h. define event class name you need to
add an event class name in eventclasslist.h. use ns_event_class macro for
adding it. the macro takes two arguments, aprefix and aname. aprefix defines prefix of event class name which should be wi...
...ld be just copied since assignfooeventdata() doesn't copy mflags. this method is basically used for duplicating an internal event class instance of a dom event when the dom event is stored by content. void assignfooeventdata(const internalfooevent* aevent, bool acopytargets) this method should copy members from aevent. first, this method should call its super class's this method. then, copy the
additional members which are defined in the class. if acopytargets is false, don't copy its event target related members. all new member variables of event classes must be with "m" prefix. although, a lot of existing members don't have "m" prefix, but you shouldn't use the legacy local rules. if you need to
add methods, it's okay to implement them as inline methods. i.e., you can implement new met...
...And 4 more matches
Adding APIs to the navigator object
starting with gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6), you can easily
add new apis to the window.navigator object by using the category manager. simply
add an entry to the "javascript-navigator-property" category. the object must be implemented as an xpcom component. each method below of
adding new objects to the navigator object requires that the new object is a registered xpcom component. you can read about creating and registering xpcom components in javascript. ...
... window.navigator object by using the category manager. simply
add an entry to the "javascript-navigator-property" category. the object must be implemented as an xpcom component. each method below of
adding new objects to the navigator object requires that the new object is a registered xpcom component. you can read about creating and registering xpcom components in javascript. ...
...
adding new objects to the navigator object requires that the new object is a registered xpcom component. you can read about creating and registering xpcom components in javascript. programmatically
adding an object to navigator var categorymanager = components.classes["@mozilla.org/categorymanager;1"] .getservice(components.interfaces.nsicategorymanager); categorymanager.
addcategoryentry("javascript-navigator-property", "myapi", my_contract_id, false, true); this
adds a new object, myapi, to the window.navigator object. the newly
added object is a reference to the component specified by the contract id my_contract_id. you can learn more about contract ids are unique text identifiers for xpcom components. ...
...And 4 more matches
Cache.add() - Web APIs
this can be a request object or a url. return value a promise that resolves with undefined. ...
...this can be a request object or a url. return value a promise that resolves with undefined. ...
...this can be a request object or a url. ...
...And 4 more matches
CanvasRenderingContext2D.addHitRegion() - Web APIs
when provided, it is an object which can contain the following properties: path a path2d object describing the area of the hit region. if not provided, the current path is used. fillrule the algorithm by which to determine if a point is inside or outside the hit region. possible values: nonzero: the non-zero winding rule. default rule. evenodd: the even-odd winding rule. ...
...nvas element's cursor. control an element (descendant of the canvas) to which events are to be routed. defaults to null. label a text label for accessibility tools to use as a description of the region, if there is no control. defaults to null. role an aria role for accessibility tools to determine how to represent this region, if there is no control. defaults to null. ...
...dant of the canvas) to which events are to be routed. defaults to null. label a text label for accessibility tools to use as a description of the region, if there is no control. defaults to null. role an aria role for accessibility tools to determine how to represent this region, if there is no control. defaults to null. examples using the
addhitregion method this example demonstrates the
addhitregion() method. ...
...And 4 more matches
MediaQueryList.addListener() - Web APIs
in the original implementation, the callback was a non-standard mediaquerylistlistener object. ...
...in the original implementation, the callback was a non-standard mediaquerylistlistener object. ...
...in the original implementation, the callback was a non-standard mediaquerylistlistener object. ...
...And 4 more matches
PasswordCredential.additionalData - Web APIs
//the options object was previously created. ...
... //the options object was previously created. ...
... //the options object was previously created. ...
...And 4 more matches
Add-on SDK - Archive of obsolete content
interact with the browser open web pages, listen for pages loading and list open pages. development techniques learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. ...
... interact with the browser open web pages, listen for pages loading and list open pages. development techniques learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. ...
... interact with the browser open web pages, listen for pages loading and list open pages. development techniques learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. ...
...And 3 more matches
Migrating raw components to add-ons - Archive of obsolete content
historically, firefox has allowed third party contributions to be
added to the application's components/ directory, but beginning with firefox 3.6, this is no longer permitted. components
added in this way are invisible to users and cannot be managed through the firefox
add-ons manager. what's worse, though, is that these components don't have a mechanism for specifying the versions of firefox with which they are compatible, leading to poor integration and instability as users upgrade their firefox installations. the firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support. ...
...fox with which they are compatible, leading to poor integration and instability as users upgrade their firefox installations. the firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support. ...
... compatible, leading to poor integration and instability as users upgrade their firefox installations. the firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support. ...
...And 3 more matches
Adding Buttons - Archive of obsolete content
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. ...
... id="identifier" class="dialog" label="ok" image="images/image.jpg" disabled="true" accesskey="t"/> the attributes are as follows, all of which are optional: id a unique identifier so that you can identify the button with. you'll see this attribute on all elements. you'll want to use this if you want to refer to the button in a style sheet or script. however, you should
add this attribute to almost all elements. it isn't always placed on elements in this tutorial for simplicity. class the style class of the button. this works the same as in html. it is used to indicate the style that the button appears in. in this case the value dialog is used. in most cases, you will not use a class for a button. label the label that will appear on the button. for example, ok...
...appears greyed out. we'll start by creating 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. ...
...And 3 more matches
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
this could be useful when trapping the focus and blur events. ...
...this could be useful when trapping the focus and blur events. ...
...efined elements. event handlers as you might expect, mouse clicks, key presses and other events are passed to each of the elements inside the content. however, you may wish to trap the events and handle them in a special way. you can
add event handlers to the elements inside the content if needed. the last example in the previous section demonstrated this. 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. each will describe the action taken for a single event handler. you can use more than one handler if necessary. if an event d...
...And 3 more matches
Adding more elements - Archive of obsolete content
« previousnext » we will conclude the discussion of boxes by
adding some boxes to the find files dialog.
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. <hbox> <menulist id="searchtype"> <menupopup> <menuitem label="name"/> <menuitem label="size"/> <menuitem label="date modified"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <menulist id="searchmode"> <menupopup> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </hbox> two drop down ...
...these spacers have been given an explicit width of 10 pixels each. you will notice that if the window is resized, the textbox grows but the other components do not. you will also notice that the label was removed. if you resize the window vertically, the elements do not change size. this is because they are inside ...
...bel="date modified"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <menulist id="searchmode"> <menupopup> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </hbox> two drop down boxes have been
added to the dialog. a spacer has been
added in between each element to separate them. these spacers have been given an explicit width of 10 pixels each. you will notice that if the window is resized, the textbox grows but the other components do not. you will also notice that the label was removed. if you resize the window vertically, the elements do not change size. this is because they are inside horizontal boxes. in might be more appr...
...And 3 more matches
Add-ons
add-ons allow developers to extend and modify the functionality of firefox. they are written using standard web technologies - javascript, html, and css - plus some dedicated javascript apis. among other things, an
add-on could: change the appearance or content of particular websites modify the firefox user interface
add new features to firefox there are several types of
add-ons, but the most common type are extensions. developing extensions in the past, there were several toolsets for developing firefox extensions, but as of november 2017, extensions must be built using webextensions apis. other toolsets, such as overlay
add-ons, bootstrapped
add-ons, and the
add-on sdk, are no longer supported. extensions written using webextensions apis for firefox are designed to be cross-brow...
...x. you can see the apis currently supported in firefox and other browsers. extension workshop the firefox extension workshop can help you develop extensions for firefox and give your users simple, yet powerful ways to customize their browsing experience. you’ll find: overview of the firefox extension features tools and processes for developing and testing how to publish your extension on
addons.mozilla.org or distribute it yourself how to manage your published extension an enterprise guide for developing and using extensions how to develop themes for firefox firefox developer communities extensions for firefox for android in 2020, mozilla will release a new firefox for android experience. this new, high-performance browser for android has been rebuilt from the ground up using ...
... for android in 2020, mozilla will release a new firefox for android experience. this new, high-performance browser for android has been rebuilt from the ground up using geckoview, mozilla’s mobile browser engine. we are currently building support for the webextensions api on geckoview. ...
...And 3 more matches
PL_HashTableAdd
if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. you can write your freeentry function to free the value of the specified entry if the old value should be freed. ...
... if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. you can write your freeentry function to free the value of the specified entry if the old value should be freed. ...
... if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. you can write your freeentry function to free the value of the specified entry if the old value should be freed. ...
...And 3 more matches
PRNetAddr
type used with socket manipulation functions to specify a network
address. syntax #include <prio.h> union prnet
addr { struct { pruint16 family; char data[14]; } raw; struct { pruint16 family; pruint16 port; pruint32 ip; char pad[8]; } inet; #if defined(_pr_inet6) struct { pruint16 family; pruint16 port; pruint32 flowinfo; pripv6
addr ip; } ipv6; #endif /* defined(_pr_inet6) */ }; typedef union prnet
addr prnet
addr; fields the structure has the following fields: family
address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for ipv6.family. data raw
address data. port port number of tcp or udp, in network byte order. ip the actual 32 (for inet.ip) or 128 (for ipv6.ip) bits of ip...
...by default, nspr is built to support only ipv4, but it's possible to build the nspr library to support both ipv4 and ipv6. ...
... family
address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for ipv6.family. data raw
address data. port port number of tcp or udp, in network byte order. ip the actual 32 (for inet.ip) or 128 (for ipv6.ip) bits of ip
address. the inet.ip field is in network byte order. pad unused. flowinfo routing information. description the union prnet
addr represents a network
address. nspr supports only the internet
address family. by default, nspr is built to support only ipv4, but it's possible to build the nspr library to support both ipv4 and ipv6. therefore, the family field can be pr_af_inet only for default nspr, and can also be pr_af_inet6 if the binary supports ipv6. ...
...And 3 more matches
NS_IF_ADDREF
this page still needs some work, help to improve it! ...
... this page still needs some work, help to improve it! ...
... this page still needs some work, help to improve it! ...
...And 3 more matches
Demo Addon
warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. overview this demo
add-on has been created by jonathan protzenko for his presentation at mozcamp 2011. it shows how to achieve various goals in a working live example, such as working with gloda. you can download it at the bottom of the page. how to use after installing the demo
add-on in thunderbird, right click on the toolbar and choose "customize". drag the "demo" button into the toolbar. afterwards, just click that button to show the demo overview. all three demos are explained in the following sections. only the interesting parts are shown, it's recommended that you download the
add-on and have a look at its files. the basics...
... iterate over any collection and transforms your collection elements in the given objects, to use fixiterator, you have to import it with cu.import("resource:///modules/iteratorutils.jsm");. demo 1 - iterate over all the accounts this demo is implemented in demo1.html in the content folder. it lists all your email accounts with their account type - either pop3 or imap - and the associated email
addresses. let data = []; for each (let account in fixiterator(mailservices.accounts.accounts, ci.nsimsgaccount)) { let info = { server: null, type: null, emails: [], name: null, }; let server = account.incomingserver; if (server) { info.server = server.prettyname; info.type = server.type; } for each (let id in fixiterator(acco...
... data.push(info); } first, we use fixiterator() here to get all accounts in your profile. each account is a nsimsgaccount. to get the the server name, we access the incomingserver property of our account, which is a nsimsgincomingserver object. from this, we get its name and type. because an account can have multiple identities of type nsimsgidentity and therefore multiple associated email
addresses, with use fixiterator() again to go over all identities and get every email
address. demo 2 - find the inbox this demo shows various information: it lists all folders of an account (in this case the first one) and marks the inbox folder with a *. furthermore, it shows some messages in the inbox and lists a random attachment. we start with listing all folders and marking the inbox: let s...
...And 3 more matches
CSSNumericValue.add() - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
...And 3 more matches
CanvasGradient.addColorStop() - Web APIs
the gradient is then used to fill a rectangle. ...
...the gradient is then used to fill a rectangle. ...
...t, color); parameters offset a number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end; an index_size_err is raised if the number is outside that range. color a css <color> value representing the color of the stop. a syntax_err is raised if the value cannot be parsed as a css <color> value. ...
...And 3 more matches
MediaSource.addSourceBuffer() - Web APIs
exceptions invalidaccesserror the value specified for mimetype is an empty string rather than a valid mime type. invalidstateerror the mediasource is not in the "open" readystate. ...
... exceptions invalidaccesserror the value specified for mimetype is an empty string rather than a valid mime type. invalidstateerror the mediasource is not in the "open" readystate. ...
... exceptions invalidaccesserror the value specified for mimetype is an empty string rather than a valid mime type. invalidstateerror the mediasource is not in the "open" readystate. ...
...And 3 more matches
PaymentRequest: shippingaddresschange event - Web APIs
the shipping
addresschange event is sent to the paymentrequest object when the user selects a shipping
address or changes details of their shipping
address. bubbles no cancelable no interface paymentrequestupdateevent event handler property onshipping
addresschange usage notes depending on the browser, the shipping
address information may be redacted for privacy reasons. that is, the payment
address which contains the shipping
address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their
address). ...
...
address information may be redacted for privacy reasons. that is, the payment
address which contains the shipping
address may have some portions of its content altered, obscured, or left out entirely in order to prevent 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 shipping
addresschange event is set up to validate that the
address meets requirements set by the web application. ...
...ly in order to prevent 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 shipping
addresschange event is set up to validate that the
address meets requirements set by the web application. ...
...And 3 more matches
PaymentResponse.shippingAddress - Web APIs
the shipping
address read-only property of the paymentrequest interface returns a payment
address object containing the shipping
address provided by the user. syntax var shipping
address = paymentrequest.shipping
address; value a payment
address object providing details comprising the shipping
address provided by the user. example generally, the user agent will fill the shipping
address property for you. you can trigger this by setting paymentoptions.requestshipping to true when calling the paymentrequest constructor. in the example below, the cost of shipping varies by geography. when the paymentrequest.onshipping
addresschange is called, updatedetails() is called to update the details of the paymentrequest, using shipping
address to set the correct shipping cost. // initialization of pa...
...xample below, the cost of shipping varies by geography. when the paymentrequest.onshipping
addresschange is called, updatedetails() is called to update the details of the paymentrequest, using shipping
address to set the correct shipping cost. // initialization of paymentrequest arguments are excerpted for brevity. var payment = new paymentrequest(supportedinstruments, details, options); request.
addeventlistener('shipping
addresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shipping
address, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); function upd...
...sschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shipping
address, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. ...
...And 3 more matches
RTCIceCandidate.address - Web APIs
the rtcicecandidate interface's read-only
address property is a string providing the
address of the device which is the source of the candidate.
address is null by default if not otherwise specified. the
address field's value is set when the rtcicecandidate() constructor is used. you can't specify the
address in the options object, but the
address is automatically extracted from the candidate a-line, if it's formatted properly. syntax var
address = rtcicecandidate.
address; value a domstring providing the ip
address from which the candidate comes. note: if port is null — and port is supported by the user agent — passing the candidate to
addicecandidate() will fail, throwing an operationerror exception. security notes it's important to note here that although webrtc does not requ...
...dress; value a domstring providing the ip
address from which the candidate comes. note: if port is null — and port is supported by the user agent — passing the candidate to
addicecandidate() will fail, throwing an operationerror exception. security notes it's important to note here that although webrtc does not require the two peers on an rtcpeerconnection to know one another's true ip
addresses, the
address property on rtcicecandidate 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. ...
...t require the two peers on an rtcpeerconnection to know one another's true ip
addresses, the
address property on rtcicecandidate 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. ...
...And 3 more matches
RTCPeerConnection: addstream event - Web APIs
the obsolete
addstream event is sent to an rtcpeerconnection when new media, in the form of a mediastream object, has been
added to it. important: this event has been removed from the webrtc specification. you should instead watch for the track event, which is sent for each media track
added to the rtcpeerconnection. bubbles no cancelable no interface mediastreamevent event handler property rtcpeerconnection.on
addstream you can, similarly, watch for streams to be removed from the connection by monitoring the removestream event. examples this example looks to determine if the user's browser supports the track event. if it does, a track event listener is set up; otherwise, an
addstream event listener is set up. pc is an rtcpeerconn...
... event handler property rtcpeerconnection.on
addstream you can, similarly, watch for streams to be removed from the connection by monitoring the removestream event. examples this example looks to determine if the user's browser supports the track event. if it does, a track event listener is set up; otherwise, an
addstream event listener is set up. pc is an rtcpeerconnection. if (pc.
addtrack !== undefined) { pc.ontrack = ev => { ev.streams.foreach(stream => do
addstream(stream)); } } else { pc.on
addstream = ev => { do
addstream(ev.stream); } } this calls a function do
addstream() once for each stream being
added to the rtcpeerconnection, regardless of whether the browser sends
addstream or track. ...
...et up. pc is an rtcpeerconnection. if (pc.
addtrack !== undefined) { pc.ontrack = ev => { ev.streams.foreach(stream => do
addstream(stream)); } } else { pc.on
addstream = ev => { do
addstream(ev.stream); } } this calls a function do
addstream() once for each stream being
added to the rtcpeerconnection, regardless of whether the browser sends
addstream or track. ...
...And 3 more matches
SpeechGrammarList.addFromURI() - Web APIs
weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. the value can be between 0.0 and 1.0; if not specified, the default used is 1.0. ...
... weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. ...
... draft ...
...And 3 more matches
padding-bottom - CSS: Cascading Style Sheets
the p
adding-bottom css property sets the height of the p
adding area on the bottom of an element. 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
...n 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
...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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. syntax /* <length> values */ p
adding-bottom: 0.5em; p
adding-bottom: 0; p
adding-bottom: 2cm; /* <percentage> value */ p
adding-bottom: 10%; /* global values */ p
adding-bottom: inherit; p
adding-bottom: initial; p
adding-bottom: unset; the p
adding-bottom property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for p
adding. values <length> the size of the p
adding as a fixed value. must be no...
...And 3 more matches
padding-right - CSS: Cascading Style Sheets
the p
adding-right css property sets the width of the p
adding area on the right of an element. 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
... 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
...y. 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. syntax /* <length> values */ p
adding-right: 0.5em; p
adding-right: 0; p
adding-right: 2cm; /* <percentage> value */ p
adding-right: 10%; /* global values */ p
adding-right: inherit; p
adding-right: initial; p
adding-right: unset; the p
adding-right property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for p
adding. values <length> the size of the p
adding as a fixed value. must be nonnegati...
...And 3 more matches
scroll-padding-block - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
...this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
...as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
...And 3 more matches
scroll-padding-inline - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...s the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...And 3 more matches
scroll-padding - CSS: Cascading Style Sheets
the scroll-p
adding shorthand property sets scroll p
adding on all sides of an element at once, much like the p
adding property does for p
adding on an element. 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 scroll-p
adding-* properties define offsets for the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport. c...
...s the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
... placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
...And 3 more matches
Developing add-ons - Archive of obsolete content
mozilla based software is typically extensible through
add-ons. there are three primary types of
add-on: extensions, plugins, and themes. this page will help guide you to the information you need in order to create
add-ons for firefox, thunderbird, or other software based on the mozilla platform, as well as how to distribute your
add-ons.
add-ons topics submitting an
add-on to amo provides helpful information for
add-on developers to help them properly package and deliver their
add-ons. this includes information about
addons.mozilla.org, mozilla's
add-on distribution web site. ...
... plugins information about how to create plugins, which are binary components that let mozilla based software display content they can't handle natively. ...
... plugins information about how to create plugins, which are binary components that let mozilla based software display content they can't handle natively. jetpack browser extension development for everyone. ...
...And 2 more matches
Adding menus and submenus - Archive of obsolete content
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. ...
...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. ...
... your menu takes a noticeable amount of time, you should not 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 previous 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-h...
...And 2 more matches
Adding sidebars - Archive of obsolete content
it's even simpler than that. all you need is to overlay the view sidebar menu. ...
...it's even simpler than that. all you need is to overlay the view sidebar menu. ...
...it's even simpler than that. all you need is to overlay the view sidebar menu. ...
...And 2 more matches
Adding windows and dialogs - Archive of obsolete content
en( "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. this can only be used from the chrome, not from regular html javascript. it indicates that a chrome document is being opened, not a web page. this means that the ...
...'s the big deal about defining a simple xul window with an ok and maybe a cancel button. the dialogs we have covered in this section are very simple and shouldn't be too hard to implement manually using xul. well, it's more complicated than that. different operating systems order and position their buttons differently in their dialogs. there are also subtle aspects about window size, margins and p
addings that are not the same for all systems, so you should avoid making dialogs from scratch or overriding the default dialog css styles. the dialog element handles all of this transparently. all you need to do is define which buttons you'll need and the actions associated with them. <dialog id="xulschoolhello-hello-dialog" title="&xulschoolhello.hellodialog.title;" buttons="accept,cancel" ...
...ncel" ondialogaccept="return xulschoolchrome.hellodialog.accept();" ondialogcancel="return xulschoolchrome.hellodialog.cancel();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> carefully read the specification of the dialog element. you'll see that you can choose from a wide variety of buttons, associate any action you need to them, override their labels, and even
add completely customized extra buttons. all of this without having to worry about your dialog looking odd in some operating systems. the only constant rule is that clicking on ok and cancel will close the dialog unless your associated function returns false. you should avoid returning false, though, specially with the cancel button. dialogs in general should be easy to dismiss. your dialogs shoul...
...And 2 more matches
Install.addDirectory - Archive of obsolete content
install.
adddirectory the install object's
adddirectory method queues an entire directory for installation once performinstall is called. ...
... install.
adddirectory the install object's
adddirectory method queues an entire directory for installation once performinstall is called. ...
... install.
adddirectory the install object's
adddirectory method queues an entire directory for installation once performinstall is called. ...
...And 2 more matches
Additional Navigation - Archive of obsolete content
ult will be removed from the data. for the second result, such an arc does exist, so the result is kept. like the first result, there is no arc for the third photo, so it is also removed. the resulting data will look like the following: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) here is the example. naturally, we will need to
add a binding for the ?title variable if we wish to display it, or we could just hardcode it since we know the value will be 'canal'. usually you won't be filtering on a title though--you would instead filter on a value that acts like a type. there has to be at least one variable used in a triple in either the subject or the object attributes, or both. you can't have a triple with no variables. that...
....xulplanet.com/rdf/relateditem" object="?start"/> </query> the triple is evaluated in the same manner except that the value of the object can be filled in with the value of the ?start variable. the rdf graph is examined for an arrow pointing in to the node instead of out. in the photos example, we might wish to categorize each photo into several categories. one possibility is to just
add another predicate for each photo with a literal value set to the category. or, we could use a resource for each category. this will allow us to associate
additional properties to each category and more easily navigate the graph in a template. in this case, we will categorize each photo by country where the photo was taken using a country predicate. <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http:...
...note that this predicate uses a new namespace so it is declared on the root rdf element. the titles of the two countries are defined near the end of the rdf data. now that we have countries for each photo, instead of starting at the node 'http://www.xulplanet.com/rdf/myphotos', we could start at a country resource and look for all photos that point to...
...And 2 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
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. ...
...each calls the 'showtitle' method. this method checks to see whether the element is being hidden or shown from the 'state' parameter that is passed in. in either case, it grabs the first element of the anonymous array. this refers to the first child in the content element, which here is the first label widg...
...nt.getanonymousnodes(this)[0].setattribute("style","visibility: collapse"); } </body> </method> </implementation> </binding> the oncommand handlers here first get a reference to their parent bound element. (in this example, it is the box with the labeledbutton class). then, the 'showtitle' method is called, which functions as it did before. custom properties and methods are
added only to the outer xul element the xbl is bound to. none of the elements declared inside the content tag have these properties or methods. this is why we have to get the parent first. the children of an element placed in the xul file can be retrieved in the normal way and don't move even if you use the children tag. for example: xul: <box id="outer" class="container"> <button label="one"/> ...
...And 2 more matches
Adding Style Sheets - Archive of obsolete content
ontains default style information for xul elements. you could leave the line out and the elements will still work, however they will look fairly plain. the style sheet applies various fonts, colors and borders to make the elements look more suitable. changing the styles however, there will be times when the default look of elements will not give the look that is desired. for this, we will need to
add a style sheet of our own. so far, we have been applying styles using the style attribute on elements. although this works, it is not really the best thing to do. it is much better to create a separate style sheet. the reason is so that different looks, or skins, can be applied easily. there may be certain cases where the style attribute is acceptable. an example would be when a script changes the...
...e style sheet is placed in the same directory as findfile.xul. some of the styles in the code above have been removed. one that wasn't was the display property on the progressmeter. this will be changed by a script so it was left in, as it doesn't really make sense to have the progress bar visible initially. you could still put this in a separate style sheet if you really wanted to. ...
... in, as it doesn't really make sense to have the progress bar visible initially. you could still put this in a separate style sheet if you really wanted to. a class was
added to the spacers so that they can be referred to. a style sheet also needs to be created. create a file findfile.css in the same directory as the xul file. (it would normally be put into a separate skin). ...
...And 2 more matches
Adding vector graphics to the Web - Learn web development
pixelate when zoomed in or blown up to a large size. 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. what are vector graphics? on the web, you'll work with two types of image — raster images, and vector images: raster images are defined using a grid of pixels — a raster image file contains information showing exactly where each pixel is to be placed, and exactly what color it should be. popular web raster formats include bitmap (.bmp), png (.png), jpeg (.jpg), and gif ...
..., you can handcode simple svg in a text editor, but for a complex image this quickly starts to get very difficult. for creating svg images, most people use a vector graphics editor like inkscape or illustrator. these packages allow you to create a variety of illustrations using various graphics tools, and create approximations of photos (for example inkscape's trace bitmap feature.) svg has some
additional advantages besides those described so far: text in vector images remains accessible (which also benefits your seo). svgs lend themselves well to styling/scripting, because each component of the image is an element that can be styled via css or scripted via javascript. so why would anyone want to use raster graphics over svg? well, svg does have some disadvantages: svg can get comp...
...ay not be suitable if you need to support older versions of internet explorer with your web site (svg started being supported as of ie9.) raster graphics are arguably better for complex precision images such as photos, for the reasons described above. note: in inkscape, save your files as plain svg to save space. also, please refer to this article describing how to prepare svgs for the web.
adding svg to your pages in this section we'll go through the different ways in which you can
add svg vector graphics to your web pages. the quick way: <img> to embed an svg via an <img> element, you just need to reference it in the src attribute as you'd expect. you will need a height or a width attribute (or both if your svg has no inherent aspect ratio). if you have not already done so, please ...
...And 2 more matches
Adding items to the Folder Pane
that container will have 3 child-items, the numbers 1, 2, and 3. clicking on those items will display the number in the main viewing pane of thunderbird. first, some necessary background on how the folder pane constructs the data it displays. the folder pane tracks modifications to a user's folders and accounts. each time the folder pane determines that it is necessary to invalidate all its data (because of too many changes, or more commonly because the folder pane's "mode" (aka view) has changed), a "rebuild" occurs. ...
... pane rebuilds every time the folder pane rebuilds, it fires a "maprebuild" event, which is the ideal opportunity for extensions to step in and modify the display data. the following code snippet listens for that event: let gnumbersext = { load: function gne_load() { window.removeeventlistener("load", gnumbersext.load, false); let tree = document.getelementbyid("foldertree"); tree.
addeventlistener("maprebuild", gnumbersext._insert, false); }, _insert: function gne__insert() { // this function is called when a rebuild occurs } }; window.
addeventlistener("load", gnumbersext.load, true); the structure of folder-tree-items the folder pane stores its current display data in a property called _rowmap. this property is an array of folder-tree-items. each item in this arr...
...however, the comp...
...And 2 more matches
ContentIndex.add() - Web APIs
title: a string title for the item. used in user-visible lists of content. title: a string title of the item. used in user-visible lists of content. description: a string description of the item. used in user-visible lists of content. url: a string containing the url of the corresponding html document. needs to be under the scope of the current service worker. category: optional a string defining the category of content. can be: '' an empty string, this is the default. ...
...solves with undefined exceptions typeerror if the service worker's registration is not present or the service worker does not contain a fetchevent. if the id, title, description or url are missing, not of type string, or an empty string. if icons images are not of image type. ...
...
add method to register it with the content index. ...
...And 2 more matches
Worklet.addModule() - Web APIs
the
addmodule() method of the worklet interface loads the module in the given javascript file and
adds it to the current worklet. syntax
addpromise = worklet.
addmodule(moduleurl);
addpromise = worklet.
addmodule(moduleurl, options); parameters moduleurl a string containing the url of a javascript file with the module to
add. options optional an object with any of the following options: credentials: a requestcredentials value that indicates whether to send credentials (e.g. cookies and http authentification) when loading the module. can be one of "omit", "same-origin", or "include". defaults to "same-origin". see also request.credentials. return value a promise that resolves once the module from the given url has been
added. the promise doesn't return any value. ...
...tials: a requestcredentials value that indicates whether to send credentials (e.g. cookies and http authentification) when loading the module. can be one of "omit", "same-origin", or "include". defaults to "same-origin". see also request.credentials. return value a promise that resolves once the module from the given url has been
added. the promise doesn't return any value. ...
...'t return any value. exceptions if
addmodule() fails, it rejects the promise, delivering one of the following errors to the rejection handler. aborterror the specified script is invalid or could not be loaded. syntaxerror the specified moduleurl is invalid. ...
...And 2 more matches
padding-left - CSS: Cascading Style Sheets
the p
adding-left css property sets the width of the p
adding area to the left of an element. 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
... 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. syntax /* <length> values */ p
adding-left: 0.5em; p
adding-left: 0; p
adding-left: 2cm; /* <percentage> value */ p
adding-left: 10%; /* global values */ p
adding-left: inherit; p
adding-left: initial; p
adding-left: unset; the p
adding-left property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for p
adding. values <length> the size of the p
adding as a fixed value. mus...
...must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...And 2 more matches
padding-top - CSS: Cascading Style Sheets
the p
adding-top css property sets the height of the p
adding area on the top of an element. 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. ...
...n 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. an element's p
adding area is the space between its content and its border. note: the p
adding property can be used to set p
addings on all four sides of an element with a single declaration. syntax /* <length> values */ p
adding-top: 0.5em; p
adding-top: 0; p
adding-top: 2cm; /* <percentage> value */ p
adding-top: 10%; /* global values */ p
adding-top: inherit; p
adding-top: initial; p
adding-top: unset; the p
adding-top property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for p
adding. values <length> the size of the p
adding as a fixed value. must be non...
...must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...And 2 more matches
Addition (+) - JavaScript
the
addition operator (+) produces the sum of numeric operands or string concatenation. 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
addition operator (+) produces the sum of numeric operands or string concatenation. 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
addition operator (+) produces the sum of numeric operands or string concatenation. 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. ...
...And 2 more matches
Using addresses of stack variables with NSPR threads on win16 - Archive of obsolete content
this is a cautionary note that may be old information for some of you. however, since it affects the portability of code, it was deemed prudent to include a short memo describing the issue. problem statement win-16 (aka, windows 3.1, et al), is unique in that the architecture depends on the operating environment (i.e., windows) knows the
address of the stack, and that there is only one such
address. consequently, implementing threads, with their implication of a unique stack for each thread, requires that the nspr copy the stacks during thread context switches. the actual copying of the stack is not such a hardship as one would imagine. with the speed of today's processors (even those running win-16), the copying of 10 - 50 kilobytes of data between two locations in memory is barel...
...ds, with their implication of a unique stack for each thread, requires that the nspr copy the stacks during thread context switches. the actual copying of the stack is not such a hardship as one would imagine. with the speed of today's processors (even those running win-16), the copying of 10 - 50 kilobytes of data between two locations in memory is barely measurable 1. what is a hardship is that
addresses of dynamic variables, those allocated on the call stack, in a function's local frame, are not valid across thread boundaries. the simplest demonstration of the problem is as follows: typedef struct shareddata { prlock *ml; prcondvar *cv; print32 counter; } shareddata; static void forkedthread(void *arg) { shareddata *shared = (shareddata*)arg; while (--shared->counter ...
...terval(1)); pr_lock(shared.ml); if (0 == shared.counter) break; pr_notifycondvar(shared.cv); pr_unlock(shared.ml); } while (pr_true); rv = pr_jointhread(thread); return (pr_success == rv) ? 0 : 1; } this is a completely correct (albeit trivial) program that will run predictably on all nspr platforms other than win-16. on win-16, the thread's attempt to
address the <tt>shareddata</tt> through the pointer shared will provide interesting (though always incorrect) results. it's difficult to tell exaclty where the updated <tt>counter</tt> is being stored. the only portable manner to write this program requires that the shared structure be allocated from the heap. well, that isn't so hard to remember, is it? what is probably more likely to cause problems...
...>shareddata</tt> through the pointer shared will provide interesting (though always incorrect) results. it's difficult to tell exaclty where the updated <tt>counter</tt> is being stored. the only portable manner to write this program requires that the shared structure be allocated from the heap. well, that isn't so hard to remember, is it? what is probably more likely to cause problems is passing
addresses of automatically allocated variables to a function that wends its way though arbitrary amounts of convoluted logic, and finds its way into an object that is shared. one should be particularly cautious of arrays since they are passed by reference by default. 1 it is possible that our ability to measure the costs is not up to the task. original document information author: larryh@netscap...
addTab - Archive of obsolete content
see code snippets: tabbed browser for examples. ...
... see code snippets: tabbed browser for examples. ...
... see code snippets: tabbed browser for examples. ...
... postdata: ..., owner: ..., allowthirdpartyfixup: ..., relatedtocurrent: ... }) return type: tab element opens a new tab that loads a page with the specified url. the rest of the parameters are optional. the row of tabs will appear if needed. firefox 3.6 note the second form of this method was
added in firefox 3.6; it allows you to specify the parameters by name, in any order. it also
adds the relatedtocurrent parameter; firefox uses this to decide whether the new tab should be inserted next to the current tab. see code snippets: tabbed browser for examples. see preprocessing post data for preparing postdata out of a string. ...
How to add a build-time test
writing a test is good, but it is even more helpful if that test gets executed. we have various automation tools that help make this possible. the first link, though, is the "check" target in a makefile. if a test is
added, that test or its directory needs to be mentioned in a makefile.in file somewhere so that the build system knows about it. standalone executables to
add a test that is written in c or c++ and which is called as a standalone executable, a few things must be done. for standalone executables, if one sets up the right variables, then the rules.mk file will do lots of magic and most of the heavy lifting. a simple example of
adding a test is in . note that the following variables are supplied by the rules.mk file: cppsrcs, simple_programs, run_test_program. xpcshell tests ...
... for now, enclose your test-related code (in the makefile) with ifdef enable_tests run the test program from the "check" target in the makefile. ...
...the test fails, exit with a non-zero status and/or print the string "fail" to stdout if the test passes, exit with a zero status and don't print the string "fail" (bonus points for printing "pass" :) ) write the test so that you expect it to pass on all platforms, since if the test fails, the tree will go orange (once we've set this up - see bug 352240 for status). for example, to
add an xpcshell test to a module, do the following: copy tools/test-harness/xpcshell-simple/example to yourmoduledir/tests_type, wheretests_type is something that describes your tests. you can of course use unit or test if you're not feeling creative. in <tt>yourmoduledir/tests_type/makefile.in</tt> change depth, module, and xpcshell_tests appropriately: depth should be a relative path poi...
...st of subdirectories of the current directory which contain xpcshell tests. you can of course just use the onetests_type directory here, but if you want to subdivide your tests by functionality, separate directories is the way to go. reference the test dir in a parent makefile (<tt>yourmoduledir/makefile.in</tt>): ifdef enable_tests dirs += tests_type endif (optional, but recommended)
add the new makefile to allmakefiles.sh (todo: need more details about this) reconfigure (e.g. with <tt>make -f client.mk configure</tt>) make/make check in <tt>yourmodule</tt> ...
PR GetAddrInfoByName
looks up a host by name. equivalent to get
addrinfo(host, null, ...) of rfc 3493. syntax #include <prnetdb.h> pr
addrinfo *pr get
addrinfobyname( const char *hostname, pruint16 af, printn flags); parameters the function has the following parameters: hostname the character string defining the host name of interest. af the
address family. may be pr_af_unspec or pr_af_inet. flags may be either pr_ai_
addrconfig or pr_ai_
addrconfig | pr_ai_nocanonname. include pr_ai_nocanonname to suppress the determination of the canonical name corresponding to hostname returns the function returns one of the following values: if successful, a pointer to the opaque pr
addrinfo structure containing the results of the host lookup. ...
... if unsuccessful, null. ...
... if unsuccessful, null. ...
...uppress the determination of the canonical name corresponding to hostname returns the function returns one of the following values: if successful, a pointer to the opaque pr
addrinfo structure containing the results of the host lookup. use pr_enumerate
addrinfo to inspect the prnet
addr values stored in this structure. when no longer needed, this pointer must be destroyed with a call to pr_free
addrinfo. if unsuccessful, null. you can retrieve the reason for the failure by calling pr_geterror. ...
PR_ReadDir
flags specifies which directory entries, if any, to skip. values can include the following: pr_skip_none. do not skip any files. pr_skip_dot. skip the directory entry "." representing the current directory. pr_skip_dot_dot. skip the directory entry ".." representing the parent directory. pr_skip_both. skip both "." and ".." pr_skip_hidden. skip hidden files. ...
...en. skip hidden files. on windows platforms and the mac os, this value identifies files with the "hidden" attribute set. on unix platform, this value identifies files whose names begin with a period ("."). returns a pointer to the next entry in the directory. if the end of the directory is reached or an error occurs, null. the reason can be retrieved via pr_geterror. description pr_re
addir returns a pointer to a directory entry structure: struct prdirentry { const char *name; }; typedef struct prdirentry prdirentry; the structure has the following field: name name of entry, relative to directory name. the flags parameter is an enum of type prdirflags: typedef enum prdirflags { pr_skip_none = 0x0, pr_skip_dot = 0x1, pr_skip_dot_dot = 0x2, pr_skip_both ...
... see also pr_opendir ...
...typedef enum prdirflags { pr_skip_none = 0x0, pr_skip_dot = 0x1, pr_skip_dot_dot = 0x2, pr_skip_both = 0x3, pr_skip_hidden = 0x4 } prdirflags; the memory associated with the returned prdirentry structure is managed by nspr. the caller must not free the prdirentry structure. moreover, the prdirentry structure returned by each pr_re
addir call is valid only until the next pr_re
addir or pr_closedir call on the same prdir object. if the end of the directory is reached, pr_re
addir returns null, and pr_geterror returns pr_no_more_files_error. see also pr_opendir ...
AddressErrors.languageCode - Web APIs
this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. ...
... this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. ...
... this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. ...
...human-readable explanation of the validation error and offers suggestions for correcting it. this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. if the languagecode value was validated successfully, this property is not included in the
addresserrors object. specifications specification status comment payment request apithe definition of '
addresserrors.languagecode' in that specification. candidate recommendation initial definition. ...
AddressErrors.regionCode - Web APIs
usage notes the region code is derived from the iso 3166-2 country subdivision name standard. ...
... usage notes the region code is derived from the iso 3166-2 country subdivision name standard. ...
... usage notes the region code is derived from the iso 3166-2 country subdivision name standard. ...
...ect it. syntax var regioncodeerror =
addresserrors.regioncode; value if the value specified in the payment
address object's regioncode property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the regioncode value was validated successfully, this property is not included in the
addresserrors object. usage notes the region code is derived from the iso 3166-2 country subdivision name standard. specifications specification status comment payment request apithe definition of '
addresserrors.regioncode' in that specification. candidate recommendation initial definition. ...
AudioTrackList.onaddtrack - Web APIs
the audiotracklist property on
addtrack is an event handler which is called when the
addtrack event occurs, indicating that a new audio track has been
added to the media element whose audio tracks the audiotracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax audiotracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which audio track has been
added to the media. ...
...rm of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax audiotracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which audio track has been
added to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose audio tracks are represented by the audiotracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each audio track in the media resource. ...
... to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose audio tracks are represented by the audiotracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each audio track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the audiotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of audio tracks available to choose from. ...
...vent will occur for each audio track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the audiotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of audio tracks available to choose from. document.queryselector("video").audiotracks.on
addtrack = function(event) {
addtotracklist(event.track); }; specifications specification status comment html living standardthe definition of 'audiotracklist.on
addtrack' in that specification. living standard html5the definition of 'audiotracklist.on
addtrack' in that specification. recommendation ...
MediaStream.onaddtrack - Web APIs
the mediastream.on
addtrack property is an eventhandler which specifies a function to be called when the
addtrack event occurs on a mediastream instance. this happens when a new track of any kind is
added to the media stream. this event is fired when the browser
adds a track to the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the
addtrack event does not get fired when javascript code explicitly
adds tracks to the stream (by calling
addtrack()). ...
...s fired when the browser
adds a track to the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the
addtrack event does not get fired when javascript code explicitly
adds tracks to the stream (by calling
addtrack()). syntax mediastream.on
addtrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object representing the
addtrack event which has occurred. the mediastreamtrack representing the track which was
added is specified in the event's track property. ...
...plicitly
adds tracks to the stream (by calling
addtrack()). syntax mediastream.on
addtrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object representing the
addtrack event which has occurred. the mediastreamtrack representing the track which was
added is specified in the event's track property. example this example
adds a listener which, when a new track is
added to the stream, appends a new item to a list of tracks; the new item shows the track's kind ("audio" or "video") and label. ...
...s input a mediastreamtrackevent object representing the
addtrack event which has occurred. the mediastreamtrack representing the track which was
added is specified in the event's track property. example this example
adds a listener which, when a new track is
added to the stream, appends a new item to a list of tracks; the new item shows the track's kind ("audio" or "video") and label. stream.on
addtrack = function(event) { let tracklist = document.getelementbyid("tracks"); let label = document.createelement("li"); label.innerhtml = event.track.kind + ": " + event.track.label; tracklist.appendchild(label); }; specifications specification status comment media capture and streamsthe definition of 'mediastream.on
addtrack' in that specification. candida...
Path2D.addPath() - Web APIs
the path2d.
addpath() method of the canvas 2d api
adds one path2d object to another path2d object. syntax void path.
addpath(path [, transform]); parameters path a path2d path to
add. transform optional a dommatrix to be used as the transformation matrix for the path that is
added. (technically a dommatrixinit object). examples
adding a path to an existing path this example
adds one path to another. html <canvas id="canvas"></canvas> javascript first, we create two separate path2d objects, each of which contains a rectangle made using the rect() method. we then create a matrix using document.createelementns() and createsvgmatrix(). we then
add the second path to the first using
addpath(), also applying the matrix to move the second path to the right. finally, we draw the firs...
.... we then create a matrix using document.createelementns() and createsvgmatrix(). we then
add the second path to the first using
addpath(), also applying the matrix to move the second path to the right. finally, we draw the first path (which now contains both rectangles) using fill(). ...
...dd the second path to the first using
addpath(), also applying the matrix to move the second path to the right. finally, we draw the first path (which now contains both rectangles) using fill(). ...
...); // create first path and
add a rectangle let p1 = new path2d(); p1.rect(0, 0, 100, 150); // create second path and
add a rectangle let p2 = new path2d(); p2.rect(0, 0, 100, 75); // create transformation matrix that moves 200 points to the right let m = document.createelementns('http://www.w3.org/2000/svg', 'svg').createsvgmatrix(); m.a = 1; m.b = 0; m.c = 0; m.d = 1; m.e = 200; m.f = 0; //
add second path to the first path p1.
addpath(p2, m); // draw the first path ctx.fill(p1); result specifications specification status comment html living standardthe definition of 'path2d.
addpath()' in that specification. living standard initial defintion. ...
PaymentAddress.dependentLocality - Web APIs
this may be an empty string if no sublocality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. ...
...this may be an empty string if no sublocality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. ...
...this may be an empty string if no sublocality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. ...
...locality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. in the united kingdom, this is used to indicate the post town in the united kingdom (known officially by the royal mail as the dependent locality). this is a disambiguating feature of
addresses in places where a city may have areas that duplicate street names. specifications specification status comment payment request apithe definition of 'payment
address.dependentlocality' in that specification. candidate recommendation initial definition. ...
PaymentRequest.onshippingaddresschange - Web APIs
the onshipping
addresschange event of the paymentrequest interface is fired whenever the user changes their shipping
address, including when an
address is
added by the user for the first time. syntax paymentrequest.
addeventlistener('shipping
addresschange', shipping
addresschangeevent => { ... }); paymentrequest.onshipping
addresschange = function(shipping
addresschangeevent) { ... }; examples the shipping
addresschange event is triggered by a user-agent controlled interaction. if the
address stored by the user agent changes at any time during a payment process, the event is triggered. to make sure an updated
address is included when sending payment information to the server, you should
add event listeners for a paymentrequest object after instantiation, but before the call to show(). // i...
...ayment process, the event is triggered. to make sure an updated
address is included when sending payment information to the server, you should
add event listeners for a paymentrequest object after instantiation, but before the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. var payment = new paymentrequest(supportedinstruments, details, options); request.
addeventlistener('shipping
addresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shipping
address, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of clarity. }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); specificati...
... candidate 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. ...
... 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. ...
RTCIceCandidateStats.address - Web APIs
the
address property of the rtcicecandidatestats dictionary indicates the
address of the ice candidate. while it's preferred that the
address be specified as an ipv4 or ipv6 numeric
address, a fully-qualified domain name can be used as well. when a domain name is specified, the first ip
address selected for that
address is used, even if the domain name maps to multiple ip
addresses. syntax candidate
address = rtcicecandidatestats.
address; value either an ipv4 or ipv6
address or a fully-qualified domain name, which corresponds to the candidate. if the value of
address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an ipv4
address. if the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as ...
...s = rtcicecandidatestats.
address; value either an ipv4 or ipv6
address or a fully-qualified domain name, which corresponds to the candidate. if the value of
address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an ipv4
address. if the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as an ipv6
address. otherwise, the
address 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...
...ess. otherwise, the
address 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 previously 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. ...
... usage notes the
address property was previously 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 recommendation initial specification. ...
RTCPeerConnection.addTransceiver() - Web APIs
init optional an object that conforms to the rtcrtptransceiverinit dictionary which provides any options that you may wish to specify when creating the new transceiver. ...
... init optional an object that conforms to the rtcrtptransceiverinit dictionary which provides any options that you may wish to specify when creating the new transceiver. ...
...r. possible values are: direction optional the new transceiver's preferred directionality. this value is used to initialize the new rtcrtptransceiver object's rtcrtptransceiver.direction property. sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender. each entry is of type rtcrtpencodingparameters. streams optional a list of mediastream objects to
add to the transceiver'srtcrtpreceiver; when the remote peer's rtcpeerconnection's track event occurs, these are the streams that will be specified by that event. exceptions typeerror a string was specified as trackorkind which is not valid. the string must be either "audio" or "video". specifications specification status comment webrtc 1.0: real-time communication...
... candidate recommendation ...
RTCPeerConnection.onaddstream - Web APIs
the rtcpeerconnection.on
addstream event handler is a property containing the code to execute when the
addstream event, of type mediastreamevent, is received by this rtcpeerconnection. such an event is sent when a mediastream is
added to this connection by the remote peer. the event is sent immediately after the call setremotedescription() and doesn't wait for the result of the sdp negotiation. important: this property has been removed from the specification; you should now use rtcpeerconnection.ontrack to watch for track events instead. it is included here in order to help you adapt existing code and understand existing samples, which may not be up-to-date yet. syntax rtcpeerconnection.on
addstream = eventhandler; value a function which handles
addstream events. these events, of typ...
...the specification; you should now use rtcpeerconnection.ontrack to watch for track events instead. it is included here in order to help you adapt existing code and understand existing samples, which may not be up-to-date yet. syntax rtcpeerconnection.on
addstream = eventhandler; value a function which handles
addstream events. these events, of type mediastreamevent, are sent when streams are
added to the connection by the remote peer. ...
... streams are
added to the connection by the remote peer. the first time an event occurs may be nearly immediately after the remote end of the connection is set using rtcpeerconnection.setremotedescription(); it doesn't wait for a particular stream to be accepted or rejected using sdp negotiation. example this code, based on an older version of our signaling and video calling sample, responds to
addstream events by setting the video source for a <video> element to the stream specified in the event, and then enabling a "hang up" button in the app's user interface. ...
...ection.setremotedescription(); it doesn't wait for a particular stream to be accepted or rejected using sdp negotiation. example this code, based on an older version of our signaling and video calling sample, responds to
addstream events by setting the video source for a <video> element to the stream specified in the event, and then enabling a "hang up" button in the app's user interface. pc.on
addstream = function(event) { document.getelementbyid("received_video").srcobject = event.stream; document.getelementbyid("hangup-button").disabled = false; }; you can also use
addeventlistener() to
add a handler for
addstream events to an rtcpeerconnection. ...
Selection.addRange() - Web APIs
the selection.
addrange() method
adds a range to a selection. syntax selection.
addrange(range); parameters range a range object that will be
added to the selection. example currently only firefox supports multiple selection ranges, other browsers will not
add new ranges to the selection if it already contains one. ...
...
added to the selection. example currently only firefox supports multiple selection ranges, other browsers will not
add new ranges to the selection if it already contains one. ...
... working draft current ...
... working draft current ...
SpeechGrammarList.addFromString() - Web APIs
weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. the value can be between 0.0 and 1.0; if not specified, the default used is 1.0. ...
... weight optional a float representing the weight of the grammar relative to other grammars present in the speechgrammarlist. the weight means the importance of this grammar, or the likelihood that it will be recognised by the speech recognition service. the value can be between 0.0 and 1.0; if not specified, the default used is 1.0. ...
... draft ...
... draft ...
TextTrackList.onaddtrack - Web APIs
the texttracklist property on
addtrack is an event handler which is called when the
addtrack event occurs, indicating that a new text track has been
added to the media element whose text tracks the texttracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax texttracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been
added to the media. ...
...orm of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax texttracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been
added to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose video tracks are represented by the texttracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each video track in the media resource. ...
...d to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose video tracks are represented by the texttracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each video track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the videotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of video tracks available to choose from. ...
...event will occur for each video track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the videotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of video tracks available to choose from. document.queryselector("video").texttracks.on
addtrack = function(event) {
addtotracklist(event.track); }; specifications specification status comment html living standardthe definition of 'texttracklist: on
addtrack' in that specification. living standard ...
VideoTrackList.onaddtrack - Web APIs
the videotracklist property on
addtrack is an event handler which is called when the
addtrack event occurs, indicating that a new video track has been
added to the media element whose video tracks the videotracklist represents. the event is passed into the event handler in the form of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax videotracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been
added to the media. ...
...rm of a trackevent object, whose track property identifies the newly-
added track. note: you can also
add a handler for the
addtrack event using
addeventlistener(). syntax videotracklist.on
addtrack = eventhandler; value set on
addtrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been
added to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose video tracks are represented by the videotracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each video track in the media resource. ...
... to the media. usage notes the
addtrack event is called whenever a new track is
added to the media element whose video tracks are represented by the videotracklist object. this happens when tracks are
added to the element when the media is first attached to the element; one
addtrack event will occur for each video track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the videotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of video tracks available to choose from. ...
...vent will occur for each video track in the media resource. example this snippet establishes a handler for the
addtrack event that calls a function,
addtotracklist(), passing in the videotrack object representing the newly-
added track. in this scenario, that function's role is to
add the new track to a list of video tracks available to choose from. document.queryselector("video").videotracks.on
addtrack = function(event) {
addtotracklist(event.track); }; specifications specification status comment html living standardthe definition of 'videotracklist: on
addtrack' in that specification. living standard ...
Window: gamepaddisconnected event - Web APIs
the gamep
addisconnected event is fired when the browser detects that a gamepad has been disconnected. ...
... the gamep
addisconnected event is fired when the browser detects that a gamepad has been disconnected. ...
... the gamep
addisconnected event is fired when the browser detects that a gamepad has been disconnected. ...
... the gamep
addisconnected event is fired when the browser detects that a gamepad has been disconnected. ...
scroll-padding-block-start - CSS: Cascading Style Sheets
the scroll-p
adding-block-start property defines offsets for the start edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
... breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-block-start: auto; /* <length> values */ scroll-p
adding-block-start: 10px; scroll-p
adding-block-start: 1em; scroll-p
adding-block-start: 10%; /* global values */ scroll-p
adding-block-start: inherit; scroll-p
adding-block-start: initial; scroll-p
adding-block-start: unset; values <length-percentage> an inwards offset from the block start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. ...
... candidate recommendation initial definition ...
scroll-padding-inline-start - CSS: Cascading Style Sheets
the scroll-p
adding-inline-start property defines offsets for the start edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-inline-start: auto; /* <length> values */ scroll-p
adding-inline-start: 10px; scroll-p
adding-inline-start: 1em; scroll-p
adding-inline-start: 10%; /* global values */ scroll-p
adding-inline-start: inherit; scroll-p
adding-inline-start: initial; scroll-p
adding-inline-start: unset; values <length-percentage> an inwards offset from the inline start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user ...
... candidate recommendation initial definition ...
Addition assignment (+=) - JavaScript
the
addition assignment operator (+=)
adds the value of the right operand to a variable and assigns the result to the variable. the types of the two operands determine the behavior of the
addition assignment operator.
addition or concatenation is possible. 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. ...
...perands determine the behavior of the
addition assignment operator.
addition or concatenation is possible. 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. ...
...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. ...
...hub 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 operator: x += y meaning: x = x + y examples using
addition assignment // assuming the following variables // foo = 'foo' // bar = 5 // baz = true // number + number ->
addition bar += 2 // 7 // boolean + number ->
addition baz += 1 // 2 // boolean + boolean ->
addition baz += false // 1 // number + string -> concatenation bar += 'foo' // "5foo" // string + boolean -> concatenation foo += false // "foofalse" // string + string -> concatenation foo += 'bar' // "foobar" specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification. ...
Updating addons broken by private browsing changes - Archive of obsolete content
after reading this document, contact josh matthews with further questions or clarifications, or file a bug if your extension has stopped working due to a change described here and you are having trouble updating it. ...
... idls nsitransferable: see using the clipboard for information about the new init method. imgicache: this must no longer be obtained as a service. see the imgicache article for more information. moz...
... remove, pause, and resume methods which should be used instead of deprecated similarly-named nsidownloadmanager methods. nsidownload's getdownload method is deprecated; use the asynchronous getdownloadbyguid method instead. nsidownloadmanager now has activeprivatedownloads, activeprivatedownloadcount, and privatedbconnection members to complement the existing public ones. nsidownloadmanager's
addlistener method is deprecated.
addprivacyawarelistener should be used instead, or no notifications will be received for private downloads. there is a new download-manager-remove-download-guid notification, which passes an nsisupportscstring subject for the guid or null. nsihttpauthmanager: setauthidentity and getauthidentity now take an optional boolean parameter to indicate whether the ident...
Install.addFile - Archive of obsolete content
install.
addfile the install object's
addfile method is the standard way to queue files for installation. ...
... install.
addfile the install object's
addfile method is the standard way to queue files for installation. ...
... install.
addfile the install object's
addfile method is the standard way to queue files for installation. ...
PR EnumerateAddrInfo
enumerates each of the possible network
addresses of a pr
addrinfo structure, acquired from pr_get
addrinfobyname. syntax #include <prnetdb.h> void *pr_enumerate
addrinfo( void *enumptr, const pr
addrinfo *
addrinfo, pruint16 port, prnet
addr *result); parameters the function has the following parameters: enumptr the index pointer of the enumeration. to begin an enumeration, this argument is set to null. to continue an enumeration (thereby getting successive
addresses from the pr
addrinfo structure), the value should be set to the function's last returned value. the enumeration is complete when a value of null is returned.
addrinfo a pointer to a pr
addrinfo structure returned by pr_get
addrinfobyname. port the port number to be assigned as part of the prnet
addr structure. this ...
...sses from the pr
addrinfo structure), the value should be set to the function's last returned value. the enumeration is complete when a value of null is returned.
addrinfo a pointer to a pr
addrinfo structure returned by pr_get
addrinfobyname. port the port number to be assigned as part of the prnet
addr structure. this parameter is not checked for validity. result on input, a pointer to a prnet
addr structure. on output, this structure is filled in by the runtime if the result of the call is not null. returns the function returns the value you should specify in the enumptr parameter for the next call of the enumerator. if the function returns null, the enumeration is ended. description pr_enumerate
addrinfo is a stateless enumerator. ...
...t, a pointer to a prnet
addr structure. on output, this structure is filled in by the runtime if the result of the call is not null. returns the function returns the value you should specify in the enumptr parameter for the next call of the enumerator. if the function returns null, the enumeration is ended. description pr_enumerate
addrinfo is a stateless enumerator. the principle input, the pr
addrinfo structure, is not modified. ...
JS_AddArgumentFormatter
obsolete since jsapi 18this 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.
add or remove a format string handler for js_convertarguments, js_pusharguments, js_convertargumentsva, and js_pushargumentsva. syntax jsbool js_
addargumentformatter(jscontext *cx, const char *format, jsargumentformatter formatter); void js_removeargumentformatter(jscontext *cx, const char *format); name type description cx jscontext * the context in which to install the formatter. format const char * the format string prefix that should be handled by formatter, or whose handler should be removed. formatter jsargumentformatter ...
... cx jscontext * the context in which to install the formatter. format const char * the format string prefix that should be handled by formatter, or whose handler should be removed. formatter jsargumentformatter the function to be used to convert arguments described by the given format. this function is described in more detail below. ...
... formatter jsargumentformatter the function to be used to convert arguments described by the given format. this function is described in more detail below. description js_
addargumentformatter establishes formatter as the conversion function for format strings beginning with format in the context cx. on success, it returns js_true. otherwise it returns js_false. (at the moment, js_
addargumentformatter fails only if there is no memory available to record the registration.) js_
addargumentformatter does not copy format, it points at the string storage allocated by the caller, which is typically a string constant. if format is in dynamic storage, the caller must keep the string alive until js_removeargumentformatter is called. js_removeargumentformatter removes any conversion func...
nsIDOMGeoPositionAddress
note: this needs to be moved into the dom reference. attributes attribute type description city domstring the city. read only. country domstring the country. ...
...ion, including street, city, and country information, for example. this information may or may not be available, depending on the geolocation service being used. 1.0 66 introduced gecko 1.9.2 obsolete gecko 14.0 inherits from: nsisupports last changed in gecko 11 (firefox 11 / thunderbird 11 / seamonkey 2.8) this object is obtained from an nsidomgeoposition
address object via its
address attribute. note: this needs to be moved into the dom reference. attributes attribute type description city domstring the city. read only. country domstring the country. read only. countrycode obsolete since gecko 11 domstring removed in firefox 11, since it isn't defined in the specification; use country instead. county domstring the county. read only. post...
...try domstring the country. read only. countrycode obsolete since gecko 11 domstring removed in firefox 11, since it isn't defined in the specification; use country instead. county domstring the county. read only. postalcode domstring the postal or zip code. read only. premises domstring the premises. read only. region domstring the region. read only. street domstring the street of the
address. read only. streetnumber domstring the street number of the
address. read only. historical note, which is likely of no interest to most readers: the types of the attributes below all changed from string to domstring in gecko 1.9.2 beta 5. see also using geolocation ...
NS_ADDREF
summary macro
addrefs the argument. do not use when the pointer might be null; use ns_if_
addref in those cases. ns_
addref(foo) is equivalent to foo->
addref(); this macro exists mainly for historical reasons, but for consistency and for symmetry with ns_release it should still be used. ...
... summary macro
addrefs the argument. do not use when the pointer might be null; use ns_if_
addref in those cases. ns_
addref(foo) is equivalent to foo->
addref(); this macro exists mainly for historical reasons, but for consistency and for symmetry with ns_release it should still be used. ...
... summary macro
addrefs the argument. do not use when the pointer might be null; use ns_if_
addref in those cases. ns_
addref(foo) is equivalent to foo->
addref(); this macro exists mainly for historical reasons, but for consistency and for symmetry with ns_release it should still be used. ...
BasicCardResponse.billingAddress - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). ...
...promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "cardnumber' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billing
address" : { "country" : "gb", // etc. billing
address is a payment
address object } } specifications specification status comment basic card paymentthe definition of 'billing
address' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to c...
...on. 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. ...
PaymentAddress.postalCode - Web APIs
a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. in most of the world, it's known as the "post code" or "postal code." in the united states, the zip code is used. india uses pin codes. ...
...a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. in most of the world, it's known as the "post code" or "postal code." in the united states, the zip code is used. india uses pin codes. ...
...r numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. in most of the world, it's known as the "post code" or "postal code." in the united states, the zip code is used. india uses pin codes. specifications specification status comment payment request apithe definition of 'payment
address.postalcode' in that specification. candidate recommendation initial definition. ...
XRInputSourcesChangeEvent.added - Web APIs
the read-only xrinputsourceschangeevent property
added is a list of zero or more input sources, each identified using an xrinputsource object, which have been newly made available for use. syntax let
addedinputs = xrinputsourceschangeevent.
added; value an array of zero or more xrinputsource objects, each representing one input device
added to the xr system. examples the example below creates a handler for the inputsourceschange event that processes the lists of
added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
...ray of zero or more xrinputsource objects, each representing one input device
added to the xr system. examples the example below creates a handler for the inputsourceschange event that processes the lists of
added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
...put device
added to the xr system. examples the example below creates a handler for the inputsourceschange event that processes the lists of
added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. xrsession.oninputsourcescchange = event => { for (let input of event.
added) { if (input.targetraymode == "tracked-pointer") {
addedpointerdevice(input); } } for (let input of event.removed) { if (input.targetraymode == "tracked-pointer") { removedpointerdevice(input); } } }; specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeevent.
added' in that specification. working draft initial definition. ...
XRInputSourcesChangeEventInit.added - Web APIs
the xrinputsourceschangeeventinit property
added specifies a list of input sources, each identified using an xrinputsource object, which the represented inputsourceschange event is to indicate are newly available for use. ...
... the xrinputsourceschangeeventinit property
added specifies a list of input sources, each identified using an xrinputsource object, which the represented inputsourceschange event is to indicate are newly available for use. ...
...ession,
added: [newdevice1, ..., newdevicen], removed: [removeddevice1, ..., newdevicen], }; myinputsourceschangeevent = new xrinputsourceschangeeventinit("inputsourceschange", inputsourceseventinit); myinputsourceschangeevent = new xrinputsourceschangeeventinit("inputsourceschange", { session: xrsession,
added:
addeddevicelist, removed: removeddevicelist }); value an array of zero or more xrinputsource objects, each representing one input device
added to the xr system. specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.
added' in that specification. wor...
additive-symbols - CSS: Cascading Style Sheets
the
additive-symbols descriptor lets you specify symbols when the value of a counter system descriptor is
additive. the
additive-symbols descriptor defines
additive tuples, each of which is a pair containing a symbol and a non-negative integer weight. the
additive system is used to construct sign-value numbering systems such as roman numerals. syntax
additive-symbols: 3 "0";
additive-symbols: 3 "0", 2 "\2e\20";
additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of
additive-symbols. formal definition related at-rule@counter-styleinitial valuen/acomputed valueas specified formal syntax [ <integer> && <symbol> ]#where <symbol> = <string> | <image> | <custom-ident>where <image> = <u...
... <angle><linear-color-stop> = <color> <color-stop-length>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples specifying
additive symbols html <ul class="list"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> css @counter-style
additive-symbols-example { system:
additive;
additive-symbols: v 5, iv 4, i 1; } .list { list-style:
additive-symbols-example; } result specifications specification status comment css counter styles level 3the defini...
... candidate recommendation initial definition. ...
scroll-padding-block-end - CSS: Cascading Style Sheets
the scroll-p
adding-block-end property defines offsets for the end edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-block-end: auto; /* <length> values */ scroll-p
adding-block-end: 10px; scroll-p
adding-block-end: 1em; scroll-p
adding-block-end: 10%; /* global values */ scroll-p
adding-block-end: inherit; scroll-p
adding-block-end: initial; scroll-p
adding-block-end: unset; values <length-percentage> an inwards offset from the block end edge of the scrollport, as a valid length or a percentage. auto th...
... candidate recommendation initial definition ...
scroll-padding-bottom - CSS: Cascading Style Sheets
the scroll-p
adding-bottom property defines offsets for the bottom of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-bottom: auto; /* <length> values */ scroll-p
adding-bottom: 10px; scroll-p
adding-bottom: 1em; scroll-p
adding-bottom: 10%; /* global values */ scroll-p
adding-bottom: inherit; scroll-p
adding-bottom: initial; scroll-p
adding-bottom: unset; values <length-percentage> an inwards offset from the bottom edge of the scrollport, as a valid length or a percentage. auto the offset is determind by...
... candidate recommendation initial definition ...
scroll-padding-inline-end - CSS: Cascading Style Sheets
the scroll-p
adding-inline-end property defines offsets for the end edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-inline-end: auto; /* <length> values */ scroll-p
adding-inline-end: 10px; scroll-p
adding-inline-end: 1em; scroll-p
adding-inline-end: 10%; /* global values */ scroll-p
adding-inline-end: inherit; scroll-p
adding-inline-end: initial; scroll-p
adding-inline-end: unset; values <length-percentage> an inwards offset from the inline end edge of the scrollport, as a valid length or a percentage. ...
... candidate recommendation initial definition ...
scroll-padding-left - CSS: Cascading Style Sheets
the scroll-p
adding-left property defines offsets for the left of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-left: auto; /* <length> values */ scroll-p
adding-left: 10px; scroll-p
adding-left: 1em; scroll-p
adding-left: 10%; /* global values */ scroll-p
adding-left: inherit; scroll-p
adding-left: initial; scroll-p
adding-left: unset; values <length-percentage> an inwards offset from the left edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent.
... candidate recommendation initial definition ...
scroll-padding-right - CSS: Cascading Style Sheets
the scroll-p
adding-right property defines offsets for the right of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-right: auto; /* <length> values */ scroll-p
adding-right: 10px; scroll-p
adding-right: 1em; scroll-p
adding-right: 10%; /* global values */ scroll-p
adding-right: inherit; scroll-p
adding-right: initial; scroll-p
adding-right: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user ...
... candidate recommendation initial definition ...
scroll-padding-top - CSS: Cascading Style Sheets
the scroll-p
adding-top property defines offsets for the top of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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. ...
...ed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. 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 */ scroll-p
adding-top: auto; /* <length> values */ scroll-p
adding-top: 10px; scroll-p
adding-top: 1em; scroll-p
adding-top: 10%; /* global values */ scroll-p
adding-top: inherit; scroll-p
adding-top: initial; scroll-p
adding-top: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this wi...
... candidate recommendation initial definition ...
WeakSet.prototype.add() - JavaScript
the
add() method appends a new object to the end of a weakset 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 ws.
add(value); parameters value required. the object to
add to the weakset collection. return value the weakset object. ...
...a weakset 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 ws.
add(value); parameters value required. the object to
add to the weakset collection. return value the weakset object. ...
...or 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 ws.
add(value); parameters value required. the object to
add to the weakset collection. return value the weakset object. examples using
add var ws = new weakset(); ws.
add(window); //
add the window object to the weakset ws.has(window); // true // weakset only takes objects as arguments ws.
add(1); // results in "typeerror: invalid value used in weak set" in chrome // and "typeerror: 1 is not a non-null object" in firefox specifications specification ecmascript (ecma-262)the definition of 'weakset.prototype.
add' in that specification. ...
additive - SVG: Scalable Vector Graphics
replace specifies that the animation will override the underlying value of the attribute and other lower priority animations. ...
... is
additive. it is frequently useful to define animation as an offset or delta to an attribute's value, rather than as absolute values. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value replace | sum default value replace animatable no sum specifies that the animation will
add to the underlying value of the attribute and other lower priority animations. replace specifies that the animation will override the underlying value of the attribute and other lower priority animations. this is the default, however the behavior is also affected by the animation value attributes by and to, as described in smil animation: how from, to and by attributes affect
additive behavior. ...
...n will override the underlying value of the attribute and other lower priority animations. this is the default, however the behavior is also affected by the animation value attributes by and to, as described in smil animation: how from, to and by attributes affect
additive behavior. specifications specification status comment svg animations level 2the definition of '
additive' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '
additive' in that specification. recommendation initial definition ...
addon-page - Archive of obsolete content
create a page that does not contain navigational elements. usage with the
add-on sdk you can present information to the user, such as a guide to using your
add-on, in a browser tab. you can supply the content in an html file in your
add-on's "data" directory. note: this module has no effect on fennec. for pages like this, navigational elements such as the awesome bar, search bar, or bookmarks toolbar are not usually relevant and distract from the content you are presenting. the
addon-page module provides a simple way to have a page which excludes these elements. to use the module import it using require(). ...
...s like this, navigational elements such as the awesome bar, search bar, or bookmarks toolbar are not usually relevant and distract from the content you are presenting. the
addon-page module provides a simple way to have a page which excludes these elements. to use the module import it using require(). after this, the page loaded from "data/index.html" will not contain navigational elements: var
addontab = require("sdk/
addon-page"); var data = require("sdk/self").data; require("sdk/tabs").open(data.url("index.html")); this only affects the page at "data/index.html": all other pages are displayed normally. ...
Adding the structure - Archive of obsolete content
« previousnext » the ui for our extension is an icon in the status bar. to implement this ui, we'll
add a statusbarpanel element to the statusbar element in the navigator.xul file. <statusbar id="status-bar" class="chromeclass-status" ondragdrop="nsdraganddrop.drop(event, contentareadndobserver);"> <statusbarpanel id="component-bar"/> <statusbarpanel id="statusbar-display" label="&statustext.label;" flex="1"/> <statusbarpanel class="statusbarpanel-progress"> <progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/> </statusbarpanel> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel cla...
...ttribute is not part of the xul definition for the statusbarpanel element, but is used by our extension to store the current tinderbox state. we'll update the value of that attribute each time we retrieve tinderbox's status from the server, and we'll define 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). « previousnext » ...
Measuring add-on startup performance - Archive of obsolete content
this article describes an
add-on that is no longer supported. using about:startup the about startup
add-on provides a much simpler way to measure startup performance. once installed, it will gather startup data and display it in the about:startup page. the
add-on is very lightweight, so it shouldn't have a noticeable negative effect on your baseline and
add-on tests. to test with about:startup, you should set up a new firefox profile, install this
add-on, and then open and quit firefox repeatedly. if you want to match talos, you should do this 20 times. then look at the results in the about:startup page. this should provide your baseline numbers. then repeat the process with both about startup and your
add-on installed. the overhead can be calculated using the same formula. the ...
...the firstpaint time should be roughly similar to what talos tests. ...
Adding Labels and Images - Archive of obsolete content
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. ...
... « previousnext » ...
Additional Install Features - Archive of obsolete content
« previous this section describes some more specifics of installers. installer file manipulation the previous section described a basic installer. 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. the following code will make a copy of the file "/bin/grep" and put it in the directory "/ma...
...forminstall(); } else { cancelinstall(); } error codes that could be returned by getlasterror() are listed in the mozilla source file nsinstall.h. during installation, a log file is created 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. « previous ...
IP Address - MDN Web Docs Glossary: Definitions of Web-related terms
an ip
address is a number assigned to every device connected to a network that uses the internet protocol. "ip
address" typically still refers to 32-bit ipv4
addresses until ipv6 is deployed more broadly. ...
... an ip
address is a number assigned to every device connected to a network that uses the internet protocol. "ip
address" typically still refers to 32-bit ipv4
addresses until ipv6 is deployed more broadly. ...
Add a hitmap on top of an image - Learn web development
objective: learn how to make different regions of one image link to different pages. this article discusses client-side image maps only. do not use server-side image maps, which require the user to have a mouse. image maps, and their drawbacks when you nest an image inside <a>, the entire image links to one webpage. ...
...tep 1: the image not just any image is acceptable. the image must make it clear what happens when people follow image links. alt text is mandatory, of course, but many people never see it. the image must clearly indicate where hotspots begin and end. hotspots must be large enough to tap comfortably, at any viewport size. how large is large enough? 72 × 72 css pixels is a good minimum, with
additional generous gaps between touch targets. the map of the world at 50languages.com (as of time of writing) illustrates the problem perfectly. it’s much easier to tap russia or north america than albania or estonia. you insert your image much the same way as always (with an <img> element and alt text). if the image is only present as a navigation device, you may write alt="", provided you fur...
Adding a new word to the en-US dictionary
the process is pretty straight-forward: get a clone of uxp, if you don't already have one, and make sure you can build it successfully. get into the dictionary sources directory using this command: cd extensions/spellcheck/locales/hunspell/dictionary-sources there's a special script used for editing dictionaries. ...
...ell/dictionary-sources there's a special script used for editing dictionaries. the script only works if you have the environment variable editor set to the executable of an editor program; if you don't have it set, you can do editor=vim sh edit-dictionary to edit using vim (or you can substitute some other editor), or you can just do sh edit-dictionary if you have an editor already specified.
add and remove words in the dictionary file, then quit the editor. sh merge-dictionaries to process the dictionary changes you've made. move the revised dictionary file into position: mv en-us.dic .. build firefox and test your updated dictionary. ...
AddonType
properties attribute type description id string the unique id for the type. name string the localized name for the type. uipriority integer a number used to determine the order of types displayed in the user interface. the lower the number the higher in the list the type will appear. ...
...the number the higher in the list the type will appear. built-in values: value category 2000 locale 4000 extension 5000 theme 6000 plugin viewtype integer the type of ui to use to display this type of
add-on in the ui. if undefined the type will not appear in the ui. flags integer
additional behavior flags for the type. ...
Localizing extension metadata on addons.mozilla.org
data describes the extension, and doesn't necessarily change with each revision (but it can). 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. step 4 allows you to translate any of the above fields into any other language amo supports. remember, all fields are optional when localizing. any field that is blank will just show up in the default locale. getting translation help you are kindl...
...directly provide translation assistance to extension authors, but there are a couple services that can help: babelzilla.org babelzilla.org is a community dedicated to the localization of extensions for moz family apps. they are volunteer translators from all over the world and are maintaining translations for more than 400 extensions with an online translation system. they also provide help for
adding a localization support to your extension if there is no localization structure yet. you can already request for amo fields localization on the forums, and these fields will be
added soon to the web translation system. amazon mechanical turk this is not free, but for a very modest amount of money you can get your amo page quickly translated by native speakers. create an account and then, usin...
PR_GetHostByAddr
buf a pointer to a buffer, allocated by the caller, that is filled in with host data on output. all of the pointers in the hostentry structure point to data saved in this buffer. this buffer is referenced by the runtime during a call to pr_enumeratehostent. bufsize number of bytes in the buf parameter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. ...
...t be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. description pr_gethostby
addr is used to perform reverse lookups of network
addresses. that is, given a valid network
address (of type prnet
addr), pr_gethostby
addr discovers the
address' primary name, any aliases, and any other network
addresses for the same host. ...
PR_NetAddrToString
converts a character string to a network
address. syntax #include <prnetdb.h> prstatus pr_net
addrtostring( const prnet
addr *
addr, char *string, pruint32 size); parameters the function has the following parameters:
addr a pointer to the network
address to be converted. string a buffer that will hold the converted string on output. size the size of the result buffer (string). returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. ...
... parameters:
addr a pointer to the network
address to be converted. string a buffer that will hold the converted string on output. size the size of the result buffer (string). returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. description the network
address to be converted (
addr) may be either an ipv4 or ipv6
address structure, assuming that the nspr library and the host system are both configured to utilize ipv6
addressing. if
addr is an ipv4
address, size needs to be at least 16. if
addr is an ipv6
address, size needs to be at least 46. ...
JS_AddExternalStringFinalizer
the js engine will automatically call this function each time a string created by js_newexternalstring is garbage-collected. ...
... 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. the callback may not keep a reference to this jsstring, as its memory is about to be freed. description
add a finalizer for external strings created by js_newexternalstring using a type-code returned from this function, and that understands how to free or release the memory pointed at by js_getstringchars(str). returns a nonnegative type index if there is room for finalizer in the global gc finalizers table, else returns -1. in a js_threadsafe build, this function must be invoked on the primordial thr...
already_AddRefed
« xpcom api reference already_
addrefed in association with nscomptr allows you to assign in a pointer without
addrefing it. you may want to use this as a return type from a function that has already produced an
addrefed pointer as a result. in fact, it is preferred to use already_
addrefed in this case over returning a raw pointer or nscomptr (see the nscomptr user manual). defined in: mfbt/already
addrefed.h. example ... already_
addrefed<nsifoo> getfoo() { nsifoo* foo = mfoo; ns_if_
addref(foo); return foo; } // or already_
addrefed<nsifoo> getfoo() { nscomptr<nsifoo> foo = mfoo; // ... return foo.forget(); } ... // the following assignment doesn't perform an
additional
addref, // as it would do if getfoo() returned a raw pointer. nscomptr<nsifoo> foo = getfoo(); s...
...ample ... already_
addrefed<nsifoo> getfoo() { nsifoo* foo = mfoo; ns_if_
addref(foo); return foo; } // or already_
addrefed<nsifoo> getfoo() { nscomptr<nsifoo> foo = mfoo; // ... return foo.forget(); } ... // the following assignment doesn't perform an
additional
addref, // as it would do if getfoo() returned a raw pointer. nscomptr<nsifoo> foo = getfoo(); see also nscomptr, getter
addrefs(), dont_
addref(). ...
Building a Thunderbird extension 6: Adding JavaScript
iece of javascript code that inserts the current date into our statusbar widget. the statusbar is usually displayed at the bottom of the thunderbird window. depending on the installed theme the result will look something like this: modify xul elements with javascript save the following javascript code into the content/ folder next to your myhelloworld.xul file and name it overlay.js. ...
...a new event listener that will be executed automatically when thunderbird loads. the event listener then calls our startup function which gets our <statusbarpanel>-element with the id my-panel from the document's dom tree. it then uses javascript's date class to get the current date, which it converts into a string that has the format of yyyy.mm.dd. because the month is zero-based we also need to
add one to the month. finally the label of our panel is set to "date: " and concatenated with the date string that contains the formatted date. we use the function window.setinterval to update the date in case thunderbird is left running for more than one day. this allows us to call the startup function repeatedly with an interval of 60000ms (every minute). further documentation more functions for...
Add Option to Context Menu
assuming this on chrome.manifest: overlay chrome://messenger/content/mailwindowoverlay.xul chrome://myext/content/thunderbird-overlay.xul
add the next in thunderbird-overlay.xul. for thunderbird 2 <?xml version="1.0"?> <overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menupopup id="messagepanecontext"> <menuitem id="my_option" label="my option concise and cool label" oncommand="alert('hi')"/> </menupopup> </overlay> for thunderbird 3 <?xml version="1.0"?> <overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <popup id="mailcontext"> <menuitem id="my_option" label="my option concis...
...zilla.org/keymaster/gatekeeper/there.is.only.xul"> <popup id="mailcontext"> <menuitem id="my_option" label="my option concise and cool label" oncommand="alert('hi')"/> </popup> </overlay> for thunderbird 2 and 3 in the same xpi if our extension needs to support thunderbird 2 and 3 we need to make custom overlays for each version. this can be reached by
adding these lines to the chrome.manifest file: overlay chrome://messenger/content/mailwindowoverlay.xul chrome://my
addon/content/tboverlay-tb2.xul appversion<3.0 overlay chrome://messenger/content/mailwindowoverlay.xul chrome://my
addon/content/tboverlay-tb3.xul appversion=>3.0 than we need two overlay xul files with content from examples above. note: if our extension supports more mozilla applica...
Access debugging in add-ons - Firefox Developer Tools
we are planning to deprecate the use by firefox
add-ons of the techniques described in this document. don't write new
add-ons that use these techniques. the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.
addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded. ...
...the use by firefox
add-ons of the techniques described in this document. don't write new
add-ons that use these techniques. the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.
addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded. ...
AddressErrors.country - Web APIs
an object based on
addresserrors includes a country property if during validation of the
address the specified value of country was determined to be invalid. the value is a string describing the error and should offer suggestions for how to correct it. syntax var countryerror =
addresserrors.country; value if an error occurred during validation of the
address due to the country property having an invalid value, this property is set to a domstring providing a human-readable error message explaining the validation error. the text should also include, when possible, advice about how to go about correcting the error. if the payment
address object's country property was determined to be valid, this property is not included in the dictionary. specifications specification status ...
...ding a human-readable error message explaining the validation error. the text should also include, when possible, advice about how to go about correcting the error. if the payment
address object's country property was determined to be valid, this property is not included in the dictionary. specifications specification status comment payment request apithe definition of '
addresserrors.country' in that specification. candidate recommendation initial definition. ...
AddressErrors.dependentLocality - Web APIs
an object based on
addresserrors includes a dependentlocality property when the
address's dependentlocality property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var localityerror =
addresserrors.dependentlocality; value if the value specified in the payment
address object's dependentlocality property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the dependentlocality value was validated successfully, this property is not included in the
addresserrors object. ...
... property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the dependentlocality value was validated successfully, this property is not included in the
addresserrors object. specifications specification status comment payment request apithe definition of '
addresserrors.dependentlocality' in that specification. candidate recommendation initial definition. ...
AddressErrors.organization - Web APIs
an object based on
addresserrors includes an organization property when the
address's organization property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var organizationerror =
addresserrors.organization; value if the value specified in the payment
address object's organization property could not be validated, this property contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. for example, if validation simply ensures that only permitted characters are included in the organization's name, this might return a string such as "the organization name may only contain the letters a-z, digits, spaces, and commas." if the organization value was valid...
...ation of the validation error and offers suggestions for correcting it. for example, if validation simply ensures that only permitted characters are included in the organization's name, this might return a string such as "the organization name may only contain the letters a-z, digits, spaces, and commas." if the organization value was validated successfully, this property is not included in the
addresserrors object. specifications specification status comment payment request apithe definition of '
addresserrors.organization' in that specification. candidate recommendation initial definition. ...
CSSStyleSheet.addRule() - Web APIs
the default is the string undefined. styleblock a domstring indicating the style block to apply to elements matching the selector. the default is the string undefined. index optional an optional index into the stylesheet's cssrulelist at which to insert the new rule. ...
...teric rules about where you can legally insert rules, it's possible that an exception may be thrown. see insertrule() for more information. usage notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method. therefore, given existing code such as the following: cssstylesheet.
addrule(selector, styles, 0); you can rewrite this to use the more standard insertrule() like this: cssstylesheet.insertrule(`${selector} {${styles}}`, 0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.
addrule()' in that specification. working draft ...
DOMTokenList.add() - Web APIs
the
add() method of the domtokenlist interface
adds the given token to the list. syntax tokenlist.
add(token1[, token2[, ...tokenn]]); parameters tokenn a domstring representing the token (or tokens) to
add to the tokenlist. return value undefined examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then
add a new token to the list, and write the list into the <span>'s node.textcontent. ...
...eturn value undefined examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then
add a new token to the list, and write the list into the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; classes.
add("d"); span.textcontent = classes; the output looks like this: you can
add multiple tokens as well: span.classlist.
add("d", "e", "f"); specifications specification status comment domthe definition of '
add()' in that specification. living standard initial definition ...
PaymentAddress.country - Web APIs
the country read-only property of the payment
address interface is a string identifying the
address's country using the iso 3166-1 alpha-2 standard. the string is always in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". syntax var paymentcountry = payment
address.country; value a domstring which contains the iso3166-1 alpha-2 code identifying the country in which the
address is located, or an empty string if no country is available, which frequently can be assumed to mean "same country as the site owner." usage notes if the payment handler validates the
address and determines that the value of country is invalid, a call to paymentrequestupdateevent.updatewith() will be made with a details object containing a shipping
addresserrors field. ...
...dress is located, or an empty string if no country is available, which frequently can be assumed to mean "same country as the site owner." usage notes if the payment handler validates the
address and determines that the value of country is invalid, a call to paymentrequestupdateevent.updatewith() will be made with a details object containing a shipping
addresserrors field. that field contains an
addresserrors-compliant object whose country property is a string indicating the validation error that occurred and, if possible, suggests how to fix it. specifications specification status comment payment request apithe definition of 'payment
address.country' in that specification. candidate recommendation initial definition. ...
PaymentAddress.region - Web APIs
the read-only region property of the payment
address interface returns a string containing the top-level administrative subdivision of the country in which the
address is located. for example, this may be a state, province, oblast, or prefecture. syntax var paymentregion = payment
address.region; value a domstring specifying the top-level administrative subdivision within the country in which the
address is located. this region has different names in different countries, such as: state, province, oblast, prefecture, or county. usage notes in some countries, like belgium, it's uncommon for people to provide a region as part of their postal
address. in such cases, the browser returns an empty string as the value of region. ...
...istrative subdivision within the country in which the
address is located. this region has different names in different countries, such as: state, province, oblast, prefecture, or county. usage notes in some countries, like belgium, it's uncommon for people to provide a region as part of their postal
address. in such cases, the browser returns an empty string as the value of region. however, the
address should still be acceptable to use for its intended purpose (e.g., to ship a product). however, always verify
addresses to make sure what the user provides is usable. specifications specification status comment payment request apithe definition of 'payment
address.region' in that specification. candidate recommendation initial definition. ...
PaymentAddress.regionCode - Web APIs
the regioncode read-only attribute of the payment
address interface returns a one-, two-, or three-alphanumeric code (domstring) representing the region of the
address (e.g., "ca" for california, or "11" for lisbon, portugal). the code is derived from the iso 3166-2 standard, which defines codes for identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. if the browser can't determine the region code, or the country doesn't use regions for postal
addresses, it returns an empty string. syntax var regioncode = payment
address.regioncode; value a domstring indicating the one to three character alphanumeric code representing the region portion of the
address. this should correspond to region, but should be the iso 3166--2 standard's r...
... for postal
addresses, it returns an empty string. syntax var regioncode = payment
address.regioncode; value a domstring indicating the one to three character alphanumeric code representing the region portion of the
address. this should correspond to region, but should be the iso 3166--2 standard's region code. the string is empty if the region code couldn't be determined, isn't needed for the
address's country, or was not provided. ...
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
the paymentdetailsupdate dictionary's shipping
addresserrors property, if present, contains an
addresserrors object whose contents provide error messages for one or more of the values in the payment
address specified as paymentrequest.shipping
address. syntax var
addresserrors = paymentdetailsupdate.shipping
addresserrors; value an
addresserrors object, which contains domstrings describing errors in the properties of a payment
address. for each property in payment
address, a property by the same name is found in shipping
addresserrors if and only if a validation error occurred for that property. in that case, the property in shipping
addresserrors is a string describing the validation error, ideally including suggestions about fixing the error. specifications specification ...
...y the same name is found in shipping
addresserrors if and only if a validation error occurred for that property. in that case, the property in shipping
addresserrors is a string describing the validation error, ideally including suggestions about fixing the error. specifications specification status comment payment request apithe definition of 'paymentdetailsupdate.shipping
addresserrors' in that specification. candidate recommendation initial definition. ...
Atomics.add() - JavaScript
the static atomics.
add() method
adds a given value at a given position in the array and returns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. 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 atomics.
add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to
add a value to. value the number to
add. return value the old value at the given pos...
...6array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to
add a value to. value the number to
add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using
add() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.
add(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.
add' in that specification. ...
<mpadded> - MathML
attributes class, id, style provided for use with stylesheets. depth sets or increments the depth. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . height sets or increments the height. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . href used to set a hyperlink to a specified uri. lspace sets or increments the horizontal position. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. ...
...e the keywords "depth", "height", and "width" as a pseudo-unit for the attributes depth, height, lspace, voffset, and width. they represent each length of the same-named dimension. prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) the mathml2 pseudo-unit lspace was allowed, which is no longer present in the mathml3 recommendation and has been removed now. examples <math> <mp
added height="+150px" width="100px" lspace="2height"> <mi> x </mi> <mo> + </mo> <mi> y </mi> </mp
added> </math> specifications specification status comment mathml 3.0the definition of 'mp
added' in that specification. recommendation current specification mathml 2.0the definition of 'mp
added' in that specification. recommendation initia...
Add a Menu Item to Firefox - Archive of obsolete content
the sdk doesn't provide a built-in api to
add new menu items to firefox. but it's extensible by design, so anyone can build and publish modules for
add-on developers to use. to see how to use third-party modules to
add a new menu item, see the tutorial on using third-party modules with jpm. ...
AudioTrackList: addtrack event - Web APIs
the
addtrack event is fired when a track is
added to an audiotracklist. bubbles no cancelable no interface trackevent event handler property on
addtrack examples using
addeventlistener(): const videoelement = document.queryselector('video'); videoelement.audiotracks.
addeventlistener('
addtrack', (event) => { console.log(`audio track: ${event.track.label}
added`); }); using the on
addtrack event handler property: const videoelement = document.queryselector('video'); videoelement.audiotracks.on
addtrack = (event) => { console.log(`audio track: ${event.track.label}
added`); }; specifications specification status html living standardthe definition of '
addtrack' in that specification. living standard ...
adData - Web APIs
the bluetoothdevice.
addata read-only property returns instance of bluetoothadvertisingdata containing the most recent advertising data received for the device. syntax var instanceofbluetooth
addata = instanceofbluetoothdevice.
addata returns an instance of bluetoothadvertisingdata. ...
DataTransfer.addElement() - Web APIs
the datatransfer.
addelement() method sets the drag source to the given element. this element will be the element to which drag and dragend events are fired, and not the defaut target (the node that was dragged). note: this method is gecko-specific. syntax void datatransfer.
addelement(el); arguments el the element to set as the drag source. return value void example this example shows the use of the
addelement() method function change_drag_node(event, node) { var dt = event.datatransfer; dt.
addelement(node); } specifications this method is not defined in any web standard. ...
HTMLTableElement.cellPadding - Web APIs
the htmltableelement.cellp
adding property represents the p
adding around the individual cells of the table. syntax htmltableelement.cellp
adding = p
adding; var p
adding = htmltableelement.cellp
adding; p
adding is either a number of pixels (e.g. "10") or a percentage value (e.g. "10%"). example // set cell p
adding to 10 pixels let t = document.getelementbyid('tablea'); t.cellp
adding = '10'; specification w3c dom 2 html specification htmltableelement .cellp
adding. ...
MediaStream.addTrack() - Web APIs
the mediastream.
addtrack() method
adds a new track to the stream. the track is specified as a parameter of type mediastreamtrack. if the specified track is already in the stream's track set, this method has no effect. syntax stream.
addtrack(track); parameters track a mediastreamtrack to
add to the stream. return value undefined example specifications specification status comment media capture and streamsthe definition of '
addtrack()' in that specification. candidate recommendation initial specification. ...
MediaStream: addtrack event - Web APIs
the
addtrack event is fired when a new mediastreamtrack object has been
added to a mediastream. bubbles no cancelable no interface mediastreamtrackevent event handler property on
addtrack examples using
addeventlistener(): let stream = new mediastream(); stream.
addeventlistener('
addtrack', (event) => { console.log(`new ${event.track.kind} track
added`); }); using the on
addtrack event handler property: let stream = new mediastream(); stream.on
addtrack = (event) => { console.log(`new ${event.track.kind} track
added`); }; specifications specification status media capture and streamsthe definition of '
addtrack' in that specification. candidate recommendation ...
PaymentAddress.city - Web APIs
the city read-only property of the payment
address interface returns a string containing the city or town portion of the
address. syntax var paymentcity = payment
address.city; value a domstring indicating the city or town portion of the
address described by the payment
address object. specifications specification status comment payment request apithe definition of 'payment
address.city' in that specification. candidate recommendation initial definition. ...
PaymentAddress.languageCode - Web APIs
the languagecode read-only property of the payment
address interface returns a string containing the bcp-47 language code for the
address. this is used while localizing the displayy of the
address, allowing the determination of the field separators and the order of fields when formatting the
address. syntax var paymentlanguagecode = payment
address.languagecode; value a domstring providing the bcp-47 format language code indicating the language the
address was written in, such as "en-us", "pt-br", or "ja-jp". ...
PaymentAddress.organization - Web APIs
the organization read-only property of the payment
address interface returns a string containing the name of the organization, firm, company, or institution at the
address. syntax var paymentorganization = payment
address.organization; value a domstring whose value is the name of the organization or company located at the
address described by the payment
address object. this should be the name of the organization that is to receive the shipment for shipping
addresses, or which is repsonsible for payment for payment
addresses. specifications specification status comment payment request apithe definition of 'payment
address.organization' in that specification. candidate recommendation initial definition. ...
PaymentAddress.phone - Web APIs
the read-only phone property of the payment
address interface returns a string containing the telephone number of the recipient or contact person. syntax var paymentphone = payment
address.phone; value a domstring containing the telephone number for the recipient of the shipment or of the responsible party for payment. if no phone number is available, this value is an empty string. specifications specification status comment payment request apithe definition of 'payment
address.phone' in that specification. candidate recommendation initial definition. ...
PaymentAddress.recipient - Web APIs
the read-only recipient property of the payment
address interface returns a string containing the name of the recipient, purchaser, or contact person at the payment
address. syntax var paymentrecipient = payment
address.recipient; value a domstring giving the name of the person receiving or paying for the purchase, or the name of a contact person in other contexts. if no name is available, this string is empty. specifications specification status comment payment request apithe definition of 'payment
address.recipient' in that specification. candidate recommendation initial definition. ...
PaymentAddress.sortingCode - Web APIs
the sortingcode read-only property of the payment
address interface returns a string containing a postal sorting code such as is used in france. syntax var sortingcode = payment
address.sortingcode; value a domstring containing the sorting code portion of the
address. specifications specification status comment payment request apithe definition of 'payment
address.sortingcode' in that specification. candidate recommendation initial definition. ...
PaymentAddress.toJSON() - Web APIs
return value a json object. specifications specification status comment web idlthe definition of 'tojson()' in that specification. candidate 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. ...
TextTrackList: addtrack event - Web APIs
the
addtrack event is fired when a track is
added to a texttracklist. bubbles no cancelable no interface trackevent event handler property on
addtrack examples using
addeventlistener(): const mediaelement = document.queryselector('video, audio'); mediaelement.texttracks.
addeventlistener('
addtrack', (event) => { console.log(`text track: ${event.track.label}
added`); }); using the on
addtrack event handler property: const mediaelement = document.queryselector('video, audio'); mediaelement.texttracks.on
addtrack = (event) => { console.log(`text track: ${event.track.label}
added`); }; specifications specification status html living standardthe definition of '
addtrack' in that specification. living standard ...
VideoTrackList: addtrack event - Web APIs
the
addtrack event is fired when a track is
added to a videotracklist. bubbles no cancelable no interface trackevent event handler property on
addtrack examples using
addeventlistener(): const videoelement = document.queryselector('video'); videoelement.videotracks.
addeventlistener('
addtrack', (event) => { console.log(`video track: ${event.track.label}
added`); }); using the on
addtrack event handler property: const videoelement = document.queryselector('video'); videoelement.videotracks.on
addtrack = (event) => { console.log(`video track: ${event.track.label}
added`); }; specifications specification status html living standardthe definition of '
addtrack' in that specification. living standard ...
Adding 2D content to a WebGL context - Web APIs
ert it to a vec4 every time we do math, we'll just use a vec4 from the beginning. this eliminates operations from every calculation we do in our shader. performance matters. in this example, we're not computing any lighting at all, since we haven't yet applied any to the scene. that will come later, in the example lighting in webgl. note also the lack of any work with textures here; that will be
added in using textures in webgl. fragment shader the fragment shader is called once for every pixel on each shape to be drawn, after the shape's vertices have been processed by the vertex shader. its job is to determine the color of that pixel by figuring out which texel (that is, the pixel from within the shape's texture) to apply to the pixel, getting that texel's color, then applying the approp...
Window.ongamepaddisconnected - Web APIs
the ongamep
addisconnected property of the window interface represents an event handler that will run when a gamepad is disconnected (when the gamep
addisconnected event fires). the event object is of type gamepadevent. syntax window.ongamep
addisconnected = function() { ... }; examples window.ongamep
addisconnected = function() { // a gamepad has been disconnected }; specifications specification status comment gamepadthe definition of 'gamep
addisconnected event' in that specification. working draft initial definition ...
Set.prototype.add() - JavaScript
the
add() method appends a new element with a specified value to the end of a set 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 myset.
add(value); parameters value the value of the element to
add to the set object. return value the set object. examples using the
add method var myset = new set(); myset.
add(1); myset.
add(5).
add('some text'); // chainable console.log(myset); // set [1, 5, "some text"] specifications specification ecmascript (ecma-262)the definition of 'set.prototype.
add' in that specification. ...
Index - Web APIs
or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. 3 angle_instanced_arrays.drawarraysinstancedangle() angle_instanced_arrays, api, method, reference, webgl, webgl extension the angle_instanced_arrays.drawarraysinstancedangle() method of the webgl api renders primitives from array data like the gl.drawarrays() method. ...
...the gl.drawarrays() method. in
addition, it can execute multiple instances of the range of elements. 4 angle_instanced_arrays.drawelementsinstancedangle() angle_instanced_arrays, api, method, reference, webgl, webgl extension the angle_instanced_arrays.drawelementsinstancedangle() method of the webgl api renders primitives from array data like the gl.drawelements() method. in
addition, it can execute multiple instances of a set of elements. 5 angle_instanced_arrays.vertexattribdivisorangle() angle_instanced_arrays, api, method, reference, webgl, webgl extension the angle_instanced_arrays.vertexattribdivisorangle() method of the webgl api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ...
...sion integer containing the acceleration of the device along the its y axis. 28 accelerometer.z api, accelerometer, accelerometer api, generic sensor api, property, reference, sensor, sensor apis, sensors, z the z read-only property of the accelerometer interface returns a double precision integer containing the acceleration of the device along the its z axis. ...
...And 281 more matches
Index - Archive of obsolete content
p notification alerts to the user. currently, these are only supported on firefox mobile and firefox os. see displaying notifications for an example. 7 window: deviceproximity event sensors, events the deviceproximity event is fired when fresh data is available from a proximity sensor. ...
...on alerts to the user. currently, these are only supported on firefox mobile and firefox os. see displaying notifications for an example. 7 window: deviceproximity event sensors, events the deviceproximity event is fired when fresh data is available from a proximity sensor. ...
...only supported on firefox mobile and firefox os. see displaying notifications for an example. 7 window: deviceproximity event sensors, events the deviceproximity event is fired when fresh data is available from a proximity sensor. 8 window: userproximity event sensors, events no summary! 9
add-ons
add-ons, archive, extensions archived
add-ons documentation. ...
...And 269 more matches
JSAPI reference
ly, but not really, corresponded to firefox releases. in the fall of 2012, the spidermonkey team decided to align releases with those of firefox. the reference applies this versioning scheme retroactively starting with firefox 5. firefox 4 is the last release that has a corresponding spidermonkey release with the old scheme, where the jsapi has the version 1.8.5. ...
...scheme retroactively starting with firefox 5. firefox 4 is the last release that has a corresponding spidermonkey release with the old scheme, where the jsapi has the version 1.8.5. ...
... js_newruntimeobsolete since jsapi 52 js_destroyruntime js_getruntimeprivate js_setruntimeprivate js_setnativestackquota
added in spidermonkey 17 js_contextiteratorobsolete since jsapi 52 js_finish obsolete since jsapi 19 struct jscontext js_newcontext js_destroycontext js_destroycontextnogc js_setcontextcallback enum jscontextop js_getruntime js_getparentruntime
added in spidermonkey 31 js_getobjectruntime
added in spidermonkey 17 js_getcontextprivate js_setcontextprivate js_getsecondcontextprivate
added in spidermonkey 17 js_setsecondcontextprivate
added in spidermonkey 17 js_setinterruptcallback
added in spidermonkey 31 js_getinterruptcallback
added in spidermonkey 31 js_requestinterruptcallback
added in spidermonkey 31 js_checkforinterrupt ...
...And 120 more matches
Index
wn modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides
additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big number calculations, and cryptographic algorithms. softoken is an nss module that exposes most freebl functionality as a pkcs#11 module. some cryptography uses the same secret key for both encrypting and decrypting, for ...
...directory on your filesystem as a parameter to the init function, and nss is designed to do the rest. it will detect and open an existing database, or it can create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been
added to permanent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db,...
...t cleanup for all handles returned by nss. the application should always call the appropriate dereference (destroy) functions once a handle is no longer needed. this is particularly important for applications that might need to close a database and reinitialize nss using a different one, without restarting. such an operation might fail at runtime if data elements are still being referenced. in
addition to the freebl, softoken, and ckbi modules, there is an utility library for general operations (e.g., encoding/decoding between data formats, a list of standardized object identifiers (oid)). nss has an ssl/tls module that implements the secure sockets layer/transport layer security network protocols, an s/mime module that implements cms messaging used by secure email and some instant messagi...
...And 90 more matches
Index
found 1275 pages: # page tags and summary 1 xpcom
add-ons, extensions, landing, mozilla, xpcom xpcom is a cross platform component object model, similar to microsoft com. it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in
addition to c++. 2 accessing the windows registry using xpcom
add-ons, code snippets, extensions, needsclassification, windows registry when implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs. to this end, there exist xpcom interfaces to read and write registry data. this article will show you how to use the available interfaces in...
...com, xpcom, xpcom:language bindings creating applications with mozilla already provides a tutorial for making a simple javascript or c++ component (implementing the nsisimple interface). here is how to make the same component in python using pyxpcom. ...
... 7 fun with xbl and xpconnect xbl, xpcom, xpcom:language bindings, xpconnect no summary! 8 generating guids
add-ons, developing mozilla, developing_mozilla:tools, extensions, tools, xpcom guids are used in mozilla programming for identifying several types of entities, including xpcom interfaces (this type of guids is callled iid), components (cid), and legacy
add-ons—like extensions and themes—that were created prior to firefox 1.5.
add-ons can (and should) be identified with ids of the form extensionname@organization.tld since firefox 1.5. 9 generic factory xpcom most xpcom factories can be very simple. rick potts wrote a templated-based generic factory (nsfactory<t>) that simplifies the factory creation process that just require...
...And 74 more matches
Python binding for NSS
the python-nss project as part of an open source community. the initial release of python-nss occurred in september 2008 with it's inclusion in the fedora distribution. the source code to python-nss was first imported into the mozilla cvs repository on june 9th 2009. python-nss is currently available in: fedora rhel 6 the principal developer of python-nss is john dennis jdennis@redhat.com.
additional contributors are: miloslav trmač mitr@redhat.com bohuslav kabrda slavek@redhat.com the python-nss binding is still young despite having been utilized in several major software projects. thus it's major version number is still at zero. this is primarily so the developers can make changes to the api as experiece grows with it. for example it is already known there are some naming inco...
...iled modules. you can build it yourself via ./setup.py build_doc. most distributions include the python-nss api documentation in the python-nss packaging. consult your distribution for more information. example code the doc/examples directory contains numerous examples 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...
...e: getting mozilla source code using cvs. the old deprecated python-nss cvs source code location is mozilla/security/python/nss. ...
...And 65 more matches
Index - Archive of obsolete content
l elements, xul reference an 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, needstechnicalreview, 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...
... 189 menu xul attributes, xul reference no summary! 190 menuactive xul attributes, xul reference no summary! 191 menuitem.key xul attributes, xul reference no summary! 192 menuitem.name xul attributes, xul reference no summary! 193 menuitem.type xul attributes, xul reference more information on
adding checkmarks to menus in the xul tutorial 194 min xul attributes, xul reference no summary! 195 minheight xul attributes, xul reference no summary! 196 minresultsforpopup xul attributes, xul reference no summary! 197 minwidth xul attributes, xul reference no summary! 198 mode no summary! ...
...d the control; they had no way of knowing that a particular collection of div and span elements should be treated as a single cohesive control (such as a tab bar or a treeview). 422 deprecated and defunct markup reference, xul {many elements on this page are wrongly marked as deprecated, this page needs review} 423 dynamically modifying xul-based user interface
add-ons, dom, extensions, xul this article discusses manipulating xul interfaces, using dom and other apis. it explains the concept of dom documents, demonstrates a few simple examples of using dom calls to perform basic manipulations on a document, and then demonstrates working with anonymous xbl content using mozilla-specific methods. 424 fileguide see io 425 ...
...And 51 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
some of that will have to be replaced and the rest will need to be loaded differently. ...
...ersion 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 forever 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 on out, it is assumed you've imported services.j...
...oad one of mozilla's internal jsm files, for example services.jsm, you'll do so via privileged javascript code like this: components.utils.import("resource://gre/modules/services.jsm"); from here on out, it is assumed you've imported services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples. ...
...And 49 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
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. ...
...with their parents using events and two-way data binding. now we will see how components can also expose methods and variables. the following new components will be developed throughout the course of this article: moreactions: displays the check all and remove completed buttons, and emits the corresponding events required to handle their functionality. newtodo: displays the <input> field and
add button for
adding a new todo. todosstatus: displays the "x out of y items completed" status heading. code along with us git clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/05-advanced-concepts or directly download the folder's content: npx degit open...
... 'uncheck'} all</button> <button type="button" class="btn btn__primary" on:click={removecompleted}>remove completed</button> </div> we've also included a completed variable to toggle between checking and unchecking all tasks. back over in todos.svelte, we are going to import our moreactions component and create two functions to handle the events emitted by the moreactions component. ...
...And 48 more matches
Experimental features in Firefox
n how to activate them, if necessary. you can test your web sites and applications before these features get released and ensure everything will still work with the latest web technology capabilities. to test these experimental features, you need to download firefox nightly or firefox developer edition. which you need is described alongside each feature's description below. editor's note: when
adding features to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-number)}}. html element: <dialog> the html <dialog> element and its associated dom apis provide support for html-based modal dialog boxes. the current implementation is a little inelegant but is basically functional. see bug 840640 for more details. release channel ...
...res to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-number)}}. html element: <dialog> the html <dialog> element and its associated dom apis provide support for html-based modal dialog boxes. the current implementation is a little inelegant but is basically functional. see bug 840640 for more details. ...
...no release 53 no preference name dom.dialog_element.enabled global attribute: inputmode our implementation of the inputmode global attribute has been updated as per the whatwg spec (bug 1509527), but we still need to make other changes too, like making it available on contenteditable content. see also bug 1205133 for details. ...
...And 45 more matches
WebIDL bindings
notes: need to document the setup for indexed and named setters/creators/deleters. the webidl bindings are generated at build time based on two things: the actual webidl file and 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...
...erface, a namespace whose name is the name of the interface with binding appended is created, and all the things pertaining to that interface's binding go in that namespace. there are various helper objects and utility methods in dom/bindings that are also all in the mozilla::dom namespace and whose headers are all exported into mozilla/dom (placed in $objdir/dist/include by the build process).
adding webidl bindings to a class to
add a webidl binding for interface myinterface to a class mozilla::dom::myinterface that's supposed to implement that interface, you need to do the following: if your interface doesn't inherit from any other interfaces, inherit from nswrappercache and hook up the class to the cycle collector so it will trace the wrapper cache properly. note that you may not...
...her objects. if you also inherit from nsisupports, make sure the nsisupports comes before the nswrappercache in your list of parent classes. if your interface does inherit from another interface, just inherit from the c++ type that the other interface corresponds to. ...
...And 42 more matches
<input type="email"> - HTML: Hypertext Markup Language
<input> elements of type email are used to let the user enter and edit an e-mail
address, or, if the multiple attribute is specified, a list of e-mail
addresses. 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 input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail
address (or list of
addresses) before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail
address or not. on browsers that don't support inputs of type email, a email in...
...s (or list of
addresses) before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail
address or not. on browsers that don't support inputs of type email, a email input falls back to being a standard text input. ...
...st and value methods select() value the <input> element's value attribute contains a domstring which is automatically validated as conforming to e-mail syntax. more specifically, there are three possible value formats that will pass validation: an empty string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed e-mail
address. this doesn't necessarily mean the e-mail
address exists, but it is at least formatted correctly. in simple terms, this means username@domain or username@domain.tld. there's more to it than that, of course; see validation for a regular expression that matches the e-mail
address validation algorithm. if and only if the multiple attribute is specified, the value can be a list of properly-forme...
...And 42 more matches
Getting Started Guide
't worry; the getting started guide is short. introduction what is nscomptr? nscomptr is a tool to help prevent leaks. 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. nscomptr is smart in that, unlike a raw c++ pointer to an xpcom object, nscomptr manages
addref, release, and queryinterface for you. nscomptr is defined in the source files: xpcom/base/nscomptr.h xpcom/base/nscomptr.cpp ...though you probably don't want to look in there, just yet. with nscomptr, you can write code that is shorter, cleaner, clearer, and safer, than you can with raw xpcom interface pointers. xpcom basics: ownership and reference counting this is a quick refresher...
...keeps a count of the number of clients holding references to it. when that count goes to zero, the interface may delete itself. clients are expected to keep this reference count accurate by incrementing it when they acquire a reference to the interface, and decrementing it before they let go. to facilitate this, all interfaces inherit from an abstract base class that provides the member functions
addref, and release. a rule of xpcom is that any function that creates or returns an interface pointer will have already
addrefed it. the caller can then hold onto the reference indefinitely, calling release when it no longer needs it. when the last pointer to an interface is released, the interface (and consequently, typically the underlying object) will delete itself. as long as there is an outsta...
...nd release. a rule of xpcom is that any function that creates or returns an interface pointer will have already
addrefed it. the caller can then hold onto the reference indefinitely, calling release when it no longer needs it. when the last pointer to an interface is released, the interface (and consequently, typically the underlying object) will delete itself. as long as there is an outstanding
addref against the interface, it continues to exist. if you forget to call release, the object will leak, i.e., the storage for that object will never be reclaimed. leaks are bad :-). a reference through which you will call
addref and release is called an owning reference. it holds a stake in the underlying object. that object cannot go away until the owning reference has relinquished its claim. not...
...And 41 more matches
Install Manifests - Archive of obsolete content
introduction an install manifest is the file an
add-on manager-enabled xul application (e.g. firefox or thunderbird) uses to determine information about an
add-on as it is being installed. it contains metadata identifying the
add-on, providing information about who created it, where more information can be found about it, which versions of what applications it is compatible with, how it should be updated, and so on. the format of the install manifest is rdf/xml. the file must be called install.rdf and live at the top level of an
add-on's xpi file. layout the basic layout of an install manifest is like so: <?xml version="1.0" encoding="utf-8"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla...
.../1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <!-- properties --> </description> </rdf> some properties are required, some are optional. some have simple string values, some are complex resources. required property reference your install manifest must specify these properties correctly otherwise your
add-on may not install. id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier to generate and manipulate. firefox 1.5 has checking to ensure that your id falls into one format or the other and will refuse to install
add-ons that have malformed ids. you should not use a ...
... install. id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier to generate and manipulate. firefox 1.5 has checking to ensure that your id falls into one format or the other and will refuse to install
add-ons that have malformed ids. you should not use a real email
address for your id, however, as it might attract spam. note: the id property is optional in a webextension. if you do not provide an id, the
add-ons site will generate an id for your
add-on automatically. examples <em:id>extensionname@example.org</em:id> <em:id>{daf44bf7-a45e-4450-979c-91cf07434c3d}</em:id> name the name of the
add-on; intended for display in the ui. examples <em:name>my ...
...And 38 more matches
Box-shadow generator - CSS: Cascading Style Sheets
this tool lets you construct css box-shadow effects, to
add box shadow effects to your css objects. ...
... this tool lets you construct css box-shadow effects, to
add box shadow effects to your css objects. ...
..."> <div class="ui-slider-name"> position x </div> <div class="ui-slider-btn-set" data-topic="posx" data-type="sub"></div> <div class="ui-slider" data-topic="posx" data-min="-500" data-max="500" data-step="1"> </div> <div class="ui-slider-btn-set" data-topic="posx" data-type="
add"></div> <div class="ui-slider-input" data-topic="posx" data-unit="px"></div> </div> <div class="slidergroup"> <div class="ui-slider-name"> position y </div> <div class="ui-slider-btn-set" data-topic="posy" data-type="sub"></div> <div class="ui-slider" data-topic=...
...And 38 more matches
cfx - Archive of obsolete content
cfx usage is: cfx [options] command [command-specific options] "options" are global options applicable to the tool itself or to all commands (for example --help). ...
...cfx usage is: cfx [options] command [command-specific options] "options" are global options applicable to the tool itself or to all commands (for example --help). ...
...cfx usage is: cfx [options] command [command-specific options] "options" are global options applicable to the tool itself or to all commands (for example --help). ...
...And 36 more matches
jpm - Archive of obsolete content
installing npm there are two ways to get npm. download and install node.js from nodejs.org. node.js includes npm. or, if you have a package manager like apt, install npm via that. ...
... installing npm there are two ways to get npm. download and install node.js from nodejs.org. node.js includes npm. or, if you have a package manager like apt, install npm via that. ...
...u would any other npm package. ...
...And 36 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
raded extension" award in mozilla's 2006 "extend firefox" competition for scrapbook, and was runner-up in the "extend firefox 2" contest for firegestures. the chapters so far have each focused on technologies in isolation—xul, javascript, css, and xpcom. in this chapter, we’ll discuss how to put them together to actually build an extension. an easier method of building a firefox/thunderbird
addon for developers who are well-acquainted with ides like netbeans, eclipse, etc. is to use netbeans (ide from sun microsystems) and foxbeans (plugin for netbeans, by teesoft). setting up your development environment in order to develop (and test) extensions in a most convenient way it is recommended to apply some changes to firefox. in the following you will find a brief description how to do s...
...—to create them, right-click, select “new>boolean”, and type in the name and set the value accordingly. install the dom inspector the dom inspector is an extension that lets you examine html and xul dom tree structures, javascript objects and css properties, etc. this is not required for developing extensions, but it is handy to have around. install extensions for firefox from the mozilla
add-ons website. optional - install firebug and chromebug chromebug is used by the firebug development team to develop firebug. you can use it to help debug firefox extensions as well as to inspect and learn how the firefox ui (chrome) is constructed. you can learn more about chromebug and download it at http://getfirebug.com/wiki/index.php/chromebug_user_guide you may also find this extension...
...d chromebug chromebug is used by the firebug development team to develop firebug. you can use it to help debug firefox extensions as well as to inspect and learn how the firefox ui (chrome) is constructed. you can learn more about chromebug and download it at http://getfirebug.com/wiki/index.php/chromebug_user_guide you may also find this extension to be valuable: extension developer https://
addons.mozilla.org/firefox/
addon/7434 developing extensions: what you need to know let’s delve into chrome, something you’ll need to know about in order to develop extensions. chrome what is chrome? “chrome”is the word used to describe all the gui structural elements that go into an xul application. for example, in the firefox browser window, everything other than the web page being di...
...And 36 more matches
Using IndexedDB - Web APIs
article and its subpages. this article documents the types of objects used by indexeddb, as well as the methods of the asynchronous api (the synchronous api was removed from spec). basic pattern the basic pattern that indexeddb encourages is the following: open a database. create an object store in the database. start a transaction and make a request to do some database operation, like
adding or retrieving data. wait for the operation to complete by listening to the right kind of dom event. do something with the results (which can be found on the request object). with these big concepts under our belts, we can get to more concrete stuff. creating and structuring the store using an experimental version of indexeddb in case you want to test your code in browsers that...
... otherwise it will be converted to the closest lower integer and the transaction may not start, nor the upgradeneeded event trigger. so for example, don't use 2.4 as a version number: var request = indexeddb.open("mytestdatabase", 2.4); // don't do this, as the version will be rounded to 2 generating handlers the first thing you'll want to do with almost all of the requests you generate is to
add success and error handlers: request.onerror = function(event) { // do something with request.errorcode! }; request.onsuccess = function(event) { // do something with request.result! }; which of the two functions, onsuccess() or onerror(), gets called? if everything succeeds, a success event (that is, a dom event whose type property is set to "success") is fired with request as its target. o...
...nerror = function(event) { console.log("why didn't you allow my web app to use indexeddb?!"); }; request.onsuccess = function(event) { db = event.target.result; }; handling errors as mentioned above, error events bubble. error events are targeted at the request that generated the error, then the event bubbles to the transaction, and then finally to the database object. if you want to avoid
adding error handlers to every request, you can instead
add a single error handler on the database object, like so: db.onerror = function(event) { // generic error handler for all errors targeted at this database's // requests! console.error("database error: " + event.target.errorcode); }; one of the common possible errors when opening a database is ver_err. it indicates that the version of ...
...And 36 more matches
Color picker tool - CSS: Cascading Style Sheets
i-color-picker .info { width: 200px; margin: 5px; float: left; } .ui-color-picker .info * { float: left; } .ui-color-picker .input { width: 64px; margin: 5px 2px; float: left; } .ui-color-picker .input .name { height: 20px; width: 30px; text-align: center; font-size: 14px; line-height: 18px; float: left; } .ui-color-picker .input input { width: 30px; height: 18px; margin: 0; p
adding: 0; border: 1px solid #ddd; text-align: center; float: right; -moz-user-select: text; -webkit-user-select: text; -ms-user-select: text; } .ui-color-picker .input[data-topic="lightness"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="value"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="lightness"] { display: block; } .ui-color-pi...
... .ui-color-picker .input[data-topic="alpha"] > .name { width: 60px; } .ui-color-picker .input[data-topic="alpha"] > 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; p
adding: 2px 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* preview color */ .ui-color-picker .preview { 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 .preview:before { height: 100...
...ition: all 0.5s; } .ui-color-picker .switch_mode:hover { background-color: #ccc; cursor: pointer; } /* * ui component */ .ui-input-slider { height: 20px; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; p
adding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; p
adding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png...
...And 36 more matches
Drawing graphics - Learn web development
you were rendering a constantly updating graph of stock prices, the fallback content could be a static image of the latest stock graph, with alt text saying what the prices are in text. creating and sizing our canvas let's start by creating our own canvas that we draw future experiments on to. first make a local copy of our 0_canvas_start.html file, and open it in your text editor. ...
...ic image of the latest stock graph, with alt text saying what the prices are in text. creating and sizing our canvas let's start by creating our own canvas that we draw future experiments on to. first make a local copy of our 0_canvas_start.html file, and open it in your text editor.
add the following code into it, just below the opening <body> tag: <canvas class="mycanvas"> <p>
add suitable fallback here.</p> </canvas> we have
added a class to the <canvas> element so it will be easier to select if we have multiple canvases on the page, but we have removed the width and height attributes for now (you could
add them back in if you wanted, but we will set them using javascript in a below section). canvases with no explicit width and height default to 300 pixels wide by 150 ...
....</p> </canvas> we have
added a class to the <canvas> element so it will be easier to select if we have multiple canvases on the page, but we have removed the width and height attributes for now (you could
add them back in if you wanted, but we will set them using javascript in a below section). canvases with no explicit width and height default to 300 pixels wide by 150 pixels high. now
add the following lines of javascript inside the <script> element: const canvas = document.queryselector('.mycanvas'); const width = canvas.width = window.innerwidth; const height = canvas.height = window.innerheight; here we have stored a reference to the canvas in the canvas constant. in the second line we set both a new constant width and the canvas' width property equal to window.innerwidth...
...And 35 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
the requested resource. 3 502 502, bad gateway, glossary, http errors, infrastructure, navigation an http error code meaning "bad gateway". 4 alpn alpn, draft, glossary, needscontent, tls application-layer protocol negotiation (alpn) is a tls extension which indicates what application layer protocol is negotiating the encryped connection without requiring
additional round trips. 5 api codingscripting, glossary, infrastructure an api (application programming interface) is a set of features and rules that exist inside a software program (the application) enabling interaction with it through software - as opposed to a human user interface. the api can be seen as a simple contract (the interface) between the application offering it an...
... a software program (the application) enabling interaction with it through software - as opposed to a human user interface. the api can be seen as a simple contract (the interface) between the application offering it and other items, such as third party software 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 st...
...sented in digital form as a collection of numbers, each representing the strength or intensity level of a given component of the color. each of these components is called a channel. in a typical image file, the color channels describe how much red, green, and blue are used to make up the final color. to represent a color through which the background can be seen to some extent, a fourth channel is
added to the color: the alpha channel. the alpha channel specifies how opaque the color is. 19 apple safari glossary, navigation, webmechanics safari is a web browser developed by apple and bundled with both macos and ios. it's based on the open source webkit engine. 20 application context codingscripting, glossary an application context is a top-level browsi...
...And 34 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
data-min="-180" data-value="0" data-max="180"></div> </div> </div> <div id="tool-section" class="section"> <div class="title"> tool settings </div> <div class="property"> <div class="name"> alpha background </div> <div id="canvas-bg"></div> <div id="
add-axis" class="button">
add line </div> </div> <div id="order"> <div id="gradient-axes"></div> <div id="gradient-order"></div> </div> </div> </div> <div id="output"> <div class="css-property"> <span class="property">background:</span> <span...
...i-color-picker .info { width: 200px; margin: 5px; float: left; } .ui-color-picker .info * { float: left; } .ui-color-picker .input { width: 64px; margin: 5px 2px; float: left; } .ui-color-picker .input .name { height: 20px; width: 30px; text-align: center; font-size: 14px; line-height: 18px; float: left; } .ui-color-picker .input input { width: 30px; height: 18px; margin: 0; p
adding: 0; border: 1px solid #ddd; text-align: center; float: right; -moz-user-select: text; -webkit-user-select: text; -ms-user-select: text; } .ui-color-picker .input[data-topic="lightness"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="value"] { display: none; } .ui-color-picker[data-mode='hsl'] .input[data-topic="lightness"] { display: block; } .ui-color-pi...
... .ui-color-picker .input[data-topic="alpha"] > .name { width: 60px; } .ui-color-picker .input[data-topic="alpha"] > 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; p
adding: 2px 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* preview color */ .ui-color-picker .preview { 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 .preview:before { height: 100%; width: 50%; left: 50%; top:...
...And 34 more matches
Content Scripts - Archive of obsolete content
many
add-ons need to access and modify the content of web pages. but the main
add-on code doesn't get direct access to web content. instead, sdk
add-ons need to factor the code that gets access to web content into separate scripts that are called content scripts. this page describes how to develop and implement content scripts. content scripts can be one of the more confusing aspects of working with the sdk, but you're very likely to have to use them. ...
...get direct access to web content. instead, sdk
add-ons need to factor the code that gets access to web content into separate scripts that are called content scripts. this page describes how to develop and implement content scripts. content scripts can be one of the more confusing aspects of working with the sdk, but you're very likely to have to use them. ...
...em. there are five basic principles: the
add-on's main code, including "main.js" and other modules in "lib", can use the sdk high-level and low-level apis, but can't access web content directly content scripts can't use the sdk's apis (no access to globals exports, require) but can access web content sdk apis that use content scripts, like page-mod and tabs, provide functions that enable the
add-on's main code to load content scripts into web pages content scripts can be loaded in as strings, but are more often stored as separate files under the
add-on's "data" directory. jpm doesn't make a "data" directory by default, so you must
add it and put your content scripts in there. a message-passing api allows the main code and content scripts to communicate with each other this complete a...
...And 33 more matches
Client-side storage - Learn web development
ould see the name item returned. now close down the browser and open it up again. enter the following lines again: let myname = localstorage.getitem('name'); myname you should see that the value is still available, even though the browser has been closed and then opened again. separate storage for each domain there is a separate data store for each domain (each separate web
address loaded in the browser). you will see that if you load two websites (say google.com and amazon.com) and try storing an item on one website, it won't be available to the other website. this makes sense — you can imagine the security issues that would arise if websites could see each other's data! a more involved example let's apply this new-found knowledge by writing a simple working examp...
...ces a javascript file called index.js (see line 40). we need to create this and write our javascript code into it. create an index.js file in the same directory as your html file. we'll start off by creating references to all the html features we need to manipulate in this example — we'll create them all as constants, as these references do not need to change in the lifecycle of the app. ...
... submitbtn = document.queryselector('#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 previous code: // stop the form from submitting when a button is pressed form.
addeventlistener('submit', function(e) { e.preventdefault(); }); 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 h...
...And 33 more matches
Starting WebLock
ation create a component. since the component hasn't been created yet, there are no instantiated nsiobserver objects that can be passed into the nsiobserverservice, nor can the component code do anything until it is loaded. registering for notifications the nsiobserverservice interface has methods for registering and unregistering an nsiobserver object. these two methods are used to dynamically
add or remove an observer to a notification topic. but weblock needs to be instantiated and
added to the observer service automatically, which also implies some sort of persistent data (after all, we want to have the component start up every time the application does). this is where a new service that manages sets of related data comes in handy. this service, the nsicategoryservice, is what xpcom an...
... the name-value pair could contain the contract ids required to create the components requesting startup. in fact, this is exactly how categories are used to handle registration with xpcom for startup notification. you will see the code which does this in the next section. getting access to the category manager two fields in the nsmodulecomponentinfo structure introduced in the last section are
addresses for registration and unregistration callbacks. the first callback is called when the component's nsimodule::registerself method is called. this callback allows the component to execute any one-time registration code it may need. the inverse of this function is the unregistration callback, where it's a good idea to undo whatever the registration function did. the two functions look like this...
...th, const char *registrylocation, const nsmodulecomponentinfo *info); the names of the functions can be anything you wish. both functions are passed the component manager and the path to the component, including the opaque registrylocation. these are also parameters in the nsimodule implementation in xxx what is example 1? link to it hereexample 1. in
addition to these parameters, the callback functions are passed the nsmodulecomponentinfo struct, which is the same structure initially passed into ns_impl_nsgetmodule. during registration, the registration callback is where you get the nsicategorymanager. once you have it, you can
add the component to the category of components that get started automatically. as a service, the nsicategorymanager is...
...And 33 more matches
Reference Manual
r is the exact same size and shape as a raw xpcom interface pointer. it can be used as a member variable without introducing bloat. most of the work of being an owning reference can be done in the constructor, destructor, and assignment operators of nscomptr. whenever you `point' the nscomptr at a different xpcom object (by assignment or initialization), it must release its old value, if any, and
addref the new. at its own destructor time it must release as well. nscomptr only does exactly the work you would have done, if you always remembered to do the right thing. safety features type safeguards it is an invariant of nscomptr that it holds the xpcom-correct interface pointer for it's underlying type. for example, an nscomptr<nsifoo> will always hold the pointer that would be returned by que...
...te: default initialized to |0| foo->dosomething(); // ns_precondition: "you can't dereference a null nscomptr with operator->()" a similar precondition intervenes on behalf of operator*. reference-counting safeguards all of the operations that extract the underlying raw pointer out of an nscomptr use a c trick to implement another safety feature. the pointer returned cannot be
addrefed, released, or deleted. nscomptr<nsifoo> foo = ...; foo->
addref(); // error: |
addref| is private delete foo.get(); // error: |operator delete| is private ns_release(foo); // error: |release| is private of course, the most important safety feature provided by nscomptr is that it
addrefs and releases automatically at the appropriate times. castin...
...bug_ptr_types, else some parts will be expecting a base class and others will not. the app will not link. unit tests the unit tests for nscomptr can be found in the file /xpcom/tests/testcomptr.cpp initialization and assignment built-in forms assignment into, or initialization of an nscomptr is easy to understand. the nscomptr releases its old value, if any, and then assigns in the new value,
addrefing it and/or calling queryinterface as you direct by "annotating" the assignment with directives like dont_
addref. this section describes each of the possibilities, though the directives can be more succinctly described in the table below. you can construct an nscomptr from, or assign into it any of the following the value 0 another nscomptr of the same type a raw xpcom interface pointe...
...And 33 more matches
Index
andled user requests. 6 activity manager interfaces thunderbird this page describes the programmatic interfaces behind the activity manager component. the functionality of the component is described on the activity manager page, and the activity manager examples page has code snippets. see nsiactivitymanager.idl and nsiactivity.idl files for source documentation. ...
...onality of the component is described on the activity manager page, and the activity manager examples page has code snippets. see nsiactivitymanager.idl and nsiactivity.idl files for source documentation. 7
address book interfaces mailnews, mozilla, seamonkey, thunderbird this page contains a list of the interfaces that you'll will most likely hit when writing patches for the
address book or writing extensions. the complete list of interfaces for the
address book can be found here. ...
...as code snippets. see nsiactivitymanager.idl and nsiactivity.idl files for source documentation. 7
address book interfaces mailnews, mozilla, seamonkey, thunderbird this page contains a list of the interfaces that you'll will most likely hit when writing patches for the
address book or writing extensions. the complete list of interfaces for the
address book can be found here.
address book examples show how to perform various tasks and provide code snippets. 8
address book examples mailnews, seamonkey, thunderbird this article provides examples on accessing and manipulating thunderbird
address books.
address book interfaces provides an overview of the related interfaces. see an overview of thunderbird components for a general description of the thunder...
...And 33 more matches
Code Samples
getting the directory where your
add-on is located if you need to determine the directory in which your
add-on is installed, code like the following will do the trick. simply replace yourextensionid with your
add-on's id. ...
... getting the directory where your
add-on is located if you need to determine the directory in which your
add-on is installed, code like the following will do the trick. simply replace yourextensionid with your
add-on's id. ...
... getting the directory where your
add-on is located if you need to determine the directory in which your
add-on is installed, code like the following will do the trick. simply replace yourextensionid with your
add-on's id. ...
...And 32 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
er windows or linux systems (i suspect mac osx would be fine too). instead of configuring end user individual preferences files (~/.mozilla/default/randomdir/prefs.js) we now use a centralized default set of preferences. this centralized preference file can lock preferences (lockpref) or initialize them (defaultpref) based on environment variables (user, home...) and/or ldap queries (fetch email
address, common name , language, homepage etc...) from the enterprise directory. central configuration file that feature is provided through a javascript file. file location (not tested since 2012 ...) in thunderbird , firefox, the javascript preference file that calls the centralized preference file is located in $install_dir_moz_app/defaults/pref, for example in thunderbird this would be repect...
...d and executed. for mozilla 1.x.x, firefox, thunderbird or netscape 7 it is still a javascript file, the byte-shift is 13 by default, but can be removed using the pref("general.config.obscure_value", 0); preference in any appropriate .js file dedicated to autoconfig (here autoconf.js). the name of the file can be anything you want because it is named by a general.config preference that should be
added at the end of file mozilla_home/default/pref/autoconf.js or mozilla_home/greprefs/autoconf.js: pref("general.config.filename", "mozilla.cfg");. 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/thunderbir...
...w.alain.knaff.lu/howto/mozi...z-byteshift.pl. for netscape 4.x the convert function from the client customization kit (cck) could also do that (and other things like personalize auto-installation...): http://developer.netscape.com/docs/manuals/deploymt/config.htm. ...
...And 31 more matches
Using DTMF with WebRTC - Web APIs
g"></div> javascript let's take a look at the javascript code next. keep in mind that the process of establishing the connection is somewhat contrived here; you normally don't build both ends of the connection in the same document. global variables first, we establish global variables. let dialstring = "12024561111"; let callerpc = null; let receiverpc = null; let dtmfsender = null; let has
addtrack = false; let mediaconstraints = { audio: true, video: false }; let offeroptions = { offertoreceiveaudio: 1, offertoreceivevideo: 0 }; let dialbutton = null; let logelement = null; these are, in order: dialstring the dtmf string the caller will send when the "dial" button is clicked. callerpc and receiverpc the rtcpeerconnection objects representing the caller and the recei...
.... callerpc and receiverpc the rtcpeerconnection objects representing the caller and the receiver, respectively. these will be initialized when the call starts up, in our connectanddial() function, as shown in starting the connection process below. dtmfsender the rtcdtmfsender object for the connection. this will be obtained while setting up the connection, in the gotstream() function shown in
adding the audio to the connection. has
addtrack because some browsers have not yet implemented rtcpeerconnection.
addtrack(), therefore requiring the use of the obsolete
addstream() method, we use this boolean to determine whether or not the user agent supports
addtrack(); if it doesn't, we'll fall back to
addstream(). this gets figured out in connectanddial(), as shown in starting the connection pr...
...udio but not video. dialbutton and logelement these variables will be used to store references to the dial button and the <div> into which logging information will be written. they'll get set up when the page is first loaded. see initialization below. ...
...And 31 more matches
panel - Archive of obsolete content
usage this module exports a single constructor function panel() which constructs a new panel. a panel is a dialog. its content is specified as html and you can execute scripts in it, so the appearance and behavior of the panel is limited only by what you can do using html, css, and javascript. the screenshot below shows a panel whose content is built from the list of currently open tabs: panels are useful for presenting temporary interfaces to users in a way that is easier for users to ignore and dismiss than a modal dialog, since panels are hidden the moment users interact with parts of the application interface outside them. ...
...al dialog, since panels are hidden the moment users interact with parts of the application interface outside them. a panel's content is loaded as soon as it is created, before the panel is shown, and the content remains loaded when a panel is hidden, so it is possible to keep a panel around in the background, updating its content as appropriate in preparation for the next time it is shown. your
add-on can receive notifications when a panel is shown or hidden by listening to its show and hide events. opening a panel will close any panel created by the panel() constructor that is already open, even if that panel was opened by a different
add-on sdk based extension. if you want to close an existing panel without opening a new one, you can call the hide() or the destroy() method. panel conte...
...s content is specified as html, which is loaded from the url supplied in the contenturl option to the panel's constructor. ...
...And 30 more matches
2D maze game with device orientation - Game development
yle> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/preloader.js"></script> <script src="src/mainmenu.js"></script> <script src="src/howto.js"></script> <script src="src/game.js"></script> </head> <body> <script> (function() { var game = new phaser.game(320, 480, phaser.canvas, 'game'); game.state.
add('boot', ball.boot); game.state.
add('preloader', ball.preloader); game.state.
add('mainmenu', ball.mainmenu); game.state.
add('howto', ball.howto); game.state.
add('game', ball.game); game.state.start('boot'); })(); </script> </body> </html> so far we have a simple html website with some basic content in the <head> section: charset, title, css styling and the inclusion of the jav...
....canvas, 'game'); the line above will initialize the phaser instance — the arguments are the width of the canvas, height of the canvas, rendering method (we're using canvas, but there are also webgl and auto options available) and the optional id of the dom container we want to put the canvas in. ...
...he phaser instance — the arguments are the width of the canvas, height of the canvas, rendering method (we're using canvas, but there are also webgl and auto options available) and the optional id of the dom container we want to put the canvas in. if there's nothing specified in that last argument or the element is not found, the canvas will be
added to the <body> tag. without the framework, to
add the canvas element to the page, you would have to write something like this inside the <body> tag: <canvas id='game' width='320' height='480'></canvas> the important thing to remember is that the framework is setting up helpful methods to speed up a lot of things like image manipulation or assets management, which would be a lot harder to do manually. note: you can read the building monster w...
...And 30 more matches
React interactivity: Events and state - Learn web development
previous overview: client-side javascript frameworks next with our component plan worked out, it's now time to start updating our app from a completely static ui to one that actually allows us to interact and change things. 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. handling events if you've only written vanilla javascript before now, you might be used to having a s...
... objective: to learn about handling events and state in react, and use those to start making the case study app interactive. handling events if you've only written vanilla javascript before now, you might be used to having a separate javascript file, where you query for some dom nodes and attach listeners to them. ...
..."hi!"); }); in react, we write event handlers directly on the elements in our jsx, like this: <button type="button" onclick={() => alert("hi!")} > say hi! </button> note: this may seem counter-intuitive regarding best-practice advice that tends to advise against use of inline event handlers on html, but remember that jsx is actually part of your javascript. in the above example, we're
adding an onclick attribute to the <button> element. the value of that attribute is a function that triggers a simple alert. the onclick attribute has special meaning here: it tells react to run a given function when the user clicks on the button. there are a couple of other things to note: the camel-cased nature of onclick is important — jsx will not recognize onclick (again, it is already use...
...And 30 more matches
nsIZipWriter
modules/libjar/zipwriter/public/nsizipwriter.idlscriptable this interface provides an easy way for scripts to archive data in the zip file format. operations on the archive can be performed one by one, or queued for later execution. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) once all the operations you wish to perform are
added to the queue, a call to processqueue() will perform the operations in the order they were
added to the queue. operations performed on the queue throw any errors that occur out to the observer. attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception. file and directory names should use slashes ("/") a...
... implemented by: @mozilla.org/zipwriter;1. ...
...ns performed on the queue throw any errors that occur out to the observer. attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception. file and directory names should use slashes ("/") as separators and should not begin with a slash. ...
...And 30 more matches
Index - Learn web development
don't have much experience, starting out with a blank page might be a bit scary. we have over 25 years' experience and we'll give you some common rules of thumb to help you design your site. 28 what is a domain name? beginner, domain names, infrastructure, intro, needsactivelearning, web domain names are a key part of the internet infrastructure. they provide a human-readable
address for any web server available on the internet. 29 what is a url? beginner, infrastructure, needsactivelearning, url, resources, urls with hypertext and http, url is one of the key concepts of the web. it is the mechanism used by browsers to retrieve any published resource on the web. 30 what is a web server? beginner, infrastructure, needsschema the te...
...but fortunately, you can get started in web development without knowing anything about most of these. in this article, we'll just set you up with a bare minimum — a text editor and some modern web browsers. 42 javascript basics beginner, codingscripting, javascript, learn, web, l10n:priority 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. 43 publishing your website beginner, codingscripting, ftp, github, google app engine, learn, web, l10n:priority, publishing, web server publishing a website is a complex topic because there are many ways to go about it. this art...
...ls, javascript, learn, optimize, promises, async, asynchronous, await, requestanimationframe, setinterval, settimeout, timeouts to finish this module off, we'll provide a brief discussion of the different coding techniques and features we've discussed throughout, looking at which one you should use when, with recommendations and reminders of common pitfalls where appropriate. we'll probably
add to this resource as time goes on. 51 cooperative asynchronous javascript: timeouts and intervals animation, beginner, codingscripting, guide, intervals, javascript, loops, asynchronous, requestanimationframe, setinterval, settimeout, timeouts this tutorial looks at the traditional methods javascript has available for running code asychronously after a set time period has elap...
...And 29 more matches
widget - Archive of obsolete content
deprecated in firefox 29 and removed in firefox 38. the widget api is deprecated from firefox 29 onwards. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. create a simple user interface for an
add-on in firefox's
add-on bar. usage "widgets" are small pieces of content that live in the firefox 4
add-on bar. ...
...es of content that live in the firefox 4
add-on bar. they can be simple icons or complex web pages. you can attach panels to them that open when they're clicked, or you can define a custom click handler to perform some other action, like opening a web page in a tab. there are a few advantages to using widgets over an ad hoc user interface. first, your users will be accustomed to interacting with
add-ons via widgets and the
add-on bar. second, it allows firefox to treat your interface as a first-class citizen. for example, in the future firefox may allow the user to drag widgets from the
add-on bar to other toolbars. by exposing your interface as a widget, your
add-on would automatically inherit such functionality. creation and content widgets can contain images or arbitrary web content. yo...
...if the content is an image, it is automatically scaled to be 16x16 pixels. ...
...And 27 more matches
How to build custom form controls - Learn web development
or very large industry players who have enough reach that an interaction they create can become a standard. for example, apple introduced the scroll wheel with the ipod in 2001. they had the market share to successfully introduce a completely new way of interacting with a device, something most device companies can't do. it is best not to invent new user interactions. for any interaction you do
add, it is vital to spend time in the design stage; if you define a behavior poorly, or forget to define one, it will be very hard to redefine it once the users have gotten used to it. if you have doubts, ask for the opinions of others, and if you have the budget for it, do not hesitate to perform user tests. this process is called ux design. if you want to learn more about this topic, you should che...
...e sure that we don't bind our css and javascript to a strong html structure, so that we can make implementation changes later without breaking code that uses the control. for example, what if you wish to implement the equivalent of the <optgroup> element later on? class names, however, provide no semantic value. in this current state, the screen reader user only "sees" an unordered list. we will
add aria semantics in a bit. creating the look and feel using css now that we have a structure, we can start designing our control. the whole point of building this custom control is to be able to style it exactly how we want. to that end, we will split our css work into two parts: the first part will be the css rules absolutely necessary to make our control behave like a <select> element, and the ...
...o two parts: the first part will be the css rules absolutely necessary to make our control behave like a <select> element, and the second part will consist of the fancy styles used to make it look the way we want. required styles the required styles are those necessary to handle the three states of our control. .select { /* this will create a positioning context for the list of options;
adding this to .select:focus-within will be a better option when fully supported */ position: relative; /* this will make our control become part of the text flow and sizable at the same time */ display : inline-block; } we need an extra class active to define the look and feel of our control when it is in its active state. because our control is focusable, we double this custom style with ...
...And 27 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
add-on versioning
add-ons should specify their versions using the toolkit version format. as a rough overview this is a version string split by periods, some examples: 2.0 1.0b1 3.0pre1 5.0.1.2 note: before firefox 1.5 the more basic firefox version format was used: major.minor.release.build[+] where only digits were allowed. the toolkit version format supports the firefox version format but allows greater flexibility. how applications determine compatibility when installing
add-ons applications look at the targetapplication entries in the
add-on's install.rdf. an entry must exist with an id matching the id of the application.
additionally the minversion and maxversion of this entry must be a range that includes the version of the running application. if the application ha...
... if the install.rdf contains any targetplatform entries then the platform of the currently running application must be listed or the installation will be rejected. ...
....rdf contains any targetplatform entries then the platform of the currently running application must be listed or the installation will be rejected. firefox 3 note in applications based on gecko 1.9 you can also use a targetapplication entry with an id toolkit@mozilla.org and minversion and maxversion that match the toolkit version of the running application. this allows you to say that your
add-on will install into any toolkit based application. overriding compatibility checking for testing purposes you can tell the application to somewhat ignore compatibility checks when installing
add-ons. simply create the boolean preference extensions.checkcompatibility and set it to false. note: before firefox 1.5 the preference app.extensions.version could be used to override the version tha...
...And 26 more matches
Client-side form validation - Learn web development
y popular site with a registration form, and you will notice that they provide feedback when you don't enter your data in the format they are expecting. you'll get messages such as: "this field is required" (you can't leave this field blank). "please enter your phone number in the format xxx-xxxx" (a specific data format is required for it to be considered valid). "please enter a valid email
address" (the data you entered is not in the right format). "your password needs to be between 8 and 30 characters long and contain one uppercase letter, one symbol, and a number." (a very specific data format is required for your data). this is called form validation. when you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the con...
...we've seen many of these earlier in the course, but to recap: required: specifies whether a form field needs to be filled in before the form can be submitted. minlength and maxlength: specifies the minimum and maximum length of textual data (strings) min and max: specifies the minimum and maximum values of numerical input types type: specifies whether the data needs to be a number, an email
address, or some other specific preset type. pattern: specifies a regular expression that defines a pattern the entered data needs to follow. if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid. if not, it is considered invalid. when an element is valid, the following things are true: the element matches the :valid css pseudo-...
...you prefer a banana or cherry?</label> <input id="choose" name="i_like"> <button>submit</button> </form> input:invalid { border: 2px dashed red; } input:valid { border: 2px solid black; } to begin, make a copy of fruit-start.html in a new directory on your hard drive. the required attribute the simplest html5 validation feature is the required attribute. to make an input mandatory,
add this attribute to the element. when this attribute is set, the element matches the :required ui pseudo-class and the form won't submit, displaying an error message on submission when the input is empty. while empty, the input will also be considered invalid, matching the :invalid ui pseudo-class.
add a required attribute to your input, as shown below. <form> <label for="choose">would you pref...
...And 26 more matches
NSS tools : certutil
ent, see the modutil manpage. options and arguments running certutil always requires one and only one command option to specify the type of certificate operation. each option may take arguments, anywhere from none to multiple arguments. the command option -h will list all the command options available and their relevant arguments. command options -a
add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this command option will initialize one by default. -b run a series of commands from the specified batch file. this requires the -i argument. -c create a new binary certificate file from a binary cert...
... create a new binary certificate file from a binary certificate request file. use the -i argument to specify the certificate request file. if this argument is not used, certutil prompts for a filename. -d delete a certificate from the certificate database. --rename change the database nickname of a certificate. -e
add an email certificate to the certificate database. -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, rsa, or ecc key. if you don't use the -k argu...
... print the certificate chain. -r create a certificate request file that can be submitted to a certificate authority (ca) for processing into a finished certificate. output defaults to standard out unless you use -o output-file argument. use the -a argument to specify ascii output. -s create an individual certificate and
add it to a certificate database. -t reset the key database or token. -u list all available modules or print a single named module. -v check the validity of a certificate and its attributes. -w change the password to a key database. --merge merge two databases into one. --upgrade-merge ...
...And 26 more matches
Border-image generator - CSS: Cascading Style Sheets
{ width: 83%; } .span_9 { width: 74.54%; } .span_8 { width: 66.08%; } .span_7 { width: 57.62%; } .span_6 { width: 49.16%; } .span_5 { width: 40.7%; } .span_4 { width: 32.24%; } .span_3 { width: 23.78%; } .span_2 { width: 15.32%; } .span_1 { width: 6.86%; } /* sections * ========================================================================== */ .section { clear: both; p
adding: 0px; margin: 0px; } /* grouping * ========================================================================== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { ...
...rgin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except ie6 and lower */ /* * ui component */ .ui-input-slider { height: 20px; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; p
adding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; p
adding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png...
...0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; p
adding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hover { background-color: #379b4a; cursor: pointer; } /*********************************************************************************...
...And 26 more matches
XUL Migration Guide - Archive of obsolete content
this guide aims to help you migrate a xul-based
add-on to the sdk. first we'll outline how to decide whether your
add-on is a good candidate for migration via a comparison of the benefits and limitations of the sdk versus xul development. next, we'll look at some of the main tasks involved in migrating: working with content scripts using the sdk's supported apis how to go beyond the supported apis when necessary, by: using third party modules using the sdk's low-level apis getting direct access to xpcom finally, we'll walk through a simple example. should you migrate? see this comparison of the benefits and limitations of sdk development and xul development. whether you should migrate a particular
add-on is largely a matter of how well the sdk's supported apis...
... using third party modules using the sdk's low-level apis getting direct access to xpcom finally, we'll walk through a simple example. should you migrate? see this comparison of the benefits and limitations of sdk development and xul development. whether you should migrate a particular
add-on is largely a matter of how well the sdk's supported apis meet its needs. ...
...hrough a simple example. should you migrate? ...
...And 25 more matches
context-menu - Archive of obsolete content
adds items, submenus, and menu separators to the page's context menu. usage instead of manually
adding items when particular contexts occur and then removing them when those contexts go away, you bind items to contexts, and the
adding and removing is automatically handled for you. 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 previously 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. ...
...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 previously 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, create your item only once and supply a context that matches the target url. ...
...ant 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, create your item only once and supply a context that matches the target url. context menu items are displayed in the order created or in the case of sub menus the order
added to the sub menu. menu items for each
add-on will be grouped together automatically. if the total number of menu items in the main context menu from all
add-ons exceeds a certain number (normally 10 but configurable with the extensions.
addon-sdk.context-menu.overflowthreshold preference) all of the menu items will instead appear in an overflow menu to avoid making the context menu too large. sp...
...And 25 more matches
ui/frame - Archive of obsolete content
experimental create html iframes, using bundled html, css and javascript, that can be
added to a designated area of the firefox user interface. at the moment you can only
add frames to a toolbar. usage this module exports the frame constructor, which can be used to create frame components. right now it can be used in conjunction with a toolbar: you create a frame, then supply it to the toolbar's constructor, and the content is then displayed inside the toolbar. constructing frames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your
add-ons "data" directory. for example, this html document defines a <select> element and a couple of <span> elements, and includes a css file to style the content and a javascript s...
...doctype html> <html> <head> <link href="city-info.css" rel="stylesheet"></link> </head> <body> <select name="city" id="city-selector"></select> <span id="time" class="info-element"></span> <span id="weather" class="info-element"></span> <script type="text/javascript" src="city-info.js"></script> </body> </html> if we save this document as "city-info.html" under the
add-on's "data" directory, we can create a frame hosting it and
add the frame to a toolbar like this: var { frame } = require("sdk/ui/frame"); var { toolbar } = require("sdk/ui/toolbar"); var frame = new frame({ url: "./city-info.html" }); var toolbar = toolbar({ name: "city-info", title: "city info", items: [frame] }); the toolbar is positioned between the
address bar and the content win...
...fo.html" }); var toolbar = toolbar({ name: "city-info", title: "city info", items: [frame] }); the toolbar is positioned between the
address bar and the content window. it occupies the whole width of the browser window and is 18 pixels high on a normal-resolution display or 36 pixels high on a high-resolution (hidpi) display. this toolbar might look something like: scripting frames to
add scripts to frames, include them directly from the frame's html content, as with a normal web page: <script type="text/javascript" src="frame.js"></script> as usual, the path to the script is relative to the html file's location. messages logged from a frame script using the console will not appear in the terminal when you run the
add-on using jpm run. however, they will appear in the browser ...
...And 25 more matches
Legacy layout methods - Learn web development
it is worth understanding how they work, and why they are different to css grid layout. this lesson will explain how grid systems and grid frameworks based on floats and flexbox work. having studied grid layout you will probably be surprised how complicated this all seems! this knowledge will be helpful to you if you need to create fallback code for browsers that do not support newer methods, in
addition to allowing you to work on existing projects which use these types of systems. it is worth bearing in mind, as we explore these systems, that none of them actually create a grid in the way that css grid layout creates a grid. they work by giving items a size, and pushing them around to line them up in a way that looks like a grid. a two column layout let's start with the simplest possible...
... until it gets to 900px wide, in which case it will stay fixed at this width and center itself in the viewport. by default, its children (the <h1> and the two <div>s) will span 100% of the width of the body. if we want the two <div>s to be floated alongside one another, we need to set their widths to total 100% of the width of their parent element or smaller so they can fit alongside one another.
add the following to the bottom of your css: div:nth-of-type(1) { width: 48%; } div:nth-of-type(2) { width: 48%; } here we've set both to be 48% of their parent's width — this totals 96%, leaving us 4% free to act as a gutter between the two columns, giving the content some space to breathe. now we just need to float the columns, like so: div:nth-of-type(1) { width: 48%; float: left; } ...
...ow"> <div class="col span1">13</div> <div class="col span6">14</div> <div class="col span3">15</div> <div class="col span2">16</div> </div> </div> the aim is to turn this into a demonstration grid of two rows on a twelve column grid — the top row demonstrating the size of the individual columns, the second row some different sized areas on the grid. ...
...And 25 more matches
CustomizableUI.jsm
customizable buttons and items in firefox's main window ui. it is available in the firefox window as the customizableui property on the window. if you want to use it from a jsm or another context without a window reference, you need to import it yourself: components.utils.import("resource:///modules/customizableui.jsm"); introduction the module is intended for two primary purposes: allow
adding, moving and removing customizable widgets. manage the areas in which these widgets are shown. note that it is expressly not really aware about the specific ui used by users to make customizations. this is handled by customizemode.jsm, which interacts with customizableui through a listener mechanism. areas areas are parts of the user interface in which customizable widgets can be placed. c...
...m an anchor (chevron) in the toolbar. in order to register such a toolbar, set the 'overflowable' property to true, and provide the id of the anchor in the 'anchor' property. widgets widget is the term that customizableui uses for each of the items in a customizable area. note that these are also abstract cross-window objects; customizableui will manage the actual dom manipulation involved with
adding/moving/removing widgets in all windows for you. there are three main types of widgets: 'legacy' xul widgets, which are the way customizableui represents widgets whose dom representation is present (or overlaid) into a window; api-style widgets, which are the new widgets customizableui can create and manage for you. these come in 3 types themselves: button which are simple toolbar...
...s in the toolbar, or as a sliding 'subview' of the menu panel when such a widget is in the menu panel. custom which are widgets that are custom-created by some js supplied by the consumer for more details, see api-provided widgets. 'special' widgets: these are the representations of xul <toolbarseparator>, <toolbarspring> and <toolbarspacer> elements. customizableui provides apis to
add, move and remove all these different widgets, and mostly abstracts the dom away from you. the lifetime of your widget should be identical to the lifetime of the
add-on - it's process-global, so if you call createwidget on bootstrap's "startup" and destroywidget on bootstrap's "shutdown", that's enough. listeners customizableui provides a way to listen for various bits of customization happenin...
...And 25 more matches
certutil
modutil manpages. options and arguments running certutil always requires one (and only one) option to specify the type of certificate operation. each option may take arguments, anywhere from none to multiple arguments. run the command option and -h to see the arguments available for each command option. options options specify an action and are uppercase. -a
add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this option will initialize one by default. -b run a series of commands from the specified batch file. this requires the -i argument. -c create a new binary certificate file from a binary certificate re...
...ed batch file. this requires the -i argument. -c create a new binary certificate file from a binary certificate request file. use the -i argument to specify the certificate request file. if this argument is not used, certutil prompts for a filename. -d delete a certificate from the certificate database. -e
add an email certificate to the certificate database. -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, rsa, or ecc key. if you don't use the -k argument, the op...
...o print the certificate chain. -r create a certificate request file that can be submitted to a certificate authority (ca) for processing into a finished certificate. output defaults to standard out unless you use -o output-file argument. use the -a argument to specify ascii output. -s create an individual certificate and
add it to a certificate database. -t reset the key database or token. -u list all available modules or print a single named module. -v check the validity of a certificate and its attributes. -w change the password to a key database. --merge merge a source database into the target database. this is used to ...
...And 25 more matches
Signaling and video calling - Web APIs
article link is forthcoming; it isn't actually online yet) to support opening a two-way video call between users. you can try out this example on glitch, and you can remix the example to experiment with it as well. you can also look at the full project on github. note: if you try out the example on glitch, please note that any changes made to the code will immediately reset any connections. in
addition, there is a short timeout period; the glitch instance is for quick experiments and testing only. the signaling server establishing a webrtc connection between two devices requires the use of a signaling server to resolve how to connect them over the internet. a signaling server's job is to serve as an intermediary to let two peers find and establish a connection while minimizing exposure ...
...dcasting to all connected users, and ensure unrecognized message types are passed through and delivered, without the server needing to know what they are. this lets us send signaling messages using this same server, instead of needing a separate server. let's take a look which changes we need to make to the chat server support webrtc signaling. this is in the file chatserver.js. first up is the
addition of the function sendtooneuser(). as the name suggests, this sends a stringified json message to a particular username. function sendtooneuser(target, msgstring) { var isunique = true; var i; for (i=0; i<connectionarray.length; i++) { if (connectionarray[i].username === target) { connectionarray[i].send(msgstring); break; } } } this function iterates over the li...
...message to see if it has a target property. if that property is present, it specifies the username of the client to which the message is to be sent, and we call sendtooneuser() to send the message to them. otherwise, the message is broadcast to all users by iterating over the connection list, sending the message to each user. as the existing code allows the sending of arbitrary message types, no
additional changes are required. our clients can now send messages of unknown types to any specific user, letting them send signaling messages back and forth as desired. that's all we need to change on the server side of the equation. now let's consider the signaling protocol we will implement. designing the signaling protocol now that we've built a mechanism for exchanging messages, we need a pro...
...And 25 more matches
package.json - Archive of obsolete content
the package.json file contains manifest data for your
add-on, providing not only descriptive information about the
add-on for presentation in the
add-ons manager, but other metadata required of
add-ons. some of its entries, such as icon, name, and description, have direct analogues in the install manifest format, and entries from package.json are written into the install manifest when the
add-on is built using jpm xpi. others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your
add-on. creating a manifest the package.json file is initially generated in your
add-on's root directory the first time you run jpm init. ...
...the install manifest when the
add-on is built using jpm xpi. others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your
add-on. creating a manifest the package.json file is initially generated in your
add-on's root directory the first time you run jpm init. ...
...the
add-on is built using jpm xpi. others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your
add-on. creating a manifest the package.json file is initially generated in your
add-on's root directory the first time you run jpm init. ...
...And 24 more matches
Bootstrapped extensions - Archive of obsolete content
gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduces bootstrapped extensions. ...
...sing overlays to apply their user interface to the application, programmatically insert themselves into the application. this is done using a special script file that's included in the extension that contains functions the browser calls to command the extension to install, uninstall, start up, and shut down. all the application does is call into this script file; the extension is responsible for
adding and removing its user interface and handling any other setup and shutdown tasks it requires. this article discusses how bootstrapped extensions work. see this tutorial on converting from an overlay extension to restartless for a practical step by step guide to migrating. the startup and shutdown process a key feature of bootstrapped extensions is that they must be able to start up and shut ...
...guide to migrating. the startup and shutdown process a key feature of bootstrapped extensions is that they must be able to start up and shut down on demand by the application. when the extension's startup() function is called, it must manually inject its user interface and other behavior into the application. similarly, when its shutdown() function is called, it must remove anything that it has
added to the application, as well as all references to any of its objects. there are several scenarios in which the startup() function may be called; for example: when the extension is first installed, assuming that it's both compatible with the application and is enabled. when the extension becomes enabled using the
add-ons manager window. when the application is started up, if the extension i...
...And 24 more matches
The box model - Learn web development
tion to other boxes on the page: if a box is defined as a block, it will behave in the following ways: the box will break onto a new line. the box will extend in the inline direction to fill the space available in its container. in most cases this means that the box will become as wide as its container, filling up 100% of the space available. the width and height properties are respected. ...
... the <a> element, used for links, <span>, <em> and <strong> are all examples of elements that will display inline by default. ...
...e display type to inline, elements such as headings (e.g. <h1>) and <p> all use block as their outer display type by default. if a box has an outer display type of inline, then: the box will not break onto a new line. the width and height properties will not apply. vertical p
adding, margins, and borders will apply but will not cause other inline boxes to move away from the box. horizontal p
adding, margins, and borders will apply and will cause other inline boxes to move away from the box. the <a> element, used for links, <span>, <em> and <strong> are all examples of elements that will display inline by default. the type of box applied to an element is defined by display property values such as block and inline, and relates to the outer value of display. aside: inner and outer displ...
...And 24 more matches
UI pseudo-classes - Learn web development
selects an element only when it is focused (i.e. by being tabbed to via the keyboard). :active: selects an element only when it is being activated (i.e. while it is being clicked on, or when the return/enter key is being pressed down in the case of a keyboard activation). these basic pseudo-classes should be familiar to you now. more recently, the css selector level 3 and css basic ui level 3
added more pseudo-classes related to html forms that provide several other useful targetting conditions that you can take advantage of. we'll discuss these in more detail in the sections below, but briefly, the main ones we'll be looking at are: :required and :optional: targets required or optional form controls. :valid and :invalid, and :in-range and :out-of-range: target form controls that are ...
...ore the form will successfully submit. for example: <form> <fieldset> <legend>feedback form</legend> <div> <label for="fname">first name: </label> <input id="fname" name="fname" type="text" required> </div> <div> <label for="lname">last name: </label> <input id="lname" name="lname" type="text" required> </div> <div> <label for="email">email
address (include if you want a response): </label> <input id="email" name="email" type="email"> </div> <div><button>submit</button></div> </fieldset> </form> here, the first name and last name are required, but the email
address is optional. you can match these two states using the :required and :optional pseudo-classes. for example, if we apply the following css to the above html: ...
... the word "required" being associated with the controls in question. in the next section, we'll look at a better example of indicating required fields using :required, which also digs into using generated content. note: you'll probably not find yourself using the :optional pseudo-class very often. form controls are optional 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 previous articles, we've seen the usage of generated content, but we thought no...
...And 24 more matches
Performance
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. ...
...r 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 brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. ...
...r 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 work on the window } function dosomething(message) { result = helper(content, message.data) sendasyncmessage("my-
addon:response-from-child", {something: result}) }
addmessagelistener("my-
addon:request-from-parent", dosomething) why is this bad? because declared functions are also objects. and since frame scripts get evaluated for each tab this means new function objects get instantiated, new constants get computed, block scopes must be set up etc. while it may seem fairly innocencous in this toy example, ...
...And 24 more matches
nsIMsgHeaderParser
nsimsgheaderparser defined in comm-central/ mailnews/ mime/ public/ nsimsgheaderparser.idl mailnews/mime/public/nsimsgheaderparser.idlscriptable ???
add brief description of interface ??? ...
...mime/public/nsimsgheaderparser.idlscriptable ???
add brief description of interface ??? ...
...description of interface ??? ...
...And 24 more matches
Configuring Build Options
please read the following directions carefully before building, and follow them in order. ...
...g-firefox calling the file .mozconfig (with a leading dot) is also supported, but this is not recommended because it may make the file harder to find. this will also help when troubleshooting because people will want to know which build options you have selected and will assume that you have put them in your mozconfig file. mozconfig contains two types of options: options prefixed with mk_
add_options are passed to client.mk. the most important of these is moz_objdir, which controls where your application gets built (also known as the object directory). options prefixed with ac_
add_options are passed to configure, and affect the build process. building with an objdir this means that the source code and object files are not intermingled in your directory system and you can build mu...
...nd object files are not intermingled in your directory system and you can build multiple applications (e.g., firefox and thunderbird) from the same source tree. if you do not specify a moz_objdir, it will be automatically set to @topsrcdir@/obj-@config_guess@. if you need to re-run configure, the easiest way to do it is using ./mach configure; running configure manually is strongly discouraged.
adding the following line to your mozconfig allows you to change the objdir: mk_
add_options moz_objdir=@topsrcdir@/obj-@config_guess@ it is a good idea to have your objdir name start with obj so that mercurial ignores it. sometimes it can be useful to build multiple versions of the source (such as with and without diagnostic asserts). to avoid the time it takes to do a full rebuild, you can creat...
...And 23 more matches
InstallListener
installlisteners are notified of an
addoninstall's progress. they may be registered to hear events from all
addoninstalls through
addinstalllistener or to a single
addoninstall through
addlistener. ...
... installlisteners are notified of an
addoninstall's progress. they may be registered to hear events from all
addoninstalls through
addinstalllistener or to a single
addoninstall through
addlistener. ...
... installlisteners are notified of an
addoninstall's progress. they may be registered to hear events from all
addoninstalls through
addinstalllistener or to a single
addoninstall through
addlistener. ...
...And 23 more matches
nsIDOMWindowUtils
, [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 apreventdefault); obsolete since gecko 15.0 boolean sendkeyevent(in astring atype, in long akeycode, in long acharcode, in long amodifiers, [optional] in unsigned long a
additionalflags); 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); void sendmouseeventtowindow(in astring atype, in float ax, in float ay, in long abutton, in long aclickcount, in long amodifiers, [optional] in boolean aignorerootscrol...
... nsidomelement aelement); nsiquerycontenteventresult sendquerycontentevent(in unsigned long atype, in unsigned long 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 a
additionalflags); boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long alength, in boolean areverse); obsolete since gecko 31.0 boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long alength, [optional] in unsigned long a
additionalflags); void sendsimplegestureevent(in astring atype, in float ax, in float ay, in unsigned long adirect...
... the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). obsolete modifier_os 0x1000 getmodifierstate("os") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). key_flag_prevent_default 0x0001 getdefaultprevented() returns true if this is specified to a
additionalflags of sendkeyevent(). deprecated since gecko 38.0 key_flag_not_synthesized_for_tests 0x0002 key_flag_location_standard 0x0010 location attrubute of the sending key event by sendkeyevent() returns keyboardevent.dom_key_location_standard if this is specified to the a
additionalflags. deprecated since gecko 38.0 key_flag_location_left 0x0020 loc...
...And 23 more matches
cfx to jpm - Archive of obsolete content
the current tool is called jpm, and is based on node.js. it replaces the old cfx tool. you can use jpm from firefox 38 onwards. this article highlights the main differences between cfx and jpm. a guide to working with jpm if you're already familiar with cfx. installation cfx is python-based and is distributed as a zip file. jpm is node-js-based and is distributed through npm. so for jpm you don't need python, but you do need npm. to get new updates of cfx you download and extract a new zip file, while to get the new version of jpm, use npm update. for jpm installation instructions, see the installation section in the jpm reference. ...
...le, while to get the new version of jpm, use npm update. for jpm installation instructions, see the installation section in the jpm reference. activation you need to call cfx activate before you can use cfx, and this only works in the current command shell: if you open a new shell you have to call activate again. with jpm, you don't need to activate. once it's installed, you can just use it. ...
... npm update. for jpm installation instructions, see the installation section in the jpm reference. activation you need to call cfx activate before you can use cfx, and this only works in the current command shell: if you open a new shell you have to call activate again. with jpm, you don't need to activate. once it's installed, you can just use it. ...
...And 22 more matches
Menu - Archive of obsolete content
jetpack's menu api allows features to access and modify the browser's built-in menus. features can also create new menus and attach them almost anywhere, chrome or content, as popup menus or context menus. two namespaces are associated with this api: jetpack.menu, which provides access to the browser's menus, and jetpack.menu, the constructor for making new menus. the api is fairly comprehensive, so you may want to start by reading through some examples. ...
.... context is an object describing the context in which the menu was shown. beforeshow may modify the menu, and when the menu is shown, it will reflect the changes. isshowing boolean true if the menu is currently visible and false otherwise. read-only. items array an array of menuitems in the menu. read-only. ...
... methods
add(items) clear() contexton(node) hide() insertbefore(newitems, target) item(target) popupon(node) remove(target) replace(target, newitems) reset() set(items) show(anchornode)
add(items)
adds items to the menu. the position at which the items are
added is at jetpack's discretion. this method and set() are the recommended methods of
adding items to a menu. parameters items a single menuitem or an array of menuitems. clear() removes all items from the menu, even items not
added by the feature. contexton(node) binds the menu to a given node as its context menu...
...And 22 more matches
Modularization techniques - Archive of obsolete content
unknown interface. nsisupports provides two key features, interface interrogation and reference counting. interface interrogation is a simple, uniform mechanism for determining which interfaces a object supports, and for hiding the the mechanics of how the object was implemented. interface interrogation is performed using the queryinterface() method. the caller passes in an id and a pointer to a
address to place the resulting interface. if the query is successful, queryinterface() will return ns_ok. if the object does not support the given interface, it will return ns_nointerface. reference counting is performed using the
addref() and release() methods. an objects reference count generally starts at zero.
addref() increments that reference count, and release() decrements it. if a call to re...
...in debug builds, these macros provide useful reference counting logs. ...
...in debug builds, these macros provide useful reference counting logs. use them wherever possible. ...
...And 22 more matches
Working with Svelte stores - Learn web development
at the beginning we import the alert store. next we import the ondestroy() lifecycle function, which lets us execute a callback after the com...
...o style our alert component. this setup allows us to work with stores in a reactive way. when the value of the store changes, the callback is executed. there we assign a new value to a local variable, and thanks to svelte reactivity all our markup and reactive dependencies are updated accordingly. using the component let's now use our component. in app.svelte we'll import the component;
add the following import statement below the existing one: import alert from './components/alert.svelte' then call the alert component just above the todos call, like this: <alert /> <todos {todos} /> load your test app now, and you should now see the alert message on screen. you may click on it to dismiss it. making stores reactive with the reactive $store syntax this work...
...ores just as easily as using reactive local variables. this is a perfect example of how svelte puts the compiler in charge of better developer ergonomics, not only saving us from typing boiler plate, but also generating less error-prone code. writing to our store writing to our store is just a matter of importing it and executing $store = 'new value'. let's use it in our todos component. ...
...And 21 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
cation-----" #define ns_cert_vfy_trailer "-----end certificate for signature verification-----" #define ns_sig_header "-----begin signature-----" #define ns_sig_trailer "-----end signature-----" #define ns_cert_header "-----begin certificate-----" #define ns_cert_trailer "-----end certificate-----" /* sample 6 commands */ typedef enum { generate_csr,
add_cert_to_db, save_cert_to_header, encrypt, decrypt, sign, verify, unknown } commandtype; typedef enum { symkey = 0, mackey = 1, iv = 2, mac = 3, pad = 4, pubkey = 5, lab = 6, certenc= 7, certvfy= 8, sig = 9 } headertype; /* * print usage message and exit */ static void usage(const char *progname) { ...
..._fprintf(pr_stderr, "%s -g -d %s -s %s -r: certificate request file name not found\n", progname, dbdir, subjectstr); validationfailed = pr_true; } if (validationfailed) { fprintf(stderr, "\nusage: %s %s \n\n", progname, "-g -d <dbdirpath> -s <subject> -r <csr> \n"); exit(-1); } } /* * validate the options used for
add cert to db command */ static void validate
addcerttodbcommand(const char *progname, const char *dbdir, const char *nicknamestr, const char *truststr, const char *certfilename, const char *certreqfilename, const char *issuernames...
...(char *infilename, prbool ascii) { certsigneddata signeddata; secitem reqder; certcertificaterequest *certreq = null; secstatus rv = secsuccess; prarenapool *arena = null; reqder.data = null; arena = port_newarena(der_default_chunksize); if (arena == null) { rv = secfailure; goto cleanup; } rv = re
adderfromfile(&reqder, infilename, ascii); if (rv) { rv = secfailure; goto cleanup; } certreq = (certcertificaterequest*) port_arenazalloc (arena, sizeof(certcertificaterequest)); if (!certreq) { rv = secfailure; goto cleanup; } certreq->arena = arena; /* since cert request is a signed data, must decode to get the ...
...And 21 more matches
Inputs and input sources - Web APIs
in order to make an experience that's fulfilling and engaging, the user needs to be able to interact with it. to that end, webxr provides support for a variety of kinds of input devices. in this guide, we'll look at how to use webxr's input device management features to determine what input sources are available and how to then monitor those sources for inputs in order to handle user interactivity with your virtual or augmented environment. ...
...s a variety of different types of devices to handle targeting and action inputs. these devices include but aren't limited to: screen taps (particularly but not necessarily only on phones or tablets) can be used to simultaneously perform both targeting and selection. motion-sensing controllers, which use accelerometers, magnetometers, and other sensors for motion tracking and targeting and may
additionally include any number of buttons, joysticks, thumbpads, touchpads, force sensors, and so on to provide
additional input sources for both targeting and selection. squeezable triggers or glove grip pads to provide squeeze actions. voice commands using speech recognition. spatially-tracked articulated hands, such as haptic gloves can provide both targeting and squeeze actions, as well as se...
...ting using the main "select" button or other input on the controller to choose the targeted direction (or the object at which it points), or to otherwise engage an action. for details on the primary action, see primary action. squeezing squeezing the controller or a mechanism on the controller to engage a secondary action. the section primary squeeze action describes this in more detail. any
additional capabilities a webxr controller may have are accessed through the input source's gamepad object. this object provides access to all of the buttons, axes, trackpads, and so forth that may be a part of the controller. see advanced controllers using the gamepad object to learn how to use these controllers. properties of input sources each individual xrinputsource has a set of properties tha...
...And 21 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
nt has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. the source of the suggested values is generally up to the browser; typically values come from past values entered by the user, but they may also come from pre-configured values. for instance, a browser might let the user save their name,
address, phone number, and email
addresses for autocomplete purposes. perhaps the browser offers the ability to save encrypted credit card information, for autocompletion following an authentication procedure. if an <input>, <select> or <textarea> element has no autocomplete attribute, then browsers use the autocomplete attribute of the element's form owner, which is either the <form> element that t...
...o its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete values if you do need to break the name down into its components: "honorific-prefix" the prefix or title, such as "mrs.", "mr.", "miss", "ms.", "dr.", or "mlle.". "given-name" the given (or "first") name. "
additional-name" the middle name. "family-name" the family (or "last") name. "honorific-suffix" the suffix, such as "jr.", "b.sc.", "phd.", "mbasw", or "iv". "nickname" a nickname or handle. "email" an email
address. "username" a username or account name. "new-password" a new password. when creating a new account or changing passwords, this should be used for an "enter your ne...
.... "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 widget company" or "girl scouts of america". ...
...And 21 more matches
dev/panel - Archive of obsolete content
o open it: you specify the panel's content and behavior using html, css, and javascript. when the panel's created, the framework passes it a debuggee: this is a messageport object that you can use to exchange json messages with the browser that the developer tools are currently debugging. the messages follow the remote debugging protocol. ...
...ecify the panel's content and behavior using html, css, and javascript. when the panel's created, the framework passes it a debuggee: this is a messageport object that you can use to exchange json messages with the browser that the developer tools are currently debugging. the messages follow the remote debugging protocol. for a simple walkthrough of using the dev/panel api to
add a new tool, see
adding a panel to the toolbox. basic usage defining the panel constructor to
add a new tool you first need to define a constructor that inherits from the panel class, and in that constructor you need to supply values for various properties . you can set the constructor up manually if you like, or you can use the
add-on sdk core/heritage module to simplify the mechanics of inheriting from panel. y...
....... }); in the constructor definition there are a number of mandatory and optional parameters for you to supply. name type description label string the string to display in the toolbox toolbar. mandatory icon string the icon to display in the toolbox toolbar, specified as a resource:// url pointing to an icon file, typically in your
add-on's "data" directory. you can use the notation "./my-icon.png" as an alias for the url pointing to "data/my-icon.png". mandatory url string a resource:// url pointing to an html file, typically in your
add-on's "data" directory. this file contains the specification of the panel's user interface. you can use the notation "./my-file.html" as an alias for the ur...
...And 20 more matches
Promises - Archive of obsolete content
it is also available for use off-main-thread in workers as a synchronous api. this interface replaces the previous, complicated xpcom nsifile and streams apis, and their related javascript helper modules. these older interfaces should be avoi...
...tory. let iter = new os.file.directoryiterator(dir); yield iter.foreach(entry => { if (!entry.isdir) files.push(entry.path); }); iter.close(); } // read the files as binary blobs and process them. let processor = new fileprocessor(); for (let file of files) { let data = yield os.file.read(file); processor.
add(data); } // now write the processed files back out, as a binary blob. yield os.file.writeatomic(config.processedpath, processor.process(), { tmppath: config.processedpath + "." + math.random() }); // and write out a new config file. config.indexstats = processor.stats; yield os.file.writeatomic(configpath, json...
...ad manager ui. representative example usage components.utils.import("resource://gre/modules/downloads.jsm"); task.spawn(function* () { // fetch a file in the background. let download_1 = downloads.fetch(url_1, path_1); // fetch a file visible in the download manager. let download_2 = yield downloads.createdownload({ source: url_2, target: path_2, }); //
add it to the downloads list used by the download manager ui. let list = yield downloads.getlist(downloads.all); list.
add(download_2); // start the second download, and wait for both // downloads to complete. // this will raise an error if either download fails. yield promise.all([download_1, download_2.start()]); // do something with the saved fil...
...And 20 more matches
CSS3 - Archive of obsolete content
ardization of non-problematic features, the css working group of the w3c, in a decision referred as the beijing doctrine, divided css in smaller components called modules . each of these modules is now an independent part of the language and moves towards standardization at its own pace. while some modules are already w3c recommendations, other still are early working drafts. new modules are also
added when new needs are identified. formally, there is no css3 standard per se . each module being standardized independently, the standard css consists of css2.1 amended and extended by the completed modules, not necessary all with the same level number. at each point of time, a snapshot of the css standard can be defined, listing css2.1 and the mature modules. the w3 consortium periodically pu...
...odules, like selectors 4 or css borders and backgrounds level 4 already have an editor's draft, though they haven't yet reached the first published working draft status. css modules status completed modules a few css modules already became a standard as a w3c recommendation. these should be no more changes. css color module level 3 recommendation since june 7th, 2011
adds the opacity property, and the hsl(), hsla(), rgba() and rgb() functions to create <color> values. it also defines the currentcolor keyword as a valid color. the transparent color is now a real color (thanks to the support for the alpha channel) and is a now an alias for rgba(0,0,0,0.0). it deprecates the system-color keywords that shouldn't be used in a production environment anymore. ...
...t also defines the currentcolor keyword as a valid color. the transparent color is now a real color (thanks to the support for the alpha channel) and is a now an alias for rgba(0,0,0,0.0). it deprecates the system-color keywords that shouldn't be used in a production environment anymore. css namespaces module recommendation since september 29th, 2011
adds the support for the xml namespaces by defining the notion of css qualified name, using the ' | ' syntax and
adding the @namespace css at-rule. selectors level 3 recommendation since september 29th, 2011
adds: substring matching attribute selectors, e[attribute^="value"], e[attribute$="value"], e[attribute*="value"] . new pseudo-classes: :targe...
...And 20 more matches
Componentizing our Svelte app - Learn web development
previous overview: client-side javascript frameworks next in the last article we started developing our todo list app. 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. code along with us git clone the github re...
...le of components, we will also learn different techniques to communicate between components, and the pros and cons of each. extracting our filter component we'll begin by creating our filterbutton.svelte. first of all, create a new file — components/filterbutton.svelte. inside this file we will declare a filter prop, and then copy the relevant markup over to it from todos.svelte. ...
...le-btn" class:btn__primary={filter === 'completed'} aria-pressed={filter === 'completed'} on:click={()=> filter = 'completed'} > <span class="visually-hidden">show</span> <span>completed</span> <span class="visually-hidden">tasks</span> </button> </div> back in our todos.svelte component, we want to make use of our filterbutton component. ...
...And 20 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
previous overview: client-side javascript frameworks next now that we have our markup and styles ready we can start developing the required features for our svelte to-do list app. 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. objective: learn and put into practice some basic svelte concepts, like creating components, passing data using props, render javascript expressions into ou...
...asic svelte concepts, like creating components, passing data using props, render javascript expressions into our markup, modify the components state and iterating over lists. code along with us git clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/03-
adding-dynamic-behavior or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/03-
adding-dynamic-behavior remember to run npm install && npm run dev to start your app in development mode. repl to code along with us using the repl, start at https://svelte.dev/repl/c862d964d48d473ca63ab91709a0a5a0?version=3.23.2 working with todos our todos.svelte component is currentl...
... and completed tasks with dynamic expressions: <h2 id="list-heading">{completedtodos} out of {totaltodos} items completed</h2> go to the app, and you should see the "2 out of 3 items completed" message as before, but this time the information is coming from the todos array. to prove it, go to that array, and try changing some of the todo object's completed property values, and even
add a new todo object. observe how the numbers in the message are updated appropriately. dynamically generating the todos from the data at the moment, our displayed todo items are all static. we want to iterate over each item in our todos array and render the markup for each task, so let's do that now. html doesn't have a way of expressing logic — like conditionals and loops. svelte does. in ...
...And 20 more matches
Setting up your own test automation environment - Learn web development
hem from on the selenium-webdriver page (see the table in the first section.) obviously, some of the browsers are os-specific, but we're going to stick with firefox and chrome, as they are available across all the main oses. download the latest geckodriver (for firefox) and chromedriver drivers. unpack them into somewhere fairly easy to navigate to, like the root of your home user directory. ...
... to set your path variable on mac os x/most linux systems: open your .bash_profile (or .bashrc) file (if you can't see hidden files, you'll need to display them, see show/hide hidden files in mac os x or show hidden folders in ubuntu). ...
...o the drivers themselves! this is a common mistake. to set your path variable on mac os x/most linux systems: open your .bash_profile (or .bashrc) file (if you can't see hidden files, you'll need to display them, see show/hide hidden files in mac os x or show hidden folders in ubuntu). paste the following into the bottom of your file (updating the path as it actually is on your machine): #
add webdriver browser drivers to path export path=$path:/users/bob save and close this file, then restart your terminal/command prompt to reapply your bash configuration. check that your new paths are in the path variable by entering the following into your terminal: echo $path you should see it printed out in the terminal. to set your path variable on windows, follow the instructions at ...
...And 20 more matches
Localizing with Koala
for the purposes of this tutorial, the locale code that we will use will be called "x-testing". in a real-life situation, that would become for example "de" (for german) or "es-es" (for spanish in spain). translating to x-testing will basically consist of converting any strings to uppercase, for example "file" in original version (en-us) will become "file" in x-testing. we will translate a small piece of the ui found in the search bar. ...
...uppercase, for example "file" in original version (en-us) will become "file" in x-testing. we will translate a small piece of the ui found in the search bar. the search bar is next to the right of the location bar, and by default points to the google search. if you click on the highlighted arrow pointing down while reading this tutorial on mdc, you will see two string that need to be translated:
add "mdc search" manage search engines... there is also a tooltip that appears when you hover over the magnifying glass icon on the right side of the bar. requirements mercurial, linux, windows or mac os x. instructions preparation install komodo edit. install koala extension. go to tools >
add-ons. search for "koala". click
add to komodo edit... restart komodo when the installation is comple...
...hile. click "ok". on windows, if koala doesn't clone the repositories, you'll need to do it manually. ...
...And 20 more matches
sample2
ed_in = (sec_error_base + 155), sec_error_end_of_list } secerrorcodes; #endif /* port_errortostring introduced in nss 3.13. on earlier versions of nss that * don't support error tables, pr_errortostring will return "unknown code". ...
...ogname, dbdir, subjectstr); validationfailed = pr_true; } if (!certreqfilename) { pr_fprintf(pr_stderr, "%s -g -d %s -s %s -r: certificate request file name not found\n", progname, dbdir, subjectstr); validationfailed = pr_true; } if (validationfailed) { fprintf(stderr, "\nusage: %s %s \n\n", progname, "-g -d <dbdirpath> -s <subject> -r <csr> \n"); exit(-1); } } /* * validate the options used for
add cert to db command */ static void validate
addcerttodbcommand(const char *progname, const char *dbdir, const char *nicknamestr, const char *truststr, const char *certfilename, const char *certreqfilename, const char *issuernamestr, const char *serialnumberstr, prbool selfsign) { prbool validationfailed = pr_false; if (!nicknamestr) { pr_fprintf(pr_stderr, "%s -a -d %s -n : nick name is missing\n",...
...rivkey; } /* * get the certificate request from csr */ static certcertificaterequest * getcertrequest(char *infilename, prbool ascii) { certsigneddata signeddata; secitem reqder; certcertificaterequest *certreq = null; secstatus rv = secsuccess; prarenapool *arena = null; reqder.data = null; arena = port_newarena(der_default_chunksize); if (arena == null) { rv = secfailure; goto cleanup; } rv = re
adderfromfile(&reqder, infilename, ascii); if (rv) { rv = secfailure; goto cleanup; } certreq = (certcertificaterequest*) port_arenazalloc (arena, sizeof(certcertificaterequest)); if (!certreq) { rv = secfailure; goto cleanup; } certreq->arena = arena; /* since cert request is a signed data, must decode to get the inner data */ port_memset(&signeddata, 0, sizeof(signeddata)); rv = sec_asn1decodeitem(...
...And 20 more matches
NSS functions
this page lists all exported functions in nss 3.11.7 it was ported from here. this is a composite page. section headings are links to the individual pages where you can edit them. keywords: deprecated - function should no longer be used. updated - function has new arguments such as new flag or
addition to structure. ssl functions the public functions listed here are used to configure sockets for communication via the ssl and tls protocols. ...
...was ported from here. this is a composite page. section headings are links to the individual pages where you can edit them. keywords: deprecated - function should no longer be used. updated - function has new arguments such as new flag or
addition to structure. ssl functions the public functions listed here are used to configure sockets for communication via the ssl and tls protocols. in
addition to the functions listed here, applications that support ssl use some of the certificate functions, crypto functions, and utility functions described below on this page. other sources of information: the nss_reference documents the functions most commonly used by applications to support ssl. the nss home page links to
additional ssl documentation. if documentation is available for a fu...
...unction name is linked to either its mdc wiki page or its entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
...And 20 more matches
Index
ases page. 2 creating javascript tests automated testing, build documentation, guide, qa, spidermonkey in which test suite does your new test belong? 3 creating javascript jstest reftests ecmascript, guide, javascript, test in the js/src/tests directory, there are a few important subdirectories. 4 foss guide, spidermonkey feel free to
add your own spidermonkey-based open source projects (and if necessary
add categories)! 5 future directions guide, mozilla, spidermonkey this article documents future directions in functionality, design, and coding practices for spidermonkey. it can be read as something like an "ideal future state" for the engine. that means the code as it is today won't match this document, and ...
...ge allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. 21 int_to_jsval jsapi reference, obsolete, spidermonkey int_to_jsval converts a c integer, i, to a jsval. 22 js::
add*root jsapi reference, needscontent, obsolete, reference, référence(2), spidermonkey these functions are obsoleted, use js::persistentrooted instead. 23 js::autoidarray jsapi reference, reference, référence(2), spidermonkey js::autoidarray takes the ownership of jsidarray, and frees it in destructor by calling js_destroyidarray. 24 js::autosaveexceptio...
...cthing to check whether a value needs to be marked and jsval_to_gcthing to convert the jsval to a pointer. 125 jsnative jsapi reference, spidermonkey jsnative is the type of native implementations of javascript functions. full documentation of how to define a jsnative (or a jsfastnative, the equivalent typedef which preceded it) is available in the api header "js/callargs.h"
added in spidermonkey 24. this header is new, but the semantics it describes are applicable to all recent spidermonkey releases. the preferred way to implement a function is to use the js::callargs structure defined there; the macros providing equivalent functionality are deprecated. 126 jsnewenumerateop jsapi reference, reference, référence(2), spidermonkey from spidermonkey...
...And 20 more matches
SpiderMonkey 1.8.5
update all those functions to the new signature. getters and setters of type jspropertyop took an id parameter of type jsval. the type of the parameter has been changed to jsid. many getters and setters simply ignore the id anyway; if the value is needed, use js_idtovalue. the type of setters has changed from jspropertyop to jsstrictpropertyop (to accomodate es5 strict mode). to migrate, simply
add a jsbool strict parameter to each setter function. it is safe for the setter to ignore the value of the argument. the rooting apis (js_
addroot, js_removeroot, etc.) have been replaced with a family of type-safe functions (js_
addstringroot, js_removestringroot, etc.) that are easier to use correctly. js_newdouble, js_newdoublevalue, and js_newnumbervalue are gone. instead use double_to_jsval, in...
...e_to_jsval, int_to_jsval, and uint_to_jsval, which are faster and can't fail. js_getstringbytes and js_getstringchars are gone. there is no longer an infallible way to examine string characters. applications must use js_getstringcharsandlength or js_encodestring/js_free and check for errors. these and other changes are explained in detail below. new javascript language features javascript 1.8.5
adds support for ecmascript edition 5, including es5 strict mode. for details, see new in javascript 1.8.5. note that there are a very small number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8. these are discussed in annex e of the es5 specification. spidermonkey 1.8.5 also ships with js-ctypes, a foreign-function interfac...
... collector will scan the c stack and registers in your embedding, looking for bits that it can treat as potential gc roots. the approach eliminates the need for the js_enterlocalrootscope api, and in many cases the need to explicitly root gc things or use the "root as you go" approach popular with earlier spidermonkey releases. since this is a conservative collector, it will often find "garbage"
addresses which can trigger warnings from certain code analysis tools. if you are running valgrind on your embedding, be sure to build spidermonkey with the --enable-valgrind option to suppress superflous error messages triggered by the garbage collector. this also means that objects will be finalized in a non-deterministic order in spidermonkey 1.8.5. this is not a bug, and, any embedding which de...
...And 20 more matches
Event reference
dom events are sent to notify code of interesting things that have taken place. each event is represented by an object which is based on the event interface, and may have
additional custom fields and/or functions used to get
additional information about what happened. events can represent everything from basic user interactions to automated notifications of things happening in the rendering model. this article offers a list of events that can be sent; some are standard events defined in official specifications, while others are events used internally by specific browsers; for example, mozilla-specific events are listed so that
add-ons can use them to interact with the browser. most common categories resource events event name fired when error a reso...
... beforeprint the print dialog is opened afterprint the print dialog is closed text composition events event name fired when compositionstart the composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition). compositionupdate a character is
added to a passage of text being composed. compositionend the composition of a passage of text has been completed or canceled. view events event name fired when fullscreenchange an element was toggled to or from fullscreen mode. fullscreenerror it was impossible to switch to fullscreen mode for technical reasons or because the permission...
... compositionend compositionevent dom l3 the composition of a passage of text has been completed or canceled. compositionstart compositionevent dom l3 the composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition). ...
...And 20 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
hat automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. if you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). however, this can be useful when creating media elements whose source will be set at a later time, under user control. see our autoplay guide for
additional information about how to properly use autoplay. to disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the <video> tag at all. to remove autoplay, the attribute needs to be removed altogether. in some browsers (e.g. chrome 70.0) autoplay doesn't work if no muted attribute is present. autopictureinpicture a boolean attribute...
... 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), preventing 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 at which it will begin is returned. setting currenttime sets the current playback position to the given time and seeks the media to that position if the media is...
... used with them. other usage notes: if you don't specify the controls attribute, the video won't include the browser's default controls; you can create your own custom controls using javascript and the htmlmediaelement api. see creating a cross-browser video player for more details. to allow precise control over your video (and audio) content, htmlmediaelements fire many different events. in
addition to providing controllability, these events let you monitor the progress of both download and playback of the media, as well as the playback state and position. you can use the object-position property to adjust the positioning of the video within the element's frame, and the object-fit property to control how the video's size is adjusted to fit within the frame. to show subtitles/captions ...
...And 20 more matches
Creating Event Targets - Archive of obsolete content
the guide to event-driven programming with the sdk describes how to consume events: that is, how to listen to events generated by event targets. for example, you can listen to the tabs module's ready event or the panel object's show event. with the sdk, it's also simple to implement your own event targets. ...
...ecially useful if you want to build your own modules, either to organize your
add-on better or to enable other developers to reuse your code. if you use the sdk's event framework for your event targets, users of your module can listen for events using the sdk's standard event api. in this tutorial we'll create part of a module to access the browser's places api. it will emit events when the user
adds and visits bookmarks, enabling users of the module to listen for these events using the sdk's standard event api. using the places api first, let's write some code using places api that logs the uris of bookmarks the user
adds. ...
...it will emit events when the user
adds and visits bookmarks, enabling users of the module to listen for these events using the sdk's standard event api. using the places api first, let's write some code using places api that logs the uris of bookmarks the user
adds. create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all the defaults. ...
...And 19 more matches
Building up a basic demo with the PlayCanvas engine - Game development
g a directory to store your experiments in. saving a copy of the latest playcanvas engine inside your directory. opening the playcanvas documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use. ...
...in the second one. there is one helper variable already included, which will store a reference to the <canvas> element. before reading on, copy this code to a new text file and save it in your working directory as index.html. playcanvas application to begin developing our game we have to create the playcanvas application first (using the given <canvas> element), and then start the update loop.
add the following code to the bottom of your second <script> element: var app = new pc.application(canvas); app.start(); the pc global object contains all the playcanvas functions available in the engine. next, we'll set the canvas to fill the window, and automatically change its resolution to be the same as the canvas size. again,
add the following lines at the bottom of your script. app.setcan...
... automatically change its resolution to be 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 previous 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, ligh...
...And 19 more matches
Building up a basic demo with Three.js - Game development
chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. open the three.js documentation in a separate tab — it is useful to refer to. ...
...hild(renderer.domelement); we are creating a new webgl renderer, setting its size to fit the whole available space on the screen, and appending the dom structure to the page. you might have noticed the antialias parameter in the first line — this renders the edges of shapes more smoothly. the setclearcolor() method sets our background to a light gray colour, instead of the default black one. ...
... might have noticed the antialias parameter in the first line — this renders the edges of shapes more smoothly. the setclearcolor() method sets our background to a light gray 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. ...
...And 19 more matches
Creating our first Vue component - Learn web development
t inside another component, pass data into it using props, and save its state. creating a todoitem component let's create our first component, which will display a single todo item. we'll use this to build our list of todos. in your moz-todo-vue/src/components directory, create a new file named todoitem.vue. open the file in your code editor. create the component's template section by
adding <template></template> to the top of the file. create a <script></script> section below your template section. inside the <script> tags,
add a default exported object export default {}, which is your component object. your file should now look like this: <template> </template> <script> export default {}; </script> we can now begin to
add actual content to our todoitem. vue templates are ...
...r component object. your file should now look like this: <template> </template> <script> export default {}; </script> we can now begin to
add actual content to our todoitem. vue templates are currently only allowed a single root element — one element needs to wrap everything inside the template section (this will change when vue 3 comes out). we'll use a <div> for that root element.
add an empty <div> inside your component template now. inside that <div>, let's
add a checkbox and a corresponding label.
add an id to the checkbox, and a for attribute mapping the checkbox to the label, as shown below. <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">my todo item</label> </div> </template> using todoitem inside...
...e now. inside that <div>, let's
add a checkbox and a corresponding label.
add an id to the checkbox, and a for attribute mapping the checkbox to the label, as shown below. <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">my todo item</label> </div> </template> using todoitem inside our app this is all fine, but we haven’t
added the component to our app yet, so there’s no way to test it and see if everything is working. let’s
add it now. open up app.vue again. ...
...And 19 more matches
Extending a Protocol
js promises. managing child actors with reference counting. visually, it's going to look something like this (except for the operating system bit, which we are not actually going to do - just to illustrate what we could do): let's start by implementing the webidl above. implementing the navigator.echo() in your favorite editor, open dom/webidl/navigator.webidl at the end of the file,
add: partial interface navigator { [throws] promise<domstring> echo(domstring astring); }; now we need to implement the echo() method in c++, so open up ./dom/base/navigator.h and let's
add the method definition, so under public:: already_
addrefed<promise> echo(const nsastring& astring, errorresult& arv); we use nsastring& as the domstring comes in from js as utf-16. this will matter l...
...base/navigator.h and let's
add the method definition, so under public:: already_
addrefed<promise> echo(const nsastring& astring, errorresult& arv); we use nsastring& as the domstring comes in from js as utf-16. this will matter later, as we will need to convert it to utf-8 (using nscstring) to send it to the parent process. ...
... already_
addrefed<promise> echo(const nsastring& astring, errorresult& arv); we use nsastring& as the domstring comes in from js as utf-16. this will matter later, as we will need to convert it to utf-8 (using nscstring) to send it to the parent process. ...
...And 19 more matches
Object.prototype.__noSuchMethod__ - Archive of obsolete content
// example base class 1 function namedthing(name) { this.name = name; } namedthing...
... // example base class 1 function namedthing(name) { this.name = name; } namedthing.prototype = { getname: function() { return t...
...rents[i][name] == 'function') { return parents[i][name].apply(this, args); } } // if we get here, the method hasn't been found throw new typeerror; } // used to
add a parent for multiple inheritance function
addparent(obj, parent) { // if the object isn't initialized, initialize it if (!obj.__parents_) { obj.__parents_ = []; obj.__nosuchmethod__ = nomethod; } //
add the parent obj.__parents_.push(parent); } an example of using this idea is shown below. // example base class 1 function namedthing(name) { this.name = name; } namedthing.prototype = { getname: function() { return this.name; }, setname: function(newname) { this.name = newname; } } // example base class 2 function agedthing(age) { this.age = age; } agedthing.prototype = { getage:...
...And 18 more matches
Introduction to CSS layout - Learn web development
splay one below the other in our english document. if we change the display value to inline they now display next to each other, as words would do in a sentence. the fact that you can change the value of display for any element means that you can pick html elements for their semantic meaning, without being concerned about how they will look. the way they look is something that you can change. in
addition to being able to change the default presentation by turning an item from block to inline and vice versa, there are some bigger layout methods that start out as a value of display. however, when using these, you will generally need to invoke
additional properties. the two values most important for our purposes when discussing layout are display: flex and display: grid. flexbox flexbox is th...
...pply display: flex to the parent element of the elements you want to lay out; all its direct children then become flex items. we can see this in a simple example. the html markup below gives us a containing element, with a class of wrapper, inside which are three <div> elements. by default these would display as block elements, below one another, in our english language document. however, if we
add display: flex to the parent, the three items now arrange themselves into columns. this is due to them becoming flex items and being affected by some initial values that flexbox sets on the flex container. they are displayed in a row, because the initial value of flex-direction set on their parent is row. they all appear to stretch to the height of the tallest item, because the initial value of th...
...property set on their parent is stretch. this means that the items stretch to the height of the flex container, which in this case is defined by the tallest item. the items all line up at the start of the container, leaving any extra space at the end of the row. flexbox example 1 * {box-sizing: border-box;} .wrapper > div { border-radius: 5px; background-color: rgb(207,232,220); p
adding: 1em; } .wrapper { display: flex; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> </div> in
addition to the above properties that can be applied to the flex container, there are properties that can be applied to the flex items. these properties, among other things, can change the way that the items flex, enabli...
...And 18 more matches
Manipulating documents - Learn web development
ebcam, etc. the document (represented by the dom in browsers) is the actual page loaded into the window, and is represented in javascript by the document object. you can use this object to return and manipulate information on the html and css that comprises the document, for example get a reference to an element in the dom, change its text content, apply new styles to it, create new elements and
add them to the current element as children, or even delete it altogether. in this article we'll focus mostly on manipulating the document, but we'll show a few other useful bits besides. the document object model the document currently loaded in each one of your browser tabs is represented by a document object model. this is a "tree structure" representation created by the browser that enables t...
...ragraph with a link inside. the html source code looks like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>simple dom example</title> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will
add a link to the <a href="https://www.mozilla.org/">mozilla homepage</a></p> </section> </body> </html> the dom on the other hand looks like this: note: this dom tree diagram was created using ian hickson's live dom viewer. you can see here that each element and bit of text in the document has its own entry in the tree — each one is called a node. you will also encounter various ter...
...ing with the dom, as a number of the code terms you'll come across make use of them. you may have also come across them if you have studied css (e.g. descendant selector, child selector). active learning: basic dom manipulation to start learning about dom manipulation, let's begin with a practical example. take a local copy of the dom-example.html page and the image that goes along with it. ...
...And 18 more matches
A first splash into JavaScript - Learn web development
see if you can guess it in 10 turns or fewer. we'll tell you if your guess was too high or too low.</p> <div class="form"> <label for="guessfield">enter a guess: </label><input type="text" id="guessfield" class="guessfield"> <input type="submit" value="s...
... } else { lastresult.textcontent = 'wrong!'; lastresult.style.backgroundcolor = 'red'; if(userguess < randomnumber) { loworhi.textcontent = 'last guess was too low!' ; } else if(userguess > randomnumber) { loworhi.textcontent = 'last guess was too high!'; } } guesscount++; guessfield.value = ''; } guesssubmit.
addeventlistener('click', checkguess); function setgameover() { guessfield.disabled = true; guesssubmit.disabled = true; resetbutton = document.createelement('button'); resetbutton.textcontent = 'start new game'; document.body.append(resetbutton); resetbutton.
addeventlistener('click', resetgame); } function resetgame() { guesscount = 1; co...
...ploring javascript features as we go. initial setup to begin this tutorial, we'd like you to make a local copy of the number-guessing-game-start.html file (see it live here). open it in both your text editor and your web browser. at the moment you'll see a simple heading, paragraph of instructions and form for entering a guess, but the form won't currently do anything. ...
...And 18 more matches
Vue conditional rendering: editing existing todos - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
... 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. ...
...this is a useful way to help reinforce everything you've learned so far. this code sets up ...
...And 18 more matches
Styling Vue components with CSS - Learn web development
t 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. styling vue components with css before we move on to
add more advanced features to our app, we should
add some basic css to make it look better. vue has three common approaches to styling apps: external css files. global styles in single file components (.vue files). component-scoped styles in single file components. to help familiarize you with each one, we'll use a combination of all three to give our app a nicer look and feel. styling with e...
...let's look at how this is done. to start with, create a file called reset.css in the src/assets directory. files in this folder get processed by webpack. this means we can use css pre-processors (like scss) or post-processors (like postcss). while this tutorial will not be using such tools, it's good to know that when including such code in the assets folder it will be processed automatically. ...
... using such tools, it's good to know that when including such code in the assets folder it will be processed automatically. ...
...And 18 more matches
Introduction to automated testing - Learn web development
s 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 code,
adding in css prefixes or transpiling nascent javascript features for maximum cross-browser reach, and so on. use a browser automation system like selenium to run specific tests on installed browsers and return results, alerting you to failures in browsers as they crop up. commercial cross-browser testing apps like lambdatest, sauce labs, browserstack, and testingbot are based on selenium, but allow...
...or printing a message to the terminal — this is useful for letting us know that gulp is working. each gulp task is written in the same basic format — gulp's task() method is run, and given two parameters — the name of the task, and a callback function containing the actual code to run to complete the task. ...
...al — this is useful for letting us know that gulp is working. each gulp task is written in the same basic format — gulp's task() method is run, and given two parameters — the name of the task, and a callback function containing the actual code to run to complete the task. you can run your gulp task with the following commands — try this now: gulp
adding some real tasks to gulp to
add some real tasks to gulp, we need to think about what we want to do. a reasonable set of basic functionalities to run on our project is as follows: html-tidy, css-lint, and js-hint to lint and report/fix common html/css/js errors (see gulp-htmltidy, gulp-csslint, gulp-jshint). autoprefixer to scan our css and
add vendor prefixes only where needed (see gulp-autoprefixer). babel to transpile an...
...And 18 more matches
Applying styles and colors - Web APIs
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. ...
...this is done by either setting the globalalpha property or by assigning a semi-transparent color to the stroke and/or fill style. globalalpha = transparencyvalue applies the specified transparency value to all future shapes drawn on the canvas. the value must be between 0.0 (fully transpare...
...ment 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 demonstrations of these
additional line styles. for even-width lines, each half ends up being an integer amount of pixels, so you want a path that is between pixels (that is, (3,1) to (3,5)), instead of down the middle of pixels. while slightly painful when initially working with scalable 2d graphics, paying attention to the pixel grid and the position of paths ensures that your drawings will look correct regardless of s...
...And 18 more matches
Details of the object model - JavaScript
properties of its parent class (no more, no less). a prototype-based language, such as javascript, does not make this distinction: it simply has objects. a prototype-based language has the notion of a prototypical object, an object used as a template from which to get the initial properties for a new object. any object can specify its own properties, either when you create it or at run time. in
addition, any object can be associated as the prototype for another object, allowing the second object to share the first object's properties. defining a class in class-based languages, you define a class in a separate class definition. in that definition you can specify special methods, called constructors, to create instances of the class. a constructor method can specify initial values for the i...
...e-based inheritance. the class syntax does not introduce a new object-oriented inheritance model to javascript. subclasses and inheritance in a class-based language, you create a hierarchy of classes through the class definitions. in a class definition, you can specify that the new class is a subclass of an already existing class. the subclass inherits all the properties of the superclass and
additionally can
add new properties or modify the inherited ones. for example, assume the employee class includes only the name and dept properties, and manager is a subclass of employee that
adds the reports property. in this case, an instance of the manager class would have all three properties: name, dept, and reports. javascript implements inheritance by allowing you to associate a prototypical ...
...or function, specifying the name and dept properties. next, you define the manager constructor function, calling the employee constructor and specifying the reports property. finally, you assign a new object derived from employee.prototype as the prototype for the manager constructor function. then, when you create a new manager, it inherits the name and dept properties from the employee object. ...
...And 18 more matches
Interacting with page scripts - Archive of obsolete content
for the sake of security, stability, and simplicity, this is usually what you want. you don't want arbitrary web pages to be able to access objects in content scripts, and you don't want objects created by content scripts to clash with objects created by page scripts. but sometimes, you will want to share objects between the two scopes. ...
...ect to a page script access objects defined by page scripts to access page script objects from content scripts, you can use the global unsafewindow object. with unsafewindow you can see javascript objects that have been defined by page scripts, and if a page script has modified the behavior of native dom functions, you'll get the modified version of them as well. ...
... 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. expose objects to page scripts until firefox 30, you could use unsafewindow to perform the reverse procedure, and make objects defined in content scripts available to page scripts: // content-script.js unsafewindow.contentscriptobject = {"greeting" : "hello from
add-on"}; // page-script.js var button = document.getelementbyid("show-content-script-var"); button.
addeventlistener("click", function() { // access object defined by content script console.log(window.contentscriptobject.greeting); // "hello from
add-on" }, false); after firefox 30, you can still do this for primitive values, but can no longer do it for objects. instead, you need to use ...
...And 17 more matches
page-mod - Archive of obsolete content
run scripts in the context of web pages whose url matches a given pattern. usage to use page-mod, you specify: one or more scripts to attach. the sdk calls these scripts "content scripts". a pattern that a page's url must match, in order for the script(s) to be attached to that page. ...
... if you supply the scripts as separate files in the "data" directory, you specify them using with a url, typically constructed using the url() method of the self module's data object: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: data.url("my-script.js") }); var data = requi...
...se "./my-script.js" as an alias for self.data.url("my-script.js"). so you can rewrite the above code like this: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ 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 destr...
...And 17 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
changing default search setting from extensions many
add-ons, for monetization or other reasons, change several search-related settings at install time. while this is generally considered acceptable behavior, considerable care must be taken to avoid violating the mozilla
add-on guidelines or creating an adverse user experience. due to the large volume of user complaints regarding hidden settings being changed against their will, and not being restored after the
add-ons responsible are disabled, mozilla will take any steps necessary to mitigate the impact of offending
add-ons. in particular, changing the location bar search keyword url in a way which is not automatically reset when the
add-on is removed will result in a reset prompt for users. other settings violations designed to rest...
...s responsible are disabled, mozilla will take any steps necessary to mitigate the impact of offending
add-ons. in particular, changing the location bar search keyword url in a way which is not automatically reset when the
add-on is removed will result in a reset prompt for users. other settings violations designed to restrict user choice will result in stronger action, such as blacklisting of the
add-ons in question. the most technically sound method of achieving this, and the only acceptable way of changing preferences such that they are automatically restored on
add-on uninstall, is to make such changes in the default preference branch, as explained below. while the technical details below are important to understand, a library which encapsulates the appropriate logic is provided along with...
...ion. the most technically sound method of achieving this, and the only acceptable way of changing preferences such that they are automatically restored on
add-on uninstall, is to make such changes in the default preference branch, as explained below. while the technical details below are important to understand, a library which encapsulates the appropriate logic is provided along with the example
add-on at the end, and should be used where possible. changing default preference values there are two common ways of changing default preference values. the simplest, which works only for traditional, non-restartless
add-ons, is to
add the preference changes to a file in an extension's defaults/preferences/ directory. the following file, for instance, would change the default keyword search engine, ...
...And 17 more matches
Building up a basic demo with A-Frame - Game development
me.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this contains some basic information like the document charset and <title>. the <script> element includes the a-frame framework in the page; we will write our example code inside the <body> element. initializing the scene a scene is the place where everything happens. ...
...ng the scene a scene is the place where everything happens. when creating new objects in the demo, we will be
adding them all to the scene to make them visible on the screen. in a-frame, the scene is reperesented by a scene entity. note: an entity is any element — it can be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. let's create the scene by
adding an <a-scene> element inside the <body> element: <a-scene> </a-scene>
adding a cube
adding the cube to the scene is done by
adding a simple <a-box> element inside the <a-scene> element. ...
...e is reperesented by a scene entity. note: an entity is any element — it can be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. let's create the scene by
adding an <a-scene> element inside the <body> element: <a-scene> </a-scene>
adding a cube
adding the cube to the scene is done by
adding a simple <a-box> element inside the <a-scene> element.
add it now: <a-box color="#0095dd" position="0 1 0" rotation="20 40 0"> </a-box> it contains a few parameters already defined: color, position and rotation — these are fairly obvious, and define the base color of the cube, the position inside the 3d scene, and the rotation of the cube. note: the distance values (e.g. for the cube y position) are unitless, and can basically be anything yo...
...And 17 more matches
HTML text fundamentals - Learn web development
prerequisites: basic html familiarity, as covered in getting started with html. ...
...to listen to the whole document read out loud. to style content with css, or make it do interesting things with javascript, you need to have elements wrapping the relevant content, so css/javascript can effectively target it. we therefore need to give our content structural markup. active learning: giving our content structure let's jump straight in with a live example. in the example below,
add elements to the raw text in the input field so that it appears as a heading and two paragraphs in the output field. if you make a mistake, you can always reset it using the reset button. if you get stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">pres...
...: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.
addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.
addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution...
...And 17 more matches
Video and Audio APIs - Learn web development
o do this. the htmlmediaelement api part of the html5 spec, the htmlmediaelement api provides features to allow you to control video and audio players programmatically — for example htmlmediaelement.play(), htmlmediaelement.pause(), etc. this interface is available to both <audio> and <video> elements, as the features you'll want to implement are nearly identical. let's go through an example,
adding features as we go. our finished example will look (and function) something like the following: getting started to get started with this example, download our media-player-start.zip and unzip it into a new directory on your hard drive. if you downloaded our examples repo, you'll find it in javascript/apis/video-audio/start/ at this point, if you load the html you should see a perfectly no...
...e time elapses. next, insert the following at the bottom of your code: media.removeattribute('controls'); controls.style.visibility = 'visible'; these two lines remove the default browser controls from the video, and make the custom controls visible. playing and pausing the video let's implement probably the most important control — the play/pause button. ...
...ibility = 'visible'; these two lines remove the default browser controls from the video, and make the custom controls visible. playing and pausing the video let's implement probably the most important control — the play/pause button. first of all,
add the following to the bottom of your code, so that the playpausemedia() function is invoked when the play button is clicked: play.
addeventlistener('click', playpausemedia); now to define playpausemedia() —
add the following, again at the bottom of your code: function playpausemedia() { if(media.paused) { play.setattribute('data-icon','u'); media.play(); } else { play.setattribute('data-icon','p'); media.pause(); } } here we use an if statement to check whether the video is paused. the htmlme...
...And 17 more matches
TypeScript support in Svelte - Learn web development
jects — it creates a new directory): npx degit sveltejs/template svelte-typescript-app cd svelte-typescript-app node scripts/setuptypescript.js this creates a starter project that includes typescript support, which you can then modify as you wish. then you'll have to tell npm to download dependencies and start the project in development mode, like we usually do: npm install npm run dev
adding typescript support to an existing svelte project to
add typescript support to an existing svelte project you can follow these instructions. alternatively, you can download the setuptypescript.js file to a scripts folder inside your project's root folder, and then run node scripts/setuptypescript.js. you can even use degit to download the script. that's what we will do to start porting our ap...
...de a svelte application, have a look at this troubleshooting/faq section about typescript support. as we said before, typescript is a superset of javascript, so your application will run without modifications. currently you will be running a regular javascript application with typescript support enabled, without taking advantage of any of the features that typescript provides. you can now start
adding types progressively. once you have typescript configured, you can start using it from a svelte component by just
adding a <script lang='ts'> at the beginning of the script section. to use it from regular javascript files, just change the file extension from .js to .ts. you'll also have to update any corresponding import statements (don't include the .ts in your import statements; typescript c...
...ur project. the main.js file has been renamed to main.ts, which means that vs code can provide hover-information on our svelte components: we also get type-checking for free. ...
...And 17 more matches
Mozilla DOM Hacking Guide
nit(), described in section 1.5. interface flattening one of the nicest -- and most important -- features of the xpconnect'ed dom is the interface flattening. "interface flattening is the ability to call methods on an object regardless of the interface it was defined on." for example, when we have the document object in javascript, we can call indistinctly document.getelementbyid(), or document.
addeventlistener(), although they are defined on two different interfaces (domdocument and domeventtarget. needless to say this is critical for the use of the dom in real-world content. in mozilla interface flattening is obtained through the use of the nsiclassinfo interface. nsiclassinfo stores the interfaces available for an object and later on xpconnect uses those interfaces to lookup the right m...
...static prbool sisinitialized: keeps track of wether class info was already initialized, because init() shouldn't be called twice. static jsval *sx_id: strings used in the global resolve methods for comparison with the passed in arguments. they represent special words for the dom. initialized by definestaticjsvals(). static const jsclass *sobjectclass: help me! static prbool sdosecuritycheckin
addproperty;: help me! nsdomclassinfo::init() this method is to be called only once. its purpose is, well, to initialize... it does a lot of different things: fill the blanks in the sclassinfodata array, initialize the sxpconnect and ssecman data members, create a new javascript context, define the jsstring data members, and register class names and class prototypes. finally it sets sisinitialized...
... here is the relevant piece of code. dom_classinfo_map_begin(window, nsidomwindow) dom_classinfo_map_entry(nsidomwindow) ... dom_classinfo_map_entry(nsidomabstractview) dom_classinfo_map_end dom_classinfo_map_begin(_class, _interface) maps to _dom_classinfo_map_begin(_class, &ns_get_iid(_interface), pr_true). ns_get_iid is a macro that expands to the iid of the interface passed in. we pass the
address of this nsiid object to the second macro. #define _dom_classinfo_map_begin(_class, _ifptr, _has_class_if) { nsdomclassinfodata &d = sclassinfodata[edomclassinfo_##_class##_id]; d.mprotochaininterface = _ifptr; d.mhasclassinterface = _has_class_if; static const nsiid *interface_list[] = { in this macro, |d| is a reference to the entry of the sclassinfodata array that corresponds to the clas...
...And 17 more matches
NSS Tools certutil
ns, or with the -h option. options and arguments options specify an action and are uppercase. option arguments modify an action and are lowercase. certificate database tool command options and their arguments are defined as follows: options -n create new certificate and key databases. -s create an individual certificate and
add it to a certificate database. -r create a certificate-request file that can be submitted to a certificate authority (ca) for processing into a finished certificate. output defaults to standard out unless you use -ooutput-file argument. use the -a argument to specify ascii output. -c create a new binary certificate file from a binary cert...
...y you have generated. in such a case, only the private key is deleted from the key pair. you can display the public key with the command certutil -k -htokenname . -k list the keyid of keys in the key database. a keyid is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -a
add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this option will initialize one by default. -d delete a certificate from the certificate database. -l list all the certificates, or display information about a named certificate, in a certificate database. use the...
...me, use "yymmddhhmmssz". when specifying an offset time, use "yymmddhhmmss+hhmm" or "yymmddhhmmss-hhmm". if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exact nickname or alias of the ca certificate, or use the ca's email
address. bracket theissuer string with quotation marks if it contains spaces. -d directory specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.netscape). on windows nt the default is the current directory. the cert8.db and key3.db database files must reside i...
...And 17 more matches
Components.utils.cloneInto
bject defined in a privileged scope and create a structured clone of it in a less-privileged scope. it returns a reference to the clone: var clonedobject = cloneinto(myobject, targetwindow); you can then assign the clone to an object in the target scope as an expando property, and scripts running in that scope can access it: targetwindow.foo = clonedobject; in this way privileged code, such as an
add-on, can share an object with less-privileged code like a normal web page script. syntax components.utils.cloneinto(obj, targetscope[, options]); parameters obj : object the object to clone. targetscope : object the object to attach the object to. options : object this optional parameter is an object with the following optional properties: clonefunctions: a boolean valu...
... have the same semantics as functions exported using components.utils.exportfunction. see cloning objects that have functions below. wrapreflectors: a boolean value that determines if objects reflected from c++, such as dom objects, should be cloned. if omitted the default value is false. see cloning objects that contain dom elements below. returns a reference to the cloned object. ...
...s below. wrapreflectors: a boolean value that determines if objects reflected from c++, such as dom objects, should be cloned. if omitted the default value is false. see cloning objects that contain dom elements below. returns a reference to the cloned object. ...
...And 17 more matches
Communicating With Other Scripts - Archive of obsolete content
this page is now obsolete, and its content has been incorporated into the main page on content scripts. this section of the guide explains how content scripts can communicate with: your main.js file, or any other modules in your
add-on other content scripts loaded by your
add-on page scripts (that is, scripts embedded in the web page or included using <script> tags) main.js your content scripts can communicate with your
add-on's "main.js" (or any other modules you're written for your
add-on) by sending it messages, using either the port.emit() api or the postmessage() api. see the articles on using postmessage() and using port for details. content scripts content scripts loaded into the same document at the same time using the same method can interact with each other directly as...
...t itself. however, content scripts which have been loaded into different documents cannot interact directly with each other. content scripts that have been loaded into the same document by different methods, or the same method called more than once, can pass messages directly to each other using the dom postmessage() api or a customevent. ...
...eract directly with each other. content scripts that have been loaded into the same document by different methods, or the same method called more than once, can pass messages directly to each other using the dom postmessage() api or a customevent. any two content scripts can communicate by using the main
add-on script to manually relay messages between the content scripts. ...
...And 16 more matches
ui/sidebar - Archive of obsolete content
you specify its content using html, css, and javascript, and the user can show or hide it in the same way they can show or hide the built-in sidebars. usage creating, showing, and hiding sidebars you construct a sidebar object using the sidebar() constructor. once you've done that, you can show the sidebar by calling the sidebar's show() method. if a new window is opened from a window that has a sidebar visible, the new window gets a sidebar, too. ...
...ts dispose() method. to show what a sidebar looks like, here's a sidebar that displays the results of running the w3c validator on the current page: specifying sidebar content the content of a sidebar is specified using html, which is loaded from the url supplied in the url option to the sidebar's constructor. unlike modules such as panel, the content must be local, typically loaded from the
add-on's data directory via a url constructed using self.data.url(): var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html") }); from firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html"). so you can rewrite the above code like this: var sidebar = require("sdk/ui/sidebar").sid...
...ad> <link href="stuff.css" type="text/css" rel="stylesheet"> </head> <body> <script type="text/javascript" src="stuff.js"></script> </body> </html> you can update the sidebar's content by setting the sidebar's url property. this will change the sidebar's content across all windows. communicating with sidebar scripts you can't directly access your sidebar's content from your main
add-on code, but you can send messages between your main
add-on code and scripts loaded into your sidebar. on the sidebar end of the conversation, sidebar scripts get a global variable
addon that contains a port for sending and receiving messages. on the
add-on side, you need to get a worker object for the sidebar before you can send or receive messages. there are two events emitted by the sidebar ...
...And 16 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
other areas. overview of the install script xpi install scripts are written in javascript using xpinstall engine syntax defined in the xpinstall api reference. ...
... here, take the following basic form (in pseudo-code and with links to the sections in which these installation steps are documented): initinstall(); if (verify_space()) { err =
add_dirs_and_files; register_files; if (err==success) { performinstall() }; else { cancelinstall() }; } as you can see in the code listing, the verification process at the top is on lines 1 to 18; the file
addition process, here part of the main installation block, is on lines 24 to 41; the registration part of the main installation block is on lines 42-58; and the execution at the end of the main block is on lines 59 to 71. ...
...e file
addition process, here part of the main installation block, is on lines 24 to 41; the registration part of the main installation block is on lines 42-58; and the execution at the end of the main block is on lines 59 to 71. if you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts mustinitialize,
add the files to be installed, and execute. note also that when you call methods on the install--as you do so often in installation scripts (getfolder, initinstall,
addfile, and performinstall are all examples of common install object methods)--the install object is implicit; like the window object in regular web page scripts, the install object does not need to be prefixed to the method. initializ...
...And 16 more matches
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. ...
...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. you don't need to implement this observer yourself, although you may
add an observer to the datasource if you want to be notified when the data changes. note that this automatic updating of the template does not occur for xml and sqlite sources, only for rdf datasources. however, as it is possible to use and/or implement other query types with templates, these
additional types may support automatic updating. there are two main situations when the notifications are mad...
...template does not occur for xml and sqlite sources, only for rdf datasources. however, as it is possible to use and/or implement other query types with templates, these
additional types may support automatic updating. there are two main situations when the notifications are made. the first is when the modification functions on the datasource are called. there are four such functions: 'assert', to
add a new triple (or arrow) to the rdf graph, 'unassert' to remove a triple, 'change' to adjust the target of a triple, and 'move' to adjust the source of a 'triple'. for mozilla's datasources, the latter two just unassert the old triple and
add a new one, creating the effect of changing the value. however, only one notification is made. for instance, an assert call looks like the following: var sou...
...And 16 more matches
Theme changes in Firefox 2 - Archive of obsolete content
updates there are a number of changed and deleted files in the browser that may require you to make changes to your theme. the table lists both the changed xul file and the theme's corresponding css file that you might need to update. filename css file details browser/base/searchdialog.xul browser/base/content/searchdialog.css removed from firefox 2. feeds/
addfeedreader.xul feeds/
addfeedreader.css new file that presents ui for
adding a new feed reader. feeds/subscribe.xhtml feeds/subscribe.css new file that presents the ui for subscribing to an rss feed. preferences/downloads.xul - removed from firefox 2. preferences/general.xul - removed from firefox 2. safebrowsing/warning-overlay.xul sa...
...r the search engine manager window. toolkit/mozapps/preferences/fontscaling.xul - removed from firefox 2. changes to the default theme the table below lists all the changes made in the default theme for firefox 2; you can use this information as a starting point for figuring out the changes you need to make. file description of change browser/bookmarks/
addbookmark.css updated to include microsummary-related css changes. browser/bookmarks/bookmarksproperties.css new file; includes microsummary-related css. browser/browser.css needs to be updated to include new css for microsummaries, search fields, iconic bookmark menu items, and more. browser/dropmark-nav-small.png new file; used as the drop-down menu arrow on...
...ields, iconic bookmark menu items, and more. browser/dropmark-nav-small.png new file; used as the drop-down menu arrow on the navigation buttons, when using small icons. browser/dropmark-nav.png new file; used as the drop-down menu arrow on the navigation buttons. browser/enginemanager.css new file; css used for the search engine manager. browser/feeds/
addfeedreader.css new file; css used for the window to
add a new feed reader. browser/feeds/feedicon.png new file; the rss feed icon. browser/feeds/feedicon16.png new file; the 16x16 pixel version of the rss feed icon. browser/feeds/subscribe.css new file; css used for the window to subscribe to a news feed. browser/go-rtl.png new file; go icon to us...
...And 16 more matches
Positioning - Learn web development
into effect on html elements. to make a specific type of positioning active on an element, we use the position property. static positioning static positioning is the default that every element gets — it just means "put the element into its normal position in the document layout flow — nothing special to see here." to demonstrate this, and get your example set up for future sections, first
add a class of positioned to the second <p> in the html: <p class="positioned"> ... </p> now
add the following rule to the bottom of your css: .positioned { position: static; background: yellow; } if you now save and refresh, you'll see no difference at all, except for the updated background color of the 2nd paragraph. this is fine — as we said before, static positioning is the default beha...
...ve and refresh at this stage, you won't see a change in the result at all. so how do you modify the element's position? you need to use the top, bottom, left, and right properties, which we'll explain in the next section. introducing top, bottom, left, and right top, bottom, left, and right are used alongside position to specify exactly where to move the positioned element to. to try this out,
add the following declarations to the .positioned rule in your css: top: 30px; left: 30px; note: the values of these properties can take any units you'd logically expect — pixels, mm, rems, %, etc. if you now save and refresh, you'll get a result something like this: <h1>relative positioning</h1> <p>i am a basic block level element. my adjacent block level elements sit on new lines below me...
...ixels, mm, rems, %, etc. if you now save and refresh, you'll get a result something like this: <h1>relative positioning</h1> <p>i am a basic block level element. my adjacent block level elements sit on new lines below me.</p> <p class="positioned">by default we span 100% of the width of our parent element, and we are as tall as our child content. our total width and height is our content + p
adding + border width/height.</p> <p>we are separated by our margins. because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. overflowing inline elements <span>wrap onto a new line if possib...
...And 16 more matches
Practical positioning examples - Learn web development
le. you might be thinking "why not just create the separate tabs as separate webpages, and just have the tabs clicking through to the separate pages to create the effect?" this code would be simpler, yes, but then each separate "page" view would actually be a newly-loaded webpage, which would make it harder to save information across views, and integrate this feature into a larger ui design. in
addition, so-called "single page apps" are becoming very popular — especially for mobile web uis — because having everything served as a single file cuts down on the number of http requests required to view all the content, thereby improving performance. note: some web developers take things even further, only having one page of information loaded at once, and dynamically changing the informati...
...o display the corresponding panel when a tab is pressed, and style the tab itself. you won't need to understand the javascript itself at this stage, but you should think about learning some basic javascript as soon as possible — the more complex your ui features become, the more likely it is that you'll need some javascript to implement your desired functionality. ...
...e javascript to implement your desired 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 previous 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. previously 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 ...
...And 16 more matches
How CSS is structured - Learn web development
as an altenative, you can also use the interactive editor below. read on and have fun! selectors a selector targets html to apply styles to content. we have already discovered a variety of selectors in the getting started with css tutorial. if css is not applying to content as-expected, your selector may not match the way you think it should match. eac...
...r may not match the way you think it should match. each css rule starts with a selector—or a list of selectors—in order to tell the browser which element or elements the rules should apply to. all the examples below are valid selectors, or lists of selectors. h1 a:link .manythings #onething * .box p .box p:first-child h1, h2, .intro try creating some css rules that use the selectors above.
add html to be styled by the selectors. if any of the syntax above is not familiar, try searching mdn. note: you will learn more about selectors in the next module: css selectors. specificity you may 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 ...
...ample with the conflict between the class selector and the element selector, the class prevails, 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 selector to .special to see how it changes the styling. the rules of specificity and the cascade can seem complicated at first. these rules are easier to understand as you become more familiar with css. the cascade and inheritance section in the next module explains this in detail, including how to calculate spec...
...And 16 more matches
Third-party APIs - Learn web development
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/third-party-apis/mapquest directory. next, you need to go to ...
...placeholder with your key. changing the type of map there are a number of different types of map that can be shown with the mapquest api. to do this, find the following line: layers: l.mapquest.tilelayer('map') try changing 'map' to 'hybrid' to show a hybrid-style map. try some other values too. the tilelayer reference page shows the different available options, plus a lot more information. ...
...ne: layers: l.mapquest.tilelayer('map') try changing 'map' to 'hybrid' to show a hybrid-style map. try some other values too. the tilelayer reference page shows the different available options, plus a lot more information.
adding different controls the map has a number of different controls available; by default it just shows a zoom control. you can expand the controls available using the map.
addcontrol() method;
add this to your code, inside the window.onload handler: map.
addcontrol(l.mapquest.control()); the mapquest.control() method just creates a simple full-featured control set, and it is placed in the top-right hand corner by default. you can adjust the position by specifying an options object as a parameter for the control containing a position property, the value of which is a s...
...And 16 more matches
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. ...
...ml, 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 create component classes and use events to control interactivity, and keep track of app state using a service.
adding interactivity now we've got a refactored componentized version of our todo app, lets walk through how we can
add the interactivity we need to make the app functional. when beginning to think about interactivity, it's good to declare what each component's goals and responsibilities are. in the below sections we’ll do this for each component, and then walk you through how the functionality c...
...ur typed in todo task when we press the enter key and have it appear in the todos list. we want to be able to capture the text typed into the input. we do this so that our javascript code knows what we typed in, and we can save our todo and pass that text along to the todo list component to display. we can capture the keydown event via the on modifier, which is just ember syntactic sugar around
addeventlistener and removeeventlistener (see this explanation if needed).
add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='what needs to be done?' placeholder='what needs to be done?' autofocus {{on 'keydown' this.onkeydown}} > this new attribute is inside double curly braces, which tells you it is part of ember's dynamic templating syntax. the f...
...And 16 more matches
Starting our Svelte Todo list app - Learn web development
gs work in svelte, we can start building our example app: a todo list. 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. 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...
...m run dev to start your app in development mode. repl to code along with us using the repl, start at https://svelte.dev/repl/b7b831ea3a354d3789cefbc31e2ca495?version=3.23.2 todo list app features this is how our todo list app wil look like once it's ready: using this ui our user will be able to: browse their tasks. mark tasks as completed/pending without deleting them. remove tasks.
add new tasks. filter tasks by status: all tasks, active tasks, or completed tasks. edit tasks. mark all tasks as active/completed. remove all completed tasks. building our first component let's create a todos.svelte component — this will contain our list of todos. create a new folder — src/components. note: you can put your components anywhere inside the src folder, but the co...
...nsole should currently give you a message along the lines of "<app> was created with unknown prop 'name'". to get rid of this, remove the name prop from src/main.js; it should now look like so: import app from './app.svelte' const app = new app({ target: document.body }) export default app now if you check your testing server url you'll see our todos.svelte component being rendered:
adding static markup for the moment we will start with a static markup representation of our app, so you can see what it will look like. copy and paste the following into our todos.svelte component file, replacing the existing content: <!-- todos.svelte --> <div class="todoapp stack-large"> <!-- newtodo --> <form> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg"> ...
...And 16 more matches
Handling Mozilla Security Bugs
for more information read the rest of this document. introduction in order to improve the mozilla project's approach to resolving mozilla security vulnerabilities, mozilla.org is creating more formal arrangements for handling mozilla security-related bugs. first, mozilla.org is appointing a security module owner charged with primary responsibility for coordinating the investigation and resolution of reported mozilla security vulnerabilities. ...
...la.org is appointing a security module owner charged with primary responsibility for coordinating the investigation and resolution of reported mozilla security vulnerabilities. the security module owner will have one or more peers to assist in this task. ...
...the same time, mozilla.org is also creating a larger "mozilla security bug group" by which mozilla contributors and others can participate in
addressing security vulnerabilities in mozilla. this document describes how the new security organizational structure will work, and how security-related mozilla bug reports will be handled. note that the focus of this new structure is restricted solely to
addressing actual security vulnerabilities arising from problems in mozilla code. this work is separate from the work of developers
adding new security features (cryptographically-based or otherwise) to mozilla, although obviously many of the same people will be involved in both sets of activities. background security vulnerabilities are different from other bugs, because their consequences are pot...
...And 16 more matches
XPIDL
he future. note: starting in gecko 9.0, the older xpidl utility, which was previously 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 the mozilla tree. xpidl:syntax (now up to date again) xpidl syntax (out of date) xpidl author's guide (not as out of date) explanation of idl semantics a full guide to the syntax can be found at xpidl:syntax, which is written in an abnf form. an xpidl file is essentially just a series of declarations. at the to...
...tax, which is written in an abnf form. an xpidl file is essentially just a series of declarations. at the top level, we can define typedefs, native types, or interfaces. interfaces may furthermore contain typedefs, natives, methods, constants, or attributes. most declarations can have properties applied to them. types there are three ways to make types: a typedef, a native, or an interface. in
addition, there are a few built-in native types. the built-in native types are those listed under the type_spec production above. the following is the correspondence table: table 1: standard idl types idl c++ in parameter c++ out parameter js type notes boolean bool bool* boolean char char char* string only chars in range \u0000-\u...
...6_t* char16_t** string full unicode set permitted most of the time you don't want to use this type but astring. array<t> const nstarray<t>& nstarray<t>& array the c++-exposed type t will be an owned variant. (e.g. ns[c]string, refptr<t>, or uint32_t) string, wstring, [ptr] native and [ref] native are unsupported as element types. ...
...And 16 more matches
filter - CSS: Cascading Style Sheets
| none for a reference to an svg <filter> element, use the following: filter: url(file.svg#filter-element-id) interpolation if both the beginning and end filters have a function list of the same length without <url>, each of their filter functions is interpolated according to its specific rules. if they have different lengths, the missing equivalent filter functions from the longer list are
added to the end of the shorter list using their lacuna values, then all filter functions are interpolated according to their specific rules. if one filter is none, it is replaced with the filter functions list of the other one using the filter function default values, then all filter functions are interpolated according to their specific rules. otherwise, discrete interpolation is used. functions ...
...gb(51, 51, 51); height:100%; overflow:hidden; } #img2 { width:100%; height:auto; -webkit-filter:blur(5px); -ms-filter:blur(5px); filter:blur(5px); } table.standard-table { border: 1px solid rgb(187, 187, 187); border-collapse: collapse; border-spacing: 0; margin: 0 0 1.286em; height: 100%; width: 85%; } table.standard-table th { border: 1px solid rgb(187, 187, 187); p
adding: 0px 5px; background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { p
adding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } <svg style="position: absolute; top: -99999px" xmlns="http://www.w3.org/2000/svg"> <filter id="svgb...
...a value of 0% will cre...
...And 16 more matches
Inline options - Archive of obsolete content
firefox 7 supports a new syntax for defining extensions' preferences for both bootstrapped and traditional extensions. the user interface for the preferences defined with this new syntax appears in the extension's detail view in the
add-on manager. this functionality originally appeared in firefox mobile and is now available in firefox on the desktop as well. options file the xul allowed for the inline options is limited to a few new tags. ...
...rences defined with this new syntax appears in the extension's detail view in the
add-on manager. this functionality originally appeared in firefox mobile and is now available in firefox on the desktop as well. options file the xul allowed for the inline options is limited to a few new tags. here is an example of an options.xul file: <?xml version="1.0"?> <!doctype mydialog system "chrome://my
addon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="bool" pref="extensions.my
addon.bool" title="boolean" desc="stored as a boolean preference" /> </vbox> note that it's limited to <setting> tags. the root <vbox> just acts as a container, it isn't merged into the main window. if you need script support, see the display notificati...
...tribute should have the full name of the preference to be stored. the title attribute is used as a label for the controls. to set a description, either use the desc attribute, or a text node as a child of the <setting> tag. settings are tied to actual preferences, except the button setting, which is designed more for actions. ...
...And 15 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. ...
...ect, 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. komodo edit has automatic completion for xul tags and attributes, and it supports mozilla's css extensions (css values and properties beginning with "-moz"). it has an
add-on system similar to the one in firefox, and there are some komodo extensions that provide
additional help in extension development. that is more than what you can get with most other editors, so we recommend you to give it a try. all of our examples are handled with komodo edit, so if you see a .kpf or .komodoproject file in an example you download, this is a komodo project file. we recommend...
...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 previous 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 first lines in makefile. these def...
...And 15 more matches
Tabbed browser - Archive of obsolete content
ment and in some firefox source is "the tabbrowser element" in a firefox xul window. getting access to the browser from main window code running in firefox's global chromewindow, common for extensions that overlay into browser.xul, can access the tabbrowser element using the global variable gbrowser. // gbrowser is only accessible from the scope of // the browser window (browser.xul) gbrowser.
addtab(...); if gbrowser isn't defined your code is either not running in the scope of the browser window or running too early. you can access gbrowser only after the browser window is fully loaded. if you need to do something with gbrowser right after the window is opened, listen for the load event and use gbrowser in the event listener. if your code does not have access to the main window becaus...
...s.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); mainwindow.gbrowser.
addtab(...); from a dialog if your code is running in a dialog opened directly by a browser window, you can use: window.opener.gbrowser.
addtab(...); if window.opener doesn't work, you can get the most recent browser window using this code: var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var mainwind...
... // wrong way (the page hasn't finished loading yet) ...
...And 15 more matches
Creating a Microsummary - Archive of obsolete content
ad 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 languages you already use to generate pages. for example, if you use php scrip...
...the page. otherwise, if the url returns plain text content (or html content that can be converted to plain text), firefox uses the content as the microsummary for the page. beginnings generators are expressed as xml documents whose root element is the <generator> element in the http://www.mozilla.org/microsummaries/0.1 namespace. to begin building the generator, create a new empty text file and
add an xml declaration and empty <generator> tag to it: <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1"> </generator> giving it a name generators should have name attributes which are arbitrary descriptions of the microsummaries the generator creates. names should be descriptive enough to give users a good idea what information the microsummarie...
...uld be descriptive enough to give users a good idea what information the microsummaries will provide. ...
...And 15 more matches
Floats - Learn web development
eally simple example involving floating a block of text around an element. you can follow along by creating a new index.html file on your computer, filling it with a simple html template, and inserting the below code into it at the appropriate places. at the bottom of the section, you can see a live example of what the final code should look like. first, we'll start off with some simple html —
add the following to your html body, removing anything that was inside there before: <h1>simple float example</h1> <div class="box">float</div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. </p...
...tibus et magnis dis parturient montes, nascetur ridiculus mus.</p> now apply the following css to your html (using a <style> element or a <link> to a separate .css file — your choice): body { width: 90%; max-width: 900px; margin: 0 auto; font: .9em/1.2 arial, helvetica, sans-serif } .box { width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); p
adding: 1em; } if you save and refresh now, you'll see something much like what you'd expect — the box is sitting above the text, in normal flow. to float the text around it
add the float and margin-right properties to the .box rule: .box { float: left; margin-right: 15px; width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); p
adding: 1em; } now if yo...
...s vestibulum sem. aliquam tincidunt eget purus in interdum. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> body { width: 90%; max-width: 900px; margin: 0 auto; font: .9em/1.2 arial, helvetica, sans-serif } .box { float: left; margin-right: 15px; width: 150px; height: 150px; border-radius: 5px; background-color: rgb(207,232,220); p
adding: 1em; } so let's think about how the float works — the element with the float set on it (the <div> element in this case) is taken out of the normal 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 righ...
...And 15 more matches
Index
found 689 pages: # page tags and summary 1
add-ons
add-ons, extension, extensions, landing, mozilla
add-ons allow developers to extend and modify the functionality of firefox. 675 creating an appealing
add-on listing
add-ons, beginner, guide, webextension, publishing there are two essential steps to getting people to use your
add-on: they need to discover your
add-on and open the listing page, then the listing page needs to encourage them to click the
add to firefox button. ...
...velopers to extend and modify the functionality of firefox. 675 creating an appealing
add-on listing
add-ons, beginner, guide, webextension, publishing there are two essential steps to getting people to use your
add-on: they need to discover your
add-on and open the listing page, then the listing page needs to encourage them to click the
add to firefox button. the content you
add to a listing is therefore vital: from making effective use of keywords in your 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. ...
...the listing page needs to encourage them to click the
add to firefox button. the content you
add to a listing is therefore vital: from making effective use of keywords in your 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. ...
...And 15 more matches
Using the Browser API
er api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. it was originally used in firefox os to implement browser applications before that project was cancelled; since firefox 47 it is available to desktop chrome code and used in places like the firefox devtools. it consists of two major parts: custom <iframe> attributes: by
adding a mozbrowser attribute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the htmlifram...
...rectly if you don't do github), open webide, open the repo as a packaged app, then run it either on a simulator or a real device if you have one. in any case, you should at least download the repo and refer to the code as you read the sections below. the html an <iframe> is turned into a browser iframe by setting the mozbrowser attribute on it: <iframe src="http://mozilla.org" mozbrowser> in
addition, the <iframe> can be loaded in its own child process — separate to the page embedding this frame — by including the remote attribute. <iframe src="http://hostname.tld" mozbrowser remote> warning: this last attribute is necessary for security reasons if you plan to load content from an untrusted/unknown origin. if you don't use it, you run the risk of your application being compromised...
... you can see the full html listing here. the javascript implementation to wire up the functionality required by our simple browser, we've written some basic javascript (see the full javascript listing.) wiring up the back and forward buttons early on in the code we implement two simple event listeners to move the browser back and forward in history when the relevant buttons are pressed: back.
addeventlistener('touchend',function() { browser.goback(); }); fwd.
addeventlistener('touchend',function() { browser.goforward(); }); the functions can be handled using the browser api htmliframeelement.goback() and htmliframeelement.goforward() methods. you'll also notice that we're also firing these functions on the touchend event, which is effective as firefox os devices are generally touchsc...
...And 15 more matches
NSS tools : modutil
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 with security module database management are part of a proces...
... 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. options running modutil always requires one (and only one) option to specify the type of module operation. each option may take arguments, anywhere from none to multiple arguments. options -
add modulename
add the named pkcs #11 module to the database. use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. a password is equivalent to a personal identification number (pin)...
...t. -fips [true | false] enable (true) or disable (false) fips 140-2 compliance for the default nss module. -force disable modutil's interactive prompts so it can be run from a script. use this option only after manually testing each planned operation to check for warnings and to ensure that bypassing the prompts will cause no security lapses or loss of database integrity. -jar jar-file
add a new pkcs #11 module to the database using the named jar file. use this command with the -installdir and -tempdir arguments. the jar file uses the nss pkcs #11 jar format to identify all the files to be installed, the module's name, the mechanism flags, and the cipher flags, as well as any files to be installed on the target machine, including the pkcs #11 module library file and other fil...
...And 15 more matches
NSS tools : modutil
name modutil — manage pkcs #11 module information within the security module database. synopsis modutil [options] arguments 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 with security module database management are part of a process that typically also involves managi...
...atabase files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. options running modutil always requires one (and only one) option to specify the type of module operation. each option may take arguments, anywhere from none to multiple arguments. options -
add modulename
add the named pkcs #11 module to the database. use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. a password i...
...ce for the default nss module. -force disable modutil's interactive prompts so it can be run from a script. use this option only after manually testing each planned operation to check for warnings and to ensure that bypassing the prompts will cause no security lapses or loss of database integrity. -jar jar-file
add a new pkcs #11 module to the database using the named jar file. use this command with the -installdir and -tempdir arguments. the jar file uses the nss pkcs #11 jar format to identify all the files to be installed, the module's name, the mechanism flags, and the cipher flags, as well as any files to be installed on the target machine, includi...
...And 15 more matches
Hacking Tips
rated code (from gdb, x86 / x86-64, arm) to set a breakpoint the generated code of a specific jsscript compiled with ionmonkey. set a breakpoint on the instruction you are interested in. if you have no precise idea which function you are looking at, you can set a breakpoint on the js::ion::codegenerator::visitstart function. optionally, a condition on the ins->id() of the lir instruction can be
added to select precisely the instruction you are looking for. once the breakpoint is on codegenerator function of the lir instruction,
add a command to generate a static breakpoint in the generated code. $ gdb --args js […] (gdb) b js::ion::codegenerator::visitstart (gdb) command >call masm.breakpoint() >continue >end (gdb) r js> function f(a, b) { return a + b; } js> for (var i = 0; i < 100000;...
...x10234e0) at /home/nicolas/mozilla/ionmonkey/js/src/ion/codegenerator.cpp:609 609 } program received signal sigtrap, trace/breakpoint trap. 0x00007ffff7fb165a in ?? () (gdb) once you hit the generated breakpoint, you can replace it by a gdb breakpoint to make it conditional, the procedure is to first replace the generated breakpoint by a nop instruction, and to set a breakpoint at the
address of 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...
... previous 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
address of the code disassembly code read at this
address (using x/ni
address, where n is the number of instructions you would like to see) here is an example. it might be simpler to use the codegenerator::link lineno instead of the full qualified name to put the breakpoint. let's say that the line number of this function is 4780, for instance: (gdb) b codegenerator.cpp:4780 breakpoint 1 at 0x84c...
...And 15 more matches
Places Developer Guide
integer identifiers for items in the bookmark system. some of the apis are uri-centric, some use item ids. the api signature and context usually make clear which is required. bookmarks the toolkit bookmarks service is nsinavbookmarksservice: var bookmarks = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); this service provides methods for
adding, editing and deleting items in the bookmarks collection. types in the bookmark system there are the four types of items in the bookmarks system, and their identifiers in the idl: bookmark: nsinavbookmarksservice.type_bookmark folder: nsinavbookmarksservice.type_folder separator: nsinavbookmarksservice.type_separator dynamic container: nsinavbookmarksservice.type_dynamic_container ide...
...efault_index); // the position of the livemark in its parent folder. accessing bookmarks and related items accessing item properties for all items: string getitemtitle(aitemid) - returns an item's title int64 getitemindex(aitemid) - returns an item's position in it's parent folder prtime getitemtype(aitemid) - returns the type of an item (bookmark, folder, separator) prtime getitemdate
added(aitemid) - returns the time in microseconds that an item was
added prtime getitemlastmodified(aitemid) - returns the time in microseconds that an item was last modified int64 getfolderidforitem(aitemid) - returns the id of the folder containing the given item. string getitemguid(aitemid) obsolete since gecko 14.0 - returns a globally unique identifier for the item. this is mainly for use ...
...sultcontainernode.getchild(i); // accessing properties of matching bookmarks var title = childnode.title; var uri = childnode.uri; } updating bookmark items for all items: setitemtitle(aitemid, atitle) - changes an item's title. setitemindex(aitemid, aindex) - changes an item's position. note: this does not re-index the whole folder - use moveitem for a managed solution. setitemdate
added(aitemid, adate
added) - set the date the item was first
added, in microseconds. setitemlastmodified(aitemid, alastmodified) - set the date the item was last modified, in microseconds. setitemguid(aitemid, aguid) obsolete since gecko 14.0 - returns a globally unique identifier for the item. this is mainly for use by extensions that sync bookmark data between different profiles. moveitem (af...
...And 15 more matches
Introduction to XPCOM for the DOM
ad the code or to work with the existing framework. the numerous macros and facilities brought by the dom, as well as nscomptr's, make our life much easier. in this chapter i will attempt to cover the most widespread use of xpcom in the dom, avoiding the details as much as possible. i will introduce nscomptr's, interfaces, reference counting, and the nsisupports interface. a tutorial about how to
add a new interface is also provided, and eventually, a more detailed discussion of class inheritance in c++. interfaces object-oriented programming is based on the used of inheritance between classes. furthermore, a class can be de declared to be "abstract" if it declares some methods but does not implement them entirely. pushing this concept to its maximum, a class can be "purely virtual" if it d...
...lementation of the interface (the concrete class) changes. xpcom pushes this concept to the extreme. pure virtual methods are declared with the following syntax: virtual nsresult functionfoo() = 0; an interface is thus simply a c++ class where all the member functions are declared as pure virtual functions. an interface can also be defined using xpidl. this is described in section 1.e, "how to
add an interface". since an interface doesn't have any implementation, it has to be implemented by a non-abstract class -- a concrete class. if the interface is called nsifoo and the class is called nsfoo, we say that "nsfoo implements nsifoo", or that "nsfoo inherits from nsifoo". the c++ code is the following: class nsfoo : public nsifoo for those unfamiliar with object-oriented c++, this means...
...ven'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 time a pointer to an interface is assigned the
address of an object, we have to increase the reference count of that object by one. the function that does this is called "
addref" and is defined in the nsisupports interface. when the pointer no longers holds the
address of that object, it has to decrease the reference count of that object by one. this is done using the "release" function, also defined in the nsisupports interface. when the referen...
...And 15 more matches
RTCPeerConnection - Web APIs
the rtcpeerconnection interface represents a webrtc connection between the local computer and a remote peer. it provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. ...
...he rtcpeerconnection interface returns one of the string values specified by the rtcsignalingstate enum; these values describe the state of the signaling process on the local end of the connection while connecting or reconnecting to another peer. see signaling in lifetime of a webrtc session for more details about the signaling process.event handlersalso inherits event handlers from: eventtargeton
addstream the rtcpeerconnection.on
addstream event handler is a property containing the code to execute when the
addstream event, of type mediastreamevent, is received by this rtcpeerconnection. such an event is sent when a mediastream is
added to this connection by the remote peer. the event is sent immediately after the call setremotedescription() and doesn't wait for the result of the sdp negotiat...
...ectionstatechange event when it occurs on an instance of rtcpeerconnection. this happens whenever the aggregate state of the connection changes.ondatachannel the rtcpeerconnection.ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection. this event, of type rtcdatachannelevent, is sent when an rtcdatachannel is
added to the connection by the remote peer calling createdatachannel().onicecandidatethe rtcpeerconnection property onicecandidate property is an eventhandler which specifies a function to be called when the icecandidate event occurs on an rtcpeerconnection instance. this happens whenever the local ice agent needs to deliver a message to the other peer through the signaling server.oniceconnectionstat...
...And 15 more matches
The Essentials of an Extension - Archive of obsolete content
abase 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. there are two accepted standards for
add-on ids. one is the email-like format in the hello world example, which should be something like <project-name>@<yourdomain>. the other standard practice is to use a generated uuid string, which is extremely unlikely to be duplicated. unix-based systems have a command line tool called uuidgen that generates uuids. there are also downloadable tools for all platforms that generate them. the enclosin...
...ome uniqueness to it, it's ok to use either form. ...
...m:name>xul school hello world</em:name> <em:description>welcome to xul school!</em:description> <em:version>0.1</em:version> <em:creator>appcoast</em:creator> <em:homepageurl>https://developer.mozilla.org/docs/xul_school</em:homepageurl> this is the data that is displayed before and after the extension is installed, that you can see in the
add-ons manager. there are many other tags that can be
added, for contributors and translators. ...
...And 14 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
its intended audience is extension developers with a basic knowledge of xul and css. we assume that you're also familiar with the basics of creating firefox extensions and have the hello world extension working. another tutorial, which walks you through the entire process from the beginning, is also available. creating an overlay the first step is to create an overlay for the document containing the toolbar you wish to enhance. explaining overlays is beyond the scope of this tutorial -- you can read about them in the xul tutorial. to overlay a document, you need to know its uri. ...
...rial. to overlay a document, you need to know its uri. you can find a list of uris for the most commonly overlaid documents at the bottom of this page. note: some people overlay chrome://messenger/content/mailwindowoverlay.xul. that should cause the button to appear on all windows that mailwindowoverlay.xul is applied to (i.e. main window and view message window). this needs to be looked into. ...
...t the bottom of this page. note: some people overlay chrome://messenger/content/mailwindowoverlay.xul. that should cause the button to appear on all windows that mailwindowoverlay.xul is applied to (i.e. main window and view message window). this needs to be looked into.
adding the toolbar button toolkit applications have customizable toolbars; therefore, it's common practice for extensions to
add their toolbar buttons to the toolbar palette, rather than
adding them directly to the toolbar. ...
...And 14 more matches
Common causes of memory leaks in extensions - Extensions
xtension 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 prevent most of these compartment leaks,
add-ons still need to be aware of the practices that caused these leaks, as the fix causes many
add-ons which would have otherwise caused a leak to instead throw errors when attempting to access nodes from documents which no longer exist. storing references to window objects and dom nodes the most common problem is extensions holding onto references to content windows for too long. for example, in...
... up belonging to the global scope. for example: function implicitdeclarationleak(window) { // implicit variable declaration in the js global, holding a strong ref to the document doc = window.document; } implicitly declared variables can be avoided by using ecmascript 5's strict mode. strict mode also excludes several other error-prone code patterns. for some examples found in real-world
add-ons, see bug 712733, bug 725875, and bug 727552. to avoid these issues, references to dom nodes in foreign document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references. be careful with setinterval/settimeout using window.setinterval() or window.settimeout() can be problematic, too, when it comes ...
...t should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references. be careful with setinterval/settimeout using window.setinterval() or window.settimeout() can be problematic, too, when it comes to zombie compartments. consider the following example code that could be part of your browser.xul overlay: gbrowser.
addeventlistener("domcontentloaded", function(evt) { var contentdoc = evt.originaltarget; var i = 0; // refresh the title once each second setinterval(function() { contentdoc.title = ++i; }, 1000); }, false); one would normally expect that the interval (or timer) would be destroyed as soon as the document unloads, in the same way that event listeners are automatically destroyed. howe...
...And 14 more matches
Build the brick field - Game development
« previousnext » 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. ...
...ter 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. ...
...ugh 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 previous 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() { // ... game.load.image('brick', 'img/brick.png'); } you also need to grab the brick image from github and save it in your /img directory. dra...
...And 14 more matches
Grids - Learn web development
, which has some child items. by default these display in normal flow so the boxes display one below the other. we will be working with this file for the first part of this lesson, making changes to see how grid behaves. to define a grid we use the grid value of the display property. as with flexbox, this switches on grid layout, and all of the direct children of the container become grid items. ...
...of the direct children of the container become grid items.
add this to the css inside your file: .container { display: grid; } unlike flexbox, the items will not immediately look any different. declaring display: grid gives you a one column grid, so your items will continue to display one below the other as they do in normal flow. to see something that looks more grid-like, we will need to
add some columns to the grid. let's
add three 200-pixel columns here. you can use any length unit, or percentages to create these column tracks. .container { display: grid; grid-template-columns: 200px 200px 200px; }
add the 2nd declaration to your css rule, then reload the page, and you should see that the items have rearranged themselves one into each cell of the created grid. simple g...
... grid; grid-template-columns: 200px 200px 200px; }
add the 2nd declaration to your css rule, then reload the page, and you should see that the items have rearranged themselves one into each cell of the created grid. ...
...And 14 more matches
Introduction to events - Learn web development
vent listener, and once() to register an event listener that unregisters after it has run once. the http 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 ...
...come unmanageable and inefficient. for a start, it is not a good idea to mix up your html and your javascript, as it becomes hard to parse — keeping your javascript separate is best practice; if it is in a separate file you can apply it to multiple html documents. even in a single file, inline event handlers are not a good idea. ...
...becomes hard to parse — keeping your javascript separate is best practice; if it is in a separate file you can apply it to multiple html documents. even in a single file, inline event handlers are not a good idea. one button is ok, but what if you had 100 buttons? you'd have to
add 100 attributes to the file; it would quickly turn into a maintenance nightmare. ...
...And 14 more matches
What is JavaScript? - Learn web development
namically updating content, control multimedia, animate images, and pretty much everything else. (okay, not everything, but it is amazing what you can achieve with a few lines of javascript code.) the three layers build on top of one another nicely. let's take a simple text label as an example. ...
...ose: <p>player 1: chris</p> then we can
add some css into the mix to get it looking nice: p { font-family: 'helvetica neue', helvetica, sans-serif; letter-spacing: 1px; text-transform: uppercase; text-align: center; border: 2px solid rgba(0,0,200,0.6); background: rgba(0,0,200,0.3); color: rgba(0,0,200,0.6); box-shadow: 1px 1px 2px rgba(0,0,200,0.4); border-radius: 10px; p
adding: 3px 10px; display: inline-block; cursor: pointer; } and finally, we can
add some javascript to implement dynamic behaviour: const para = document.queryselector('p'); para.
addeventlistener('click', updatename); function updatename() { let name = prompt('enter a new name'); para.textcontent = 'player 1: ' + name; } try clicking on this last version of the text label to see wha...
...but these are advanced techniques that we won't cover in this course. javascript running order when the browser encounters a block of javascript, it generally runs it in order, from top to bottom. this means that you need to be careful what order you put things in. for example, let's return to the block of javascript we saw in our first example: const para = document.queryselector('p'); para.
addeventlistener('click', updatename); function updatename() { let name = prompt('enter a new name'); para.textcontent = 'player 1: ' + name; } here we are selecting a text paragraph (line 1), then attaching an event listener to it (line 3) so that when the paragraph is clicked, the updatename() code block (lines 5–8) is run. the updatename() code block (these types of reusable code blocks ar...
...And 14 more matches
Creating localizable web applications
ces and recommendations that should be followed in order to make your content easily localizable. note: most of the code snippets used in the examples below come from an early version of the getpersonas.com website. in some cases, the code snippets were slightly changed to better illustrate the recommendations or for clarity. cheatsheet don't hardcode english text, formats (numbers, dates,
addresses, etc.), word order or sentence structure. don't put text or numbers in images. don't forget about right-to-left locales. take advantage of printf() (or equivalents) and use variables in the english strings. write semantic code (e.g. don't use text and <img/> for decorations; instead, use css). document your code so that localizers know what they're translating (e.g. in gettext use comm...
...t and <img/> for decorations; instead, use css). document your code so that localizers know what they're translating (e.g. in gettext use comments and contexts). app logic detect the locale correctly be smart about detecting the user's locale correctly. you can use one or more of the following techniques: http accept-language headers, the ua string, ip geolocation. see examples of the
addons.mozillaorg code at /
addons/trunk/site/app/config/language.php and /
addons/trunk/site/app/config/language.inc.php. the language_config class expects arrays of valid languages & supported languages. always give the user a possibility to change the locale (e.g. by
adding locale dropdown menu at bottom of page) and remember this choice for the future visits. use the locale code in the urls depe...
...tml/php: <?php function isrtl($locale) { $rtl_locales = array('ar', 'fa', 'he'); return in_array($locale, $rtl_locales); } ?> <html lang="<?= $locale?>" dir="<?= isrtl($locale) ? 'rtl' : 'ltr' ?>" > <body class="<?= $locale?> <?= isrtl($locale) ? 'rtl' : 'ltr' ?>"> </body> </html> notice that <body/> is given a class equal to the current locale. this is useful to
add minor corrective rules to the css that apply only for selected locales. for example, for locales that tend to have longer words than english, you may want to make an element slightly wider. snippet 3. good: body.de foo, body.fr foo, body.pl foo { /* locale-specific rules for the foo element */ width: 10em; /* originally 8em */ } adapt the interaction to rtl locales right-to-left locales n...
...And 14 more matches
nsIMsgSearchSession
imsgsearchsession interface allows you to create and manipulate search sessions within thunderbird. to create an instance, use: var searchsession = components.classes["@mozilla.org/messenger/searchsession;1"] .createinstance(components.interfaces.nsimsgsearchsession); to use the instance append search terms, set the scope, and then call search(). ...
...ion.
addscopeterm(components.interfaces.nsmsgsearchscope.offlinemail, afolder); var searchterm = searchsession.createterm(); var value = searchterm.value; value.str = avalue; searchterm.value = value; searchterm.op = searchsession.booleanor; searchterm.booleanand = false; searchsession.appendterm(searchterm); searchsession.search(null); inherits from: nsisupports method overview void
addsearchterm(in nsmsgsearchattribvalue attrib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value, in boolean booleanand, in string arbitraryheader); nsimsgsearchterm createterm(); void appendterm(in nsimsgsearchterm term); void registerlistener(in nsimsgsearchnotify listener); void unregisterlistener(in nsimsgsearchnotify listener); void getnthsearchte...
...tener(in nsimsgsearchnotify listener); void unregisterlistener(in nsimsgsearchnotify listener); void getnthsearchterm(in long whichterm, in nsmsgsearchattribvalue attrib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value); long countsearchscopes(); void getnthsearchscope(in long which,out nsmsgsearchscopevalue scopeid, out nsimsgfolder folder); void
addscopeterm(in nsmsgsearchscopevalue scope, in nsimsgfolder folder); void
adddirectoryscopeterm(in nsmsgsearchscopevalue scope); void clearscopes(); [noscript] boolean scopeusescustomheaders(in nsmsgsearchscopevalue scope, in voidptr selection, in boolean forfilters); boolean isstringattribute(in nsmsgsearchattribvalue attrib); void
addallscopes(in nsmsg...
...And 14 more matches
Autoconfiguration in Thunderbird
do not change this document without consulting the author thunderbird 3.1 and later (and 3.0 to some degree) includes mail account autoconfiguration functionality. the goal of autoconfiguration is to make it very easy for users to configure the connection of thunderbird to their email servers. in many cases, people should be able to download and install thunderbird, enter their real name, email
address and password in the account setup wizard and have a fully functioning mail client and get and send their mail as securely as possible. see also: for instructions for users, see automatic account configuration on the thunderbird knowledge base. the configuration file description and definition the original project page on the mozilla wiki for background, design, implementation and projec...
...he server settings via different means, each of which is intended for different cases: ispdb the ispdb is a central database, currently hosted by the thunderbird project, but free to use for any client. it contains settings for the world's largest isps. most isps with a market share of more than 0.1% are included. this allows to autoconfigure almost 50% of our user's email accounts. it was
added because we cannot assume that all big isps (including microsoft) will set up a configuration server for thunderbird. configuration server at isp isps have the option to provide their configuration information themselves directly to users, by setting up a web server at autoconfig.<domain>, which simply returns a static xml file with the configuration, as described below. for more complicated ...
...ill set up a configuration server for thunderbird. configuration server at isp isps have the option to provide their configuration information themselves directly to users, by setting up a web server at autoconfig.<domain>, which simply returns a static xml file with the configuration, as described below. for more complicated setups, for example when the login name does not appear in the email
address, the xml file can also be generated by the isp. in such complicated cases, this is the only way to allow an automatic setup. configuration file on harddisk local administrators may place a configuration file in the thunderbird installation folder. this is mainly intended for companies who install thunderbird on their employees' computers and want to enable easy account setup without having...
...And 14 more matches
Border-radius generator - CSS: Cascading Style Sheets
width: 83%; } .span_9 { width: 74.54%; } .span_8 { width: 66.08%; } .span_7 { width: 57.62%; } .span_6 { width: 49.16%; } .span_5 { width: 40.7%; } .span_4 { width: 32.24%; } .span_3 { width: 23.78%; } .span_2 { width: 15.32%; } .span_1 { width: 6.86%; } /* sections * ========================================================================== */ .section { clear: both; p
adding: 0px; margin: 0px; } /* grouping * ========================================================================== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { ...
...ild { margin-left: 0; } /* all browsers except ie6 and lower */ /* * ui component */ .ui-input-slider-container { height: 20px; margin: 10px 0; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider-container * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; p
adding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; p
adding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png...
...0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; p
adding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hover { background-color: #379b4a; cursor: pointer; } /* * ui component */ /* checkbox */ .ui-checkbox { text-align: center; font-...
...And 14 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
o the layout you desire. you can also create a grid using flexible sizes with percentages or with the new fr unit designed for this purpose. item placement you can place items into a precise location on the grid using line numbers, names or by targeting an area of the grid. grid also contains an algorithm to control the placement of items not given an explicit position on the grid. creation of
additional tracks to hold content you can define an explicit grid with grid layout. the grid layout specification is flexible enough to
add additional rows and columns when needed. features such as
adding “as many columns that will fit into a container” are included. alignment control grid contains alignment features so we can control how the items align once placed into a grid area, and how t...
...pper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> i make the .wrapper a grid container. .wrapper { display: grid; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; p
adding: 1em; color: #d9480f; } all the direct children are now grid items. in a web browser, you won’t see any difference to how these items are displayed before turning them into a grid, as grid has created a single column grid for the items. at this point, you may find it useful to work with the grid inspector, available as part of firefox's developer tools. if you view this example in fir...
... tools. if you view this example in firefox and inspect the grid, you will see a small icon next to the value grid. click this and then the grid on this element will be overlaid in the browser window. as you learn and then work with the css grid layout this tool will give you a better idea of what is happening with your grids visually. ...
...And 14 more matches
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
want with grid layout. choose the method you find most helpful for the problems that you are solving and the designs that you need to implement. a responsive layout with 1 to 3 fluid columns using grid-template-areas many websites are a variation of this type of layout, with content, sidebars, a header and a footer. in a responsive design, you may want to display the layout as a single column,
adding a sidebar at a certain breakpoint and then bring in a three-column layout for wider screens. i am going to create this layout using the named template areas that we learned about in the guide grid template areas. my mark-up is a container with elements inside for a header, footer, main content, navigation, sidebar, and a block into which i am intending to place advertising. * {box-sizin...
...e for a header, footer, main content, navigation, sidebar, and a block into which i am intending to place advertising. ...
...ntending to place advertising. ...
...And 14 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
pixels. i have also set the flex-wrap property to wrap, so that if the space in the container becomes too narrow to maintain the flex basis, items will wrap onto a new row. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; p
adding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { width: 500px; display: flex; flex-wrap: wrap; } .wrapper > div { flex: 1 1 150px; } in the image, you can see that two items have wrapped onto a new line. these items are sharing the available space and not lining up undern...
...es out one into each cell of the created grid. as you can see they stay in a strict grid, lining up in rows and columns. with five items, we get a gap on the end of row two. ...
...flexbox works from the content out. an ideal use case for flexbox is when you have a set of items and want to space them out evenly in a container. you let the size of the content decide how much individual space each item takes up. if the items wrap onto ...
...And 14 more matches
Creating a cross-browser video player - Developer guides
doing things this way still allows users who have javascript turned off (for whatever reason) to still have access to the browser's native controls. a poster image is defined for the video, and the preload attribute is set to metadata, which informs the browser that it should initially only atte...
...and ogg. using these different source formats gives the best chance of being supported across all browsers that support html5 video. for further information on video formats and browser compatibility, see supported media formats. for browsers that do not support html5 video, a flash player is provided that will allow playback of the mp4 video source, provided the end user has flash installed. in
addition a download link is displayed to allow users to download the mp4 video file, should they wish to (providing those without flash installed with a method of viewing the video, a fallback for a fallback if you like). the code above would allow playback of the video in most browsers, using the browser's default control set. the next step is to define a custom control set, also in html, which wil...
... most browsers, using the browser's default control set. the next step is to define a custom control set, also in html, which will be used to control the video. the control set most browser's default video controls have the following functionality: play/pause mute volume control progress bar skip ahead go fullscreen the custom control set will also support this functionality, with the
addition of a stop button. once again the html is quite straightforward, using an unordered list with list-style-type:none set to enclose the controls, each of which is a list item with float:left. for the progress bar, the progress element is taken advantage of, with a fallback provided for browsers that don't support it (e.g. ie8 and ie9). this list is inserted after the <video> element, but insid...
...And 14 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
plicitly a float. also, watch out for stuff like: 0.1 + 0.2 == 0.30000000000000004; in practice, integer values are treated as 32-bit ints, and some implementations even store it that way until they are asked to perform an instruction that's valid on a number but not on a 32-bit integer. this can be important for bit-wise operations. the standard arithmetic operators are supported, including
addition, subtraction, modulus (or remainder) arithmetic, and so forth. there's also a built-in object that we did not mention earlier called math that provides advanced mathematical functions and constants: math.sin(3.5); var circumference = 2 * math.pi * r; you can convert a string to an integer using the built-in parseint() function. this takes the base for the conversion as an optional second ...
... (which is the same as modulo.) values are assigned using =, and there are also compound assignment statements such as += and -=. these extend out to x = x operator y. x += 5; x = x + 5; you can use ++ and -- to increment and decrement respectively. these can be used as a prefix or postfix operators. the + operator also does string concatenation: 'hello' + ' world'; // "hello world" if you
add a string to a number (or other value) everything is converted into a string first. this might trip you up: '3' + 4 + 5; // "345" 3 + 4 + '5'; // "75"
adding an empty string to something is a useful way of converting it to a string itself. comparisons in javascript can be made using <, >, <= and >=. these work for both strings and numbers. equality is a little less straightforward. the doubl...
...this is very rarely what you want — in fact it's worth specifically labeling deliberate fallthrough with a comment if you really meant it to aid debugging: switch (a) { case 1: // fallthrough case 2: eatit(); break; default: donothing(); } the default clause is optional. you can have expressions in both the...
...And 14 more matches
Understanding WebAssembly text format - WebAssembly
s start with the simplest, shortest possible wasm module. (module) this module is totally empty, but is still a valid module. if we convert our module to binary now (see converting webassembly text format to wasm), we’ll see just the 8 byte module header described in the binary format: 0000000: 0061 736d ; wasm_binary_magic 0000004: 0100 0000 ; wasm_binary_version
adding functionality to your module ok, that’s not very interesting, let’s
add some executable code to this module. all code in a webassembly module is grouped into functions, which have the following pseudo-code structure: ( func <signature> <locals> <body> ) the signature declares what the function takes (parameters) and returns (return values). the locals are like vars in javascript, bu...
... have to talk about one more thing: stack machines. 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 previous 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) loca...
...citly grabs the previous 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 contains exactly one i32 value — the result of the expression ($p + $p), which is handled by i32.
add. the return value of a function is just the final value left on the stack. the webassembly validation rules ensure the stack matches exactly: if you declare a (result f32), then the stack must contain exactly one f32 at the end. if there is no result type, the stack must be empty. ...
...And 14 more matches
Using the WebAssembly JavaScript API - WebAssembly
param i32)) (func (export "exported_func") i32.const 42 call $i)) in the second line, you will see that the import has a two-level namespace — the internal function $i is imported from imports.imported_func. we need to reflect this two-level namespace in javascript when writing the object to be imported into the wasm module. create a <script></script> element in your html file, and
add the following code to it: var importobject = { imports: { imported_func: arg => console.log(arg) } }; streaming the webassembly module new in firefox 58 is the ability to compile and instantiate webassembly modules directly from underlying sources. this is achieved using the webassembly.compilestreaming() and webassembly.instantiatestreaming() methods. these methods are easier than their...
...e byte code directly into module/instance instances, cutting out the need to separately put the response into an arraybuffer. this example (see our instantiate-streaming.html demo on github, and view it live also) shows how to use instantiatestreaming() to fetch a wasm module, import a javascript function into it, compile and instantiate it, and access its exported function — all in one step. ...
...sembly.instantiate(bytes, importobject) ).then(results => { results.instance.exports.exported_func(); }); viewing wasm in developer tools in firefox 54+, the developer tool debugger panel has functionality to expose the text representation 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 preview. 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 ...
...And 14 more matches
jspage - Archive of obsolete content
at(a).each(function(b){if(b instanceof function){b=class.instantiate(b);}this.implement(b); },this);}};var chain=new class({$chain:[],chain:function(){this.$chain.extend(array.flatten(arguments));return this;},callchain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false; },clearchain:function(){this.$chain.empty();return this;}});var events=new class({$events:{},
addevent:function(c,b,a){c=events.removeon(c);if(b!=$empty){this.$events[c]=this.$events[c]||[]; this.$events[c].include(b);if(a){b.internal=true;}}return this;},
addevents:function(a){for(var b in a){this.
addevent(b,a[b]);}return this;},fireevent:function(c,b,a){c=events.removeon(c); if(!this.$events||!this.$events[c]){return this;}this.$events[c].each(function(d){d.create({bind:this,delay:a,"argumen...
...,c[d]); }return this;}if(c){c=events.removeon(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeevent(d,b[a]); }}return this;}});events.removeon=function(a){return a.replace(/^on([a-z])/,function(b,c){return c.tolowercase();});};var options=new class({setoptions:function(){this.options=$merge.run([this.options].extend(arguments)); if(!this.
addevent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^on[a-z]/).test(a)){continue;}this.
addevent(a,this.options[a]); delete this.options[a];}return this;}});var element=new native({name:"element",legacy:window.element,initialize:function(a,b){var c=element.constructors.get(a); if(c){return c(b);}if(typeof a=="string"){return document.newelement(a,b);}return docu...
...t(c||"iframe",d);var b=function(){var g=$try(function(){return c.contentwindow.location.host;});if(!g||g==window.location.host){var h=new window(c.contentwindow); new document(c.contentwindow.document);$extend(h.element.prototype,element.prototype);}e.call(c.contentwindow,c.contentwindow.document);};var a=$try(function(){return c.contentwindow; });((a&&a.document.body)||window.frames[d.id])?b():c.
addlistener("load",b);return c;}});var elements=new native({initialize:function(f,b){b=$extend({ddup:true,cash:true},b); f=f||[];if(b.ddup||b.cash){var g={},e=[];for(var c=0,a=f.length;c<a;c++){var d=document.id(f[c],!b.cash);if(b.ddup){if(g[d.uid]){continue;}g[d.uid]=true; }if(d){e.push(d);}}f=e;}return(b.cash)?$extend(f,this):f;}});elements.implement({filter:function(a,b){if(!a){return this;}return...
...And 13 more matches
Building accessible custom components in XUL - Archive of obsolete content
se"/> <label value="conference fee" flex="1"/> <label value="lodging" flex="1"/> <label value="dinner" flex="1"/> <label value="lodging" flex="1"/> <label value="breakfast" flex="1"/> <label value="lunch" flex="1"/> <label value="dinner" flex="1"/> </column> <-- several columns omitted for brevity --> </columns> </grid> </code> now we can use css to
add some minimal styling to make it actually look like a spreadsheet. <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; p
adding: 3px; } grid.spreadsheet description { color: black; background-color: white; m...
...tyling to make it actually look like a spreadsheet. <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; p
adding: 3px; } grid.spreadsheet description { color: black; background-color: white; margin: 0px; p
adding: 2px; border-left: thin solid; border-bottom: thin solid; font-family: monospace; font-size: 12pt; text-align: center; font-weight: bold; } </code> you can see the results by installing stage-1.xpi, restarting firefox, and selecting accjax from the tools menu. the final product looks like this: <caption>xul spreadsheet with 7 rows and 5 columns</caption> although this has ...
...y are exposed as role="text". <caption>it looks like a column header, but it's not</caption> so, before we do anything else, we need to tell assistive technologies that all of these unrelated elements are actually related. this is where dhtml accessibility comes in. further reading grid element reference description element reference label element reference grid tutorial label tutorial
adding roles with dhtml accessibility download stage-2.zip install stage-2.xpi using the new dhtml accessibility techniques in firefox 1.5, we can declare the role of each element in our spreadsheet. the grid element is really a spreadsheet. each label element is really a cell within the spreadsheet. each description element is really a row or column header within the spreadsheet. you can find a ...
...And 13 more matches
Building up a basic demo with Babylon.js - Game development
to store your experiments in. saving a copy of the latest babylon.js engine inside your directory. opening the babylon.js documentation in a separate tab — it is useful to refer to. ...
...n the second one. there is one helper variable already included, which will store a reference to the <canvas> element. before reading on, copy this code to a new text file and save it in your working directory as index.html. initialising the babylon.js engine we have to create a babylon.js engine instance first (passing it the <canvas> element to render on) before we start developing our game.
add the following code to the bottom of your second <script> element: 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...
...o the bottom of your second <script> element: 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. ...
...And 13 more matches
Accessible multimedia - Learn web development
hat they can't be easily made to follow a site style guide. to remedy this, we can create our own custom controls. let's look at how. creating custom audio and video controls html5 video and audio share an api — html media element — which allows you to map custom functionality to buttons and other controls — both of which you define yourself. let's take the video example from above and
add custom controls to them. basic setup first, grab a copy of our custom-controls-start.html, custom-controls.css, rabbit320.mp4, and rabbit320.webm files and save them in a new directory on your hard drive. create a new file called main.js and save it in the same directory. first of all, let's look at the html for the video player, in the html: <section class="player"> <video controls> <...
...ead.</p> </video> <div class="controls"> <button class="playpause">play</button> <button class="stop">stop</button> <button class="rwd">rwd</button> <button class="fwd">fwd</button> <div class="time">00:00</div> </div> </section> javascript basic setup we've inserted some simple control buttons below our video. ...
...op">stop</button> <button class="rwd">rwd</button> <button class="fwd">fwd</button> <div class="time">00:00</div> </div> </section> javascript basic setup we've inserted some simple control buttons below our video. these controls of course won't do anything by default; to
add functionality, we will use javascript. ...
...And 13 more matches
Getting started with CSS - Learn web development
raph. it contains an <em>emphasized</em> element.</p> <ul> <li>item one</li> <li>item two</li> <li>item <em>three</em></li> </ul> </body> </html> note: if you are reading this on a device or an environment where you can't easily create files, then don't worry — live code editors are provided below to allow you to write example code right here in the page.
adding css to our document the very first thing we need to do is to tell the html document that we have some css rules we want it to use. there are three different ways to apply css to an html document that you'll commonly come across, however, for now, we will look at the most usual and useful way of doing so — linking css from the head of your document. create a file in the same folder as your ...
...it to use. there are three different ways to apply css to an html document that you'll commonly come across, however, for now, we will look at the most usual and useful way of doing so — linking css from the head of your document. create a file in the same folder as your html document and save it as styles.css. the .css extension shows that this is a css file. ...
...the level one heading at the top of the document should now be red. ...
...And 13 more matches
Styling links - Learn web development
a:hover { } a:active { } this order is important because the link styles build on one another, for example the styles in the first rule will apply to all the subsequent ones, and when a link is being activated, it is also being hovered over. if you put these in the wrong order, things won't work properly. to remember the order, you could try using a mnemonic like love fears hate. ...
...lso being hovered over. if you put these in the wrong order, things won't work properly. to remember the order, you could try using a mnemonic like love fears hate. ...
...her gives us this result: so what did we do here? this certainly looks different to the default styling, but it still provides a familiar enough experience for users to know what's going on: the first two rules are not that interesting to this discussion. the third rule uses the a selector to get rid of the default text underline and focus outline (which varies across browsers anyway), and
adds a tiny amount of p
adding to each link — all of this will become clear later on. next, we use the a:link and a:visited selectors to set a couple of color variations on unvisited and visited links, so they are distinct. the next two rules use a:focus and a:hover to set focused and hovered links to have different background colors, plus an underline to make the link stand out even more. two poi...
...And 13 more matches
Deploying our app - Learn web development
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. ...
... 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. ...
...ode and push to github and the updated code will automatically trigger the entire build routine. if all is well, we get a live change deployed automatically. the only action we need to perform is that initial "push". however, we do have to set these steps up, and we'll look at that now. the build process again, because we're using parcel for development, the build option is extremely simple to
add. instead of running the server with npx parcel src/index.html, we can run it with npx parcel build src/index.html and parcel will build everything ready for production instead of just running it for development and testing purposes. this includes doing minification and tree-shaking of code, and cache-busting on filenames. the newly-created production code is placed in a new directory called dist...
...And 13 more matches
Profiling with the Firefox Profiler
mance panel. it can be used in a variety of situations where external profilers are not available, and can provide more information and insight into what the browser is doing. using the firefox profiler visit profiler.firefox.com to get started. it has instructions for enabling the profiler menu button, and getting going. there are also product docs available at profiler.firefox.com/docs/. in
addition to profiler.firefox.com, the firefox devtools have a simplified interface targeted towards web developers, but does not include as much information as the firefox profiler web app. it is available from the menu at tools > web developer > performance. understanding profiles the firefox profiler has more current documentation available at profiler.firefox.com/docs/. however the following co...
...aused by a page's js is to type its url into the "filter stacks" box. you can then select corresponding call tree entries and watch the timeline for entries in the content process main thread that get darker as you select call tree entries. tip: if things are blank elsewhere in the ui, you may have text entered 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...
...-2017 faq document. it's a good idea to search bugzilla before filing a bug about a performance problem in firefox but sometimes it's hard to find issues that have already been reported. therefore, it's usually a good idea to file a bug. ...
...And 13 more matches
Property attributes
the jsapi expresses property attributes as a value of type unsigned, the bitwise or of zero or more of the jsprop flags described below. an application can set property attributes when creating a property. see js_defineproperty, js_fs, and js_fn flag description jsprop_enumerate the property is visible to javascript for...in and for each ... ...
... higher, as in ecmascript, such attempts are ignored. this is the ecma standard dontdelete attribute. the javascript language does not provide any way for a script to delete a permanent property. mxr id search for jsprop_permanent jsprop_propop_accessors passed to js_define(uc)property* and js_defineelement if getters/setters are jspropertyop/jsstrictpropertyop
added in spidermonkey 38. mxr id search for jsprop_propop_accessors jsprop_getter the property's getter is a javascript function, not a c/c++ function. see js_defineproperty for details. mxr id search for jsprop_getter jsprop_setter the property's setter is a javascript function, not a c/c++ function. see js_defineproperty for details. mxr id s...
...d, the setter is called instead. if the property is also jsprop_permanent, then certain aspects of inheriting the property via the prototype chain are affected. do not depend on this. see bug 575997. mxr id search for jsprop_shared jsprop_index the property's id is represented internally as an integer, not a string. obsolete since jsapi 39 this flag has an
additional special meaning when used with js_defineproperty, js_fs, and other apis that define properties: it means that the name parameter is actually an integer unsafely cast to a pointer type, not a string. mxr id search for jsprop_index jsprop_define_late don't define property when initially creating the constructor. some objects like function/object have self-hosted fun...
...And 13 more matches
SpiderMonkey 1.8.7
ngs. 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. xxx is there anything here? these and other changes are explained in detail below. new javascript language features xxx needs updating javascript 1.8.5
adds support for ecmascript edition 5, including es5 strict mode. for details, see new in javascript 1.8.5. note that there are a very small number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8. these are discussed in annex e of the es5 specification. spidermonkey 1.8.5 also ships with js-ctypes, a foreign-function interfac...
... collector will scan the c stack and registers in your embedding, looking for bits that it can treat as potential gc roots. the approach eliminates the need for the js_enterlocalrootscope api, and in many cases the need to explicitly root gc things or use the "root as you go" approach popular with earlier spidermonkey releases. since this is a conservative collector, it will often find "garbage"
addresses which can trigger warnings from certain code analysis tools. if you are running valgrind on your embedding, be sure to build spidermonkey with the --enable-valgrind option to suppress superflous error messages triggered by the garbage collector. this also means that objects will be finalized in a non-deterministic order in spidermonkey 1.8.5. this is not a bug, and, any embedding which de...
... messages triggered by the garbage collector. this also means that objects will be finalized in a non-deterministic order in spidermonkey 1.8.5. this is not a bug, and, any embedding which depends upon deterministic finalization is fatally flawed. typed rooting api the rooting api has been changed from an error-prone void ** interface to an interface which accepts pointers to specific types. js_
addroot has been replaced by js_
addobjectroot, js_
addvalueroot and js_
addstringroot; similar changes were made for js_
addnamedroot and js_removeroot. since jsdoubles are now stored in the jsval, instead of on the heap, we no longer need to define roots for them. compartments spidermonkey 1.8.5 introduces the concept of compartments. a compartment is a global object, a context, and a set of related o...
...And 13 more matches
Places utilities for JavaScript
string wrapnode(nsinavhistoryresultnode anode, string atype, nsiuri aoverrideuri); array unwrapnodes(string blob, string atype); nsitransaction maketransaction(string data, string type, nsinavhistoryresultnode container, int index, boolean copy); nsinavhistoryresult getfoldercontents(int afolderid, boolean aexcludeitems, boolean aexpandqueries); boolean show
addbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showminimal
addbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean show
addlivemar...
...ring apostdata); boolean showminimal
addbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean show
addlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker); boolean showminimal
addlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker); boolean showminimal
addmultibookmarkui(array nsiuri aurilist); boolean showbookmarkproperties(int aid); boolean showfolderproperties(int aid); boolean show
addfolderui(string atitle, int adefaultinsertionpoint, boolean ashowpicker); ...
...rarchy. [optional] expandqueries true to make query items expand as new containers. for managing,you want this to be false, for menus and such, you want this to be true. return type returns a nsinavhistoryresult containing the contents of the folder. the result.root is guaranteed to be open. bookmark dialog methods to show the bookmarkproperties dialog in its various modes. ...
...And 13 more matches
An Overview of XPCOM
has established. this is the contractual agreement of this unencapsulated class: a set of rules that define when each method can be called and what it is expected to do. one rule might specify that dosomethinguseful may only be called after a call to init(). the dosomethinguseful method may do some kind of checking to ensure that the condition - that init has been called - has been satisfied. in
addition to writing well-commented code that tells the client developer the rules about init(), the developer can take a couple steps to make this contract even clearer. first, the construction of an object can be encapsulated, and a virtual class provided that defines the dosomethinguseful method. in this way, construction and initialization can be completely hidden from clients of the class. in thi...
...an interface and forgets to decrement the reference count. when this happens, interfaces may never be released and will leak memory. the system of reference counting is, like many things in xpcom, a contract between clients and implementations. it works when people agree to it, but when they don't, things can go wrong. it is the responsibility of the function that creates the interface pointer to
add the initial reference, or owning reference, to the count. pointers in xpcom in xpcom, pointers refer to interface pointers. the difference is a subtle one, since interface pointers and regular pointers are both just
addresses in memory. but an interface pointer is known to implement the nsisupports base interface, and so can be used to call methods such as
addref, release, or queryinterface. ...
...terface pointers and regular pointers are both just
addresses in memory. but an interface pointer is known to implement the nsisupports base interface, and so can be used to call methods such as
addref, release, or queryinterface. nsisupports, shown below, supplies the basic functionality for dealing with interface discovery and reference counting. the members of this interface, queryinterface,
addref, and release, provide the basic means for getting the right interface from an object, incrementing the reference count, and releasing objects once they are not being used, respectively. the nsisupports interface is shown below: the nsisupports interface class sample: public nsisupports { private: nsrefcnt mrefcnt; public: sample(); virtual ~sample(); ns_imethod queryinte...
...And 13 more matches
nsINavBookmarkObserver
inherits from: nsisupports last changed in gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18) method overview void onbeforeitemremoved(in long long aitemid, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid); obsolete since gecko 21.0 void onbeginupdatebatch(); void onendupdatebatch(); void onfolder
added(in print64 folder, in print64 parent, in print32 index); obsolete since gecko 1.9 void onfolderchanged(in print64 folder, in acstring property); obsolete since gecko 1.9 void onfoldermoved(in print64 folder, in print64 oldparent, in print32 oldindex, in print64 newparent, in print32 newindex); obsolete since gecko 1.9 void onfolderremoved(in print64 folder, in print64...
...e gecko 1.9 void onfolderchanged(in print64 folder, in acstring property); obsolete since gecko 1.9 void onfoldermoved(in print64 folder, in print64 oldparent, in print32 oldindex, in print64 newparent, in print32 newindex); obsolete since gecko 1.9 void onfolderremoved(in print64 folder, in print64 parent, in print32 index); obsolete since gecko 1.9 void onitem
added(in long long aitemid, in long long aparentid, in long aindex, in unsigned short aitemtype, in nsiuri auri, in autf8string atitle, in prtime adate
added, in acstring aguid, in acstring aparentguid); void onitemchanged(in long long aitemid, in acstring aproperty, in boolean aisannotationproperty, in autf8string anewvalue, in prtime alastmodified, in unsigned short aitemtype, in long long ...
... this method notifies this obs...
...And 13 more matches
Working with data
size of the array's data buffer is 20 bytes (5 entries, 4 bytes apiece). ...
...: creating an array of strings var cstr1 = ctypes.jschar.array()('rawr'); var cstr2 = ctypes.jschar.array()('boo'); var mycarray_ofstrings = ctypes.jschar.ptr.array(2)([cstr1, cstr2]); // specifying length of 2 is optional, can omit it, so can just do `ctypes.jschar.ptr.array()([cstr1, cstr2])` mycarray_ofstrings.
addressofelement(0).contents.readstring(); // outputs: "rawr" mycarray_ofstrings.
addressofelement(1).contents.readstring(); // outputs: "boo" example: creating an array of integers var jsarr = [4, 10]; var mycarr = ctypes.int.array(jsarr.length)(jsarr); // specifying length is optional, can omit. this will also work: `ctypes.int.array()(jsarr)` mycarr.
addressofelement(0).contents; // outputs: 4 mycarr.
addressofelement(1).contents; // outputs: 10 type casting you can type ...
...very much like a standard c type cast or c++ reinterpret_cast. example: cast an array this example shows how to cast an array of a certain type to another type. ...
...And 13 more matches
Using files from web applications - Web APIs
see using the dom file api in chrome code for details. accessing selected file(s) consider this html: <input type="file" id="input" multiple> the file api makes it possible to access a filelist containing file objects representing the files selected by the user. ...
...see using the dom file api in chrome code for details. accessing selected file(s) consider this html: <input type="file" id="input" multiple> the file api makes it possible to access a filelist containing file objects representing the files selected by the user. ...
...ted by the user. the multiple attribute on the input element allows the user to select multiple files. accessing the first selected file using a classical dom selector: const selectedfile = document.getelementbyid('input').files[0]; accessing selected file(s) on a change event it is also possible (but not mandatory) to access the filelist through the change event. ...
...And 13 more matches
HTML Drag and Drop API - Web APIs
the mouse button. a translucent representation of the draggable elements follows the pointer during the drag operation. for web sites, extensions, and xul applications, you can customize which elements can become draggable, the type of feedback the draggable elements produce, and the droppable elements. this overview of html drag and drop includes a description of the interfaces, basic steps to
add drag-and-drop support to an application, and an interoperability summary of the interfaces. drag events html drag-and-drop uses the dom event model and drag events inherited from mouse events. a typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element. during drag operations, several event types are f...
...ragevent, datatransfer, datatransferitem and datatransferitemlist. the dragevent interface has a constructor and one datatransfer property, which is a datatransfer object. datatransfer objects include the drag event's state, such as the type of drag being done (like copy or move), the drag's data (one or more items), and the mime type of each drag item. datatransfer objects also have methods to
add or remove items to the drag's data. the dragevent and datatransfer interfaces should be the only ones needed to
add html drag and drop capabilities to an application. (firefox supports some gecko-specific extensions to the datatransfer object, but those extensions will only work on firefox.) each datatransfer object contains an items property, which is a list of datatransferitem objects. a data...
... an items property, which is a list of datatransferitem objects. a datatransferitem object represents a single drag item, each with a kind property (either string or file) and a type property for the data item's mime type. the datatransferitem object also has methods to get the drag item's data. the datatransferitemlist object is a list of datatransferitem objects. the list object has methods to
add a drag item to the list, remove a drag item from the list, and clear the list of all drag items. a key difference between the datatransfer and datatransferitem interfaces is that the former uses the synchronous getdata() method to access a drag item's data, but the latter instead uses the asynchronous getasstring() method. note: dragevent and datatransfer are broadly supported on desktop browse...
...And 13 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
in
addition to the ability to place items accurately onto a created grid, the css grid layout specification contains rules that control what happens when you create a grid and do not place some or all of the child items. you can see auto-placement in action in the simplest of ways by creating a grid on a set of items. if you give the items no placement information they will position themselves on the grid, one in each grid cell. ...
... of ways by creating a grid on a set of items. if you give the items no placement information they will position themselves on the grid, one in each grid cell. ...
... <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> default rules for auto-placement as you can see with the above example, if you create a grid all child items will lay themselves out one into each grid cell. the default flow is to arrange items by row. grid will lay an item out into each cell of row 1. if you have created
additional rows using the grid-template-rows property then grid will continue placing items in these rows. if the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. sizing rows in the implicit grid the default for automatically created rows in the implicit grid is for them to be auto-sized. this means that they will contain the content a...
...And 13 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
auto-placement rules, one item in each of the first four cells. if you use the firefox grid highlighter you can see how the grid has defined columns and rows. ...
... the fourth row line. .box1 { grid-column-start: 1; grid-column-end: 2; grid-row-start: 1; grid-row-end: 4; } as you position some items, other items on the grid will continue to be laid out using the auto-placement rules. we will take a proper look at how these work in a later 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 prevent floats from rising up into the space we have left. * {box-sizing: border-box;} .wrapper { border...
...event floats from rising up into the space we have left. ...
...And 13 more matches
Communicating using "port" - Archive of obsolete content
this page is now obsolete, and its content has been incorporated into the main page on content scripts. to enable
add-on scripts and content scripts to communicate with each other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. ...
...nd content scripts to communicate with each other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. ...
... on(): listen to a message. removelistener(): stop listening to a message. once(): listen to only the first occurrence of a message. ...
...And 12 more matches
Getting Started (jpm) - Archive of obsolete content
the
add-on sdk includes a command-line tool that you use to initialize, run, test, and package
add-ons. the current tool is called jpm, and is based on node.js. it replaces the old cfx tool. you can use jpm from firefox 38 onwards. this article describes how to develop using jpm. this tutorial walks through creating a simple
add-on using the sdk. prerequisites to create
add-ons for firefox using the sdk, you'll need: firefox version 38 or later. if you need to work with earlier versions of firefox, you'll need to use the old cfx tool. see instructions for getting started with cfx. the command-line jpm tool. see the instructions for installing jpm. once you've done that, you'll be looking at a command prompt. install firefox developer version for testing your
add-on. initializin...
..., you'll need: firefox version 38 or later. if you need to work with earlier versions of firefox, you'll need to use the old cfx tool. see instructions for getting started with cfx. the command-line jpm tool. see the instructions for installing jpm. once you've done that, you'll be looking at a command prompt. install firefox developer version for testing your
add-on. initializing an empty
add-on in the command prompt, create a new directory. navigate to it, type jpm init, and hit enter: mkdir my-
addon cd my-
addon jpm init you'll then be asked to supply some information about your
add-on: this will be used to create your
add-on's package.json file. for now, just press enter to accept the default for each property. for more information on jpm init, see the jpm command reference. on...
...e information about your
add-on: this will be used to create your
add-on's package.json file. for now, just press enter to accept the default for each property. for more information on jpm init, see the jpm command 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 previous step. ...
...And 12 more matches
Getting started (cfx) - Archive of obsolete content
this tutorial walks through creating a simple
add-on using the cfx command-line tool. cfx has been deprecated and you should use jpm instead. use cfx only if you need to work with firefox 38 or earlier. see: getting started with jpm cfx to jpm prerequisites to create
add-ons for firefox using the sdk, you'll first need to follow the instructions to install and activate the sdk. once you've done that, you'll be looking at a command prompt. initializing an empty
add-on in the command prompt, create a new directory. the directory doesn't have to be under the sdk root: you can create it anywhere you like. ...
...
add-ons for firefox using the sdk, you'll first need to follow the instructions to install and activate the sdk. once you've done that, you'll be looking at a command prompt. initializing an empty
add-on in the command prompt, create a new directory. the directory doesn't have to be under the sdk root: you can create it anywhere you like. navigate to it, type cfx init, and hit enter: mkdir my-
addon cd my-
addon cfx init you'll see some output like this: * lib directory created * data directory created * test directory 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". ...
...r: mkdir my-
addon cd my-
addon cfx init you'll see some output like this: * lib directory created * data directory created * test directory 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 previous step. ...
...And 12 more matches
Localization - Archive of obsolete content
the sdk supports localization of strings appearing in: your main
add-on's javascript code html files packaged with your
add-on the title, description and homepage fields of your
add-on's metadata the title and description fields of your
add-on's preferences. it doesn't, yet, support localization of css or content scripts, or the
add-on's title and description that appear in the
add-ons manager. see limitations below. localized strings translated strings are kept in a directory called "locale" under your main
add-on directory, one file for each locale. the files: use the .properties format are named "xx-yy.properties", where "xx-yy" is the name of the locale in question contain one entry for each string you want to localize, consisting of an identifier for the string and its tr...
... "fr.properties" contains this: hello_id= bonjour ! now whenev...
...calize, consisting of an identifier for the string and its translation in that locale, in the format identifier=translation need to use utf-8 without bom encoding lines starting with "#" (after optional whitespace) are comments suppose your
add-on contains a single localizable string, represented in english as "hello!", and you want to supply us english and french french localizations. ...
...And 12 more matches
Miscellaneous - Archive of obsolete content
os x. ...
...= services.appinfo.os; detecting the host application and version // get the name of the application running us services.appinfo.name; // returns "firefox" for firefox services.appinfo.version; // returns "2.0.0.1" for firefox version 2.0.0.1 retrieving the version of an extension as specified in the extension's install.rdf components.utils.import("resource://gre/modules/
addonmanager.jsm");
addonmanager.get
addonbyid("extension-guid@example.org", function(
addon) { // this is an asynchronous callback function that might not be called immediately alert("my extension's version is " +
addon.version); }); restarting firefox/thunderbird/seamonkey_2.0 for firefox 3 see onwizardfinish around here: http://mxr.mozilla.org/seamonkey/sou...pdates.js#1639 for firefox 2 see around here: http:...
...a. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. ...
...And 12 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
reasons why you might want to include c++ components in your extension include: need for high-performance beyond what can be delivered by javascript code. ...
... use of third-party libraries written in c or c++. use of mozilla interfaces that are not exposed via xpcom (e.g. nspr). note: with the modern jit javascript engine in gecko and js-ctypes more extension code can be written only in javascript than ever before. please consider all of your options carefully before deciding to use native code (c++) in your extension. in
addition, binary components need to be recompiled for every major firefox release, which can be frustrating. this article describes how to set up the development environment for a large, complex firefox extension with any or all of the above-mentioned requirements. i should also stress that you do not have to build mozilla or use the mozilla build system if you want to create c++ components fo...
...ain directory with two subdirectories, public/ and src/. the main directory and each subdirectory must contain a makefile.in (from now on i'll just refer to this file as a makefile although we know that it is actually used to generate the real makefile). this makefile says two things. first of all, it lists the subdirectories that make up the extension, so the build system knows where to look for
additional makefiles. secondly, it instructs the build system to create a new extension, rather than copying the components directly into firefox's binary directory. the main advantage of using an extension is that it is easy to package everything up and install it on another machine. so here's your basic, plain-vanilla top-level makefile (makefile.in in the main extension directory): d...
...And 12 more matches
The Box Model - Archive of obsolete content
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. any xul interface can be broken down into the following basic components: boxes text images alignment and flexibility widths and heights margins and p
addings menus, toolbar buttons, and even the most complex elements in xul are composed of these simple ingredients. complex elements are created from simpler ones through xbl, which will be covered later on. once you grasp this simple idea, you'll be able to use the dom inspector and css to mold xul elements and layouts with great precision and flexibility. most of the examples shown in the rest o...
...e dom inspector and css to mold xul elements and layouts with great precision and flexibility. most of the examples shown in the rest of this section were generated using the xul box alignment example. we recommend you play around with it for a while to get an idea of how the basic parts of the box model work. in order to use this page, you'll need to install the remote xul manager extension and
add developer.mozilla.org to the whitelist. boxes a xul box is very similar to an html div. it's an invisible rectangular container with no styling at all (divs may have some default styling, though). their behavior is similar. however, one of the fundamental differences between xul and html has been the fact that xul boxes can be oriented vertically or horizontally (this behavior is being introduc...
... to bottom. a box is a generic version that you can orient as you please, but its default is horizontal orientation, so it's pretty much equivalent to an hbox and it is seldom used. here's a very simple example of an hbox with 3 child buttons: <hbox> <button label="cat" /> <button label="parrot" /> <button label="porcupine" /> </hbox> this is how it looks on mac os (the black border was
added for illustrative purposes, boxes don't have borders by default): if you use a vbox instead, it looks like this: the orientation of boxes (and most xul elements) can be controlled using the orient attribute or the -moz-box-orient css property. with these you can make an hbox have vertical orientation and viceversa, although that isn't very useful. the css property may be useful on some occ...
...And 12 more matches
Creating a Help Content Pack - Archive of obsolete content
to use to create help content. the previous 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 can be accessed using any xul application or program that embeds mozilla. what is a content pack? a content pack is a packaged set of files that describe help content. content packs include help ...
... and use only the actual file names without path when needed later. you don't actually need this attribute if you don't want it, but it's a useful shorthand to save typing. next, we need to describe where to find the glossary, index, and table of contents. (we're still not actually to the point where we're describing the actual data in each of these, so we'll just use some filler data for now.)
add the following code inside the rdf:description element you just created: <nc:panellist> <rdf:seq> </rdf:seq> </nc:panellist> you'll create the relevant information descriptions within the rdf:seq element. the location of each of the glossary, index, and table of contents data sources is stored in one rdf:description element contained within one rdf:li element, like...
...ta sources may only be available by searching through the loaded content pack. nc:datasources is a space-separated list of rdf datasources used in construction of the structure of referenced topics. generally, each item in the list will be a uri to an rdf file, but if you're more familiar with rdf you can also refer to a specific node within the rdf file using its rdf:id attribute. nc:platform (
added in mozilla 1.8b2/firefox 1.1) when present specifies the platforms to which the information stored in the referenced data sources applies. this attribute is useful when some of your help contents only apply to one specific platform. if this attribute is omitted, the information in the data sources applies to all platforms. the attribute is a space-separated list of platform strings. strings rec...
...And 12 more matches
Space Manager Detailed Design - Archive of obsolete content
esshell, nsiframe* aframe); ~nsspacemanager(); void* operator new(size_t asize); void operator delete(void* aptr, size_t asize); static void shutdown(); /* * get the frame that's associated with the space manager. this frame * created the space manager, and the world coordinate space is * relative to this frame. * * you can use queryinterface() on this frame to get any
additional * interfaces. */ nsiframe* getframe() const { return mframe; } /** * translate the current origin by the specified (dx, dy). this * creates a new local coordinate space relative to the current * coordinate space. */ void translate(nscoord adx, nscoord ady) { mx += adx; my += ady; } /** * returns the current translation from local coordinate space to * worl...
...pace * @return ns_ok if successful and ns_error_failure if the band data is not * not large enough. the 'count' member of the band data struct * indicates how large the array of trapezoids needs to be */ nsresult getbanddata(nscoord ayoffset, const nssize& amaxsize, nsbanddata& abanddata) const; /** *
add a rectangular region of unavailable space. the space is * relative to the local coordinate system. * * the region is tagged with a frame * * @param aframe the frame used to identify the region. must not be null * @param aunavailablespace the bounding rect of the unavailable space * @return ns_ok if successful * ns_error_failure if there is already a region ta...
...le space. the space is * relative to the local coordinate system. * * the region is tagged with a frame * * @param aframe the frame used to identify the region. must not be null * @param aunavailablespace the bounding rect of the unavailable space * @return ns_ok if successful * ns_error_failure if there is already a region tagged with aframe */ nsresult
addrectregion(nsiframe* aframe, const nsrect& aunavailablespace); /** * resize the rectangular region associated with aframe by the specified * deltas. the height change always applies to the bottom edge or the existing * rect. you specify whether the width change applies to the left or right edge * * returns ns_ok if successful, ns_error_invalid_arg if ...
...And 12 more matches
Arrays - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. ...
...d do the same thing to every value. maybe we've got a series of product items and their prices stored in an array, and we want to loop through them all and print them out on an invoice, while totaling all the prices together and printing out the total price at the bottom. if we 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 previous articles, let's learn about the real basics of arrays by entering some examples into browser developer console. cre...
...n array of any length, but in this case it stops looping at item number 7 (this is good, as the last item — which we want the loop to include — is item 6). for each item, print it out to the browser console with console.log(). some useful array methods in this section we'll look at some rather useful array-related methods that allow us to split strings into array items and vice versa, and
add new items into arrays. converting between strings and arrays often you'll be presented with some raw data contained in a big long string, and you might want to separate the useful items out into a more useful form and then do things to them, like display them in a data table. to do this, we can use the split() method. in its simplest form, this takes a single parameter, the character you want t...
...And 12 more matches
Communicating with frame scripts
cess 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 asynchronous message the frame script uses the global sendasyncmessage() function: // frame script sendasyncmessage("my-
addon@me.org:my-e10s-extension-message"); sendasyncmessage() takes one mandatory parameter, which is the name of the message. all messages share the same namespace, so to avoid conflicts with other code, you'll need to ensure that the names you use are unique. if you're using the message manager in an
add-on, a good way to do that is to prefix messages with your
add-on's id. after the name, you can...
...to prefix messages with your
add-on's id. after the name, you can pass detailed data as a string or a json-serializable object, and after that you can pass any objects it wants to pass to content as cpows. the example below sends a message named "my-e10s-extension-message", with a data payload containing details and tag properties, and exposes the event.target object as a cpow: // frame script
addeventlistener("click", function (event) { sendasyncmessage("my-
addon@me.org:my-e10s-extension-message", { details : "they clicked", tag : event.target.tagname }, { target : event.target }); }, false); to receive messages from content, a chrome script needs to
add a message listener using the message manager's
addmessagelistener() api. the message passed to the listener is ...
... data the json object passed as the second parameter to sendasyncmessage(). target the xul <browser> element from which this message was sent. ...
...And 12 more matches
NSS API Guidelines
e layering section explains how the nss code is layered, and how higher-level functions wrap low-level functions. the libraries section descibes the nss libraries, the functionality each provides, and the layer in which the library (mostly) operates. layering each separate component of the api should live in its own layer. the functions in these apis should never call api layers above them. in
addition, some low-level apis may be completely opaque to higher level layers. that is, access to these functions should only be provided by the api directly above them. the nss apis are layered, as shown in this diagram: the boxes in the gray section, towards the center, are exported only through pkcs #11. pkcs #11 is only exported through the wrappers. the areas which need the most work (both he...
...ectory 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 certdb library manipulates the certificate database (
add, create, delete certificates and crls). it also provides general certificate-handling routines (create a certificate, verify,
add/check certificate extensions). low cert lib/certdb cdbhdl.h, certdb.h, cert.h, certt.h certhi provides high-level certificate-related functions, that do not access the certificate database, nor individual certificate data directly. currently, ocsp ...
...alized (also known as camelcase). for example: layer_capitalizedenglishwords() or cert_destroycertificate(). data types and typdefs should have the form layerbody, with the same definitions for layer as public functions, and body in camel case english words. for example: layercapitalizedenglishwords or seckeyprivatekey. structures should have the same name as their typedefs, with the string str
added to the end. for example layercapitalizedenglishwordsstr or seckeyprivatekeystr. private functions should have the form layer_body(), where layer is the all lower case prefix for what layer the function lives in, and body is camel case english words. private functions include functions that may be "public" in a c sense, but are not exported out of the layer. for example: layer_capitalizedenglis...
...And 12 more matches
nsIMsgFolder
void delete(); void deletesubfolders(in nsisupportsarray folders, in nsimsgwindow msgwindow); void propagatedelete(in nsimsgfolder folder, in boolean deletestorage,in nsimsgwindow msgwindow); void recursivedelete(in boolean deletestorage, in nsimsgwindow msgwindow); void createsubfolder(in astring foldername, in nsimsgwindow msgwindow); nsimsgfolder
addsubfolder(in astring foldername); void createstorageifmissing(in nsiurllistener urllistener); void compact(in nsiurllistener alistener, in nsimsgwindow amsgwindow); void compactall(in nsiurllistener alistener, innsimsgwindow amsgwindow,in nsisupportsarray afolderarray, in boolean acompactofflinealso,in nsisupportsarray aofflinefolderarray); void compactallofflin...
... boolean testsemaphore(in nsisupports semholder); void getnewmessages(in nsimsgwindow awindow, in nsiurllistener alistener); void writetofoldercache(in nsimsgfoldercache foldercache, in boolean deep); long getnumnewmessages(in boolean deep); void setnumnewmessages(in long numnewmessages); acstring generatemessageuri(in nsmsgkey msgkey); void
addmessagedispositionstate(in nsimsgdbhdr amessage,in nsmsgdispositionstate adispositionflag); void markmessagesread(in nsisupportsarray messages, in boolean markread); void markallmessagesread(); void markmessagesflagged(in nsisupportsarray messages, in boolean markflagged); void markthreadread(in nsimsgthread thread); void setlabelformessages(in nsisuppo...
...dow); acstring getstringproperty(in string propertyname); void setstringproperty(in string propertyname, in acstring propertyvalue); boolean isancestorof(in nsimsgfolder folder); boolean containschildnamed(in astring name); nsimsgfolder getchildnamed(in astring aname); nsimsgfolder findsubfolder(in acstring escapedsubfoldername); void
addfolderlistener(in nsifolderlistener listener); void removefolderlistener(in nsifolderlistener listener); void notifypropertychanged(in nsiatom property, in acstring oldvalue, in acstring newvalue); void notifyintpropertychanged(in nsiatom property, in long oldvalue, in long newvalue); void notifyboolpropertychanged(in nsiatom property, in boolean oldvalue, in bo...
...And 12 more matches
nsIXULTemplateBuilder
esult interface and may be identified by an id which must be unique within a given set of query results. each query may be accompanied by one or more <rule> elements. these rules are evaluated by the template builder for each result produced by the query. a rule consists of conditions that cause a rule to be either accepted or rejected. the condition syntax allows for common conditional handling;
additional filtering may be applied by
adding a custom filter to a rule with the builder's
addrulefilter() method. if a result passes a rule's conditions, this is considered a match, and the content within the rule's <action> body is inserted as a sibling of the <template>, assuming the template builder creates real dom content. only one rule will match a result. for a tree builder, for example, the ...
...der creates real dom content. only one rule will match a result. for a tree builder, for example, the content within the action body is used to create the tree rows instead. a matching result must have its rulematched() method called. when a result no longer matches, 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 previous iteration's results as reference point to invoke the same queries. since the reference point is different, different output will ty...
... allowing the result objects from each iteration to be used directly as the reference points for the next iteration. when using multiple queries, each may generate results with the same id. more than one of these results may match one of the rules in their respective queries, however only the result for the earliest matching query in the template becomes the active match and generates output. the
addresult, removeresult, replaceresult and resultbindingchanged methods may be called by the query processor to indicate that the set of valid results has changed, such that a different query may match. if a different match would become active, the content for the existing match is removed and the content for the new match is generated. a query processor is not required to provide any support for upd...
...And 12 more matches
Using Web Workers - Web APIs
once created, a worker can send messages to the javascript code that created it by posting messages to an event handler specified by that code (and vice versa). this article provides a detailed introduction to using web workers. web workers api a worker is an object created using a constructor (e.g. ...
...by a dedicatedworkerglobalscope object in the case of dedicated workers (standard workers that are utilized by a single script; shared workers use sharedworkerglobalscope). a dedicated worker is only accessible from the script that first spawned it, whereas shared workers can be accessed from multiple scripts. note: see the web workers api landing page for reference documentation on workers and
additional guides. you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly manipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes avail...
...nd the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data attribute.) the data is copied rather than shared. workers may, in turn, spawn new workers, as long as those workers are hosted within the same origin as the parent page. in
addition, workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. dedicated workers as mentioned above, a dedicated worker is only accessible by the script that called it. in this section we'll discuss the javascript found in our basic dedicated worker example (run dedicated worker): this allows you to ente...
...And 12 more matches
ARIA: button role - Accessibility
this role can be used in combination with the aria-pressed attribute to create toggle buttons. ...
...ton role identifies an element as a button to screen readers. a button is a widget used to perform actions such as submitting a form, opening a dialog, cancelling an action, or performing a command such as inserting a new record or displaying information. a common convention to inform users a button will launch a dialog is to append "…" (ellipsis) to the button's label, e.g., "save as…". in
addition to the ordinary button widget, role="button" should be included when creating a toggle button or menu button using a non button element. a toggle button is a two-state button that can be either off (not pressed) or on (pressed). the aria-pressed attribute values of true or false identify a button as a toggle button. a menu button is a button that controls a menu and has an aria-haspopup prop...
...ed from the aria-label or aria-labelledby attributes. toggle buttons a toggle button typically has two states: pressed and not pressed. a third mixed state is available for toggle buttons that control other elements, such as other toggle buttons or checkboxes, which do not all share the same value. whether an element is a toggle button or not can be indicated with the aria-pressed attribute in
addition to the button role (if the element is not already a native button element): if aria-pressed is not used, or is set to the "undefined" state, the button is not a toggle button. if aria-pressed="false" is used the button is a toggle button that is currently not pressed. if aria-pressed="true" is used the button is a toggle button that is currently pressed. if aria-pressed="mixed" is use...
...And 12 more matches
Cross-browser audio basics - Developer guides
oying. plus browsers have policies that will block autoplay entirely in many situations. see the autoplay guide for media and web audio apis for details. loop the loop attribute will ensure that upon getting to the end of the audio clip, the audio clip will loop back to the beginning and start playing again. <audio loop> ... </audio> muted if you want the audio to start muted (no volume),
add the muted attribute. <audio muted> ... </audio> note: this value is often ignored on mobile platforms. preload the preload attribute allows you to specify a preference for how the browser preloads the audio, in other words, which part of the file it downloads when the <audio> element is initialized, and before the play button is pressed. preload can take 3 different values: none: don'...
...deo=false&file=audiofile.mp3" /> </object> </audio> note: you should be aware that flash and silverlight code require that the user has the appropriate plugin installed, and that the browser cannot guarantee the security aspects of code running on those plugin platforms. these are also deprecated, and soon won't work in any modern browsers. manipulating the audio element with javascript in
addition to being able to specify various attributes in html, the <audio> element comes complete with several properties and methods that you can manipulate via javascript. given the following html: <audio id="my-audio" src="audiofile.mp3"> ... </audio> you can grab the <audio> element like this: var myaudio = document.getelementbyid('my-audio'); alternatively, you can create a new element. ...
...f we want to show progress, buffering and only activate the buttons when the media is ready to play? fortunately, there are a number of events we can use to let our player know exactly what is happening. first, let's take a look at the media loading process in order: loadstart the loadstart event tells us simply that load process has started and the browser is connecting to the media. ...
...And 12 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
the use of color is a fundamental form of human expression. children experiment with color before they even have the manual dexterity to draw. maybe that's why color is one of the first things people often want to experiment with when learning to develop websites. with css, there are lots of ways to
add color to your html elements to create just the look you want. this article is a primer introducing each of the ways css color can be used in html. fortunately,
adding color to your html is actually really easy to do, and you can
add color to nearly anything. we're going to touch on most of what you'll need to know when using color, including a list of what you can color and what css properties are involved, how you describe colors, and how to actually use colors both in stylesheets and in s...
...eground color of an html element's content and the background-color property defines the element's background color. these can be used on just about any element. text whenever an element is rendered, these properties are used to determine the color of the text, its background, and any decorations on the text. color the color to use when drawing the text and any text decorations (such as the
addition of under- or overlines, strike-through lines, and so forth. background-color the text's background color. text-shadow configures a shadow effect to apply to text. among the options for the shadow is the shadow's base color (which is then blurred and blended with the background based on the other parameters). see text drop shadows in fundamental text and font styling to learn more. text-...
...en drawing text for east asian languages. caret-color the color to use when drawing the caret (sometimes referred to as the text input cursor) within the element. this is only useful in elements that are editable, such as <input> and <textarea> or elements whose html contenteditable attribute is set. boxes every element is a box with some sort of content, and has a background and a border in
addition to whatever contents the box may have. borders see the section borders for a list of the css properties you can use to set the colors of a box's borders. background-color the background color to use in areas of the element that have no foreground content. column-rule-color the color to use when drawing the line separating columns of text. outline-color the color to use when drawing...
...And 12 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
hat automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. if you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). however, this can be useful when creating media elements whose source will be set at a later time, under user control. see our autoplay guide for
additional information about how to properly use autoplay. controls if this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback. crossorigin this enumerated attribute indicates whether to use cors to fetch the related audio file. cors-enabled resources can be reused in the <canvas> element withou...
... 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), preventing 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, in seconds, of the audio. if the audio's metadata isn't available yet—thereby preventing you from knowing the media's start time or duration—currenttime instead indicates, and can be used to change, the time at which playback will begin. otherwise, ...
...fault controls are shown. the default controls have a display value of inline by default, and it is often a good idea set the value to block to improve control over positioning and layout, unless you want it to sit within a text block or similar. you can style the default controls with properties that affect the block as a single unit, so for example you can give it a border and border-radius, p
adding, margin, etc. you can't however style the individual components inside the audio player (e.g. change the button size or icons, change the font, etc.), and the controls are different across the different browsers. to get a consistent look and feel across browsers, you'll need to create custom controls; these can be marked up and styled in whatever way you want, and then javascript can be used ...
...And 12 more matches
<input type="time"> - HTML: Hypertext Markup Language
tep attribute), the format is always hh:mm:ss. you can learn more about the format of the time value used by this input type in time strings in date and time formats used in html. in this example, you can see the time input's value by entering a time and seeing how it changes afterward. first, a look at the html. ...
...tml. this is simple enough, with the label and input as we've seen before, but with the
addition of a <p> element with a <span> to display the value of the time input: <form> <label for="starttime">start time: </label> <input type="time" id="starttime"> <p> value of the <code>time</code> input: <code> "<span id="value">n/a</span>"</code>. </p> </form> the javascript code
adds code to the time input to watch for the input event, which is triggered every time the contents of an input element change. when this happens, the contents of the <span> are replaced with the new value of the input element. ...
.../a</span>"</code>. </p> </form> the javascript code
adds code to the time input to watch for the input event, which is triggered every time the contents of an input element change. when this happens, the contents of the <span> are replaced with the new value of the input element. var starttime = document.getelementbyid("starttime"); var valuespan = document.getelementbyid("value"); starttime.
addeventlistener("input", function() { valuespan.innertext = starttime.value; }, false); when a form including a time input is submitted, the value is encoded before being included in the form's data. ...
...And 12 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
n active in supporting browsers. <input type="date" name="date"/> html5 datetime-local a control for entering a date and time, with no time zone. opens a date picker or numeric wheels for date- and time-components when active in supporting browsers. <input type="datetime-local" name="datetime-local"/> html5 email a field for editing an email
address. looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards. <input type="email" name="email"/> html5 file a control that lets the user select a file. use the accept attribute to define the types of files that the control can select. <input type="file" accept="image/*, text/*" name="...
...it button. displays an image defined by the src attribute. the alt attribute displays if the image src is missing. <input type="image" name="image" src="" alt="image input"/> month a control for entering a month and year, with no time zone. <input type="month" name="month"/> html5 number a control for entering a number. displays a spinner and
adds default validation when supported. displays a numeric keypad in some devices with dynamic keypads. <input type="number" name="number"/> html5 password a single-line text field whose value is obscured. will alert user if site is not secure. <input type="password" name="password"/> radio a radio button, allowing a single value to be selected...
... attributes the <input> element is so powerful because of its attributes; the type attribute, described with examples above, being the most important. since every <input> element, regardless of type, is based on the htmlinputelement interface, they technically share the exact same set of attributes. however, in reality, most attributes have an effect on only a specific subset of input types. in
addition, the way some attributes impact an input depends on the input type, impacting different input types in different ways. this section provides a table listing all the attributes with a brief description. this table is followed by a list describing each attribute in greater detail, along with which input types they are associated with.those that are common to most or all input types are define...
...And 12 more matches
HTTP Index - HTTP
t, layout description, images, videos, scripts, and more 4 basics of http guide, http, overview http is a pretty extensible protocol. it relies on a few basic concepts like the notion of resources and uris, a simple structure of messages, and a client-server structure for the communication flow. on top of these basic concepts, numerous extensions have appeared over the years,
adding new functionality and new semantics by creating new http methods or headers. 5 choosing between www and non-www urls guide, http, url a recurring question among website owners is whether to choose non-www or www urls. this page provides some advice on what's best. 6 data urls base64, guide, http, intermediate, url data urls, urls prefixed with the data...
... connection management is a key topic in http: opening and maintaining connections largely impacts the performance of web sites and web applications. in http/1.x, there are several models: short-lived connections, persistent connections, and http pipelining. 16 content security policy (csp) csp, content security policy, reference, security content security policy (csp) is 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 to distribution of malware. 17 content negotiation content negotiation, content negotiation reference, http, reference in http, content negotiation is the mecha...
...p accept header for specific inputs and browser versions. 19 cross-origin resource policy (corp) http, reference, security cross-origin resource policy is an opt-in mechanism that allows web applications to protect against certain cross-origin requests, such as those issued by the browser when resources are embedded using elements such as <script> and <img>. 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 prevent some cross-origin reads by default. 20 cross-origin resource sharing (cors) ajax, cors, cross-origin resource...
...And 12 more matches
page-worker - Archive of obsolete content
u must create a new instance to load another page. you specify the page to load using the contenturl option to the page() constructor. this can point to a remote file: pageworker = require("sdk/page-worker").page({ contentscript: "console.log(document.body.innerhtml);", contenturl: "http://en.wikipedia.org/wiki/internet" }); it can also point to an html file which you've packaged with your
add-on. to do this, save the file in your
add-on's data directory and create the url using the data.url() method of the self module: pageworker = require("sdk/page-worker").page({ contentscript: "console.log(document.body.innerhtml);", contenturl: require("sdk/self").data.url("myfile.html") }); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html"). so you ca...
...are called "content scripts" because they're explicitly used for interacting with web content. you can specify one or more content scripts to load into the page using the contentscript or contentscriptfile options to the page() constructor. with contentscript you pass the script as a string, as in the examples above. ...
...e script as a string, as in the examples above. with contentscriptfile you pass a url which points to a script saved under your
add-on's data directory. you construct the url using the data.url() method of the self module. while content scripts can access dom content, they can't access any of the sdk apis, so in many cases you'll need to exchange messages between the content script and your main
add-on code for a complete solution. for example, the content script might read some content and send it back to the main
add-on, which could store it using the simple-storage api. ...
...And 11 more matches
Autodial for Windows NT - Archive of obsolete content
002 works and why it works that way. a brief history of autodial on windows in the consumer versions of windows, (windows 95, windows 98, windows me) autodial for all applications is controlled from the control panel, in the internet options applet, under the tab connections. if you turn on the autodial feature, windows will automatically dial whenever any application tries to access a network
address that can't be reached. technically, this control panel applet (internet options) is part of internet explorer. it is not present in early versions of windows until internet explorer is installed. despite this fact, the feature is triggered by any application that uses networking. starting with windows nt, and in all nt-based versions (windows nt, windows 2000, and windows xp, including xp hom...
...ture is triggered by any application that uses networking. starting with windows nt, and in all nt-based versions (windows nt, windows 2000, and windows xp, including xp home) microsoft has changed the behavior of autodial. for these oss, the autodial options found in the internet options control panel applet only apply to microsoft applications, including internet explorer and outlook. microsoft
added a windows system service (remote access auto connection) to handle autodial for all other applications. if this service is running, and control panel | network connections | advanced | dialup preferences is set to enable autodial, then any application trying to access the internet will trigger the autodial feature whenever an internet
address cannot be reached. however, this service will won't ...
...dle autodial for all other applications. if this service is running, and control panel | network connections | advanced | dialup preferences is set to enable autodial, then any application trying to access the internet will trigger the autodial feature whenever an internet
address cannot be reached. however, this service will won't function if you have a lan card installed, unless that particular
address has been accessed in the past via a dialup connection. origin of the bug before the implementation of the autodial helper feature, mozilla would trigger the autodial feature on nt-based operating systems, but only if certain conditions are met. these conditions are as follows: the autodial service is running control panel | network connections | advanced | dialup preferences | enable au...
...And 11 more matches
Modifying a XUL Interface - Archive of obsolete content
the dom provides various functions to modify the document. 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. ...
...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. for example, the following will
add a button to a xul window: example 1 : source view <script> function
addbutton(){ var abox = document.getelementbyid("abox"); var button = document.createelement("button"); button.setattribute("label","a new button"); abox.appendchild(button); } </script> <box id="abox" width="200"> <button label="
add" oncommand="
addbutton();"/> </box> this example has two parts a box container element in xul. notice that this is not the same as a vbox or an ...
...n xul. notice that this is not the same as a vbox or an hbox. (this is discussed more in the box model pages.) the box element has two attributes "id" and "width". the box element contains a button element. the button element has two attributes "label" and "oncommand" a javascript function named "
addbutton()" this script first gets a reference to the box with getelementbyid(), which is the container to
add a new button to. the function getelementbyid() does not know that the box it is looking for happens to be containing the tag that has the oncommand attribute that referenced it. getelementbyid() only knows the box it is looking to find has an id with the value "abox". thi...
...And 11 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
rtificate identifies someone or something a certificate is an electronic document used to identify an individual, a server, a company, or some other entity and to associate that identity with a public key. like a driver's license, a passport, or other commonly used personal ids, a certificate provides generally recognized proof of a person's identity. public-key cryptography uses certificates to
address the problem of impersonation. to get a driver's license, you typically apply to a government agency, such as the department of motor vehicles, which verifies your identity, your ability to drive, your
address, and other information before issuing the license. to get a student id, you apply to a school or college, which performs different checks (such as whether you have paid your tuition) be...
... certificates work much the same way as any of these familiar forms of identification. certificate authorities (cas) are entities that validate identities and issue certificates. ...
...ms 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 prevent 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 information. most importantly, a certificate always includes the digital signature of the issuing ca. the ca's digital signature allows the certificate to function as a "letter of introduction" for users who know a...
...And 11 more matches
Building up a basic demo with PlayCanvas editor - Game development
or button we'll launch the online playcanvas editor where we'll create our scene with the shapes. do this now. creating the scene here's how the scene looks initially in the editor. even though it's a blank new project we don't have to start entirely from scratch — the camera and directional light are prepared already, so you don't have to worry about them. now onto the creative part. to
add an entity to the scene you have to click on the big plus button located in the top left area of the editor, next to the hierarchy text. when hovering over that button with your mouse the label will say '
add entity' — that's exactly what we want to do. an entity is any object used in the scene — it cna be an object like a box, cylinder or cone, but it can also be a camera, light or sound sourc...
...ing over that button with your mouse the label will say '
add entity' — that's exactly what we want to do. an entity is any object used in the scene — it cna be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. after clicking the button you'll see a dropdown list containing a lot of various entities to choose from. go ahead and click box — it will be
added to the scene. the box is created with the default values — width, height and depth are set to 1, and it is placed in the middle of the scene. you can drag it around or apply new values in the right panel. to
add some colors to the scene we need a new material that will be used on the newly created box. click on the plus button in the assets tab, and click on the material option in the d...
... button in the assets tab, and click on the material option in the dropdown list that appears to create a new material. click on your new material in the assets tab and its entity inspector will appear on the right hand side of the display. now edit the name text field to give it a unique name (we've chosen boxmaterial). a unique name will help us remember what this material is for — we will
add more later! to change its color we'll use the diffuse option in the entity inspector. click diffuse, then select the colored box next to the color label — it will open a color wheel. from here you can click your desired color or enter it in the bottom text field as a hex value. we've chosen a blue color with a hex value of 0095dd — enter this code in the text field and press return for it ...
...And 11 more matches
WAI-ARIA basics - Learn web development
previous overview: accessibility next following on from the previous 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 accessiblity. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of the previous 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. wh...
...appear. for example, html5 introduced a number of semantic elements to define common page features (<nav>, <footer>, etc.) before these were available, developers would simply use <div>s with ids or classes, e.g. <div class="nav">, but these were problematic, as there was no easy way to easily find a specific page feature such as the main navigation programmatically. the initial solution was to
add one or more hidden links at the top of the page to link to the navigation (or whatever else), for example: <a href="#hidden" class="hidden">skip to navigation</a> but this is still not very precise, and can only be used when the screenreader is reading from the top of the page. as another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosi...
...ed using javascript. the problem here is that visually they work, but screenreaders can't make any sense of what they are 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 wherever 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="c...
...And 11 more matches
Sending forms through JavaScript - Learn web development
{ urlencodeddatapairs.push( encodeuricomponent( name ) + '=' + encodeuricomponent( data[name] ) ); } // combine the pairs into a single string and replace all %-encoded spaces to // the '+' character; matches the behaviour of browser form submissions. ...
...nd replace all %-encoded spaces to // the '+' character; matches the behaviour of browser form submissions. ...
... ); // define what happens on successful data submission xhr.
addeventlistener( 'load', function(event) { alert( 'yeah! data sent and response loaded.' ); } ); // define what happens in case of error xhr.
addeventlistener( 'error', function(event) { alert( 'oops! ...
...And 11 more matches
JavaScript basics - Learn web development
it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. ...
...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. with more experience, you'll be able to create games, animated 2d and 3d graphics, comprehensive database-driven apps, and much more! javascript itself is relatively compact, yet very flexible. ...
...ures too. have fun! a hello world! example javascript is one of the most popular modern web technologies! as your javascript skills grow, your websites will enter a new dimension of power and creativity. however, getting comfortable with javascript is more challenging than getting comfortable with html and css. you may have to start small, and progress gradually. to begin, let's examine how to
add javascript to your page for creating a hello world! example. (hello world! is the standard for introductory programming examples.) important: if you haven't been following along with the rest of our course, download this example code and use it as a starting point. go to your test site and create a new folder named scripts. within the scripts folder, create a new file called main.js, and sa...
...And 11 more matches
Getting started with HTML - Learn web development
0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.
addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.
addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution...
...show solution'; updatecode(); }); solution.
addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; 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.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = tex...
...le, the class attribute is an identifying name used to target the element with style information. an attribute should have: a space between it and the element name. (for an element with more than one attribute, the attributes should be separated by spaces too.) the attribute name, followed by an equal sign. an attribute value, wrapped with opening and closing quote marks. active learning:
adding attributes to an element another example of an element is <a>. this stands for anchor. an anchor can make the text it encloses into a hyperlink. anchors can take a number of attributes, but several are as follows: href: this attribute's value specifies the web
address for the link. for example: href="https://www.mozilla.org/". title: the title attribute specifies extra information about t...
...And 11 more matches
Graceful asynchronous programming with Promises - Learn web development
esolved with the mediastream once it's available. the code that the video chat application would use might look something like this: function handlecallbutton(evt) { setstatusmessage("calling..."); navigator.mediadevices.getusermedia({video: true, audio: true}) .then(chatstream => { selfviewelem.srcobject = chatstream; chatstream.gettracks().foreach(track => mypeerconnection.
addtrack(track, chatstream)); setstatusmessage("connected"); }).catch(err => { setstatusmessage("failed to connect"); }); } this function starts by using a function called setstatusmessage() to update a status display with the message "calling...", indicating that a call is being attempted. it then calls getusermedia(), asking for a stream that has both video and audio tracks, t...
...tarts by using a function called setstatusmessage() to update a status display with the message "calling...", indicating that a call is being attempted. it then calls getusermedia(), asking for a stream that has both video and audio tracks, then once that's been obtained, sets up a video element to show the stream coming from the camera as a "self view," then takes each of the stream's tracks and
adds them to the webrtc rtcpeerconnection representing a connection to another user. after that, the status display is updated to say "connected". if getusermedia() fails, the catch block runs. this uses setstatusmessage() to update the status box to indicate that an error occurred. the important thing here is that the getusermedia() call returns almost immediately, even if the camera stream hasn't...
...urther improvements with async/await syntax, which we'll dig into in the next article. at their most basic, promises are similar to event listeners, but with a few differences: a promise can only succeed or fail once. it cannot succeed or fail twice and it cannot switch from success to failure or vice versa once the operation has completed. if a promise has succeeded or failed and you later
add a success/failure callback, the correct callback will be called, even though the event took place earlier. explaining basic promise syntax: a real example promises are important to understand because most modern web apis use them for functions that perform potentially lengthy tasks. to use modern web technologies you'll need to use promises. later on in the chapter, we'll look at how to write ...
...And 11 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
lly if the timeout callback is more than a few lines of code. settimeout() returns 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 previous 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 t...
...e css animations to run this kind of simple animation. however, this kind of example is very useful to demonstrate requestanimationframe() usage, and you'd be more likely to use this kind of technique when doing something more complex such as updating the display of a game on each frame. grab a basic html template (such as this one). put an empty <div> element inside the <body>, then
add a ↻ character inside it. this circular arrow character will act as our spinner for this example. apply the following css to the html template (in whatever way you prefer). this sets a red background on the page, sets the <body> height to 100% of the <html> height, and centers the <div> inside the <body>, horizontally and vertically. html { background-color: white; height: 100%; } ...
...ariable to null, which will later be used to store the start time of the requestanimationframe(). const spinner = document.queryselector('div'); let rotatecount = 0; let starttime = null; let raf; below the previous code, insert a draw() function that will be used to contain our animation code, which includes the timestamp parameter: function draw(timestamp) { } inside draw(),
add the following lines. they will define the start time if it is not defined already (this will only happen on the first loop iteration), and set the rotatecount to a value to rotate the spinner by (the current timestamp, take the starting timestamp, divided by three so it doesn't go too fast): if (!starttime) { starttime = timestamp; } rotatecount = (timestamp - starttime) / 3; ...
...And 11 more matches
Making decisions in your code — conditionals - Learn web development
nt to set the shoppingdone variable to true if the child did the shopping. note: you can see a more complete version of this example on github (also see it running live.) else if the last example provided us with two choices, or outcomes — but what if we want more than two? there is a way to chain on extra choices/outcomes to your if...else — using else if. each extra choice requires an
additional block to put in between if() { ... } and else { ... } — check out the following more involved example, which could be part of a simple weather forecast application: <label for="weather">select the weather type today: </label> <select id="weather"> <option value="">--make a choice--</option> <option value="sunny">sunny</option> <option value="rainy">rainy</option> <option value="...
...wear shorts! go to the beach, or the park, and get an ice cream.'; } else if (choice === 'rainy') { para.textcontent = 'rain is falling outside; take a rain coat and an umbrella, and don\'t stay out for too long.
...ercast') { para.textcontent = 'it isn\'t raining, but the sky is grey and gloomy; it could turn any minute, so take a rain coat just in case.'; } else { para.textcontent = ''; } } here we've got an html <select> element allowing us to make different weather choices, and a simple paragraph. in the javascript, we are storing a reference to both the <select> and <p> elements, and
adding an event listener to the <select> element so that when its value is changed, the setweather() function is run. when this function is run, we first set a variable called choice to the current value selected in the <select> element. we then use a conditional statement to show different text inside the paragraph depending on what the value of choice is. notice how all the conditions are tested i...
...And 11 more matches
Performance best practices for Firefox front-end engineers
ng of background tasks api, and doing it only when we have a free second where presumably the user isn’t doing something. see also the blog post collective scheduling with requestidlecallback. as of bug 1353206, you can also schedule idle events in non-dom contexts by using services.tm.idledispatchtomainthread. see the nsithreadmanager.idl file for more details. hide your panels if you’re
adding a new xul <xul:popup> or <xul:panel> to a document, set the hidden attribute to true by default. by doing so, you cause the binding applied on demand rather than at load time, which makes initial construction of the xul document faster. get familiar with the pipeline that gets pixels to the screen learn how pixels you draw make their way to the screen. knowing the path they will take through...
...hat are style flushes? when css is applied to a document (html or xul, it doesn’t matter), the browser does calculations to figure out which css styles will apply to each element. this happens the first time the page loads and the css is initially applied, but can happen again if javascript modifies the dom. javascript code might, for example, change dom node attributes (either directly or by
adding or removing classes from elements), and can also
add, remove, or delete dom nodes. because styles are normally scoped to the entire document, the cost of doing these style calculations is proportional to the number of dom nodes in the document (and the number of styles being applied). it is expected that over time, script will update the dom, requiring us to recalculate styles. normally, the ...
...as the consumer of this api to not accidentally write to the dom within the promisedocumentflushed callback. doing so might cause flushes to occur for other promisedocumentflushed callbacks that are scheduled to fire in the same tick of the refresh driver. bug 1441168 tracks work to make it impossible to modify the dom within a promisedocumentflushed callback. writing tests to ensure you don’t
add more synchronous style flushes unlike reflow, there isn’t a “observer” mechanism for style recalculations. however, as of firefox 49, the nsidomwindowutils.elementsrestyled attribute records a count of how many style calculations have occurred for a particular dom window. it should be possible to write a test that gets the nsidomwindowutils for a browser window, records the number of styl...
...And 11 more matches
UpdateListener
an updatelistener receives messages from an update check for a single
add-on, though it is possible to pass the same updatelistener to as many calls to findupdates() as you like. for each individual update check, the following methods will be called on the listener: either oncompatibilityupdateavailable() or onnocompatibilityupdateavailable(), depending on whether compatibility information for the requested application version was seen. either onupdateavailable() or onnoupdateavailable(), depending on whether a newer version of the
addon was found. onupdatefinished() to signal that the update check has completed. ...
...pdateavailable() or onnocompatibilityupdateavailable(), depending on whether compatibility information for the requested application version was seen. either onupdateavailable() or onnoupdateavailable(), depending on whether a newer version of the
addon was found. onupdatefinished() to signal that the update check has completed. ...
...vailable() or onnocompatibilityupdateavailable(), depending on whether compatibility information for the requested application version was seen. either onupdateavailable() or onnoupdateavailable(), depending on whether a newer version of the
addon was found. onupdatefinished() to signal that the update check has completed. ...
...And 11 more matches
WebRequest.jsm
the webrequest module is new in firefox 41. the webrequest module provides an api to
add event listeners for the various stages of making an http request. the event listener receives detailed information about the request, and can modify or cancel the request. you can use this api to implement a content policy in an
add-on (for example, an ad or script blocker), as you could using nsicontentpolicy. more generally, you can also use this api instead of http request observers. you can use webrequest.jsm in either the chrome or content processes. the webrequest api is modeled on chrome's webrequest extension api, which makes it easier to write cross-browser
add-on code. there are some differences between this api and chrome's, though: see chrome incompatibilities for the details. us...
...it takes one mandatory argument and two optional arguments, as detailed below. name type description callback function the callback argument is a function to be called when the event is triggered. it's pass...
...rce://gre/modules/webrequest.jsm", {}); the webrequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onbeforerequest onbeforesendheaders onsendheaders onheadersreceived onresponsestarted oncompleted each of these objects defines two functions:
addlistener(callback, filter, opt_extrainfospec) removelistener(callback)
adding listeners use
addlistener to
add a listener to a particular event. it takes one mandatory argument and two optional arguments, as detailed below. name type description callback function the callback argument is a function to be called when the event is triggered. it's passed an object whose structure will vary depending on the event you're listenin...
...And 11 more matches
NSS Tools crlutil
taining one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create,
add to a database, modify, or validate. bracket the nickname string with quotation marks if it contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. ...
...syntax: crl generation script file has the following syntax: line with comments should have <bold>#</bold> as a first symbol of a line set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
... line with comments should have <bold>#</bold> as a first symbol of a line set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...And 11 more matches
Building the WebLock UI
een building a component that can be installed in any gecko application. 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. specifically, the user interface we create in this chapter will be overlaid into the statusbar of the browser component, ...
...t be made available to the javascript in the form of the weblock object being used in the snippets above. as you can see, weblock is initialized as a global javascript variable, available in the scope of these functions and others: var weblock = components.classes["@dougt/weblock"] .getservice() .queryinterface(components.interfaces.iweblock); in
addition to this basic setup, you must also write javascript that uses the
addsite method to
add new sites to the white list. this is a bit more complicated, because it requires that you work with the currently loaded page or provide other ui (e.g., a textfield where you can enter an arbitrary url) for specifying urls. in the xul section we'll go into how the user interface is defined. this section d...
...s is a bit more complicated, because it requires that you work with the currently loaded page or provide other ui (e.g., a textfield where you can enter an arbitrary url) for specifying urls. in the xul section we'll go into how the user interface is defined. this section describes the functions that are called from the interface and how they interact with the weblock component. ...
...And 11 more matches
Setting HTTP request headers
http is one of the core technologies behind the web. in
addition to the actual content, some important information is passed with http headers for both http requests and responses. you can
add your own http headers to any request the application makes, whether the request is initiated by your code explicitly opening an http channel, because of xmlhttprequest activity, an <img> element in content, or even from css. http channels when you deal with http requests and responses, typically you are doing this with an nsihttpchannel. the nsihttpchannel interface has a number of properties and methods, but the method that is of interest to us is setrequestheader. this method allows us to set an http request header. ...
...img> element in content, or even from css. http channels when you deal with http requests and responses, typically you are doing this with an nsihttpchannel. the nsihttpchannel interface has a number of properties and methods, but the method that is of interest to us is setrequestheader. this method allows us to set an http request header. below is some sample code where we set an http header. //
adds "x-hello: world" header to the request httpchannel.setrequestheader("x-hello", "world", false); in the example code above we have a variable named httpchannel which points to an object implementing nsihttpchannel. (this variable could have been named anything though.) the setrequestheader method takes 3 parameters. the first parameter is the name of the http request header. the second parameter...
...ts to an object implementing nsihttpchannel. (this variable could have been named anything though.) the setrequestheader method takes 3 parameters. the first parameter is the name of the http request header. the second parameter is the value of the http request header. and for now, just ignore the third parameter, and just always make it false. ...
...And 11 more matches
ctypes.open
at the heart of js-ctypes is the ctypes.open() function. this must be called before any work can commence. there are two options: custom native file (dll, so, dylib, etc.) standard os libraries custom native file for this method, a native file must be created. a native file for use on unix systems is an so file, which is created and a c function called
add() is written. int
add(int a, int b) { return a + b; } to make this a shared library, a native file which can be loaded and used from js-ctypes, compile it with these commands: gcc -fpic -c mycfuntionsforunix.c gcc -shared -o mycfuntionsforunix.so mycfuntionsforunix.o a file named mycfuntionsforunix.so is successfully created. this native file can be placed in any folder of an
addon and then loaded from js-ctypes. they can al...
... be loaded and used from js-ctypes, compile it with these commands: gcc -fpic -c mycfuntionsforunix.c gcc -shared -o mycfuntionsforunix.so mycfuntionsforunix.o a file named mycfuntionsforunix.so is successfully created. this native file can be placed in any folder of an
addon and then loaded from js-ctypes. they can also be loaded from the system library path. loading the native file if your
addon is restartless, you must set it to be unpacked. ...
...sforunix.so mycfuntionsforunix.o a file named mycfuntionsforunix.so is successfully created. this native file can be placed in any folder of an
addon and then loaded from js-ctypes. they can also be loaded from the system library path. loading the native file if your
addon is restartless, you must set it to be unpacked. see: http://stackoverflow.com/questions/19382201/how-to-load-dll-from-sdk-
addon-data-folder it is important to note that custom native files cannot be loaded through chrome:// or resource:// uris. they must be accessed through a local file path (file://) or a jar path (jar:). if the
addon is an unpacked
addon, such as bootstrap or
add-on sdk
addons, the jar path must be used. therefore, the path has to be converted and then the converted path is used for loading with cty...
...And 11 more matches
Background Tasks API - Web APIs
ally by the user agent when it determines that there is free time to do so. concepts and usage the main thread of a web browser is centered around its event loop. this code draws any pending updates to the document currently being displayed, runs any javascript code the page needs to run, accepts events from input devices, and dispatches those events to the elements that should receive them. in
addition, the event loop handles interactions with the operating system, updates to the browser's own user interface, and so forth. it's an extremely busy chunk of code, and your main javascript code may run right inside this thread 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 ch...
...ack() is much simpler: window.cancelidlecallback = window.cancelidlecallback || function(id) { cleartimeout(id); } if cancelidlecallback() isn't defined, this creates one which simply passes the specified callback id through to cleartimeout(). now your code will work even on browsers that don't support the background tasks api, albeit not as efficiently. interfaces the background tasks api
adds only one new interface: idledeadline an object of this type is passed to the idle callback to provide an estimate of how long the idle period is expected to last, as well as whether or not the callback is running because its timeout period has expired. the window interface is also augmented by this api to offer the new requestidlecallback() and cancelidlecallback() methods. example in th...
...st, as well as whether or not the callback is running because its timeout period has expired. the window interface is also augmented by this api to offer the new requestidlecallback() and cancelidlecallback() methods. example in this example, we'll take a look at how you can use requestidlecallback() to run time-consuming, low-priority tasks during time the browser would otherwise be idle. in
addition, this example demonstrates how to schedule updates to the document content using requestanimationframe(). below you'll find only the html and javascript for this example. the css is not shown, since it's not particularly crucial to understanding this functionality. html content in order to be oriented about what we're trying to accomplish, let's have a look at the html. this establishes a...
...And 11 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
ion 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 prevented. 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 logic. negotiation is an inherently asymme...
...ting that difference out into independent negotiation logic, so that your application doesn't need to care which end of the connection it is. as far as your application is concerned, it makes no difference whether you're calling out or receiving a call. 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 prevent collisions with incoming offers. a polite peer, essentially, is one which may send out offers, but then responds if an offer arrives from the ot...
... server. your own code, of course, can use any signaling technique you like. note that this code is identical for both peers involved in the connection. create the signaling and peer connections first, the signaling channel needs to be opened and the rtcpeerconnection needs to be created. the stun server listed here is obviously not a real one; you'll need to replace stun.myserver.tld with the
address of a real stun server. const constraints = { audio: true, video: true }; const config = { iceservers: [{ urls: "stun:stun.mystunserver.tld" }] }; const selfvideo = document.queryselector("video.selfview"); const remotevideo = document.queryselector("video.remoteview"); const signaler = new signalingchannel(); const pc = new rtcpeerconnection(config); this code also gets the <video> ele...
...And 11 more matches
SVG documentation index - SVG: Scalable Vector Graphics
in this example, we use xhtml, svg, javascript, and the dom to animate a swarm of "motes". these motes are governed by two simple principles. first, each mote tries to move towards the mouse cursor, and second each mote tries to move away from the average mote position. combined, we get this very natural-looking behavior. 8 other resources reference, svg here is a list of
additional resources on svg: 9 project svg no summary! 10 replaced element svg this page was auto-generated because a user created a sub-page to this page. 11 svg 1.1 support in firefox firefox, svg you can find some basic examples of svg syntax and usage in the w3c svg test suite. 12 svg 2 support in mozilla firefox, svg ...
...19 accent-height deprecated, needsexample, svg, svg attribute the accent-height attribute defines the distance from the origin to the top of accent characters, measured by a distance within the font coordinate system. 20 accumulate needscompattable, needsexample, svg, svg attribute this attribute controls whether or not the animation is cumulative. 21
additive needscompattable, needsexample, svg, svg attribute no summary! 22 alignment-baseline svg, svg attribute the alignment-baseline attribute specifies how an object is aligned with respect to its parent. this property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. for example, this allows alphabetic baseline...
...vg attribute the begin attribute defines when an animation should begin or when an element should be discarded. 35 bias filters, needsexample, svg, svg attribute the bias attribute shifts the range of the filter. after applying the kernelmatrix of the <feconvolvematrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is
added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. 36 by svg, svg attribute the by attribute specifies a relative offset value for an attribute that will be modified during an animation. 37 calcmode needscompattable, needsexample, svg, svg attribute the calcmode attribute specifies the interpolation mode f...
...And 11 more matches
passwords - Archive of obsolete content
usage a credential is the set of information a user supplies to authenticate herself with a service. typically a credential consists of a username and a password. using this module you can: search for credentials which have been stored in the password manager. you can then use the credentials to access their related service (for example, by logging into a web site). store credentials in the password manager. you can store different sorts of credentials, as outlined in the "credentials" section below. remove stored credentials from the password manager. credentials in this api, credentials are represented by objects. ...
...y objects. you create credential objects to pass into the api, and the api also returns credential objects to you. the sections below explain both the properties you should define on credential objects and the properties you can expect on credential objects returned by the api. all credential objects include username and password properties. different sorts of stored credentials include various
additional properties, as outlined in this section. you can use the passwords api with three sorts of credentials:
add-on credentials html form credentials http authentication credentials
add-on credential these are associated with your
add-on rather than a particular web site. they contain the following properties: username the username. password the password...
...d in this section. you can use the passwords api with three sorts of credentials:
add-on credentials html form credentials http authentication credentials
add-on credential these are associated with your
add-on rather than a particular web site. they contain the following properties: username the username. password the password. url for an
add-on credential, this property is of the form:
addon:<
addon-id>, where <
addon-id> is the
add-on's program id. you don't supply this value when storing an
add-on credential: it is automatically generated for you. however, you can use it to work out which stored credentials belong to your
add-on by comparing it with the uri property of the self module. realm you can us...
...And 10 more matches
ui/button/action - Archive of obsolete content
experimental
add a button to the firefox user interface. with this module you can create buttons that display icons and can respond to click events. usage creating buttons to create a button you must give it an id, an icon, and a label: var { actionbutton } = require("sdk/ui/button/action"); var button = actionbutton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: function(state) { console.log("button '" + state.label + "' was clicked"); } }); by default, the button appears in the firefox toolbar: however, users can move it to the firefox menu panel using the toolbar customization feature: badged buttons new in firefox 36. ...
... button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: function(state) { console.log("button '" + state.label + "' was clicked"); } }); by default, the button appears in the firefox toolbar: however, users can move it to the firefox menu panel using the toolbar customization feature: badged buttons new in firefox 36. you can
add a "badge" to a button using its badge property. this can be a number or a string, and you can update it at any time. by default the badge's color is red, but you can set your own color using the badgecolor property, specified as a css <color> value: var { togglebutton } = require("sdk/ui/button/toggle"); var button = togglebutton({ id: "my-button1", label: "my button1", icon: "./ico...
...utton is in the toolbar and the large icon when the button is in the menu panel. read more about specifying icons in the reference documentation for the actionbutton constructor. responding to click events you can respond to click events by assigning a listener to the button's click event. you can do this in the button's constructor, by assigning the listener to the onclick option. ...
...And 10 more matches
ui/button/toggle - Archive of obsolete content
with this module you can create buttons that function like a check box, representing an on/off choice. toggle buttons have all the same features as action buttons: they can display icons and respond to click events. like action buttons, you can control their state on a per-window or per-tab basis as well as globally. toggle buttons have two extra features: they emit a change event when clicked, as well as a click event. they have an extra attribute checked that is automatically toggled when the button is clicked. when a button is checked it gets a "pressed" look in the user interface (note that the "pressed" look currently does not work in mac os x). ...
... id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onchange: function(state) { console.log(state.label + " checked state: " + state.checked); } }); by default, the button appears in the firefox toolbar: however, users can move it to the firefox menu panel: badged buttons new in firefox 36. you can
add a "badge" to a button using its badge property. this can contain a number or a string, and you can update it at any time. by default the badge's color is red, but you can set your own color using the badgecolor property, specified as a css <color> value: var { togglebutton } = require("sdk/ui/button/toggle"); var button = togglebutton({ id: "my-button1", label: "my button1", icon: "...
... and the large icon when the button is in the menu panel. read more about specifying icons in the reference documentation for the togglebutton constructor. responding to click events you can respond to click events by assigning a listener to the button's click or change events. you can do this in the button's constructor, by assigning the listener to the onclick or onchange option. ...
...And 10 more matches
Chapter 1: Introduction to Extensions - Archive of obsolete content
ticated tools to assist with web design. but we didn't set out to create an all-in-one browser that can satisfy everyone. instead, firefox can support these features through extensions. the core browser is limited to basic features, so it’s something that a beginner can be comfortable with, but users who want something beyond that can install extensions. ...
...h web design. but we didn't set out to create an all-in-one browser that can satisfy everyone. instead, firefox can support these features through extensions. the core browser is limited to basic features, so it’s something that a beginner can be comfortable with, but users who want something beyond that can install extensions. ...
... firefox can support these features through extensions. the core browser is limited to basic features, so it’s something that a beginner can be comfortable with, but users who want something beyond that can install extensions. about extensions management using the
add-ons manager firefox's
add-ons manager is an excellent way to manage extensions, and is a great step up in ease of use. ...
...And 10 more matches
Handling Preferences - Archive of obsolete content
files are used: default preferences: these are stored in the directory defaults/pref in the firefox installation directory. current preferences: these are stored in the profile directory with the name prefs.js. this is where the user's settings are stored. this file is updated when preferences are modified by the user. user preferences: the file user.js in the user's profile directory holds
additional preferences the user has set. this file is never written to by firefox, but you may wish to set preferences manually in this file to override other settings. lockfile settings: these preferences are stored in a file that usually has the name mozilla.cfg or netscape.cfg. the file may be located on a network. it is intended to be used by an administrator or isp to set settings centrally. in...
...tional preferences the user has set. this file is never written to by firefox, but you may wish to set preferences manually in this file to override other settings. lockfile settings: these preferences are stored in a file that usually has the name mozilla.cfg or netscape.cfg. the file may be located on a network. it is intended to be used by an administrator or isp to set settings centrally. in
addition, certain preferences may be locked such that users cannot change them. locked preferences are disabled in the preferences window. firefox exposes its most common high-level preferences through the preferences window and other parts of its ui. in reality there are thousands of other preferences firefox handles that are not readily available to the user. these are hidden because they are too...
...ferences. 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 can be seen in this page. you don't need to know them by heart; if doin...
...And 10 more matches
Intercepting Page Loads - Archive of obsolete content
t 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. ...
...ds. 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. read the recommendations in appendix a regarding performance if you're planning on implementing any of these. the easy way: load events this comes from the tabbrowser code snippets page. in a nutshell, from the chrome code in the overlay we
add an event listener for the load event. this._loadhandler = function() {that._onpageload(); }; gbrowser.
addeventlistener("load", this._loadhandler, true); gbrowser is a global object that corresponds to the tabbrowser element in the main browser window. it is full of useful functions, so you should always keep it in mind when you want to handle tabs and web content windows. attaching the load e...
... nsitraceablechannel to get and modify the response text before it gets to the original requester. you won't be able to make dom modifications like with the load events, since these notifications are triggered before the response arrives and is parsed into dom tree, so this is not the best approach for the typical greasemonkey-style extensions. 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 previous 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 accoun...
...And 10 more matches
Index of archived content - Archive of obsolete content
.htaccess ( hypertext access ) 2015 mdn fellowship program api navigator navigator.moznotification
add-ons
add-on sdk builder guides content scripts communicating with other scripts communicating using "port" communicating using "postmessage" cross-domain content scripts interacting with page scripts loading content scripts reddit example port self ...
...ce content processes getting started modules private properties firefox compatibility module structure of the sdk porting the library detector program id sdk api lifecycle sdk and xul comparison testing the
add-on sdk two types of scripts working with events xul migration guide high-level apis
addon-page base64 clipboard context-menu hotkeys indexed-db l10n notifications p...
... util/uuid window/utils release notes tools cfx cfx to jpm console jpm jpm-mobile jpmignore package.json tutorials
add a context menu item
add a menu item to firefox
adding a button to the toolbar annotator creating annotations displaying annotations implementing the widget overview storing annotations chrome authorit...
...And 10 more matches
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. ...
... 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. ...
... 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. ...
...And 10 more matches
Extensions - Archive of obsolete content
this can be done by overlaying the popup to append the item to. ...
...this can be done by overlaying the popup to append the item to. ...
...this can be done by overlaying the popup to append the item to. ...
...And 10 more matches
XUL Questions and Answers - Archive of obsolete content
jects. he said the code will be open-source, but it is not released yet (as of oct 2006). some teasers are on his blog. overlaying elements without ids the original developers only tend to put ids where they need them. as an extension author, you have at least two options: use dom methods to dynamically create or rearrange elements file an enhancement request in bugzilla to have extra ids
added. displaying graphics and animation in xul? there are several options for displaying graphics and animation in xul: <html:canvas> svg <xul:image> (static images or animated gif; support for apng is planned) plugins templates with non-rdf datasources? support for non-rdf datasources for xul template is planned (bug 321170): xml datasources (bug 321171) storage (sqlite) datasou...
...with the correct type. using the "icon" attribute on a button from xulplanet.com reference: this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be used in place of the image attribute. possible values include: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print,
add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. if you are using a button that matches one of these common usages, use the icon attribute to indicate this. how to use dynamic objects in toolbar there may be a few ways to implement this: by building your menupopup from an rdf datasource, which could be generated on the server. by getting data (e.g. j...
...ample of tab browswer in xul how can i get uris on open tabs? using the following code sample, // get browsers object var browsers=document.getelementbyid('content').browsers; var numbrowsers=browsers.length; for (var i=0; numbrowsers>i; i++) { var thisuri=browsers[i].currenturi.spec; // do something with it. } the person can get the titles too using the .contenttitle tag. how to
add and remove values to/from, set up inside a <prefwindow> container to handle the preference? <prefwindow> can contain any control, just like a regular window. some of them can be tied to a preference so that the preference is automatically updated as the control is manipulated. others, like <listbox>, cannot be so tied, but one can always write a script that updates preferences explicitly, via ns...
...And 10 more matches
tabbrowser - Archive of obsolete content
onbookmarkgroup, onnewtab, tabmodalpromptshowing properties browsers, cangoback, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, securityui, selectedbrowser, selectedtab, sessionhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webprogress methods
addprogresslistener,
addtab,
addtabsprogresslistener,appendgroup, getbrowseratindex, getbrowserindexfordocument, getbrowserfordocument, getbrowserfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loadonetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadalltabs, reloadtab, ...
...cted tab, which will always be one of the tab elements in the tabs element. assign a value to this property to modify the currently selected tab. sessionhistory type: nsishistory this read-only property contains the nsishistory object which holds the session history. tabcontainer type: tabs element returns the tabs element that contains the tabs. this is useful for
add-ons that need to use events related to tabs in the browser window. tabs type: array a nodelist containing the tab objects for each tab in the tabbrowser. this is a shortcut for looking at the tabs in the tabcontainer. visibletabs type: array an array containing tab objects for each visible tab in the tabbrowser. this lets you determine which tabs are visible in the current tab set. ...
... the document. most of its methods are callable directly on the element itself, such as goback and goforward. it also contains the load constants used by reloadwithflags and loaduriwithflags. webprogress type: nsiwebprogress this read-only property contains an nsiwebprogress object which is used to monitor the progress of a document loading. ...
...And 10 more matches
Index - Game development
d when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28). to see the difference, toggle javascript.options.parallel_parsing in about:config. 26 audio for web games audio, games, web audio api, audio sprites, spatialization, syncing tracks audio is an important part of any game; it
adds feedback and atmosphere. web-based audio is maturing fast, but there are still many browser differences to navigate. we often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as w...
... 32 desktop mouse and keyboard controls controls, desktop, games, javascript, keyboard, mouse ok, we've dealt with touch, keyboard and mouse controls. now let's move on to look at how to set up the game to be controlled using a console gamepad, using the gamepad api. 33 mobile touch controls controls, games, javascript, mobile, pointer, touch that covers
adding touch controls for mobile; in the next article we'll see how to
add keyboard and mouse support. 34 unconventional controls controls, doppler, games, javascript, makey makey, proximity, tv leap motion, voice 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. 35 tiles and t...
...bounce off the walls 2d, beginner, canvas, games, javascript, phaser, tutorial, bouncing now that physics have been introduced, we can start implementing collision detection into the game — first we'll look at the walls. ...
...And 10 more matches
Extra lives - Game development
« previousnext » this is the 13th 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/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. defining the new text labels defining...
...les 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. defining the new text labels defining the texts look like something we already did in the score lesson. ...
...ill 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. defining the new text labels defining the texts look like something we already did in the score lesson. ...
...And 10 more matches
CSS property compatibility table for form controls - Learn web development
border partial[1][2] yes webkit browsers (mostly on mac osx and ios) use the native look & feel for the search fields. therefore, it's required to use -webkit-appearance:none to be able to apply this property to search fields. on windows 7, internet explorer 9 does not apply the border unless background:none is applied. margin yes yes p
adding partial[1][2] yes webkit browsers (mostly on mac osx and ios) use the native look & feel for the search fields. therefore, it's required to use -webkit-appearance:none to be able to apply this property to search fields. on windows 7, internet explorer 9 does not apply the border unless background:none is applied. text and font color[1] ...
... buttons see the button, submit, and reset input types and the <button> element. property n t note css box model width yes yes height partial[1] yes this property is not applied on webkit based browsers on mac osx or ios. border partial yes margin yes yes p
adding partial[1] yes this property is not applied on webkit based browsers on mac osx or ios. text and font color yes yes font yes yes see the note about line-height. letter-spacing yes yes text-align no no text-decoration partial yes text-indent yes ...
...e the value of the field, with the spinners on safari being outside the field. property n t note css box model width yes yes height partial[1] partial[1] on opera, the spinners are zoomed in, which can hide the content of the field. border yes yes margin yes yes p
adding partial[1] partial[1] on opera, the spinners are zoomed in, which can hide the content of the field. text and font color yes yes font yes yes see the note about line-height. letter-spacing yes yes text-align yes yes text-decoration partial partial tex...
...And 10 more matches
Styling web forms - Learn web development
tting 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. why is styling form widgets challenging? form controls were
added to html in the html 2 specification in 1995; css wasn't released until late 1996, and wasn't supported very well by browsers for a few years after that. browsers relied on the underlying operating system to manage and render form controls. and even with css available to style html, browser vendors have historically been reluctant to make form controls stylable because users were so accustomed ...
...s and text css font and text features can be used easily with any widget (and yes, you can use @font-face with form widgets). however, browser behavior is often inconsistent. by default, some widgets do not inherit font-family and font-size from their parents. many browsers use the system default appearance instead. to make your forms' appearance consistent with the rest of your content, you can
add the following rules to your stylesheet: button, input, select, textarea { font-family: inherit; font-size: 100%; } the inherit property value causes the property value to match the computed value of the property of its parent element; inheriting the value of the parent. the screenshots below show the difference. on the left is the default rendering of an <input type="text">, <input type="d...
...utton> elements over their equivalent input types! there's a lot of debate as to whether forms look better using the system default styles, or customized styles designed to match your content. this decision is yours to make, as the designer of your site, or web application. ...
...And 10 more matches
Creating hyperlinks - Learn web development
mplement 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. hyperlinks allow us to link documents to other documents or resources, link to specific parts of documents, or make apps available at a web
address. almost any web content can be converted to a link so that when clicked or otherwise activated the web browser goes to another web
address (url). note: a url can point to html files, text files, images, text documents, video and audio files, or anything else that lives on the web. if the web browser doesn't know how to display or handle the file, it will ask you if you want to open the file...
...any links that point not only to multiple news stories, but also different areas of the site (navigation functionality), login/registration pages (user tools), and more. ...
...link a basic link is created by wrapping the text or other content, see block level links, inside an <a> element and using the href attribute, also known as a hypertext reference, or target, that contains the web
address. <p>i'm creating a link to <a href="https://www.mozilla.org/">the mozilla homepage</a>. </p> this gives us the following result: i'm creating a link to the mozilla homepage.
adding supporting information with the title attribute another attribute you may want to
add to your links is title. the title contains
additional information about the link, such as which kind of information the page contains, or things to 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 ...
...And 10 more matches
Images in HTML - Learn web development
there are other types of multimedia to consider, but it is logical to start with the humble <img> element, used to embed a simple image in a webpage. ...
...> and so on. note: search engines also read image filenames and count them towards seo. therefore, you should give your image a descriptive filename; dinosaur.jpg is better than img835.png. you could embed the image using its absolute url, for example: <img src="https://www.example.com/images/dinosaur.jpg"> but this is pointless, as it just makes the browser do more work, looking up the ip
address from the dns server all over again, etc. you'll almost always keep the images for your website on the same server as your html. warning: most images are copyrighted. do not display an image on your webpage unless: you own the image. you have received explicit, written permission from the image owner. you have ample proof that the image is, in fact, in the public domain. copyright v...
... etc. you'll almost always keep the images for your website on the same server as your html. warning: most images are copyrighted. do not display an image on your webpage unless: you own the image. you have received explicit, written permission from the image owner. you have ample proof that the image is, in fact, in the public domain. copyright violations are illegal and unethical. in
addition, never point your src attribute at an image hosted on someone else's website that you don't have permission to link to. this is called "hotlinking". again, stealing someone's bandwidth is illegal. it also slows down your page, leaving you with no control over whether the image is removed or replaced with something embarrassing. our above code would give us the following result: note: e...
...And 10 more matches
HTML table advanced features and accessibility - Learn web development
advanced features of html tables — such as captions/summaries and grouping your rows into table head, body and footer sections — as well as looking at the accessibility of tables for visually impaired users. 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> ... </table> as you can infer from the brief example above, the caption is meant to contain a description of the ta...
...eater detail. a caption is placed directly 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 previous 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 time...
...ting an example we first met in the previous 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).
adding structure with <thead>, <tfoot>, and <tbody> as your tables get a bit more complex in structure, it is useful to give them more structural definition. one clear way to do this is by using <thead>, <tfoot>, and <tbody>, which allow you to mark up a header, footer, and body section for the table. these elements don't make the table any more accessible to screenreader users, and don't result in...
...And 10 more matches
Accessibility in React - Learn web development
usion for both keyboard-only and screenreader users. 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. or, at least: they can do all of these things with a mouse. unfortunately, these features are not very accessible to keyboard-only users. let's explore this now. exploring the keyboard usability problem start by clicking on the input at the top of our a...
...heck tasks, delete tasks, or edit task names. and they can filter their task list by all, active, or completed tasks. or, at least: they can do all of these things with a mouse. unfortunately, these features are not very accessible to keyboard-only users. let's explore this now. exploring the keyboard usability problem start by clicking on the input at the top of our app, as if you're going to
add a new task. you'll see a thick, dashed outline around that input. this outline is your visual indicator that the browser is currently focused on this element. press the tab key, and you will see the outline appear around the "
add" button beneath the input. this shows you that the browser's focus has moved. press tab a few more times, and you will see this dashed focus indicator move between each...
...two new constants beneath the hooks in your todo() function. each should be a ref – one for the "edit" button in the view template and one for the edit field in the editing template. const editfieldref = useref(null); const editbuttonref = useref(null); these refs have a default value of null because they will not have value until we attach them to their respective elements. to do that, we'll
add an attribute of ref to each element, and set their values to the appropriately named ref objects. the textbox <input> in your editing template should be updated like this: <input id={props.id} classname="todo-text" type="text" value={newname} onchange={handlechange} ref={editfieldref} /> the "edit" button in your view template should read like this: <button type="button" class...
...And 10 more matches
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. ...
...e can at least implement an edittask() function in app.js. it’ll be similar to deletetask() because it'll take an id to find its target object, but it'll also take a newname property containing the name to update the task to. we'll use array.prototype.map() instead of array.prototype.filter() because we want to return a new array with some changes, instead of deleting something from the array. ...
...e refactoring. a ui for editing in order to allow users to edit a task, we have to provide a user interface for them to do so. first, import usestate into the todo component like we did before with the app component, by updating the first import statement to this: import react, { usestate } from "react"; we'll now use this to set an isediting state, the default state of which should be false. ...
...And 10 more matches
Beginning our React todo list - Learn web development
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. ...
... 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/. ...
... objective: to introduce our todo list case study, and get the basic app structure and styling in place. our app's user stories in software development, a user story is an actionable goal from the perspective of the user. defining user stories before we begin our work will help us focus our work. our app should fulfill the following stories: as a user, i can read a list of tasks.
add a task using the mouse or keyboard. mark any task as completed, using the mouse or keyboard. delete any task, using the mouse or keyboard. edit any task, using the mouse or keyboard. view a specific subset of tasks: all tasks, only the active task, or only the completed tasks. we'll tackle these stories one-by-one. pre-project housekeeping create-react-app has made a few files we won't be...
...And 10 more matches
Focus management with Vue refs - Learn web development
reat experience for non-mouse users. specifically, when a user activates the "edit" button, we remove the "edit" button from the dom, but we don't move the user's focus anywhere, so in effect it just disappears. this can be disorienting for keyboard and non-visual users. to understand what's currently happening: reload your page, then press tab. ...
... the "edit" button, we remove the "edit" button from the dom, but we don't move the user's focus anywhere, so in effect it just disappears. this can be disorienting for keyboard and non-visual users. to understand what's currently happening: reload your page, then press tab. you should see a focus outline on the input for
adding new to-do items. press tab again. the focus should move to the "
add" button. hit it again, and it'll be on the first checkbox. one more time, and focus should be on the first "edit" button. activate the "edit" button by pressing enter. the checkbox will be replaced with our edit component, but the focus outline will be gone. this behavior can be jarring. in
addition, what happens when you press tab again varies depending on the browser you're using. similarly...
...we'll also want to put focus back on the "edit" button when a user cancels or saves their edit. ...
...And 10 more matches
Understanding client-side JavaScript frameworks - Learn web development
we will say hello to react. 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. 2. beginning our react todo list let's say that we’ve been tasked with creating a proof-of-concept in react – an app that allows users to
add, edit, and delete tasks they want to work on, and also mark tasks as complete without deleting them. 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. 3. componentizing our react app at this point, our app is a monolith. before we can make it do things, we need to...
...vity: events and state with our component plan worked out, it's now time to start updating our app from a completely static ui to one that actually allows us to interact and change things. in this article we'll do this, digging into events and state along the way. 5. react interactivity: editing, filtering, conditional rendering as we near the end of our react journey (for now at least), we'll
add the finishing touches to the main areas of functionality in our todo list app. 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. 6. accessibility in react in our final tutorial article, we'll focus on (pun intended) accessibility, including focus management in reac...
...further in your learning. ember tutorials note: ember tutorials last tested in may 2020, with ember/ember cli version 3.18.0. if you need to check your code against our version, you can find a finished version of the sample ember app code in the ember-todomvc-tutorial repository. for a running live version, see https://nullvoxpopuli.github.io/ember-todomvc-tutorial/ (this also includes a few
additional features not covered in the tutorial). 1. getting started with ember in our first ember article we will look at how ember works and what it's useful for, install the ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. 2. ember app structure and componentization in this article we'll get right on with planning out the structur...
...And 10 more matches
Package management basics - Learn web development
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 contains all the javascript for your software — typically compressed as much as possible to help reduce the time it takes to get your software downloaded and displayed in your visitors’ browser. in
addition, what happens if you find a better tool that you want to use instead of the current one, or a new version of your dependency is released that you want to update to? this is not too painful for a couple of dependencies, but in larger projects with many dependencies this kind of thing can become really challenging to keep track of. it makes more sense to use a package manager such as npm, as t...
...tter tool that you want to use instead of the current one, or a new version of your dependency is released that you want to update to? this is not too painful for a couple of dependencies, but in larger projects with many dependencies this kind of thing can become really challenging to keep track of. it makes more sense to use a package manager such as npm, as this will guarantee that the code is
added and removed cleanly, as well as a host of other advantages. what exactly is a package manager? we've met npm already, but stepping back from npm itself, a package manager is a system that will manage your project dependencies. the package manager will provide a method to install new dependencies (also referred to as "packages"), manage where packages are stored on your file system, and offer...
...m in the correct locations in your project. writing the code to include the package(s) in your application (this tends to be done using javascript modules, another subject that is worth reading up on and understanding). doing the same thing for all of the packages' sub-dependencies, 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 previous article, dependencies can be installed globally or locally to your project. although there tend to be more pr...
...And 10 more matches
Chrome registration
ntent area. toolbars, menu bars, progress bars, and window title bars are all examples of elements that are typically part of the chrome. mozilla locates and reads the root chrome.manifest file for extensions and themes. note: with gecko 1.9.2 and older, mozilla reads chrome/*.manifest files from applications. starting with gecko 2.0, the root chrome.manifest is the only manifest used; you can
add manifest commands to that file to load secondary manifests. chrome providers a supplier of chrome for a given window type (e.g., for the browser window) is called a chrome provider. the providers work together to supply a complete set of chrome for a particular window, from the images on the toolbar buttons to the files that describe the text, content, and appearance of the window itself. the...
...iases 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 preventing 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. there may be chrome registration lines which only apply to one particular application. the flag application=app-id indicates that the instruction should only be applied if the...
...=app-id indicates that the instruction should only be applied if the extension is installed into the application identified by app-id. multiple application flags may be included on a single line, in which case the line is applied if any of the flags match. ...
...And 10 more matches
Localization content best practices
ozilla products, you might want to read our localization quick start guide for information on localizing mozilla code. note on localizers mozilla localizers are volunteers with very diverse technical skills: some of them rely exclusively on translation tools, others prefer to work directly with text editors and don't have problems working with vcs systems. it's important to consider this when
adding strings, and especially localization comments for strings that contain references, or obscure technical details. localization files choose good key ids the ids (names) chosen for your keys, regardless of the file format, should always be descriptive of the string, and its role in the interface (button label, title, etc.). think of them as long variable names. when you have to change a key i...
... strings, and especially localization comments for strings that contain references, or obscure technical details. localization files choose good key ids the ids (names) chosen for your keys, regardless of the file format, should always be descriptive of the string, and its role in the interface (button label, title, etc.). think of them as long variable names. when you have to change a key id,
adding a progressive number to the existing key should always be used as a last resort. for example, suppose this string needs to be changed from "event" to "
add new event": new-event-header = event
add-new-event-header is definitely a better choice for the new string than new-event-header1. if a string is tied to an accesskey or a tooltip, use string ids that highlight this relation: neweventbtn...
...gressive number to the existing key should always be used as a last resort. for example, suppose this string needs to be changed from "event" to "
add new event": new-event-header = event
add-new-event-header is definitely a better choice for the new string than new-event-header1. if a string is tied to an accesskey or a tooltip, use string ids that highlight this relation: neweventbtn.label =
add event neweventbtn.accesskey = a neweventbtn.tooltip =
add a new event don't duplicate ids if you're
adding new strings, check that you're not duplicating an existing id. depending on the parser logic, one of these two translations will be ignored. ...
...And 10 more matches
DMD
rly enabled, the "save" button won't be grayed out. look at the "trigger" section below to see the full list of ways to get a dmd report once you have it activated. note that stack information you get will likely be less detailed, due to being unable to symbolicate. you will be able to get function names, but not line numbers. desktop firefox (linux) build build firefox with these options: ac_
add_options --enable-dmd if building via try server, modify browser/config/mozconfigs/linux64/common-opt or a similar file before pushing. launch use mach run --dmd; use --mode to choose the mode.
add --debug to run under gdb. trigger there are three ways to trigger a dmd snapshot. visit about:memory and click the dmd button (depending on how old your build is, it might be labelled "save" or...
...tack frame table... dmd[5222] } in an e10s-enabled build, you'll see separate output for each process. this step can take 10 or more seconds and may make firefox freeze temporarily. if you see the "opened" line, it tells you where the file was saved. it's always in a temp directory, and the filenames are always of the form dmd-<pid>. ...
...pened" line, it tells you where the file was saved. it's always in a temp directory, and the filenames are always of the form dmd-<pid>. desktop firefox (mac) build build with these options: ac_
add_options --enable-dmd if building via try server, modify browser/config/mozconfigs/macosx64/common-opt or a similar file before pushing. launch use mach run --dmd; use --mode to choose the mode.
add --debug to run under lldb. trigger follow the trigger instructions for linux. note that on mac this step can take 30+ seconds. ...
...And 10 more matches
nsINavBookmarksService
s from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: @mozilla.org/browser/nav-bookmarks-service;1. ...
... obsolete since gecko 2.0 long long getfolderidforitem(in long long aitemid); boolean getfolderreadonly(in long long aitemid); astring getfoldertitle(in print64 folder); obsolete since gecko 1.9 nsiuri getfolderuri(in print64 folder); obsolete since gecko 1.9 long long getidforitemat(in long long aparentid, in long aindex); prtime getitemdate
added(in long long aitemid); astring getitemguid(in long long aitemid); obsolete since gecko 14.0 long long getitemidforguid(in astring aguid); obsolete since gecko 14.0 long getitemindex(in long long aitemid); prtime getitemlastmodified(in long long aitemid); autf8string getitemtitle(in long long aitemid); unsigned short getitemtype(in long ...
... void replaceitem(in print64 folder, in nsiuri item, in nsiuri newitem); obsolete since gecko 1.9 void runinbatchmode(in nsinavhistorybatchcallback acallback, in nsisupports auserdata); void setfolderreadonly(in long long afolder, in boolean areadonly); void setfoldertitle(in print64 folder, in astring title); obsolete since gecko 1.9 void setitemdate
added(in long long aitemid, in prtime adate
added); void setitemguid(in long long aitemid, in astring aguid); obsolete since gecko 14.0 void setitemindex(in long long aitemid, in long anewindex); void setitemlastmodified(in long long aitemid, in prtime alastmodified); void setitemtitle(in long long aitemid, in autf8string atitle); void setkeywordforbook...
...And 10 more matches
MailNews fakeserver
s largely based off of the httpd fakeserver from network code. it utilizes utf-8 as its transport mechanism and is capable of performing proper pipelining of commands. the other two components are specific to the protocol type and found under similar files in the same directory (e.g., smtpd.js). a daemon is information about the server that can be manipulated. an example of such a manipulation is
adding a folder or
adding messages. daemons should usually persist for the entirety of the test. the handler is the glue between the server and the daemon. this area will be the most diverse of all components, as edge cases with quirky servers being liberal with the specs will require different handlers. writing a new fakeserver since the number of protocols we use is very small, most people should...
...othing called when in multi-line mode. postcommand server object none called after every command. the server is smart about the responses and will normalize all occurrences of '\n' (but not '\r') to '\r\n' for you, as well as append the '\r\n' to the response if not present. it will also properly queue all messages sent in pipelining mode and will present lines without any eol characters. in
addition, it uses utf-8 as the transmission medium. the server presents the following api to the handler: <caption> server api </caption> name arguments returns description closesocket none nothing closes the socket and stops the test. setmultiline the new value of multiline nothing the value is a boolean, with true invoking multiline mode. it is off by default. extending a handler to provi...
... debugging is set to "none" by default. specific fakeserver guidelines pop imap smtp nntp nntpd.js defines a few different classes of nntp servers: compliance for rfc 977, rfc 2980, and rfc 3977, as well as a giganews and an inn server. (full 2980 and 3977 compliance as well as inn is not yet written). ...
...And 10 more matches
Mozilla
a bird's-eye view of the mozilla framework the purpose of this article is to provide a high-level technical overview of the architecture of the extensible, object-based mozilla application framework. accessibility and mozilla accessibility is the idea that software (among other things) should be designed to be usable and, as much as possible, convenient to use for people with disabilities. ...
...ed mozilla application framework. accessibility and mozilla accessibility is the idea that software (among other things) should be designed to be usable and, as much as possible, convenient to use for people with disabilities. mozilla strives to make its software accessible; the documents below cover the ways in which we do so.
add-ons
add-ons allow developers to extend and modify the functionality of firefox.
adding a new css property this page describes how to
add a new css property to the style system. the style system is the part of the code in gecko that is responsible for producing a computed value for every property for every element. see the gecko overview fo...
...functionality of firefox.
adding a new css property this page describes how to
add a new css property to the style system. the style system is the part of the code in gecko that is responsible for producing a computed value for every property for every element. see the gecko overview for more information about the style system.
adding a new event this draft document covers how to
add a new event to the mozilla (firefox) source code.
adding a new word to the en-us dictionary occasionally bugs are filed pointing out situations where perfectly legitimate words are missing from the english spell check dictionary in firefox. ...
...And 10 more matches
Element - Web APIs
ent interface is the base interface for html elements, while the svgelement interface is the basis for all svg elements. most functionality is specified further down the class hierarchy. languages outside the realm of the web platform, like xul through the xulelement interface, also implement element. ...
...uch as when your app is running in the background. element.onfullscreenerror an event handler for the fullscreenerror event, which is sent when an error occurs while attempting to change into full-screen mode. methods inherits methods from its parents node, and its own parent, eventtarget, and implements those of parentnode, childnode, nondocumenttypechildnode, and animatable. eventtarget.
addeventlistener() registers an event handler to a specific event type on the element. element.attachshadow() attaches a shadow dom tree to the specified element and returns a reference to its shadowroot. element.animate() a shortcut method to create and run an animation on an element. returns the created animation object instance. element.closest() returns the element which is the closest...
...tens() sets the value of the attribute with the specified name and namespace, from the current node. element.setcapture() sets up mouse event capture, redirecting all mouse events to this element. element.setpointercapture() designates a specific element as the capture target of future pointer events. element.toggleattribute() toggles a boolean attribute, removing it if it is present and
adding it if it is not present, on the specified element. obsolete methods element.getattributenode() retrieves the node representation of the named attribute from the current node and returns it as an attr. element.getattributenodens() retrieves the node representation of the attribute with the specified name and namespace, from the current node and returns it as an attr. element.rem...
...And 10 more matches
Using Service Workers - Web APIs
ote: the cache api is not supported in every browser. (see the browser compatibility section for more information.) if you want to use this now, you could consider using a polyfill like the one available in google's topeka demo, or perhaps store your assets in indexeddb. ...
...you want to use this now, you could consider using a polyfill like the one available in google's topeka demo, or perhaps store your assets in indexeddb. ...
... inside waituntil() we use the caches.open() method to create a new cache called v1, which will be version 1 of our site resources cache. this returns ...
...And 10 more matches
Using CSS animations - CSS: Cascading Style Sheets
ce at which they take place. 0% indicates the first moment of the animation sequence, while 100% indicates the final state of the animation. because these two times are so important, they have special aliases: from and to. both are optional. if from/0% or to/100% is not specified, the browser starts or finishes the animation using the computed values of all attributes. you can optionally include
additional keyframes that describe intermediate steps between the start and end of the animation. examples note: some older browsers (pre-2017) may need prefixes; the live examples you can click to see in your browser include the -webkit prefixed syntax. making text slide across the browser window this simple example styles the <p> element so that the text slides in from off the right edge of the...
... the browser window. the second (and final) keyframe occurs at 100% (using the alias to). the left margin is set to 0% and the width of the element is set to 100%. this causes the header to finish its animation flush against the left edge of the content area. <p>the caterpillar and alice looked at each other for some time in silence: at last the caterpillar took the hookah out of its mouth, and
addressed her in a languid, sleepy voice.</p> note: reload page to see the animation, or click the codepen button to see the animation in the codepen environment.
adding another keyframe let’s
add another keyframe to the previous example’s animation. let’s say we want the header’s font size to increase as it moves from right to left for a while, then to decrease back to its original s...
...eepy voice.</p> note: reload page to see the animation, or click the codepen button to see the animation in the codepen environment.
adding another keyframe let’s
add another keyframe to the previous example’s animation. let’s say we want the header’s font size to increase as it moves from right to left for a while, then to decrease back to its original size. ...
...And 10 more matches
<input type="url"> - HTML: Hypertext Markup Language
. value the <input> element's value attribute contains a domstring which is automatically validated as conforming to url syntax. more specifically, there are two possible value formats that will pass validation: an empty string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed absolute url. ...
...s validation: an empty string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed absolute url. this doesn't necessarily mean the url
address exists, but it is at least formatted correctly. in simple terms, this means urlscheme://restofurl. see validation for details on how urls are validated to ensure that they're formatted properly. ...
...string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed absolute url. this doesn't necessarily mean the url
address exists, but it is at least formatted correctly. in simple terms, this means urlscheme://restofurl. see validation for details on how urls are validated to ensure that they're formatted properly. ...
...And 10 more matches
Proxy Auto-Configuration (PAC) file - HTTP
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 previously 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, asking again after an
additional 40 minutes. quer...
... examples proxy w3proxy.netscape.com:8080; proxy mozilla.netscape.com:8081 primary proxy is w3proxy:8080; if that goes down start using mozilla:8081 until the primary proxy comes up again. ...
...c filename extension: proxy.pac and the mime type should be set to: application/x-ns-proxy-autoconfig next, you should configure your server to map the .pac filename extension to the mime type. notes: the javascript function should always be saved to a file by itself but not be embedded in a html file or any other file. the examples at the end of this document are complete. there is no
additional syntax needed to save it into a file and use it. (of course, the javascripts must be edited to reflect your site's domain name and/or subnets.) predefined functions and environment these functions can be used in building the pac file: hostname based conditions isplainhostname() dnsdomainis() localhostordomainis() isresolvable() isinnet() related utility funct...
...And 10 more matches
Working with objects - JavaScript
this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. ...
... you can also access properties by using a string value that is stored in a variable: var propertyname = 'make'; mycar[propertyname] = 'ford'; propertyna...
...empty string'; console.log(myobj); please note that all keys in the square bracket notation are converted to string unless they're symbols, since javascript object property names (keys) can only be strings or symbols (at some point, private names will also be
added as the class fields proposal progresses, but you won't use them with [] form). for example, in the above code, when the key obj is
added to the myobj, javascript will call the obj.tostring() method, and use this result string as the new key. you can also access properties by using a string value that is stored in a variable: var propertyname = 'make'; mycar[propertyname] = 'ford'; propertyname = 'model'; mycar[propertyname] = 'mustang'; you can use the bracket notation with for...in to iterate over all the enumerable proper...
...And 10 more matches
Authoring MathML - MathML
s such as those used on this mdn wiki then a small mathml.css stylesheet might be enough. to use it, just insert one line in your document header: <script src="https://fred-wang.github.io/mathml.css/mspace.js"></script> if you need more complex constructions, you might instead consider using the heavier mathjax library as a mathml polyfill: <script src="https://fred-wang.github.io/mathjax.js/mp
added-min.js"></script> note that these two scripts perform feature detection of the mspace or mp
added elements (see the browser compatibility table on these pages). there is also a similar script to display a warning at the top of the page for browsers without good mathml support and let the users choose between one of the fallback above: <script src="https://fred-wang.github.io/mathml-warning.js/...
...-min.js"></script> note that these two scripts perform feature detection of the mspace or mp
added elements (see the browser compatibility table on these pages). there is also a similar script to display a warning at the top of the page for browsers without good mathml support and let the users choose between one of the fallback above: <script src="https://fred-wang.github.io/mathml-warning.js/mp
added-min.js"></script> if you don't want to use this link to github but instead to integrate these polyfills or others in your own project, you might need the detection scripts to verify the level of mathml support. ...
...ript src="https://fred-wang.github.io/mathml-warning.js/mp
added-min.js"></script> if you don't want to use this link to github but instead to integrate these polyfills or others in your own project, you might need the detection scripts to verify the level of mathml support. ...
...And 10 more matches
Web video codec guide - Web media technologies
ing on the web, summaries of their capabilities and any compatibility and utility concerns, and advice to help you choose the right codec for your project's video. common codecs the following video codecs are those which are most commonly used on the web. for each codec, the containers (file types) that can support them are also listed. each codec provides a link to a section below which offers
additional details about the codec, including specific capabilities and compatibility issues you may need to be aware of. codec name (short) full codec name container support av1 aomedia video 1 mp4, webm avc (h.264) advanced video coding 3gp, mp4, webm h.263 h.263 video 3gp hevc (h.265) high efficiency video coding mp4 ...
... video will affect the output varies depending on the codec and how it works. if the codec converts the media into an internal pixel format, or otherwise represents the image using a means other than simple pixels, the format of the original image doesn't make any difference. however, things such as frame rate and, obviously, resolution will always have an impact on the output size of the media.
additionally, all codecs have their strengths and weaknesses. some have trouble with specific kinds of shapes and patterns, or aren't good at replicating sharp edges, or tend to lose detail in dark areas, or any number of possibilities. it all depends on the underlying algorithms and mathematics. the potential effect of source video format and contents on the encoded video quality and size ...
...in dark areas, or any number of possibilities. it all depends on the underlying algorithms and mathematics. the potential effect of source video format and contents on the encoded video quality and size feature effect on quality effect on size color depth (bit depth) the higher the color bit depth, the higher the quality of color fidelity is achieved in the video.
additionally, in saturated portions of the image (that is, where colors are pure and intense, such as a bright, pure red [rgba(255, 0, 0, 1)]), color depths below 10 bits per component (10-bit color) allow banding, where gradients cannot be represented without visible stepping of the colors. depending on the codec, higher color depths may result in larger compressed file sizes. the determining fac...
...And 10 more matches
The "codecs" parameter in common media types - Web media technologies
such as video/mp4 or audio/mpeg. however, many media types—especially those that support video tracks—can benefit from the ability to more precisely describe the format of the data within them. for instance, just describing a video in an mpeg-4 file with the mime type video/mp4 doesn't say anything about what format the actual media within takes. for that reason, the codecs parameter can be
added to the mime type describing media content. with it, container-specific information can be provided. this information may include things like the profile of the video codec, the type used for the audio tracks, and so forth. this guide briefly examines the syntax of the media type codecs parameter and how it's used with the mime type string to provide details about the contents of audio or video...
...type. video/quicktime a video file in apple's quicktime format. as noted elsewhere, this format was once commonly used on the web but no longer is, since it required a plugin to use. however, each of these mime types is vague. all of these file types support a variety of codecs, and those codecs may have any number of profiles, levels, and other configuration factors. for this reason, you can
add the codecs parameter to the media type. to do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file. some media types only let you specify the names of the codecs to use, while others allow you to specify various constraints on those codecs as well. you can specify multiple codecs by separating them with commas. audio/ogg; codecs=...
...ntax. av1 the syntax of the codecs parameter for av1 is defined the av1 codec iso media file format binding specification, section 5: codecs parameter string. av01.p.llt.dd[.m[.ccc[.cp[.tc[.mc[.f]]]]]] this codec parameter string's components are described in more detail in the table below. each component is a fixed number of characters long; if the value is less than that length, it must be p
added with leading zeros. av1 codec parameter string components component details p the one-digit profile number: av1 profile numbers profile number description 0 "main" profile; supports yuv 4:2:0 or monochrome bitstreams with bit depth of 8 or 10 bits per component. ...
...And 10 more matches
Release notes - Archive of obsolete content
details github commits made between firefox 33 and firefox 34. ...
... will not include any uplifts made after this release entered aurora. bugs fixed between firefox 34 and firefox 35. this will not include any uplifts made after this release entered aurora. firefox 34 highlights new api: dev/panel enables you to extend the firefox developer tools. jpm beta released. ...
... details github commits made between firefox 32 and firefox 33. ...
...And 9 more matches
Creating annotations - Archive of obsolete content
enter the annotation text itself. selector page-mod selector content scripts the content script for the selector page-mod uses jquery to examine and manipulate the dom. its main job is to maintain a matched element: this is the page element that is the current candidate for an annotation. the matched element is highlighted and has a click handler bound to it which sends a message to the main
add-on code. the selector page mod can be switched on and off using a message from the main
add-on code. it is initially off: var matchedelement = null; var originalbgcolor = null; var active = false; function resetmatchedelement() { if (matchedelement) { (matchedelement).css('background-color', originalbgcolor); (matchedelement).unbind('click.annotator'); } } self.on('message', funct...
... is eligible if it, or one of its ancestors in the dom tree, has an attribute named "id". the idea here is to make it more likely that the annotator will be able to identify annotated elements correctly later on. if the page element is eligible for annotation, then the selector highlights that element and binds a click handler to it. the click handler sends a message called show back to the main
add-on code. the show message contains: the url for the page, the id attribute value, and the text content of the page element. $('*').mouseenter(function() { if (!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelem...
...r = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yellow'); $(matchedelement).bind('click.annotator', function(event) { event.stoppropagation(); event.preventdefault(); self.port.emit('show', [ document.location.tostring(), $(ancestor).attr("id"), $(matchedelement).text() ] ); }); }); conversely, the
add-on resets the matched element on mouseout: $('*').mouseout(function() { resetmatchedelement(); }); save this code in a new file called selector.js in your
add-on's data directory. because this code uses jquery, you'll need to download that as well, and save it in data. updating main.js go back to main.js and
add the code to create the selector into the main function: var selector = pagemo...
...And 9 more matches
Preferences - Archive of obsolete content
mozilla is nsipreflocalizedstring. it is similar to nsisupportsstring, except that when there is no user value, getcomplexvalue() gets the default value from a locale file (thus making the default value localizable). it's easier to explain this by example. let's say you want to make the default value for the extensions.myext.welcomemessage preference localizable. you should do the following:
add this line to some .properties file (for all of your locales), say to chrome://myext/locale/defaults.properties: extensions.myext.welcomemessage=localized default value
add the default value for extensions.myext.welcomemessage, pointing to that properties file, by
adding the following line to your file with default preferences (see below). pref("extensions.myext.welcomemessage", "chrome://...
...ocalizedstring, described above). otherwise an ns_error_unexpected exception is thrown. if the branch is from the default tree, the get method doesn't check the tree with current values at all. ...
...ult values are read from all mozilla-based applications read (application directory)/defaults/preferences/*.js in
addition to that, recent versions of toolkit applications (firefox 1.0, thunderbird 1.0, and the like but not the mozilla suite) read extension defaults -- usually located in (profile folder)/extensions/(id)/defaults/preferences/ these files use simple javascript-like syntax. to
add a default value for a preference, you should
add a line like this to your default preferences file: pref("extensions.extensionname.preferencename", false); how to install an extension's defaults files for mozilla suite (not firefox and thunderbird), copy them to (appdir)/defaults/pref in your install script. for firefox/thunderbird, just put them in myext.xpi/defaults/preferences/. they will...
...And 9 more matches
XPCOM Objects - Archive of obsolete content
e 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. the fact that it allows to easily create os-independent applications is a big selling point for xulrunner. xpcom is the way in which the two layers (xulrunner and chrome) communicate. most of...
...ex 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 documentation. there is no comprehensive list of these (that we know of), and that's understandable since it would be a very long list, and it can be extended by
add-ons. if you want to see the list in your current firefox installation, just run the following code in the error console: var str = ""; for (var i in components.classes) { str += i + "\n" }; str a run on firefox 3.6.2 with a few extensions installed yields 876 strings. that's quite a lot. luckily, you'll only need to know a handful of those for extension development. the @mozilla.org/ prefix...
...e x in a component, you first need to "cast" the component to interface x. this is done via the queryinterface method that is included in all xpcom components. this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.nsiprefbranch); this._prefvalue = this._prefservice.getboolpref("somepreferencename"); this._prefservice.queryinterface(ci.nsiprefbranch2); this._prefservice.
addobserver("somepreferencename", this, false); this._prefservice.queryinterface(ci.nsiprefbranch); this is a common piece of code you'll see when initializing components or jsm that rely on preferences. we use the preferences service to get and set preference values, such as the preference value we're getting on the fourth line of code. these methods are in the nsiprefbranch interface. the getser...
...And 9 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
resource description framework: rdf simple object access protocol: soap 1.1 ecma-262, revision 3 (javascript 1.5): ecma-262 general cross-browser coding tips even though web standards do exist, different browsers behave differently (in fact, the same browser may behave differently depending on the platform). 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 mozilla and internet explorer, i'll cover some basic ways you can make a web application extensible in order to
add new browser support later. since different browsers sometimes use different apis for the same functionality, you can often find multiple if() else() blocks throughout the code to differentiate...
...u want it to support a new browser, you must update these blocks throughout the web application. the easiest way to eliminate the need to recode for a new browser is to abstract out functionality. rather than multiple if() else() blocks, you increase efficiency by taking common tasks and abstracting them out into their own functions. ...
...d nodes and only process those with a nodetype of 1: html: <div id="foo"> <span>test</span> </div> javascript: var mydiv = document.getelementbyid("foo"); var mychildren = mydiv.childnodes; for (var i = 0; i < mychildren.length; i++) { if (mychildren[i].nodetype == 1){ // element node }; }; generate and manipulate content mozilla supports the legacy methods for
adding content into the dom dynamically, such as document.write, document.open and document.close. mozilla also supports internet explorer's innerhtml method, which it can call on almost any node. it does not, however, support outerhtml (which
adds markup around an element, and has no standard equivalent) and innertext (which sets the text value of the node, and which you can achieve in mozilla by us...
...And 9 more matches
MenuItems - Archive of obsolete content
unlike the access key, which only functions while the menu is open, a shortcut key works at any time. a shortcut key can be created using the key element. in reality, the keyboard shortcut is handled by the key element, however, the menu item will display the shortcut next to its label. this allows the user to discover what shortcut keys are available by looking at the menus. ...
...d to do so, you can also set a custom label for the keyboard shortcut on the menu using the acceltext attribute. you might do this if the key associated with the item changes, for instance a list of open windows displayed on a window menu. <menuitem label="first window" acceltext="1"/> here the keyboard shortcut label will be '1', however you will need to write code to handle the key as well. ...
... for the keyboard shortcut on the menu using the acceltext attribute. you might do this if the key associated with the item changes, for instance a list of open windows displayed on a window menu. <menuitem label="first window" acceltext="1"/> here the keyboard shortcut label will be '1', however you will need to write code to handle the key as well.
adding icons to menu items an icon may be
added to a menu item using the image attribute. ...
...And 9 more matches
MenuModification - Archive of obsolete content
this function appends a new item to the menu's popup with the label insert. ...
...this function appends a new item to the menu's popup with the label insert. ...
...this function appends a new item to the menu's popup with the label insert. ...
...And 9 more matches
Document Object Model - Archive of obsolete content
ion about them or modify them. 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. in mozilla, the dom may be accessed and manipulated using javascript. the various dom objects have functions which may be accessed in scrip...
...l functions of the new window from the opener. it is important to note, however, that the open() method returns before the window has fully loaded, so functions will not typically be available yet. the window object isn't defined by any dom specification, but in mozilla is sometimes considered part of dom level 0, a name used by some developers to refer to the dom-like functions before they were
added to specifications. the actual document displayed in a window can be retrieved using the window's document property. since it is one of the most commonly referenced properties of the window, the document property is usually referenced without the 'window.' qualifier. mozilla provides several different document objects depending on the kind of document. the three main documents are htmldocument,...
...atter type of document used for xul. the three document types are very similar, in fact they all share the same base implementation. however, there are a few functions that are specific to one document type or the other. retrieving elements the most common method to retrieve an element in a document is to give the element an id attribute and the use the document's getelementbyid() method. we've
added the id attribute to a number of elements in the find file dialog. for example, we could get the state of a check box by using the code below: var state = document.getelementbyid('casecheck').checked; the value casecheck corresponds to the id of the case sensitive checkbox. once we have an indication of whether it is checked or not, we can use the state to perform the search. we could do some...
...And 9 more matches
Building XULRunner with Python - Archive of obsolete content
this page describes how to build and use xulrunner with the python extension on windows and while generally useful it is written based on experiences with accessibility projects. see also xulrunner. or, if you are interested in working with xulrunner with python on linux, see mark lise's post with the python extensions enabled xulrunner provides python script access to the dom and xpcom in
addition to the usual java script. this gives access to python features and modules and builds on mark hammond's pyxpcom work from active state. xpcom components can also be created in python. currently (mar 07) python is not enabled by default so a custom build of mozilla is needed. this page provides instructions in the hope of eliminating much trial and error. you should also read the the developer do...
...directory (e.g.c:\projects\mozilla or/c/projects/mozilla in msys) create the following .mozconfig file. note this is complete and does not require the checkout of any other project specific .mozconfig files as sometimes shown. it effectively specifies a release build that is not particularly suitable for debugging xulrunner itself. it uses the trunk (or latest) code in cvs so may be unstable. ...
...a in msys) create the following .mozconfig file. note this is complete and does not require the checkout of any other project specific .mozconfig files as sometimes shown. it effectively specifies a release build that is not particularly suitable for debugging xulrunner itself. it uses the trunk (or latest) code in cvs so may be unstable. ...
...And 9 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
ee the following threads on mozillazine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 windows 7 aero not going into full screen mode properly on win7 with aero glass support firefox doesn't always go to full screen mode from a normal window properly. the resolution to this issue is to
add the following code to your browser.css file somewhere below where the main-window is made transparent to support aero glass. @media all and (-moz-windows-compositor) { /* make transition to fullscreen mode seamlessly in firefox 10+ */ #main-window[infullscreen="true"] { -moz-appearance: none; background-color: -moz-dialog!important; } } for more information about this issue please...
...olors when in private browsing mode. the cause of this issue is that linux firefox uses a different id for the firefox button from windows. the fix is to make sure any style rule that references #appmenu-button also has a comparable reference to #appmenu-toolbar-button in chrome://browser/skin/browser.css. if your firefox button relies on some button styling from toolbarbuttons.css you'll need to
add comparable style rules for #appmenu-toolbar-button in browser.css. toolbars and menus firefox application button application button doesn't change styling for private browsing mode when in private browsing mode there needs to be a visual difference to the firefox app button that is displayed when tabs are on top and the menu bar is disabled. text only toolbar buttons not aligned properly wh...
...lbar buttons are selected in customize toolbars, text labels in toolbar buttons may not align properly. the common cause of this is style rules that reference [iconsize="small"] without excluding [mode="text"]. the solution usually is to append :not ([mode="text"]) to those style rules. for instance use toolbar[iconsize="small"]:not ([mode="text"]). a little experimenting may be required to fully
address this issue with your theme.
address bar identity box is missing padlock icons for secure sites in firefox 14 and later the identity box has been significantly changed and the favicon has been replaced by an icon that indicates the website's status. in the case of secure sites the icon must be a padlock. to fix this issue, you need to copy the files chrome://browser/skin/identity-icons-gene...
...And 9 more matches
RDF in Mozilla FAQ - Archive of obsolete content
} note that the observer will remain attached to the rdf/xml datasource unless removexmlsinkobserver is called. how do i access the information in a datasource? the nsirdfdatasource interface is the means by which you access and manipulate the assertions in a datasource. boolean hasassert...
...erty, atruthvalue). nsirdfresource getsource(aproperty, atarget, atruthvalue). nsisimpleenumerator getsources(aproperty, atarget, atruthvalue). nsisimpleenumerator arclabelsin(atarget). nsisimpleenumerator arclabelsout(asource). you can also use the rdf container interfaces to access information contained in rdf containers. how do i change information in the datasource? to use 'assert' to
add one assertion and 'unassert' to remove one. refer to mozilla rdf back end architecture ds.assert(homepage, fv_quality, value, true); ds.unassert(homepage, fv_quality, value, true); how do i save back changes to an rdf/xml datasource? an rdf/xml datasource can be queryinterface()'d to nsirdfremotedatasource. this interface has a flush() method, which will attempt to write the contents of the d...
... contractids that make it easy to instantiate the datasource using either the nsirdfserivce's getdatasource() method or the datasources attribute on a xul template. these contractids are of the form @mozilla.org/rdf/datasource;1?name=name and are accessable via getdatasource() and the datasources attribute using the shorthand rdf:name. for example, the following xul fragment illustrates how to
add the bookmarks service as a datasource into a xul template. <tree datasources="rdf:bookmarks"> ... </tree> how do i manipulate rdf "containers"? to manipulate an rdf "container" (an <rdf:seq>, for example), you can use nsirdfcontainerutils which can be instantiated as a service with the following contractid: @mozilla.org/rdf/container-utils;1 you can use this service to detect if somethin...
...And 9 more matches
Mobile touch controls - Game development
d thing about using phaser is that it offers helper variables and functions for easier and faster development, but it's entirely up to you which approach you to choose. pure javascript approach we could implement touch events on our own — setting up event listeners and assigning relevant functions to them would be quite straightforward: var el = document.getelementsbytagname("canvas")[0]; el.
addeventlistener("touchstart", handlestart); el.
addeventlistener("touchmove", handlemove); el.
addeventlistener("touchend", handleend); el.
addeventlistener("touchcancel", handlecancel); this way, touching the game's <canvas> on the mobile screen would emit events, and thus we could manipulate the game in any way we want (for example, moving the space ship around). the events are as follows: touchs...
...ve the player's ship by touching the screen on a mobile device. we will use two events: touchstart and,touchmove both handled by one function. ...
... device. we will use two events: touchstart and,touchmove both handled by one function. ...
...And 9 more matches
Styling tables - Learn web development
your local computer. next, create a new file called style.css and save it in the same directory as your other files. ...
...normally, table columns tend to be sized according to how much content they contain, which produces some strange results. ...
...nt, who knows?) with border-collapse: collapse; set, the borders collapse down into one, which looks much better: we've put a border around the whole table, which is needed because we'll be putting some borders round the table header and footer later on — it looks really odd and disjointed when you don't have a border round the whole outside of the table and end up with gaps. we've set some p
adding on the <th> and <td> elements — this gives the data items some space to breathe, making the table look a lot more legible. at this point, our table already looks a lot better: some simple typography now we'll get our text sorted out a bit. first of all, we've found a font on google fonts that is suitable for a table about punk bands. you can go there and find a different one if you li...
...And 9 more matches
Your first form - Learn web development
we'll expand on each of these subtopics in more detail later on in the module. prerequisites: basic computer literacy, and a basic understanding of html. ...
... elements you'll need for simple cases. what are web forms? web forms are one of the main points of interaction between a user and a web site or application. forms allow users to enter data, which is generally sent to a web server for processing and storage (see sending form data later in the module), or used on the client-side to immediately update the interface in some way (for example,
add another item to a list, or show or hide a ui feature). a web form's html is made up of one or more form controls (sometimes called widgets), plus some
additional elements to help structure the overall form — they are often referred to as html forms. the controls can be single or multi-line text fields, dropdown boxes, buttons, checkboxes, or radio buttons, and are mostly created using the <inp...
...but it's standard practice to always set at least the action and method attributes: the action attribute defines the location (url) where the form's collected data should be sent when it is submitted. the method attribute defines which http method to send the data with (usually get or post). note: we'll look at how those attributes work in our sending form data article later on. for now,
add the above <form> element into your html <body>. the <label>, <input>, and <textarea> elements our contact form is not complex: the data entry portion contains three text fields, each with a corresponding <label>: the input field for the name is a single-line text field. the input field for the e-mail is an input of type email: a single-line text field that accepts only e-mail
addresses. th...
...And 9 more matches
CSS basics - Learn web development
ies these are ways in which you can style an html element. (in this example, color is a property of the <p> elements.) in css, you choose which properties you want to affect in the rule. property value to the right of the property—after the colon—there is the property value. this chooses one out of many possible appearances for a given property. (for example, there are many color values in
addition to red.) note the other important parts of the syntax: apart from the selector, each ruleset must be wrapped in curly braces. ({}) within each declaration, you must use a colon (:) to separate the property from its value or values. within each ruleset, you must use a semicolon (;) to separate each declaration from the next one. to modify multiple property values in one ruleset, writ...
...pecified element(s), but only when in the specified state. (for example, when a cursor hovers over a link.) a:hover selects <a>, but only when the mouse pointer is hovering over the link. 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 previously 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 c...
...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 existing rule you have in your style.css file. it was a good test, but let's not continue with lots of red text.
add the following lines (shown below), replacing the font-family assignment with your font-family selection from what will your website look like?. the property font-family refers to the font(s) you want to use for text. this rule defines a global base font and font size for the whole page. since <html> is the parent element of the whole page, all elements inside it inherit the same font-size and fon...
...And 9 more matches
Advanced text formatting - Learn web development
eir inner thoughts or feelings and in the process relaying them to the audience (but not to other characters.) monologue in drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present. aside in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought or piece of
additional background information description lists use a different wrapper than the other list types — <dl>; in
addition each term is wrapped in a <dt> (description term) element, and each description is wrapped in a <dd> (description definition) element. let's finish marking up our example: <dl> <dt>soliloquy</dt> <dd>in drama, where a character speaks to themselves, representing their inn...
...cess relaying them to the audience (but not to other characters.)</dd> <dt>monologue</dt> <dd>in drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.</dd> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought, or piece of
additional background information.</dd> </dl> the browser default styles will display description lists with the descriptions indented somewhat from the terms. note that it is permitted to have a single term with multiple descriptions, for example: <dl> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a ...
....</dd> </dl> the browser default styles will display description lists with the descriptions indented somewhat from the terms. note that it is permitted to have a single term with multiple descriptions, for example: <dl> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. ...
...And 9 more matches
Video and audio content - Learn web development
previous overview: multimedia and embedding next now that we are comfortable with
adding simple images to a webpage, the next step is to start
adding video and audio players to your html documents! in this article we'll look at doing just that with the <video> and <audio> elements; we'll then finish off by looking at how to
add captions/subtitles to your videos. 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. video and audio on the web web developers have wanted to use video and audio on the...
...ed) technologies like flash (and later, silverlight) became popular for handling such content. this kind of technology worked ok, but it had a number of problems, including not working well with html/css features, security issues, and accessibility issues. a native solution would solve much of this if implemented correctly. fortunately, a few years later the html5 specification had such features
added, with the <video> and <audio> elements, and some shiny new javascript apis for controlling them. we'll not be looking at javascript here — just the basic foundations that can be achieved with html. we won't be teaching you how to produce audio and video files — that requires a completely different skillset. we have provided you with sample audio and video files and example code for your ow...
...ly. 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 which has a main video track and one alternate angle track, plus audio for both english and spanish, in
addition to audio for an english commentary track can be conceptualized as shown in the diagram below. also included are text tracks containing closed captions for the feature film, spanish subtitles for the film, and english captions for the commentary. the audio and video tracks within the container hold data in the appropriate format for the codec used to encode that media. different formats ar...
...And 9 more matches
Limitations of chrome scripts
this page describes patterns that used to work in the chrome process that will no longer work in multiprocess firefox. these are the sorts of things that will break an old
add-on in multiprocess firefox. the fix is generally some variant of "do that in a frame script loaded into the content process". this is one of a pair of articles: the other one lists limitations of frame scripts. compatibility shims for many of the patterns described here we've implemented compatibility shims so the patterns still work. ...
...one lists limitations of frame scripts. compatibility shims for many of the patterns described here we've implemented compatibility shims so the patterns still work. for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code synchronous access to the content. ...
...the patterns described here we've implemented compatibility shims so the patterns still work. for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code synchronous access to the content. you'll get the shims for your
add-on by default, unless you set the multiprocesscompatible flag in your
add-on's install manifest. ...
...And 9 more matches
about:memory
ory reports let's assume that you want to measure firefox's memory usage. perhaps you want to investigate it yourself, or perhaps someone has asked you to use about:memory to generate "memory reports" so they can investigate a problem you are having. follow these steps. at the moment of interest (e.g. once firefox's memory usage has gotten high) open a new tab and type "about:memory" into the
address bar and hit "enter". if you are using a communication channel where files can be sent, such as bugzilla or email, click on the "measure and save..." button. this will open a file dialog that lets you save the memory reports to a file of your choosing. (the filename will have a .json.gz suffix.) you can then attach or upload the file appropriately. the recipients will be able to view the cont...
...suring, all trees will be shown fully expanded and no artificial nodes will be inserted. the "js-non-window" sub-tree represents javascript memory usage that doesn't come from windows, but from the browser core. the "heap-unclassified" value represents heap-allocated memory that is not measured by any memory reporter. this is typically 10--20% of "explicit". ...
...expanded and no artificial nodes will be inserted. the "js-non-window" sub-tree represents javascript memory usage that doesn't come from windows, but from the browser core. the "heap-unclassified" value represents heap-allocated memory that is not measured by any memory reporter. this is typically 10--20% of "explicit". if it gets higher, it indicates that
additional memory reporters should be
added. ...
...And 9 more matches
AsyncTestUtils extended framework
the asynctestutils extended framework is one mechanism for testing the mailnews component of thunderbird. see mailnews automated testing for a description of the other testing mechanisms. ...
...isms. ...
...everything you need: load("../../mailnews/resources/loghelper.js"); load("../../mailnews/resources/asynctestutils.js"); load("../../mailnews/resources/messagegenerator.js"); load("../../mailnews/resources/messagemodifier.js"); load("../../mailnews/resources/messageinjection.js"); if the directory where you are
adding the tests does not have a head_*.js file that has the two following lines,
add them at the top of your test file (before the lines shown above): load("../../mailnews/resources/maildirservice.js"); load("../../mailnews/resources/mailtestutils.js"); at the bottom of the test file,
add the following: var tests =[ // list your tests here ]; function run_test() { configure_message_injection({mode: "local"}); async_run_tests(tests); } asynchronous testing basics ...
...And 9 more matches
64-bit Compatibility
ingly often - see bug 501324, bug 512866 for example. amd64 pointers if mucking with pointers on amd64 (or em64-t/intel64), it is important to keep in mind an invariant that bits 63-48 must be sign-extended from bit 47. if you use these bits to squirrel away a payload, they must be adjusted before attempting to dereference the pointer. for more information and platform specific details on virtual
address widths, see this article on wikipedia. builtins and calls when passing arguments to lirwriter::inscall(), there are four types: argsize_f - floating point value argsize_i - 32-bit integer argsize_q - 64-bit integer argsize_p - 32-bit integer on 32-bit platforms, 64-bit integer on 64-bit platforms. remember to use argsize_p where appropriate - on pointers or natively sized integers (incl...
...n wikipedia. builtins and calls when passing arguments to lirwriter::inscall(), there are four types: argsize_f - floating point value argsize_i - 32-bit integer argsize_q - 64-bit integer argsize_p - 32-bit integer on 32-bit platforms, 64-bit integer on 64-bit platforms. remember to use argsize_p where appropriate - on pointers or natively sized integers (including jsvals). similarly, when
adding types to jsbuiltins.h, remember to use _js_ptr for pointer-width values. lir safety it is not immediately clear from reading lir which opcodes should be used for 64-bit safety. if you make a mistake, there's an extremely good chance the sanityfilter in nanojit will catch it while generating code. if this happens you will get an assert that points directly to the ill-typed lir. not all pointer-...
...odes there are two forms, an "undecorated" form which is 32-bit, and a form decorated with a "q" or "qi" that is 64-bit. to make it easier to generate platform specific code, these opcodes have aliases decorated with a "p". ...
...And 9 more matches
nsIMsgDatabase
the nsimsgdatabase interface is an abstract interface used to access the mail database backend. mailnews/db/msgdb/public/nsimsgdatabase.idlscriptable please
add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsidbchangeannouncer method overview void open(in nsilocalfile afoldername, in boolean acreate, in boolean aleaveinvaliddb); void forcefolderdbclosed(in nsimsgfolder afolder); void close(in boolean aforcecommit); void commit(in nsmsgdbcommit committype); void forceclosed(); void clearcachedhdrs; void resethdrcachesize(in unsigned long size); nsimsgdbhdr getmsghdrforkey(in nsmsgkey key); nsimsgdbhdr getmsghdrformessageid(in string messageid); boolean containskey(in nsmsgkey key); nsimsgdbhdr createnewhdr(in nsmsgkey k...
... nsisimpleenumerator enumeratemessages(); nsisimpleenumerator enumeratethreads(); void synccounts; nsimsgthread getthreadcontainingmsghdr(in nsimsgdbhdr msghdr); ...
...s; void resethdrcachesize(in unsigned long size); nsimsgdbhdr getmsghdrforkey(in nsmsgkey key); nsimsgdbhdr getmsghdrformessageid(in string messageid); boolean containskey(in nsmsgkey key); nsimsgdbhdr createnewhdr(in nsmsgkey key); void
addnewhdrtodb(in nsimsgdbhdr newhdr, in boolean notify); nsimsgdbhdr copyhdrfromexistinghdr(in nsmsgkey key, in nsimsgdbhdr existinghdr, in boolean
addhdrtodb); void listallkeys(in nsmsgkeyarrayref outputkeys); native code only! nsisimpleenumerator enumeratemessages(); nsisimpleenumerator enumeratethreads(); void synccounts; nsimsgthread getthreadcontainingmsghdr(in nsimsgdbhdr msghdr); void markhdrread(in nsimsgdbhdr msghdr, in boolean bread, in nsidbchangelistener instigator); void markhdrreplied(in nsimsgdbhdr msghdr, in boolean...
...And 9 more matches
Migrating from Firebug - Firefox Developer Tools
s when expanding the request within the console panel. the devtools web console shows those structures directly under the "response" tab. multi-line command line firebug's console has a multi-line command line called command editor. the devtools do not have a side panel like the command editor (which is requested in bug 1133849), 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 preview there is a preview tab when a network request logged to the conso...
...s 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 to view and edit the css rules related to the element selected within the node view in a similar way. firebug has a style side panel for this, the devtools have a rules side panel. in firebug you
add new rules by right-clicking and choosing
add rule... from the context menu. the devtools also have a context menu option for that named
add new rule and
additionally have a + button within the rules panel's toolbar to create new rules. to edit element styles, i.e. the css properties of the style attribute of an element, in firebug you have to right-click into the style side panel and choose edit...
...to-completion of css as in firebug, the rules view provides an auto-completion for the css property names and their values. a few property values are not auto-completed yet, which is tracked in bug 1337918. copy & paste css firebug's style side panel as well as the devtools' rules side panel provide options within their context menus to copy the css rule or the style declarations. the devtools
additionally provide an option to copy the selector of a rule and copy disabled property declarations as commented out. they are missing the option to copy the whole style declaration, though this can be achieved by selecting them within the panel and copying the selection by pressing ctrl+c or via the context menu. the rules side panel of the devtools is smarter when it comes to pasting css into it...
...And 9 more matches
about:debugging (before Firefox 68) - Firefox Developer Tools
the about:debugging page provides a single place from which you can attach the firefox developer tools to a number of debugging targets. at the moment it supports three main sorts of targets: restartless
add-ons, tabs, and workers. opening the about:debugging page there are several different ways to open about:debugging: type "about:debugging" in the firefox url bar. in the tools > web developer menu, click "service workers". select the web developer menu under the hamburger menu (), then select "service workers". ...
... page there are several different ways to open about:debugging: type "about:debugging" in the firefox url bar. in the tools > web developer menu, click "service workers". select the web developer menu under the hamburger menu (), then select "service workers". ...
...t:debugging: type "about:debugging" in the firefox url bar. in the tools > web developer menu, click "service workers". select the web developer menu under the hamburger menu (), then select "service workers". when about:debugging opens, on the left-hand side, you'll see a sidebar enabling you to switch between the two main views: one for
add-ons and one for workers. whether or not system
add-ons appear in the list on this page depends on the setting of the devtools.aboutdebugging.showsystem
addons preference. if you need to see system
add-ons, navigate to about:config and make sure that this value is set to true.
add-ons the
add-ons section in about:debugging only supports restartless
add-ons, including basic bootstrapped extensions,
add-on sdk
add-ons, and webextensions. this pa...
...And 9 more matches
Using the CSS Painting API - Web APIs
units tall, positioned 0 units from the left and 15 units from the top of the content box. we can use the css background-size and background-position properties to re-size or relocate this background image, but this is the default size and placement of the yellow box we created in our paint worklet. we tried to keep the example simple. for more options, look at the canvas documentation. we also
add a little bit of complexity later in this tutorial. using the paint worklet to use the paint worklet, we need to register it using
addmodule() and include it in our css, ensuring the css selector matches a dom node in our html registering the worklet the setup and design of our paint worklet took place in the external script shown above. we need to register that worklet from our main script. ...
...complexity later in this tutorial. using the paint worklet to use the paint worklet, we need to register it using
addmodule() and include it in our css, ensuring the css selector matches a dom node in our html registering the worklet the setup and design of our paint worklet took place in the external script shown above. we need to register that worklet from our main script. css.paintworklet.
addmodule('nameofpaintworkletfile.js'); this can be done using the paint worklet's
addmodule() method in a <script> within the main html or in an external javascript file linked to from the document. in our example, the paintworklet is stored on github. ...
...klet took place in the external script shown above. we need to register that worklet from our main script. css.paintworklet.
addmodule('nameofpaintworkletfile.js'); this can be done using the paint worklet's
addmodule() method in a <script> within the main html or in an external javascript file linked to from the document. in our example, the paintworklet is stored on github. css.paintworklet.
addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/01partone/header-highlight.js'); reference the paint worklet in css once we have a registered paint worklet, we can use it in css. employ the css paint() function like we would any other <image> type, using the same string identifier we used in the paintworklet's registerpaint() function. .fancy { background-image: paint(headerhigh...
...And 9 more matches
Advanced animations - Web APIs
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. ...
... = canvas.getcontext('2d'); var ball = { x: 100, y: 100, radius: 25, color: 'blue', draw: function() { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, math.pi * 2, true); ctx.closepath(); ctx.fillstyle = this.color; ctx.fill(); } }; ball.draw(); nothing special here, the ball is actually a simple circle and gets drawn with the help of the arc() method.
adding velocity now that we have a ball, we are ready to
add a basic animation like we have learned in the last chapter of this tutorial. again, window.requestanimationframe() helps us to control the animation. the ball gets moving by
adding a velocity vector to the position. for each frame, we also clear the canvas to remove old circles from prior frames. var canvas = document.getelementbyid('canv...
...we need to check if the x and y position of the ball is out of the canvas dimensions and invert the direction of...
...And 9 more matches
Using the Gamepad API - Web APIs
o>, and <video>, along with javascript implementations, have matured to the point where they can now support many tasks previously requiring native code. 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. in
addition to these events, the api also
adds a gamepad object, which you can use to query the state of a connected gamepad, and a navigator.getgamepads() method which you can use to get a list of gamepads known to the page. connecting to a gamepad when a new gamepad is connected to the computer, the focused page first receives a gamepadconnected event. if a gamepad is already connected when the page...
...o 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 prevent 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, 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 previou...
....", 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 previously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched to the focused window, gamep
addisconnected: window.
addeventlistener("gamep
addisconnected", 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 controllers of the same type are used. the index property also functions as the index into the array returned by navigator.getgamep...
...And 9 more matches
Timing element visibility with the Intersection Observer API - Web APIs
of the columns within the grid. perfect for our needs. the sidebar our sidebar is used to present links to other pages on the site. none of them work in our example here, but they exist to help with the presentation of a blog-like experience. the sidebar is represented using an <aside> element, and is styled as follows: aside { grid-column: 1; grid-row: 2; background-color: cornsilk; p
adding: 5px 10px; } aside ul { p
adding-left: 0; } aside ul li { list-style: none; } aside ul li a { text-decoration: none; } the most important thing to note here is that the grid-column is set to 1, to place the sidebar on the left-hand side of the screen. if you change this to -1, it will appear on the right (although some other elements will need some adjustments made to their margins to...
...the site is kept in a <main> element. the following style is applied to that: main { grid-column: 2; grid-row: 2; margin: 0; margin-left: 16px; font-size: 16px; } the primary feature here is that the grid position is set to place the body content in column 2, row 2. articles each article is contained in an <article> element, styled like this: article { background-color: white; p
adding: 6px; } article:not(:last-child) { margin-bottom: 8px; } article h2 { margin-top: 0; } this creates article boxes with a white background which float atop the blue background, with a small margin around the article. every article which isn't the last item in the container has an 8px bottom margin to space things apart. ads finally, the ads have the following initial styling. individua...
...-top: 0; } this creates article boxes with a white background which float atop the blue background, with a small margin around the article. every article which isn't the last item in the container has an 8px bottom margin to space things apart. ads finally, the ads have the following initial styling. individual ads may customize the style somewhat, as we'll see later. .ad { height: 96px; p
adding: 6px; border-color: #555; border-style: solid; border-width: 1px; } .ad:not(:last-child) { margin-bottom: 8px; } .ad h2 { margin-top: 0; } .ad div { position: relative; float: right; p
adding: 0 4px; height: 20px; 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...
...And 9 more matches
Capabilities, constraints, and settings - Web APIs
re, after ensuring that the constrainable properties for which matches must be found are supported (width, height, framerate, and facingmode), we set up constraints which request a width no smaller than 640 and no larger than 1920 (but preferably 1920), a height no smaller than 400 (but ideally 1080), an aspect ratio of 16:9 (1.777777778), and a frame rate no greater than 30 frames per second. in
addition, the only acceptable input device is a camera facing the user (a "selfie cam"). if the width, height, framerate, or facingmode constraints can't be met, the promise returned by applyconstraints() will be rejected. constraints which are specified using any or all of max, min, or exact are always treated as mandatory. if any constraint which uses one or more of those can't be met when callin...
...facingmode constraints can't be met, the promise returned by applyconstraints() will be rejected. constraints which are specified using any or all of max, min, or exact are always treated as mandatory. if any constraint which uses one or more of those can't be met when calling applyconstraints(), the promise will be rejected. advanced constraints so-called advanced constraints are created by
adding an advanced property to the constraint set; this property's value is an array of
additional constraint sets which are considered optional. there are few if any use cases for this feature, and there is some interest in removing it from the specification, so it will not be discussed here. if you wish to learn more, see section 11 of the media capture and streams specification, past example 2. c...
...in this example, constraints are applied at getusermedia() time, asking for an ideal set of options with fallbacks for the video. you can specify one or more media input device ids to establish restrictions on which input sources are allowed. to collect a list of the available devices, you can call navigator.mediadevices.enumeratedevices(), then for each device which meets the desired criteria,
add its deviceid to the mediaconstraints object that eventually gets passed into getusermedia(). you can also change the constraints of an existing mediastreamtrack on the fly, by calling the track's applyconstraints() method, passing into it an object representing the constraints you wish to apply to the track: videotrack.applyconstraints({ width: 1920, height: 1080 }); in this snippet, the...
...And 9 more matches
TrackEvent - Web APIs
it's important not to confuse trackevent with the rtctrackevent interface, which is used for tracks which are part of an rtcpeerconnection. ...
...racklist found in htmlmediaelement.videotracks events involving audio tracks are always sent to the audiotracklist specified in htmlmediaelement.audiotracks events affecting text tracks are sent to the texttracklist object indicated by htmlmediaelement.texttracks. constructor trackevent() creates and initializes a new trackevent object with the event type specified, as well as optional
additional properties. properties trackevent is based on event, so properties of event are also available on trackevent objects. track read only the dom track object the event is in reference to. if not null, this is always an object of one of the media track types: audiotrack, videotrack, or texttrack). methods trackevent has no methods of its own; however, it is based on event, so it pro...
...ack read only the dom track object the event is in reference to. if not null, this is always an object of one of the media track types: audiotrack, videotrack, or texttrack). methods trackevent has no methods of its own; however, it is based on event, so it provides the methods available on event objects. ...
...And 9 more matches
WebGL model view projection - Web APIs
nd on the screen, and are concepts that transcend individual frameworks and engines. clip space in a webgl program, data is typically uploaded to the gpu with its own coordinate system and then the vertex shader transforms those points into a special coordinate system known as clip space. any data which extends outside of the clip space is clipped off and not rendered. however, if a triangle str
addles the border of this space then it is chopped up into new triangles, and only the parts of the new triangles that are in clip space are kept. the above graphic is a visualization of the clip space that all of the points must fit into. it is a cube two units on each side, with one corner at (-1,-1,-1) and the opposite corner at (1,1,1). the center of the cube is the point (0,0,0). this 8 cubic...
...are on the screen. the z depth in the squares determines what gets drawn on top when the squares share the same space. the smaller z values are rendered on top of the larger z values. webglbox example this example will create a custom webglbox object that will draw a 2d box on the screen. note: the code for each webglbox example is available in this github repo and is organized by section. in
addition there is a jsfiddle link at the bottom of each section. webglbox constructor the constructor looks like this: function webglbox() { // setup the canvas and webgl context this.canvas = document.getelementbyid('canvas'); this.canvas.width = window.innerwidth; this.canvas.height = window.innerheight; this.gl = mdn.createcontext(canvas); var gl = this.gl; // setup a webgl pro...
.... 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 after z, so by convention this fourth dimension is labeled w. in the above example the w coordinate is set to 1.0. the obvious question is "why the extra dimension?" it turns out that this
addition allows for lots of nice techniques for manipulating 3d data. this
added dimension introduces the notion of perspective into the coordinate system; with it in place, we can map 3d coordinates into 2d space—thereby allowing two parallel lines to intersect as they recede into the distance. the value of w is used as a divisor for the other components of the coordinate, so that the true values ...
...And 9 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
to be applied to convert them to simulate the viewer's current position and orientation. the fragment shader returns the color of each vertex, interpolating as needed from the values found in the texture and applying the lighting effects. starting up and shutting down webxr upon initially loading the script, we install a handler for the load event, so that we can perform initialization. ...
... the color of each vertex, interpolating as needed from the values found in the texture and applying the lighting effects. starting up and shutting down webxr upon initially loading the script, we install a handler for the load event, so that we can perform initialization. ...
...then references are obtained to the four <div> blocks into which we'll output the current contents of each of the key matrices for informational purposes while our scene is running. then we look to see if navigator.xr is defined. if it isn't—and/or the enableforcepolyfill configuration constant is set to true—we install the webxr polyfill by instantiating the web...
...And 9 more matches
@media - CSS: Cascading Style Sheets
uery matches the device on which the content is being used. note: in javascript, the rules created using @media can be accessed with the cssmediarule css object model interface. syntax the @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. /* at the top level of your code */ @media screen and (min-width: 900px) { article { p
adding: 1rem 3rem; } } /* nested within another conditional at-rule */ @supports (display: flex) { @media screen and (min-width: 900px) { article { display: flex; } } } 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 ...
...pe will be implied. all suitable for all devices. print intended for paged material and documents viewed on a screen in print preview 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 shouldn't be used. the aural type has been replaced by speech, which is similar. media features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are enti...
... features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are entirely optional. each media feature expression must be surrounded by parentheses. name summary notes any-hover does any available input mechanism allow the user to hover over elements?
added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it?
added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range ...
...And 9 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <div class="container"> <div class="item">item</div> </div> another place you might see physical keywords in use, is when using text-align: right to align text to the right. there are also physical properties in css. we
add margins, p
adding, and borders using these physical properties of margin-left, p
adding-left, and so on. we call these keywords and properties physical because they relate to the screen you are looking at. left is always left, no matter what direction your text is running. this can become an issue when developing a site that has to work in multiple languages, including languages that have text st...
...hen developing a site that has to work in multiple languages, including languages that have text starting on the right, rather than the left. browsers are pretty good at dealing with text direction, and you don’t even need to be working in a rtl language to take a look. in the example below, i have two paragraphs. one has no text-align property set, the second has text-align set to left. i have
added dir="rtl" 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...
...e jen’s article. as a simple example, i have two paragraphs below. the first uses the default horizontal-tb, and the second uses vertical-rl. in the mode text still runs left to right, however the direction of the text is vertical - inline text now runs down the page, from top to bottom. ...
...And 9 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
on 15. the ie/edge (≤15) version of the specification is prefixed with an -ms prefix and the properties implemented in ie/edge (≤15) are as follows: grid-template-columns as -ms-grid-columns grid-template-rows as -ms-grid-rows grid-row-start as -ms-grid-row grid-column-start as -ms-grid-column align-self as -ms-grid-row-align justify-self as -ms-grid-column-align the ie version has
additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span. this version does not include auto-placement capability, or grid template areas. some simple grid layouts could be implemented for ie10, through to edge 15, using the -ms properties. as these properties are vendor prefixed, they will not effect any browser supporting the up to date and unprefixe...
...i am using floats for older browsers and grid for new ones.</div> </div> the image below shows the media object in a non-supporting browser on the left, and a supporting ...
...o float them. ...
...And 9 more matches
Layout and the containing block - CSS: Cascading Style Sheets
by its containing block. most often, the containing block is the content area of an element's nearest block-level ancestor, but this is not always the case. in this article, we examine the factors that determine an element's containing block. when a user agent (such as your browser) lays out a document, it generates a box for every element. each box is divided into four areas: content area p
adding area border area margin area many developers believe that the containing block of an element is always the content area of its parent, but that isn't necessarily true. let's investigate the factors that determine what an element's containing block is. effects of the containing block before learning what determines the containing block of an element, it's useful to know why it matters i...
...t necessarily true. let's investigate the factors that determine what an element's containing block is. effects of the containing block before learning what determines the containing block of an element, it's useful to know why it matters in the first place. the size and position of an element are often impacted by its containing block. percentage values that are applied to the width, height, p
adding, margin, and offset properties of an absolutely positioned element (i.e., which has its position set to absolute or fixed) are computed from the element's containing block. identifying the containing block the process for identifying the containing block depends entirely on the value of the element's position property: if the position property is static, relative, or sticky, the containin...
...the containing block is formed by the edge of the content box of the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself). if the position property is absolute, the containing block is formed by the edge of the p
adding box of the nearest ancestor element that has a position value other than static (fixed, absolute, relative, or sticky). if the position property is fixed, the containing block is established by the viewport (in the case of continuous media) or the page area (in the case of paged media). if the position property is absolute or fixed, the containing block may also be formed by the edge of the ...
...And 9 more matches
Using media queries - CSS: Cascading Style Sheets
characteristics and parameters (such as screen resolution or browser viewport width). media queries are used for the following: to conditionally apply styles with the css @media and @import at-rules. to target specific media for the <style>, <link>, <source>, and other html elements with the media= attribute. to test and monitor media states using the window.matchmedia() and mediaquerylist.
addlistener() javascript methods. note: the examples on this page use css's @media for illustrative purposes, but the basic syntax remains the same for all types of media queries. syntax a media query is composed of an optional media type and any number of media feature expressions. multiple queries can be combined in various ways by using logical operators. media queries are case-insensitive. ...
...pe will be implied. all suitable for all devices. print intended for paged material and documents viewed on a screen in print preview 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 shouldn't be used. the aural type has been replaced by speech, which is similar. media features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are enti...
... features media features describe specific characteristics of the user agent, output device, or environment. media feature expressions test for their presence or value, and are entirely optional. each media feature expression must be surrounded by parentheses. name summary notes any-hover does any available input mechanism allow the user to hover over elements?
added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it?
added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range ...
...And 9 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
e html <tr> element defines a row of cells in a table. the row's cells can then be established using a mix of <td> (data cell) and <th> (header cell) elements. 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. to provide
additional control over how cells fit into (or span across) columns, both <th> and <td> support the colspan attribute, which lets you specify how many columns wide the cell should be, with the default being 1. similarly, you can use the rowspan attribute on cells to indicate they should span more than one table row. this can take a little practice to get right when building your tables. we have some...
... of the characters in the row are the same size, the effect is the same as bottom. bottom, draws the text in each of the row's cells as closely as possible to the bottom edge of those cells. middle each cell's text is vertically centered. top each cell's text is drawn as closely as possible to the top edge of the containing cell. don't use the obsolete valign attribute. instead,
add the css vertical-align property to the row. examples see <table> for examples on <tr>. basic example this simple example shows a table listing people's names along with various information about membership in a club or service. html this html demonstrates the most basic structure of a table. there are no groups, no cells that span multiple rows or columns, no captions, and only the mos...
...no cells that span multiple rows or columns, no captions, and only the most basic styling to create lines around the components of the table for something resembling clarity. there are just four rows (including one header row), each with four columns (including one header column). not even the table section elements are used; instead, the browser is allowed to determine this automatically. we'll
add <thead>, <tbody>, and <tfoot> in the next example. <table> <tr> <th>name</th> <th>id</th> <th>member since</th> <th>balance</th> </tr> <tr> <td>margaret nguyen</td> <td>427311</td> <td><time datetime="2010-06-03">june 3, 2010</time></td> <td>0.00</td> </tr> <tr> <td>edvard galinski</td> <td>533175</td> <td><time datetime="2011-01-13">january ...
...And 9 more matches
HTML documentation index - HTML: Hypertext Markup Language
s that, in combination with an appropriate cors header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current origin. 3 applying color to html elements using css beginner, css, css colors, guide, html, html colors, html styles, styling html, color with css, there are lots of ways to
add color to your html elements to create just the look you want. this article is a primer introducing each of the ways css color can be used in html. 4 block-level elements beginner, development, guide, html, html5, web html (hypertext markup language) elements historically were categorized as either "block-level" elements or "inline-level" elements. by default, a block-level el...
...using custom elements for more details). 21 itemid attribute, global attribute, html, html microdata, microdata, reference, itemid the itemid global attribute provides microdata in the form of a unique, global identifier of an item. 22 itemprop attribute, global attribute, html, html microdata, microdata, reference the itemprop global attribute is used to
add properties to an item. every html element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. each name-value pair is called a property, and a group of one or more properties forms an item. property values are either a string or a url and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source...
...ence, x-ms-format-detection the x-ms-format-detection attribute determines whether data formats within the element’s text, like phone numbers, are automatically converted to followable links. 36 html attribute reference attribute, attributes, beginner, configuring, element attributes, elements, html, reference, settings, web elements in html have attributes; these are
additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want. 37 html attribute: accept accept, attribute, file, input, reference the accept attribute takes as its value a comma-separated list of one or more file types, or unique file type specifiers, describing which file types to allow. 38 html attribute:...
...And 9 more matches
Browser detection using the user agent - HTTP
orkarounds for the bug. are you trying to check for the existence of a specific feature? your site needs to use a specific web feature that some browsers don't yet support, and you want to send those users to an older web site with fewer features but that you know will work. this is the worst reason to use user agent detection because odds are eventually all the other browsers will catch up. in
addition, it is not practical to test every one of the less popular browsers 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 f...
...or 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 prevent 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 detection f...
...pstring("jqwhy")); // ["jq", "w", "hy"] the above code would have made several incorrect assumptions: it assumed that all user agent strings that include the substring "chrome" are chrome. ua strings are notoriously misleading. it assumed that the lookbehind feature would always be available if the browser was chrome. the agent might be an older version of chrome, from before support was
added, or (because the feature was experimental at the time) it could be a later version of chrome that removed it. most importantly, it assumed no other browsers would support the feature. support could have been
added to other browsers at any time, but this code would have continued choosing the inferior path. problems like these can be avoided by testing for support of the feature itself ins...
...And 9 more matches
Inheritance and the prototype chain - JavaScript
]] to be assigned to all instances of objects created by the given function when used as a constructor. the object.prototype property represents the object prototype object. here is what happens when trying to access a property: // let's create an object o from function f with its own properties a and b: let f = function () { this.a = 1; this.b = 2; } let o = new f(); // {a: 1, b: 2} //
add properties in f function's prototype f.prototype.b = 3; f.prototype.c = 4; // do not set the prototype f.prototype = {b:3,c:4}; this will break the prototype chain // o.[[prototype]] has properties b and c. // o.[[prototype]].[[prototype]] is object.prototype. // finally, o.[[prototype]].[[prototype]].[[prototype]] is null. // this is the end of the prototype chain, as null, // by definition, ha...
..., stop searching, // no property found, return undefined. code link setting a property to an object creates an own property. the only exception to the getting and setting behavior rules is when there is an inherited property with a getter or a setter. inheriting "methods" javascript does not have "methods" in the form that class-based languages define them. in javascript, any function can be
added to an object in the form of a property. an inherited function acts just as any other property, including property shadowing as shown above (in this case, a form of method overriding). when an inherited function is executed, the value of this points to the inheriting object, not to the prototype object where the function is an own property. var o = { a: 2, m: function() { return this.a...
...yed an object that looks similar to this. { constructor: ƒ dosomething(), __proto__: { constructor: ƒ object(), hasownproperty: ƒ hasownproperty(), isprototypeof: ƒ isprototypeof(), propertyisenumerable: ƒ propertyisenumerable(), tolocalestring: ƒ tolocalestring(), tostring: ƒ tostring(), valueof: ƒ valueof() } } we can
add properties to the prototype of dosomething(), as shown below. function dosomething(){} dosomething.prototype.foo = "bar"; console.log( dosomething.prototype ); this results in: { foo: "bar", constructor: ƒ dosomething(), __proto__: { constructor: ƒ object(), hasownproperty: ƒ hasownproperty(), isprototypeof: ƒ isprototypeof(), propertyisenumerabl...
...And 9 more matches
Media container formats (file types) - Web media technologies
e format and mpeg-4, but is specifically streamlined for lower bandwidth scenarios. base 3gp media mime types audio video audio/3gpp video/3gpp audio/3gpp2 video/3gpp2 audio/3gp2 video/3gp2 these mime types are the fundamental types for the 3gp media container; other types may be used depending on the specific codec or codecs in use; in
addition, you can
add the codecs parameter to the mime type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics. video codecs supported by 3gp codec browser support chrome edge firefox safari avc (h.264) yes1,2 ...
... yes mpeg-4 (mp4) mpeg-4 (mp4) is the latest version of the mpeg file format. there are two versions of the format, defined in parts 1 and 14 of the specification. mp4 is a popular container today, as it supports several of the most-used codecs and is broadly supported. ...
...everal of the most-used codecs and is broadly supported. the original mpeg-4 part 1 file format was introduced in 1999; the version 2 format, defined in part 14, was
added in 2003. the mp4 file format is derived from the iso base media file format, which is directly derived from the quicktime file format developed by apple. when specifying the mpeg-4 media type (audio/mp4 or video/mp4), you can
add the codecs parameter to the mime type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics. base mpeg-4 media mime types audio video audio/mp4 video/mp4 these mime types are the fundamental types for the mpeg-4 media container; other mi...
...And 9 more matches
Module structure of the SDK - Archive of obsolete content
commonjs is the underlying infrastructure for both the sdk and the
add-ons you build using the sdk. a commonjs module is a piece of reusable javascript: it exports certain objects which are thus made available to dependent code. commonjs defines: an object called exports which contains all the objects which a commonjs module wants to make available to other modules a function called require which a module can use to import the exports object of another module. except for scripts that interact directly with web content, all the javascript code you'll write or use when developing
add-ons using the sdk is part of a commonjs module, including: sdk modules: the javascript modules which the sdk provides, such as panel and page-mod. local modules: each of the javascript files under your...
... a module can use to import the exports object of another module. except for scripts that interact directly with web content, all the javascript code you'll write or use when developing
add-ons using the sdk is part of a commonjs module, including: sdk modules: the javascript modules which the sdk provides, such as panel and page-mod. local modules: each of the javascript files under your
add-on's "lib" directory. external modules: reusable modules developed and maintained outside the sdk, but usable by sdk-based
add-ons. sdk modules the modules supplied by the sdk are divided into two sorts: high-level modules like panel and page-mod provide relatively simple, stable apis for the most common
add-on development tasks. low-level modules like heritage and namespace provide more ...
..."sdk/tabs"); // load the low-level "uuid" module var uuid = require('sdk/util/uuid'); the path to specify for a low-level module is given along with the module name itself in the title of the module's documentation page (for example, system/environment). ...
...And 8 more matches
Working with Events - Archive of obsolete content
in this case one end of the conversation emits the events, and the other end listens to them. ...
...in this case one end of the conversation emits the events, and the other end listens to them. ...
...in this case one end of the conversation emits the events, and the other end listens to them. ...
...And 8 more matches
/loader - Archive of obsolete content
create commonjs module loaders. usage the code is intentionally authored so that it can be loaded in several ways. it can be loaded as a regular script tag in documents that have system principals (note: this does not appear to work as of 02.2016 due to "use strict" being
added to the file): <script type='application/javascript' src='resource://gre/modules/commonjs/toolkit/loader.js'></script> this will expose a single loader object containing all of the api functions described in this document. it can be loaded as a javascript code module: let { loader, require, unload } = components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js'); it can be required as a commonjs module from a module loaded in the loader itself: let { loade...
...ons); configuration loader() may be provided with a set of configuration options: paths: describes where the loader should find the modules it is asked to load. mandatory. modules: provides a set of module exports. optional. globals: provides a set of globals shared across modules loaded via this loader. optional. resolve: provide customized module resolution logic. optional. id: provide
add-on id to attach to loaded modules. optional. paths the loader needs to be provided with a set of locations to indicate where to find modules loaded using require(). this is provided by a mandatory options.paths hash that represents the mapping between module id prefixes and locations. there are lots of different possibilities, but the most common setup looks like this: let { loader } = requir...
...the example above overlays the base path '' with a different mapping for 'toolkit/' prefixed modules. modules the loader may optionally be provided with a...
...And 8 more matches
console - Archive of obsolete content
but see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. console methods all console methods except exception() and trace() accept one or more javascript objects as arguments and log them to the console. ...
...but see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. console methods all console methods except exception() and trace() accept one or more javascript objects as arguments and log them to the console. ...
...but see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. console methods all console methods except exception() and trace() accept one or more javascript objects as arguments and log them to the console. ...
...And 8 more matches
Storing annotations - Archive of obsolete content
ing private browsing storing new annotations in this section we are only touching the main.js file. first, import the simple-storage module with a declaration like: var simplestorage = require('sdk/simple-storage'); in the module scope, initialize an array which will contain the stored annotations: if (!simplestorage.storage.annotations) simplestorage.storage.annotations = []; now we'll
add a function to the module scope which deals with a new annotation. the annotation is composed of the text the user entered and the "annotation anchor", which consists of the url, element id and element content: function handlenewannotation(annotationtext, anchor) { var newannotation = new annotation(annotationtext, anchor); simplestorage.storage.annotations.push(newannotation); } this functi...
...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 ...
... .text(storedannotation.annotationtext); annotationlist.append(annotationhtml); }); }); it builds the dom for the panel from the array of annotations it is given. the user will be able to click links in the panel, but we want to open them in the main browser window rather than the panel. so the content script binds a click handler to the links which will send the url to the
add-on. save this file in data/list as annotation-list.js. annotation list html and css here's the html for the annotation list: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>saved annotations</title> <link rel="stylesheet" type="text/css" href="annotation-list.css" /> </head> <body> <div id="annotation-list"> </div> <div id="template"> <div...
...And 8 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
mes of the buttons you want to display as a comma-delimited list in the value of the buttons attribute. fixme: make the table cleaner button name description accept the ok button. cancel the cancel button. help the help button. disclosure either a disclosure triangle or a button. this is used to allow the user to toggle the display of
additional information. table 1: types of buttons that can be displayed in the dialog element
additionally, there are two special button names, extra1 and extra2. the labels for these buttons are set using the buttonlabelextra1 and buttonlabelextra2 attributes on the root element, which take arbitrary strings as their values. the action taken when pressing one of these buttons is defined by ...
... a menu is marked up with the menuitem tag. use the menuseparator element to insert a separator bar that groups items together. both menu and menuitem elements take the label attribute to set their labels. insert menu elements into a menubar element to create multiple menus. you can easily create hierarchical menus by inserting menupopup and menu elements. you can even display icons in menus by
adding class="menuitem-iconic" to a menuitem element, along with a src attribute that gives an image uri. figure 7 shows an example of how this is displayed. figure 7: menu items with icons executing commands when selecting menu items much like dynamic html, event handlers are used to execute a command when a menu item is selected. to respond to mouse and keyboard inputs in html, the onclick eve...
...> listing 10: the oncommand event handler because the gecko engine implements dom level 2 event handlers, you can define dynamic event listeners such as the one in listing 11. ...
...And 8 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
). these files are native code files made with the netscape plugin api. if the plugin is scriptable, then it will also consist of an xpt file. examples would be flash 6r47 on windows, which consists of a dll (called npswf32.dll) and an xpt file for scriptability (called flashplayer.xpt). if you are developing a plugin and wish to make it scriptable, read the relevant portions of the plugin api.
additional software. many plugins are part of
additional software for media types. for example, realplayer on windows consists of a plugin dll, but also the realplayer application (exe) which the plugin dll is a subset of. in this case, the plugin is the part of the software package that is browser-specific, as a mechanism to give the application
additional "hooks" into the browser. xpinstall can be...
...l known" directory in which to install to as a secondary install location. on windows: write windows registry keys that netscape gecko browsers (that get installed after the current browser) can parse to discover where the plugin is installed on the machine. in particular, the windows registry keys should point to the secondary install location so that future netscape gecko browsers can find and
add to their list of available plugin locations. the exact format of these registry keys and how they should be written is covered in the section on the first install problem. to actually create and write keys to the windows system registry, you'll use the functions of the winreg object. ensure that the plugin that has just been installed is refreshed by correctly invoking the refreshplugins api. by...
...refreshing your plugin, you're ensuring that the plugin is available for use immediately, without obliging the user to restart their browser. this is one of the chief advantages of a smooth xpinstall experience. the first install problem the first install problem refers to the conditions arising when a plugin arrives on a user's machine before a browser arrives. ...
...And 8 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
ribute of a textbox to autocomplete. it is used to create a textbox with a popup containing a list of possible completions for what the user has started to type. the autocomplete functionality is handled through one of more session objects, each of which can return a set of results given the current value of the textbox. the sessions can be set using the searchsessions attribute or by calling the
addsession method. attributes accesskey, alwaysopenpopup, autocompletesearch, autocompletesearchparam, autofill, autofillaftermatch, autofill, completedefaultindex, crop, disableautocomplete, disableautocomplete, disabled, disablehistory, enablehistory, focused, forcecomplete, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, ignoreblurwhilesearching, inputtooltiptext, labe...
...this should be one of the c...
...ew in thunderbird 3 requires seamonkey 2.0 the user's email domain is suggested. history requires seamonkey 2.0 the user's url history is searched. form-history requires seamonkey 2.0 search the values that the user has entered into form fields. file (linux only) the local file system is searched. gloda new in thunderbird 3
addrbook new in thunderbird 3 requires seamonkey 2.0 the user's
address book is searched. ldap new in thunderbird 25 requires seamonkey 2.22 the user's ldap directory is searched. autocompletesearchparam new in thunderbird 2 requires seamonkey 1.1 type: string a string which is passed to the search component. autofill obsolete since gecko 1.
...And 8 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
articles to find out more—the main extensions page here is a good starting point. in particular, the articles creating toolbar buttons and building an extension explain the process in more detail. supported applications you can use the steps on this page only with seamonkey 1.x versions. seamonkey 2 is being reworked to support the same process as firefox, thunderbird and others. this tutorial
adds a customizable button to all seamonkey's toolbars. it
adds a menu choice to chatzilla's menu bar (because chatzilla has no toolbar). note: for a similar tutorial that applies to seamonkey 2, firefox, thunderbird and sunbird, see: custom toolbar button earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. requ...
...ether with other files that are provided by extensions. your toolbar button will be an extension. 2. delete these two files: chrome.rdf overlays.rdf explanation: seamonkey automatically rebuilds these files the next time it starts. when it rebuilds them, it will include your new extension. 3. edit the file: installed-chrome.txt at the end of the file,
add the following line. copy and paste the line from here, to avoid typing errors: content,install,url,resource:/chrome/custombutton/ explanation: this line registers your custom toolbar button extension, linking it into seamonkey. 4. create a new directory named: custombutton perform the following steps in this new directory, creating five files there.
... chrome:author="my name" chrome:name="custombutton" chrome:localeversion="1.8" chrome:skinversion="1.5" chrome:extension="true"/> <rdf:seq about="urn:mozilla:overlays"> <!-- browser --> <rdf:li> <rdf:seq about="chrome://navigator/content/navigator.xul"> <rdf:li>chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:li> <!--
address book --> <rdf:li> <rdf:seq about="chrome://messenger/content/
addressbook/
addressbook.xul"> <rdf:li>chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:li> <!-- message --> <rdf:li> <rdf:seq about="chrome://messenger/content/messagewindow.xul"> <rdf:li>chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:...
...And 8 more matches
Custom toolbar button - Archive of obsolete content
you can use the steps on this page with any or all of these mozilla applications: firefox 1.5 or a later version seamonkey 2.0 or a later version thunderbird 1.5 or a later version sunbird 0.3 or a later version pre-release versions of these (alphas, betas and release candidates) are also ok. in the rest of this page, the term application means the mozilla application where you want to
add the button. note: there is a similar tutorial for seamonkey 1.x on the page: custom toolbar button:seamonkey earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. required tools you will need two tools. your operating system normally provides them: a way to create and work with files and directories a text...
...r to customize the images. you can optionally use a jar tool or zip tool to package your button as a cross-platform installable (xpi) for other people to install and use. making a button there are ten easy steps. when you have completed all the steps, you will have a structure like this in your profile directory: the profile directory and the extensions directory already exist. you will
add the other directories and files that are shown in the diagram. (other directories and files also exist, but the diagram does not show them.) 1. go to the profile directory that you use for the application, then go to the extensions directory there. note: for information about how to find the profile directory, see: profile folder explanation: the profile directory contains information speci...
...tor. change the text between double-quote characters on these three lines. optionally remove the sections for target applications that you do not want. save the file. explanation: this file contains information used by the application's extension manager. sections for target applications specify the versions where the extension works. the last section in the file specifies that this extension
adds content to the application. 4. create a plain text file named chrome.manifest. copy the following content, and paste it into the new file: content custombutton chrome/ style chrome://global/content/customizetoolbar.xul chrome://custombutton/content/button.css # firefox overlay chrome://browser/content/browser.xul chrome://custombutton/content/button.xul # thunderbird mail overlay chrome://m...
...And 8 more matches
Manifest Files - Archive of obsolete content
es 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. that means that all you need to do to install a new package is
add a new manifest file either into the application chrome directory or the user specific chrome directory. this latter chrome directory is normally the one used since the application directory might not have sufficient permissions to write into it. note: starting in gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest c...
...to the application chrome directory or the user specific chrome directory. this latter chrome directory is normally the one used since the application directory might not have sufficient permissions to write into it. note: starting in gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest command in that file to import
additional manifests. use manifest flags to configure the scenarios in which the secondary manifest is imported. if you just want to try testing privileged xul code in the firefox browser, you can do this easily by just using a manifest with only one line in it: create a new directory somewhere. for example, on a windows machine, you might use c:\testfiles create a new ascii1 file called test.man...
...he firefox browser, you can do this easily by just using a manifest with only one line in it: create a new directory somewhere. for example, on a windows machine, you might use c:\testfiles create a new ascii1 file called test.manifest in the chrome directory. it doesn't actually matter what the file is called as long as it has the .manifest extension. ( 1. ...
...And 8 more matches
XBL Example - Archive of obsolete content
ng 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. 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. along the bottom, we'll need a button to go the previous page, a label to display the current page number, and a button to go to the next page. example 1 : source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> ...
...ck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:hbox> </xul:vbox> </content> </binding> this binding creates the slideshow structure that we want. the flex attribute has been
added to a number of elements so that it stretches in the right way. the label attributes on the two buttons inherit their values from the bound element. here, they inherit from two custom attributes, previoustext and nexttext. this makes it easy to change the labels on the buttons. the children of the element that the xbl is bound to will be placed inside the deck. the selectedindex is inherited by ...
... 2"/> <textbox/> </box> the style sheet used here is: .slideshow { -moz-binding: url("slideshow.xml#slideshow"); } the first button, button 1 has been used as the first page of the deck. the label widget has not appeared as no value has been specified for it. we could set a value, but instead it will calculated later. page property next, a property that holds the current page will be
added. when getting this custom property, it will need to retrieve the value of the selectedindex attribute of the deck, which holds the number of the currently displayed page. similarly, when setting this property, it will need to change the selectedindex attribute of the deck. in
addition, the text widget will need to be updated to display which page is the current one. <property name="page" o...
...And 8 more matches
Using Remote XUL - Archive of obsolete content
_xul_xbl_for_file to true. however, there is a whitelist that lets you specify sites that can still use remote xul. the remote xul manager extension lets you manage this whitelist, which is maintained using nsipermissionmanager, by creating entries of type "allowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.nsipermissionmanager) .
add(uri, 'allowxulxbl', components.interfaces.nsipermissionmanager.allow_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). xul is often used by deskto...
...t, css, and the dom. knowledge of xml and its syntax is useful but not required. you also need a text editor and a web browser that can render xul, like mozilla, or firefox. if you build a xul file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of xul files as application/vnd.mozilla.xul+xml. for apache, you can do this by
adding the following line to your mime.types file: application/vnd.mozilla.xul+xml .xul alternately,
add this line to your httpd.conf file or, if the apache server is configured to allow it, to the .htaccess file in the directory from which the xul file is served:
addtype application/vnd.mozilla.xul+xml .xul then restart your web server. with php you can send the mime-type with the header() fun...
... the extent to which the element will stretch relative to other flexible elements. an element with a flex of "2" is twice as flexible as an element with a flex of "1", so the first element might show up as twice as wide as the second. in our case, the iframe will be the only flexible element in our document, so we don't have to worry about its value and give it a standard value of 1. [optionally
add something about how flex only applies to one axis] note that for remote xul documents you can see changes you make to the ui by reloading the document with your browser's "reload" function, just as with a typical html page. source | rendered step 3: menus and buttons the mozilla.org web site uses an html navigation bar on the left-hand side of its pages to provide site navigation. the bar c...
...And 8 more matches
Build the brick field - Game development
th step out of 10 of the gamedev canvas tutorial. 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 p
addle. 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. first however we need to set up some variables to define information about the bricks such as their width an...
...eeds 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. 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. ...
...op 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 previously declared in your program. var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickp
adding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; here we've defined the number of rows and columns of bricks , their width and height, the p
adding between the bricks so they won't touch each other and a top and left offset so they won't start being drawn right from the edge of the canvas. we will hold all our bricks in a two-dimensional array. it will contain the brick columns (c), w...
...And 8 more matches
Animations and tweens - Game development
quentially to create the illusion of animation. the spritesheet() method's two extra paremeters determine the width and height of each single frame in the given spritesheet file, indicating to the program how to chop it up to get the individual frames. loading the animation next up, go into your create() function, find the line that loads the ball sprite, and below it put the call to animations.
add() seen below: ball = game.
add.sprite(50, 250, 'ball'); ball.animations.
add('wobble', [0,1,0,2,0,1,0,2,0], 24); to
add an animation to the object we use the animations.
add() method, which contains the following parameters the name we chose for the animation an array defining the order in which to display the frames during the animation. if you look again at the wobble.png image, you'll see ...
...'ll see there are three frames. phaser extracts these and stores references to them in an array — positions 0, 1, and 2. the above array says that we are displaying frame 0, then 1, then 0, etc. the framerate, in fps. since we are running the animation at 24fps and there are 9 frames, the animation will display just under three times per second. applying the animation when the ball hits the p
addle in the arcade.collide() method call that handles the collision between the ball and the p
addle (the first line inside update(), see below) we can
add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function. update the first line inside update() as shown below: function update() { game.physics.arcade.c...
...ade.collide() method call that handles the collision between the ball and the p
addle (the first line inside update(), see below) we can
add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function. update the first line inside update() as shown below: function update() { game.physics.arcade.collide(ball, p
addle, ballhitp
addle); game.physics.arcade.collide(ball, bricks, ballhitbrick); p
addle.x = game.input.x || game.world.width*0.5; } then we can create the ballhitp
addle() function (having ball and p
addle as default parameters), playing the wobble animation when it is called. ...
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
or nothing." however, — every improvement you can make will help the cause of accessibility. text content one of the best accessibility aids a screen reader user can have is an excellent content structure with headings, paragraphs, lists, etc. an excellent semantic example might look something like the following: <h1>my heading</h1> <p>this is the first section of my document.</p> <p>i'll
add another paragraph here too.</p> <ol> <li>here is</li> <li>a list for</li> <li>you to read</li> </ol> <h2>my subheading</h2> <p>this is the first subsection of my document. i'd love people to be able to find this content!</p> <h2>my 2nd subheading</h2> <p>this is the second subsection of my content. i think is more interesting than the last one.</p> we've prepared a version with longer...
...g 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><br> i'll
add another paragraph here too. <br><br> 1. here is <br><br> 2. a list for <br><br> 3. you to read <br><br> <font size="5">my subheading</font> <br><br> this is the first subsection of my document. i'd love people to be able to find this content! <br><br> <font size="5">my 2nd subheading</font> <br><br> this is the second subsection of my content. i think is more interesting than the last one. if yo...
...a tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users.
additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. you can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>header</h1> </header> <nav> <!-- main navigation in here --> </nav> <!-- here is our page's main content --> <main> ...
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
or nothing." however, — every improvement you can make will help the cause of accessibility. text content one of the best accessibility aids a screen reader user can have is an excellent content structure with headings, paragraphs, lists, etc. an excellent semantic example might look something like the following: <h1>my heading</h1> <p>this is the first section of my document.</p> <p>i'll
add another paragraph here too.</p> <ol> <li>here is</li> <li>a list for</li> <li>you to read</li> </ol> <h2>my subheading</h2> <p>this is the first subsection of my document. i'd love people to be able to find this content!</p> <h2>my 2nd subheading</h2> <p>this is the second subsection of my content. i think is more interesting than the last one.</p> we've prepared a version with longer...
...g 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><br> i'll
add another paragraph here too. <br><br> 1. here is <br><br> 2. a list for <br><br> 3. you to read <br><br> <font size="5">my subheading</font> <br><br> this is the first subsection of my document. i'd love people to be able to find this content! <br><br> <font size="5">my 2nd subheading</font> <br><br> this is the second subsection of my content. i think is more interesting than the last one. if yo...
...a tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users.
additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. you can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>header</h1> </header> <nav> <!-- main navigation in here --> </nav> <!-- here is our page's main content --> <main> ...
...And 8 more matches
Supporting older browsers - Learn web development
o provide support for your layouts on older browsers that might not support the features you want to use. what is the browser landscape for your site? every website is different in terms of target audience. before deciding on the approach to take, find out the number of visitors coming to your site using older browsers. this is straightforward if you have an existing website which you are
adding to or replacing, as you probably have analytics available which can tell you the technology people are using. if you have no analytics or this is a brand new site, then there are sites such as statcounter that can provide statistics filtered by location. you should also consider the type of devices and the way people use your site, for example, you may expect a higher than an average number o...
...ed item that becomes a grid item loses the float behaviour, which means that by turning the wrapper into a grid container, the floated items become grid items. if the browser supports grid layout it will display the grid view, if not it ignores the display: grid and related properties and the floated layout is used. ...
...ports grid layout it will display the grid view, if not it ignores the display: grid and related properties and the floated layout is used. * {box-sizing: border-box;} .wrapper { background-color: rgb(79,185,227); p
adding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; background-color: rgb(207,232,220); p
adding: 1em; } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <div class="item">item three</div> </div> note: the clear property also has no effect once the cleared item becomes a grid item, so you could have a layout with a cleared footer, which is then turned into a grid layout. fallback methods there are a number of layout methods which can...
...And 8 more matches
Fundamental text and font styling - Learn web development
courier new monospace some oses have an alternative (possibly older) version of the courier new font called courier. it's considered best practice to use both with courier new as the preferred alter...
... provide something 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 previous 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 h...
...tions on fonts (you'll mainly use this to unset the default underline on links when styling them.) available values are: none: unsets any text decorations already present. underline: underlines the text. overline: gives the text an overline. line-through: puts a strikethrough over the text. ...
...And 8 more matches
Advanced form styling - Learn web development
px auto; max-width: 400px; } form > div { margin-bottom: 20px; } select { -webkit-appearance: none; appearance: none; } .select-wrapper { position: relative; } .select-wrapper::after { content: "▼"; font-size: 1rem; top: 6px; right: 10px; position: absolute; } button, label, input, select, progress, meter { display: block; font-family: inherit; font-size: 100%; p
adding: 0; margin: 0; box-sizing: border-box; width: 100%; p
adding: 5px; height: 30px; } input[type="text"], input[type="datetime-local"], input[type="color"], select { box-shadow: inset 1px 1px 3px #ccc; border-radius: 5px; } label { margin-bottom: 5px; } button { width: 60%; margin: 0 auto; } note: if you want to test these examples across a number of browsers simultaneousl...
... input[type="text"], input[type="datetime-local"], input[type="color"], select { box-shadow: inset 1px 1px 3px #ccc; border-radius: 5px; } label { margin-bottom: 5px; } button { width: 60%; margin: 0 auto; } note: if you want to test these examples across a number of browsers simultaneously, you can find it live here (also see here for the source code). also bear in mind that we've
added some javascript to the page that lists the files selected by the file picker, below the control itself. this is a simplified version of the example found on the <input type="file"> reference page. as you can see, we've done fairly well at getting these to look uniform across modern browsers. we've applied some global normalizing css to all the controls and their labels, to get them to size i...
.... as you can see, we've done fairly well at getting these to look uniform across modern browsers. ...
...And 8 more matches
Build your own function - Learn web development
is fine, as you can tell them apart — function names appear with parentheses after them, and variables don't. start by accessing the function-start.html file and making a local copy. you'll see that the html is simple — the body contains just a single button. we've also provided some basic css to style the custom message box, and an empty <script> element to put our javascript in. next,
add the following inside the <script> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function. this is followed by the name we want to give to our function, a set of parentheses, and a set of curly braces. any parameters we want to give to our function go inside the parentheses, and the code that runs when we call the function goes in...
...> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function. this is followed by the name we want to give to our function, a set of parentheses, and a set of curly braces. any parameters we want to give to our function go inside the parentheses, and the code that runs when we call the function goes inside the curly braces. ...
... appear again! so this is fun — we now have a reusable function that we can call any time we like. but we probably want it to appear in response to user and system actions. ...
...And 8 more matches
Looping code - Learn web development
canvas.height = height; function random(number) { return math.floor(math.random()*number); } function draw() { ctx.clearrect(0,0,width,height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } btn.
addeventlistener('click',draw); </script> </body> </html> you don't have to understand all the code for now, but let's look at the part of the code that actually draws the 100 circles: for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } random(x), defined earlier...
..., which is cats[whatever i is at the time]) along with a comma and space, onto the end of the info variable. so: during the first run, i = 0, therefore cats[0] + ', ' (which is equal to bill, ) will be concatenated onto info. during the second run, i = 1, so cats[1] + ', ' (which is equal to jeff, ) will be concatenated onto info. and so on. after each time the loop has run, 1 will be
added to i (i++), then the process will start again. when i becomes equal to cats.length (in this case, 5), the loop will stop, and the browser will move on to the next bit of code below the loop. note: we have made the condition i < cats.length, not i <= cats.length, because computers count from 0, not 1 — we are starting i at 0, and going up to i = 4 (the index of the last array item). c...
...sults in: <label for="search">search by contact name: </label> <input id="search" type="text"> <button>search</button> <p></p> now on to the javascript: const contacts = ['chris:2232322', 'sarah:3453456', 'bill:7654322', 'mary:9998769', 'dianne:9384975']; const para = document.queryselector('p'); const input = document.queryselector('input'); const btn = document.queryselector('button'); btn.
addeventlistener('click', function() { let searchname = input.value.tolowercase(); input.value = ''; input.focus(); for (let i = 0; i < contacts.length; i++) { let splitcontact = contacts[i].split(':'); if (splitcontact[0].tolowercase() === searchname) { para.textcontent = splitcontact[0] + '\'s number is ' + splitcontact[1] + '.'; break; } else { para.textconten...
...And 8 more matches
Fetching data from the server - Learn web development
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 the poem (which you may well recognize) via xhr when it's selected in the drop-down menu. just inside the <script> element,
add the following code. this stores a reference to the <select> and <pre> elements in constants and defines an onchange event handler function so that when the select'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(...
...different value in a value attribute) — so for example "verse 1". the corresponding verse text file is "verse1.txt", and is in the same directory as the html file, therefore just the file name will do. however, web servers tend to be case sensitive, and the file name doesn't have a space in it. to convert "verse 1" to "verse1.txt" we need to convert the v to lower case, remove the space, and
add .txt on the end. this can be done with replace(), tolowercase(), and simple string concatenation.
add the following lines inside your updatedisplay() function: verse = verse.replace(" ", ""); verse = verse.tolowercase(); let url = verse + '.txt'; to begin creating an xhr request, you need to create a new request object using the xmlhttprequest() constructor. you can call this object anyt...
..., and simple string concatenation.
add the following lines inside your updatedisplay() function: verse = verse.replace(" ", ""); verse = verse.tolowercase(); let url = verse + '.txt'; to begin creating an xhr request, you need to create a new request object using the xmlhttprequest() constructor. you can call this object anything you like, but we'll call it request to keep things simple.
add the following below your previous lines inside your updatedisplay() function: let request = new xmlhttprequest(); next, you need to use the open() method to specify what http request method to use to request the resource from the network, and what its url is. we'll just use the get method here and set the url as our url variable. ...
...And 8 more matches
Object building practice - Learn web development
const num = math.floor(math.random() * (max - min + 1)) + min; return num; } this function takes two numbers as arguments, and returns a random number in the range between the two. modeling a ball in our program our program will feature lots of balls bouncing around the screen. since these balls will all behave in the same way, it makes sense to represent them with an object. let's start by
adding the following constructor to the bottom of our code. function ball(x, y, velx, vely, color, size) { this.x = x; this.y = y; this.velx = velx; this.vely = vely; this.color = color; this.size = size; } here we include some parameters that define the properties each ball needs in order to function in our program: x and y coordinates — the horizontal and vertical coordinates whe...
...ction in our program: x and y coordinates — the horizontal and vertical coordinates where the ball starts on the screen. this can range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). ...
...ty; in real terms these values are regularly
added to the x/y coordinate values when we animate the balls, to move them by this much on each frame. color — each ball gets a color. size — each ball gets a size — this is its radius, in pixels. this handles the properties, but what about the methods? we want to get our balls to actually do something in our program. drawing the ball first
add the following draw() method to the ball()'s prototype: ball.prototype.draw = function() { ctx.beginpath(); ctx.fillstyle = this.color; ctx.arc(this.x, this.y, this.size, 0, 2 * math.pi); ctx.fill(); } using this function, we can tell the ball to draw itself onto the screen, by calling a series of members of the 2d canvas context we defined earlier (ctx). the context is like the paper, a...
...And 8 more matches
Getting started with Vue - Learn web development
rop-in replacement for a library like jquery. that being said, you can also use vue to write entire single page applications (spas). this allows you to create markup managed entirely by vue, which can improve developer experience and performance when dealing with complex applications. it also allows you to take advantage of libraries for client-side routing and state management when you need to. ...
...like most frameworks, vue lets you create reusable blocks of markup via components. most of the time, vue components are written using a special html template syntax. ...
......
...And 8 more matches
Handling common accessibility problems - Learn web development
aragraphs for your content; this is because screen reader users tend to use the headings of a document as signposts to find the content they need more quickly. if your content has no headings, all they will get is a huge wall of text with no signposts to find anything. examples of bad and good html: <font size="7">my heading</font> <br><br> this is the first section of my document. <br><br> i'll
add another paragraph here too. <br><br> <font size="5">my subheading</font> <br><br> this is the first subsection of my document. i'd love people to be able to find this content! <br><br> <font size="5">my 2nd subheading</font> <br><br> this is the second subsection of my content. i think it is more interesting than the last one. <h1>my heading</h1> <p>this is the first section of my document.</p>...
...aragraph here too. <br><br> <font size="5">my subheading</font> <br><br> this is the first subsection of my document. i'd love people to be able to find this content! <br><br> <font size="5">my 2nd subheading</font> <br><br> this is the second subsection of my content. i think it is more interesting than the last one. ...
... as a test, you can turn off a site's css and see how understandable it is without it. ...
...And 8 more matches
Handling common HTML and CSS problems - Learn web development
previous overview: cross browser testing next 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 prevent problems from happening, or fix problems that occur. 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. the trouble with html and css ...
...ut only in old versions of ie that don't recognise them (so, ie 8 and lower). this way new browsers can just use the code as normal, but older ie versions will be able to style these elements too. note: see ie conditional comments for the best way to do this. more complex elements like html <video>, <audio>, and <canvas> (and other features besides) have natural mechanisms for fallbacks to be
added, which work on the same principle as described above. you can
add fallback content in between the opening and closing tags, and non-supporting browsers will effectively ignore the outer element and run the nested content. for example: <video id="video" controls preload="metadata" poster="img/poster.jpg"> <source src="video/tears-of-steel-battle-clip-medium.mp4" type="video/mp4"> <source s...
...pacity on hover to give the user a hint that the button is interactive, and some semi-transparent inset box-shadow shades to give the button a bit of texture and depth. the trouble is that rgba colors and box shadows don't work in ie versions older than 9 — in older versions the background just wouldn't show up at all so the text would be unreadable, no good at all! to sort this out, we have
added a second background-color declaration, which just specifies a hex color — this is supported way back in really old browsers, and acts as a fallback if the modern shiny features don't work. what happens is a browser visiting this page first applies the first background-color value; when it gets to the second background-color declaration, it will override the initial value with this value if it...
...And 8 more matches
Eclipse CDT
olchain for mozilla development. this plugin is intended mainly for managed projects but we use an unmanaged project for mozilla (since it has its own build system). using this plugin will result in parts of the ui described below being hidden or disabled. download "eclipse ide for c/c++ developers" (not eclipse ide for enterprise java developers) from the eclipse download page, install it, and
add the directory containing the eclipse binary to your path (/applications/eclipse.app/contents/eclipse/ on mac). (while package managers like snap sometimes provide an eclipse package, they do not include the c++ developer tools. since it's a pain to install them and keep them up to date we do not recommend getting eclipse this way.) increase eclipse's memory limits! make sure you do this! be...
...t side of the window. to rebuild for changes in an individual directory (for example, to take account of some changes that you yourself made) select "index > freshen all files" on that directory. to rebuild the entire index (for example when you pull from mozilla-central) select "index > rebuild" on the project root. usage tips below are some of the more useful user tips. (if you're thinking of
adding tips, please first consider how widely useful they'll be before
adding to this already lengthy page.) for further documentation see the official eclipse user guide and eclipse cdt user guide. keyboard shortcuts regarding key bindings (keyboard shortcuts), the bindings given below are the defaults. you can change the key bindings by opening the workspace preferences (eclipse > preferences, or...
...r source directory instead of invoking 'make' from your object directory, then in the "c/c++ build" section of the project properties, set "build command" to "make -f client.mk" and set "build directory" to just "${projdirpath}" (this is the top of the source tree). select the behavior tab and remove the "all" from the "build (incremental build)" field. select "c/c++ build > build variables", and
add a variable "mozconfig", and set it to the path of your .mozconfig file relative to the top source directory. set any other environment variables you want to set for the build, then close the project properties window. now when you hit the build button (the little hammer icon), you should see the source build in the console tab at the bottom of the window. the benefit of building from inside ecl...
...And 8 more matches
Eclipse CDT Manual Setup
efore creating a project in that workspace: in "general > workspace", disable "build automatically" in "c/c++ > indexer", disable "automatically update the index" turning off automatic indexing prevents the cpu intensive indexer from running at various stages during the steps below before we're ready. 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 eclipse a chance of expanding its understanding of the source into the objective-c files. select "general > editors > text editors". if you want line numbers, tick "show line numbers". if you want a colu...
...e" and select "refresh using native hooks or polling" and "refresh on access" to prevent 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 rules. download this first pass at an eclipse formatter configuration for mozilla c/c++ coding style, and install it by opening the workspace preferences, selecting "c/c++ > code style > formatter", and then using the "import" button to import that file. the "active profile" field should then automatically change to...
...ntinue with the steps below. (if an "indexing" item starts after the "refreshing the workspace" item has finished, click the little red box beside that item to cancel it, since we want to configure the project before the indexer runs.) initial project properties so that the indexer will run faster and give better results, and so that eclipse doesn't give results for irrelevant files, you should
add some resource filters to have eclipse ignore certain non-source files and directories. note, you must not make eclipse ignore your (main) object directory. that object directory is needed to resolve include paths to the various headers that the build process generates/copies there. to create resource filters, open the project properties (different to the workspace preferences!) by selecting prop...
...And 8 more matches
Multiple Firefox profiles
web developers might want a secondary profile for testing websites, apps, or other projects on different firefox channels. ...
...ed into their copy of firefox. you can find details about profiles on mozilla's end-user support site. reasons to have multiple profiles the casual user may want to have different profiles for work and personal use, or different family members. ...
...e, or allow each family member to have his or her own set of bookmarks, settings, and
add-ons. web developers might want a secondary profile for testing websites, apps, or other projects on different firefox channels. for example, you might want to have some extensions installed for web development, but not for general-purpose web browsing. while using the nightly channel, you may encounter some
add-ons that have become temporarily incompatible with new api changes, until the
add-on developer has a chance to update them. you can remove such
add-ons from your profile for nightly use while keeping them for use with other profiles. for qa, testing, and bug triaging contributors, you may want to have multiple development versions of firefox installed, each with its own profile. creating new pro...
...And 8 more matches
Message manager overview
ct access to content into separate scripts, which are called "frame scripts" use a frame message manager to load these frame scripts into the content process use the frame message manager api to communicate with the frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts". this usage is deprecated because the
add-on sdk uses "content script" to refer to a similar but different kind of script. so fundamentally, frame message managers enable chrome code to: load a script into a frame (essentially, a single browser tab) in the content process. these scripts are called "frame scripts". communicate with frame scripts using message-passing apis there are various types of frame message managers, as depic...
... and is then delivered to any frame scripts that are listening for it. ...
...ager, it gets sent to all content tabs in that window. ...
...And 8 more matches
source-editor.jsm
osed through source-editor.jsm. ...
...you can then use this value to detect when t...
... array getbreakpoints(); boolean removebreakpoint(number alineindex); properties attribute type description dirty boolean set this value to false whenever you save the text; the editor will update it to true when the content is changed. you can then use this value to detect when the contents of the text are different from your most recent save. in
addition, when this value changes, the "dirtychanged" event is sent. 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 findprevious() method. read only. ...
...And 8 more matches
Investigating leaks using DMD heap scan mode
steps you need to reproduce your leak. if your leak is a ghost window, it can be handy to get an about:memory report and write down the pid of the leaking process. you may want to wait 10 or so seconds after this to make sure as much as possible is cleaned up. next, exit the browser. this will cause a lot of logs to be written out, so it can take a while. analyzing the logs getting the pid and
address of the leaking object the first step is to figure out the pid of the leaking process. the second step is to figure out the
address of the leaking object, usually a window. conveniently, you can usually do both at once using the cycle collector log. if you are investigating a leak of www.example.com, then from $logdir you can do "grep nsglobalwindow cc-edges* | grep example.com". this looks t...
...ut that looks something like this: cc-edges.15873.log:0x7f0897082c00 [rc=1285] nsglobalwindowinner # 2147483662 inner https://www.example.com/ * cc-edges.15873.log: the first part is the file name where it was found. 15873 is the pid of the process that leaked. you'll want to write down the name of the file and the pid. let's call the file $cclog and the pid $pid. * 0x7f0897082c00: this is the
address of the leaking window. you'll also want to write that down. let's call this $win
addr. if there are multiple files, you'll end up with one that looks like cc-edges.$pid.log and one or more that look like cc-edges.$pid-$n.log for various values of $n. you want the one with the largest $n, as this was recorded the latest, and so it will contain the least non-garbage. identifying the root in th...
... want the one with the largest $n, as this was recorded the latest, and so it will contain the least non-garbage. identifying the root in the cycle collector log the next step is to figure out why the cycle collector could not collect the window, using the find_roots.py script from the heapgraph repository. the command to invoke this looks like this: python $heapgraph/find_roots.py $cclog $win
addr this may take a few seconds. it will eventually produce some output. you'll want to save a copy of this output for later. the output will look something like this, after a message about loading progress: 0x7f0882fe3230 [fragmentorelement (xhtml) script https://www.example.com] --[[via hash] mlistenermanager]--> 0x7f0899b4e550 [eventlistenermanager] --[mlisteners event=onload listene...
...And 8 more matches
Refcount tracing and balancing
refcount balancing is a follow-up step that analyzes the resulting log to help a developer figure out where refcounting went wrong. ...
...ogs are large and expensive to capture, so you probably don't want to do that. warning: you should never use this without xpcom_mem_log_classes and/or xpcom_mem_log_objects, because without some filtering the logging will be completely useless due to how slow the browser will run and how large the logs it produces will be. ...
...ging will be completely useless due to how slow the browser will run and how large the logs it produces will be. xpcom_mem_comptr_log this environment variable enables logging of
additions and releases of objects into nscomptrs. this requires c++ dynamic casts, so it is not supported on all platforms. however, having an nscomptr log and using it in the creation of the balance tree allows
addref and release calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic. ...
...And 8 more matches
NSS tools : crlutil
he password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create,
add to a database, modify, or validate. bracket the nickname string with quotation marks if it contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type...
...u url specify the url. crl generation script syntax crl generation script file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...crl generation script file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...And 8 more matches
NSS tools : crlutil
rtificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create,
add to a database, modify, or validate. bracket the nickname string with quotation marks if it contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -t ...
...rl. crl generation script syntax crl generation script file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...t file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). ...
...And 8 more matches
Tutorial: Embedding Rhino
. in this document, javascript code will be in green, java code will be in green, and shell logs will be in purple. ...
...all it does it read a script from the command line, execute it, and print a result. ...
...ontext.exit(); } exits the context. this removes the association between the context and the current thread and is an essential cleanup action. there should be a call to exit for every call to enter. to make sure that it is called even if an exception is thrown, it is put into the finally block corresponding to the try block starting after context.enter(). expose java apis using java apis no
additional code in the embedding needed! the javascript feature calledliveconnect allows javascript programs to interact with java objects: $ java runscript "java.lang.system.out.println(3)" 3.0 undefined implementing interfaces using rhino, javascript objects can implement arbitrary java interfaces. there's no java code to write -- it's part of rhino's liveconnect implementation. for example, we...
...And 8 more matches
SpiderMonkey 38
js::truehandlevalue (bug 959787) jsconstintegerspec (bug 1066020) jsid_is_symbol (bug 645416) jsid_to_symbol (bug 645416) jsprop_define_late (bug 825199) jsprop_ignore_enumerate (bug 1037770) jsprop_ignore_permanent (bug 1037770) jsprop_ignore_readonly (bug 1037770) jsprop_ignore_value (bug 1037770) jsprop_propop_accessors (bug 1088002) jsprop_redefine_nonconfigurable (bug 1101123) js_
addfinalizecallback (bug 996785) js_defineconstintegers (bug 1066020) js_getflatstringcharat (bug 1034627) js_getfunctionscript (bug 1069694) js_getlatin1flatstringchars (bug 1037869) js_getlatin1internedstringchars (bug 1037869) js_getlatin1stringcharsandlength (bug 1032726) js_getstringcharat (bug 1034627) js_gettwobyteexternalstringchars (bug 1034627) js_gettwobyteflatstringchars (bug 103...
...ndlength (bug 1032726) js_newplainobject (bug 1125356) js_removefinalizecallback (bug 996785) js_self_hosted_sym_fn (bug 1082672) js_sym_fn (bug 1082672) js_sym_fnspec (bug 1082672) js_stringhaslatin1chars (bug 1032726) js_stringisflat (bug 1037869) js_stringtoid (bug 959787) propertydefinitionbehavior (bug 825199) symbol_to_jsid (bug 645416) obsolete apis ... ...
...ect (bug 1125356) js_removefinalizecallback (bug 996785) js_self_hosted_sym_fn (bug 1082672) js_sym_fn (bug 1082672) js_sym_fnspec (bug 1082672) js_stringhaslatin1chars (bug 1032726) js_stringisflat (bug 1037869) js_stringtoid (bug 959787) propertydefinitionbehavior (bug 825199) symbol_to_jsid (bug 645416) obsolete apis ... ...
...And 8 more matches
Animated PNG graphics
authors the apng specification was authored by: stuart parmenter <pavlov@pavlov.net> vladimir vukicevic <vladimir@pobox.com> andrew smith <asmith15@littlesvr.ca> overview apng is an extension of the portable network graphics (png) format,
adding support for animated images. it is intended to be a replacement for simple animated images that have traditionally used the gif format, while
adding support for 24-bit images and 8-bit transparency. apng is a simpler alternative to mng, providing a spec suitable for the most common usage of animated images on the internet. apng is backwards-compatible with png; any png decoder should be able to ignore the apng-specific chunks and display a single image. terminology the default image is the image described by the standard 'idat' chunks, an...
...hen 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 as an apng, an 'actl' chunk must appear in the stream before any 'idat' chunks. the 'actl' structure is described below. conceptually, at the beginning of each play the output buffer must be completely initialized to a fully transparent black rectangle, with width and height dimensions from the 'ih...
...ceded by a sequence number. information for each frame about placement and rendering is stored in 'fctl' chunks. the full layout of 'fdat' and 'fctl' chunks is described below. the boundaries of the entire animation are specified by the width and height parameters of the png 'ihdr' chunk, regardless of whether the default image is part of the animation. the default image should be appropriately p
added with fully transparent pixels if extra space will be needed for later frames. each frame is identical for each play, therefore it is safe for applications to cache the frames. chunk sequence numbers the 'fctl' and 'fdat' chunks have a 4 byte sequence number. both chunk types share the sequence. the purpose of this number is to detect (and optionally correct) sequence errors in an animated pn...
...And 8 more matches
XPCOM array guide
uide describes the available arrays as well as the enumerator classes that can be used to get to them. in this document the term array refers to a container for multiple objects with a numeric, zero-based index. the standard array classes are: nsiarray - a scriptable container for scriptable xpcom objects. this array is read-only, and the interface does not provide any methods that will allow
adding and removing members. nsimutablearray - a scriptable container for scriptable xpcom objects, which allows
addition and removal of member objects. this interface actually derives from nsiarray. nstarray<t> - a c++ class which provides a typesafe container for objects or primitive types (pointers, integers, and so on). the objects must define a default constructor and a copy constructor. to us...
...ment in the array. for most concrete c++ classes like nstarray<t> and nscomarray<t>, indexing should be faster than the callback-style enumeration, because accessing an indexed member of such an array is usually very fast, while enumeration has slight function call overhead. in the case of scriptable arrays like nsiarray however, the enumeration mechanism is often preferred because it avoids the
addref / release overhead that comes from accessing each object. the only functional drawback to in-place enumeration is that you cannot manipulate the array itself during the enumeration. for example, you should not delete elements of an array during the enumeration as this will often confuse the loop which is enumerating the array. enumerators most arrays provide access to an object which is use...
...t id "@mozilla.org/array;1". the created array implements nsimutablearray and nsiarray. since nsimutablearray derives from nsiarray, the resulting array can be cast to a read-only array. c++ example void getlist(nsiarray** aresult) { nscomptr<nsimutablearray> array = do_createinstance(ns_array_contractid); // append some elements ... // return it to the caller *aresult = array; ns_
addref(*aresult); } javascript example function getlist() { var array = components.classes["@mozilla.org/array;1"] .createinstance(components.interfaces.nsimutablearray); // append some elements ... // return it to the caller return array; } access to elements since nsiarray is a regular xpcom object, its interfaces follows the standard conventions of ownershi...
...And 8 more matches
Creating the Component Code
rogram registers the component in the default component registry. we suggest that when you are testing your component in the mozilla or netscape client, you copy your component into the components directory in the client's installation folder. when it is copied there, run regxpcom from the command line to register that component and all the others in that directory. several new options have been
added to regxpcom in versions 1.4 and later. you can run regxpcom with the -h option to see full usage options. registration alternatives a gecko embedding application may provide other ways 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 w...
...to support contractual relationships between the client and component interfaces. the variable kifactoryiid, for example, provides methods like equals() that can be used to facilitate comparisons in the code, as in the following example from the mozilla source: using class methods to handle identifiers if (aiid.equals(ns_get_iid(nsisupports))) { *ainstanceptr = (void*)(nsisupports*)this; ns_
addref_this(); return ns_ok; } finally, sample_cid is an example of a cid that uniquely identifies the component. all of the 128-bit numbers used in xpcom - the class and the interface ids - are examples of uuids, or universal unique identifiers, which were discussed in object interface discovery. generating cids to generate a cid for your component, you can use the uuidgen tool that comes wit...
...sifile *alocation, const char *aloaderstr, const char *atype) = 0; ns_imethod unregisterself(nsicomponentmanager *acompmgr, nsifile *alocation, const char *aloaderstr) = 0; registerself is called when a component is first registered with xpcom. it is only called once, which gives you a chance to
add any one time setup functionality. the registerself call allows your component to tell xpcom exactly what it supports. note that whatever you do in registerself should be undone in unregisterself. first, the nsgetmodule entry point is called in your component library, and it returns an interface pointer to a nsimodule implementation. then xpcom calls registerself, passing parameters that we'll ex...
...And 8 more matches
How to build a binary XPCOM component using Visual Studio
intools.zip download the sample project here is what the folder structure looks like: create a vc++ project visual studio project and file templates (or wizards) for creating xpcom modules and components do not currently exist. for now, you can use the included xpcom project that contains a simple xpcom component. ...
... and file templates (or wizards) for creating xpcom modules and components do not currently exist. for now, you can use the included xpcom project that contains a simple xpcom component. you can use the project as a starting point and modify the component files to
add your own functionality. to make the project, you start with a standard multi-thread dll project. ...
...s) for creating xpcom modules and components do not currently exist. for now, you can use the included xpcom project that contains a simple xpcom component. you can use the project as a starting point and modify the component files to
add your own functionality. to make the project, you start with a standard multi-thread dll project. ...
...And 8 more matches
Observer Notifications
owglobalparent called just after a windowglobalparent is initialized. a windowglobal actor has a lifetime matching that of an nsglobalwindowinner. window-global-destroyed windowglobalparent called just before a windowglobalparent is destroyed. by this point, the wgp being destroyed will have cleaned up most of its state, including its browsingcontext children and jswindowactors.
additionally, it will have been removed from any windowcontext tree it was part of. io notifications these topics can be used to watch the io service for useful information. topic description offline-requested called to query whether the application can go offline. the attempt to go offline can be canceled. note: if your code chooses to cancel the attempt to go of...
...n a response will be read completely from the cache. headers are available on the channel. http-on-examine-merged-response called instead of http-on-examine-response when a response will be read partially from cache, and partially from the network (http 206 or 304 response). headers are available on the channel. ...
... be read partially from cache, and partially from the network (http 206 or 304 response). headers are available on the channel. cookies these topics indicate whenever a cookie has been changed (
added, changed, cleared, or deleted) or its setting rejected by the browser. see nsicookieservice for details. topic description cookie-changed called upon a cookie change (
added, changed, cleared, or deleted) cookie-rejected called when the setting of a cookie was rejected by the browser (per the user's preferences) http-on-response-set-cookie this is fired only when a cookie is created due to the presence of set-cookie header in the response header of any network request. this notification will come only after the "http-on-examine...
...And 8 more matches
nsIHTMLEditor
editor/idl/nsihtmleditor.idlscriptable please
add a summary to this article. ...
... editor/idl/nsihtmleditor.idlscriptable please
add a summary to this article. ...
... editor/idl/nsihtmleditor.idlscriptable please
add a summary to this article. ...
...And 8 more matches
Creating a Custom Column
one of the new and exciting features available to thunderbird extension developers in thunderbird 2.0 is the ability to easily create and handle custom columns in thunderbird's main view. the following step through will get you well on the road to creating your own columns and populating them with custom data. getting started in this example we will be developing a small extension that will be
adding a column that will display the "reply-to:" field of an email (if it exists, it if often not set). if you are unfamiliar with the setup and creation of an extension please read building a thunderbird extension.
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 c...
...ine 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 something similar to this: <?xml version="1.0"?> <overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"...
...tion(hdr) {return 0;} } basically, all we are doing here is making sure that both the text that is displayed to the user (getcelltext()) and the string we sort according to (when the user decided to sort the view by our custom column) are identical. putting the pieces together we now have our column and our handler object - it's time to put everything together. ...
...And 8 more matches
customDBHeaders Preference
describe the process i went through in developing a custom column to display a 'superfluous' column within thunderbird's main view. the data will come from a custom header labeled x-superfluous. setting the preferences although there are various ways to set preferences, i tend to just navigate to the directory where my profile is stored and edit the user.js file with my favorite text editor. ...
...within thunderbird's main view. the data will come from a custom header labeled x-superfluous. setting the preferences although there are various ways to set preferences, i tend to just navigate to the directory where my profile is stored and edit the user.js file with my favorite text editor. ...
...m a custom header labeled x-superfluous. setting the preferences although there are various ways to set preferences, i tend to just navigate to the directory where my profile is stored and edit the user.js file with my favorite text editor. in
addition to the preference outlined in setting up extension development environment, you'll want to
add the following preferences: // this allows you to
add extra headers while composing messages user_pref("mail.compose.other.header", "x-superfluous,x-other,x-whatever"); // this enables the preservation of custom headers as incoming mail is processed user_pref( "mailnews.customdbheaders", "x-superfluous,x-other"); important: please pay careful attention to the case of the mailnews.customdbheaders preference. because comparisons are case-insensitive...
...And 8 more matches
Zombie compartments
this page tells you how to detect and avoid zombie compartments, which are a particular kind of memory leak. they can be caused by bugs in firefox itself, or by bugs in firefox
add-ons. compartments firefox’s javascript memory is segregated into zones and compartments. roughly speaking, all memory used by javascript code that is from a particular origin (i.e. website) goes into its own compartment. firefox’s own javascript code also gets one or more compartments and so do
add-on scripts. multiple compartments can share a zone, where a zone keeps track of things that can easily and securely be shared between related compartments such as string data and type information. viewing live compartments if you want to see a list of live compartments, type "about:memory" into the ad...
...s that can easily and securely be shared between related compartments such as string data and type information. viewing live compartments if you want to see a list of live compartments, type "about:memory" into the
address bar and click on the measure button. in the results, you'll find a js-main-runtime-compartments tree (whcih you may need to expand further) that lists all system (firefox and
add-ons) and user (website) compartments, these compartments are also listed in more detail in the explicit allocations section. that more fine-graned representation may look like this │ ├───28.45 mb (05.71%) -- top(https://www.google.de/, id=141) │ │ ├──13.66 mb (02.74%) -- active/window(https://www.google.de/) │ │ │ ├───7.83 mb (01.57%) -- js-compartment(h...
... compartments, dom etc. when are compartments created? any compartments with the following forms are created by firefox for its own internal use, and can usually be ignored when looking for zombie compartments. js-compartment([system principal], 0x7f10f1250000) compartment(atoms) js-compartment(about:home) js-compartment(about:blank) compartment([system principal], resource://gre/modules/
addons/xpiprovider.jsm) when looking at user compartments there are a couple of things to be aware of. first, many sites utilize scripts from other sites to provide advertisements, "like" and "+1" buttons, twitter feeds, etc. so it's common for multiple compartments to be created for a single web page. for example, if i open www.techcrunch.com the following compartments are created. compartme...
...And 8 more matches
Browser Console - Firefox Developer Tools
onsole is like the web console, but applied to the whole browser rather than a single content tab. so it logs the same sorts of information as the web console - network requests, javascript, css, and security errors and warnings, and messages explicitly logged by javascript code. however, rather than logging this information for a single content tab, it logs information for all content tabs, for
add-ons, and for the browser's own code. if you also want to use the other web developer tools in the regular web toolbox with
add-on or browser code, consider using the browser toolbox. similarly, you can execute javascript expressions using the browser console. but while the web console executes code in the page window scope, the browser console executes them in the scope of the browser's chrome ...
...f the browser's chrome window. this means you can interact with all the browser's tabs using the gbrowser global, and even with the xul used to specify the browser's user interface. nb: the browser console command line (to execute javascript expressions) is disabled by default. to enable it set the devtools.chrome.enabled preference to true in about:config, or set the "enable browser chrome and
add-on debugging toolboxes" (firefox 40 and later) option in the developer tool settings. opening the browser console you can open the browser console in one of two ways: from the menu: select "browser console" from the web developer submenu in the firefox menu (or tools menu if you display the menu bar or are on macos). from the keyboard: press ctrl+shift+j (or cmd+shift+j on a mac). you c...
...b console: http requests warnings and errors (including javascript, css, security warnings and errors, and messages explicitly logged by javascript code using the console api). input/output messages: commands send to the browser via the command line, and the result of executing them. however, it displays such messages from: web content hosted by all browser tabs the browser's own code
add-ons. messages from
add-ons the browser console displays messages logged by all firefox
add-ons. console.jsm to use the console api from a traditional or bootstrapped
add-on, get it from the console module. one exported symbol from console.jsm is "console". below is an example of how to access it, which
adds a message to the browser console. components.utils.import("resource://gre/modules/c...
...And 8 more matches
Debugger - Firefox Developer Tools
accessor properties of the debugger prototype object a debugger instance inherits the following accessor properties from its prototype: enabled a boolean value indicating whether this debugger instance’s handlers, breakpoints, and the like are currently enabled. ...
...th a getter and setter: assigning to it enables or disables this debugger instance; reading it produces true if the instance is enabled, or false otherwise. this property is initially true in a freshly created debugger instance. this property gives debugger code a single point of control for disentangling itself from the debuggee, regardless of what sort of events or handlers or “points” we
add to the interface. allowunobservedasmjs a boolean value indicating whether asm.js code running inside this debugger instance’s debuggee globals is invisible to debugger api handlers and breakpoints. setting this to false inhibits the ahead-of-time asm.js compiler and forces asm.js code to run as normal javascript. this is an accessor property with a getter and setter. it is initially false...
... debugging a target javascript program. allowwasmbinarysource a boolean value indicating whether webassembly sources will be available in binary form. the webassembly text generation will be disabled. collectcoverageinfo a boolean value indicating whether code coverage should be enabled inside each debuggee of this debugger instance. changing this flag value will recompile all jit code to
add or remove code coverage instrumentation. changing this flag when any frame of the debuggee is currently active on the stack will produce an 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 co...
...And 8 more matches
Using the CSS Typed Object Model - Web APIs
es an introduction to all of its main features. computedstylemap() with the css typed om api, we can access all the css properties and values — including custom properties — that are impacting an element. let's see how this works by creating our first example, which explores computedstylemap(). we start with some html: a paragraph with a link, as well as a definition list to which we will
add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we
add javascript to grab our unstyled link and return back a definition list of all the default css property values impacting the link using computedstylemap(). // get the element const myelement = document.queryselector('a'); // get the <dl> we'll be populating const styleslis...
...operty values impacting the link using computedstylemap(). ...
...and values. in other browsers, you'll just see a link. did you realize how many default css properties a link had? update the javascript on line 2 to select the <p> rather than the <a>. you'll notice a difference in the margin-top and margin-bottom default computed values. .get() method / custom properties let's update our example to only retrieve a few properties and values. ...
...And 8 more matches
Element.classList - Web APIs
elimited string via element.classname. syntax const elementclasses = elementnodereference.classlist; returns a domtokenlist representing the contents of the element's class attribute. if the class attribute is not set or empty, it returns an empty domtokenlist, i.e. a domtokenlist with the length property equal to 0. ...
...t or empty, it returns an empty domtokenlist, i.e. a domtokenlist with the length property equal to 0. the domtokenlist itself is read-only, although you can modify it using the
add() and remove() methods. ...
...mtokenlist with the length property equal to 0. the domtokenlist itself is read-only, although you can modify it using the
add() and remove() methods. ...
...And 8 more matches
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. ...
...object that specifies characteristics about the event listener. the available options are: capture: a boolean which indicates that events of this type will be dispatched to the registered listener before being dispatched to any eventtarget beneath it in the dom tree. mozsystemgroup: available only in code running in xbl or in firefox' chrome, it is a boolean defining if the listener is
added to the system group. usecapture optional specifies whether the eventlistener to be removed is registered 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 listen...
...apturing 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. ...
...And 8 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
t if you would like more details, you can read the information in the article in depth: microtasks and the javascript runtime environment. tasks a task is any javascript code which is scheduled to be run by the standard mechanisms such as initially starting to run a program, an event callback being run, or an interval or timeout being fired. these all get scheduled on the task queue. tasks get
added to the task queue when: a new javascript program or subprogram is executed (such as from a console, or by running the code in a <script> element) directly. an event fires,
adding the event's callback function to the task queue. a timeout or interval created with settimeout() or setinterval() is reached, causing the corresponding callback to be
added to the task queue. the event loop driv...
...ue very differently. there are two key differences. first, each time a task exits, the event loop checks to see if the task is returning control to other javascript code. if not, it runs all of the microtasks in the microtask queue. the microtask queue is, then, processed multiple times per iteration of the event loop, including after handling events and other callbacks. second, if a microtask
adds more microtasks to the queue by calling queuemicrotask(), those newly-
added microtasks execute before the next task is run. that's because the event loop will keep calling microtasks until there are none left in the queue, even if more keep getting
added. warning: since microtasks can themselves enqueue more microtasks, and the event loop continues processing microtasks until the queue is empt...
... using microtasks before getting farther into this, it's important to note again that most developers won't use microtasks much, if at all. ...
...And 8 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
" id="attack" type="range" min="0" max="1" value="0.2" step="0.1" /> <label for="release">release</label> <input name="release" id="release" type="range" min="0" max="1" value="0.5" step="0.1" /> now we can create some variables over in javascript and have them change when the input values are updated: let attacktime = 0.2; const attackcontrol = document.queryselector('#attack'); attackcontrol.
addeventlistener('input', function() { attacktime = number(this.value); }, false); let releasetime = 0.5; const releasecontrol = document.queryselector('#release'); releasecontrol.
addeventlistener('input', function() { releasetime = number(this.value); }, false); the final playsweep() function now we can expand our playsweep() function. we need to
add a gainnode and connect that through ou...
...st wave: <label for="hz">hz</label> <input name="hz" id="hz" type="range" min="660" max="1320" value="880" step="1" /> <label for="lfo">lfo</label> <input name="lfo" id="lfo" type="range" min="20" max="40" value="30" step="1" /> as before, we'll vary the parameters when the range input values are changed by the user. ...
...fo" id="lfo" type="range" min="20" max="40" value="30" step="1" /> as before, we'll vary the parameters when the range input values are changed by the user. ...
...And 8 more matches
Alerts - Accessibility
the problem you have a form — a contact form, for example — that you want to put some accessible error checking into. examples of common problems include e-mail
addresses which are not valid, or a name field which does not contain at least a first name or a surname. the form first, please read about the aria-required technique if you have not done so, as this technique expands upon that. ...
...st, please read about the aria-required technique if you have not done so, as this technique expands upon that. ...
... if the above criteria is not met, the field’s aria-invalid attribute will be given a value of “true”. if the criteria was...
...And 8 more matches
Operable - Accessibility
navigation must be operable. note: to read the w3c definitions for operable and its guidelines and success criteria, see principle 2: operable — user interface components and navigation must be operable. guideline 2.1 — keyboard accessible: make all functionality available from a keyboard this guideline covers the necessity of making core website functionality available via a keyboard in
addition to other means (e.g. mouse), so that users that rely on keyboard controls can access them. success criteria how to conform to the criteria practical resource 2.1.1 keyboard (a) all functionality should be accessible using keyboard controls, unless it cannot be done using the keyboard (e.g. freehand drawing). built-in controls should be used where possible (e.g...
...keyboard users do not get trapped on specific sections of your apps. 2.1.3 keyboard — all functionality (aaa) this is a further step beyond criterion 2.1.1. to achieve aaa conformance, all functionality should be accessible using keyboard controls — with no exceptions. see ui controls and building keyboard accessibility back in 2.1.4 character key shortcuts (a)
added in 2.1 if a single character key shortcut exists, then at least one of the following is true: single character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus. understanding character key shortcuts note: also see the wcag description for guideline 2.1 keyboard accessible: make all functionality available from a ke...
...terruptions (aaa) any interruptions such as alerts or interstitial adverts should have functionality available to suppress or postpone them, unless it is an emergency alert. 2.2.5 re-authenticating (aaa) if an authentication session expires during usage of a web app, the user can re-authenticate and continue their usage without losing any data. 2.2.6 timeouts (aaa)
added in 2.1 if there is a timeout (caused by user inactivity) warn users at the start of a process so they will not be surprised that a timeout exists (or only allow the timeout to occur after 20 hours of inactivity. understanding timeouts note: also see the wcag description for guideline 2.2 enough time: provide users enough time to read and use content. guideline 2.3 — ...
...And 8 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
he grid container, to align the items using one of the following values: auto normal start end center stretch baseline first baseline last baseline * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; p
adding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(8, 1fr); grid-gap: 10px; grid-auto-rows: 100px; grid-template-areas: "a a a a b b b b" "a a a a b b b b" "c c c c d d d d" "c c c c d d d d"; align-items: start; } .item1 { grid-area: a; } .item2 { grid-area: b; } .item3 { grid-area: c; } .item4 { grid-area: d; } <div cl...
...ea, is showing the default behavior of align-self, which is to stretch. the second item, has an align-self value of start, the third end and the fourth center. ...
...default, grid items will cover their grid area, unless you change that by setting alignment. ...
...And 8 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
id-template-columns properties. to demonstrate i’ll use the simple layout created in the guide on line-based placement. this time i’ll create the grid using named lines. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; p
adding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets. those names can be anything you like. i have defined a name for the start and end of the container, both for rows and columns. then defined the centre block of the grid as content-start and content-end again, both for columns and rows although you do not need to name all of the lines on your grid. you ...
...n creating a responsive design where you redefine the grid, rather than then needing to redefine the content position by changing the line number in your media queries, you can ensure that the line is always named the same in your definitions. giving lines multiple names you may want to give a line more than one name, perhaps it denotes the sidebar-end and the main-start for example. to do this
add the names inside the square brackets with whitespace between them [sidebar-end main-start]. you can then refer to that line by either of the names. implicit grid areas from named lines when naming the lines, i mentioned that you can name these anything you like. the name is a custom ident, an author-defined name. when choosing the name you need to avoid words that might appear in the specificat...
...ple, i have content-start and content-end both for rows and for columns. this means i get a grid area named content, and could place something in that area should i wish to. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; p
adding: 1em; color: #d9480f; } i’m using the same grid definitions as above, however this time i am going to place a single item into the named area content. .wrapper { display: grid; grid-template-columns: [main-start] 1fr [content-start] 1fr [content-end] 1fr [main-end]; grid-template-rows: [main-start] 100px [content-start] 100px [content-end] 100px [main-end]; } .thing { grid-area...
...And 8 more matches
CSS Scroll Snap - CSS: Cascading Style Sheets
at introduces scroll snap positions, which enforce the scroll positions that a scroll container’s scrollport may end at after a scrolling operation has completed. note: the previous version of this module was called scroll snap points and has been deprecated. css scroll snap is the current implementation. ...
...roll snap positions, which enforce the scroll positions that a scroll container’s scrollport may end at after a scrolling operation has completed. note: the previous version of this module was called scroll snap points and has been deprecated. css scroll snap is the current implementation. ...
... which enforce the scroll positions that a scroll container’s scrollport may end at after a scrolling operation has completed. note: the previous version of this module was called scroll snap points and has been deprecated. css scroll snap is the current implementation. ...
...And 8 more matches
Audio and video manipulation - Developer guides
this article provides a reference to explain what you need to do. ...
...<canvas> element. read the data from the intermediary <canvas> element and manipulate it. write the manipulated data to your "display" <canvas>. pause and repeat. for example, let's process a video to display it in greyscale. in this case, we'll show both the source video and the output greyscale frames. ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably
add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames. html we can set up our video player and <canvas> element like this: <video id="my-video" controls="true" width="480" height="270" crossorigin="anonymous"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" ty...
...his.video.ended) { return; } this.computeframe(); var self = this; settimeout(function () { self.timercallback(); }, 16); // roughly 60 frames per second }, doload: function() { this.video = document.getelementbyid("my-video"); this.c1 = document.getelementbyid("my-canvas"); this.ctx1 = this.c1.getcontext("2d"); var self = this; this.video.
addeventlistener("play", function() { self.width = self.video.width; self.height = self.video.height; self.timercallback(); }, false); }, computeframe: function() { this.ctx1.drawimage(this.video, 0, 0, this.width, this.height); var frame = this.ctx1.getimagedata(0, 0, this.width, this.height); var l = frame.data.length / 4; for (var i = 0; i < l; i++) { ...
...And 8 more matches
Set - JavaScript
be stored in a set. all nan values are equated (i.e. nan is considered the same as nan, even though nan !== nan). constructor set() creates a new set object. static properties get set[@@species] the constructor function that is used to create derived objects. 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 previously returned. set.prototype.has(value) will return false afterwards. set.prototype.has(value) returns a boolean asserting ...
... this is similar to the map object, so that each entry's key is the same as its value for a set. set.prototype.foreach(callbackfn[, thisarg]) calls callbackfn once for each value present in the set object, in insertion order. if a thisarg parameter is provided, it will be used as the this value for each invocation of callbackfn. ...
..., so that each entry's key is the same as its value for a set. set.prototype.foreach(callbackfn[, thisarg]) calls callbackfn once for each value present in the set object, in insertion order. if a thisarg parameter is provided, it will be used as the this value for each invocation of callbackfn. ...
...And 8 more matches
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
previous overview: progressive web apps next now that we’ve seen what the structure of js13kpwa looks like and have seen the basic shell up and running, let's look at how the offline capabilities using service worker are implemented. 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. they run on a separate thread from the main javascript code of our page, and don't have any access to th...
...d can be executed after the registration is successful. it's the only piece of service worker code that sits inside the app.js file; everything else that is service worker-specific is written in the sw.js file itself. lifecycle of a service worker when registration is complete, the sw.js file is automatically downloaded, then installed, and finally activated. installation the api allows us to
add event listeners for key events we are interested in — the first one is the install event: self.
addeventlistener('install', (e) => { console.log('[service worker] install'); }); in the install listener, we can initialize the cache and
add files to it for offline use. our js13kpwa app does exactly that. first, a variable for storing the cache name is created, and the app shell files are li...
... be loaded along with the content from the data/games.js file are generated in the second array. after that, both arrays are merged using the array.prototype.concat() function. var gamesimages = []; for(var i=0; i<games.length; i++) { gamesimages.push('data/img/'+games[i].slug+'.jpg'); } var contenttocache = appshellfiles.concat(gamesimages); then we can manage the install event itself: self.
addeventlistener('install', (e) => { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then((cache) => { console.log('[service worker] caching all: app shell and content'); return cache.
addall(contenttocache); }) ); }); there are two things that need an explanation here: what extendableevent.waituntil does, and what the caches object is. the ...
...And 8 more matches
simple-prefs - Archive of obsolete content
experimental store preferences across application restarts. you can store booleans, integers, and string values, and users can configure these preferences in the
add-ons manager. this gives users a consistent way to access and modify preferences across different
add-ons. this api is for your
add-on's preferences. if you need to get and set the general browser preferences, use preferences/service. usage defining and initializing preferences to define preferences and give them initial values,
add a new json array called preferences to your package.json file, and give it one entry for each preference: { "fullname": "example
add-on", ... "preferences": [{ "name": "somepreference", "title": "some preference title", "description": "some short description...
...ve optional attributes attributes that are specific to the preference's data type mandatory common attributes these are attributes that all preferences must have. attribute description type the type of preference, as defined in the "preference types" section below. name an identifier for the preference. this is used to access the preference from your
add-on: console.log(require("sdk/simple-prefs").prefs.mysettingname); this means that it must be a valid javascript identifier. title this is used as a label for the preference in the
add-ons manager user interface. optional common attributes these are attributes that all preferences may have: attribute description description this ...
...prefs").prefs.mysettingname); this means that it must be a valid javascript identifier. title this is used as a label for the preference in the
add-ons manager user interface. optional common attributes these are attributes that all preferences may have: attribute description description this appears below the preference title in the
add-ons manager ui. value a default value for the preference. depending on the preference type, this may be an integer, string, or boolean value. hidden a boolean value which, if present and set to true, means that the preference won't appear in the
add-ons manager interface, so users of your
add-on won't be able to see or alter it. { "name": "myhiddeninteger", ...
...And 7 more matches
simple-storage - Archive of obsolete content
it's a normal javascript object, and you can treat it as you would any other. to store a value, just assign it to a property on storage: var ss = require("sdk/simple-storage"); ss.storage.myarray = [1, 1, 2, 3, 5, 8, 13]; ss.storage.myboolean = true; ss.storage.mynull = null; ss.storage.mynumber = 3.1337; ss.storage.myobject = { a: "foo", b: { c: true }, d: null }; ss.storage.mystring = "o frabjous day!"; you can store array, boolean, number, object, null, and string values. ...
...hese types. be careful to set properties on the storage object and not the module itself, as demonstrated below: // this is not good! var ss = require("sdk/simple-storage"); ss.foo = "i will not be saved! :("; simple storage and "jpm run" the simple storage module stores its 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 prevent firefox from copying the profile to a temporarry directory each time it starts. jpm run --no-copy --profile path/to/...
...xistent 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 storage will not be notified that the session is finished, and will not write your data to the backing store. accessing storage from the console in the
add-on debugger, you can access your
add-on's simple-storage programmatically from the console using the following: loader.modules['resource://gre/modules/commonjs/sdk/simple-storage.js'].exports.storage clarification from mozilla needed: writing the above line in
add-on debugger console results in "referenceerror: loader is not defined". constructing arrays be careful to construct array object...
...And 7 more matches
Creating Reusable Modules - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. with the sdk you don't have to keep all your
add-on in a single "index.js" file. you can split your code into separate modules with clearly defined interfaces between them. you then import and use these modules from other parts of your
add-on using the require() statement, in exactly that same way that you import core sdk modules like page-mod or panel. it can often make sense to structure a larger or more complex
add-on as a collection of modules. this makes the design of the
add-on easier to understand and provides some encapsulation as each module will export only what it chooses to, so you can change the internals of the module without breaking its users. once you've done this, you can package the modules and distr...
... often make sense to structure a larger or more complex
add-on as a collection of modules. this makes the design of the
add-on easier to understand and provides some encapsulation as each module will export only what it chooses to, so you can change the internals of the module without breaking its users. once you've done this, you can package the modules and distribute them independently of your
add-on, making them available to other
add-on developers and effectively extending the sdk itself. in this tutorial we'll do exactly that with a module that calculates file hashes. a hashing
add-on a hash function takes a string of bytes of any length, and produces a short, fixed length string of bytes as output. it's a useful way to create a "fingerprint" that can be used to identify a file. md5 ...
...for both these operations we'll use xpcom interfaces. file picker to let the user select a file we'll use nsifilepicker. ...
...And 7 more matches
Developing for Firefox Mobile - Archive of obsolete content
see developing webextensions for firefox for android to learn more about development of webextensions for firefox for android. to follow this tutorial you'll need to have learned the basics of jpm. firefox for android implements its ui using native android widgets instead of xul. with the
add-on sdk you can develop
add-ons that run on this new version of firefox mobile as well as on the desktop version of firefox. ...
...droid implements its ui using native android widgets instead of xul. with the
add-on sdk you can develop
add-ons that run on this new version of firefox mobile as well as on the desktop version of firefox. you can use the same code to target both desktop firefox and firefox mobile, and use jpm-mobile instead of the normal jpm. right now not all modules are fully functional, but we're working on
adding support for more modules. the tables at the end of this guide list the modules that are currently supported on firefox mobile. this tutorial explains how to run sdk
add-ons on an android device connected via usb to your development machine. ...
... normal jpm. right now not all modules are fully functional, but we're working on
adding support for more modules. the tables at the end of this guide list the modules that are currently supported on firefox mobile. this tutorial explains how to run sdk
add-ons on an android device connected via usb to your development machine. we'll use the android debug bridge (adb) to communicate between the
add-on sdk and the device. it's possible to use the android emulator to develop
add-ons for android without access to a device, but it's slow, so for the time being it's much easier to use the technique described below. setting up the environment first you'll need an android device capable of running the native version of firefox mobile. then: install the nightly build of the native version o...
...And 7 more matches
Modifying Web Pages Based on URL - Archive of obsolete content
a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); do as follows: create a new directory and navigate to it. run jpm init, accepting all the defaults open the file index.js and
add the code above run jpm run open ietf.org in the browser window that opens. below is what 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, mainta...
...h 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. ...
...le 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. ...
...And 7 more matches
Using third-party modules (jpm) - Archive of obsolete content
the
add-on sdk includes a command-line tool that you use to initialize, run, test, and package
add-ons. the current tool is called jpm, and is based on node.js. it replaces the old cfx tool. you can use jpm from firefox 38 onwards. this article describes how you can use third-party modules with jpm. to follow this tutorial you'll need to have installed jpm and learned the basic jpm commands. to install menuitem you'll need to have git command. if you have error related to git, check you have latest git command installed. the
add-on sdk is extensible by design: you can use the modules that ship inside firefox, but you can also create your own modules and make them available for anyone else to use. before the jpm tool was available, there wasn't any package manager for these communi...
...nd make them available for anyone else to use. before the jpm tool was available, there wasn't any package manager for these community-developed modules, so it wasn't obvious where to find community-developed modules, or how to install and update them. with jpm, we use npm as the package manager for sdk modules that don't ship inside firefox. ...
... available, there wasn't any package manager for these community-developed modules, so it wasn't obvious where to find community-developed modules, or how to install and update them. with jpm, we use npm as the package manager for sdk modules that don't ship inside firefox. module developers can publish sdk modules to npm, and
add-on developers can install them from npm and build them into their
add-ons. ...
...And 7 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
a web page to an extension is by using custom dom events. in your extension's browser.xul overlay, write code which listens for a custom dom event. here we call the event myextensionevent. var myextension = { mylistener: function(evt) { alert("received from web page: " + evt.target.getattribute("attribute1") + "/" + evt.target.getattribute("attribute2")); } } 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. the data from the web page (unprivileged code) will be the values of attribute1 and attribute2. to trigger the alert() in the listener and pass the data from the web page, write code such as this i...
... (to better ensure others do not also implement the same event with a different meaning, one might either attach a namespace to <myextensiondataelement/> and check on the event handler for the correct namespaceuri property, or as per the dom specification, use initevent() with an event name that is itself namespaced (xml name characters only): "it is also strongly recommended that third parties
adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events.") in the case where your extension's overlay does not interact directly with browser.xul, such as in a sidebar, it might be easier to
add the event listener to the top-level document directly as shown below (also see: accessing the elements of the top-level document from a c...
...rface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); mainwindow.document.
addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); if you need to to pass lots of data, consider using cdata sections instead of the simple attributes on a custom element. note: if you're using html5's postmessage() to send a message from unprivileged code to privileged code,
adding 'true' to the end of your event listener in your privileged chrome code ...
...And 7 more matches
Appendix D: Loading Scripts - Archive of obsolete content
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 previously imported the services.jsm module. ...
... and compile time are reduced. the scripts still need to execute all of their initialization code and allocate and initialize all of their data structures each time the script is loaded. loading: script loaded via script tags run in partially loaded documents. problems can ensue if the script immediately attempts to access dom nodes. this is easily resolved by deferring the work to a dynamically
added onload hander. (a standalone xul window can use an onload attribute.) example the following overlay will load the script “overlay.js” from the same directory as the overlay file into the window which it overlays. the script will be read with the utf-8 encoding, based on the encoding of the overlay, and will execute as javascript version 1.8, based on the version specified in the script t...
.... flexibility: the evalinsandbox method accepts several parameters, including the url, line number, and javascript version of the file from which the code being evaluated was extracted. this information is invaluable for debugging, and the flexibility with which it can be specified makes this method useful for extracting javascript from a number of file formats other than raw javascript scripts.
additionally, as sandbox objects can be created with an arbitrary prototype object, the evaluated code can be given access to the global properties of any existing scope. security: sandbox objects are initialized with a security principal object, or otherwise a window or url from which to derive one. this means that evalinsandbox can be used to execute code with a specified privilege level rather th...
...And 7 more matches
Signing an XPI - Archive of obsolete content
note: these instructions are for how to test with a self-signed certificate. see signing an extension for a practical guide. introduction this article describes how to sign your own firefox extensions with a code-signing certificate on a windows platform. it was developed from the linux article so you want to sign your xpi package? by mozdev group's pete collins. ...
... local folder. in my case it's c:\apps\nss-3.11.4\ get netscape portable runtime 1. download the latest netscape portable runtime from the mozilla ftp site: http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. for windows you'll want the nspr-4.6.zip package in the v4.6/winnt5.0_opt.obj/ folder. 2. extract the contents of the archive file to a local folder. in my case it's c:\apps\nspr-4.6\
add path
add the nss tools bin/ and lib/, and the nspr lib/ directories to the system path. you can either set this permanently via control panel->system properties->advanced->environment variables->system variables or do it each time you run the tools from the command-line (preferably using a batch file). windows contains its own version of some of these files (e.g. certutil.exe) in the system dire...
...e browser before continuing this operation. enter "y" to continue, or anything else to abort: y enter certificate information. all fields are optional. acceptable characters are numbers, letters, spaces, and apostrophes. certificate common name: xpi test organization: tjworld organization unit: software state or province: nottingham country (must be exactly 2 characters): gb username: tj email
address: certificates@lan.tjworld.net generated public/private key pair certificate request generated certificate has been signed certificate "mytestcert"
added to database exported certificate to x509.raw and x509.cacert. x509.cacert will be used to sign your xpi package. check that it exists on the file system and in the certificate database: c:\projects\codesigning\> dir x509* 14/12/2005 15:1...
...And 7 more matches
Using Dependent Libraries In Extension Components - Archive of obsolete content
, nsimodule* *aresult) { nsresult rv; // this is not the real component. we want to load the dependent libraries // of the real component, then the component itself, and call nsgetmodule on // the component. ...
...rv; nsgetmoduleproc getmoduleproc = (nsgetmoduleproc) pr_findfunctionsymbol(lib, ns_get_module_symbol); if (!getmoduleproc) return ns_error_failure; return getmoduleproc(acompmgr, alocation, aresult); } extensions/stub/bdsstubloader.cpp (for mac os x) the code as written above won't work for mac os x. dependant libraries on the mac must be loaded with a special system function ns
addimage() with the flag ns
addimage_option_match_filename_by_installname. the following are the necessary modifications you will need in order to write a stub loader for an os x extension. you will also need to make sure you are properly linking the xpcom glue libraries. see xpcom glue for the proper flags on how to link to the glue libraries. /* * os x stubloader * original stubloader code by...
...sifile* alocation, nsimodule* *aresult) { nsresult rv; // this is not the real component. we want to load the dependent libraries // of the real component, then the component itself, and call nsgetmodule on // the component. ...
...And 7 more matches
No Proxy For configuration - Archive of obsolete content
initially, proxy servers were used for access control and performance. ...
...ptional field, part of "manual proxy configuration". the field is relatively short, but can hold reasonably long (2k+ characters) entries. new profiles contain the values "localhost, 127.0.0.1", by default. entry points: preferences | advanced | proxies control-click menu for off line-online icon (network plug) configuration the no proxy list is composed of either domain elements or ipv4
address elements. the elements are separated by either a space (" ") or a comma (","). note for former-ie users: "*" is supported only at the beginning of domain filters (*.mozilla.org). to block ... put this into "no proxy for" ...for example use... limitations a domain, including sub-domains domain suffix "mozilla.org" does not block domains that end in the s...
...s not block the main domain (mozilla.org) a hostname (without domain) hostname-only (see problems below) "localhost" also blocks any possible domains that start with the entry ("www.otherdomain.localhost") a hostname (with domain) domain name "www.mozilla.org" does not block hostnames or domains that end in the same string (other-www.mozilla.org) an ip
address ip
address "1.2.3.4" does not block hostnames that resolve to the ip
address ("127.0.0.1" does not block "localhost") a network network w/ cidr block "10.0.0.0/8" does not block hostnames that resolve to the ip
address range (10.0.0.0/8 is not "no proxy for intranet hostnames") optional - port-specific (optional) ":" + port number "<filter>:81" onl...
...And 7 more matches
LIR - Archive of obsolete content
auses no code to be generated, but it affects register allocation so that no registers are live when it is reached. 2 skip void links code chunks. 3 parami integer 32 bit load an int parameter (register or stack location). 4 paramq quad 64 bit load a quad parameter (register or stack location). ...
... call subroutine that returns void 34 calli integer call subroutine that returns an int 35 callq quad 64 bit call subroutine that returns a quad 36 calld double call subroutine that returns a double branch 37 j void jump always 38 jt void jump if true 39 jf void jump if false 40 jtbl void jump to
address in table 41 label void a jump target (no machine code is emitted for this) 42 not in use guards 43 x void exit always 44 xt void exit if true 45 xf void exit if false 46 xtbl void exit via indirect jump 47 xbarrier void a lir_xbarrier cause no code to be generated, but it acts like a never-...
... it's only used on i386/x64. the operand is the result of a lir_divi because on i386/x64 div and mod results are computed by the same instruction. 84 noti integer ...
...And 7 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. ...
... to match. for instance, we might use the following: <vbox datasources="template-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood"> <template> <rule parent="vbox"> <groupbox uri="rdf:*"> <caption label="rdf:http://purl.org/dc/elements/1.1/title"/> </groupbox> </rule> <rule> <label uri="rdf:*" value="rdf:http://www.xulplanet.com/rdf/
address"/> </rule> </template> </vbox> on the first pass, the container where generated content would be inserted is a <vbox>, so the first rule will match and a captioned <groupbox> will be created. on the next pass, the parent container will be the element with the uri attribute from the previous pass, in this case, the <groupbox> the first rule will not match in this case, but the second ru...
...the first of these tests can be used to test if an element is a container or not. to use this test, place an iscontainer ...
...And 7 more matches
XUL Template Primer - Bindings - Archive of obsolete content
warning: the content of this article may be out of date. see xul:template guide for up to date documentation. overview this document expands on the xul template primer by introducing the <bindings> element in the extended xul template syntax. the <bindings> element is used to create
additional,optional variable bindings, in
addition to those that are specified in a rule's <conditions>. this is different from the variables specified in the rule's conditions, where a value must be found for each variable for the rule to match. if a <binding> can't be matched, the rule will still fire. example to illustrate how <bindings> work, we'll examine this xul document, which builds a simple content model an rdf/xml file. <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/sk...
...netscape.com/nc-rdf#friends" object="?friends"/> <member container="?friends" child="?friend"/> <triple subject="?friend" predicate="http://home.netscape.com/nc-rdf#name" object="?name"/> </conditions> <bindings> <binding subject="?friend" predicate="http://home.netscape.com/nc-rdf#
address" object="?
addr"/> <binding subject="?
addr" predicate="http://home.netscape.com/nc-rdf#street" object="?street"/> </bindings> <action> <hbox uri="?friend"> <label value="?name"/> <label value="?street"/> </hbox> </action> </rule> </template> </vbox>...
... <label value="?name"/> <label value="?street"/> </hbox> </action> </rule> </template> </vbox> </window> the xul template primer covers the <conditions> and <action> elements, so we won't discuss those here. we'll use a the following data model to illustrate how bindings work. ...
...And 7 more matches
Building a Theme - Archive of obsolete content
ate 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 preview.png is shown as a preview 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 into this directory. the location differs by operating system: linux: /...
...nt end metadata --> <em:name>my theme</em:name> <em:internalname>sample</em:internalname> <em:description>a test extension</em:description> <em:creator>your name here</em:creator> <em:homepageurl>http://www.example.com/</em:homepageurl> </description> </rdf> sample@example.net - the id of the extension. this is a value you come up with to identify your extension in email
address format (note that it should not be your email). make it unique. you could also use a guid. note: this parameter must be in the format of an email
address, although it does not have to be a valid email
address. (example.example.example) 4 - the type of the
add-on. '4' declares that it is installing a theme. if you were to install an extension it would be 2 (see install manifests#type for othe...
...ents. by default, the right pane should show the dom node, which has useful styling information like the css class and node id. the element itself is of id navigator-toolbox, with no idea. to change its style within our theme, we need to write a selector rule to select this class. open up the file chrome/browser/browser.css in your theme. search this file for the #navigator-toolbox selector, and
add a background: orange; rule to it. save the file. chrome uris next, we have to tell firefox where to find the theme files for your theme. css, xul, and other files are part of "chrome packages" - bundles of user interface components which are loaded via chrome:// uris. rather than load the browser from disk using a file:// uri (since the location of firefox on the system can change from platf...
...And 7 more matches
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. ...
...vascript. the good thing about using phaser is that it offers helper variables and functions for easier and faster development, but it's totally up to you which approach you chose. pure javascript approach let's think about implementing pure javascript keyboard/mouse controls in the game first to see how it would work. first, we'd need an event listener to listen for the pressed keys: document.
addeventlistener('keydown', keydownhandler, false); document.
addeventlistener('keyup', keyuphandler, false); whenever any key is pressed down, we're executing the keydownhandler function, and when press finishes we're executing the keyuphandler function, so we know when it's no longer pressed. to do that we'll hold the information on whether the keys we are interested in are pressed or not: var rig...
...n the actual task you want to do. mouse the mouse interactions in the game are focused on clicking the buttons. in phaser the buttons you create will take any type of input, whether it's a touch on mobile or a click on desktop. ...
...And 7 more matches
Buttons - Game development
« previousnext » this is the 15th 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/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. ...
...mpleting 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.
add the following to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); a single button frame is 120 pixels wide and 40 pixels high. you ...
... loading the button spritesheet we can load the button spritesheet the same way we loaded the ball's wobble animation.
add the following to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); a single button frame is 120 pixels wide and 40 pixels high. you also need to grab the button spritesheet from github, and save it in your /img directory.
adding the button to the game
adding the new button to the game is done by using the
add.button method. ...
...And 7 more matches
Debugging CSS - Learn web development
right of your html, you should be able to see the css properties and values applied to that element. you will see the rules directly applied to class box1 and also the css that is being inherited by the box from its ancestors, in this case to <body>. this is useful if you are seeing some css being applied that you didn't expect. perhaps it is being inherited from a parent element and you need to
add a rule to overwrite it in the context of this element. also useful is the ability to expand out shorthand properties. in our example the margin shorthand is used. click on the little arrow to expand the view, showing the different longhand properties and their values. you can toggle values in the rules view on and off, when that panel is active — if you hold your mouse over it checkboxes wil...
...-radius, and the css will stop applying. you can use this to do an a/b comparison, deciding if something looks better with a rule applied or not, and also to help debug it — for example if a layout is going wrong and you are trying to work out which property is causing the problem. the following video provides some useful tips on debugging css using the firefox devtools: editing values in
addition to turning properties on and off, you can edit their values. perhaps you want to see if another color looks better, or wish to tweak the size of something? devtools can save you a lot of time editing a stylesheet and reloading the page. with box1 selected, click on the swatch (the small colored circle) that shows the color applied to the border. a color picker will open up and you can try o...
...e of something? devtools can save you a lot of time editing a stylesheet and reloading the page. with box1 selected, click on the swatch (the small colored circle) that shows the color applied to the border. a color picker will open up and you can try out some different colors; these will update in real time on the page. in a similar fashion, you could change the width or style of the border.
adding a new property you can
add properties using the devtools. perhaps you have realised that you don't want your box to inherit the <body> element's font size, and want to set its own specific size? you can try this out in devtools before
adding it to your css file. you can click the closing curly brace in the rule to start entering a new declaration into it, at which point you can start typing ...
...And 7 more matches
Pseudo-classes and pseudo-elements - Learn web development
tend to act as if you had applied a class to some part of your document, often helping you cut down on excess classes in your markup, and giving you more flexible, maintainable code. pseudo-classes are keywords that start with a colon: :pseudo-class-name simple pseudo-class example let's look at a simple example. ...
...ss to some part of your document, often helping you cut down on excess classes in your markup, and giving you more flexible, maintainable code. pseudo-classes are keywords that start with a colon: :pseudo-class-name simple pseudo-class example let's look at a simple example. ...
...we'd need to move the class over to the new paragraph. ...
...And 7 more matches
Flexbox - Learn web development
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. ...
...out any of the terms being used. columns or rows? flexbox provides a property called flex-direction that specifies what direction the main axis runs in (what direction the flexbox children are laid out in) — by default this is set to row, which causes them to be laid out in a row in the direction 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! wra...
... 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 you want to follow along with this example): here we see that the children are indeed breaking out of their container. one way in which you can fix this is to
add the following declaration to your <section> rule: flex-wrap: wrap; also,
add the following declaration to your <article> rule: flex: 200px; try this now; you'll see that the layout looks much better with this included: we now have multiple rows — as many flexbox children are fitted onto each row as makes sense, and any overflow is moved down to the next line. the flex: 200px declaration se...
...And 7 more matches
Beginner's guide to media queries - Learn web development
means that it doesn't matter what the exact dimensions are of the device being used, every range is catered for. the points at which a media query is introduced are known as breakpoints. the responsive design mode in firefox devtools is very useful for working out where these breakpoints should go. you can easily make the viewport smaller and larger to see where the content would be improved by
adding a media query and tweaking the design. active learning: mobile first responsive design broadly, you can take two approaches to a responsive design. you can start with your desktop or widest view and then
add breakpoints to move things around as the viewport becomes smaller, or you can start with the smallest view and
add layout as the viewport becomes larger. this second approach is descri...
...der your source well and you will have a readable layout by default. the below walkthrough takes you through this approach with a very simple layout. in a production site you are likely to have more things to adjust within your media queries, however the approach would be exactly the same. ...
...actly the same. walkthrough: a simple mobile-first layout our starting point is an html document with some css applied to
add background colors to the various parts of the layout. ...
...And 7 more matches
create fancy boxes - Learn web development
t be done in one day, and some web developers spend their whole life having fun with it. ...
... making circles <div class="fancy">hi! i want to be fancy.</div> this is something that is both very simple and very fun. ...
...ground-size, etc. its pseudo-element: ::before and ::after and some aside properties like: box-shadow, transform, outline, etc. so we have a very large playground. let the fun begin. box model tweak the box model alone allows us to do some basic stuff, like
adding simple borders, making squares, etc.. it starts to get interesting when you push the properties to the limit by having negative p
adding and/or- margin by having border-radius larger than the actual size of the box. making circles <div class="fancy">hi! i want to be fancy.</div> this is something that is both very simple and very fun. the border-radius property is made to create a rounded corner applied to boxes, but what happens if the radius size is equal or larger than the actual width of the box? .fancy { /* within ...
...And 7 more matches
How the Web works - Learn web development
's web browser. the other parts of the toolbox the client and server we've described above don't tell the whole story. there are many other parts involved, and we'll describe them below. for now, let's imagine that the web is a road. on one end of the road is the client, which is like your house. on the other end of the road is the server, which is a shop you want to buy something from. in
addition to the client and the server, we also need to say hello to: your internet connection: allows you to send and receive data on the web. it's basically like the street between your house and the shop. tcp/ip: transmission control protocol and internet protocol are communication protocols that define how data should travel across the internet. this is like the transport mechanisms that let y...
...een your house and the shop. tcp/ip: transmission control protocol and internet protocol are communication protocols that define how data should travel across the internet. this is like the transport mechanisms that let you place an order, go to the shop, and buy your goods. in our example, this is like a car or a bike (or however else you might get around). dns: domain name servers are like an
address book for websites. when you type a web
address in your browser, the browser looks at the dns to find the website's real
address before it can retrieve the website. the browser needs to find out which server the website lives on, so it can send http messages to the right place (see below). this is like looking up the
address of the shop so you can access it. http: hypertext transfer protocol ...
...parts of the goods you buy from the shop. these files come in two main types: code files: websites are built primarily from html, css, and javascript, though you'll meet other technologies a bit later. assets: this is a collective name for all the other stuff that makes up a website, such as images, music, video, word documents, and pdfs. so what happens, exactly? when you type a web
address into your browser (for our analogy that's like walking to the shop): the browser goes to the dns server, and finds the real
address of the server that the website lives on (you find the
address of the shop). the browser sends an http request message to the server, asking it to send a copy of the website to the client (you go to the shop and order your goods). this message, and all other d...
...And 7 more matches
What’s in the head? Metadata in HTML - Learn web development
in larger pages however, the head can get quite full. try going to some of your favorite websites and use the developer tools to check out their head contents. our aim here is not to show you how to use everything that can possibly be put in the head, but rather to teach you how to use the major elements that you'll want to include in the head, and give you some familiarity. let's get started.
adding a title we've already seen the <title> element in action — this can be used to
add a title to the document. this however can get confused with the <h1> element, which is used to
add a top level heading to your body content — this is also sometimes referred to as the page title. but they are different things! the <h1> element appears on the page when loaded in the browser — generally ...
... used in other ways. for example, if you try bookmarking the page (bookmarks > bookmark this page or the star icon in the url bar in firefox), you will see the <title> contents filled in as the suggested bookmark name. the <title> contents are also used in search results, as you'll see below. metadata: the <meta> element metadata is data that describes data, and html has an "official" way of
adding metadata to a document — the <meta> element. of course, the other stuff we are talking about in this article could also be thought of as metadata too. there are a lot of different types of <meta> elements that can be included in your page's <head>, but we won't try to explain them all at this stage, as it would just get too confusing. instead, we'll explain a few things that you might common...
... you use, you may not see this problem anyway. you should still set an encoding of utf-8 on your page anyway, to avoid any potential problems in other browsers. active learning: experiment with character encoding to try this out, revisit the simple html template you obtained in the previous section on <title> (the title-example.html page), try changing the meta charset value to iso-8859-1, and
add the japanese to your page. this is the code we used: <p>japanese example: ご飯が熱い。</p>
adding an author and description many <meta> elements include name and content attributes: name specifies the type of meta element it is; what type of information it contains. content specifies the actual meta content. two such meta elements that are useful to include on your page define the ...
...And 7 more matches
Object-oriented JavaScript for beginners - Learn web development
ple program that displays information about the students and teachers at a school. here we'll look at oop theory in general, not in the context of any specific programming language. to start this off, we could return to our person object type from our first objects article, which defines the generic data and functionality of a person. there are lots of things you could know about a person (their
address, height, shoe size, dna profile, passport number, significant personality traits ...) , but in this case we are only interested in showing their name, age, gender, and interests, and we also want to be able to write a short introduction about them based on this data, and get them to say hello. this is known as abstraction — creating a simple model of a more complex thing, which represents i...
...as you need in an effective way, attaching data and functions to them as required. let's explore creating classes via constructors and creating object instances from them in javascript. first of all, we'd like you to make a new local copy of the oojs.html file we saw in our first objects article. a simple example let's start by looking at how you could define a person with a normal function. ...
..., the object's name property will be equal to the name value passed to the constructor call, and the greeting() method will use the name value passed to the constructor call too. 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 7 more matches
Getting started with Svelte - Learn web development
at happens only when you build your app, producing highly-optimized vanilla javascript. the outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable for people that have limited experience of the modern tooling ecosystem. svelte sticks closely to the classic web development model of html, css, and js, just
adding a few extensions to html and javascript. it arguably has fewer concepts and tools to learn than some of the other framework options. it's main current disadvantages are that it is a young framework — its ecosystem is therefore more limited in terms of tooling, support, plugins, clear usage patterns, etc. than more mature frameworks, and there are also less job opportunities. but it's advant...
... learn than some of the other framework options. it's main current disadvantages are that it is a young framework — its ecosystem is therefore more limited in terms of tooling, support, plugins, clear usage patterns, etc. than more mature frameworks, and there are also less job opportunities. but it's advantages should be enough to make you interested to explore it. note: recently svelte has
added official typescript support, one of its most requested features. we'll look at it later on in this tutorial series. we encourage you to go through the svelte tutorial for a really quick introduction to the basic concepts, before returning to this tutorial series to learn how to build something slightly more in-depth. it should take you about 30 minutes to complete. use cases svelte can be u...
...does svelte work? being a compiler, svelte can extend html, css, and javascript, generating optimal javascript code without any runtime overhead. to achieve this, svelte extends vanilla web technologies in the following ways: it extends html by allowing javascript expressions in markup and providing directives to use conditions and loops, in a fashion similar to handlebars. it extends css by
adding a scoping mechanism, allowing each component to define their own styles without the risk of clashing with other component's styles. it extends javascript by reinterpreting specific directives of the language to achieve true reactivity and ease component state management. the compiler only intervenes in very specific situations and only in the context of svelte components. extensions to the ...
...And 7 more matches
Rendering a list of Vue components - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
... prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
... effective to-do list, we need to be able to render multiple to-do items. to do that, vue has a special directive, v-for. this is a built-in vue directive that lets us include a loop inside of our template, repeating the rendering of a template feature for each item in an array. we'll use this to iterate through an array of to-do items and display them in our app in separate todoitem components.
adding some data to render first we need to get an array of to-do items. to do that, we’ll
add a data property to the app.vue component object, containing a todoitems field whose value is an array of todo items. while we'll eventually
add a mechanism to
add new todo items, we can start with some mock to do items. each to-do item will be represented by an object with a name and a done property. ad...
...And 7 more matches
Implementing feature detection - Learn web development
for browsers that don't, we could use a floated layout that works ok, although it is slightly more brittle and hacky, and not as cool-looking. let's implement something that demonstrates this, although we'll keep it simple for now. start by making local copies of our css-feature-detect.html, flex-layout.css, float-layout.css, and basic-styling.css files. save them in a new directory. we will
add the html5 shiv to our example too so that the html5 semantic elements will style properly in older versions of ie. download the latest version (see manual installation), unzip the zip file, copy the html5shiv-printshiv.min.js and html5shiv.min.js files into your example directory, and link to one of the files by putting the following under your <title> element: <script src="html5shiv.min.js"></...
...ively apply to browser depending on their support levels. you can look at the different effects these two files have by manually changing the css file referred to by the second <link> element, but let's instead implement some javascript to automatically swap them as needed. first, remove the contents of the second <link> element's href attribute. we will fill this in dynamically later on. next,
add a <script></script> element at the bottom of your body (just before the closing </body> tag). give it the following contents: const conditional = document.queryselector('.conditional'); const testelem = document.createelement('div'); if (testelem.style.flex !== undefined && testelem.style.flexflow !== undefined) { conditional.setattribute('href', 'flex-layout.css'); } else { conditional.se...
... aspect ratio, it selectively applies css depending on whether a css feature is supported. for example, we could rewrite our previous 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 { p
adding-right: 4%; flex: 1; } main div:last-child { p
adding-right: 0; } } this at-rule block applies the css rule within only if the current browser supports both the flex-flow: row and flex: 1 declarations. 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 a...
...And 7 more matches
Introducing a complete toolchain - Learn web development
are necessary and consider each part carefully. the smallest toolchain is one that has no links at all. you would handcode the html, use "vanilla javascript" (meaning no frameworks or intermediary languages), and manually upload it all to a server for hosting. however, more complicated software requirements will likely benefit from the usage of tools to help simplify the development process. in
addition, you should include tests before you deploy to your production server to ensure your software works as intended — this already sounds like a necessary toolchain. for our sample project, we'll be using a toolchain specifically designed to aid our software development and support the technical choices made during the software design phase. we will however be avoiding any superfluous tooling...
...y designed to aid our software development and support the technical choices made during the software design phase. we will however be avoiding any superfluous tooling, with the aim of keeping complexity to a minimum. for example, we could have included a tool to minimize our svg file sizes during build. however, this project has only 4 svg images, which were manually minified using svgo before
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 previously...
...s 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 previously, 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 files that do not change in real time), which lets us deploy mu...
...And 7 more matches
Cross Process Object Wrappers
ocument describes cross process object wrappers (cpows), which enable chrome code to synchronously access content in multiprocess firefox. note that from firefox 47 onwards, unsafe cpow usage is no longer permitted in browser code. if browser code tries an unsafe cpow operation, the browser will throw an exception and you'll see an "unsafe cpow usage forbidden” error in the browser console.
add-on code is still allowed to use cpows "unsafely". however, if an
add-on passes a cpow into a platform api, and that platform api then attempts an unsafe operation on it, this will throw an exception. so as a general rule,
add-ons should avoid passing cpows into non-
addon code. in multiprocess firefox, chrome code runs in a different process from web content. so chrome code can't directly intera...
...g cpows from frame scripts frame scripts can send messages to chrome using one of two global functions: sendasyncmessage() or sendsyncmessage(). the optional third parameter to each of these functions is an object whose properties are objects to wrap. for example, this frame script sends a dom node to chrome when the user clicks it, as the clicked property of the third argument: // frame script
addeventlistener("click", function (event) { sendasyncmessage("my-e10s-extension-message", {}, { clicked : event.target }); }, false); in the chrome script, the dom node is now accessible through a cross process object wrapper, as a property of the objects property of the message. the chrome script can get and set the wrapped object's properties and call its functions: // chrome script windowmm.a...
...cript can get and set the wrapped object's properties and call its functions: // chrome script windowmm.
addmessagelistener("my-e10s-extension-message", handlemessage); function handlemessage(message) { let wrapper = message.objects.clicked; console.log(wrapper.innerhtml); wrapper.innerhtml = "<h2>modified by chrome!</h2>" wrapper.setattribute("align", "center"); } auto-generated cpows
add-ons that have not declared themselves multiprocess compatible are set up with a number of compatibility shims. one of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentdocument), it is given back a cpow that wraps the content object. this means that examples like this will actually work, even i...
...And 7 more matches
Frame script loading and lifetime
dom event, generally domwindowcreated, domcontentloaded, or load. unloading frame scripts frame scripts are automatically unloaded when their hosting tab is closed. there is currently no way to unload them when loaded, other than closing the tab they were loaded into. ...
...ding frame scripts frame scripts are automatically unloaded when their hosting tab is closed. there is currently no way to unload them when loaded, other than closing the tab they were loaded into. to listen for an event, when your frame script is unloaded (due to tab close for instance), you must set the third argument of
addmessagelistener to true. ...
...ripts are automatically unloaded when their hosting tab is closed. there is currently no way to unload them when loaded, other than closing the tab they were loaded into. to listen for an event, when your frame script is unloaded (due to tab close for instance), you must set the third argument of
addmessagelistener to true. ...
...And 7 more matches
DownloadList
a downloadlist object represents a collection of download objects that can be viewed and managed by the user interface, and persisted across sessions. a reference to a downloadlist object can be obtained using the downloads.getlist() function. ...
...collection of download objects that can be viewed and managed by the user interface, and persisted across sessions. a reference to a downloadlist object can be obtained using the downloads.getlist() function. method overview promise<array<download>> getall(); promise
add(download adownload); promise remove(download adownload); promise
addview(object aview); promise removeview(object aview); void removefinished([optional] function afilterfn); methods getall() retrieves a snapshot of the downloads that are currently in the list. the returned array does not change when downloads are
added or removed, though the download objects it contains are still updated in real time. promise<array<download...
... void removefinished([optional] function afilterfn); methods getall() retrieves a snapshot of the downloads that are currently in the list. the returned array does not change when downloads are
added or removed, though the download objects it contains are still updated in real time. promise<array<download>> getall(); parameters none. promise resolves to an array of download objects.
add()
adds a new download to the end of the items list. note: when a download is
added to the list, its onchange event is registered by the list, thus it cannot be used to monitor the download. ...
...And 7 more matches
Application Translation with Mercurial
x and fx-* denote branches of firefox for desktop, the browser for desktops and notebooks running, windows, mac os or linux. fennec and fennec-* denote branches of firefox for mobile, the firefox browser for the android operating system. thunderbird and tb-* denote branches of thunderbird, the mail client, newsgroup and feed reader and chat client. the localization of the lightning calendar
add-on also takes place on these branches. seamonkey and sea-* denote branches of seamonkey, the suite consisting of browser, mail and chat client and more. lightning and cal-* denote branches of lightning, the calendar
add-on for thunderbird. the localization of lightning now happens on thunderbird's tb-* branches, the cal-* branches have been retired. in this example, we assume firefox...
...sers can use e.g. notepad++. paste the following content into the file: [ui] username = firstname lastname <mynick@example.com> merge = internal:merge [alias] qexport = export -g -r qtip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = 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 c...
... 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 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...
...And 7 more matches
Localizing extension descriptions
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. ...
...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. ...
...for en-us). the current app locale will be searched for and then there will be a fallback search for en-us. if a preference isn't set and there isn't a matching em:localized property for the current locale or en-us, then the properties specified directly on the install manifest are used as a last resort, as they were always used before gecko 1.9. ...
...And 7 more matches
Localizing without a specialized tool
ized tool without going through the create a new localization page. what we will translate we will translate a small piece of the ui found in the search bar. the search bar is next to the right of the location bar, and by default points to the google search. if you click on the highlighted arrow pointing down while reading this tutorial on mdc, you will see two string that need to be translated:
add "mdc search" manage search engines... there is also a tooltip that appears when you hover over the magnifying glass icon on the right side of the bar. folder structure throughout this document, we will be using the following folder structure in all examples: your working directory (root) mozilla-1.9.2 (en-us source, pulled from http://hg.mozilla.org/releases/mozilla-1.9.2) l10n-mozilla-1.9.2 ...
... 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. ...
... this will be your guide to localize firefox. localiz...
...And 7 more matches
MathML Torture Test
se">)</mo> </mrow> </math> </td></tr> <tr> <td>22</td> <td><img src="https://udn.realityripple.com/samples/dc/c12454a963.png" width="159" height="81" alt="texbook, 18.41" /></td> <td> <math display="block"> <mrow> <mo stretchy="false">{</mo> <munder> <mrow> <mover> <mrow> <mp
added width="0em"><mphantom><mo>(</mo></mphantom></mp
added> <mi>a</mi> <mo>,</mo> <mo>...</mo> <mo>,</mo> <mi>a</mi> </mrow> <mover> <mo>&overbrace;</mo> <mrow> <mi>k</mi> <mtext> </mtext> ...
...row> <mover> <mo>&overbrace;</mo> <mrow> <mi>k</mi> <mtext> </mtext> <mi>a</mi> <mtext>'s</mtext> </mrow> </mover> </mover> <mo>,</mo> <mover> <mrow> <mp
added width="0em"><mphantom><mo>(</mo></mphantom></mp
added> <mi>b</mi> <mo>,</mo> <mo>...</mo> <mo>,</mo> <mi>b</mi> </mrow> <mover> <mo>&overbrace;</mo> <mrow> <mi>ℓ</mi> <mtext> </mtext> ...
...>d</mi> <mi>π</mi> <mo stretchy="false">(</mo> <mi>t</mi> <mo stretchy="false">)</mo> </mrow> </math> </td></tr> <tr> <td>22</td> <td> <math dir="rtl" display="block"> <mrow> <mo stretchy="false">{</mo> <munder> <mrow> <mover> <mrow> <mp
added width="0em"><mphantom><mo>(</mo></mphantom></mp
added> <mi>𞸀</mi> <mo>,</mo> <mo>...</mo> <mo>,</mo> <mi>𞸀</mi> </mrow> <mover> <mo>&overbrace;</mo> <mrow> <mi>𞸟</mi> <mtext>&n...
...And 7 more matches
PR_Accept
timeout a value of type printervaltime specifying the time limit for completion of the accept operation. ...
... timeout a value of type printervaltime specifying the time limit for completion of the accept operation. ...
... timeout a value of type printervaltime specifying the time limit for completion of the accept operation. ...
...And 7 more matches
NSS Tools modutil
using the security module database (modutil) newsgroup: mozilla.dev.tech.crypto the security module database tool is a command-line utility for managing pkcs #11 module information within secmod.db files or within hardware tokens. you can use the tool to
add and delete pkcs #11 modules, change passwords, 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 key3.db, cert8.db, and secmod.db security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases (key3.db files) and certificate databases (cert8.db files). the key, certificate, and pkcs #11 module...
...db, and cert8.db files. use the -dbdir directory argument to specify a directory. if any of these databases already exist in a specified directory, the security module database tool displays an error message. -list [modulename] display basic information about the contents of the secmod.db file. use modulename to display detailed information about a particular module and its slots and tokens. -
add modulename
add the named pkcs #11 module to the database. use this option with the -libfile, -ciphers, and -mechanisms arguments. -jar jar-file
add a new pkcs #11 module to the database using the named jar file. use this option with the -installdir and -tempdir arguments. the jar file uses the netscape server pkcs #11 jar format to identify all the files to be installed, the module's name, the ...
...directory. -dbprefix prefix specify the prefix used on the cert8.db and key3.db files (for example, my_cert8.db and my_key3.db). this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -libfile library-file specify a path to the dll or other library file containing the implementation of the pkcs #11 interface module that is being
added to the database. -ciphers cipher-enable-list enable specific ciphers in a module that is being
added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it contains spaces. the following cipher is currently available: fortezza. -mechanisms mechanism-list specify the security mechanisms for which a particular module will ...
...And 7 more matches
Property cache
erty is simple enough for optimized access, or a pointer to the js::shape if not. the opcodes that take advantage of the property cache, as of june 2009, are: getprop, get{x,this,arg,local}prop, and length; name; setprop, bindname, and setname; callprop and callname; and {inc,dec}name and name{inc,dec}. elem opcodes do not use it. nor do {inc,dec}prop or prop{inc,dec}. nor do operations such as
add that only need to look up a property (.tostring) in unusual cases. throughout this article, phrases such as "own property" should be taken to refer to the low-level representation of properties in scopes and shape chains. in the case of shared permanent properties, this differs from the notion of "own property" seen by scripts via object.prototype.hasownproperty. shape native objects have a sh...
...s, and no shape-regenerating gc occurred, then at t1 y has prototype z. (informally: changing an object's prototype changes its shape and the shape of every object that was on its prototype chain before the change. without this guarantee, every access to a property via a prototype chain would have to recheck each link in the prototype chain, even though assigning to __proto__ is very rare.)
adding guarantee — if at time t0 the object x has shape s, and rt->protohazardshape is z, and x does not inherit a jsprop_shared or jsprop_readonly property with name n from any prototype, and at time t1 an object y has shape s and rt->protohazardshape is z, and no shape-regenerating gc occurred, then y does not inherit a jsprop_shared or jsprop_readonly property named n from any prototype. (inform...
...arantee — if at time t0 the object x has shape s, and rt->protohazardshape is z, and x does not inherit a jsprop_shared or jsprop_readonly property with name n from any prototype, and at time t1 an object y has shape s and rt->protohazardshape is z, and no shape-regenerating gc occurred, then y does not inherit a jsprop_shared or jsprop_readonly property named n from any prototype. (informally:
adding a shared or readonly property to a prototype changes rt->protohazardshape.) (at the moment, xml objects and resolve hooks can trigger bugs in the implementation that break some of these guarantees. see bug 458271 and bug 507231 for example. there are probably similar bugs to do with, for example, xml objects' custom getproperty op.) dense arrays are shapeless. the shape of an object does...
...And 7 more matches
Introduction to the JavaScript shell
he javascript shell was built. note: clear() with no parameters really clears everything. this includes all these built-in functions. clone(function, [scope]) clones the specified function object. if scope isn't specified, the new object's parent is the same as the original object's. otherwise, the new object is placed in the scope of the object specified by scope. ...
...for more information, see the c/c++ version of this function, js_dumpheap. evalcx(string[, object]) evaluates the javascript code in string. if object is specified, the code is executed in that object, treating it as a sandbox. ...
...ed, evalcx() returns a new object with eager standard classes. if string is "lazy" and object is not specified, evalcx() returns a new object with lazy standard classes. note: evalcx() is only useful for people doing deep internal work on the javascript engine, for testing evalinsandbox-like environments in the shell. gc() runs the garbage collector to free up memory. gcparam(name[, value])
added in spidermonkey 1.8 read or configure garbage collector parameters. the name must be one of the parameter keys (such as 'maxbytes', 'maxmallocbytes' or 'gcnumber') defined by for_each_gc_param in https://searchfox.org/mozilla-central/source/js/src/builtin/testingfunctions.cpp#464. if value is not specified, gcparam() returns the current value associated with gc parameter named name. if value...
...And 7 more matches
TPS Tests
. a test file may contain an arbitrary number of sections, each involving the same or different profiles, so that one test file may be used to test the effect of syncing and modifying a common set of data (from a single sync account) over a series of different events and clients. set up an environment and run a test to run tps, you should create a new firefox account using a restmail.net email
address (strictly speaking, restmail isn't required, but it will allow tps to automatically do account confirmation steps for you. even if you opt not to use restmail, do not use your personal firefox account, as tps will delete and replace the data in it many times, not to mention the first run is very likely to fail, since it expects a clean start). note: be prepared not to use your computer for ...
...existing config (eg, the existing username and password), you should instead execute: python create_venv.py --keep-config %path% activate the environment source %path%/bin/activate run some tests note that the testfile is not a path, it should only be the filename from services/sync/tests/tps/ runtps --debug --testfile %test_file_name% --binary %firefox_binary_path%
additionally, omitting a --testfile parameter will cause it to run all tps tests listed in services/sync/tests/tps/all_tests.json an example on osx, for running just the test_sync.js testfile against a locally built firefox (where the mozconfig set the objdir to obj-ff-artifact): runtps --debug --testfile test_sync.js --binary obj-ff-artifact/dist/nightly.app/contents/macos/firefox ...
... dev instead of stage "identity.fxaccounts.autoconfig.uri": "https://accounts.stage.mozaws.net" // possibly more preferences... }, // ... } note that in this example, the foobar@restmail.net account must be registered on stage, otherwise authentication will fail (and the whole test will fail as well. you can sign up for an fxa account on stage or dev by creating an fxa account after
adding the identity.fxaccounts.autoconfig.uri preference (with the appropriate value) to about:config.
additionally, note that the config file must parse as valid json, and so you can't have comments in it (sorry, i know this is annoying). one alternative is to put underscores before the "disabled" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is ru...
...And 7 more matches
Finishing the Component
rface changes beneath your code can cause havoc. the danger of using unfrozen interfaces suppose that you need to use the interface nsifoo that isn't frozen. you build your component using this interface, and it works great with the version of gecko that you have tested against. however, some point in the future, the nsifoo interface requires a major change, and methods are reordered, some are
added, others are removed. moreover, since this interface was never supposed to be used by clients other than gecko or mozilla, the maintainers of the interface don't know that it's being used, and don't change the iid of the interface. when your component runs in a version of gecko in which this interface is updated, your method calls will be routed through a different v-table than the one the compo...
...chanism iweblock web lock not frozen enables and disables weblock. also, provides access to the url that are whitelisted. implementing the nsicontentpolicy interface to implement the new interface, you must #include the unfrozen nsicontentpolicy, and you must also make sure the build system can find the file you've brought over. ...
...policy, and you must also make sure the build system can find the file you've brought over. the location of the file and the steps for
adding that location to the build system vary depending on how you build this component. once you have made sure that your component builds with the new header file, you must derive the weblock class from the interface nsicontentpolicy, which you can do by simply
adding a public declaration when defining the class. at the same time, you can
add the macro ns_decl_nsicontentpolicy to the class declaration that provides all of the methods defined in the interface nsicontentpolicy. the updated weblock class looks as follows: class weblock: public nsiobserver, public iweblock, public nsicontentpolicy { public: weblock(); virtual ~weblock(); ns_decl...
...And 7 more matches
Components.utils.exportFunction
cope. in this way privileged code, such as an extension, can share code with less-privileged code like a normal web page script. a function exported from privileged to less-privileged code can be called from the less privileged code's context. the function has access to its surrounding closure just as if it were being called in the privileged context. the exported function does not have to be
added to the less privileged code's global window object: it can be exported to any object in the target scope. exportfunction() is made available as a global in sandboxes which have the wantexporthelpers option set in the sandbox() constructor. this includes
add-on sdk content scripts. to understand what happens if the functions you export accept arguments, see exporting functions that take argume...
...ake arguments below. syntax components.utils.exportfunction(func, targetscope[, options]); parameters func : function the function to export. targetscope : object the object to attach the function to. this does not have to be the global window object: it could be any other object in the target window, or an object created by the caller. options : object optional parameter that supplies
additional options. the following options are currently defined: defineas: determines the name of the function in targetscope. if this is omitted, you need to assign the return value of exportfunction() to an object in the target scope. allowcallbacks: deprecated/redundant from firefox 34. this option allows the exported function to accept callbacks as arguments. boolean, defaulting to false. th...
... xray filtering and waiving xrays provide a filtered view of the original ob...
...And 7 more matches
nsIDownloadManager
this interface is deprecated as of firefox 26. please use downloads.jsm instead. toolkit/components/downloads/public/nsidownloadmanager.idlscriptable this interface lets applications and extensions communicate with the download manager,
adding and removing files to be downloaded, fetching information about downloads, and being notified when downloads are completed. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/download-manager;1. ...
...ownloads are completed. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/download-manager;1. ...
...asses["@mozilla.org/download-manager;1"] .getservice(components.interfaces.nsidownloadmanager); method overview nsidownload
adddownload(in short adownloadtype, in nsiuri asource, in nsiuri atarget, in astring adisplayname, in nsimimeinfo amimeinfo, in prtime astarttime, in nsilocalfile atempfile, in nsicancelable acancelable, in boolean aisprivate); void
addlistener(in nsidownloadprogresslistener alistener); void canceldownload(in unsigned long aid); void cleanup(); void endbatchupdate(); obsolete since gecko 1.9.1 void flush(); obsolete since gecko 1.8 nsidownload getdownload(in unsigned long aid); void onclose(); obsolete since gecko 1.9.1 void open(in nsidomwindow aparent, in nsidown...
...And 7 more matches
nsINavHistoryService
components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsinavhistoryservice); method overview astring getpagetitle(in nsiuri auri); void markpageasfollowedbookmark(in nsiuri auri); void markpageasfollowedlink(in nsiuri auri); void markpageastyped(in nsiuri auri); boolean can
adduri(in nsiuri auri); long long
addvisit(in nsiuri auri, in prtime atime, in nsiuri areferringuri, in long atransitiontype, in boolean aisredirect, in long long asessionid); obsolete since gecko 22.0 nsinavhistoryquery getnewquery(); nsinavhistoryqueryoptions getnewqueryoptions(); nsinavhistoryresult executequery(in nsinavhistoryquery aquery, in nsinavhistoryquer...
...ns options); void querystringtoqueries(in autf8string aquerystring, [array, size_is(aresultcount)] out nsinavhistoryquery aqueries, out unsigned long aresultcount, out nsinavhistoryqueryoptions options); autf8string queriestoquerystring([array, size_is(aquerycount)] in nsinavhistoryquery aqueries, in unsigned long aquerycount, in nsinavhistoryqueryoptions options); void
addobserver(in nsinavhistoryobserver observer, in boolean ownsweak); void removeobserver(in nsinavhistoryobserver observer); void runinbatchmode(in nsinavhistorybatchcallback acallback, in nsisupports aclosure); void importhistory(in nsifile file); astring getcharsetforuri(in nsiuri auri); astring setcharsetforuri(in nsiuri auri, in astring acharset); ...
...bookmark. void markpageasfollowedbookmark( in nsiuri auri ); parameters auri the page that is to be marked as followed by a bookmark. markpageastyped() this method designates the url as having been explicitly typed in by the user, so it can be used as an autocomplete result. it is called by the url bar when the user types in a url. this can be and is called before the page is actually
added to history, since the page isn't
added until it actually starts loading. the typed flag affects the url bar autocomplete. this will cause the transition type of the next visit of the url to be marked as "typed." void markpageastyped( in nsiuri auri ); parameters auri the page that is to be marked as typed by the user. markpageasfollowedlink() designates the specified url as coming f...
...And 7 more matches
nsIPermissionManager
the nsipermissionmanager interface is used to persistently store permissions for different object types (cookies, images, and so on) on a site-by-site basis. netwerk/base/nsipermissionmanager.idlscriptable please
add a summary to this article. ...
... the nsipermissionmanager interface is used to persistently store permissions for different object types (cookies, images, and so on) on a site-by-site basis. netwerk/base/nsipermissionmanager.idlscriptable please
add a summary to this article. ...
...on) on a site-by-site basis. netwerk/base/nsipermissionmanager.idlscriptable please
add a summary to this article. ...
...And 7 more matches
nsISocketTransport
changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: connection setup is triggered by opening an input or output stream, it does not start on its own. completion of the connection setup is indicated by a status_connected_to notification to the event sink (if set). ...
...gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: connection setup is triggered by opening an input or output stream, it does not start on its own. completion of the connection setup is indicated by a status_connected_to notification to the event sink (if set). ...
...onkey 2.3) note: connection setup is triggered by opening an input or output stream, it does not start on its own. completion of the connection setup is indicated by a status_connected_to notification to the event sink (if set). ...
...And 7 more matches
Using the clipboard
acerequestor) .getinterface(ci.nsiwebnavigation); res.init(source); } return res; } here, the string "text to copy" will be copied but you can replace this with the text string that you want to copy. now that we have the object to copy, a transferring object needs to be created: var str = "text to copy"; var trans = transferable(sourcewindow); trans.
adddataflavor("text/unicode"); // we multiply the length of the string by 2, since it's stored in 2-byte utf-16 // format internally. trans.settransferdata("text/unicode", supportsstring(str), str.length * 2); the first line gets the transferring component which implements nsitransferable. next we need to initialize it with a "privacy context", which will ensure that source data from inside private...
... being copied -- from any dom element you can obtain it via element.ownerdocument.defaultview. if, and only if, you are placing data on the clipboard that is unrelated to web content the user is viewing, you can pass a null privacy context to the init method. the next step is to tell the transferable what type of data we want to use. the type of data is referred to as a data flavor. the function
adddataflavor is used to tell the transferable that it needs to transfer data of a certain flavor. in this case, we are transferring the flavor "text/unicode" which is a unicode string. then, the function settransferdata is called which copies the data from the string into the transferable. this function takes three parameters. the first is the flavor we are setting, the second is the object holding ...
...lled which copies the data from the string into the transferable. this function takes three parameters. the first is the flavor we are setting, the second is the object holding the string, and the third is the length of the data, in bytes. here, the length is multiplied by two because we are using a unicode string which requires two bytes per character. you can repeat the last two lines and call
adddataflavor and settransferdata for multiple flavors. that way, you could have a text version and an html version of the content. the transferable object will hold its own copy of the data. when you've
added all the flavors you want, you can put it all on the clipboard at once. the transferable object will hold all of the data that you want until you're ready to put it on the clipboard. services.c...
...And 7 more matches
DevTools API - Firefox Developer Tools
ly when the tool is selected (not when the toolbox is opened). there is no way to "close/destroy" a toolpanel. the only way to close a toolpanel is to close its containing toolbox. all these objects implement the eventemitter interface. api gdevtools the gdevtools api can be used to register new tools, themes and handle toolboxes for different tabs and windows. to use the gdevtools api from an
add-on, it can be imported with following snippet const { gdevtools } = require("resource:///modules/devtools/gdevtools.jsm"); methods registertool(tooldefinition) registers a new tool and
adds a tab to each existing toolbox. parameters: tooldefinition {tooldefinition} - an object that contains information about the tool. see tooldefinition for details. unregistertool(tool) unregist...
... toolbox object or undefined if there's no toolbox for the given target.. closetoolbox(target) closes the toolbox for given target. parameters: target {target} - the target of the toolbox that should be closed. return value: a promise that is fulfilled once the toolbox has been destroyed. getdefaulttools() returns an array of tooldefinition objects for the built-in tools. get
additionaltools() returns an array of tooldefinition objects for tools
added by
addons. gettooldefinition(toolid) fetch the tooldefinition object for a tool if it exists and is enabled. parameters: toolid {string} - the id of the tool. return value: a tooldefinition if a tool with the given id exists and is enabled, null otherwise. gettooldefinitionmap() returns a toolid → tool...
...e for a toolpanel implementation. // in the tooldefintion object, do // build: (window, target) => new mypanel(window, target), function mypanel(window, target) { // the window object that has loaded the url defined in the tooldefinition this.window = window; // the target this toolbox is debugging. this.target = target; // do synchronous initialization here. window.document.body.
addeventlistener("click", this.handleclick); } mypanel.prototype = { open: function() { // any asynchronous operations should be done here. return this.dosomethingasynchronous() .then(() => this); }, destroy: function() { // synchronous destruction. this.window.document.body.removeeventlistener("click", this.handleclick); // async destruction. return this.destro...
...And 7 more matches
about:debugging - Firefox Developer Tools
opening the about:debugging page there are two ways to open about:debugging: type about:debugging in the firefox url bar. in the tools > web developer menu, click remote debugging. ...
... click connect next to the device name to open a connection to it. if the connection was successful, you can now click the name of the device to switch to a tab with information about the device. the information on this page is the same as the information on the this firefox tab, but instead of displaying information for your computer, it displays the information for the remote device with the
addition of a tabs section with an entry for each of the tabs open on the remote device. note: if the version of firefox on your remote device is more than one major version older than the version running on your computer, you may see a message like the following: in firefox 76 and above, the message can look like the following: see connection for firefox for android 68 for more information. ...
...bug 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 preview, 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 browsing history with the back and forward buttons. connecting over the network you can ...
...And 7 more matches
Examples of web and XML development using the DOM - Web APIs
p into the dom. note that the table itself has an onclick event handler that ought to display a message when the table is clicked. but the stopevent method has stopped propagation, and so after the data in the table is updated, the event phase is effectively ended, and an alert box is displayed to confirm this. ...
...ata in the table is updated, the event phase is effectively ended, and an alert box is displayed to confirm this. <!doctype html> <html lang="en"> <head> <title>event propagation</title> <style> #t-d
addy { border: 1px solid red } #c1 { background-color: pink; } </style> <script> function stopevent(ev) { c2 = document.getelementbyid("c2"); c2.innerhtml = "hello"; // this ought to keep t-d
addy from getting the click. ...
...>event propagation</title> <style> #t-d
addy { border: 1px solid red } #c1 { background-color: pink; } </style> <script> function stopevent(ev) { c2 = document.getelementbyid("c2"); c2.innerhtml = "hello"; // this ought to keep t-d
addy from getting the click. ...
...And 7 more matches
How to create a DOM tree - Web APIs
this page describes how to use the dom core api in javascript to create and modify dom objects. it applies to all gecko-based applications (such as firefox) both in privileged (extensions) and unprivileged (web pages) code. ...
...nd modify dom objects. it applies to all gecko-based applications (such as firefox) both in privileged (extensions) and unprivileged (web pages) code. ...
... pages) code. ...
...And 7 more matches
IDBTransaction - Web APIs
actions. you use idbdatabase to start transactions, idbtransaction to set the mode of the transaction (e.g. is it readonly or readwrite), and you access an idbobjectstore to make a request. you can also use an idbtransaction object to abort transactions. note: this feature is available in web workers. ...
...1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store should contain the value "2", since trans2 should run after trans1. transaction failures 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 prevented by using preventdefault() 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 er...
...ommit() for an active transaction, commits the transaction. note that this doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made. commit() can be used to start the commit process without waiting for events from outstanding requests to be dispatched. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when an indexeddb transaction is aborted. also available via the onabort property. complete fired when a transaction successfully completes. also available via the oncomplete property. error fired when a request returns an error and the event bubbles up to the transaction object. ...
...And 7 more matches
URL API - Web APIs
the url api is a component of the url standard, which defines what constitutes a valid uniform resource locator and the api that accesses and manipulates urls. the url standard also defines concepts such as domains, hosts, and ip
addresses, and also attempts to describe in a standard way the legacy application/x-www-form-urlencoded mime type used to submit web forms' contents as a set of key/value pairs. url concepts and usage the majority of the url standard is taken up by the definition of a url and how it is structured and parsed. also covered are definitions of various terms related to
addressing of computers on a network, and the algorithms for parsing ip
addresses and dom
addresses are specified. more interesting to most developers is the api itself. accessing url components creati...
...in this case, those strings are developer.mozilla.org and /docs/web/api/url_api, respectively. ...
...in this case, those strings are developer.mozilla.org and /docs/web/api/url_api, respectively. ...
...And 7 more matches
WebRTC connectivity - Web APIs
channel. peer b will receive the offer from the signal channel and create an answer. they will then send this back to peer a along the signal channel. session descriptions the configuration of an endpoint on a webrtc connection is called a session description. the description includes information about the kind of media being sent, its format, the transfer protocol being used, the endpoint's ip
address and port, and other information needed to describe a media transfer endpoint. this information is exchanged and stored using session description protocol (sdp); if you want details on the format of sdp data, you can find it in rfc 2327. when a user starts a webrtc call to another user, a special description is created called an offer. this description includes all the information about the c...
...pient then responds with an answer, which is a description of their end of the call. in this way, both devices share with one another the information needed in order to exchange media data. this exchange is handled using interactive connectivity establishment (ice, a protocol which lets two devices use an intermediary to exchange offers and answers even if the two devices are separated by network
address translation (nat). each peer, then, keeps two descriptions on hand: the local description, describing itself, and the remote description, describing the other end of the call. the offer/answer process is performed both when a call is first established, but also any time the call's format or other configuration needs to change. regardless of whether it's a new call, or reconfiguring an exist...
...time the call's format or other configuration needs to change. regardless of whether it's a new call, or reconfiguring an existing one, these are the basic steps which must occur to exchange the offer and answer, leaving out the ice layer for the moment: the caller captures local media via navigator.mediadevices.getusermedia() the caller creates rtcpeerconnection and called rtcpeerconnection.
addtrack() (since
addstream is deprecating) the caller calls rtcpeerconnection.createoffer() to create an offer. the caller calls rtcpeerconnection.setlocaldescription() to set that offer as the local description (that is, the description of the local end of the connection). after setlocaldescription(), the caller asks stun servers to generate the ice candidates the caller uses the signaling serv...
...And 7 more matches
Lifetime of a WebRTC session - Web APIs
e 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. really big. ...
...nder construction, and some of the content will move to other pages as the webrtc guide material is built out. pardon our dust! ...
...as the webrtc guide material is built out. pardon our dust! ...
...And 7 more matches
Web applications and ARIA FAQ - Accessibility
what is aria? wai-aria is the accessible rich internet applications specification from the web accessibility initiative at the w3c. aria provides a means to make web applications and widgets more accessible to a diverse range of users, including those who use assistive technologies such as screen readers or magnifiers. aria provides
additional semantics to describe the role, state, and functionality of many familiar user interface controls, such as menus, sliders, trees, and dialogs. it also provides
additional structural information, helping authors identify landmarks, regions, and grids on their pages. aria enables dynamic, javascript-driven applications and widgets to interoperate with a variety of desktop-based assistive technologies. for more information about how to create ac...
...widgets. where is aria supported? aria is a relatively new specification, but support for it is growing. a wide variety of commonly-used browsers, assistive technologies, javascript toolkits, and applications now support aria. however, many users may still be using older versions of these technologies. you may want to consider implementing aria using progressive enhancement techniques—such as
adding aria using javascript, not directly to your markup—in order to more gracefully support older browsers and assistive technologies. browsers aria is supported in the following browsers: browser minimum version notes firefox 3.0+ works with nvda, jaws 10+, and orca chrome latest screen reader support still experimental as of chrome 15 saf...
... 10 window-eyes 7 no live region support currently zoomtext ? no live region support currently note: early versions of these tools often had partial or buggy aria implementations. for notes on jaws support for aria as of jaws 10, see this article from the paciello group: jaws support for aria. javascript toolkits aria roles, states, and properties have been
added to a number of popular javascript user interface toolkits, including: dojo/dijit jquery ui fluid infusion google closure google web toolkit bbc glow yahoo! user interface library (yui) for more information about javascript toolkit accessibility: steve faulkner's wai-aria implementation in javascript ui libraries can you show me an example of aria in action? sure. here's the mar...
...And 7 more matches
Consistent list indentation - CSS: Cascading Style Sheets
etails of list construction. making a list first, we consider a single, pure list item. this list item has no marker (otherwise known as a "bullet") and is not yet part of a list itself. it hangs alone in the void, simple and unadorned, as shown in figure 1. that dotted red border represents outer edges of the content-area of the list item. ...
...on. making a list first, we consider a single, pure list item. this list item has no marker (otherwise known as a "bullet") and is not yet part of a list itself. it hangs alone in the void, simple and unadorned, as shown in figure 1. that dotted red border represents outer edges of the content-area of the list item. remember that, at this point, the list item has no p
adding or borders. if we
add two more list items, we get a result like that shown in figure 2. now we wrap these in a parent element; in this case, we'll wrap them in an unordered list (i.e., <ul>). according to the css box model, the list items' boxes must be displayed within the parent element's content area. since that parent has no p
adding or margins yet, we get the situation shown in figure 3. here, the dotted blu...
...these in a parent element; in this case, we'll wrap them in an unordered list (i.e., <ul>). according to the css box model, the list items' boxes must be displayed within the parent element's content area. since that parent has no p
adding or margins yet, we get the situation shown in figure 3. here, the dotted blue border shows us the edges of the <ul> element's content area. since we have no p
adding for the <ul> element, its content wraps snugly around the three list items. now we
add the list item markers. since this is an unordered list, we'll
add traditional filled-circle "bullets," as shown in figure 4. visually, the markers are outside the content area of the <ul>, but that's not the important part here. what's key is that the markers are placed outside the "principal box" of the...
...And 7 more matches
Video player styling basics - Developer guides
is either obvious or not specifically relevant to styling the video player. ...
...== 'playpause') { if (video.paused || video.ended) { playpause.setattribute('data-state', 'play'); } else { playpause.setattribute('data-state', 'pause'); } } // mute button else if (type == 'mute') { mute.setattribute('data-state', video.muted ? ...
...('data-state', 'play'); } else { playpause.setattribute('data-state', 'pause'); } } // mute button else if (type == 'mute') { mute.setattribute('data-state', video.muted ? ...
...And 7 more matches
Audio and Video Delivery - Developer guides
ur audio or video player to have a consistent look across browsers, or just wish to tweak it to match your site. the general technique for achieving this is to omit the controls attribute so that the default browser controls are not displayed, create custom controls using html and css, then use javascript to link your controls to the audio/video api. if you need something extra, it's possible to
add features that are not currently present in default players, such as playback rate, quality stream switches or even audio spectrums. you can also choose how to make your player responsive — for example you might remove the progress bar under certain conditions. you may detect click, touch and/or keyboard events to trigger actions such as play, pause and scrubbing. it's often important to rememb...
...y detect click, touch and/or keyboard events to trigger actions such as play, pause and scrubbing. it's often important to remember keyboard controls for user convenience and accessibility. ...
...for more information, see creating your own custom audio player. other tips for audio/video stopping the download of media while stopping the playback of media is as easy as calling the element's pause() method, the browser keeps do...
...And 7 more matches
<input type="number"> - HTML: Hypertext Markup Language
e and input supported common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueasnumber methods select(), stepup(), stepdown() value any floating-point number, or empty. ...
...rted common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueasnumber methods select(), stepup(), stepdown() value any floating-point number, or empty. ...
...ceholder="multiple of 10"> controlling step size by default, the up and down buttons provided for you to step the number up and down will step the value up and down by 1. you can change this by providing a step attribute, which takes as its value a number specifying the step amount. our above example contains a placeholder saying that the value should be a multiple of 10, so it makes sense to
add a step value of 10: <input type="number" placeholder="multiple of 10" step="10"> in this example, you should find that the up and down step arrows will increase and decrease the value by 10 each time, not 1. you can still manually enter a number that's not a multiple of 10, but it will be considered invalid. specifying minimum and maximum values you can use the min and max attributes to spe...
...And 7 more matches
<input type="radio"> - HTML: Hypertext Markup Language
as many radio groups on a page as you like, as long as each has its own unique name. for example, if your form needs to ask the user for their preferred contact method, you might create three radio buttons, each with the name property set to contact but one with the value email, one with the value phone, and one with the value mail. the user never sees the value or the name (unless you expressly
add code to display it). the resulting html looks like this: <form> <p>please select your preferred contact method:</p> <div> <input type="radio" id="contactchoice1" name="contact" value="email"> <label for="contactchoice1">email</label> <input type="radio" id="contactchoice2" name="contact" value="phone"> <label for="contactchoice2">phone</label> <input type="ra...
...adio button is selected when the form is submitted, the radio group is not included in the submitted form data at all, since there is no value to report. 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. ...
...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. ...
...And 7 more matches
<input type="range"> - HTML: Hypertext Markup Language
of the min attribute. the algorithm for determining the default value is: defaultvalue = (rangeelem.max < rangeelem.min) ? rangeelem.min : rangeelem.min + (rangeelem.max - rangeelem.min)/2; if an attempt is made to set the value lower than the minimum, it is set to the minimum. similarly, an attempt to set the value higher than the maximum results in it being set to the maximum. ...
...algorithm for determining the default value is: defaultvalue = (rangeelem.max < rangeelem.min) ? rangeelem.min : rangeelem.min + (rangeelem.max - rangeelem.min)/2; if an attempt is made to set the value lower than the minimum, it is set to the minimum. similarly, an attempt to set the value higher than the maximum results in it being set to the maximum. ...
... step to 0.01: <input type="range" min="5" max="10" step="0.01"> if you want to accept any value regardless of how many decimal places it extends to, you can specify a value of any for the step attribute: <input type="range" min="0" max="3.14" step="any"> this example lets the user select any value between 0 and π without any restriction on the fractional part of the value selected. ...
...And 7 more matches
<input type="search"> - HTML: Hypertext Markup Language
text(), setselectionrange(). value the value attribute contains a domstring representing the value contained in the search field. you can retrieve this using the htmlinputelement.value property in javascript. searchterms = mysearch.value; if no validation constraints are in place for the input (see validation for more details), the value can be any text string or an empty string (""). ...
...). value the value attribute contains a domstring representing the value contained in the search field. you can retrieve this using the htmlinputelement.value property in javascript. searchterms = mysearch.value; if no validation constraints are in place for the input (see validation for more details), the value can be any text string or an empty string (""). ...
... be q=searchterm. you must remember to set a name for your input, otherwise 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 previously 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 c...
...And 7 more matches
<input type="tel"> - HTML: Hypertext Markup Language
eractive-examples and send us a pull request. despite the fact that inputs of type tel are functionally identical to standard text inputs, they do serve useful purposes; the most quickly apparent of these is that mobile browsers — especially on mobile phones — may opt to present a custom keypad optimized for entering phone numbers. using a specific input type for telephone numbers also makes
adding custom validation and handling of phone numbers more convenient. note: browsers that don't support type tel fall back to being a standard text input. value a domstring representing a telephone number, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, and size id...
...attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, and size idl attributes list, selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), setselectionrange() value the <input> element's value attribute contains a domstring that either represents a telephone number or is an empty string (""). ...
..., list, maxlength, minlength, pattern, placeholder, readonly, and size idl attributes list, selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), setselectionrange() value the <input> element's value attribute contains a domstring that either represents a telephone number or is an empty string (""). ...
...And 7 more matches
<input type="text"> - HTML: Hypertext Markup Language
elect(), setrangetext() and setselectionrange(). value the value attribute is a domstring that contains the current value of the text entered into the text field. you can retrieve this using the value property in javascript. let thetext = mytextinput.value; if no validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). ...
...d setselectionrange(). value the value attribute is a domstring that contains the current value of the text entered into the text field. you can retrieve this using the value property in javascript. let thetext = mytextinput.value; if no validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). ...
...ul pseudo-classes available for styling form elements to help the user see when their values are valid or invalid. these are :valid and :invalid. in this section, we'll use the following css, which will place a check (tick) mark next to inputs containing valid values, and a cross (x) next to inputs containing invalid values. div { margin-bottom: 10px; position: relative; } input + span { p
adding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; p
adding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; p
adding-left: 5px; } the technique also requires a <span> element to be placed after the form element, which acts as a holder for the icons. this was necessary because some input types on some browsers don't display icons p...
...And 7 more matches
Evolution of HTTP - HTTP
and to adapt its behavior in consequence (like in updating or using its local cache in a specific way) the notion of http headers has been introduced, both for the requests and the responses, allowing metadata to be transmitted and making the protocol extremely flexible and extensible. with the help of the new http headers, the ability to transmit other documents than plain html files has been
added (thanks to the content-type header). at this point, a typical request and response looked like this: get /mypage.html http/1.0 user-agent: ncsa_mosaic/2.0 (windows 3.1) 200 ok date: tue, 15 nov 1994 08:12:31 gmt server: cern/3.0 libwww/2.17 content-type: text/html <html> a page with an image <img src="/myimage.gif"> </html> followed by a second connection and request to fetch the image (...
...a lot of interoperability problems were common. in november 1996, in order to solve these annoyances, an informational document describing the common practices has been published, rfc 1945. this is the definition of http/1.0 and it is notable that, in the narrow sense of the term, it isn't an official standard. http/1.1 – the standardized protocol ...
...r, proper standardization was in progress. the first standardized version of http, http/1.1 was published in early 1997, only a few months after http/1.0. http/1.1 clarified ambiguities and introduced numerous improvements: a connection can be reused, saving the time to reopen it numerous times to display the resources embedded into the single original document retrieved. pipelining has been
added, allowing to send a second request before the answer for the first one is fully transmitted, lowering the latency of the communication. chunked responses are now also supported.
additional cache control mechanisms have been introduced. content negotiation, including language, encoding, or type, has been introduced, and allows a client and a server to agree on the most adequate content to exc...
...And 7 more matches
Closures - JavaScript
in this case, myfunc is a reference to the instance of the function displayname created when makefunc is run. the instance of displayname maintains a reference to its lexical environment, within which the variable name exists. for this reason, when myfunc is invoked, the variable name remains available for use, and "mozilla" is passed to alert. here's a slightly more interesting example—a make
adder function: function make
adder(x) { return function(y) { return x + y; }; } var
add5 = make
adder(5); var
add10 = make
adder(10); console.log(
add5(2)); // 7 console.log(
add10(2)); // 12 in this example, we have defined a function make
adder(x), that takes a single argument x, and returns a new function. the function it returns takes a single argument y, and returns the sum of x and y. ...
...ction make
adder(x) { return function(y) { return x + y; }; } var
add5 = make
adder(5); var
add10 = make
adder(10); console.log(
add5(2)); // 7 console.log(
add10(2)); // 12 in this example, we have defined a function make
adder(x), that takes a single argument x, and returns a new function. the function it returns takes a single argument y, and returns the sum of x and y. in essence, make
adder is a function factory. it creates functions that can
add a specific value to their argument. in the above example, the function factory creates two new functions—one that
adds five to its argument, and one that
adds 10.
add5 and
add10 are both closures. they share the same function body definition, but store different lexical environments. ...
... practical closures closures are useful because they let you associate data (the lexical environment) with a function that operates on that data. ...
...And 7 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. ...
...as passed in. 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.freeze(obj) parameters obj the object to freeze. return value the object that was passed to the function. description nothing can be
added to or removed from the properties set of a frozen object. any attempt to do so will fail, either silently or by throwing a typeerror exception (most commonly, but not exclusively, when in strict mode). for data properties of a frozen object, values cannot be changed, the writable and configurable attributes are set to false. accessor properties (getters and setters) work the same (and still gi...
...And 7 more matches
Porting the Library Detector - Archive of obsolete content
this example walks through the process of porting a xul-based
add-on to the sdk. it's a very simple
add-on and a good candidate for porting because there are suitable sdk apis for all its features. the
add-on is paul bakaus's library detector. the library detector tells you which javascript frameworks the current web page is using. it does this by checking whether particular objects that those libraries
add to the global window object are defined. for example, if window.jquery is defined, then the page has loaded jquery. for each library that it finds, the library detector
adds an icon representing that library to the status bar. it
adds a tooltip to each icon, which contains the library name and version. you can browse and run the ported version in the sdk's examples directory. how t...
...t it finds, the library detector
adds an icon representing that library to the status bar. it
adds a tooltip to each icon, which contains the library name and version. you can browse and run the ported version in the sdk's examples directory. how the library detector works all the work is done inside a single file, librarydetector.xul this contains: a xul overlay a script the xul overlay
adds a box element to the browser's status bar: the script does everything else. the bulk of the script is an array of test objects, one for each library. each test object contains a function called test(): if the function finds the library, it defines various
additional properties for the test object, such as a version property containing the library version. each test also contains a chrome:// ur...
... finally, it listens to gbrowser's tabselect event, to update the contents of the box for that window. ...
...And 6 more matches
private-browsing - Archive of obsolete content
check whether a given object is private, so an
add-on can respect private browsing usage per-window private browsing private browsing status is a property of an individual browser window. the user enters private browsing by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...n respect private browsing usage per-window private browsing private browsing status is a property of an individual browser window. the user enters private browsing by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...ng by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...And 6 more matches
platform/xpcom - Archive of obsolete content
bjects from there. implementing xpcom interfaces this module exports a class called unknown which implements the fundamental xpcom interface nsisupports. by subclassing unknown, either using standard javascript inheritance or using the sdk's heritage module, you can provide your own implementations of xpcom interfaces. "unknown" is named after the "iunknown" interface in com. for example, the
add-on below implements the nsiobserver interface to listen for and log all topic notifications: var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome') var observerservice = cc['@mozilla.org/observer-service;1']. getservice(ci.nsiobserverservice); var starobserver = class({ extends: unknown, inte...
...var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome') var observerservice = cc['@mozilla.org/observer-service;1']. ...
...bserve: function observe(subject, topic, data) { console.log('star observer:', subject, topic, data); } }); var starobserver = starobserver(); starobserver.register(); implementing xpcom factories the xpcom module exports a class called factory which implements the nsifactory interface. you can use this class to register factories for xpcom components you have defined. for example, this
add-on defines a subclass of unknown called helloworld that implements a function called hello. by creating a factory and passing it the contract id for the helloworld component and the helloworld constructor, we enable xpcom clients to access the helloworld component, given its contract id. in this example the helloworld component is available to javascript only, so we use the technique documented ...
...And 6 more matches
Enhanced Extension Installation - Archive of obsolete content
e extension system when it discovers that the xpi file contains an install.rdf manifest. the extension manager extracts that file and checks to see if the item is compatible with the running version of the application. if it is, a small set of metadata about it is written to the appropriate datasource (name, version, a flag to tell the system to properly install it on the next startup), and it is
added to the appropriate type container. the system also writes a .autoreg file to the profile folder which tells the startup system that something has changed on the next restart. a copy of the xpi file the item was installed from is set aside since the xpinstall system cleans up the temporary file it hands to the extension system. if the item is not compatible, the extension system asks the approp...
...he appropriate update service (either the one specified by the item, or the default one) if there is remote compatibility information that supercedes the compatibility information held by the item. if there is, and this remote information makes it so that the item is now compatible with the running version of the application, the item is configured in the manner described above (metadata written,
added to container). finalization for themes, the item is immediately installed fully, rather than awaiting the next restart, since themes do not supply xpcom components, preferences defaults etc. for extensions, on the next startup, the startup system notices the presence of the .autoreg file and starts the extension manager with a "dirty" flag, telling it to finish any install operations that ma...
...y" flag, telling it to finish any install operations that may be pending. the extension manager loads the xml/rdf datasources (this is allowable and necessary because a major change has happened) and gets a list of all items that need to be installed (tracked using a tobeinstalled flag on the item in the datasource). it locates the staged copy of the xpi file, extracts its contents (logging file
additions as it goes into {guid}/uninstall/uninstall), loads the install manifest file and copies all metadata into the appropriate datasource. at this time a new extensions.ini file is written locating the extension so that the component manager, preferences system and chrome registry can locate
additional files on the next start. the finalization process then notifies the startup process that final...
...And 6 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
ion from the copyright holder. how software licenses work in order to duplicate, distribute, or modify software, you need a use permit. duplicating software would be burning cd-rs or downloading from the internet (copying from server to client). distributing software would be selling that cd-r or publishing the software on the internet. modifying software would be changing its functionality or
adding new functions. duplication: copying a piece of software distribution: passing a piece of software to another person modification: modifying 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 duplic...
......
... 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 prevent 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 extent possible. types of oss licenses and their ...
...And 6 more matches
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
add-ons normally run code at startup, and as it is covered in the main tutorial, all you need is a load event handler and a little code. it is also common for an
add-on to require to run a script only when it is installed for the first time, or every time it is updated. it can be used to write or copy necessary files to the profile folder, like the initial db the
add-on will use for storage. a few others require cleanup code to be run after the
add-on is uninstalled. this appendix covers these cases with simple code that should work for most
add-ons. install scripts just like with a regular initialization function, we want a load event handler: // rest of overlay code goes here. ...
...the best approach in this case is to use a preference, as explained in the handling preferences section. ...
... value before you run any other first run code. keep in mind that the user could have set multiple firefox windows to open at startup, so there's a race condition on which window will run the first run code. if you need to run code on every update, or some of them, the code would be very similar. instead of a boolean preference, it would be best to use a string preference with the last-installed
add-on version. and then do a version comparison to decide which code to run. the current version number can be hard-coded in the first run function, or you can use the
add-on manager to dynamically get it. this can get tricky with the firefox 4
addonmanager, so it's probably best to keep it simple. uninstall scripts there are two common cases for needing these: cleaning up local data and presentin...
...And 6 more matches
Custom XUL Elements with XBL - Archive of obsolete content
as tabs, buttons and input controls are implemented using xbl and simpler xul elements. as explained earlier, xul is really just boxes, text and images. we'll look into xbl using a modified version of the hello world extension. download the hello world xbl project, build it and test it for a while. you should see a new item in the hello world menu, that opens a binding test window where you can
add "persons" to a list. xbl basics in order to create an xbl binding you'll need 2 files: the xbl file and a css file that binds an element name to your xbl declaration. if you look into the content directory, you'll see both files: person.xml - this is the main binding file. it holds all the code necessary to control the new element we created. we'll look into the code throughout the rest of t...
...se bindings on toolbar elements, remember to include the css file in the customize dialog, using the style directive in the chrome.manifest file. with those 2 files properly defined, we can now use the new element. if you look at file bindingdialog.xul, you'll see that the css stylesheet is included, which means that the xshelloperson tag can now be used just like any xul tag. in this case we're
adding the "persons" dynamically, so you'll have to look into the js file to see how xshelloperson elements are created and
added to the dom just like any other.
addperson : function(aevent) { // ... let person = document.createelement("xshelloperson"); // ... person.setattribute("name", name); person.setattribute("greeting", greeting); // ... personlist.appendchild(person); // ... }...
.../xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> the bindings element is the root of the document, and it's a container for binding elements. notice how the default namespace for the document is xbl, and the xul namespace is defined as "xul". you'll need to keep this in mind when defining the content of the binding, because weird things can happen if you don't
add "xul:" to your content nodes. <binding id="person"> in general, you should only have one binding per file. bindings tend to require many lines of code, and having more than one ends up making gigantic, unbrowsable files. on the other hand, if your bindings are small and have a strong relationship with each other, it makes sense to keep them together. as for the css file, it's usually good t...
...And 6 more matches
Getting Started with Firefox Extensions - Archive of obsolete content
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. ...
...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. ...
...illa applications such as firefox and thunderbird. 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. it is also worth noting that there are differences between the definition of extension and
add-on. ...
...And 6 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
ers format text layouts into pages and link those pages to related content, is analogous to a book or a magazine: readers view pages, go to other pages for more information, and view resources listed as references on that page. html and web standards have evolved and now offer flexible and fine-grained control to layout as well supporting dhtml, powerful programming languages like javascript, and
additional media through embeddable third-party resources like flash, java, vrml, etc.
additionally, server-side technologies have also evolved, supporting and connecting different resources to different browsers. despite all the evolution, we still see the underpinnings of the original model in modern web sites. we still connect through a set of links that mostly drive us to a new page, and we still...
...des the dhtml element. we've separated this sample in two main components following the model. the data loader module and the data binder module. the data loader module is responsible for the requests and retrieves the stock data information from the web. it also sends an event to the data binder module. the data binder module is responsible for the binding of the data with the html interface. ...
...this example uses an iframe element as the mechanism to establish the communication with the server side application. ...
...And 6 more matches
Localizing an extension - Archive of obsolete content
« previousnext » this article expands upon the previous 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 previous 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...
...abel "apple (aapl)"> <!entity menu_google.label "google (goog)"> <!entity menu_microsoft.label "microsoft (msft)"> <!entity menu_yahoo.label "yahoo (yhoo)"> update the xul files each xul file needs to reference its corresponding locale file. we also need to update the code to use the entities instead of the strings, so that the substitutions take place based on the currently active locale. ...
...menu_microsoft.label "microsoft (msft)"> <!entity menu_yahoo.label "yahoo (yhoo)"> update the xul files each xul file needs to reference its corresponding locale file. we also need to update the code to use the entities instead of the strings, so that the substitutions take place based on the currently active locale. to
add a reference to the correct locale file for a given xul file, we need to
add one line to the xul file. to options.xul, we
add this line: <!doctype window system "chrome://stockwatcher2/locale/options.dtd"> we
add a similar line to the stockwatcher.xul file: <!doctype overlay system "chrome://stockwatcher2/locale/stockwatcher2.dtd"> in larger applications you might need to use entities from several locale files in a single xul file. using multiple dtds describes how to...
...And 6 more matches
MMgc - Archive of obsolete content
suspect you have missing write barriers, turn these switches on in a debug build. (the second switch will slow your application down a lot more than the first switch, so you could try the first, then the second.) when a missing write barrier is detected, mmgc will assert and drop you into the debugger, and will print out a message telling you which object contained the missing write barrier, the
address of the member variable that needs it, and what object didn't get marked due to the missing write barrier. sometimes, this missing write barrier detection will turn up a false positive. if you can't find anything wrong with the code, it might just be a false positive. debugging aids mmgc has several debugging aids that can be useful in your development work. underwrite/overwrite detection mmgc...
...mmgc has several debugging aids that can be useful in your development work. underwrite/overwrite detection mmgc can often detect when you write outside the boundaries of an object, and will throw an assert in debugging builds when this happens. leak detection (for unmanaged memory) when the application is exiting, mmgc will detect memory leaks in its unmanaged memory allocators and print out the
addresses and sizes of the leaked objects, and stack traces if stack traces are enabled. stack traces are enabled via the mmgc_memory_profiler feature and setting the mmgc_profile environment variable to 1. the mmgc_memory_profiler feature is implied by the debugger feature and is always on in debug builds. deleted object poisoning and write detection mmgc will "poison" memory for deleted objects, a...
...c 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 previous 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 as
addref and release are called at the proper times, can reclaim memory from objects that are no longer referenced. problem: circular references reference counting fall...
...And 6 more matches
JavaScript crypto - Archive of obsolete content
tokens, and signing text. handling smart card events web sites can make themselves more smartcard friendly by listening for smartcard insertion and removal events. to enable your document to receive these events, you must first tell the crypto system you are interested by setting window.crypto.enablesmartcardevents to true. you can then register event handlers for these events with the document.
addeventlistener() method. two smart card related events are generated: smartcard-insert when smartcards are inserted, and smartcard-remove when smartcards are removed. web sites which use ssl clientauth login could use the following code to refresh the page on token insertions and removals: <!doctype html> <p>... <script> function onsmartcardchange() { window.location.reload(); } function regis...
...ted: smartcard-insert when smartcards are inserted, and smartcard-remove when smartcards are removed. web sites which use ssl clientauth login could use the following code to refresh the page on token insertions and removals: <!doctype html> <p>... ...
...en smartcards are removed. web sites which use ssl clientauth login could use the following code to refresh the page on token insertions and removals: <!doctype html> <p>... ...
...And 6 more matches
Nanojit - Archive of obsolete content
irbuffer(*alloc); #ifdef debug fragmento->labels = new (*alloc) labelmap(*alloc, &lc); buf->names = new (*alloc) lirnamemap(*alloc, fragmento->labels); #endif // create a fragment to hold some native code. fragment *f = fragmento->getanchor((void *)0xdeadbeef); f->lirbuf = buf; f->root = f; // create a lir writer lirbufwriter out(buf); // write a few lir instructions to the buffer:
add the first parameter // to the constant 2. out.ins0(lir_start); lins *two = out.insimm(2); lins *firstparam = out.insparam(0, 0); lins *result = out.ins2(lir_
add, firstparam, two); out.ins1(lir_ret, result); // emit a lir_loop instruction. it won't be reached, but there's // an assertion in nanojit that trips if a fragment doesn't end with // a guard (a bug in nanojit). lins *rec_ins =...
... + 1); guard->exit = exit; guard->exit->target = f; f->lastins = out.insguard(lir_loop, out.insimm(1), rec_ins); // compile the fragment. compile(assm, f, *alloc verbose_only(, fragmento->labels)); if (assm->error() != none) { fprintf(stderr, "error compiling fragment\n"); return 1; } printf("compilation successful.\n"); // call the compiled function. ...
... exit; guard->exit->target = f; f->lastins = out.insguard(lir_loop, out.insimm(1), rec_ins); // compile the fragment. compile(assm, f, *alloc verbose_only(, fragmento->labels)); if (assm->error() != none) { fprintf(stderr, "error compiling fragment\n"); return 1; } printf("compilation successful.\n"); // call the compiled function. ...
...And 6 more matches
Grids - Archive of obsolete content
as with a table. however, you can still use columns to specify the size and appearance of the columns in a grid. alternatively, you can put content inside the columns, and use the rows to specify the appearance. we'll look at the case of organizing elements by row first. declaring a grid to declare a set of rows, use the rows tag, which should be a child element of grid. inside that you should
add row elements, which are used for each row. inside the row element, you should place the content that you want inside that row. similarly, the columns are declared with the columns element, which should be placed as a child element of the grid. inside that go individual column elements, one for each column you want in the grid. this should be easier to understand with an example. example 1 : so...
...s should be easier to understand with an example. example 1 : source view <grid flex="1"> <columns> <column flex="2"/> <column flex="1"/> </columns> <rows> <row> <button label="rabbit"/> <button label="elephant"/> </row> <row> <button label="koala"/> <button label="gorilla"/> </row> </rows> </grid> two rows and two columns have been
added to a grid. each column is declared with the column tag. each column has been given a flex attribute. each row contains two elements, both buttons. the first element in each row element is placed in the first column of the grid and the second element is each row is placed in the second column. note that you do not need an element to declare a cell -- there is no equivalent of the html td element...
...value="path:"/> <hbox flex="1"> <textbox id="docpath" flex="1"/> <button label="browse..."/> </hbox> </row> </rows> </grid> notice in the image how the first column of elements containing the labels has only a single element in each row. the second column contains a box in its second row, which in turn contains two elements, a textbox and a button. you could
add additional nested boxes or even another grid inside a single cell. if you resize the window of the last example, you will see that the textboxes resize, but no other elements do. this is because of the flex attributes
added to the textboxes and the second column. the first column does not need to be flexible as the labels do not need to change size. the initial width of a column is determined b...
...And 6 more matches
Tree View Details - Archive of obsolete content
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. ...
...he topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. the tree will query the view for each row by calling its getlevel method to find out the level of that row. the view will need to return 0 for the outermost rows and higher values for inner rows. the tree will use this information to determine the hierarchical structure of the rows. in
addition to the getlevel method, there is a hasnextsibling function which, given a row, should return true if there is another row afterwards at the same level. this function is used, specifically, to draw the nesting lines along the side of the tree. the getparentindex method is expected to return the parent row of a given row, that is, the row before it with a lower nesting value. all of these met...
...f their own and several are open. it could take a while in some implementations to determine what the next sibling's row index would be in such a case. example of hierarchical custom view let's put this together into a simple example that takes an array and constructs a tree from it. this tree will only support a single parent level with an inner child level, but it could be extended to support
additional levels without too much effort. we'll examine it piece by piece. <window onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementlist" flex="1"> <treecols> <treecol id="element" label="element" primary="true" flex="1"/> </treecols> <treechildren/> </tree> </window> we use a simple tree here with no data in the treechil...
...And 6 more matches
Using Spacers - Archive of obsolete content
applications that need to support multiple platforms and languages usually have their windows laid out with lots of space to allow for this. ...
...applications that need to support multiple platforms and languages usually have their windows laid out with lots of space to allow for this. ...
...applications that need to support multiple platforms and languages usually have their windows laid out with lots of space to allow for this. ...
...And 6 more matches
XUL Structure - Archive of obsolete content
the mozilla rendering engine takes the content in the form of html source and transforms it into a document tree. ...
...ile using a chrome url, the files receive elevated privileges to access local files, access preferences and bookmarks and perform other privileged operations. obviously, web pages do not get these privileges, unless they are signed with a digital certificate and the user has granted permission to perform these operations. this chrome package registration is the way firefox extensions are able to
add features to the browser. the extensions are small packages of xul files, javascript, style sheets and images packed together into a single file. these packaged files can be created by using a zip utility. when the user downloads the zipped file, the packaged files will be installed onto the user's machine. the extension will hook into the browser using a xul specific feature called an overlay whi...
...u want pre-installed. each extension is something of a standalone component with a separate chrome url. mozilla also has one component for each installed theme and locale. each of these components, or packages, is made up of a set of files that describe the user interface for it. for example, the messenger component has descriptions of the mail messages list window, the composition window and the
address book dialogs. the packages that are provided with mozilla are located within the chrome directory, which is in the directory where you built mozilla. the chrome directory is where you find all the files that describe the user interface used by the mozilla browser, mail client, and other applications. typically, you put all the xul files for an application in this directory, although extensio...
...And 6 more matches
The Implementation of the Application Object Model - Archive of obsolete content
merging good for? the first reason to have local/remote merging is that a remote file must be able to reference local data and have it merged in with the information that it specified. an example of this feature is a downloadable file that describes the user's main bookmarks folder. because the file lives remotely, it can be updated whenever the owner of the web site sees fit. a site admin could
add new bookmarks to the file, and then the user would pick them up. however, in order for this to work, the local bookmarks have to be merged in with the remote bookmarks specified by the site. the second reason to have local/remote merging is to save state and/or to record customizations that the user has made to his or her user interface. imagine a remote file that describes the user's personal to...
...tree in which it might occur), you have an easy means of distinguishing the two trees and preventing 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. ...
...by making xul a separate beast, this is less of an issue. ...
...And 6 more matches
Debugging a XULRunner Application - Archive of obsolete content
ponents.interfaces.nsiconsoleservice) .logstringmessage(str); } for more information about the error console see the error console and browser console article. browser debugger as of gecko 44, it is no longer possible to start the devtools server from xul apps. see bug 1244163. starting with xulrunner 24, you should use the firefox browser debugger to debug your xulrunner apps. ...
... starting with xulrunner 24, you should use the firefox browser debugger to debug your xulrunner apps.
add the following code to your xul app: components.utils.import('resource://gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { debuggerserver.init(); // don't specify a window type parameter below if "navigator:browser" // is suitable for your app. ...
...pe parameter below if "navigator:browser" // is suitable for your app. debuggerserver.
addbrowseractors("myxulrunnerappwindowtype"); } debuggerserver.openlistener(6000); for xulrunner version 37+ the code to enable the debugger has changed: components.utils.import('resource://gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { debuggerserver.init(); debuggerserver.
addbrowseractors(); debuggerserver.allowchromeprocess = true; } let dbglistener=debuggerserver.createlistener(); dbglistener.portorpath=6000; dbglistener.open();
add the following to your prefs.js: (in recent ffox, edit about:config instead) pref("devtools.debugger.remote-enabled", true); in firefox, go to tools > web developer > connect... and you should be able to point the debugger to your...
...And 6 more matches
XULRunner tips - Archive of obsolete content
for firefox, suite, etc.) the function toopenwindowbytype() needs to be defined. there is a working stub. any better suggestion? venkman uses "chrome://communicator/skin/" as an alias for "chrome://global/skin/" and this alias was maintained in the xulrunner toolkit until xulrunner 1.9 was released. ...
...d. there is a working stub. any better suggestion? venkman uses "chrome://communicator/skin/" as an alias for "chrome://global/skin/" and this alias was maintained in the xulrunner toolkit until xulrunner 1.9 was released. when using xulrunner 1.9 or greater, you can create your own alias in your chrome manifest
add a "skin" line: skin communicator classic/1.0 skin/communicator/
add a skin folder named "communicator" and
add a single css file named "communicator.css" with this content: @import url("chrome://global/skin"); dom inspector to
add dom inspector 2.0.* to your xulrunner 1.9.0.* application follow these steps: download the dom inspector (instead of clicking the "
add to..." button, right-click and select "save link as..."). save the dom_inspector-...
...tton, right-click and select "save link as..."). ...
...And 6 more matches
Mouse controls - Game development
« previousnext » this is the 9th step out of 10 of the gamedev canvas tutorial. 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. ...
...hould 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. ...
...y 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.
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 p
addle movement to the mouse movement we can update the p
addle position based on the pointer coordinates — the following handler function will do exactly that. ...
...And 6 more matches
Images, media, and form elements - Learn web development
ch 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 previous 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 smaller to fit into the box. you can make other choices about images inside containers. for example, you may want to size an image so it completely covers a box. the object-fit property can help you here. when using object-fit the replaced element can b...
...uld however stretch the image, so probably isn't what you'd want to do. form elements form elements can be a tricky issue when it comes to styling with css, and the web forms module contains detailed guides to the trickier aspects of styling form elements, which i will not fully reproduce here. there are a few key basics worth highlighting in this section of the article. many form controls are
added to your page by way of the <input> element — this defines simple form fields such as text inputs, through to more complex fields
added in html5 such as color and date pickers. there are some
additional elements, such as <textarea> for multiline text input, and also elements used to contain and label parts of forms such as <fieldset> and <legend>. html5 also contains attributes that enable we...
...ypes such as <input type="email">, and the <textarea> element are quite easy to style and tend to behave just like other boxes on your page. the default styling of these elements will differ however based on the operating system and browser that your user visits the site with. in the example below we have styled some text inputs using css — you can see that things such as borders, margins and p
adding all apply as you would expect. we are using attribute selectors to target the different input types. try changing how this form looks by adjusting the borders,
adding background colors to the fields, and changing fonts and p
adding. important: you should take care when changing the styling of form elements to make sure it is still obvious to the user they are form elements. you could create...
...And 6 more matches
Styling lists - Learn web development
the <dd> elements have margin-left of 40px (2.5em.) the <p> elements we've included for reference have a top and bottom margin of 16px (1em), the same as the different list types. handling list spacing when styling lists, ...
.../dd> </dl> if you go to the live example now and investigate the list elements using browser developer tools, you'll notice a couple of styling defaults: the <ul> and <ol> elements have a top and bottom margin of 16px (1em) and a p
adding-left of 40px (2.5em.) the list items (<li> elements) have no set defaults for spacing. the <dl> element has a top and bottom margin of 16px (1em), but no p
adding set. the <dd> elements have margin-left of 40px (2.5em.) the <p> elements we've included for reference have a top and bottom margin of 16px (1em), the same as the different list types. handling list spacing when styling lists, you need to adjust their styles so they keep the same vertical spacing as their surrounding elements (such as paragraphs and images; sometimes called vertical rhyth...
...image: url(star.svg); } however, this property is a bit limited in terms of controlling the position, size, etc. of the bullets. you are better off using the background family of properties, which you've learned in the backgrounds and borders article. for now, here's a taster! in our finished example, we have styled the unordered list like so (on top of what you've already seen above): ul { p
adding-left: 2rem; list-style-type: none; } ul li { p
adding-left: 2rem; background-image: url(star.svg); background-position: 0 0; background-size: 1.6rem 1.6rem; background-repeat: no-repeat; } here we've done the following: set the p
adding-left of the <ul> down from the default 40px to 20px, then set the same amount on the list items. this is so that overall the list items are stil...
...And 6 more matches
The HTML5 input types - Learn web development
prerequisites: basic computer literacy, and a basic understanding of html. ...
...ions. if you want more detail on browser support, you should consult our html forms element reference, and in particular our extensive <input> types reference. because html form control appearance may be quite different from a designer's specifications, web developers sometimes build their own custom form controls. we cover this in an advanced tutorial: how to build custom form widgets. e-mail
address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email
address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the multiple attribut...
...e type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email
address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the multiple attribute in combination with the email input type to allow several email
addresses to be entered in the same input (separated by commas): <input type="email" id="email" name="email" multiple> on some devices — notably, touch devices with dynamic keyboards like smart phones — a different virtual keypad might be presented that is more suitable for entering email
addresses, including the @ key. see the firefox for android keyboard screenshot below for an example: n...
...And 6 more matches
Example 1 - Learn web development
: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; p
adding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow ...
...: #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; p
adding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em...
...color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { p
adding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } result for basic state active state html <div class="select active"> <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> ...
...And 6 more matches
Example 4 - Learn web development
: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; p
adding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);...
... #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; p
adding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em...
...t { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { p
adding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('ac...
...And 6 more matches
Basic math in JavaScript — numbers and operators - Learn web development
r + 3; you end up with the result 743, not 77, because mynumber is actually defined as a string. you can test this by typing in the following: typeof mynumber; to fix the calculation, you can do this: number(mynumber) + 3; arithmetic operators arithmetic operators are the basic operators that we use to do sums in javascript: operator name purpose example +
addition
adds two numbers together. 6 + 9 - subtraction subtracts the right number from the left. 20 - 15 * multiplication multiplies two numbers together. 3 * 7 / division divides the left number by the right. 10 / 5 % remainder (sometimes called modulo) returns the remainder left over after you've divided the left numbe...
...rowser does "10 divided by 8 equals 1.25", then "50 plus 1.25 plus 2 equals 53.25". this is because of operator precedence — some operators are applied before others when calculating the result of a calculation (referred to as an expression, in programming). operator precedence in javascript is the same as is taught in math classes in school — multiply and divide are always done first, then
add and subtract (the calculation is always evaluated from left to right). if you want to override operator precedence, you can put parentheses round the parts that you want to be explicitly dealt with first. so to get a result of 6, we could do this: (num2 + num1) / (8 + 2); try it and see. note: a full list of all javascript operators and their precedence can be found in expressions and operat...
...u want to override operator precedence, you can put parentheses round the parts that you want to be explicitly dealt with first. so to get a result of 6, we could do this: (num2 + num1) / (8 + 2); try it and see. note: a full list of all javascript operators and their precedence can be found in expressions and operators. increment and decrement operators sometimes you'll want to repeatedly
add or subtract one to or from a numeric variable value. this can be conveniently done using the increment (++) and decrement (--) operators. we used ++ in our "guess the number" game back in our first splash into javascript article, when we
added 1 to our guesscount variable to keep track of how many guesses the user has left after each turn. guesscount++; note: these operators are most commonly ...
...And 6 more matches
Inheritance in JavaScript - 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). ...
...onstructors. say we wanted to create a teacher class, like the one we described in our initial object-oriented definition, which inherits all the members from person, but also includes: a new property, subject — this will contain the subject the teacher teaches. ...
...embers from person, but also includes: a new property, subject — this will contain the subject the teacher teaches. an updated greeting() method, which sounds a bit more formal than the standard greeting() method — more suitable for a teacher
addressing some students at school. defining a teacher() constructor function the first thing we need to do is create a teacher() constructor —
add the following below the existing code: function teacher(first, last, age, gender, interests, subject) { person.call(this, first, last, age, gender, interests); this.subject = subject; } this looks similar to the person constructor in many ways, but there is something strange here that we've not seen before — the call() function. this function basically allows you to call a function defin...
...And 6 more matches
Client-Server Overview - Learn web development
file, a particular data point on the server, or a tool to run). a method that defines the required action (for example, to get a file or to save or update some data). the different methods/verbs and their associated actions are listed below: get: get a specific resource (e.g. an html file containing information about a product, or a list of products). post: create a new resource (e.g.
add a new article to a wiki,
add a new contact to a database). head: get the metadata information about a specific resource without getting the body like get would. you might for example use a head request to find out the last time a resource was updated, and then only use the (more "expensive") get request to download the resource if it has changed. put: update an existing resource (or creat...
...head request to find out the last time a resource was updated, and then only use the (more "expensive") get request to download the resource if it has changed. put: update an existing resource (or create a new one if it doesn't exist). delete: delete the specified resource. trace, options, connect, patch: these verbs are for less common/advanced tasks, so we won't cover them here.
additional information can be encoded with the request (for example, html form data). information can be encoded as: url parameters: get requests encode data in the url sent to the server by
adding name/value pairs onto the end of it — for example http://mysite.com?name=fred&age=11. you always have a question mark (?) separating the rest of the url from the url parameters, an equals sign (=) ...
...ion mark (?) separating the rest of the url from the url parameters, an equals sign (=) separating each name from its associated value, and an ampersand (&) separating each pair. url parameters are inherently "insecure" as they can be changed by users and then resubmitted. as a result url parameters/get requests are not used for requests that update data on the server. post data. post requests
add new resources, the data for which is encoded within the request body. client-side cookies. cookies contain session data about the client, including keys that the server can use to determine their login status and permissions/accesses to resources. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the ...
...And 6 more matches
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. ...
... 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. planning out the layout of the todomvc app in the last article we set up a new ember project, then
added and configured our css styles. at this point we
add some html, planning out the structure and semantics of our todomvc app. the 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...
...g out the structure and semantics of our todomvc app. the 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 previous 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="...
...And 6 more matches
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. ...
...hat 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 how to use vue computed properties. using computed properties the aim here is to
add a summary count of our to-do list. this can be useful for users, while also serving to label the list for assistive technology. if we have 2 of 5 items completed in our to-do list, our summary could read "3 items completed out of 5". while it might be tempting to do something like this: <h2>{{todoitems.filter(item => item.done).length}} out of {{todoitems.length}} items completed</h2> it would...
...matter too much. for bigger apps, or when the expression is more complicated, that could cause 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 previously.
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...
...And 6 more matches
Command line crash course - Learn web development
previous overview: understanding client-side tools next in your development process you'll undoubtedly be required to run some command in the terminal (or on the "command line" — these are effectively the same thing). 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. if you're running any tooling...
... a list of the files and directories in your present working directory, but the information is really basic — you only get the name of each item present, not whether it is a file or a directory, or anything else. fortunately, a small change to the command usage can give you a lot more information. introducing command options most terminal commands have options — these are modifiers that you
add onto the end of a command, which make it behave in a slightly different way. these usually consist of a space after the command name, followed by a dash, followed by one or more letters. for example, give this a go and see what you get: ls -l in the case of ls, the -l (dash ell) option gives you a listing with one file or directory on each line, and a lot more information shown. directories c...
... try running this: curl /docs/web/api/fetch -l -i | grep location | awk '{ print "https://developer.mozilla.org" $2 }' your final output should look something like this: /docs/web/api/...
...And 6 more matches
The Firefox codebase: CSS Guidelines
ify the styles in css. classlist is generally better than classname. there's less chance of overwriting an existing class. only use generic selectors such as :last-child, when it is what you mean semantically. if not, using a semantic class name is more descriptive and usually better. boilerplate make sure each file starts with the standard copyright header (see license boilerplate). before
adding more css it is good practice to check if the css that is being written is needed, it can be the case that a common component has been already written could be reused with or without changes. most of the time, the common component already follows the a11y/theme standards defined in this guide. so, when possible, always prefer editing common components to writing your own. also, it is good pra...
...andards defined in this guide. so, when possible, always prefer editing common components to writing your own. also, it is good practice to introduce a common class when the new element you are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced. formatting spacing & indentation 2 spaces indentation is preferred
add a space after each comma, except within color functions: linear-gradient(to bottom, black 1px, rgba(255,255,255,0.2) 1px) always
add a space before !important. omit units on 0 values do this: margin: 0; not this: margin: 0px; use expanded syntax it is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. it is g...
...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 prevent the other rule from applying, this is especially relevant for different element states (:hover, :active, [checked] or [disabled]). ...
...And 6 more matches
overflow-clip-box
b: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow. it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties. /* keyword values */ overflow-clip-box: p
adding-box; overflow-clip-box: content-box; /* two values */ overflow-clip-box: p
adding-box content-box; overflow-clip-box: content-box content-box; /* global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, p
adding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, thi...
...ow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, p
adding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, this behavior was hardcoded; since then it uses this property that can be used elsewhere too. note that this property is activated by default only in the ua stylesheet and chrome contexts. initial valuep
adding-boxapplies toall elementsinheritednomediavisualcomputed valueas specifiedanimation typediscretecanonical orderthe unique non-ambiguous order defined by the formal grammar syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. ...
...hrome contexts. initial valuep
adding-boxapplies toall elementsinheritednomediavisualcomputed valueas specifiedanimation typediscretecanonical orderthe unique non-ambiguous order defined by the formal grammar syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. content-box this keyword makes the clipping be related to the content box. ...
...And 6 more matches
Release phase
y push through ssh. consequently, if you already have a local clone that you pulled using http, you'll need to modify a config file to tell mercurial to push through ssh. let's go over configuring your connection protocols. configuration before you try pushing, you need to tell ssh which username you wish to use for connecting with hg.mozilla.org. this should be your mozilla ldap account name. ...
... with your mozilla ldap account name: host hg.mozilla.org user user@host.domain if you have already cloned the remote repository using the http protocol using this command: $ hg clone http://hg.mozilla.org/releases/l10n-central/x-testing then you will need to edit the .hg/hgrc file (inside the x-testing local clone) to tell mercurial to push using ssh. ...
...you should now be able to push to the remote repository! commit, outgoing, and pu...
...And 6 more matches
An overview of NSS Internals
wn modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides
additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big number calculations, and cryptographic algorithms. softoken is an nss module that exposes most freebl functionality as a pkcs#11 module. some cryptography uses the same secret key for both encrypting and decrypting, for ...
...directory on your filesystem as a parameter to the init function, and nss is designed to do the rest. it will detect and open an existing database, or it can create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been
added to permanent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db,...
...t cleanup for all handles returned by nss. the application should always call the appropriate dereference (destroy) functions once a handle is no longer needed. this is particularly important for applications that might need to close a database and reinitialize nss using a different one, without restarting. such an operation might fail at runtime if data elements are still being referenced. in
addition to the freebl, softoken, and ckbi modules, there is an utility library for general operations (e.g., encoding/decoding between data formats, a list of standardized object identifiers (oid)). nss has an ssl/tls module that implements the secure sockets layer/transport layer security network protocols, an s/mime module that implements cms messaging used by secure email and some instant messagi...
...And 6 more matches
Certificate functions
unction name is linked to either its mdc wiki page or its entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
...s entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
... reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
...And 6 more matches
SpiderMonkey Build Documentation
and of course, you'll need to get the spidermonkey source code. ...
... the following should help, open /library/developer/commandlinetools/packages/macos_sdk_headers_for_macos_10.14.pk this builds an executable named js in the directory build-release/dist/bin. you can test it with dist/bin/js --help, which displays a help page. at this point, you're ready to run and try out the shell. ...
...the
additional command make install. this installs the shared library to /usr/local/lib, the c header files to /usr/local/include, and the js executable to/usr/local/bin. developer (debug) build for developing and debugging spidermonkey itself, it is best to have both a debug build (for everyday debugging) and an optimized build (for performance testing), in separate build directories. thus, in
addition to following the steps above, you should also create a debug build using these steps: cd js/src # this name should end with "_dbg.obj" to make the version control system ignore it. mkdir build_dbg.obj cd build_dbg.obj /bin/sh ../configure.in --enable-debug --disable-optimize # use "mozmake" on windows make you can also build debug builds of spidermonkey with the js_gc_zeal option, which ...
...And 6 more matches
JSProtoKey
ch for jsproto_uint8clampedarray jsproto_proxy proxy mxr search for jsproto_proxy jsproto_weakmap weakmap mxr search for jsproto_weakmap jsproto_map map mxr search for jsproto_map jsproto_set set mxr search for jsproto_set jsproto_dataview dataview mxr search for jsproto_dataview jsproto_symbol symbol
added in spidermonkey 38 mxr search for jsproto_symbol jsproto_sharedarraybuffer sharedarraybuffer (nightly only) mxr search for jsproto_sharedarraybuffer jsproto_intl intl mxr search for jsproto_intl jsproto_typedobject typedobject (nightly only) mxr search for jsproto_typedobject jsproto_generatorfunction generatorfunction
added in...
... jsproto_intl intl mxr search for jsproto_intl jsproto_typedobject typedobject (nightly only) mxr search for jsproto_typedobject jsproto_generatorfunction generatorfunction
added in spidermonkey 31 mxr search for jsproto_generatorfunction jsproto_simd simd (nightly only) mxr search for jsproto_simd jsproto_weakset weakset
added in spidermonkey 38 mxr search for jsproto_weakset jsproto_sharedint8array sharedint8array (nightly only) mxr search for jsproto_sharedint8array jsproto_shareduint8array shareduint8array (nightly only) mxr search for jsproto_shareduint8array jsproto_sharedint16array sharedint16array (nightly only) mxr search for jsproto_sharedint16array ...
...sharedfloat32array sharedfloat32array (nightly only) mxr search for jsproto_sharedfloat32array jsproto_sharedfloat64array sharedfloat64array (nightly only) mxr search for jsproto_sharedfloat64array jsproto_shareduint8clampedarray shareduint8clampedarray (nightly only) mxr search for jsproto_shareduint8clampedarray jsproto_typedarray typedarray
added in spidermonkey 38 mxr search for jsproto_typedarray jsproto_atomics atomics (nightly only) mxr search for jsproto_atomics description each of these types corresponds to standard objects in javascript. some of them are nightly only (depends on each option). see also bug 789635 bug 645416 -
added jsproto_symbol bug 769872 -
added jsproto_intl bug 792439 -
add...
...And 6 more matches
Web Replay
non-determinism is prevented from spreading too far with the following techniques: different pointer values can affect the internal layout of hash tables. to prevent this from having an effect on iteration order (and execution behavior) in the table, the main table classes (for now plhashtable and pldhashtable) are instrumented so that they always iterate over elements in the order they were
added when recording or replaying. differing gc behavior can cause object finalizers to run at different times. to prevent this from having an effect on execution behavior, gc finalizers which can affect the recording are instrumented so that the finalizer action is performed at the same time in the replay as it was during the recording. even if the associated js object has not been destroyed yet ...
...ork by posting events to the main thread (a deterministic component), so for now incremental gcs are disabled. many of these behavioral changes should eventually be removable. graphics rendering is entirely local to the content process. instead of communicating via ipc with a compositor in the ui process, there is a compositor in the recording process itself which performs the rendering. some
additional instrumentation is performed, per the 'allowed non-determinism', section above. the ipc, rewind, and debugger components are all active while recording. these spawn a number of threads which do not participate in the recording: any events they execute are live. see the sections below for details on how these affect the process' behavior. to make it easier to ensure that the non-determ...
...e previous snapshot. certain memory regions are excluded from snapshots; these memory regions are allocated with a special api and are used for state that needs to be preserved when rewinding. snapshot data may be stored in memory or on disk. diffs are computed by first setting up an exception handler thread (mac only) very similar to the one used by asm.js. ...
...And 6 more matches
Using RAII classes in Mozilla
ensuring raii classes are not used as temporaries a common mistake when using raii classes is to accidentally forget to name object, which causes its scope to be different from what is intended. for example, instead of writing: autolock lock(mmutex); which causes the lock to be held until the end of the block, one might write: autolock(mmutex); which erroneously causes the lock to be released at the end of the statement. we have two techniques for avoiding this problem: static analysis and runtime assertions. ...
...sertions. static analysis static analysis passes are run on our testing infrastructure using our clang plugin, you can also run them locally marking a raii class for the static analysis is very simple, and performing this marking causes the static analysis to produce a build-time error whenever a raii class is allocated as a temporary, on the heap, or in static storage. this involves just one
addition to the class, and the inclusion of attributes.h: class moz_raii nsautoscriptblocker {...} this is much simpler and more thorough than the guardobject runtime assertions, but are unfortunately currently only run on mac os x and linux builds, which means that guardobject should still be used for raii guards which may be used in windows-only code. assertions runtime assertions offer two be...
...urrently working on than static analysis, which he might not think to run. we have a set of macros that will cause a class to assert when it is instantiated at a temporary. they cause no extra complexity for users of the class, but they do slightly complicate the implementation of the class. these macros are provided in guardobjects.h. ...
...And 6 more matches
Packaging WebLock
called install.js. once you have the component and the other resources for weblock packaged properly (see the following section, archiving resources), the installation script for weblock is a simple one (see the weblock installation script). archiving resources once you have compiled all the resources that make up the weblock component and the files that make up the user interface that will be
added to the browser, you can place these within a subdirectory called weblock. place the entire subdirectory into a zip archive and name the archive weblock.xpi. the archive, its subdirectory structure, and its contents should look like this: weblock.xpi archive viewed in winzip note that the top level of the archive holds the install.js installation file, an rdf manifest for the package as a w...
...i archive viewed in winzip note that the top level of the archive holds the install.js installation file, an rdf manifest for the package as a whole, and the component files (weblock.xpt and weblock4.dll). the component files are copied to the components directory of the gecko application, and the weblock subdirectory gets copied over into the chrome subdirectory, where its ui resources can be
added dynamically to the xul-based gecko application. the next section shows how this process of downloading, copying and registering the necessary files from the xpi can be achieved with an xpinstall installation script. the weblock installation script the installation script is the javascript file that is stored within the xpi. it must appear at the top level of the installation archive (i.e., w...
...e., weblock.xpi) itself. ...
...And 6 more matches
Using XPCOM Utilities to Make Things Easier
ommon implementation macros every xpcom object implements nsisupports, but writing this implementation over and over is tedious. unless you have very special requirements for managing reference counting or handling interface discovery, theimplementation macros that xpcom provides can be used. instead of implementing the nsisupports yourself, ns_impl_isupports1 can expand to the implementation of
addref, release, and queryinterface for any object. ns_impl_isupports1(classname, interface1) also, if you implement more than one interface, you can simply change the 1 in the macro to the number of interfaces you support and list the interfaces, separated by commas. for example: ns_impl_isupports2(classname, interface1, interface2) ns_impl_isupportsn(classname, interface1, ..., interfacen) th...
...terface for any object. ns_impl_isupports1(classname, interface1) also, if you implement more than one interface, you can simply change the 1 in the macro to the number of interfaces you support and list the interfaces, separated by commas. for example: ns_impl_isupports2(classname, interface1, interface2) ns_impl_isupportsn(classname, interface1, ..., interfacen) these macros automatically
add the nsisupports entry for you, so you don't need to do something like this: ns_impl_isupports2(classname, interface1, nsisupports) take a close look at the above example. note that it uses the actual name of the interface and not an iid. inside the macro, the interface name expands to ns_get_iid(), which is another macro that extracts the iid from the generated header of the interface. when ...
...nce to a shared nsiid object\ static const nsiid iid1 = ns_get_iid(nsisupports); // constructs a new nsiid object static const nsiid iid2 = ns_isupports_iid; in order to use ns_impl_isupportsn, you must be sure that a member variable of type nsrefcnt is defined and named mrefcnt in your class. but why even bother when you can use another macro? declaration macros ns_decl_nsisupports declares
addref, release, and queryinterface for you, and it also defines the mrefcnt required by ns_impl_isupports. furthermore, ns_decl_ appended with any interface name in all caps will declare all of the methods of that interface for you. for example, ns_decl_nsifoo will declare all of the methods of nsifoo provided that it exists and that nsifoo.h was generated by the xpidl compiler. consider the followi...
...And 6 more matches
Mozilla internal string guide
three ownership models dynamically: reference counted, copy-on-write, buffers (the default) adopted buffers (a buffer that the string class owns, but is not reference counted, because it came from somewhere else) dependent buffers, that is, an underlying buffer that the string class does not own, but that the caller that constructed the string guarantees will outlive the string instance in
addition, there is a special string class, ns[c]autostring, that
additionally contains an internal 64-unit buffer (intended primarily for use on the stack), leading to a fourth ownership model: storage within an auto string's stack buffer auto strings will prefer reference counting an existing reference-counted buffer over their stack buffer, but will otherwise use their stack buffer for anythin...
...these types are really just convenient notation for constructing an ns[c]s[ubs]tring with a non-default ownership mode; they should not be thought of as different types. ...
...oints. used for http headers and for size-optimized storage in text node and spidermonkey strings. latin1 converts to utf-16 by zero-extending each byte to a 16-bit code unit. note that this kind of "latin1" is not available for encoding html, css, js, etc. specifying charset=latin1 means the same as charset=windows-1252. windows-1252 is a similar but different encoding used for interchange. in
addition, there exist multiple other (legacy) encodings. the web-relevant ones are defined in the encoding standard. conversions from these encodings to utf-8 and utf-16 are provided by mozilla::encoding.
additonally, on windows the are some rare cases (e.g. drag&drop) where it's necessary to call a system api with data encoded in the windows locale-dependent legacy encoding instead of utf-16. in tho...
...And 6 more matches
nsICycleCollectorListener
edge starting at that node; then a call to begindescriptions(); then for every black node in the cycle collector graph a call to either describerefcountedobject() or to describegcedobject(); and then a call to end(). if begin() returns an error none of the other functions will be called. ...
... node in the cycle collector graph a call to either describerefcountedobject() or to describegcedobject(); and then a call to end(). if begin() returns an error none of the other functions will be called. method overview void begin(); void begindescriptions(); void describegcedobject(in unsigned long long a
address, in boolean amarked); void describerefcountedobject(in unsigned long long a
address, in unsigned long aknownedges, in unsigned long atotaledges); void end(); void noteedge(in unsigned long long afrom
address, in unsigned long long ato
address, in string aedgename); void noteobject(in unsigned long long a
address, in string aobjectdescription); methods begin() void begin(); parameters none. begindescriptions() void begindescriptions(); parameters none. describegcedobj...
...taledges); void end(); void noteedge(in unsigned long long afrom
address, in unsigned long long ato
address, in string aedgename); void noteobject(in unsigned long long a
address, in string aobjectdescription); methods begin() void begin(); parameters none. begindescriptions() void begindescriptions(); parameters none. describegcedobject() void describegcedobject( in unsigned long long a
address, in boolean amarked ); parameters a
address amarked describerefcountedobject() void describerefcountedobject( in unsigned long long a
address, in unsigned long aknownedges, in unsigned long atotaledges ); parameters a
address aknownedges atotaledges end() void end(); parameters none. ...
...And 6 more matches
nsIEffectiveTLDService
s not. is "pretty.flowers" a domain name, according to getpublicsuffix()? depends on the age of the copy of the psl you are working with. the tld space is currently expanding at a fairly great rate, and the copy of the psl firefox has may not be totally up to date (because it's not dynamically updated data). method overview acstring getbasedomain(in nsiuri auri, [optional] in pruint32 a
additionalparts); acstring getbasedomainfromhost(in autf8string ahost, [optional] in pruint32 a
additionalparts); acstring getpublicsuffix(in nsiuri auri); acstring getpublicsuffixfromhost(in autf8string ahost); methods getbasedomain() returns the base domain of a uri; that is, the public suffix with a given number of
additional domain name parts. acstring getbased...
...ost(in autf8string ahost, [optional] in pruint32 a
additionalparts); acstring getpublicsuffix(in nsiuri auri); acstring getpublicsuffixfromhost(in autf8string ahost); methods getbasedomain() returns the base domain of a uri; that is, the public suffix with a given number of
additional domain name parts. acstring getbasedomain( in nsiuri auri, [optional] in pruint32 a
additionalparts ); parameters auri the uri to be analyzed. a
additionalparts the number of domain name parts to be returned in
addition to the public suffix. return value an acstring containing the base domain (public suffix plus the requested number of
additional parts). exceptions thrown ns_error_invalid_arg this exception is thrown if the hostname in auri is empty. ns_error_insuffi...
... ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname contains characters disallowed in uris. ...
...And 6 more matches
nsIServerSocket
the nsiserversocket interface implements a server socket that can accept incoming connections. netwerk/base/public/nsiserversocket.idlscriptable please
add a summary to this article. last changed in gecko 1.6 inherits from: nsisupports implemented by: @mozilla.org/network/server-socket;1. ...
....6 inherits from: nsisupports implemented by: @mozilla.org/network/server-socket;1. to create an instance, use: var serversocket = components.classes["@mozilla.org/network/server-socket;1"] .createinstance(components.interfaces.nsiserversocket); method overview void init(in long aport, in boolean aloopbackonly, in long abacklog); void initwith
address([const] in prnet
addrptr a
addr, in long abacklog);native code only! void close(); void asynclisten(in nsiserversocketlistener alistener); prnet
addr get
address();native code only! attributes attribute type description port long returns the port of this server socket. read only. methods asynclisten() this method puts the s...
... the listener to be notified when client connections are accepted. close() this method closes a server socket. this does not affect already connected client sockets (i.e., the nsisockettransport instances created from this server socket). this will cause the onstoplistening event to asynchronously fire with a status of ns_binding_aborted. void close(); parameters none. ...
...And 6 more matches
nsIWindowMediator
common uses of nsiwindowmediator are, enumerating all windows of a given type and getting the most recent / any window of a given type. ...
...updatewindowtimestamp(in nsixulwindow awindow); native code only! void updatewindowtitle(in nsixulwindow awindow, in wstring intitle ); native code only! constants constant value description zleveltop 1 send window to top. zlevelbottom 2 send window to bottom. zlevelbelow 3 place window below some window. ...
... void updatewindowtitle(in nsixulwindow awindow, in wstring intitle ); native code only! constants constant value description zleveltop 1 send window to top. zlevelbottom 2 send window to bottom. zlevelbelow 3 place window below some window. methods
addlistener() register a listener for window status changes. void
addlistener( in nsiwindowmediatorlistener alistener ); parameters alistener the listener to register. example: of window listener object and how to register then unregister. this example below waits for listens to when a window opens, and then after that window opens it
adds event listener to listen to when the window completes loading, after that it fires a function. important: this will ...
...And 6 more matches
Weak reference
in 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 weak reference is set to nsnull. why do i need this? when you hold an owning reference on an object (i.e., you have
addrefed it), you are holding that object in existence for the duration of your reference. this isn't always appropriate, and can lead to trouble. if, for instance, this owning reference is part of a cycle of owning references (e.g., if the referenced object also holds a owning reference back to you), then none of the objects in the cycle can be reclaimed without taking special measures. there are less severe situations. a naive design for an observer/observa...
... 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 of observers. class nsobservable { public: // ... ...
...implements nsisupportsweakreference. you can extrapolate from managing a single observer to managing a list of observers. class nsobservable { public: // ... nsresult
addobserver( nsiobserver* ); nsresult notifyobservers( nsimessage* ); // ... private: nsweakptr mobserver; // ...or imagine a list of observers here }; // ... ...
...And 6 more matches
Creating a gloda message query
t message query... import gloda gloda's api is exposed in the "gloda" object that is contributed to your namespace. you can find the file, which includes doxygen markup of sorts, here: https://hg.mozilla.org/comm-central/file/tip/mailnews/db/gloda/modules/gloda.js components.utils.import("resource:///modules/gloda/public.js"); create the query let query = gloda.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 previous color constraint it would match...
...d 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 previous color constraint it would match a red square, a green square, or a blue 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.daterange([lowerdate1, upperdate1], [lowerdate2, upperdate2], ...):
add the constraint that the message date (per the message's date header) must fall within one of the specified inclusive ranges. the date instances are javascript date instances. query.folder(folder1, folder2, ...):
add the constraint that the message must be found in one of the specified folders. the folder may be a glodafolder instance (retrieved via gloda.getfolderforfolder, which takes an nsimsg...
...And 6 more matches
Activity Manager examples
y can provide their own xbl elements for their own activity types. all custom activity xbl elements should inherit from "activity-base" binding. for xbl samples please see activity.xml and activitybinding.css files. showing a user-defined activity in the activity manager window the following sample will show a process and an event for junk processing in the activity manager window. ...
... instance of nsimsgfolder interface // localization is omitted, initiator is not provided process.init("processing folder: " + folder.prettiestname, null); // note that we don't define a custom icon, default process icon // will be used process.contexttype = "account"; // group this activity by account process.contextobj = folder.server; // account in question gactivitymanager.
addactivity(process); // step 2: showing some progress let percent = 50; process.setprogress(percent, "junk processing 25 of 50 messages", 25, 50); // step 3: removing the process and
adding an event using process' attributes process.state = components.interfaces.nsiactivityprocess.state_completed; gactivitymanager.removeactivity(process.id); let event = components.classes["@mozilla.org/activity-...
... // step 1: create a nsiactivitycancelhandler implementation function canceljunkprocess() { // user stuff here.. } canceljunkprocess.prototype = { cancel: function(aactivity) { let initia...
...And 6 more matches
Standard OS Libraries
standard libraries offer the advantage of not having to ship anything. they are already available on the operating system for you. ...
...standard libraries offer the advantage of not having to ship anything. they are already available on the operating system for you. ...
... unix unix based operating systems are linux, *bsd, solaris, etc. there is a star/asterik ("*") before "bsd" because this ...
...And 6 more matches
Examine and edit HTML - Firefox Developer Tools
arker enables the flexbox highlighter. custom… the element is a custom element. clicking the marker switches to the line of javascript code in the debugger where the custom element got defined. note: there are some useful keyboard shortcuts that can be used in the html tree — see the html pane keyboard shortcuts list. ::before and ::after you can inspect pseudo-elements
added using ::before and ::after: custom element definition when you open the inspector on a page that includes custom elements, you can view the class definition for the custom element in the debugger: inspect the element click on the word custom the source for the element's class will be displayed in the debugger. whitespace-only text nodes web developers don’t write all their cod...
... output, but in fact, when a browser parses html it will automatically generate anonymous text nodes for elements not contained in a node. this includes white space (which is after all a type of text). if these auto generated text nodes are inline level, browsers will give them a non-zero width and height. then you will find strange gaps between elements, even if you haven’t set any margin or p
adding on them. since firefox 52, the inspector displays these whitespace nodes, so you can see where the gaps in your markup come from. whitespace nodes are represented with a dot: and you get an explanatory tooltip when you hover over them: to see this in action, see the demo at https://mdn.github.io/devtools-examples/whitespace-only-demo/index.html. shadow roots any shadow roots present in ...
...ts expansion arrow to see the full contents of the shadow dom, and then manipulate the contained nodes in a similar way to other part of the page's dom (although 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. ...
...And 6 more matches
Web Console remoting - Firefox Developer Tools
for page errors and console api calls. the reply looks like this: { "messages": [ ... ], "from": "conn0.console9" } each message in the array is of the same type as when we send typical page errors and console api calls. these will be explained in the following sections of this document. actor preferences to allow the web console to configure logging options while it is running, we have
added the setpreferences packet: { "to": "conn0.console9", "type": "setpreferences", "preferences": { "networkmonitor.saverequestandresponsebodies": false } } reply: { "updated": [ "networkmonitor.saverequestandresponsebodies" ], "from": "conn0.console10" } for convenience you can use webconsoleclient.setpreferences(prefs, onresponse). the prefs argument is an object like ...
...console9", "type": "setpreferences", "preferences": { "networkmonitor.saverequestandresponsebodies": false } } reply: { "updated": [ "networkmonitor.saverequestandresponsebodies" ], "from": "conn0.console10" } for convenience you can use webconsoleclient.setpreferences(prefs, onresponse). the prefs argument is an object like { prefname: prefvalue, ... }. in firefox 25 we
added the getpreferences request packet: { "to": "conn0.console34", "type": "getpreferences", "preferences": [ "networkmonitor.saverequestandresponsebodies" ] } reply packet: { "preferences": { "networkmonitor.saverequestandresponsebodies": false }, "from": "conn0.console34" } you can also use the webconsoleclient.getpreferences(prefs, onresponse). the prefs argument is an...
...mnnumber": 0, "category": "content javascript", "timestamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } the packet is similar to nsiscripterror - for simplicity. we only removed several unneeded properties and changed how flags work. the private flag tells if the error comes from a private window/tab (
added in firefox 24). starting with firefox 24 the errormessage and linetext properties can be long string actor grips if the string is very long. console api messages the window.console api calls send internal messages throughout gecko which allow us to do whatever we want for each call. the web console actor sends these messages to the remote debugging client. we use the objectactor from dbg-sc...
...And 6 more matches
The HTML DOM API - Web APIs
ntroduced by the element interface. an element object instance represents a single element in a document created using either html or an xml vocabulary such as svg. ...
...s svg. for example, consider a document with two elements, one of which has two more elements nested inside it: while the document interface is defined as part of the dom specification, the html specification significantly enhances it to
add information specific to using the dom in the context of a web browser, as well as to using it to represent html documents specifically. among the things
added to document by the html standard are: support for accessing various information provided by the http headers when loading the page, such as the location from which the document was loaded, cookies, modification date, referring site, and so forth. access to lists of elements in the document's <head> block and body, as well as lists of the images, links, scripts, etc. contained in the documen...
... and more. event handlers for events that can be delivered to both elements and documents; these presently include only copy, cut, and paste actions. html element interfaces the element interface has been further adapted to represent html elements specifically by introducing the htmlelement interface, which all more specific html element classes inherit from. this expands the element class to
add html-specific general features to the element nodes. properties
added by htmlelement include for example hidden and innertext. htmlelement also
adds all the global event handlers. an html document is a dom tree in which each of the nodes is an html element, represented by the htmlelement interface. the htmlelement class, in turn, implements node, so every element is also a node (but not the othe...
...And 6 more matches
IDBTransaction.objectStore() - Web APIs
every call to this method on the same transaction object, with the same name, returns the same idbobjectstore instance. if this method is called on a different transaction object, a different idbobjectstore instance is returned. note: this feature is available in web workers. syntax idbtransaction.objectstore(name); parameters name the name of the requested object store. return value an idbobjectstore object for accessing an object store. ...
... of one of the following types: exception description notfounderror the requested object store is not in this transaction's scope. invalidstateerror the request was made on a source object that has been deleted or removed, or if the transaction has finished. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { not...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 6 more matches
Using the Payment Request API - Web APIs
equest() constructor. this takes two mandatory parameters and one option parameter: methoddata — an object containing information concerning the payment provider, such as what payment methods are supported, etc. details — an object containing information concerning the specific payment, such as the total payment amount, tax, shipping cost, etc. options (optional) — an object containing
addtional options related to the payment. so for example, you could create a new paymentrequest instance like so: var request = new paymentrequest(buildsupportedpaymentmethoddata(), buildshoppingcartdetails()); the functions invoked inside the constructor simply return the required object parameters: function buildsupportedpaymentmethoddata() { // example suppo...
...uld process the payment. for this demo, simulate immediate success: paymentresponse.complete('success') .then(function() { // for demo purposes: intropanel.style.display = 'none'; successpanel.style.display = 'block'; }); }) this object provides the developer with access to details they can use to complete the logical steps required after the payment completes, such as an email
address to contact the customer, a shipping
address for mailing goods out to them, etc. in the code above, you'll see that we've called the paymentresponse.complete() method to signal that the interaction has finished — you'd use this to carry out finishing steps, like updating the user interface to tell the user the transaction is complete, etc. other useful payment request methods there are som...
...mentrequest). in the following snippet, a merchant page performs this check, and if it returns true updates the checkout button to use paymentrequest instead of legacy web forms. const checkoutbutton = document.getelementbyid('checkout-button'); if (window.paymentrequest) { let request = new paymentrequest(buildsupportedpaymentmethodnames(), buildshoppingcartdetails()); checkoutbutton.
addeventlistener('click', function() { request.show().then(function(paymentresponse) { // handle successful payment }).catch(function(error) { // handle cancelled or failed payment. for example, redirect to // the legacy web form checkout: window.location.href = '/legacy-web-form-checkout'; }); // every click on the checkout button should use a new instance of ...
...And 6 more matches
Background audio processing using AudioWorklet - Web APIs
ations. the drawback to scriptprocessornode was simple: it ran on the main thread, thus blocking everything else going on until it completed execution. this was far less than ideal, especially for something that can be as computationally expensive as audio processing. enter audioworklet. an audio context's audio worklet is a worklet which runs off the main thread, executing audio processing code
added to it by calling the context's audioworklet.
addmodule() method. calling
addmodule() loads the specified javascript file, which should contain the implementation of the audio processor. with the processor registered, you can create a new audioworkletnode which passes the audio through the processor's code when the node is linked into the chain of audio nodes along with any other audio nodes. th...
...art with a brief high-level overview of what's involved. create module that defines a audio worklet processor class, based on audioworkletprocessor which takes audio from one or more incoming sources, performs its operation on the data, and outputs the resulting audio data. access the audio context's audioworklet through its audioworklet property, and call the audio worklet's domxref("worklet.
addmodule", "
addmodule()")}} method to install the audio worklet processor module. as needed, create audio processing nodes by passing the processor's name (which is defined by the module) to the audioworkletnode() constructor. set up any audio parameters the audioworkletnode needs, or that you wish to configure. these are defined in the audio worklet processor module. connect the created audiowor...
... audio processing pipeline as you would any other node, then use your audio pipeline as usual. throughout the remainder of this article, we'll look at these steps in more detail, with examples (including working examples you can try out on your own). the example code found on this page is derived from this working example which is available on glitch. the example creates an oscillator node and
adds white noise to it using an audioworkletnode before playing the resulting sound out. slider controls are available to allow controlling the gain of both the oscillator and the audio worklet's output. glitch project page see the code try it live creating an audio worklet processor fundamentally, an audio worklet processor (which we'll refer to usually as either an "audio processor" or simpl...
...And 6 more matches
Using XMLHttpRequest - Web APIs
common and more obscure use cases for xmlhttprequest are included. to send an http request, create an xmlhttprequest object, open a url, and send the request. after the transaction completes, the object will contain useful information such as the response body and the http status of the result. function reqlistener () { console.log(this.responsetext); } var oreq = new xmlhttprequest(); oreq.
addeventlistener("load", reqlistener); oreq.open("get", "http://www.example.org/example.txt"); oreq.send(); types of requests a request made via xmlhttprequest can fetch the data in one of two ways, asynchronously or synchronously. the type of request is dictated by the optional async argument (the third argument) that is set on the xmlhttprequest.open() method. if this argument is true or not spec...
...ipulation and analysis are outlined in the following sections. analyzing and manipulating the responsexml property if you use xmlhttprequest to get the content of a remote xml document, the responsexml property will be a dom object containing a parsed xml document. this could prove difficult to manipulate and analyze. there are four primary ways of analyzing this xml document: using xpath to
address (or point to) parts of it. manually parsing and serializing xml to strings or objects. using xmlserializer to serialize dom trees to strings or to files. regexp can be used if you always know the content of the xml document beforehand. you might want to remove line breaks, if you use regexp to scan with regard to line breaks. however, this method is a "last resort" since if the xml code ch...
...data. these involve utilizing the overridemimetype() method on the xmlhttprequest object and is a workable solution. var oreq = new xmlhttprequest(); oreq.open("get", url); // retrieve data unprocessed as a binary string oreq.overridemimetype("text/plain; charset=x-user-defined"); /* ... */ however, more modern techniques are available, since the responsetype attribute now supports a number of
additional content types, which makes sending and receiving binary data much easier. for example, consider this snippet, which uses the responsetype of "arraybuffer" to fetch the remote content into a arraybuffer object, which stores the raw binary data. var oreq = new xmlhttprequest(); oreq.onload = function(e) { var arraybuffer = oreq.response; // not responsetext /* ... */ } oreq.open("get"...
...And 6 more matches
ARIA live regions - Accessibility
gions fill this gap and provide a way to programmatically expose dynamic content changes in a way that can be announced by assistive technologies. note: assistive technologies will announce dynamic changes in the content of a live region. including an aria-live attribute or a specialized live region role (such as role="alert") on the element you want to announce changes to works as long as you
add the attribute before the changes occur — either in the original markup, or dynamically using javascript. simple live regions dynamic content which updates without a page reload is generally either a region or a widget. simple content changes which are not interactive should be marked as live regions. below is a list of each related aria live region property with a description. aria-live: ...
...because the live region has aria-live="polite", the screen reader will wait until th...
...chosen. here is a screenshot of voiceover on mac announcing the update (via subtitles) to the live region: preferring specialized live region roles in the following well-known predefined cases it is better to use a specific provided "live region role": role description compatibility notes log chat, error, game or other type of log to maximize compatibility,
add a redundant aria-live="polite" when using this role. status a status bar or area of the screen that provides an updated status of some kind. screen reader users have a special command to read the current status. to maximize compatibility,
add a redundant aria-live="polite" when using this role. alert error or warning message that flashes on the screen. alerts are partic...
...And 6 more matches
Using the alert role - Accessibility
description this technique demonstrates how to use the alert role and describes the effect it has on browsers and assistive technology. the alert role is used to communicate an important and usually time-sensitive message to the user. when this role is
added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. the alert role is most useful for information that requires the user's immediate attention, for example: an invalid value was entered into a form field the user's login session is about to expire the connection to the server was lost, local changes will not be saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immed...
...was lost, local changes will not be saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immediate attention is required. dynamic changes that are less urgent should use a less aggressive method, such as aria-live="polite" or other live region roles. possible effects on user agents and assistive technology when the alert role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having an alert role in the operating system's accessibility api. fire an accessible alert event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers ma...
... interrupt current output (whether it's speech or braille) and immediately announce or display the alert message. screen magnifiers may visually indicate that an alert occurred and what the alert text was. note: opinons 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:
adding the role in the html code the snippet below shows how the alert role is
added directly into the html source code. the moment the element finishes loading the screen reader should be notified of the alert. if the element was already in the original source code when the page loaded, the screen reader will announce the error immediately after announcing the page title. <h2 role="alert">your for...
...And 6 more matches
Accessibility documentation index - Accessibility
h assistive technologies, for each browser that at supports wai-aria in. where a failure occurs we will test the browser for api incorrectness, using tools such as msaa inspect. this must be done in order to determine where to file a bug (browser or at). 5 aria annotations aria, accessibility, wai-aria, annotations, 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 ...
...an be announced by assistive technologies. 8 forms aria, accessibility the following pages provide various techniques for improving the accessibility of web forms: 9 alerts aria, accessibility, forms, web you have a form — a contact form, for example — that you want to put some accessible error checking into. examples of common problems include e-mail
addresses which are not valid, or a name field which does not contain at least a first name or a surname. 10 basic form hints aria, accessibility, forms when implementing forms using traditional html form-related elements, it is important to provide labels for controls, and explicitly associate a label with its control. 11 multipart labels: using aria for labels with e...
... aria defines semantics that can be applied to elements, with these divided into roles (defining a type of user interface element) and states and properties that are supported by a role. authors must assign an aria role and the appropriate states and properties to an element during its life-cycle, unless the element already has appropriate aria semantics (via use of an appropriate html element).
addition of aria semantics only exposes extra information to a browser's accessibility api, and does not affect a page's dom. 14 aria technique template accessibility no summary! 15 using the alert role aria, accessibility, advanced, css, example, html, needscontent, alert, alert role, alertrole, alerts, assitive technology, role configuration, wcag1.2.1, wcag3.3.1...
...And 6 more matches
system - CSS: Cascading Style Sheets
is used in a @counter-style to define the behavior of the defined style. if the algorithm specified in the system descriptor is unable to construct the representation for a particular counter value, then that value's representation will be constructed using the fallback system provided. syntax /* keyword values */ system: cyclic; system: numeric; system: alphabetic; system: symbolic; system:
additive; system: fixed; /* combined values */ system: fixed 3; system: extends decimal; this may take one of three forms: one of the keyword values cyclic, numeric, alphabetic, symbolic,
additive, or fixed. the keyword value fixed along with an integer. the keyword value or extends along with a @counter-style name. cyclic cycles through the list of symbols provided. once the end of...
... described above. the main difference is that in the alphabetic system, the first counter symbol given in the symbols descriptor is interpreted as 1, the next as 2, and so on. however, in the numeric system, the first counter symbol is interpreted as 0, the next as 1, then 2, and so on. at least two counter symbols must be specified in the symbols descriptor or the counter style is not valid. ...
...n. however, in the numeric system, the first counter symbol is interpreted as 0, the next as 1, then 2, and so on. at least two counter symbols must be specified in the symbols descriptor or the counter style is not valid.
additive used to represent "sign-value" numbering systems, such as roman numerals, which rather than reuse digits in different positions to obtain different values, define
additional digits for larger values. the value of a number in such a system can be found out by
adding the digits in the number. ...
...And 6 more matches
animation - CSS: Cascading Style Sheets
1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#restart'); } .grid { width: 100%; height: 100%; display: flex; background: #eee; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; justify-content: space-between; } .col { display: flex; flex: 1 auto; flex-direction: column; } .cell { box-sizing: border-box; margin: .5em; p
adding: 0; background-color: #fff; overflow: hidden; text-align: left; } .flx { flex: 1 0; } .note { background: #fff3d4; p
adding: 1em; margin: .5em; font: .8em sans-serif; text-align: left; flex: none; } .overlay { p
adding: .5em; } @keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } } .a1 { animation: 3s ease-in 1s 2 reverse both paused slide...
...eft; flex: none; } .overlay { p
adding: .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')); function togglebutton (btn, type) { btn.classlist.remove('play', 'pause', 'restart'); btn.classlist.
add(type); btn.title = type.touppercase(type); } function playpause (i) { var btn = button[i]; va...
...onplaystate = 'running'; togglebutton(btn, 'pause'); } else if (btn.classlist.contains('pause')) { anim.style.animationplaystate = 'paused'; togglebutton(btn, 'play'); } else { anim.classlist.remove('a' + (i + 1)); settimeout(function () { togglebutton(btn, i === 0 ? ...
...And 6 more matches
clip-path - CSS: Cascading Style Sheets
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. ...
... values <clip-source> a <url> referencing an svg <clippath> element. <basic-shape> a shape whose size and position is defined by the <geometry-box> value. if no geometry box is specified, the ...
...ith a <basic-shape>, this value defines the reference box for the basic shape. if specified by itself, it causes the edges of the specified box, including any corner shaping (such as a border-radius), to be the clipping path. the geometry box can be one of the following values: margin-box uses the margin box as the reference box. border-box uses the border box as the reference box. p
adding-box uses the p
adding box as the reference box. content-box uses the content box as the reference box. fill-box uses the object bounding box as the reference box. stroke-box uses the stroke bounding box as the reference box. view-box uses the nearest svg viewport as the reference box. if a viewbox attribute is specified for the element creating the svg viewport, the reference ...
...And 6 more matches
<color> - CSS: Cascading Style Sheets
heir rgb values may differ from the corresponding color on x11 systems since manufacturers sometimes tailor x11 colors to their specific hardware. note: the list of accepted keywords has undergone many changes during the evolution of css: css level 1 only included 16 basic colors, called the vga colors as they were taken from the set of displayable colors on vga graphics cards. css level 2
added the orange keyword. although various colors not in the specification (mostly adapted from the x11 colors list) were supported by early browsers, it wasn't until svg 1.0 and css colors level 3 that they were formally defined. they are called the extended color keywords, the x11 colors, or the svg colors. css colors level 4
added the rebeccapurple keyword to honor web pioneer eric meyer. ...
... #adff2f grey #808080 honeydew #f0fff0 hotpink #ff69b4 indianred #cd5c5c indigo #4b0082 ivory #fffff0 khaki #f0e68c lavender #e6e6fa lavenderblush #fff0f5 lawngreen #7cfc00 lemonchiffon #fffacd lightblue #
add8e6 lightcoral #f08080 lightcyan #e0ffff lightgoldenrodyellow #fafad2 lightgray #d3d3d3 lightgreen #90ee90 lightgrey #d3d3d3 lightpink #ffb6c1 lightsalmon #ffa07a lightseagreen #20b2aa lightskyblue #87cefa lightslategray #77...
...enrod #eee8aa palegreen #98fb98 paleturquoise #afeeee palevioletred #db7093 papayawhip #ffefd5 peachpuff #ffdab9 peru #cd853f pink #ffc0cb plum #dda0dd powderblue #b0e0e6 rosybrown #bc8f8f royalblue #4169e1 s
addlebrown #8b4513 salmon #fa8072 sandybrown #f4a460 seagreen #2e8b57 seashell #fff5ee sienna #a0522d skyblue #87ceeb slateblue #6a5acd slategray #708090 slategrey #708090 snow #fffafa springgreen #00ff7f steelb...
...And 6 more matches
Challenge solutions - Developer guides
etters are underlined. solution move the declaration for underlining from the rule for <p> to the one for <strong>. the resulting file looks like this: p {color: blue; } strong {color: orange; text-decoration: underline;} later sections of this tutorial describe style rules and declarations in greater detail. selectors second paragraph blue challenge without changing your html file,
add a single rule to your css file that keeps all the initial letters the same color as they are now, but makes all the other text in the second paragraph blue. solution
add a rule with an id selector of #second and a declaration color: blue;, as shown below: #second { color: blue; } a more specific selector, p#second also works. both paragraphs blue challenge now change the rule you have ...
...ngle rule to your css file that keeps all the initial letters the same color as they are now, but makes all the other text in the second paragraph blue. solution
add a rule with an id selector of #second and a declaration color: blue;, as shown below: #second { color: blue; } a more specific selector, p#second also works. both paragraphs blue challenge now change the rule you have just
added (without changing anything else), to make the first paragraph blue too. solution change the selector of the new rule to be a tag selector using p: p { color: blue; } the rules for the other colors all have more specific selectors, so they override the blue of the paragraph. readable css commenting out a rule challenge comment out part of your stylesheet, without changing anything ...
...our stylesheet, without changing anything else, to make the very first letter of your document red. solution one way to do this is to put comment delimiters around the rule for .carrot: /* .carrot { color: orange; } */ text styles big initial letters challenge without changing anything else, make all six initial letters twice the size in the browser's default serif font. solution
add the following style declaration to the strong rule: font: 200% serif; if you use separate declarations for font-size and font-family, then the font-style setting on the first paragraph is not overridden. color three-digit color codes challenge in your css file, change all the color names to 3-digit color codes without affecting the result. solution the following values are reasonabl...
...And 6 more matches
Using the application cache - HTML: Hypertext Markup Language
cache manifest file: a text file that lists urls that browsers should cache for your application. you should include the manifest attribute on each page of your site that you want cached. the browser does not cache pages without the manifest attribute, unless such pages are listed in the manifest file. you do not need to list all pages you want cached in the manifest file, the browser implicitly
adds every page that the user visits and that has the manifest attribute set to the application cache. some browsers (e.g., firefox) display a notification bar the first time a user loads an application that uses the application cache. the notification bar displays a message such as: this website (example.com) is asking to store data on your computer for offline use. [allow] [never for this site] [...
...ocument that includes the manifest attribute, if no application cache exists, the browser loads the document and then fetches all the entries listed in the manifest file, creating the first version of the application cache. subsequent visits to that document cause the browser to load the document and other assets specified in the manifest file from the application cache (not from the server). in
addition, the browser also sends a checking event to the window.applicationcache object, and fetches the manifest file, following the appropriate http caching rules. if the currently-cached copy of the manifest is up-to-date, the browser sends a noupdate event to the applicationcache object, and the update process is complete. note that if you change any cached resources on the server, you must also...
...f the manifest is up-to-date, the browser sends a noupdate event to the applicationcache object, and the update process is complete. note that if you change any cached resources on the server, you must also change the manifest file itself, so that the browser knows it needs to fetch all the resources again. if the manifest file has changed, all the files listed in the manifest—as well as those
added to the cache by calling applicationcache.
add()—are fetched into a temporary cache, following the appropriate http caching rules. for each file fetched into this temporary cache, the browser sends a progress event to the applicationcache object. if any errors occur, the browser sends an error event, and the update halts. once all the files have been successfully retrieved, they are moved into...
...And 6 more matches
Expressions and operators - JavaScript
the simple assignment operator is equal (=), which assigns the value of its right operand to its left operand. that is, x = y assigns the value of y to x. ...
...han or equal (<=) returns true if the left operand is less than or equal to the right operand. var1 <= var2 var2 <= 5 note: (=>) is not an operator, but the notation for arrow functions. arithmetic operators an arithmetic operator takes numerical values (either literals or variables) as their operands and returns a single numerical value. ...
...s their operands and returns a single numerical value. the standard arithmetic operators are
addition (+), subtraction (-), multiplication (*), and division (/). these operators work as they do in most other programming languages when used with floating point numbers (in particular, note that division by zero produces infinity). for example: 1 / 2; // 0.5 1 / 2 == 1.0 / 2.0; // this is true in
addition to the standard arithmetic operations (+, -, *, /), javascript provides the arithmetic operators listed in the following table: arithmetic operators operator description example remainder (%) binary operator. returns the integer remainder of dividing the two operands. 12 % 5 returns 2. increment (++) unary operator.
adds one to its operand. if ...
...And 6 more matches
Functions - JavaScript
(x) { return x * x * x; } let numbers = [0, 1, 2, 5, 10]; let cube = map(f,numbers); console.log(cube); function returns: [0, 1, 8, 125, 1000]. in javascript, a function can be defined based on a condition. for example, the following function definition defines myfunc only if num equals 0: var myfunc; if (num === 0) { myfunc = function(theobject) { theobject.make = 'toyota'; } } in
addition to defining functions as described here, you can also use the function constructor to create functions from a string at runtime, much like eval(). a method is a function that is a property of an object. read more about objects and methods in working with objects. calling functions defining a function does not execute it. defining it simply names the function and specifies what to do when ...
...tion, and any other variables to which the parent function has access. // the following variables are defined in the global scope var num1 = 20, num2 = 3, name = 'chamahk'; // this function is defined in the global scope function multiply() { return num1 * num2; } multiply(); // returns 60 // a nested function example function getscore() { var num1 = 2, num2 = 3; function
add() { return name + ' scored ' + (num1 + num2); } return
add(); } getscore(); // returns "chamahk scored 5" scope and the function stack recursion a function can refer to and call itself. there are three ways for a function to refer to itself: the function's name arguments.callee an in-scope variable that refers to the function for example, consider the following function defin...
...ntains the scope of the outer function. to summarize: the inner function can be accessed only from statements in the outer function. the inner function forms a closure: the inner function can use the arguments and variables of the outer function, while the outer function cannot use the arguments and variables of the inner function. ...
...And 6 more matches
Object.create() - JavaScript
a pull request. syntax object.create(proto, [propertiesobject]) parameters proto the object which should be the prototype of the newly-created object. propertiesobject optional if specified and not undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descriptors to be
added to the newly-created object, with the corresponding property names. these properties correspond to the second argument of object.defineproperties(). return value a new object with the specified prototype object and properties. exceptions the proto parameter has to be either null or an object excluding primitive wrapper objects. if proto is neither of these a typeerror is thrown. cus...
...ob.po=oco; // create same compound object again, but create same properties in different order > showproperties( ob ) // display top-level properties - error: cannot convert object to primitive value note that neither property gets shown. note that such a different order may arise statically via disparate fixed codings such as here, but also dynamically via whatever the order any such property-
adding code-branches actually get executed at runtime as depends on inputs and/or random-variables. then again, the actual iteration order is not guaranteed no matter what the order members are
added. be aware of, also, that using object.entries() on an object created via object.create() will result in an empty array being returned. var obj = object.create({ a: 1, b: 2 }); > console.log(object.ent...
...tion order is not guaranteed no matter what the order members are
added. be aware of, also, that using object.entries() on an object created via object.create() will result in an empty array being returned. var obj = object.create({ a: 1, b: 2 }); > console.log(object.entries(obj)); // shows "[]" some non-solutions a good solution for the missing object-methods is not immediately apparent. ...
...And 6 more matches
Web audio codec guide - Web media technologies
d in order to transfer audio, whether for streaming or to download it for use during gameplay. the processing of audio data to encode and decode it is handled by an audio codec (coder/decoder). in this article, we look at audio codecs used on the web to compress and decompress audio, what their capabilities and use cases are, and offer guidance when choosing audio codecs to use for your content.
additionally, webrtc implementations generally use a subset of these codecs for their encoding and decoding of media, and may support
additional codecs as well, for optimal cross-platform support of video and audio conferencing, and to integrate better with legacy telecommunication solutions. see codecs used by webrtc for details. for information about the fundamental concepts behind how digital aud...
...e digital audio concepts. common codecs the list below denotes the codecs most commonly used on the web and which containers (file types) support them. if all you need to know is which codecs are even possible to use, this is for you. of course, individual browsers may or may not choose to support all of these codecs, and their support for which container types can use them may vary as well. in
addition, browsers may choose to support
additional codecs not included on this list. codec name (short) full codec name container support aac advanced audio coding mp4, adts, 3gp alac apple lossless audio codec mp4, quicktime (mov) amr adaptive multi-rate 3gp flac free lossless audio codec mp4, ogg, flac g.711 ...
...n kind. for more information about these and other features of audio data, see audio data format and structure in digital audio concepts. the effect of codec configuration on encoded audio output audio codecs typically employ cleverly-designed and highly-complex mathematical algorithms to take source audio data and compress it to take substantially less space in memory or network bandwidth. in
addition to choosing the type of encoder to use, you may have the opportunity to adjust the encoder using parameters that choose specific algorithms, tune those algorithms, and specify how many passes to apply while encoding. audio encoder configuration effects on quality and size feature effect on quality effect on size lossless compression no loss of fidelity unl...
...And 6 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
don't get caught in the situation of having to bring out more new site versions as more new browsers and platforms come out, and adjust code as feature support in existing browsers changes. there are disadvantages to this approach as well. if the content, layout, and functionality need to change greatly for different devices, it may not be such a good approach. also, taking an existing site and
adding responsiveness to it, to make it mobile/tablet friendly, can be a lot more effort than just creating a separate mobile site or app, especially if it is a sprawling enterprise site. read more about responsive design advantages and disadvantages. you can also read our discussion on the basics of responsive design, if you need some more background information and basics. fluid grids the best...
...k> note: these weird x- elements may be unfamiliar; they are part of brick, mozilla's ui element library for mobile web apps. we have used brick to create the mobile layout for snapshot, which you will read more about below. to get these sitting side-by-side we have used the following rules: x-card { width: 100%; } x-card:nth-child(1), x-card:nth-child(2) { width: 30%; float: left; p
adding: 2rem; } x-card:nth-child(3) { width: 40%; float: left; height: 100%; overflow: auto; p
adding: 2rem; } so we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left. this way they end up side-by-side, and their proportions remain the same as the browser window size varies. this is just a simple grid example, but you can apply this...
...%; overflow: auto; p
adding: 2rem; } so we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left. this way they end up side-by-side, and their proportions remain the same as the browser window size varies. this is just a simple grid example, but you can apply this principle to more complex grid layouts as required. ...
...And 6 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
side as needed. the first page load is quick because of the ssr, and the navigation between pages is smooth because the client can re-render the page with only the parts that have changed. pwas can be built using any approach you like, but some will work better than the others. the most popular approach is the app shell concept, which mixes ssr and csr in exactly the way described above, and in
addition follows the "offline first" methodology which we will explain in detail in upcoming articles and use in our example application. there is also a new approach involving the streams api, which we'll mention briefly. the app shell concept the app shell concept is concerned with loading a minimal user interface and content as soon as possible, caching it so it's available offline for subsequen...
... server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article — for now let's focus on the structure itself. benefits of the app shell pattern this architecture allows a web site to benefit the most from all the pwa features — it caches the app shell and manages the dynamic content in a way that greatly improves the performance. in
addition to the basic shell, you can
add other features such as
add to home screen or push notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement. the website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. being linkable, ...
...gn it's important to remember the pwa advantages and keep them in mind when designing the application. the app shell approach allows websites to be: linkable: even though it behaves like a native app, it is still a website — you can click on the links within the page and send a url to someone if you want to share it. progressive: start with the "good, old basic website” and progressively
add new features while remembering to detect if they are available in the browser and gracefully handle any errors that crop up if support is not available. for example, an offline mode with the help of service workers is just an extra trait that makes the website experience better, but it's still perfectly usable without it. responsive: responsive web design also applies to progressive web apps, as...
...And 6 more matches
Using templates and slots - Web Components
lonenode() method. and because we are appending its contents to a shadow dom, we can include some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. this wouldn't work if we just appended it to the standard dom. ...
...de some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. this wouldn't work if we just appended it to the standard dom. so for example: <template id="my-paragraph"> <style> p { color: white; background-color: #666; p
adding: 5px; } </style> <p>my paragraph</p> </template> now we can use it by just
adding it to our html document: <my-paragraph></my-paragraph> note: templates are well-supported in browsers; the shadow dom api is supported by default in firefox (version 63 onwards), chrome, opera, safari, and edge (starting with version 79).
adding flexibility with slots so far so good, but the element isn't very flexible. we can only display one bit of text inside it, meaning that at the ...
...ement instance in a nice declarative way using the <slot> element. this has more limited support than <template>, available since chrome 53, opera 40, safari 10, firefox 59, and edge 79. slots are identified by their name attribute, and allow you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup. so, if we want to
add a slot into our trivial example, we could update our template's paragraph element like this: <p><slot name="my-text">my default text</slot></p> if the slot's content isn't defined when the element is included in the markup, or if the browser doesn't support slots, <my-paragraph> just contains the fallback content "my default text". to define the slot's content, we include an html structure in...
...And 6 more matches
Cross-domain Content Scripts - Archive of obsolete content
by default, content scripts don't have any cross-domain privileges. in particular, they can't: access content hosted in an iframe, if that content is served from a different domain make cross-domain xmlhttprequests however, you can enable these features for specific domains by
adding them to your
add-on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be allowed to access content served from https://example.com/. wildcards are not allowed. this fe...
...ins listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be allowed to access content served from https://example.com/. wildcards are not allowed. this feature is currently only available for content scripts, not for page scripts included in html files shipped with your
add-on. cross-domain iframes the following "main.js" creates a page-worker which loads a local html file called "page.html", attaches a content script called "page.js" to the page, waits for messages from the script, and logs the payload. //main.js var data = require("sdk/self").data; var pageworker = require("sdk/page-worker").page({ contenturl: data.url("page.html"), contentscriptfile: dat...
...if you want to try it out, you'll need to register and get an api key. the "main...
...And 5 more matches
Communicating using "postMessage" - Archive of obsolete content
as an alternative to port, content modules support the built-in message event. in most cases port is preferable to message events. however, the context-menu module does not support port, so to send messages from a content script to the
add-on via a context menu object, you must use message events. ...
...ntent script to the
add-on via a context menu object, you must use message events. handling message events in the content script to send a message from a content script, you use the postmessage function of the global self object: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. to receive a message from the
add-on script, use self's on function: self.on("message", function(
addonmessage) { // handle the message }); like all event-registration functions, this takes two parameters: the name of the event, and the handler function. the handler function is passed the message payload. ...
...sage payload, which may be any json-serializable value. to receive a message from the
add-on script, use self's on function: self.on("message", function(
addonmessage) { // handle the message }); like all event-registration functions, this takes two parameters: the name of the event, and the handler function. the handler function is passed the message payload. handling message events in the
add-on script to send a message to a content script, use the worker's postmessage function. ...
...And 5 more matches
Display a Popup - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to display a popup dialog, use the panel module. a panel's content is defined using html. you can run content scripts in the panel: although the script running in the panel can't directly access your main
add-on code, you can exchange messages between the panel script and the
add-on code. in this tutorial we'll create an
add-on that
adds an action button to the toolbar that displays a panel when clicked. ...
... script running in the panel can't directly access your main
add-on code, you can exchange messages between the panel script and the
add-on code. in this tutorial we'll create an
add-on that
adds an action button to the toolbar that displays a panel when clicked. the panel just contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main
add-on code. the main
add-on code logs the message to the console. ...
..., you can exchange messages between the panel script and the
add-on code. in this tutorial we'll create an
add-on that
adds an action button to the toolbar that displays a panel when clicked. the panel just contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main
add-on code. the main
add-on code logs the message to the console. ...
...And 5 more matches
Logging - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. the dom console object is useful for debugging javascript. because dom objects aren't available to the main
add-on code, the sdk provides its own global console object with most of the same methods as the dom console, including methods to log error, warning, or informational messages. you don't have to require() anything to get access to the console. it is automatically made available to you. ...
...nsole, including methods to log error, warning, or informational messages. you don't have to require() anything to get access to the console. it is automatically made available to you. ...
...lo world"); try it out: create a new directory, and navigate to it execute jpm init, accepting all the defaults open "index.js" and
add the line above execute jpm run firefox will start, and the following line will appear in the command window you used to execute jpm run: info: hello world! console in content scripts you can use the console in content scripts as well as in your main
add-on code. ...
...And 5 more matches
Extension Etiquette - Archive of obsolete content
extensions, including how to be kind to your users. it assumes that you are already familiar with building an extension. user interface tools menu items using the tool menu option gives the author the maximum amount of choices. whether the extensions should go at the top, bottom, or somewhere in between on the tools menu, the author always has a choice. ideally, the location would be below the
add-ons item, grouped with the other extension-related commands (menuitem:insertafter="javascriptconsole,devtoolsseparator"). sub-menus should be used for single extensions needing multiple menu items, and a tools menu item should not be created for options and preferences (for options and preferences, see the
add-on manager). if possible, create a menu item in the menu where it is most applicable; f...
...likewise, use context menu items sparingly — only for tasks that are done frequently or on specific elements of a web page. focus don't steal focus. ...
...ate a menu item in the menu where it is most applicable; for instance, a bookmark sharing extension should be called from the bookmarks menu. to maintain the default theme, avoid the use of an icon next to the menu items. other ui elements in general, toolbar items are very useful to end users because they can be removed or
added to various toolbars as necessary. status bar items should only be
added for extensions that need constant monitoring, such as ad blocking, page ranking, or cookie management. likewise, use context menu items sparingly — only for tasks that are done frequently or on specific elements of a web page. focus don't steal focus. it's not your extension's job to take focus from the web content. if the user loads a website and they ask for focus, they should get it. ove...
...And 5 more matches
Listening to events in Firefox extensions - Archive of obsolete content
hat application and extension authors can use to receive notifications from <xul:browser> and <xul:tabbrowser> elements to hear about changes relating to loads of the content contained within them. simple dom events registering for a dom event is done using with code such as the following: function callback(evt) { // do your processing here. check evt.target for the target of the event. ...
... domtitlechanged dispatched when the title of the page changes. domcontentloaded dispatched when the initial dom for the page is completely loaded. load dispatched after the page—including images—has first finished loading. ...
... the pagehide event in the main document. for navigation that occurs inside a single frame, events fire only in the affected frame. web progress listeners for more information about web loads a web progress listener can be used; these provide more details about the progress of loading data from the web. both browser and tabbrowser elements support the following: var progresslistener = { //
add nsiwebprogressimplementation here } b.
addprogresslistener(progresslistener); where b is the browser or tabbrowser you want to listen to events for. there are code snippets available that give more detail on using web progress listeners. for a tabbrowser, the above code will only get events from the browser that is currently displayed at the time the event occurs. in order to listen to events ...
...And 5 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
l debuggers, and is useful not only for developing extensions, but also for general web development. also, because it works with the javascript in extensions and firefox itself, the debugger can be a good way to learn about design methods. installing this is bundled with the mozilla suite and the current version of seamonkey, but it needs to be installed as an extension in firefox. see https://
addons.mozilla.org/firefox/216/. install the extension in firefox directly from the above url and relaunch firefox. starting up select “javascript debugger” from the tools menu. targeting javascript for debugging. when venkman first launches, it can only debug the file currently open in your web browser. this is because a lot of javascript files can slow down the browser down if they’re op...
...lift this restriction in order to develop extensions. uncheck the “exclude browser files” menu item under the debug menu (figure 1). fixme: figure 1: uncheck “exclude browser files.” set up quicknote for the purposes of this explanation, we’re going to use the file-storage mechanism in quicknote1 for our debugger. install quicknote from the following url and relaunch firefox. https://
addons.mozilla.org/firefox/46/. after relaunching firefox, activate quicknote. then select tools:quicknote:float to display it in its own window. using venkman read in source code activate venkman, and then select open windows:quicknote.xul:files on the top-left of the screen. double-click on quicknote.js to open it in source-code view (figure 2). fixme: figure 2: selecting source code insertin...
...hen stepped through it. use step over to avoid a function, and step into to always call it; once you are done investigating a function, use step out, and then you can step into the next function. set breakpoints in locations of interest where you’re not sure what’s going on, and the next time you run it, use continue to shift to that location and start investigating again. fixme: figure 4:
adding a watch target mozunit mozunit is a tool for javascript that assists with unit testing. it provides an ui similar to that of eclipse’s junit test runner. it should be very easy for java programmers to get up to speed on it quickly. installing mozunit is a feature of mozlab. install mozlab from the following url and relaunch firefox. http://hyperstruct.net/projects/mozunit after relaunc...
...And 5 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
for security reasons, and to prevent errors, care needs to be taken to avoid evaluating arbitrary text as html. 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. ...
...ent's attributes and/or callback functions (eg. onclick) for (var key in elemattr) { var val = elemattr[key]; if (nodes && key == "key") { nodes[val] = elem; continue; } var attrns = namespace(key); if (typeof val == "function") { // special case for function attributes; don't just
add them as 'on...' attributes, but as events, using
addeventlistener elem.
addeventlistener(key.replace(/^on/, ""), val, false); } else { // note that the default namespace for xml attributes is, and should be, blank (ie. they're not in any namespace) elem.setattributens(attrns.namespace || "", attrns.shortname, val); ...
...var text = "google"; var nodes = {}; document.documentelement.appendchild( jsontodom(["xul:hbox", {}, ["div", {}, ["a", { href: href, key: "link", onclick: function (event) { alert(event.target.href); } }, text], ["span", { class: "stuff" }, "stuff"]]], document, nodes)); alert(nodes.link); function
addentrytopopup(menupopup, doc, chromewindow) { var newitem = doc.createelement("menuitem"); newitem.setattribute("value", "testvalue"); newitem.setattribute("label", "another popup menu item"); menupopup.appendchild(newitem); }; var jsontemplatebtn = ["xul:toolbarbutton", { id: "mytestbutton", class: "toolbarbutton-1", type: "menu", ...
...And 5 more matches
XUL School Tutorial - Archive of obsolete content
xul school is a comprehensive
add-on development tutorial, focusing on firefox extension development. it is recommended that you read through all of it at least once. while firefox changes rapidly, the content in this tutorial should be up to date and valid. ...
... firefox extension development. it is recommended that you read through all of it at least once. while firefox changes rapidly, the content in this tutorial should be up to date and valid. ...
...nt. it is recommended that you read through all of it at least once. while firefox changes rapidly, the content in this tutorial should be up to date and valid. ...
...And 5 more matches
Setting up an extension development environment - Archive of obsolete content
d firedevedition or similar. you do not have to install these unstable versions, if you do not wish. make a symbolic link (also referred to as a shortcut) to the firefox binary (firefox.exe on windows), then move the link to your desktop, or your preferred location. to run this version of firefox, simply double click on this file. explore this profile a little: change some settings, install any
additional extensions, and finally close this instance of firefox. now run your firefox profile manager. (linux, mac os x, windows instructions.) you'll see the list of available user profiles one which is default (stable) and other (unstable) profile(s) created automatically when you run other versions of firefox earlier. choose default and uncheck "don't ask at startup" checkbox. click "start fir...
...the "general" tab then click the "config editor" button. recommended development preferences not all preferences are defined by default, and are therefore not listed by default. you will have to create new (boolean) entries for them. for more information about mozilla preferences, refer to the mozillazine article on "about:config". tip: you can install either the developer profile or devprefs
add-ons to handle setting these preferences automatically, and skip the rest of this section. devprefs can now be found at https://github.com/noitidart/devprefs. maxversion needs to be set in install.rdf javascript.options.showinconsole = true. logs errors in chrome files to the error console. nglayout.debug.disable_xul_cache = true. disables the xul cache so that changes to windows and dialogs...
... the use of the dump() statement to print to the standard console. see window.dump for more info. you can use nsiconsoleservice instead of dump() from a privileged script. javascript.options.strict = true. enables strict javascript warnings in the error console. ...
...And 5 more matches
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
ant meta-information is present in the win32 system registry. these keys are written by the installer of mozilla browsers -- the netscape 6.2 installer, for example, writes these keys to the registry, and so does the mozilla installer (for versions after mozilla 0.9.1). other major commercial browsers based on gecko have committed to providing these keys as well. some gecko-based browsers provide
additional information via the registry, and where appropriate, these registry keys are also mentioned, with the necessary version caveats. much of this registry data follows as a consequence of the discussions in bug 109402. to find the plugins directory applicable to netscape 6.1, 6.2.x, netscape 7.0 (and up), mozilla 1.0, and compuserve 7.0 this section details the suggested mechanism to find out ...
... to hkey_local_machine\software\mozilla caveat emptor: if the mozilla subkey is not present under hkey_local_machine, look under hkey_current_user\software\mozilla\. on windows xp and windows 2000, in order to write to the registry, sometimes the software may need administrator privileges. thus, some mozilla based browsers, such as the netscape 6 installer, write to the hkey_current_user key in
addition; this doesn't require administrator privileges. traditionally, hkey_current_user is a copy of everything in hkey_local_machine. the mozilla subkey is written under hkey_current_user\software also. however, always look at hkey_local_machine first. enumerate the mozilla subkey. here you will find keys on a per-product basis. you can enumerate the application subkeys, e.g. hkey_local_machine...
..."product x.y" contain application keys for the given mozilla based browser. example: netscape 6 6.1\ look at the extensions subkey, e.g. hkey_local_machine\software\mozilla\netscape 6 6.1\extensions\ access the plugins value and value-data pair, e.g: plugins = c:\program files\netscape\netscape 6\plugins. you also have the components value and value-data pair; this is for xpcom components. in
addition, if you have made your plugin scriptable and accessible from javascript, you ought to put the associated xpt file in the components directory. you can access the components value and value-data pair (telling you where the components directory is) in a similar manner, e.g.: components=c:\program files\netscape\netscape 6\components. future mozilla based browsers won't distinguish between plug...
...And 5 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
on which handles a particular aspect of drag and drop. five functions may be defined. you only have to define the ones that you need. ondragstart(event, transferdata, action) define this function to have something happen when a drag starts. it takes three arguments, the event object as was originally passed to the event handler, the data to drag and the type of drag action. this function should
add the data to drag to the transferdata object. ondragover(event, flavor, session) this function should be defined when you want something to happen when an element is dragged over. the first argument is the event object, the second is the flavor of the data and the third is a drag session object which provides more details about the drag that is occurring. you should define this function for eleme...
...file flavor will be used. if the file is dropped onto a textbox, the text name flavor will be used. the text is therefore used to insert the name of the file when files can't be dropped directly. a flavor object has a name, which is a formatted like a mime type, such as 'text/unicode'. within the ondragstart function, you specify what flavours are available for the item being dragged. to do this,
add data and flavours to the transferdata object, which is the second argument to ondragstart. an example should help here. the ondragstart function
adds data to the transferdata object. var textobserver = { ondragstart: function (event, transferdata, action) { var htmltext = "<strong>cabbage</strong>"; var plaintext = "cabbage"; transferdata.data = new transferdata(); transferdata...
...it has one property called ondragstart. ...
...And 5 more matches
Java in Firefox Extensions - Archive of obsolete content
creation of a xpcom component. ...
...ferences leading to this jar and all other jars in your extension within an array of java.net.url's, pass to java.net.urlclassloader to get a class loader, and finally pass the classloader and array to a function which gives the necessary privileges: // this function will be called to give the necessary privileges to your jar files // however, the policy never comes into play, because // (1)
adding permissions doesn't
add to the policy itself, and // (2)
addurl alone does not set the grant codebase function policy
add (loader, urls) { try { //if have trouble with the policy try changing it to //edu.mit.simile.javafirefoxextensionutils.urlsetpolicy var str = 'edu.mit.simile.javafirefoxextensionutils.urlsetpolicy'; var policyclass = java.lang.cl...
...ils.urlsetpolicy var str = 'edu.mit.simile.javafirefoxextensionutils.urlsetpolicy'; var policyclass = java.lang.class.forname( str, true, loader ); var policy = policyclass.newinstance(); policy.setouterpolicy(java.security.policy.getpolicy()); java.security.policy.setpolicy(policy); policy.
addpermission(new java.security.allpermission()); for (var j=0; j < urls.length; j++) { policy.
addurl(urls[j]); } }catch(e) { alert(e+'::'+e.linenumber); } } //get extension folder installation path... (this works in firefox 3.x, for firefox 4.x use
addonmanager.get
addonbyid) var extensionpath = components.classes["@mozilla.org/extensions/manager;1"...
...And 5 more matches
Space Manager High Level Design - Archive of obsolete content
frame in the context of a reflow, and to associate it with the blockreflowstate so it is passed down to child frames' reflow methods. after reflow, the space manager is destroyed. during reflow, the space manager stores the space taken up by floats (updatespacemanager in nsblockframe) and provides information about the space available for other elements (getavailablespace in nsblockreflowstate).
additionally, there is a need to manage impacts to lines caused by changes to floated elements. this is referred to as propagation of float damage and is handled by the block frame, making use of the space manager. when a float is incrementally reflowed, the space manager is notified if the float's region has changed. if so, the vertical space that has been affected (including both the float's old re...
...cleared. essentially a css-specific wrapper for generic nsbanddata. bandrect: keeps the bounds of a band, along with the frames associated with the band. bandrects are a linked list (provided by prcliststr super-class) and also provide some geometry-management methods (splitvertically, splithorizontally) and some methods that query or manipulate the frames associated with the band (isoccupiedby,
addframe, removeframe). bandlist: a subclass of bandrect that provides a list interface - head(), tail(), isempty(), etc. frameinfo: a structure that keeps information about the rectangle associated with a specific frame, in a linked list. nsbandtrapezoid: represents the discrete regions within a band that are either available, occupied by a single frame, or occupied by several frames. this is use...
...ckreflowstate 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 returned to the blockreflowstate instance after the new one has been destroyed. thus, space managers are effectively 'nested' during reflow, with each new block introducing its own space manager. use case 2: float is
added to the space manager after a space manager is created for a block context's reflow chain, a floated block may be
added to it. this happens in the method nsblockreflowstate::recoverfloats and nsblockreflowstate::flowandplacefloat (formerly this was done in nsblockframe::updatespacemanager). the general algorithm in nsblockreflowstate::recoverfloats is: for each line in the block, see if it ha...
...And 5 more matches
Tamarin build documentation - Archive of obsolete content
$ hg clone http://hg.mozilla.org/tamarin-central tamarin-central tips for working with mercurial can be found here. building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable (shell) for executing files in the abc file format. running the shell without any arguments will list the available options. note that
additional command-line arguments are only available in the debug configuration. the tamarin codebase contains a cross-platform build system for mozilla developers. the cross-platform build system is used for daily automated build testing so it is the most reliable system. the tamarin codebase has the ability to build
additional code which supports debugging hooks. in the xcode project, this is the...
...illa.org/tamarin-redux/ $ cd tamarin-redux $ mkdir objdir-release $ cd objdir-release $ python ../configure.py $ make ... $ shell/avmshell shell 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 previous cross-platform instructions here: https://developer.mozilla.org/index.php?title=en/tamarin/tamarin_build_documentation&revision=21 the bug when building on snow leopard (bug 537817) has been fixed in the tamarin-redux repo. the work for that fix ...
...'t pass the --mac-sdk switch you will get no sdk in your build. if you pass '--mac-sdk=104u' you will also get gcc/g++ 4.0. if you pass '--mac-sdk=105' or '--mac-sdk=106' you will get the gcc/g++ default for the machine you're building on. example call to build on an x86_64 machine with the 10.5 sdk: $ ../configure.py --mac-sdk=105 --target=x86_64-darwin if asc is not set, you will need to
add asc.jar to the utils directory in tamarin-redux (bug 631641). download ftp://ftp.mozilla.org/pub/js/tamarin/builds/asc/latest/asc.jar put it in utils/ building tamarin for android 2.3.3 on mac public sdk/ndk setup to build tamarin for android you will need an sdk/ndk. the setup procedure below creates an android sdk/ndk entirely from publicly available sources. this sdk/ndk *must* be u...
...And 5 more matches
Windows stub installer - Archive of obsolete content
for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually zipped with the directory structure preserved. read ...
...for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually zipped with the directory structure preserved. read the top of the pac...
...for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually zipped with the directory structure preserved. read the top of the packages-win file for it's simple syntax and semantics.
...And 5 more matches
getLastError - Archive of obsolete content
most recent nonzero error code. method of install object syntax int getlasterror (); parameters none. returns the most recent nonzero error code. for a list of possible values, see return codes. description use getlasterror method to obtain the most recent nonzero error code since initinstall or reseterror were called. ...
...t nonzero error code. method of install object syntax int getlasterror (); parameters none. returns the most recent nonzero error code. for a list of possible values, see return codes. description use getlasterror method to obtain the most recent nonzero error code since initinstall or reseterror were called. ...
... of install object syntax int getlasterror (); parameters none. returns the most recent nonzero error code. for a list of possible values, see return codes. description use getlasterror method to obtain the most recent nonzero error code since initinstall or reseterror were called. ...
...And 5 more matches
Reading from Files - Archive of obsolete content
des a means of reading bytes, strings or other values from the file. while there is only one method to create an input stream, it provides a number of options to control exactly how reading is performed. for instance, there are options to read a file as if it were text or a binary file. using the former will cause characters in the stream to be interpreted with a particular character encoding. in
addition, lines may be read by reading the file up until a linefeed character is detected. a binary stream would be used to read bytes or numbers encoded within the file. to create an input stream, first get a reference to a nsifile, and then use nsiscriptableio.newinputstream() to open a stream for reading from it. to learn more about file objects, see files and streams. var file = io.getfile("home"...
...ors that might occur during the process. see file errors for a list of errors that might occur. the newinputstream method takes two arguments in this example. the first argument is the file to read from, and the second is a set of flags which control the reading. in this case, the 'text' flag is used which indicates that you expect this file to be text file. this method actually takes a number of
additional arguments, however they are optional so they do not need to be specified if they aren't needed. these extra arguments will be discussed later. you can also specify to read from a binary file by using the flag 'binary' instead of 'text'. the difference is that text streams process the bytes being read into characters in a particular character encoding whereas binary streams always read byte...
..."home", "sample.txt"); var stream = io.newinputstream(file, "text"); var str = stream.readstring(20); stream.close(); in this example, a text input stream is created for the file 'sample.txt'. the readstring method is called to read a 20 character string from the file. since the stream was just opened, the string will be read from the beginning of the file. a further read from the file will read
additional characters after the first 20. the readstring takes one argument, the number of characters to read from the file. note that this is distinct from the number of bytes to read. depending on the character encoding, it is possible that more than 20 bytes will be read from the file in order to retrieve 20 characters from the file. the readstring method returns the string read from the stream. u...
...And 5 more matches
Anonymous Content - Archive of obsolete content
« previousnext » in this section we'll look at creating content with xbl. 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. declaring scrollbar example the example below shows how a scrollbar might be declared (it has been simplified a bit from the real thing): <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <b...
... <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </content> </binding> </bindings> this file contains a single binding, declared with the binding element. the id attribute should be set to the identifier of the binding. this way it can be referred to through the css -moz-binding property. the content tag is used to declare anonymous content that will be
added to the scroll bar. all of the elements inside the content tag will be
added inside the element that the binding is bound to. presumably this binding would be bound to a scroll bar, although it doesn't have to be. any element that has its css -moz-binding property set to the uri of the binding will use it. the result of using the above binding is that the line of xul below will be expanded as fo...
...use it. the result of using the above binding is that the line of xul below will be expanded as follows, assuming that the scrollbar is bound to the xbl above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> the elements within the content tag are
added to the scroll bar anonymously. although anonymous content is displayed on screen, you cannot get to it through a script in the normal way. to the xul, it's as if there was only one single element, even though it is really made up of a number of elements. if you look at a scroll bar in a mozilla window, you will see that it is made up of an arrow button, a slider, a thumb inside it and a second ...
...And 5 more matches
Focus and Selection - Archive of obsolete content
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. this attribute should be set to a number. when the user presses tab, the focus will shift to the element with the next highest tab index. that means that you can order the elements by setting indices on elements in sequence. usually, however, you would not set the tabindex attribute. if you do not, pressing tab will set the focus to the next displayed elemen...
... wish to use a different order. here is an example: example 1 : source view <button label="button 1" tabindex="2"/> <button label="button 2" tabindex="1"/> <button label="button 3" tabindex="3"/> the focus event the focus event is used to respond when the focus is given to an element. the blur event is used to respond when the focus is removed from an element. you can respond to focus changes by
adding an onfocus or onblur attribute on an element. they work just like their html counterparts. you might use these event handlers to highlight the element or display text on a status bar. the following example can be used to apply a function to handle a focus event. example 2 : source view <script> function displayfocus(){ var elem=document.getelementbyid('sbar'); elem.setattribute('value','e...
... blur event occurs. typically, you will use focus and blur events to update parts of the interface as the user selects elements. for instance, you might update a total as the user enters values in other fields, or use focus events to validate certain values. don't display an alert during a focus or blur event as this will be distracting for the user and is poor user interface design. you can also
add event handlers dynamically using the dom function
addeventlistener. you can use it for any element and event type. it takes three parameters, the event type, a function to execute when the event occurs and a boolean indicating whether to capture or not. getting the currently focused element the currently focused element is held by an object called a command dispatcher, of which there is only one ...
...And 5 more matches
Keyboard Shortcuts - Archive of obsolete content
ys (such as shift or ctrl) need to be pressed. an example is shown below: <keyset> <key id="sample-key" modifiers="shift" key="r"/> </keyset> this sample defines a keyboard shortcut that is activated when the user presses the shift key and r. the key attribute (note that it has the same name as the element itself) can be used to indicate which key should be pressed, in this case r. you could
add any character for this attribute to require that key to be pressed. the modifiers that must be pressed are indicated with the modifiers attribute. it is a space-separated list of modifier keys, which are listed below. alt the user must press the alt key. on the macintosh, this is the option key. control the user must press the ctrl key. meta the user must press the meta key. this is the c...
...rent key for keyboard shortcuts. for example, windows uses the control key and the macintosh uses the command key. it would be inconvenient to define separate key elements for each platform. luckily, there is a solution. the modifier accel refers to the special platform-specific key used for shortcuts. it works just like the other modifiers, but won't be the same on every platform. here are some
additional examples: <keyset> <key id="copy-key" modifiers="control" key="c"/> <key id="explore-key" modifiers="control alt" key="e"/> <key id="paste-key" modifiers="accel" key="v"/> </keyset> keycode attribute the key attribute is used to specify the key that must be pressed. however, there will also be cases where you want to refer to keys that cannot be specified with a character (such a...
... vk_d vk_e vk_f vk_g vk_h vk_i vk_j vk_k vk_l vk_m vk_n vk_o vk_p vk_q vk_r vk_s vk_t vk_u vk_v vk_w vk_x vk_y vk_z vk_numpad0 vk_numpad1 vk_numpad2 vk_numpad3 vk_numpad4 vk_numpad5 vk_numpad6 vk_numpad7 vk_numpad8 vk_numpad9 vk_multiply vk_
add vk_separator vk_subtract vk_decimal vk_divide vk_f1 vk_f2 vk_f3 vk_f4 vk_f5 vk_f6 vk_f7 vk_f8 vk_f9 vk_f10 vk_f11 vk_f12 vk_f13 vk_f14 vk_f15 vk_f16 vk_f17 vk_f18 vk_f19 vk_f20 vk_f21 vk_f22 vk_f23 vk_f24 vk_num_lock vk_scroll_lock vk_comma vk_period v...
...And 5 more matches
List Controls - Archive of obsolete content
or creating list boxes. 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. example 1 : source view <listbox> <listitem label="butter pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like wi...
...titem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. ...
...ml option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll bar will appear that the user can use to display the
additional rows. ...
...And 5 more matches
Popup Menus - Archive of obsolete content
s. you will also notice that the id has been set on the menupopup element itself. the popupset element surrounds the entire popup menu declaration. this is a generic container for popups, and is optional. it does not draw on screen but instead is used as a placeholder where you would declare all of your popups. as the name popupset implies, you can put multiple popup declarations inside it. just
add additional ones after the first menupopup element. you can have more than one popupset in a file, but usually you will have only one. associating a popup with an element now that we've created the popup, it's time to make the popup appear. to do this we need to associate the popup with an element where it should appear. we do this because we only want the popup to appear when the user clicks in...
...nly one. associating a popup with an element now that we've created the popup, it's time to make the popup appear. to do this we need to associate the popup with an element where it should appear. we do this because we only want the popup to appear when the user clicks in a certain area of a window. typically, this will be a specific button or a box. to associate the popup with an element, you
add one of three attributes to the element. the attribute you
add depends on which type of popup you want to create. for plain popups,
add a popup attribute to the element. for context popups,
add a context attribute. finally, for tooltip popups,
add a tooltip attribute. the value of the attribute must be set to the id of the menupopup that you want to have appear. this is why you must put the id on...
...a context attribute. finally, for tooltip popups,
add a tooltip attribute. the value of the attribute must be set to the id of the menupopup that you want to have appear. this is why you must put the id on the popup. that way it's easy to have multiple menupopups in one file. in the example above, we want to make the popup a context menu. that means that we need to use the context attribute and
add it to the element which we want to have the popup associated with. the sample below shows how we might do this: example 1 : source view <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <box context="clipmenu"> <label value="context click for menu"/> </box> here, the menupopup has been ...
...And 5 more matches
Templates - Archive of obsolete content
e.netscape.com/nc-rdf#name"/> </template> </vbox> here, a vertical box has been created that will contain a column of buttons, one for each top-level bookmark. you can see that the template contains a single button. this single button is used as a basis for all the buttons that need to be created. you can see in the image that the set of buttons has been created, one for each bookmark. try
adding a bookmark in the browser while you have the example window open. you'll notice that the buttons in the example get updated instantly. (you may have to focus the window for it to change.) container and datasources the template itself is placed inside a vertical box. the box has two special attributes that allow it to be used for templates, which are used to specify where the data comes from.
...d like to retrieve data from. in the case of the bookmarks, the value nc:bookmarksroot is used to indicate the root of the bookmarks hierarchy. other values that you can use will depend on the datasource you are using. if you are using your own rdf file as a datasource, the value will usually correspond to the value of an about attribute on an rdf bag, seq or alt element. inside the template by
adding these two attributes to the box above, it allows the generation of elements using the template. however, the elements inside the template need to be declared differently. you may notice in the example above that the button has a uri attribute and an unusual value for the label attribute. an attribute value inside the template that begins with 'rdf:' indicates that the value should be taken fr...
... as you can see, you can dynamically generate lists of elements with the attributes provided by a separate datasource. the uri attribute is used to specify the element where content generation will begin. content earlier will only be generated once whereas content inside will be generated for each resource. we'll see more about this when we get to creating templates for trees. more examples by
adding these features to the container the template is in, which in this case is a box, and to the elements inside the template, we can generate various interesting lists of content from external data. we can of course put more than one element inside a template and
add the special rdf references to the attributes on any of the elements. the example below demonstrates this. example 2 : source <vbox...
...And 5 more matches
Trees - Archive of obsolete content
e 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. however, listboxes may contain any type of content, whereas trees may only contain text and images. (using advanced features, progress meters or checkboxes also can be
added to the tree) a tree consists of two parts, the set of columns, and the tree body. the set of columns is defined by a number of treecol elements, one for each column. each column will appear as a header at the top of the tree. the second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. the tree is unique in that the body of the tree cons...
...ee elements trees can be created with the tree element, which is described in the following sections. there are also two elements used to define the columns to be displayed in the tree. tree this is the outer element of a tree. treecols this element is a placeholder for a set of treecol elements. treecol this is used to declare a column of the tree. by using this element, you can specify
additional information about how the data in the columns are sorted and if the user can resize the columns. you should always place an id attribute on a column, as mozilla uses the ids to identify the columns when rearranging and hiding them. this is no longer required in mozilla 1.8 and later, but it is still a good idea to use ids on columns. treechildren this contains the main body of the tree w...
... rearranging and hiding them. this is no longer required in mozilla 1.8 and later, but it is still a good idea to use ids on columns. treechildren this contains the main body of the tree where the individual rows of data will be displayed. example tree with two columns example 1 : source view <tree flex="1"> <treecols> <treecol id="namecolumn" label="name" flex="1"/> <treecol id="
addresscolumn" label="
address" flex="2"/> </treecols> <treechildren/> </tree> first, the entire table is surrounded with a tree element. this declares an element that is used as a table or tree. as with html tables, the data in a tree is always organized into rows. the columns are specified using the treecols tag. you may place as many columns as you wish in a tree. as with listboxes, a he...
...And 5 more matches
browser - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a xul <browser> element represents a frame which is expected to contain a view of a web document. it is similar to an iframe except that it holds a page history and contains
additional methods to manipulate the currently displayed page. are you here looking for information about the firefox web browser, or because you'd like to download the latest version of firefox? get firefox most of the properties and methods of the browser will rarely be used and can only be called from chrome urls. other urls will need to use the document and history objects to change the displayed document. attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disa...
..., droppedlinkhandler, homepage, showcaret, src, type properties accessibletype, cangoback, cangoforward, contentdocument, contentprincipal, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, webprogress methods
addprogresslistener, goback, goforward, gohome, gotoindex, loaduri, loaduriwithflags, reload, reloadwithflags, removeprogresslistener, stop, swapdocshells examples <!-- shows mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox> attributes autocompleteenabled type: ...
...ome type. subdocuments of chrome documents 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 preventing 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 insi...
...And 5 more matches
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
d in the build documentation. follow the instructions for meeting build requirements and getting the source, then come back here since the build process itself will be slightly different. got source? now you need to set up a special .mozconfig file to tell mozilla to build both xulrunner and your application. here's a sample .mozconfig for building xulrunner and mccoy: # options for client.mk. ...
...s for meeting build requirements and getting the source, then come back here since the build process itself will be slightly different. got source? now you need to set up a special .mozconfig file to tell mozilla to build both xulrunner and your application. here's a sample .mozconfig for building xulrunner and mccoy: # options for client.mk. ...
...ck here since the build process itself will be slightly different. got source? now you need to set up a special .mozconfig file to tell mozilla to build both xulrunner and your application. here's a sample .mozconfig for building xulrunner and mccoy: # options for client.mk. mk_
add_options moz_build_projects="xulrunner mccoy" mk_
add_options moz_objdir=@topsrcdir@/../mccoybase # global options ac_
add_options --enable-debug ac_
add_options --disable-optimize # xulrunner options ac_
add_app_options xulrunner --enable-application=xulrunner # mccoy options ac_
add_app_options mccoy --enable-application=mccoy ac_
add_app_options mccoy --with-libxul-sdk=../xulrunner/dist the first section tells mozilla what to build and where to put the resulting object files. in this case, we are building both xulr...
...And 5 more matches
Archived Mozilla and build documentation - Archive of obsolete content
ncludes tools for looking at checkin logs (and comments); doing diffs between various versions of a file; and finding out which person is responsible for changing a particular line of code ("cvsblame"). bookmark keywords practically every web surfer has bookmarks, of course, and power surfers usually have hundreds stuffed into folders within folders. in
addition to being handy pointers to useful resources, bookmarks in mozilla can be used to make the
address bar itself a power tool. searches, lookups, package tracking, and even word definitions can all be retrieved from user-customized bookmarks. building transformiix standalone calicalendarview an object implementing calicalendarview is g...
...tent of a page. web pages can reference generators via <link rel="microsummary"> elements in their <head> elements. generators can also be independently downloaded and installed by users if they include a list of pages to which they apply. creating a mozilla extension a mozilla extension is an installable enhancement to the mozilla browser that provides
additional functionality (for example linky, which
adds an item to the context menu for opening multiple links in a document or selection). this tutorial walks you through the process of building a mozilla extension that
adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e. whether or not the latest version of the code is compiling successf...
...xr (where the "d" comes from "dehydra"), which is based on clang instead of gcc. try dxr instead, or else try the gcc python plugin: https://fedorahosted.org/gcc-python-plugin/. developing new mozilla features tips for contributing new features to mozilla. devmo 1.0 launch roadmap comments, ideas, questions and other discussion should be
added on the devmo talk:1.0 launch roadmap page. further details on smaller tasks being done are available at user:dria:todo page. see also current events. download manager improvements in firefox 3 firefox 3 offers improvements to the download manager that allow multiple progress listeners, use of the storage api for data management, download resuming, and...
...And 5 more matches
Extentsions FAQ - Archive of obsolete content
lla-dev-extensions faq friday, september 22 - 29, 2006 (↑ top) how to write an xpcom component in c++ that can communicate to a com component? write an xpcom component in c++ - it will talk to the com component and will be accessible to js code via xpconnect. how to customizes toolbar button to coexist in a toolbar palette and status bar? option #3 install status buttons 1.0 <https://
addons.mozilla.org/firefox/1272/> "lets you put toolbar buttons at either end of the status-bar. just drag them there from the toolbar customisation window, like you would when
adding buttons to the toolbars." option #4 install toolbar control <http://webdesigns.ms11.net/chromeditp.html> asking for help with getting an extension to process windows messages. use wm_copydata how to creating...
...ascript for an extension? these two links should give you a starting point: http://www..xulplanet.com/tutorials/...u/advmenu.html http://www.xulplanet.com/tutorials/x...dommodify.html request for a thunderbird extension that can automatically detect the default domain when composing e-mails via autodetect. <https://bugzilla.mozilla.org/show_bug.cgi?id=312818> "thunderbird requires domain in
addresses and doesn't always
add default" there is an extension that allows what you want attached to one of the comments in this bug. how to get the value of a text box when a button is clicked? read http://developer.mozilla.org/en/docs/extension_faq and check if there are any errors in js console. friday, september 29 - october 6, 2006 (↑ top) is there anyway, via plugin or extension, fo...
...d all of the right-click context menu support is present so it should meet my needs. what is the valid location and things needed to to release a mozilla extension on mozallia site? you must remove updateurl from the install.rdf and use a known to amo minversion/maxversion. no confirmation that the answer given worked yet. is it possible to open the url in a new tab? var tab = gbrowser.
addtab( url ); // and if you want it to load in the foreground: gbrowser.selectedtab = tab; is it possible to read the html-code of the current url/site? yes, this is possible. use the dom api (http://www.w3schools.com/dom/default.asp has a good tutorial). not the best answer but a good starting point for the question asker to do some research towards the answer. why does his extension not ab...
...And 5 more matches
TCP/IP Security - Archive of obsolete content
tcp/ip is widely used throughout the world to provide network communications. 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 previous 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 pr...
...ol 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 previously 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 must be established for each application. for example, if an application needs to protect s...
...layer include: application layer. separate controls must be established for each application. for example, if an application needs to protect sensitive data sent across networks, the application may need to be modified to provide this protection. while this provides a very high degree of control and flexibility over the application’s security, it may require a large resource investment to
add and configure controls properly for each application. designing a cryptographically sound application protocol is very difficult, and implementing it properly is even more challenging, so creating new application layer security controls is likely to create vulnerabilities. also, some applications, particularly off-the-shelf software, may not be capable of providing such protection. while appli...
...And 5 more matches
Theme changes in Firefox 4 - Archive of obsolete content
e that skin files are now split into two subfolders within the omni.jar file, and you'll need to look in both places to find all the skin resources you need. /chrome/browser/skin contains application-specific skin resource files. /chrome/toolkit/skin contains toolkit skin files. note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software. in
addition, due to the way the archive is optiimized, some zip utilities don't work with it. controlling the actual icon size used by
add-on toolbar buttons the iconsize attribute of the browser's toolbar elements now has a different default value on each toolbar independently. the value does not necessarily reflect the user preference in the toolbar customization palette anymore. the theme can now ...
...es not necessarily reflect the user preference in the toolbar customization palette anymore. the theme can now override the value by setting a special css property on the toolbar. the iconsize attribute of the toolbox element in the main browser window (#navigator-toolbox) still reflects the user preference in the toolbar customization palette. use of the iconsize attribute on toolbar elements
add-ons use the iconsize attribute to determine which icon they should display when a button is placed in a specific toolbar. iconsize value actual
add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels note: for stock buttons, the theme is free to use icons of any size. however, the theme shoul...
...e which icon they should display when a button is placed in a specific toolbar. iconsize value actual
add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels note: for stock buttons, the theme is free to use icons of any size. however, the theme should be designed in such a way that the above
add-on button icon sizes fit correctly. note:
add-ons always use a 24x24 pixels icon when the button is displayed in the toolbar customization palette. default values of the iconsize attribute on browser toolbars if the theme doesn't override the value of the iconsize attribute, the following defaults are used: toolbar element id default iconsize value menu bar #tool...
...And 5 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
n strategies are inappropriate, we must first look back on how these strategies came into being. in the earliest days of the web, html was very simple, not standardized and did not include any support for client side scripting. html itself was not standardized until html 2.0 was introduced in late 1995 and it did not even include tables. browser vendors such as netscape and microsoft competed to
add compelling features to the html they supported in their browsers in order to provide the richest most compelling content to their users and to entice web authors to support them. the abilities of browsers to support the latest and greatest content changed on an almost daily basis. web authors were faced from the beginning with a variety of browsers, some of which supported the latest and greates...
... vendor and version using the reported user agent string. although this approach was considered reasonable at the time, this approach caused problems for browser vendors right from the beginning. the original netscape browsers used a user agent string which began with the code name for the netscape browser followed by its version number, e.g. mozilla/version followed by a comment token which gave
additional information regarding the operating system being used, etc. since the earliest browser detection techniques were based upon looking for a netscape based browser and only provided customized content to browsers which used the mozilla/version user agent string, other browser vendors standardized on using mozilla/version to signal that they were compatible with a particular netscape version. ...
...tion was used in some circumstances, many web authors continued to use the vendor/version approach to distinguishing web browsers in their client side scripts. since the user agent string was exposed as a property of the navigator object (e.g. navigator.useragent), many web authors used the same logic in their client side scripts as they had used earlier in their server side browser detection. in
addition to navigator.useragent other properties such as appname and appversion were available in the navigator object which could be used in browser vendor/version detection strategies. the classic example of this vendor/version client side detection strategy can be found in the ultimate browser sniffer. this script and variants of it can be found today on many web sites where it is a common source...
...And 5 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
ozilla: mozilla rhino and mozilla spidermonkey. rhino is a javascript interpreter written in java that can also bridge javascript to java server-side. steve yegge of google has been doing interesting work with this engine. spidermonkey on the other hand is the javascript engine (written in c) in the highly popular mozilla firefox browser. spidermonkey is what will evolve to become tracemonkey. in
addition, the jaxer “ajax server” (a project i work on at aptana) is an example of ssjs that uses not only spidermonkey, but also embeds the entire firefox browser engine in the application server such that you can do server-side dom manipulation and other ajaxy things server-side that rhino was not built to do. let's take a look at various ssjs implementations and some exam...
...ote resource var u = new url( "http://www.mozilla.org/news.rdf" ); var c = u.openconnection(); c.connect(); // read in the raw data var s = new java.io.inputstreamreader( c.getinputstream() ); var b = new java.io.bufferedreader( s ); var l, str = ""; while( ( l = b.readline() ) != null ) { // skip if( l != "" ) { str = str + l + "\n"; } } // define the namespaces, first the default, // then
additional namespaces default xml namespace = "http://purl.org/rss/1.0/"; var dc = new namespace( "http://purl.org/dc/elements/1.1/" ); var rdf = new namespace( "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ); // use e4x to process the feed var x = new xml( str ); for each( var i in x..item ) { print( "title: " + i.title + "\n" ); print( "about: " + i.@rdf::about + "\n" ); print( "link: " + i.lin...
... features packed into the mozilla firefox browser engine, aptana jaxer fuses the client-side with the server-side, creating a unified “same language” development platform. where once you would need to master not only javascript for the client-side but also some flavor of a server-side web language, jaxer puts all the rich capability of a server-side language into javascript. this accounts for
added simplicity and promotes rapid development methodologies. managing context to take advantage of all the operating contexts of jaxer, you'll need to specify how your scripts should behave using the runat attribute of the script tag (or by setting a runat property on a javascript function object). the common values for this attribute are explained below, though there a...
...And 5 more matches
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
the table. this was most easily accomplished by floating the div elements themselves. since i wanted them to be side by side, it was important to be sure the total width of the element boxes (including margins) was less than 50%, so the first step was this: div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} by making the content of each card 45% the width of the containing element, and
adding 2% margin to both the left and right sides, each card's element box is 49% as wide as the parent. two of them side by side will take up 98% the width of the parent element. this leaves out 2% as "wasted space," so to speak. i did it that way because it's a lot less likely to trigger a situation where rounding errors force the two floats to total more than 100% the width of the parent, as could...
... to overcome this error in document flow wasn't worth the effort. the layout wasn't bad if the fish weren't laid out next to each other, so i moved on. floating fish with the cards set up to float, the next step was to place the images appropriately. this involved floating the image inside the floated div. it just seemed like a fish cam page should have a lot of floating for some reason. i also
added a border to the image, so that it would have a nice frame. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; border: 1px solid #339;} that done, it was time to style the fish names. these are enclosed in h3 elements, so the field was pretty wide open in terms of what we could do. since the image was floated, any background or border we set on the h3 would "...
...rder the rest of the way around, and set the background to match the rest of the design. thus: div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} finishing the style
adding the background to the heading containing the name of the fish created three problems: the double border was completely covered up by the image. the text of the h3 was basically touching the right side of the floated image... ...or it would have been, except in some browsers the heading was drawn over the floated image, in contradiction to the css specification. getting the image back on...
...And 5 more matches
Unconventional controls - Game development
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. ...
... = this.input.keyboard.createcursorkeys(); //... if(this.cursors.right.isdown) { // move player right } it works out of the box. the cursors are the four directional arrow keys on the keyboard, and these have exactly the same key codes as the arrow keys on the remote. ...
...you know the codes for the other remote keys? ...
...And 5 more matches
Finishing up - Game development
d 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. ...
... 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. ...
...e as drawing the score counter —
add the following function to your code, below the drawscore() function: function drawlives() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("lives: "+lives, canvas.width-65, 20); } instead of ending the game immediately, we will decrease the number of lives until they are no longer available. we can also reset the ball and the p
addle positions when the player begins with their next life. ...
...And 5 more matches
Organizing your CSS - Learn web development
le line, like so: .box { background-color: #567895; } h2 { background-color: black; color: white; } other developers prefer to break everything onto a new line: .box { background-color: #567895; } h2 { background-color: black; color: white; } css doesn't mind which one you use. we personally find it is more readable to have each property and value pair on a new line. ...
...r: white; } css doesn't mind which one you use. we personally find it is more readable to have each property and value pair on a new line. comment your css
adding comments to your css will help any future developer work with your css file, but will also help you when you come back to the project after a break. /* this is a css comment it can be broken onto multiple lines. */ a good tip is to
add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly when scanning through, or even give you something to search for to jump right into that part of the css. if you use a string which won't appear in the code you can jump from section to section by searching for it — below we have used ||. /* || general styles */ ... /* || typography ...
... reason. you may have used a css property in a specific way to get around older browser incompatibilities, for example: .box { background-color: red; /* fallback for older browsers that don't support gradients */ background-image: linear-gradient(to right, #ff0000, #aa0000); } perhaps you followed a tutorial to achieve something, and the css is a little non-obvious. in that case you could
add the url of the tutorial to the comments. you will thank yourself when you come back to this project in a year or so, and can vaguely remember there was a great tutorial about that thing, but where is it? create logical sections in your stylesheet it is a good idea to have all of the common styling first in the stylesheet. this means all of the styles which will generally apply unless you do som...
...And 5 more matches
Multiple-column layout - Learn web development
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. our starting point contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. the <div> with a class of container will become our multicol container. we switch on multicol by using one of two properties c...
... should look like. our starting point contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. the <div> with a class of container will become our multicol container. we switch on multicol by using one of two properties column-count or column-width. the column-count property will create as many columns as the value you give it, so if you
add the following css to your stylesheet and reload the page, you will get three columns: .container { column-count: 3; } the columns that you create have flexible widths — the browser works out how much space to assign each column. column-count example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } <div class="container...
...> </div> .container { column-width: 200px; } styling the columns the columns created by multicol cannot be styled individually. there is no way to make one column bigger than other columns, or to change the background or text color of a single column. you have two opportunities to change the way that columns display: changing the size of the gap between columns using the column-gap.
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 previ...
...And 5 more matches
Basic native form controls - Learn web development
>, <legend>, <textarea>, <label>, <button>, and <input>. this article covers: the common input types button, checkbox, file, hidden, image, password, radio, reset, submit, and text. some of the attributes that are common to all form controls. note: the features discussed in this article are supported in all browsers, which is not the case for all form controls. we cover newer form controls
added in html5 in the next two articles. if you want a more advanced reference, you should consult our html forms element reference, and in particular our extensive <input> types reference. text input fields text <input> fields are the most basic form widgets. they are a very convenient way to let the user enter any kind of data, and we've already seen a few simple examples. note: html form text...
...ld"> single line text fields have only one true constraint: if you type text with line breaks, the browser removes those line breaks before sending the data to the server. the following screenshot shows default, focused and disabled text input types in firefox 71 and safari on macos and in chrome 79 and edge 18 on windows 10. ...
...with dots or asterisks) so it can't be easily read by others. ...
...And 5 more matches
Example 5 - Learn web development
: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; p
adding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);...
... #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; p
adding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em...
...t { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { p
adding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('ac...
...And 5 more matches
Use HTML to solve common problems - Learn web development
antic information for a document, so html answers many questions you might have about how to get your message across best in your document. ...
...te images and graphics how to mark abbreviations and make them understandable how to
add quotations and citations to web pages how to define terms with html hyperlinks one of the main reasons for html is making navigation easy with hyperlinks, which can be used in many different ways: how to create a hyperlink how to create a table of contents with html images & multimedia how to
add images to a webpage how to
add video content to a webpage scripting & styling html only sets up document structure. to solve presentation issues, use css, or use scripting to make your page interactive. ...
...these articles help you tackle the less common use cases you may face: forms forms are a complex html structure made to send data from a webpage to a web server. ...
...And 5 more matches
Useful string methods - Learn web development
aracter number of the main string the substring starts at. if the substring is not found inside the main string, it returns a value of -1. try this: browsertype.indexof('zilla'); this gives us a result of 2, because the substring "zilla" starts at position 2 (0, 1, 2 — so 3 characters in) inside "mozilla". such code could be used to filter strings. for example, we may have a list of web
addresses and only want to print out the ones that contain "mozilla". this can be done in another way, which is possibly even more effective. try the following: browsertype.indexof('vanilla'); this should give you a result of -1 — this is returned when the substring, in this case 'vanilla', is not found in the main string. you could use this to find all instances of strings that don't ...
...options too; study the slice() page to see what else you can find out. changing case the string methods tolowercase() and touppercase() take a string and convert all the characters to lower- or uppercase, respectively. this can be useful for example if you want to normalize all user-entered data before storing it in a database. let's try entering the following lines to see what happens: let r
addata = 'my name is mud'; r
addata.tolowercase(); r
addata.touppercase(); updating parts of a string you can replace one substring inside a string with another substring using the replace() method. this works very simply at a basic level, although there are some advanced things you can do with it that we won't go into yet. it takes two parameters — the string you want to replace, and the string y...
...y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.
addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = jssolution; solution.value = 'show solution'; updatecode(); }); solution.
addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.v...
...And 5 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
ssage along the following lines: this is a pretty easy error to track down, and the browser gives you several useful bits of information to help you out (the screenshot above is from firefox, but other browsers provide similar information). from left to right, we've got: a red "x" to indicate that this is an error. an error message to indicate what's gone wrong: "typeerror: guesssubmit.
addeventlistener is not a function" a "learn more" link that links through to an mdn page that explains what this error means in greater detail. the name of the javascript file, which links through to the debugger tab of the developer tools. if you follow this link, you'll see the exact line where the error is highlighted. the line number where the error is, and the character number in that ...
...t file, which links through to the debugger tab of the developer tools. if you follow this link, you'll see the exact line where the error is highlighted. the line number where the error is, and the character number in that line where the error is first seen. in this case, we've got line 86, character number 3. if we look at line 86 in our code editor, we'll find this line: guesssubmit.
addeventlistener('click', checkguess); the error message says "guesssubmit.
addeventlistener is not a function", which means that the function we're calling is not recognized by the javascript interpreter. often, this error message actually means that we've spelled something wrong. if you are not sure of the correct spelling of a piece of syntax, it is often good to look up the feature on mdn. the ...
...t recognized by the javascript interpreter. often, this error message actually means that we've spelled something wrong. if you are not sure of the correct spelling of a piece of syntax, it is often good to look up the feature on mdn. the best way to do this currently is to search for "mdn name-of-feature" with your favorite search engine. here's a shortcut to save you some time in this instance:
addeventlistener(). so, looking at this page, the error appears to be that we've spelled the function name wrong! remember that javascript is case sensitive, so any slight difference in spelling or casing will cause an error. changing
addeventlistener to
addeventlistener should fix this. do this now. note: see our typeerror: "x" is not a function reference page for more details about this error. ...
...And 5 more matches
Object prototypes - Learn web development
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. ...
...ay 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). objective: to understand javascript object prototypes, how prototype chains work, and how to
add new methods onto the prototype property. a prototype-based language? javascript is often described as a prototype-based language — to provide inheritance, objects can have a prototype object, which acts as a template object that it inherits methods and properties from. an object's prototype object may also have a prototype object, which it inherits methods and properties from, and so o...
...ry this, for example: person1.constructor.name note: the value of constructor.name can change (due to prototypical inheritance, binding, preprocessors, transpilers, etc.). therefore, for more complex examples, you'll want to use the instanceof operator instead. ...
...And 5 more matches
Server-side web frameworks - Learn web development
ld be hard to maintain, so web frameworks provide simple mechanisms to map url patterns to specific handler functions. this approach also has benefits in terms of maintenance, because you can change the url used to deliver a particular feature without having to change the underlying code. different frameworks use different mechanisms for the mapping. for example, the flask (python) web framework
adds routes to view functions using a decorator. @app.route("/") def hello(): return "hello world!" while django expects developers to define a list of url mappings between a url pattern and a view function. urlpatterns = [ url(r'^$', views.index), # example: /best/myteamname/5/ url(r'^best/(?p<team_name>\w.+?)/(?p<team_number>[0-9]+)/$', views.best), ] make it easy to access dat...
...eplace the underlying database without necessarily needing to change the code that uses it. this allows developers to optimize for the characteristics of different databases based on their usage. basic validation of data can be implemented within the framework. this makes it easier and safer to check that data is stored in the correct type of database field, has the correct format (e.g. an email
address), and isn't malicious in any way (crackers can use certain patterns of code to do bad things such as deleting database records). for example, the django web framework provides an orm, and refers to the object used to define the structure of a record as the model. the model specifies the field types to be stored, which may provide field-level validation on what information can be stored (e.g...
...s can use certain patterns of code to do bad things such as deleting database records). for example, the django web framework provides an orm, and refers to the object used to define the structure of a record as the model. the model specifies the field types to be stored, which may provide field-level validation on what information can be stored (e.g. an email field would only allow valid email
addresses). the field definitions may also specify their maximum size, default values, selection list options, help text for documentation, label text for forms etc. the model doesn't state any information about the underlying database as that is a configuration setting that may be changed separately of our code. the first code snippet below shows a very simple django model for a team object. this s...
...And 5 more matches
Introduction to client-side frameworks - Learn web development
to learn, and what alternatives there are to client-side frameworks. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand how client-side javascript frameworks came to exist, what problems they solve, what alternatives there are, and how to go about choosing one. a brief history when javascript debuted in 1996, it
added occasional interactivity and excitement to a web that was, up until then, composed of static documents. the web became not just a place to read things, but to do things. javascript’s popularity steadily increased. developers who worked with javascript wrote tools to solve the problems they faced, and packaged them into reusable packages called libraries, so they could share their solutions wi...
...nspired the creation of frameworks, but not really why developers felt the need to make them. exploring the why requires first examining the challenges of software development. consider a common kind of application: a to-do list creator, which we'll look at implementing using a variety of frameworks in future chapters. this application should allow users to do things like render a list of tasks,
add a new task, and delete a task; and it must do this while reliably tracking and updating the data underlying the application. in software development, this underlying data is known as state. each of our goals is theoretically simple in isolation. we can iterate over the data to render it; we can
add to an object to make a new task; we can use an identifier to find, edit, or delete a task. when we...
...(); state.tasks.foreach(task => { const item = buildtodoitemel(task.id, task.name); frag.appendchild(item); }); while (todolistel.firstchild) { todolistel.removechild(todolistel.firstchild); } todolistel.appendchild(frag); } we've now got well over thirty lines of code dedicated just to the ui – just to the step of rendering something in the dom – and at no point do we
add classes that we could use later to style our list-items! working directly with the dom, as in this example, requires understanding many things about how the dom works: how to make elements; how to change their properties; how to put elements inside of each other; how to get them on the page. none of this code actually handles user interactions, or
addresses
adding or deleting a task. if we
add t...
...And 5 more matches
Creating JavaScript callbacks in components
and this implementation is passed to the component. the component can then call methods on the observer interface to signal the external code when predefined events occur. ...
...
addobserver(stringparserobserver observer); }; in this example, the stringparser will call the stringparserobserver.onword method whenever it finishes parsing a word found in the raw string data. here is an example of how to use the callback system: var wordhandler = { onword : function(word) { alert(word); } }; var stringparser = /* get a reference to the parser somehow */ stringparser.
addobserver(wordhandler); stringparser.parse("pay no attention to the man behind the curtain"); you can find examples of this pattern all over the mozilla codebase. in fact, there is even a specific interface for this form of push callbacks, nsiobserverservice. javascript functions as callbacks another common use of the pattern is found in
addeventlistener / removeeventlistener. a nice feature of ad...
... all over the mozilla codebase. in fact, there is even a specific interface for this form of push callbacks, nsiobserverservice. javascript functions as callbacks another common use of the pattern is found in
addeventlistener / removeeventlistener. a nice feature of
addeventlistener is that you can pass a javascript function in place of the callback listener interface. ...
...And 5 more matches
Debugging on Mac OS X
ved applications such as firefox, thunderbird, and seamonkey on macos using xcode. if you want to debug from the terminal see debugging mozilla with lldb. for specific information on a way to debug hangs, see debugging a hang on os x. creating a debuggable build first, you need to build the application you're going to debug using --disable-optimize--enable-debug-symbols in your .mozconfig (also
add --enable-debug if you want assertions etc. compiled in). see building firefox for macos if you need help creating your own build. debugging firefox on macos 10.14+ macos 10.14 introduced notarization and hardened runtime features for improved application security. macos 10.15 went further, requiring applications to be notarized with hardened runtime enabled in order to launch (ignoring workarou...
...he *.xcodejproj directory in the temporary directory, move it into your mozilla source tree, and then double-click on it to reopen it. in the left-hand pane in xcode you should see a tree item where the root item has the project name. if the temporary directory that you originally created the xcode project in is under that, right click it and delete it. now, right click on the root item, select '
add files to "<project-name>"', select all the files and directories in your source directory, untick "copy items if needed", then click
add. (these will then be progressively
added under the root item <project-name> in the left-hand pane. note that subdirectories may initially appear to be empty, but they too will progressively be populated as xcode processes the sourse files. once done, you should ...
...is typically found inside the dist folder in your build directory. if you are 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 previously. 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 (ot...
...And 5 more matches
ESLint
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. ...
... user guide for which plugins to install in your editor. prior to firefox 55 the location for the eslint binary used to be tools/lint/eslint/node_modules/.bin, since bug 1305023, node_modules is now located in the top-level directory, and should need no special set-up. understanding rules and errors not all files are linted currently eslint runs on: .js .jsx .jsm .xml .html .xhtml
additionally, some directories and files are ignored, see the .eslintignore file handling errors if your code fails an eslint rule, you'll get an error similar to this: /gecko/toolkit/mozapps/installer/js-compare-ast.js 18:39 error 'snarf' is not defined. no-undef (eslint) if you don't understand a rule, you can look it up on eslint.org for more information about it. mozilla specific r...
...c for the mozilla code-base. these have the prefix mozilla/. more information: outline details of the rules rule source code common issues and how to solve them my editor says that "mozilla/whatever" is unknown run ./mach eslint --setup restart your editor if that doesn't work, check that you have your editor pointing to the correct node_modules folder. node.js is not recognized
add it to your path environment variable by running path="$path:/path/to/node.js/". for example: in windows 10, if you have installed node.js on "c:\nodejs", then the command should look like: export path=$path:/c/nodejs enabling eslint for a new directory remove the directory from .eslintignore (in the base directory of the repository) fix errors that occur when running ./mach eslint path/to/...
...And 5 more matches
mach
t mozconfig search logic is applied. here are some examples: # use an explicit mozconfig file. $ mozconfig=/path/to/mozconfig ./mach build # alternatively (for persistent mozconfig usage): $ export mozconfig=/path/to/mozconfig $ ./mach build # let's pretend the mozconfig environment variable isn't set. this will use # the mozconfig from the object directory. $ cd objdir-firefox $ mach build
adding mach to your shell's search path if you
add mach to your path (by modifying the path environment variable to include your source directory, or by copying mach to a directory in the default path like /usr/local/bin) then you can type mach anywhere in your source directory or your objdir. mach expands relative paths starting from the current working directory, so you can run commands like mach...
...you can run commands like mach build . to rebuild just the files in the current directory. for example: $ cd devtools/client $ mach build webconsole # rebuild only the files in the devtools/client/webconsole directory $ mach mochitest webconsole/test # run mochitests in devtools/client/webconsole/test enable tab completion to enable tab completion in bash, run the following command. you can
add the command to your .profile so it will run automatically when you start the shell: source /path/to/mozilla-central/python/mach/bash-completion.sh this will enable tab completion of mach command names, and in the future it may complete flags and other arguments too. note: mach tab completion will not work when running mach in a source directory older than firefox 24. for zsh, you can call the...
... general. bugs against testing commands should be filed somewhere in the testing product. how is building with mach different from building with client.mk, from using make directly? currently, mach build simply invokes client.mk as an ersatz makefile. there are no differences in terms of how the build is performed (well, at least there should not be any ideally). however - mach does offer some
additional features over manual invocation of client.mk: if on windows, mach will automatically use pymake instead of gnu make, as that is preferred on windows. mach will print timings with each line of output from the build. this gives you an idea of how long things take. mach will colorize terminal output (on terminals that support it - typically most terminals except on windows) mach will sc...
...And 5 more matches
Displaying Places information using views
row in that column. the following table shows the mappings between these magic column id values and their corresponding nsinavhistoryresultnode properties: treecol id or anonid corresponding nsinavhistoryresultnode property title title url uri date time visitcount accesscount keyword * description * date
added date
added lastmodified lastmodified tags tags ** icon *keyword and description are looked up in the places database using the nsinavhistoryresultnode property itemid. **the title column (and only the title column) automatically receives the favicon referenced by the nsinavhistoryresultnode property icon. you may specify as few or as many of these ...
...ontain other columns as well. in lieu of setting an id on a treecol, you may specify an anonid attribute. this is useful when you need the id for another purpose or when a treecol is contained in anonymous content, as in xbl. if both an id attribute and anonid attribute are specified, the anonid is used. the built-in tree view is provided as a general-purpose convenience. if you need to display
additional data or otherwise require more control over your view, you may need to write your own. see creating custom views below. using the tree view so you've got a built-in tree view. how do you ask it about the data it displays? first, see nsiplacesview. like all places views, the built-in tree view implements this interface, which provides broad methods such as getting the view's nsinavhisto...
...sinavhistoryresultnode to select. selectplaceuri() causes a particular node represented by the specified placeuri to be selected in the tree. all containers above the node in the hierarchy will be opened so that the node is visible. void selectplaceuri( string placeuri ); parameters placeuri the uri (as a string) of the nsinavhistoryresultnode to select. convenience properties in
addition to the methods above, some properties of convenience are implemented directly on the built-in tree view. warning: until bug 476952 is fixed, you may experience problems using some of these properties in conjunction with the place attribute and property. property type description flatlist boolean if true the view does not recurse into containers. the action to ...
...And 5 more matches
overflow-clip-box-block
the overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction. /* keyword values */ overflow-clip-box-block: p
adding-box; overflow-clip-box-block: content-box; /* global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset; note: on gecko, by default, p
adding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. content-box this keyword makes the clipping be related to the content box. formal...
...ut type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. content-box this keyword makes the clipping be related to the content box. ...
...nly in the ua stylesheet and chrome contexts. value not found in db! ...
...And 5 more matches
overflow-clip-box-inline
the overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction. /* keyword values */ overflow-clip-box-inline: p
adding-box; overflow-clip-box-inline: content-box; /* global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset; note: on gecko, by default, p
adding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. content-box this keyword makes the clipping be related to the content box. ...
...ut type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values p
adding-box this keyword makes the clipping be related to the p
adding box. content-box this keyword makes the clipping be related to the content box. ...
...nly in the ua stylesheet and chrome contexts. value not found in db! ...
...And 5 more matches
QA phase
this is due to a bug in the build logic. please either follow the above structure closely or adjust the commands below according to your custom setup. to copy this file to the appropriate directory, do the following: navigate to your working directory from your command-line te...
.../x-testing/toolkit/defines.inc tah-dah! copied! finally, you will need a file called .mozconfig to proceed with manual builds. this file contains the necessary build instructions. ...
... enter the following comma...
...And 5 more matches
McCoy
mccoy uses xulrunner which is bound to break, for details see this post. mozilla calls mccoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not. mccoy is an application that allows
add-on authors to provide secure updates to their users. applications periodically look for and install updates to their
add-ons. it's important that the update information retrieved has not been tampered with since being written by the
add-on author. specifically, it focuses on the process of digitally signing update manifests so the applications can verify the integrity of a manifest retrieved over normally insecure channels. if you want to learn about the technical details of mccoy then visit the project wiki. installing mccoy to use mccoy you need to...
...os x). the first time it runs it will ask you to create a master password. it is strongly recommended that you use a password to protect your mccoy data. once you have a password set you can change it from the keys menu and you will have to enter it each time you run mccoy. signing from command line currently there is no support to run mccoy from command line under windows, but it is planned to
add this support in the future. however, there are several external and unofficial tools which enable signing from command line: uhura - part of the mxtools package from softlights http://www.softlights.net/projects/mxtools/uhura.html signontheline - an extension to mccoy - important: you have to checkout rev 222, later revisions are not working in mccoy! https://fireclipse.svn.sourceforge.net/...
... the first step is to create a cryptographic key. simply click the "create" toolbar button or select "create key" from the "keys" menu. you should give the key a name that...
...And 5 more matches
NSPR Error Handling
rerror.h: pr_out_of_memory_error insufficient memory to perform request. pr_bad_descriptor_error the file descriptor used as an argument in the preceding function is invalid. pr_would_block_error the operation would have blocked, which conflicts with the semantics that have been established. pr_access_fault_error one of the arguments of the preceding function specified an invalid memory
address. pr_invalid_method_error the preceding function is invalid for the type of file descriptor used. pr_illegal_access_error one of the arguments of the preceding function specified an invalid memory
address. pr_unknown_error some unknown error has occurred. pr_pending_interrupt_error the operation terminated because another thread has interrupted it with pr_interrupt. pr_not_implemented...
...invalid device. pr_io_timeout_error the i/o operation has not completed in the time specified for the preceding function. pr_io_pending_error an i/o operation has been attempted on a file descriptor that is currently busy with another operation. pr_directory_open_error the directory could not be opened. pr_invalid_argument_error one or more of the arguments to the function is invalid. ...
... i/o operation has not completed in the time specified for the preceding function. pr_io_pending_error an i/o operation has been attempted on a file descriptor that is currently busy with another operation. pr_directory_open_error the directory could not be opened. pr_invalid_argument_error one or more of the arguments to the function is invalid. ...
...And 5 more matches
NSS 3.47 release notes
d in early december: tls 1.3 will be the default maximum tls version. see bug 1573118 for details. tls extended master secret will be enabled by default, where possible. see bug 1575411 for details. ...
... tls extended master secret will be enabled by default, where possible. see bug 1575411 for details. ...
..., where possible. see bug 1575411 for details. ...
...And 5 more matches
Encrypt Decrypt_MAC_Using Token
xt[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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, i...
...o 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 previously created iv. ...
...ss) { 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 previously created iv. ...
...And 5 more matches
sslfnc.html
successful, secfailure. use pr_geterror to retrieve the error code. description nss_init opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) in the specified directory. nss_init isnot idempotent, so call it only once. nss_init opens the database files read-only. if you are performing operations that require write permission, for example s/mime operations such as
adding a certificate, use nss_initreadwrite instead. before calling nss_init, your program must call pr_init. the policy flags for all cipher suites are turned off by default, disallowing all cipher suites. therefore, an application cannot use nss to perform any cryptographic operations until after it enables appropriate cipher suites by calling one of the ssl export policy functions: nss_set...
...s 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). see the description below for more informatio...
...sed, the server default value is used: /tmp (unix) or \\temp (nt). returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain error code. description if you are writing an application that will use ssl sockets that handshake as a server, you must call ssl_configserversessionidcache to configure
additional session caches for server sessions. if your server application uses multiple processes (instead of or in
addition to multiple threads), use ssl_configmpserversidcache instead. you must use one of these functions to create a server cache. this function creates two caches: theserver session id cache (also called the server session cache, or server cache), and theclient-auth certificate cach...
...And 5 more matches
NSS tools : signtool
alue] ] [[--norecurse] ] [[--leavearc] ] [[-j directory] ] [[-z jarfile] ] [[-o] ] [[-p password] ] [directory-tree] [archive] description the signing tool, signtool, creates digital signatures and uses a java archive (jar) file to associate the signatures with files in a directory. electronic software distribution over any network involves potential security problems. to help
address some of these problems, you can associate digital signatures with the files in a jar archive. digital signatures allow ssl-enabled clients to perform two important operations: * confirm the identity of the individual, company, or other entity whose digital signature is associated with the files * check whether the files have been tampered with since being signed if you ha...
...t allows you to associate your digital signature with one or more files. an individual file can potentially be signed with multiple digital signatures. for example, a commercial software developer might sign the files that constitute a software product to prove that the files are indeed from a particular company. a network administrator manager might sign the same files with an
additional digital signature based on a company-generated certificate to indicate that the product is approved for use within the company. the significance of a digital signature is comparable to the significance of a handwritten signature. once you have signed a file, it is difficult to claim later that you didn't sign it. in some situations, a digital signature may be considered ...
...ed in your copy of communicator, you typically install it by clicking the appropriate link on the certificate authority's web site, for example on the page from which you initiated enrollment for your signing certificate. this is the case for some test certificates, as well as certificates issued by netscape certificate management system: you must download the the ca certificate in
addition to obtaining your own signing certificate. ca certificates for several certificate authorities are preinstalled in the communicator certificate database. when you receive an object-signing certificate for your own use, it is automatically installed in your copy of the communicator client software. communicator supports the public-key cryptography standard known as pkcs ...
...And 5 more matches
Bytecode Descriptions
can throw. on success, the result is always a boolean value. format: jof_ic lsh, rsh, ursh stack: lval, rval ⇒ (lval op rval) bitwise shift operators (<<, >>, >>>). pop two values, convert them to integers, perform a bitwise shift, and push the result. conversion can call .tostring()/.valueof() methods and can throw. the result on success is always an int32 or bigint value. format: jof_ic
add stack: lval, rval ⇒ (lval + rval) the binary + operator. pop two values, convert them to primitive values,
add them, and push the result. if both values are numeric,
add them; if either is a string, do string concatenation instead. the conversion can call .tostring()/.valueof() methods and can throw. format: jof_ic sub stack: lval, rval ⇒ (lval - rval) the binary - operator. pop two value...
...ring()/.valueof() methods and can throw. format: jof_ic sub stack: lval, rval ⇒ (lval - rval) the binary - operator. pop two values, convert them to numeric values, subtract the top value from the other one, and push the result. the conversion can call .tostring()/.valueof() methods and can throw. on success, the result is always numeric. format: jof_ic inc, dec stack: val ⇒ (val +/- 1)
add or subtract 1. val must already be a numeric value, such as the result of jsop::tonumeric. implements: the ++ and -- operators, step 3 of each algorithm. format: jof_ic mul, div, mod stack: lval, rval ⇒ (lval op rval) the multiplicative operators (*, /, %). pop two values, convert them to numeric values, do math, and push the result. the conversion can call .tostring()/.valueof() methods and...
...property key for us, but the spec says to convert it only once. the conversion can call .tostring()/.valueof() methods and can throw. format: jof_ic tonumeric, tostring stack: val ⇒ tonumeric(val) convert a value to a numeric value (a number or bigint). implements: tonumeric(val). note: this is used to implement ++ and --. surprisingly, it's not possible to get the right behavior using jsop::
add and jsop::sub alone. for one thing, jsop::
add sometimes does string concatenation, while ++ always does numeric
addition. more fundamentally, the result of evaluating x-- is tonumeric(old value of x), a value that the sequence getlocal "x"; one; sub; setlocal "x" does not give us. format: jof_ic other expressions globalthis stack: ⇒ this push the global this value. not to be confused with ...
...And 5 more matches
Using the Places history service
ces. this page provides a map to the external api. history services interface overview the mozilla history service has undergone many revisions. to maintain backwards compatibility, each version has implemented the older interfaces, resulting in functionality spread across many interfaces. the places history service ("navhistory") implements these history interfaces: nsiglobalhistory2: basic
add page, is visited functionality used by the docshell when visiting and rendering pages. nsiglobalhistory3:
adds extra functions for dealing with redirects and hints for rendering (gecko flags). nsibrowserhistory:
adds functions used by the basic browser like marking pages as typed in the url bar, and removing pages as from the history interface. nsinavhistoryservice: complex query functions, mo...
... .corrupt file and a new one has been created and initialized. break; case historyservice.database_status_upgraded: // database had an old schema version and has been upgraded to a new one. break; } in case the database is locked by a third party process and cannot be opened, a "places-database-locked" notification is fired, in such a case the service won't be able to initialize.
adding pages to history nsiglobalhistory2.
adduri: this is the basic function for
adding pages to history that is called by the docshell as you browse. the redirect flag is deprecated. see
adddocumentredirect below. nsiglobalhistory3.
adddocumentredirect: this is called by the docshell when a redirect occurs. it replaces the old redirect flag on
adduri. it gives the old and new channels to the histor...
...ges to history that is called by the docshell as you browse. the redirect flag is deprecated. see
adddocumentredirect below. nsiglobalhistory3.
adddocumentredirect: this is called by the docshell when a redirect occurs. it replaces the old redirect flag on
adduri. it gives the old and new channels to the history service so that the source page of the redirect can be determined. nsibrowserhistory.
addpagewithdetails: called by history importing code. new code should use nsinavhistoryservice.setpagedetails. nsinavhistoryservice.
addvisit: this is an advanced function that allows the caller to set the exact referring visit, the time, the session, etc. ...
...And 5 more matches
Setting up the Gecko SDK
r last visual c++. now it's microsoft visual c++ 2010. express edition is free.) new dialog select ok. in the win32 dynamic-link library dialog that displays (see below), you can choose the default selection "an empty dll project" as the type of dll. in this dialog, click finish. microsoft studio creates a new project per your specification and presents you with the standard project view.
adding the gecko sdk to the project settings in order to build anything that uses gecko, you have to further modify the project so that it knows where to find the gecko sdk on the disk. to edit project settings, select settings from the project menu (or press alt-f7). most of the changes you make in the following steps apply to all configurations of the project (both debug and optimized), so select...
...ows where to find the gecko sdk on the disk. to edit project settings, select settings from the project menu (or press alt-f7). most of the changes you make in the following steps apply to all configurations of the project (both debug and optimized), so select "all configurations" from the settings for dropdown menu: on the c/c++ tab, select the preprocessor category. this window is where you
add the include paths to the gecko sdk as well as two preprocessor defines: xpcom_glue mozilla_strict_api at a minimum, you must include the nspr, the embedstring and string include directories, and the xpcom include subdirectory. if your component will use other parts of the sdk (e.g., necko), you will have to
add these include directories to this field as well. assuming you are using the exa...
...m\include c:\gecko-sdk\nspr\include c:\gecko-sdk\string\include under the c++ language category, disable exception handling. as described in the section exceptions in xpcom, exception handling isn't supported across interface boundaries, so setting this option may catch problems during development. the weblock component needs to link against the appropriate libraries to uses xpcom glue. to
add these libraries, select the link tab, then choose the input category. in this panel, instead of linking to the include subdirectories of the nspr, embedstring, and xpcom directories,
add the paths to the bin subdirectories. we also link against a number of libraries in the object/library modules line: nspr4.lib plds4.lib plc4.lib embedstring.lib xpcomglue.lib both of these settings are ...
...And 5 more matches
amIWebInstaller
toolkit/mozapps/extensions/amiwebinstaller.idlscriptable this interface is used to allow web pages to start installing
add-ons. ...
... toolkit/mozapps/extensions/amiwebinstaller.idlscriptable this interface is used to allow web pages to start installing
add-ons. ...
...tring ahashes, [array, size_is(ainstallcount)] in wstring anames, [array, size_is(ainstallcount)] in wstring aicons, [optional] in amiinstallcallback acallback, [optional] in pruint32 ainstallcount); boolean isinstallenabled(in astring amimetype, in nsiuri areferer); note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindow. ...
...And 5 more matches
nsIBlocklistService
xpcom/system/nsiblocklistservice.idlscriptable please
add a summary to this article. ...
... xpcom/system/nsiblocklistservice.idlscriptable please
add a summary to this article. ...
... xpcom/system/nsiblocklistservice.idlscriptable please
add a summary to this article. ...
...And 5 more matches
nsIBrowserSearchService
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/browser/search-service;1. to access this service, use: var browsersearchservice = components.classes["@mozilla.org/browser/search-service;1"] .getservice(components.interfaces.nsibrowsersearchservice); attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. ...
.... this is not an issue if your code is executed in reaction to a user interaction, as initialization is complete by then, but this is an issue if your code is executed during startup. if you need to write code that is executed during startup and makes use of nsibrowsersearchservice, you should make sure that this code is executed from the callback to init(). ...
...ecuted during startup. if you need to write code that is executed during startup and makes use of nsibrowsersearchservice, you should make sure that this code is executed from the callback to init(). ...
...And 5 more matches
nsIJumpListBuilder
widget/public/nsijumplistbuilder.idlscriptable please
add a summary to this article. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) jump lists are built and then applied. modifying an applied jump list is not permitted. callers should begin the creation of a new jump list using initlistbuild(),
add sub lists using
addlisttobuild(), then commit the jump list using commitlistbuild(). lists are built in real-time during the sequence of build calls, make sure to check for errors on each individual step. the default number of allowed items in a jump list is ten. users can change the number through system preferences. ...
...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(). ...
...lists are built in real-time during the sequence of build calls, make sure to check for errors on each individual step. the default number of allowed items in a jump list is ten. users can change the number through system preferences. user may also pin items to jump lists, which take up
additional slots. applications do not have control over the number of items allowed in jump lists; excess items
added are dropped by the system. item insertion priority is defined as first to last
added. ...
...And 5 more matches
Working with Multiple Versions of Interfaces
o identify each particular extension instance. to do this i used the accessibility framework: hwnd gethwnd(nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsiaccessibleretrieval> refp; refp = do_createinstance( "@mozilla.org/accessibleretrieval;1", &rv); if (ns_failed(rv)){ return self; } //line 6. nscomptr<nsiaccessible> accnode; rv = refp->getaccessiblefor(node, getter_
addrefs(accnode)); if(ns_failed(rv)){ return self; } void *wh = null; nscomptr<nsiaccessibledocument> accdocnode; accdocnode = do_queryinterface(accnode, &rv); if(ns_failed(rv)){ return self; } rv = accdocnode->getwindowhandle(&wh); if(ns_succeeded(rv)){ self = static_cast<hwnd>(wh); } return self; } this approach worked, as is, for versions as early as firefox 1.5. the problem arise...
...onst nsiid iar_iid_old = { 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x06, 0xb6, 0x26 }}; static const nsiid iad_iid_old = {0x8781fc88, 0x355f, 0x4439, { 0x88, 0x1f, 0x65, 0x04, 0xa0, 0xa1, 0xce, 0xb6 }}; then follow the recipe. ...
... { 0x88, 0x1f, 0x65, 0x04, 0xa0, 0xa1, 0xce, 0xb6 }}; then follow the recipe. ...
...And 5 more matches
XPCOM
interfaces in xpcom are defined in a dialect of idl called xpidl. xpcom itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc. the majority of xpcom components are not part of this core set and are provided by other parts of the platform (e.g. ...
...ws registry using xpcomwhen implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs. to this end, there exist xpcom interfaces to read and write registry data. this article will show you how to use the available interfaces in several mozilla products.aggregating the in-memory datasourcealready_
addrefedalready_
addrefed in association with nscomptr allows you to assign in a pointer without
addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail. it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. effectively, it is a different platform.b...
...illa already provides a tutorial for making a simple javascript or c++ component (implementing the nsisimple interface). here is how to make the same component in python using pyxpcom.fun with xbl and xpconnectgenerating guidsguids are used in mozilla programming for identifying several types of entities, including xpcom interfaces (this type of guids is callled iid), components (cid), and legacy
add-ons—like extensions and themes—that were created prior to firefox 1.5.
add-ons can (and should) be identified with ids of the form extensionname@organization.tld since firefox 1.5.generic factorymost xpcom factories can be very simple. rick potts wrote a templated-based generic factory (nsfactory<t>) that simplifies the factory creation process that just requires writing a createinstance() me...
...And 5 more matches
Mail event system
essage count increases. the folder pane needs to know that this changed so that it can update the message count so the user can see it. interfaces the key interfaces here are: nsifolder.idl is an interface for storing a hierarchy of objects with properties. this interface is not (should not be) mail-related. ...
...if the object wants to know about all notifications on all folders, then it should register with the mail session. nsimsgmailsession.idl is a service that acts as a broadcaster for folder notifications. the mail session receives all notifications from all folders, and then forwards it on to any nsifolderlisteners that have registered themselves. ...
... the object wants to know about all notifications on all folders, then it should register with the mail session. nsimsgmailsession.idl is a service that acts as a broadcaster for folder notifications. the mail session receives all notifications from all folders, and then forwards it on to any nsifolderlisteners that have registered themselves. the nsimsgmailsession interface actually only allows
adding and removal of listeners - the notifications happen through the nsifolderlistener interface as well. methods each event type has a two methods associated with it: notify*<event> - in the nsifolder interface, and nsimsgmailsession interface. onitem*<event> - in the nsifolderlistener interface. the mail session implements this interface. where <event> is the type of event, such as bo...
...And 5 more matches
Index - Firefox Developer Tools
4 color vision simulation accessibility, accessibility inspector, color blindness, devtools, guide, simulation, tools the simulator in the accessibility inspector in firefox developer tools lets you see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity loss. 5
add-ons web development, web development:tools developer tools that are not built into firefox, but ship as separate
add-ons. 6 dom inspector dom, dom:tools, dom_inspector, extensions, extensions:tools, themes, themes:tools, tools, web development, web development:tools, xul, xul:tools the dom inspector (also known as domi) is a developer tool used to inspect, browse, a...
... at inspecting app manifests using the firefox devtools application panel. 14 browser console browser, debugging, tools, web development, webdevelopment:tools the browser console is like the web console, but applied to the whole browser rather than a single content tab. 15 browser toolbox debug, firefox, javascript the browser toolbox enables you to debug
add-ons and the browser's own javascript code rather than just web pages like the normal toolbox. the browser toolbox's context is the whole browser rather than just single page on a single tab. 16 dom property viewer dom, tools, web development the dom property viewer lets you inspect the properties of the dom as an expandable tree structure, starting from the window object of ...
...tarting from the window object of the current page or the selected iframe. 17 debugger-api debugger, intermediate, intro, javascript, tools mozilla’s javascript engine, spidermonkey, provides a debugging interface named debugger which lets javascript code observe and manipulate the execution of other javascript code. both firefox’s built-in developer tools and the firebug
add-on use debugger to implement their javascript debuggers. however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. 18 debugger when called as a constructor, the debugger object creates a new debugger instance. 19 debugger.environment a debugger.environment instan...
...And 5 more matches
DataTransfer.mozSetDataAt() - Web APIs
if data of the given format already exists, it is replaced in the same position as the old data. ...
...if data of the given format already exists, it is replaced in the same position as the old data. ...
...if data of the given format already exists, it is replaced in the same position as the old data. the data should be either a string, a boolean or number type (which will be converted into a string) or an nsisupports. note: this method is gecko-specific. ...
...And 5 more matches
IDBObjectStore.autoIncrement - Web APIs
auto increment counter. note: this feature is available in web workers. syntax var myautoincrement = objectstore.autoincrement; value a boolean: value meaning true the object store auto increments. false the object store does not auto increment. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store using
add(). after the object store has been created, we log objectstore.autoincrement to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; ...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 5 more matches
IDBTransaction.abort() - Web APIs
bute set to aborterror. note: this feature is available in web workers. syntax transaction.abort(); exceptions this method may raise a domexception of the following type: exception description invalidstateerror the transaction has already been committed or aborted. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we simply abort any activity done under the current transaction using abort(). for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest...
...r a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...le, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 5 more matches
IDBTransaction.db - Web APIs
the db read-only property of the idbtransaction interface returns the database connection with which this transaction is associated. note: this feature is available in web workers. syntax var mydatabase = transaction.db; value an idbdatabase object. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we return the associated database connection using db. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = func...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 5 more matches
IDBTransaction.mode - Web APIs
that delete and create object stores and indexes. this mode is for updating the version number of transactions that were started using idbdatabase.setversion(). transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we simply log the mode of the current transaction using mode. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexed...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 5 more matches
Intersection Observer API - Web APIs
the root intersection rectangle is the root element's content area. otherwise, the root intersection rectangle is the intersection root's bounding client rectangle (as returned by calling getboundingclientrect() on it). the root intersection rectangle can be adjusted further by setting the root margin, rootmargin, when creating the intersectionobserver. the values in rootmargin define offsets
added to each side of the intersection root's bounding box to create the final intersection root bounds (which are disclosed in intersectionobserverentry.rootbounds when the callback is executed). thresholds rather than reporting every infinitesimal change in how much a target element is visible, the intersection observer api uses thresholds. when you create an observer, you can provide one or more...
...l bottomright"></div> </div> </template> <main> <div class="contents"> <div class="wrapper"> </div> </div> </main> .contents { position: absolute; width: 700px; height: 1725px; } .wrapper { position: relative; top: 600px; } .samplebox { position: relative; left: 175px; width: 150px; background-color: rgb(245, 170, 140); border: 2px solid rgb(201, 126, 17); p
adding: 4px; margin-bottom: 6px; } #box1 { height: 200px; } #box2 { height: 75px; } #box3 { height: 150px; } #box4 { height: 100px; } .label { font: 14px "open sans", "arial", sans-serif; position: absolute; margin: 0; background-color: rgba(255, 255, 255, 0.7); border: 1px solid rgba(0, 0, 0, 0.7); width: 3em; height: 18px; p
adding: 2px; text-align: center; } .tople...
... an array of threshold sets for each of the boxes. the // first box's thresholds are set programmatically // since there will be so many of them (for each percentage // point). ...
...And 5 more matches
KeyboardEvent: code values - Web APIs
pause" "pause" 0x0046 "scrolllock" "scrolllock" 0x0047 "numpad7" "numpad7" 0x0048 "numpad8" "numpad8" 0x0049 "numpad9" "numpad9" 0x004a "numpadsubtract" "numpadsubtract" 0x004b "numpad4" "numpad4" 0x004c "numpad5" "numpad5" 0x004d "numpad6" "numpad6" 0x004e "numpad
add" "numpad
add" 0x004f "numpad1" "numpad1" 0x0050 "numpad2" "numpad2" 0x0051 "numpad3" "numpad3" 0x0052 "numpad0" "numpad0" 0x0053 "nump
addecimal" "nump
addecimal" 0x0054 (alt + printscreen) "printscreen" "" 0x0055 "unidentified" "" 0x0056 "intlbackslash" "intlbackslash"...
... "audiovolumedown" "volumedown" (was "volumedown" until chrome 50) 0xe02f "unidentified" "" 0xe030 "audiovolumeup" "volumeup" (was "volumeup" until chrome 50) 0xe031 "unidentified" "" 0xe032 "browserhome" "browserhome" 0xe033, 0xe034 "unidentified" "" 0xe035 "nump
addivide" "nump
addivide" 0xe036 "unidentified" "" 0xe037 "printscreen" "printscreen" 0xe038 "altright" "altright" 0xe039, 0xe03a "unidentified" "" 0xe03b "unidentified" "help" 0xe03c~ 0xe044 "unidentified" "" 0xe045 "numlock" "numlock" 0xe046 (ctrl...
...ntrol (0x3b) "controlleft" "controlleft" kvk_rightshift (0x3c) "shiftright" "shiftright" kvk_rightoption (0x3d) "altright" "altright" kvk_rightcontrol (0x3e) "controlright" "controlright" kvk_function (0x3f) "fn" (no events fired actually) "" (no events fired actually) kvk_f17 (0x40) "f17" "f17" kvk_ansi_keyp
addecimal (0x41) "nump
addecimal" "nump
addecimal" kvk_ansi_keypadmultiply (0x43) "numpadmultiply" "numpadmultiply" kvk_ansi_keypadplus (0x45) "numpad
add" "numpad
add" kvk_ansi_keypadclear (0x47) "numlock" "numlock" kvk_volumeup (0x48) "audiovolumeup" (was "volumeup" until firefox 48) "audiovolumeup" (was "volumeup" until chrome 50) ...
...And 5 more matches
Key Values - Web APIs
d in firefox per bug 1232918. until that's fixed, these keys are returned as "os" by firefox: vk_lwin (0x5b) and vk_rwin (0x5c) on windows, and gdk_key_super_l (0xffeb), gdk_key_super_r (0xffec), gdk_key_hyper_l (0xffed), and gdk_key_hyper_r (0xffee) on linux. [2] internet explorer (tested on release 9 and 11) reports "scroll" instead of "scrolllock" for the scroll lock key. [3] firefox did not
add support for the symbol key until firefox 37. [4] firefox generates the key value "os" for the super and hyper keys, instead of "super" and "hyper". [5] chrome 67 and firefox 63 now correctly interpret the right alt key for keyboard layouts which map that key to altgr. see firefox bug bug 900750 and chrome bug 25503 for further details. whitespace keys keyboardevent.key value descr...
...ing an input method editor (ime) to input text which can't readily be entered by simple keypresses, such as text in languages such as those which have more graphemes than there are character entry keys on the keyboard. common examples include chinese, japanese, korean, and hindi. some keys are common across multiple languages, while others exist only on keyboards targeting specific languages. in
addition, not all keyboards have all of these keys. common ime keys keyboardevent.key value description virtual keycode windows mac linux android "allcandidates" the all candidates key, which starts multi-candidate mode, in which multiple candidates are displayed for the ongoing input. gdk_key_multiplecandidate (0xff3d qt::key_multiple...
...al television service (analog cable or antenna reception). keycode_tv_terrestrial_analog (235) "tvterrestrialdigital" selects digital terrestrial television service (digital cable or antenna receiption). keycode_tv_terrestrial_digital (236) "tvtimer" timer programming button. keycode_tv_timer_programming (258) [1] firefox
added proper support for the "tv" key in firefox 37; before that, this key generated the key code "live". [2] these keys were "unidentified" until firefox 37. media controller keys because modern remote controls for media devices often include buttons beyond the basic controls covered elsewhere in this document, key values are defined for a broad array of these
additional buttons. the values belo...
...And 5 more matches
Node - Web APIs
the dom node interface is an abstract base class upon which many other dom api objects are based, thus letting those object types to be used similarly and often interchangeably. as an abstract class, there is no such thing as a plain node object. all objects that implement node functionality are based on one of its subclasses. most notable are document, element, and documentfragment. in
addition, every kind of dom node is represented by an interface based on node. these include attr, characterdata (which text, comment, and cdatasection are all based on), processinginstruction, documenttype, notation, entity, and entityreference. in some cases, a particular feature of the base node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or t...
...include attr, characterdata (which text, comment, and cdatasection are all based on), processinginstruction, documenttype, notation, entity, and entityreference. in some cases, a particular feature of the base node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. ...
...s, a particular feature of the base node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. for example, attempting to
add children to a node type that cannot have children will throw an exception. ...
...And 5 more matches
PaymentRequest.onshippingoptionchange - Web APIs
the onshippingoptionchange event of the paymentrequest interface is fired whenever the user changes a shipping option. syntax paymentrequest.
addeventlistener('shippingoptionchange', shippingoptionchangeevent => { ... }); paymentrequest.onshippingoptionchange = function(shippingoptionchangeevent) { ... }; examples the shippingoptionchange event is triggered by a user-agent controlled interaction. if the option stored by the user agent changes at any time during a payment process, the event is triggered. to make sure an updated option is included when sending payment information to the server, you should
add event listeners for a paymentrequest object after instantiation, but before the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. var reque...
...nt is triggered. to make sure an updated option is included when sending payment information to the server, you should
add event listeners for a paymentrequest object after instantiation, but before the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. ...
... to make sure an updated option is included when sending payment information to the server, you should
add event listeners for a paymentrequest object after instantiation, but before the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. ...
...And 5 more matches
Performance API - Web APIs
ry provides methods and properties the encapsulate a single performance metric that is part of the performance timeline. performanceframetiming provides methods and properties containing frame timing data about the browser's event loop. performancemark an abstract interface for performance entries with an entry type of "mark". entries of this type are created by calling performance.mark() to
add a named domhighrestimestamp (the mark) to the browser's performance timeline. performancemeasure an abstract interface for performance entries with an entry type of "measure". entries of this type are created by calling performance.measure() to
add a nameddomhighrestimestamp (the measure) between two marks to the browser's performance timeline. performancenavigationtiming provides methods and...
... the browser's performance timeline. performanceresourcetiming provides methods and properties for retrieving and analyzing detailed network timing data regarding the loading of an application's resources. specifications specification status comment high resolution time recommendation initial definition. ...
...lyzing detailed network timing data regarding the loading of an application's resources. specifications specification status comment high resolution time recommendation initial definition. high resolution time level 2 recommendation
adds performance attribute on window and workerglobalscope. high resolution time level 3 editor's draft
add timeorigin property to performance interface. frame timing draft
adds performanceframetiming interface. ...
...And 5 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
ose of flexbox: "note: while the alignment properties are defined in css box alignment [css-align-3], flexible box layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec. these properties apply only to flex layout until css box alignment level 3 is finished and defines their effect for other layout modes. ...
...these properties were initially defined in the css grid specification and named grid-row-gap, grid-column-gap and grid-gap. they have been renamed and moved to box alignment in order that they can be used in all layout methods — this will ultimately include flexbox. ...
...n on browser support in the mdn documentation for writing-mode. however if you are planning on using writing modes in your layout, carefully testing the results is advisable — not least because it would be easy to make things hard to read! note that you would not normally use css and the writing-mode property to change an entire document to another writing mode. this would be done via html, by
adding a dir and lang attribute to the html element to indicate the document language and default text direction. this would mean that the document would display correctly even if css did not load. flexbox and other layout methods the flexbox specification contains a definition of what happens if an item uses another layout method and then becomes a flex item. for example, if an item is floated and...
...And 5 more matches
Using CSS transitions - CSS: Cascading Style Sheets
ons are shown here: a { color: #fff; background-color: #333; transition: all 1s ease-out; } a:hover, a:focus { color: #333; background-color: #fff; } this css establishes the look of the menu, with the background and text colors both changing when the element is in its :hover and :focus states. javascript examples care should be taken when using a transition immediately after:
adding the element to the dom using .appendchild() removing an element's display: none; property. this is treated as if the initial state had never occurred and the element was always in its final state. the easy way to overcome this limitation is to apply a window.settimeout() of a handful of milliseconds before changing the css property you intend to transition to. using transitions to make ja...
... to make javascript functionality smooth transitions are a great tool to make things look much smoother without having to do anything to your javascript functionality. take the following example. ...
...v id="foo"></div> using javascript you can make the effect of moving the ball to a certain position happen: var f = document.getelementbyid('foo'); document.
addeventlistener('click', function(ev){ f.style.transform = 'translatey('+(ev.clienty-25)+'px)'; f.style.transform += 'translatex('+(ev.clientx-25)+'px)'; },false); with css you can make it smooth without any extra effort. ...
...And 5 more matches
box-sizing - CSS: Cascading Style Sheets
calculated. 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. by default in the css box model, the width and height you assign to an element is applied only to the element's content box. ...
...ource 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. by default in the css box model, the width and height you assign to an element is applied only to the element's content box. ...
...ll request. by default in the css box model, the width and height you assign to an element is applied only to the element's content box. if the element has any border or p
adding, this is then
added to the width and height to arrive at the size of the box that's rendered on the screen. this means that when you set width and height, you have to adjust the value you give to allow for any border or p
adding that may be
added. for example, if you have four boxes with width: 25%;, if any has left or right p
adding or a left or right border, they will not by default fit on one line within the constraints of the parent container. the box-sizing property can be used to adjust this behavior: content-box gives you the default css box-sizing behavior. if you set an element's width to 100 pixels, then ...
...And 5 more matches
env() - CSS: Cascading Style Sheets
to the var() function and custom properties. the difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
... defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. to tell the browser to use the whole available space on the screen, and so enabling us to use the env() variables, we need to
add a new viewport meta value: <meta name="viewport" content="viewport-fit=cover" /> body { p
adding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px); } in
addition, unlike custom properties, which cannot be used outside of declarations, the env() function can be used in place of any part of a property value, or any part of a descriptor (e.g. in media query rules). as the spec evolves, it may al...
...-defined property names are case-sensitive. formal syntax env( <custom-ident> , <declaration-value>? ) examples the below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available. ...
...And 5 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
content within each <a> should indicate the link's destination. 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. attributes this element's attributes include the global attributes. downloadhtml5 prompts the user to save the linked url instead of navigating to it. ...
...e header takes priority. (if content-disposition: inline, firefox prefers the header while chrome prefers download.) href the url that the hyperlink points to. links are not restricted to http-based urls — they can use any url scheme supported by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone numbers with tel: urls email
addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotocolhandler() hreflang hints at the human language of the linked url. no built-in functionality. allowed values are the same as the global lang attribute. ping a space-separated list of urls. when the link is followed, the browser will send post requests with the body ping to the...
... _self: the current browsing context. (default) _blank: usually a new tab, but users can configure browsers to open a new window instead. _parent: the parent browsing context of the current one. if no parent, behaves as _self. _top: the topmost browsing context (the "highest" context that’s an ancestor of the current one). if no ancestors, behaves as _self. note: when using target,
add rel="noreferrer noopener" to avoid exploitation of the window.opener api; note: in newer browser versions (e.g. firefox 79+) setting target="_blank" on <a> elements implicitly provides the same rel behavior as setting rel="noopener". type hints at the linked url’s format with a mime type. no built-in functionality. obsolete attributes charsetobsolete since html5 hinted at the ...
...And 5 more matches
<input type="button"> - HTML: Hypertext Markup Language
. ...
... updatebutton() { if (button.value === 'start machine') { button.value = 'stop machine'; paragraph.textcontent = 'the machine has started!'; } else { button.value = 'start machine'; paragraph.textcontent = 'the machine is stopped.'; } } the script gets a reference to the htmlinputelement object representing the <input> in the dom, saving this refence in the variable button. ...
...ntent = 'the machine has started!'; } else { button.value = 'start machine'; paragraph.textcontent = 'the machine is stopped.'; } } the script gets a reference to the htmlinputelement object representing the <input> in the dom, saving this refence in the variable button.
addeventlistener() is then used to establish a function that will be run when click events occur on the button.
adding keyboard shortcuts to buttons keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. to
add a keyboard shortcut to a button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute. in this example, s is specified as the access key (you'll need ...
...And 5 more matches
<input type="file"> - HTML: Hypertext Markup Language
pi. 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. value a domstring representing the path to the selected file. events change and input supported common attributes required
additional attributes accept, capture, files, multiple idl attributes files and value dom interface htmlinputelement properties properties that apply only to elements of type file methods select() value a file input's value attribute contains a domstring that represents the path to the selected file(s). if the user selected ...
...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 prevent malicious software from guessing the user's file structure. ...
...put'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 prevent malicious software from guessing the user's file structure. ...
...And 5 more matches
<input type="month"> - HTML: Hypertext Markup Language
or example, it will look like bday-month=1978-06. ...
...ike bday-month=1978-06. ...
...month"> does not apply any validation to entered values. the ui implementations generally don't let you enter anything that isn't a date — which is helpful — but you can still submit the form with the month input empty, or enter an invalid date (e.g. the 32nd of april). to help avoid this, you can use min and max to restrict the available dates (see setting maximum and minimum dates), and in
addition use the required attribute to make filling in the date mandatory. as a result, supporting browsers will display an error if you try to submit a date that is outside the set bounds, or an empty date field. let's look at an example; here we've set minimum and maximum dates, and also made the field required: <form> <div> <label for="month">what month would you like to visit us (summer m...
...And 5 more matches
Microformats - HTML: Hypertext Markup Language
rch 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. microformats2 is an update to microformats that provides a simpler way of annotating html structured syntax & vocabularies than previous approaches of using rdfa and microdata which require learning new attributes. microformats are supported by all major search engines. search engines benefit greatl...
...simpler way of annotating html structured syntax & vocabularies than previous 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 read by humans. to create a microformats object, h-* class names are used in the class attribute. to
add a property to an object, the p-*, u-*, dt-*, e-* class names are used on one of the object's descendants. there are open source parsing libraries for most languages for microformats2. how microformats work an author ...
...chine-readable, their format is designed to be easily read by humans. to create a microformats object, h-* class names are used in the class attribute. to
add a property to an object, the p-*, u-*, dt-*, e-* class names are used on one of the object's descendants. there are open source parsing libraries for most languages for microformats2. how microformats work an author of a webpage can
add microformats to their html. for example if they wanted to identify themselves they could use an h-card such as: html example <a class="h-card" href="http://alice.example.com">alice blogger</a> when a parser encounters this data, it will know that this page contains a "card" which describes a person or organization named alice blogger with a url of http://alice.example.com/. the parser makes t...
...And 5 more matches
An overview of HTTP - HTTP
stly irrelevant to the description of http. client: the user-agent the user-agent is any tool that acts on the behalf of the user. this role is primarily performed by the web browser; other possibilities are programs used by engineers and web developers to debug their applications. the browser is always the entity initiating the request. it is never the server (though some mechanisms have been
added over the years to simulate server-initiated messages). to present a web page, the browser sends an original request to fetch the html document that represents the page. it then parses this file, making
additional requests corresponding to execution scripts, layout information (css) to display, and sub-resources contained within the page (usually images and videos). the web browser then mixes t...
...of servers, sharing the load (load balancing) or a complex piece of software interrogating other computers (like cache, a db server, or e-commerce servers), totally or partially generating the document on demand. a server is not necessarily a single machine, but several server software instances can be hosted on the same machine. with http/1.1 and the host header, they may even share the same ip
address. proxies between the web browser and the server, numerous computers and machines relay the http messages. due to the layered structure of the web stack, most of these operate at the transport, network or physical levels, becoming transparent at the http layer and potentially making a significant impact on performance. those operating at the application layers are generally called proxies. t...
...http messages can be read and understood by humans, providing easier testing for developers, and reduced complexity for newcomers. http is extensible introduced in http/1.0, http headers make this protocol easy to extend and experiment with. new functionality can even be introduced by a simple agreement between a clie...
...And 5 more matches
Digital audio concepts - Web media technologies
eform as measured for a given slice of the overall waveform of the audio signal. there are several formats used for the individual samples within an audio file. most audio files use 16-bit signed integers for each sample, but others use 32-bit floating-point values or 24-bit or 32-bit integers. some older audio file formats—which you won't find in use on the web—used 8-bit integer samples. in
addition, samples may use signed or unsigned values, as well. the size of an individual sample is called the sample size. the position of each audio source within the audio signal is called a channel. each channel contains a sample indicating the amplitude of the audio being produced by that source at a given moment in time. for instance, in stereo sound, there are two audio sources: one speaker on ...
...khz is considered the minimum "high fidelity" sampling rate. the nyquist-shannon sampling theorem dictates that to reproduce a sound accurately, it must be sampled at twice the rate of the sound's frequency. since the range of human hearing is from around 20 hz to 20,000 hz, reproducing the highest-pitched sounds people can generally hear requires a sample rate of more than 40,000 hz. to provide
additional room for a low-pass filter in order to avoid distortion caused by aliasing, an
additional 2.05 khz transition band is
added to the pre-sampling frequency (resulting in 22,050 hz). doubling that per the nyquist theorem results in a final minimum frequency of (you guessed it) 44.1 khz. high-resolution (96 khz) audio is used in some high-end audio systems, and it and ultra-high resolution (1...
...er 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 previously 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 streams and teleconferencing psychoacoustic...
...And 5 more matches
port - Archive of obsolete content
for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. ...
... for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. ...
... for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. ...
...And 4 more matches
indexed-db - Archive of obsolete content
experimental exposes the indexeddb api to
add-ons. usage scripts running in web pages can access indexeddb via the window object. for example: window.indexeddb = window.indexeddb || window.webkitindexeddb || window.mozindexeddb || window.msindexeddb; var request = window.indexeddb.open("mydatabase"); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; because your main
add-on code can't access the dom, you can't do this. so you can use the indexed-db module to access the same api: var { indexeddb } = require('sdk/indexed-db'); var request = indexeddb.open('mydatabase'); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; mo...
...ects that implement the indexeddb api, such as idbtransaction, idbopendbrequest, and idbobjectstore, are accessible through the indexeddb object itself. the api exposed by indexed-db is almost identical to the dom indexeddb api, so we haven't repeated its documentation here, but refer you to the indexeddb api documentation for all the details. ...
...ere, but refer you to the indexeddb api documentation for all the details. the database created will be unique and private per
add-on, and is not linked to any website database. the module cannot be used to interact with a given website database. see bug 778197 and bug 786688. example this example uses the action button api, which is only available from firefox 29 onwards. here's a complete
add-on that
adds two buttons to the browser: the button labeled "
add"
adds the title of the current tab to a database, while the button labeled "list" lists all the titles in the database. the
add-on implements helper functions open(),
additem() and getitems() to open the database,
add a new item to the database, and get all items in the database. var { indexeddb, idbkeyrange } = require('sdk/index...
...And 4 more matches
url - Archive of obsolete content
the url. url methods tostring() returns a string representation of the url. returns string : the url as a string. tojson() returns a string representation of the url. returns string : the url as a string. properties scheme the name of the protocol in the url, without the trailing ':'. compare with protocol. ...
...without the trailing ':'. compare with protocol. for example: var url = require("sdk/url").url("https://developer.mozilla.org/
add-ons?example=true&visible=yes#top"); console.log(url.scheme); // https userpass the username:password part of the url, null if not present. host the host of the url, null if not present. for example: var url = require("sdk/url").url("https://developer.mozilla.org/
add-ons?example=true&visible=yes#top"); console.log(url.host); // developer.mozilla.org port the port number of the url, null if none was specified. path the path component of the url. contains everything after the host of the url. compare with pathname. ...
...r url = require("sdk/url").url("https://developer.mozilla.org/
add-ons?example=true&visible=yes#top"); console.log(url.host); // developer.mozilla.org port the port number of the url, null if none was specified. path the path component of the url. contains everything after the host of the url. compare with pathname. for example: var url = require("sdk/url").url("https://developer.mozilla.org/
add-ons?example=true&visible=yes#top"); console.log(url.path); // /
add-ons?example=true&visible=yes#top hostname the domain of the url, as a string. mirrors window.location.hostname. ...
...And 4 more matches
High-Level APIs - Archive of obsolete content
modules listed on this page implement high-level apis for building
add-ons: creating user interfaces, interacting with the web, and interacting with the browser. unless the documentation explicitly says otherwise, all these modules are "stable": we'll avoid making incompatible changes to them.
addon-page create a page that does not contain navigational elements. base64 data encoding and decoding using base64 algorithms. clipboard interact with the system clipboard, setting and getting its contents. context-menu
adds items, submenus, and menu separators to the page's context menu. hotkeys assign hotkey combinations to functions in your
add-on. indexed-db exposes the indexeddb api to
add-ons. l10n localize strings appearing in the
add-on's javascript code. notifications di...
... request make simple network requests. ...
...
add-on's javascript code. notifications display transient, toaster-style desktop messages to the user. page-mod run scripts in the context of web pages whose url matches a given pattern. page-worker create a permanent, invisible page and access its dom. panel creates transient dialogs to implement part of an
add-on's user interface. passwords interact with firefox's password manager to
add, retrieve and remove stored credentials. private-browsing check whether a given object is private, so an
add-on can respect private browsing querystring utility functions for working with query strings. request make simple network requests. selection get and set text and html selections in the current web page. ...
...And 4 more matches
Modifying the Page Hosted by a Tab - Archive of obsolete content
s to interact with web content. here's a simple example: var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscript: 'document.body.style.border = "5px solid red";' }); } }); to run this example, save an icon file named "icon-16.png" in
add-on's "data" directory. you could download this icon: . this
add-on creates a button with mozilla favicon as an icon. it has a click handler which fetches the active tab and loads a script into the page hosted by the active tab. the script is specified using the contentscript option, and just draws a red border around the page. then open any web page in the browser window, and click the button .
...sing the contentscript option, and just draws a red border around the page. 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. ...
...ple 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. ...
...And 4 more matches
Appendix F: Monitoring DOM changes - Archive of obsolete content
for this reason, it is best to avoid using mutation listeners at all costs, especially from extensions. this document lays out some alternatives which do not have such severe performance impacts. ...
... mutation observers mutation observers are the more efficient, w3c speced replacement for the highly inefficient mutation events. their major advantage is in their performance and their ease of use, especially when combined with simple libraries. their main disadvantage is that, due to their recent advent, support is currently limited to firefox 14+ and chrome 18. while they are still viable for
add-ons targeting only the latest firefox, those wishing to support older browsers will need to provide fallbacks. for more information, see this blog post on the issues at hand. non-mutation triggers it is usually possible to tell when a mutation has occurred or is about to occur without resorting to mutation events or observers. most of these methods are specific to a particular site or codebase...
... alone. in particular, the ::before and ::after pseudo-elements, and pseudo-classes like :hover and :active can be used to achieve extremely complex dynamic behavior. late binding and event delegation often times, it suffices to bind event listeners to top-level elements and check for matching elements when the event fires. for instance, rather than watching for the creation of <a> elements and
adding event listeners to them as they are created, an event listener can be
added to the root <html> element, and when the event fires, the event.target and its parents can be searched for a matching element. you can read more about event delegation here. it is important to note, however, that this method can have severe performance implications for certain events, namely mouseover, mouseout, and ...
...And 4 more matches
Observer Notifications - Archive of obsolete content
the notification. this example code shows you what an implementation of the nsiobserver interface looks like: let testobserver = { observe : function(asubject, atopic, adata) { if (atopic == "xulschoolhello-test-topic") { window.alert("data received: " + adata); } } } in order for this observer to work, you need to use the observer service that provides methods for you to
add, remove, notify and enumerate observers.
adding an observer to the observer service is simple, invoking the
addobserver method with three parameters. the first parameter is an observer object, the second parameter is a notification topic, and the third parameter is a boolean which indicates whether the observer service should hold a weak reference to the observer. you should normally set the thi...
...observer object, the second parameter is a notification topic, and the third parameter is a boolean which indicates whether the observer service should hold a weak reference to the observer. you should normally set the third parameter to false. let observerservice = components.classes["@mozilla.org/observer-service;1"]. getservice(components.interfaces.nsiobserverservice); observerservice.
addobserver(testobserver, "xulschoolhello-test-topic", false); you should come up with a notification topic that is unique so you know it will not conflict with firefox or other extensions topics. to remove an observer for a specific topic, you use the removeobserver method. the method takes the observer object and notification topic as parameters. observerservice.removeobserver(testobserv...
...tobserver, "xulschoolhello-test-topic"); after you have registered some observers to listen to a notification topic, you can then use the notifyobservers method to send a notification to all of them. the method takes three parameters. the first parameter can be any xpcom object to pass to those observers (can be null), 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 previous sections, you can use javascript code module and xpcom objects very easil...
...And 4 more matches
Extensions support in SeaMonkey 2 - Archive of obsolete content
starting with seamonkey 2 alpha 1 seamonkey supports toolkit/-style extensions. these type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. the basics to support seamonkey 2 as a target application, you need to
add it to the list of target applications in the extension's install.rdf file. the code for that will look something like this: <em:targetapplication> <!-- seamonkey --> <description> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>2.0</em:minversion> <em:maxversion>2.*</em:maxversion> </description> </em:targetapplication> the install.js is not supported any more and should be removed. differences as compared to other toolkit/-based applications you need to overlay/open ...
...there a...
...although this doesn't affect the appearance of the display, it may affect your extension if it overlays chrome relative to these elements. for example, if you overlay some chrome before th...
...And 4 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
a touch more complicated than this, but we don't need anything more for our purposes. one image, one cell-- that's all it takes. there's nothing apparently wrong with that example. there isn't supposed to be, since it's an example of how browsers have traditionally behaved. now let's see what that same simple table looks like in a modern browser when the page has a strict doctype. notice the
added space beneath the image in figure 2. the markup of both table and cell remains unchanged-- it's the rendering mode that's different. instead of "shrinkwrapping" the image itself, the browser is now wrapping around the line in which the image sits. the image is sitting in a line because images are, by default, inline content. that's all it takes. how inline content is constructed in order to u...
...ich 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 wherever 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-align-- we'll talk about that in a bit-- but almost nobody ever changes the value from its default. let's take away the text, and leave only the image, as was done in figure 5. so we have an image sitting on the baseline of a li...
...g 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 "standards" rendering mode, so we're going to go through two basic ways to
address the problem in strict documents, and a number of ways to call on these "fixes." setting images to be blocks the first choice, and one that will work for most graphically-intense designs, is to convert the image from being an inline element to a block-level element. do that, and it no longer generates a line box, and so the problem goes away-- assuming that the image is the only thing that o...
...And 4 more matches
Bookmark Keywords - Archive of obsolete content
practically every web surfer has bookmarks, of course, and power surfers usually have hundreds stuffed into folders within folders. in
addition to being handy pointers to useful resources, bookmarks in mozilla can be used to make the
address bar itself a power tool. searches, lookups, package tracking, and even word definitions can all be retrieved from user-customized bookmarks. the key to this ability, if you'll pardon the pun, is the ability to
add a keyword to any mozilla bookmark. under ordinary circumstances, this might be used to reduce typing of a common url: http://www.cnn.com/ could be given the keyword cnn. once that's done, all it takes to go to the cnn home page would be to type <tt>cnn</tt> into the
address bar. mozilla will automatically expand the keyword to the corres...
...n url: http://www.cnn.com/ could be given the keyword cnn. once that's done, all it takes to go to the cnn home page would be to type <tt>cnn</tt> into the
address bar. mozilla will automatically expand the keyword to the corresponding bookmarked url, and load up the site. that's pretty interesting on its own, but mozilla takes it a step further by allowing the user to define an "entry point" for
added information. for example, a keyworded bookmark could be set up so that a user could type <tt>google spam and eggs</tt> and thereby trigger a google search for the words "spam and eggs." because these tools require bookmarks with specific keywords in order to work, they will be referred to hereafter as keymarks, as distinct from regular bookmarks. laying the groundwork we're going to pick a r...
...we're going to pick a relatively easy example to illustrate this process: a keymark that will let the user jump straight to a specific bugzilla entry by entering its number. the quickest way to start is to simply look up any random bug in the bugzilla system-- the actual number doesn't matter. see figure 1 for an example. to file this bookmark open the "bookmarks" menu in the browser and select "
add bookmark," or by of use the keyboard equivalent (e.g., <tt>cmd-d</tt> on macintosh). this will
add a bookmark of the current page to the list of bookmarks. you can also file the bookmark into a folder by using the "file bookmark..." menu option. to open the bookmark manager go to "bookmarks" menu and select the "manage bookmarks" option. this will open up the bookmark manager. in figure 2, we can...
...And 4 more matches
Making it into a static overlay - Archive of obsolete content
now that we have a working mozilla extension that shows tinderbox status, we need to make it distributable to other users. the two ways of doing that are to integrate it into the mozilla codebase (in which case it is no longer an extension but rather part of the default mozilla distribution) and to package it into an installer that users can run from within mozilla to
add the extension to their mozilla installation. most extensions are distributed as installer packages, and that's how we'll distribute our extension. integrating extensions into the mozilla codebase is beyond the scope of this tutorial, but for more information see mozilla.org's hacking documentation. mozilla installer packages are called xpis (pronounced "zippies"), which stands for cross-platform installer. the packag...
...installer. the packages are just standard zip archives of the files to be installed along with a javascript script that performs the installation and some rdf files that describe the components being installed for the chrome registry. ...
...istry. because our extension modifies an existing file in the mozilla distribution, before we package it up we need to separate the modifications into a different file and
add them back in at run time via a dynamic xul overlay. a xul overlay is a xul file containing elements to be inserted into another xul file when the other xul file is rendered into an application interface. static overlays are
added to a xul file via a reference at the top of the file (much like stylesheets and javascript scripts). dynamic overlays are
added to a xul file via a reference in the chrome registry. overlays provide a way to break up a large xul file into several different files (one that describes the overall structure of an application window and the others to implement specific portions of the window) to imp...
...And 4 more matches
Using microformats - Archive of obsolete content
order to make it possible to present summaries of the information on a page without having to know how to parse the document itself. firefox 3 implements a global microformats object that provides access to microformats. this object and its api make finding and reading microformats easy to do. loading the microformats api the microformats object is created using the new javascript script loader
added to firefox 3. to use the api, you need to first load the object: components.utils.import("resource://gre/modules/microformats.js"); once you've loaded the microformats api, you can manage microformats using the methods listed here; for information about parsing microformats, see parsing microformats in javascript. predefined microformats firefox 3 provides definitions implementing several ...
...o first load the object: components.utils.import("resource://gre/modules/microformats.js"); once you've loaded the microformats api, you can manage microformats using the methods listed here; for information about parsing microformats, see parsing microformats in javascript. predefined microformats firefox 3 provides definitions implementing several common microformats: adr represents an
address (such as a street or mailing
address). geo represents a geographical location using latitude and longitude. hcard represents contact information for a person. hcalendar represents a calendar appointment entry. tag used to
add tags to other microformats. methods
add()
adds a new microformat to the microformat module. note: if a microformat by the specified name already exists, it ...
... definition a javascript structure describing the microformat. see describing microformats in javascript for details. count() counts the number of microformats in a document that match specified criteria. ...
...And 4 more matches
JavaScript Client API - Archive of obsolete content
the best, and most up-to-date, reference to sync's internal apis is the source code. ...
...r removed, and it is your store object's responsibility to apply this change to the local application using whatever methods are neccessary. create(record) not to be confused with createrecord(), this method (which should probably be renamed for clarity soon) tells your store to create a new item in the local application, based on the data in record. (so for example, bookmarkstore.create()
adds a new bookmark to the firefox profile). update(record) the argument is a record which has been remotely modified; your store should locate the matching local item (presumably using the guid, which is available in record.id) and update it to the new values provided in record. remove(record) the argument is a record which has been remotely deleted; your store should locate the matc...
...ng it to 100 means "sync me immediately". it's up to you to figure out the best way to assign a score based on the current state of whatever data type you're tracking. your tracker score is automatically reset to zero after each time your engine syncs. the changed guid list the base class maintains a list of guids that need syncing. when your tracker detects that an item has changed, you should
add it to this list by calling: this.
addchangedid(guid); these guids correspond to the .id fields of your record objects; see the section on the store class for more about defining and maintaining the mapping between guids and records. example here's the skeleton of a sample tracker class. function footracker(name) { tracker.call(this, name); // register yourself as event listener or observer f...
...And 4 more matches
Mozilla Crypto FAQ - Archive of obsolete content
stribute cryptographic software, particularly for commercial sale or distribution, then you should consult an attorney with expertise in the particular laws and regulations that apply in your jurisdiction. ...
...regulation of encryption technology. cryptographic functionality in mozilla have all the issues with mozilla and crypto now been resolved? almost. ...
...for more information on the rsa patent see the rsa security press release announcing release of the patent into the public domain, and the rsa patent itself. for information on new us encryption export regulations, see the u.s. department of commerce press release announcing the new regulations as well as the updated regulations (pdf) themselves. export of source code for open source software is
addressed in part 740 (pdf), section 740.13(e), "unrestricted encryption source code"; export of binaries is
addressed in 740.17. (you may also be interested in a more in-depth analysis of the new regulations, with an emphasis on how they affect open source software.) for more information on the ssl, s/mime, pki, and other crypto source code being developed as part of the mozilla project, see the p...
...And 4 more matches
New Skin Notes - Archive of obsolete content
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. ...
...izeable in all browsers. yay! --dria wordpress skins need footer information. -- dria when a page is redirected, need to say-so and what it was redirected from, (see document for an example of such.) this is only an issue in mw1.5 so far. devmo skin vs cavendish skin --callek i can probably pull-off this patch if needed (quickly), so dria or others do not have to hunt up "how". --callek
add "what not to do" css class to stylesheet, as discussed on talk:core javascript 1.5 reference. what's the class called? --maian 21:08, 1 sep 2005 (pdt) in the new mw1.5 skin (not the one currently available here) there's class "wrong" and class "wrong-inline". those will be available after we do the wiki upgrades in the near future. --dria headers need a little p
adding. h1 could be smaller. ...
...border around them. --nickolay 04:43, 25 aug 2005 (pdt) the radio buttons on history page are jumping in a weird way because the selected row becomes bold. --nickolay 04:46, 25 aug 2005 (pdt) the sidebar overrides content on diff pages --nickolay turns out this was fixed for 1.5 already. --dria the buttons in the upper-right of the horizontal nav-bar don't really feel like buttons; maybe
add a pseudo-class for onhover that gives them an underline? --beltzner the "+" item under the "views" menu of a discussion page looks really out of place. can we replace it with "
add section" or something? --beltzner i'll look into it, but i think this is one of those "don't hold your breath" things because that's not managed by the skin. i could probably just eliminate it entirely. that'd work,...
...And 4 more matches
Static Analysis for Windows Code under Linux - Archive of obsolete content
h our cross compiler. check the build run: make check_treehydra run static analysis on mozilla windows code static analysis is hooked into mozilla repository from mozilla 2. ...
...: make check_treehydra run static analysis on mozilla windows code static analysis is hooked into mozilla repository from mozilla 2. ...
...tic analysis on mozilla windows code static analysis is hooked into mozilla repository from mozilla 2. ...
...And 4 more matches
Supporting private browsing mode - Archive of obsolete content
/ } in the above example, we only save the user's private information if not in private browsing mode. note: private browsing mode may only be detected by chrome code, such as extensions; web content cannot detect whether or not private browsing is in effect. detecting whether private browsing mode is permanent requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) firefox 4
added support for having private browsing mode permanently enabled. the theme looks different in this scenario. to determine whether or not the browser is permanently in private browsing mode, you can look at the privatebrowsingmode attribute on the document root. its value is "permanent" if private browsing is permanently enabled for the session, "temporary" if private browsing is temporarily enable...
...t until we restore the original value of the private browsing mode setting, things are done privately. this allows us to, for example, work with the places database without affecting its contents. private browsing notifications there are notifications available that allow you to easily watch for changes to the status of the private browsing mode, including detecting when it turns on and off. in
addition, there is a browser:purge-session-history notification that is sent when the browser purges private data that extensions can watch in order to know when it's time to do the same. a private browser listener helper object this helper object registers listeners for private browsing mode changes. this handles interacting with the private browsing service so you don't have to. function privatebr...
...ener() { this.init(); } privatebrowsinglistener.prototype = { _os: null, _inprivatebrowsing: false, // whether we are in private browsing mode _watcher: null, // the watcher object init : function () { this._inited = true; this._os = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); this._os.
addobserver(this, "private-browsing", false); this._os.
addobserver(this, "quit-application", false); try { var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); this._inprivatebrowsing = pbs.privatebrowsingenabled; } catch(ex) { // ignore exceptions in older versions of firef...
...And 4 more matches
Table Layout Strategy - Archive of obsolete content
n is hold in the adjusted width's. due to this there are 10 width informations for every column. ...
...ormations for every column. ...
... min_pro final the width parameter have the following meaning: #define width_not_set -1 #define num_widths 10 #define num_major_widths 3 // min, des, fix #define min_con 0 // minimum width required of the content + p
adding #define des_con 1 // desired width of the content + p
adding #define fix 2 // fixed width either from the content or cell, col, etc. ...
...And 4 more matches
Elements - Archive of obsolete content
tion. please edit only if an actual behavior differs from the described one. please do not edit only on the basis of another xbl specification. <!element bindings ( binding* ) > hierarchy: root element may contain: <binding> the bindings element is the root element of any xbl document. it should usually declare xbl as the default namespace (unless an xbl namespace prefix is used) and it may
additionally declare other namespace prefixes used in your binding. bindings contains zero or more binding elements as children. each binding child element defines a unique binding that can be attached to elements in other documents. an element can have only one binding attached (explicitly or inherited) at one moment. from several bindings only the last in the sequence will be used (like with any ...
...plicit encoding declarations may be present to override the default, for example <?xml version="1.0" encoding="iso-8859-1"?> uri in namespace declarations is an opaque string used to uniquely identify the namespace. it doesn't have to (and often it doesn't) point to some actual schema or a namespace-related resource. namespaces in xml besides the default namespace, you can declare any amount of
additional namespaces to handle your content. the most useful namespaces could be html/xhtml, xul (xml user interface language), svg (scalable vector graphics) and xlink. this way a more-or-less universal namespace declaration in your bindings could be like: <bindings xmlns="http://www.mozilla.org/xbl" xmlns:html = "http://www.w3.org/1999/xhtml" xmlns:xul = "http://www.mozilla.org/keymaster/gate...
... % binding-content "(resources?,content?,implementation?,handlers?)"> <!element binding %binding-content;> <!attlist binding id id #required extends cdata #implied display cdata #implied inheritstyle true #implied > the binding element describes a single xbl binding. a xbl binding can
add anonymous content, fields, properties, methods, and event handlers to html/xml elements. a single xbl binding can be attached to an element by using style sheets or by scripting. (see bug 83830 for <table> specifics). css: div { -moz-binding: url(mybinding.xml#default); } dom: elementreference.style.mozbinding = "url(mybinding.xml#default)"; in both cases above we are using binding with ...
...And 4 more matches
The Joy of XUL - Archive of obsolete content
stead of pages, heading levels, and hypertext links. in fact, many developers invest a significant amount of effort to achieve these results in their dhtml web applications but at the cost of complexity and performance and without any supporting standards. based on existing standards xul is an xml language based on w3c standard xml 1.0. applications written in xul are based on
additional w3c standard technologies featuring html 4.0; cascading style sheets (css) 1 and 2; document object model (dom) levels 1 and 2; javascript 1.5, including ecma-262 edition 3 (ecmascript); xml 1.0. platform portability like html, xul is designed to be platform-neutral, making applications easily portable to all of the operating systems on which mozilla runs. considering the broad...
...ms on which mozilla runs. considering the broad range of platforms that currently support mozilla, this may be one of the most compelling features of xul as a technology for building applications. since xul provides an abstraction of user interface components, it delivers on the promise of write-once, run-anywhere. the user interface for all of mozilla's core applications (browser, messenger,
address book, etc.) is written in xul with one single code base supporting all mozilla platforms. separation of presentation from application logic one of the major downfalls of most web applications is the tight coupling of user interface elements with client application logic. this poses a significant problem in team environments because the skills required to develop these two part...
...mong all of the custom versions. supporting technologies there are number of other technologies introduced by mozilla that complement xul for building cross platform web applications. xbl the extensible bindings language (xbl) is a markup language that defines special new elements, or "bindings" for xul widgets. with xbl, developers can define new content for xul widgets,
add additional event handlers to a xul widget, and
add new interface properties and methods. essentially, xbl empowers developers with the ability to extend xul by customizing existing tags and creating new tags of their own. by using xbl, developers can easily build custom user interface widgets such as progress meters, fancy pop-up menus, and even toolbars and search forms. these custom compone...
...And 4 more matches
Advanced Rules - Archive of obsolete content
the child against the value of the child attribute. in this case, it is just set to the variable 'city'. so the builder will set the 'city' variable to the each child resource in turn. because there are no more conditions, the condition matches for each of those four resources and the builder will generate content for each of the four. of course, the example above doesn't have any content. we'll
add that later. triple element the next element is the triple element. it is used to check for the existence of a given triple (or assertion) in the rdf datasource. a triple is like a property of a resource. for example, a triple exists between a bookmark and its url. this might be expressed as follows: a bookmark to mozilla.org -> url -> www.mozilla.org this means that there is a triple between...
...act, the bookmark's title would be another triple in the datasource using the name predicate. you can replace the subject and object on the triple element with variable references, in which case values will be substituted for the variables. if no value is defined for a variable yet, the template builder will look up the value in the datasource and assign it to the variable. let's say we wanted to
add a weather prediction to the city datasource. the following conditions might be used: <conditions> <content uri="?list"/> <member container="?list" child="?city"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#prediction" object="?pred"/> </conditions> the template builder will iterate over each city as before. when it gets to the triple, ...
...ject with an in-line value. for example: <conditions> <content uri="?city"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#prediction" object="cloudy"/> </conditions> this example is similar but we specify that we want to match on 'cloudy'. the result is that the conditions will only match for cities where the prediction is 'cloudy'. we can
add more triples to require more matches. for example, in the example above, we might want to check for the temperature and the wind speed. to do this just
add another triple which checks for the
additional resource. the condition will match if all of the triples provide values. the example below will check for an extra triple for the name of the city. it will be assigned to the 'name' variable. the ...
...And 4 more matches
Broadcasters and Observers - Archive of obsolete content
this is a useful way to simplify the amount of code you need to write. ...
...ant 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 on popup menus. although we could write a script to do this, it is quite tedious. it also has the disadvantage that we would need to know all of the places where a back action could be. if someone
added a new back button using an extension, it wouldn't be handled. it is convenient to simply disable the back action and have all the elements that issue the back action disable themselves. we can use the attribute forwarding of commands to accomplish this. broadcasters there is a similar element called a broadcaster. broadcasters support attribute forwarding in the same way that commands do. the...
... new label. like other non-displayed elements, the broadcasterset element serves as a placeholder for broadcasters. you should declare all your broadcasters inside a broadcasterset element so that they are all kept together. making elements observers elements that are watching the broadcaster are called observers because they observe the state of the broadcaster. to make an element an observer,
add an observes attribute to it. this is analogous to using the command attribute when attaching an element to a command element. for example, to make a button an observer of the broadcaster above: <button id="offline_button" observes="isoffline"/> the observes attribute has been placed on the button and its value has been set to the value of the id on the broadcaster to observe. here the button w...
...And 4 more matches
Commands - Archive of obsolete content
ation. 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. if you did not use commands, you would need to figure out which field has the focus, then check to ensure that the operation is suitable for that element. in
addition, the menu commands would need to be enabled and disabled depending on whether the focused element had selected text or not, and for paste operations, whether there is something suitable on the clipboard to paste. as you can see, this becomes complicated. by using commands, much of the work is handled for you. you can use a command for any operation. mozilla uses them for almost every menu c...
...menu commands would need to be enabled and disabled depending on whether the focused element had selected text or not, and for paste operations, whether there is something suitable on the clipboard to paste. as you can see, this becomes complicated. by using commands, much of the work is handled for you. you can use a command for any operation. mozilla uses them for almost every menu command. in
addition, text fields and other widgets have a number of commands which they already support that you can invoke. you should use them when the operation depends on which element is focused. a command is identified by its id attribute. mozilla uses the convention that command id's start with 'cmd_'. you will probably want to use the same id if a command is already being used, however, for your own co...
...ughout the ui code. the other advantage is that several buttons or other ui elements can be hooked up to the same command. for instance, you might have a menu item, a toolbar button and a keyboard shortcut all for the same operation. rather than repeat the code three times, you can hook all three up to the same command. normally, you would only hook up elements that would send a command event.
additionally, if you set the disabled attribute on the command, the command will be disabled and it will not be invoked. any buttons and menu items hooked up to it will be disabled automatically. if you re-enable the command, the buttons will become enabled again. example: toggling command disabled example 2 : source view <command id="cmd_openhelp" oncommand="alert('help');"/> <button label=...
...And 4 more matches
Creating a Window - Archive of obsolete content
he 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. in fact, there will not be shown any window at all. if you want to force the window to become visible you can
add the width and height attribute to the window tag. here is a line by line breakdown of the code above: <?xml version="1.0"?> this line simply declares that this is an xml file. you would normally
add this line as is at the top of each xul file. <?xml-styles...
...l"> this line declares the namespace for xul, which you should put on the window element to indicate that all of its children are xul. note that this url is never actually downloaded. mozilla will recognize this url internally. <!-- other elements go here --> replace this comment block with other elements (the buttons, menus and other user interface components) to appear in the window. we'll
add some of these in the next set of sections. </window> and finally, we need to close the window tag at the end of the file. opening a window in order to open a xul window, there are several methods that can be used. if you are only in the development stage, you can just type the url (whether a chrome:, file: or other url type) into the location bar in a mozilla browser window. you should also...
...cument can be opened in the browser as mentioned above only if |dom.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| . if it does not exist, then it needs to be created and set to |true|. the correct way, of course, is to open the window using javascript. no new syntax is necessary as you can use the window.open() function as one can do for html documents. however, one
additional flag, called 'chrome' is necessary to indicate to the browser that this is a chrome document to open. this will open the window without the toolbars and menus and so forth that a normal browser window has. the syntax is described below: window.open(url,windowname,flags); where the flags contains the flag "chrome" as in this example window.open("chrome://navigator/content/navigator.xul",...
...And 4 more matches
Styling a Tree - Archive of obsolete content
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 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. ...
... setting the type attribute on the column to progressmeter. ::-moz-tree-drop-feedback: the drag and drop feedback. ::-moz-tree-checkbox: the image to use for checkbox columns. you can check for multiple properties by separating them with commas. the example below sets the background color to grey for rows that have the 'readonly' and 'unread' properties. for properties that are 'readonly', it
adds a red border around the row. note that the first rule will apply to any row that is 'readonly' regardless of whether other properties such as 'unread' are set. treechildren::-moz-tree-row(readonly) { border: 1px solid red; } treechildren::-moz-tree-row(readonly, unread) { background-color: rgb(80%, 80%, 80%); } default properties the properties list for tree elements contain a small numb...
...And 4 more matches
XPCOM Interfaces - Archive of obsolete content
rformed on files. a file would need properties for its name, modification date and its size. functions of a file would include moving, copying and deleting it. the file interface only describes the characteristics of a file, it does not implement it. the implementation of the file interface is left to a component. the component will have code which can retrieve the file's name, date and size. in
addition, it will have code which copies and renames it. we don't care how the component implements it, as long as it implements the interface correctly. of course, we'll have different implementations anyway, one for each platform. the windows and macintosh versions of a file component would be significantly different. however, they would both implement the same interface. thus, we can use a compon...
...yway, one for each platform. the windows and macintosh versions of a file component would be significantly different. however, they would both implement the same interface. thus, we can use a component by accessing it using the functions we know from the interface. in mozilla, interfaces are usually preceded by 'nsi' or 'mozi' so that they are easily recognized as interfaces. for example, the nsi
addressbook is the interface for interacting with an
address book, nsisound is used for playing files and nsilocalfile is used for files. for more interfaces in mozilla, see interfaces. xpcom components are typically implemented natively, which means that they generally do things that javascript cannot do itself. however, there is a way in which you can call them, which we will see shortly. we can c...
...eated with the createinstance() function. you should check the return value of createinstance() to ensure that it is not null, which would indicate that the component does not exist. however, at this point, we only have a reference to the file component itself. in order to call the functions of it we need to get one of its interfaces, in this case nsilocalfile. a second line of code needs to be
added as follows: var afile = components.classes["@mozilla.org/file/local;1"].createinstance(); if (afile) afile.queryinterface(components.interfaces.nsilocalfile); the function queryinterface() is a function provided by all components which can be used to get a specific interface of that component. this function takes one parameter, the interface that you want to get. the interfaces property of t...
...And 4 more matches
XUL Tutorial - Archive of obsolete content
this tutorial describes xul, the xml user-interface language. this language was created for the mozilla application and is used to describe its user interface. ...
... this tutorial describes xul, the xml user-interface language. this language was created for the mozilla application and is used to describe its user interface. ...
... this tutorial describes xul, the xml user-interface language. this language was created for the mozilla application and is used to describe its user interface. ...
...And 4 more matches
listbox - Archive of obsolete content
l reference home [ examples | attributes | properties | methods | related ] this element is used to create a list of items where one or more of the items may be selected. a listbox may contain multiple columns. there are numerous methods which allow the items in the listbox to be retrieved and modified. you may specify the number of rows to display in the list using the rows attribute.
additional rows can be viewed using a scroll bar. a listbox is expected to contain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. attributes disabled, dis...
...chlistbox element. see list controls for more information. ...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. disablekeynavigation type: boolean if this attribute is not used, the user can navigate to specific items within the element by pressing keys corresponding to letters in the item's label. this is done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. preference type: id connects th...
...And 4 more matches
Introduction to SSL - Archive of obsolete content
email servers. the ssl protocol runs above tcp/ip and below higher-level protocols such as http or imap. it uses tcp/ip on behalf of the higher-level protocols, and in the process allows an ssl-enabled server to authenticate itself to an ssl-enabled client, allows the client to authenticate itself to the server, and allows both machines to establish an encrypted connection. these capabilities
address fundamental concerns about communication over the internet and other tcp/ip networks: ssl server authentication allows a user to confirm a server's identity. ssl-enabled client software can use standard techniques of public-key cryptography to check that a server's certificate and public id are valid and have been issued by a certificate authority (ca) listed in the client's list of truste...
...k sending confidential financial information to a customer and wants to check the recipient's identity. an encrypted ssl connection requires all information sent between a client and a server to be encrypted by the sending software and decrypted by the receiving software, thus providing a high degree of confidentiality. confidentiality is important for both parties to any private transaction. in
addition, all data sent over an encrypted ssl connection is protected with a mechanism for detecting tampering-that is, for automatically determining whether the data has been altered in transit. the ssl protocol includes two sub-protocols: the ssl record protocol and the ssl handshake protocol. the ssl record protocol defines the format used to transmit data. the ssl handshake protocol involves us...
...ts of cipher suites. administrators can enable or disable any of the supported cipher suites for both clients and servers. when a particular client and server exchange information during the ssl handshake, they identify the strongest enabled cipher suites they have in common and use those for the ssl session. note: firefox 2 ships 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 prevent ssl connections with weaker encryption. however, due to u.s. go...
...And 4 more matches
Sunbird Theme Tutorial - Archive of obsolete content
directory, go to the <tt>extensions</tt> directory. note: if the <tt>extensions</tt> directory is empty, you are in the wrong place—start again and follow the instructions more carefully. creating a unique identifier create an identifier that is likely to be unique, in the form: <tt>something@domain-name</tt> it must contain an at-sign (<tt>@</tt>), making it look something like an e-mail
address, but it does not need to be a real e-mail
address. before and after the at-sign, it can only contain the characters a-z, a-z, 0-9, full stop, hyphen and underscore. if you do not own a domain name, you can make up something else. if you want to make it clear that your made-up name is not a real domain,
add <tt>.invalid</tt> to the end. create a new directory in the <tt>extensions</tt> directo...
...t> directory, together with all its contents, into your new <tt>chrome</tt> directory. now you have a theme, although it looks exactly the same as sunbird's classic theme. modifying your theme to modify your theme, change the css and image files in any way you like. for testing purposes, go to the <tt>calendar</tt> directory that you have just pasted. edit the file <tt>calendar.css</tt> there.
add this line at the end: label {color: red;} save the file. fixing bug 320823 if you are using the sunbird 0.3a1 release, or a test build before 2005-12-21, then you must apply a fix for bug 320823 to allow sunbird to use themes. go to sunbird's program directory, then to the <tt>defaults</tt> directory there. in the <tt>pref</tt> directory, edit the file <tt>sunbird.js</tt> and search for the ...
...r: red;} save the file. fixing bug 320823 if you are using the sunbird 0.3a1 release, or a test build before 2005-12-21, then you must apply a fix for bug 320823 to allow sunbird to use themes. go to sunbird's program directory, then to the <tt>defaults</tt> directory there. in the <tt>pref</tt> directory, edit the file <tt>sunbird.js</tt> and search for the <tt>pref("extensions</tt> entries.
add the line: pref("extensions.dss.enabled", false); save the file. using your theme to use your theme, restart sunbird. from the menu bar, choose tools – themes... in the themes window, check that your new theme has appeared. select it and press the use theme button. restart sunbird again. if your theme is working, you see the effect of the changes that you made. developing your theme to d...
...And 4 more matches
Reference - Archive of obsolete content
entally. i also just read a document on proper inheritance using apply(). well if you combine the two, you can have inherited private variables: function myclass(){ var property = 5; this.tellme = function(){ return property; } } function myotherclass(){ myclass.apply( this ); } var o = new myotherclass; alert( o.tellme() ); //alerts 5 as you'd expect — the preceding comment was
added by psygnisfive (talk – contribs) on 22:23, 4 december 2006 terminology we need a terminology appendix. for example, "script" and "program" are synonymous. so are "current object" and "context object". we could also put in layman definitions there for js constructs like functions and variables. --maian 01:43, 30 september 2005 (pdt) we should define the terms we are using. in particular thi...
...tes#template:deprecated_header --nickolay 00:58, 26 aug 2005 (pdt) hmm, that was a bad question. what i meant to ask is: what markup should i use for bad examples (which aren't necessarily deprecated), i.e. examples that show what not to do? --maian 02:07, 26 aug 2005 (pdt) oh, i don't think so, but you can ask dria to create a css class for that. --nickolay 11:50, 26 aug 2005 (pdt) i'll
add it to my todo list for the new skins. i have to go through them again this weekend to fix up some stuff anyhow. good idea, maian. thanks :) -- dria 21:06, 26 aug 2005 (pdt) coding style should semicolons be
added to all the examples? --maian 21:06, 25 aug 2005 (pdt) the original authors didn't use semicolons, but i'd
add them. --nickolay 00:58, 26 aug 2005 (pdt) (more coding style questi...
...is not a part of the javascript engine, but a dom feature (probably non-standard). --nickolay 08:31, 22 september 2005 (pdt) what's funny is that this talk page shows up first in a google search for "btoa javascript". this is number 2. it's not in the ecma docs. if it's not in a standard, and that sun doc is corrent, then it should probably go in the window object methods. --jonnyq i've already
added those methods in the methods listing, but i haven't defined them yet. --maian 02:39, 21 october 2005 (pdt) delete? i don't see any mention in the operators section for the delete operator. did this operator get removed/deprecated, or is it missing from the documentation? brundlefly 13:15, 19 december 2005 (pst) neither: core javascript 1.5 reference:operators:special operators:delete o...
...And 4 more matches
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
n mozilla based browsers. in order to make it still possible to script plugins, some changes have been made to the mozilla code. the changes allow to make existing 4.x plugins scriptable with only minor modifications in their code. the present document describes the steps of what should be done to the plugin code to turn it scriptable again. ...
... describes the steps of what should be done to the plugin code to turn it scriptable again. what's in the mozilla code? a couple of lines have been
added to the dom code asking a plugin to return a scriptable iid and a pointer to a scriptable instance object. the old plugin api call npp_getvalue is used to retrieve this information from the plugin. so the plugin project should be aware of two new
additions to nppvariable enumeration type which are now defined in npapi.h as: nppvpluginscriptableinstance = 10, nppvpluginscriptableiid = 11 and two analogous
additions to nsplugininstancevariable type in nsplugindefs.h as: nsplugininstancevariable_scriptableinstance = 10, nsplugininstancevariable_scriptableiid = 11 what's in the plugin code? a unique interface id should be obtained. w...
...a scriptable instance object should be implemented in the plugin. this class will contain native methods callable from javascript. this class should also inherit from nsiclassinfo and implement its methods to be able to request all necessary privileges from the mozilla security manager (see example 2). ...
...And 4 more matches
GLSL Shaders - Game development
lsl is strongly typed and there is a lot of math involving vectors and matrices. it can get very complicated — very quickly. in this article we will make a simple code example that renders a cube. to speed up the background code we will be using the three.js api. as you may remember from the basic theory article, a vertex is a point in a 3d coordinate system. vertices may, and usually do, have
additional properties. the 3d coordinate system defines space and the vertices help define shapes in that space. shader types a shader is essentially a function required to draw something on the screen. shaders run on a gpu (graphics processing unit), which is optimized for such operations. using a gpu to deal with shaders offloads some of the number crunching from the cpu. this allows the cpu to f...
... are using a modern browser with good webgl support, such as the latest firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. html structure here's the html structure we will use. ...
... basic material we will set the cube's color and position using shaders. go to the cube.html file on github, copy all the javascript code from inside the second <script> element, and paste it into the third <script> element of the current example. save and load index.html in your browser — you should see a blue cube. the vertex shader code let's continue by writing a simple vertex shader —
add the code below inside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projection matrices by each vector to get the final vertex position, in each case. note: you can learn more about model, view, and projecti...
...And 4 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. ...
...caniuse.com. the list of supported devices is also quite extensive — most popular gamepads (e.g. xbox 360 or ps3) should be suitable for web implementations. pure javascript approach let's think about implementing pure javascript gamepad controls in our little controls demo first to see how it would work. ...
... for(var b=0; b<controller.buttons.length; b++) { if(controller.buttons[b].pressed) { buttonspressed.push(b); } } } } we first reset the buttonspressed array to get it ready to store the latest info we'll write to it from the current frame. then, if the buttons are available we loop through them; if the pressed property is set to true, then we
add them to the buttonspressed array for later processing. next, we'll consider the gamepadbuttonpressedhandler() function: function gamepadbuttonpressedhandler(button) { var press = false; for(var i=0; i<buttonspressed.length; i++) { if(buttonspressed[i] == button) { press = true; } } return press; } the function takes a button as a parameter; in the loo...
...And 4 more matches
Collision detection - Game development
« previousnext » this is the 7th step out of 10 of the gamedev canvas tutorial. 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. this won't give a pe...
...of the ball is less than the y position of the brick plus its height. ...
... dy = -dy; } } } }
add the above block to your code, below the keyuphandler() function. making the bricks disappear after they are hit the above code will work as desired and the ball changes its direction. the problem is that the bricks are staying where they are. we have to figure out a way to get rid of the ones we've already hit with the ball. we can do that by
adding an extra parameter to indicate whether we want to paint each brick on the screen or not. in the part of the code where we initialize the bricks, let's
add a status property to each brick object. update the following part of the code as indicated by the highlighted line: var bricks = []; for(var c=0; c<brickcolumncount; c++) { bricks[c] = []; for(var r=0; r<brickrowcount; r++) { ...
...And 4 more matches
Move the ball - Game development
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. you can run a function over and over again using a javascript timing function such as setinterval() or requestanimationframe(). ...
... making it move you won't notice the ball being repainted constantly at the moment, as it's not moving. ...
...e 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 change that. first, instead of a hardcoded position at (50,50) we will define a starting point at the bottom center part of the canvas in variables called x and y, then use those to define the position the circle is drawn at. ...
...And 4 more matches
Track the score and win - Game development
e 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. ...
...uld 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 after the collisiondetection() function: function drawscore() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("score: "+score, 8, 20); } drawing text on a canvas is similar to drawing a shape. the font definition looks exactly like the one in css — you can set the size and font type in the font() method. then use fillstyle() to set the color of the...
...ont() method. then use fillstyle() to set the color of the font and filltext() to set the actual text that will be placed on the canvas, and where it will be placed. the first parameter is the text itself — the code above shows the current number of points — and the last two parameters are the coordinates where the text will be placed on the canvas. ...
...And 4 more matches
Visual typescript game engine - Game development
client config if you want web app without any networking then setup: appusenetwork: boolean = false; you want to use communication for multiplayer but you don't want to use server database account sessions. the setup this on false in main client config class. appuseaccountssystem: boolean = false; networking is disabled by default. ...
...ig if you want web app without any networking then setup: appusenetwork: boolean = false; you want to use communication for multiplayer but you don't want to use server database account sessions. the setup this on false in main client config class. appuseaccountssystem: boolean = false; networking is disabled by default. ...
...e setup this on false in main client config class. appuseaccountssystem: boolean = false; networking is disabled by default. find configuration at ./src/lib/client-config.ts /** *
addson * all
addson are ansync loaded scripts. * - cache is based on webworkers. * - hackertimer is for better performace also based on webworkers. * - dragging is script for dragging dom elements. ...
...And 4 more matches
Backgrounds and borders - 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 how to style the background and border of boxes. ...
...we'll return to how the shorthand works later in the tutorial, but first let's have a look at the different things you can do with backgrounds in css, by looking at the individual background properties. background colors the background-color property defines the background color on any element in css. the property accepts any valid <color>. a background-color extends underneath the content and p
adding box of the element. in the example below, we have used various color values to
add a background color to the box, a heading, and a <span> element. play around with these, using any available <color> value. background images the background-image property enables the display of an image in the background of an element. in the example below, we have two boxes — one has a background image ...
... has a background image which is larger than the box, the other has a small image of a star. this example demonstrates two things about background images. by default, the large image is not scaled down to fit the box, so we only see a small corner of it, whereas the small image is tiled to fill the box. in this case, the actual image is just a single star. if you specify a background color in
addition to a background image then the image displays on top of the color. try
adding a background-color property to the example above to see that in action. controlling background-repeat the background-repeat property is used to control the tiling behavior of images. the available values are: no-repeat — stop the background from repeating altogether. repeat-x — repeat horizontally. repea...
...And 4 more matches
What is a URL? - Learn web development
nternet works, what a web server is and the concepts behind links on the web. objective: you will learn what a url is and how it works on the web. summary with hypertext and http, url is one of the key concepts of the web. it is the mechanism used by browsers to retrieve any published resource on the web. url stands for uniform resource locator. a url is nothing more than the
address of a given unique resource on the web. in theory, each valid url points to a unique resource. such resources can be an html page, a css document, an image, etc. in practice, there are some exceptions, the most common being a url pointing to a resource that no longer exists or that has moved. as the resource represented by the url and the url itself are handled by the web server, it is up to t...
... it is up to the owner of the web server to carefully manage that resource and its associated url. active learning there is no active learning available yet. deeper dive basics: anatomy of a url here are some examples of urls: https://developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's
address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others optional. let's see the most important parts using the following url: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument http is the protocol. the first part of the url indicates which protocol the browser must use. a protocol ...
...the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. www.example.com is the domain name. it indicates which web server is being requested. alternatively, it is possible to directly use an ip
address, but because it is less convenient, it is not often used on the web. :80 is the port. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. /path/to/myfile.html is the path to the res...
...And 4 more matches
Example 3 - Learn web development
: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; p
adding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);...
... #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; p
adding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em...
...t { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { p
adding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('ac...
...And 4 more matches
From object to iframe — other embedding technologies - Learn web development
; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.queryselector('.output'); let code = textarea.value; let userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.
addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.
addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution...
...\n\n<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d37995.65748333395!2d-2.273568166412784!3d53.473310471916975!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x487bae6c05743d3d%3a0xf82fddd1e49fc0a1!2sthe+lowry!5e0!3m2!1sen!2suk!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.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = t...
...w them from being embedded inside <iframe>s (see configure csp directives, below.) this makes sense — an entire mdn page doesn't really make sense to be embedded in other pages unless you want to do something like embed them on your site and claim them as your own — or attempt to steal data via clickjacking, which are both really bad things to do. plus if everybody started to do this, all the
additional bandwidth would start to cost mozilla a lot of money. only embed when necessary sometimes it makes sense to embed third-party content — like youtube videos and maps — but you can save yourself a lot of headaches if you only embed third-party content when completely necessary. a good rule of thumb for web security is "you can never be too cautious. if you made it, double-check it anyw...
...And 4 more matches
HTML table basics - Learn web development
ng to effectively work across a variety of devices. active learning: creating your first table we've talked table theory enough, so, let's dive into a practical example and build up a simple table. first of all, make a local copy of blank-template.html and minimal-table.css in a new directory on your local machine. the content of every table is enclosed by these two tags : <table></table>.
add these inside the body of your html. the smallest container inside a table is a table cell, which is created by a <td> element ('td' stands for 'table data').
add the following inside your table tags: <td>hi, i'm your first cell.</td> if we want a row of four cells, we need to copy these tags three times. update the contents of your table to look like so: <td>hi, i'm your first cell.</td> ...
...tents of your table to look like so: <td>hi, i'm your first cell.</td> <td>i'm your second cell.</td> <td>i'm your third cell.</td> <td>i'm your fourth cell.</td> as you will see, the cells are not placed underneath each other, rather they are automatically aligned with each other on the same row. each <td> element creates a single cell and together they make up the first row. every cell we
add makes the row grow longer. to stop this row from growing and start placing subsequent cells on a second row, we need to use the <tr> element ('tr' stands for 'table row'). let's investigate this now. place the four cells you've already created inside <tr> tags, like so: <tr> <td>hi, i'm your first cell.</td> <td>i'm your second cell.</td> <td>i'm your third cell.</td> <td>i'm your ...
...he <tr> element ('tr' stands for 'table row'). let's investigate this now. ...
...And 4 more matches
Introduction to web APIs - Learn web development
device apis are basically apis for manipulating and retrieving data from modern device hardware in a way that is useful for web apps. examples include telling the user that a useful update is available on a web app via system notifications (see the notifications api) or vibration hardware (see the vibration api). client-side s...
...e maps api allows you to do all sorts of things with maps on your web pages. the facebook suite of apis enables you to use various parts of the facebook ecosystem to benefit your app, for example by providing app login using facebook login, accepting in-app payments, rolling out targetted ad campaigns, etc. the telegram apis allows you to embed content from telegram channels on your website, in
addition to providing support for bots. the youtube api, which allows you to embed youtube videos on your site, search youtube, build playlists, and more. the pinterest api provides tools to manage pinterest boards and pins to include them in your website. the twilio api, which provides a framework for building voice and video call functionality into your app, sending sms/mms from your apps, and m...
...st playbtn = document.queryselector('button'); const volumeslider = document.queryselector('.volume'); const audiosource = audioctx.createmediaelementsource(audioelement); next up we include a couple of event handlers that serve to toggle between play and pause when the button is pressed and reset the display back to the beginning when the song has finished playing: // play/pause audio playbtn.
addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } // if track is stopped, play it if (this.getattribute('class') === 'paused') { audioelement.play(); this.setattribute('class', 'playing'); this.textcontent = 'pause' // if track is playing, ...
...And 4 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
ember generate component-class footer next, go and find the newly-created todomvc/app/components/footer.js file and update it to the following: import component from '@glimmer/component'; import { inject as service } from '@ember/service'; export default class footercomponent extends component { @service('todo-data') todos; } now we need to go back to our todo-data.js file and
add some functionality that will allow us to return the number of incomplete todos (useful for showing how many are left), and clear the completed todos out of the list (which is what the “clear completed” functionality needs). in todo-data.js,
add the following getter underneath the existing all() getter to define what the incomplete todos actually are: get incomplete() { return this.tod...
......
... however, if you try to click the "clear completed" button now, it won't appear to do anything, because there is currently no way to "complete" a todo. we need to wire up the todo.hbs template to the service, so that checking the relevant checkbox changes the state of each todo. we'll do that next. the todo/todos plural problem the above is fine, but we have another small issu...
...And 4 more matches
Getting started with Ember - Learn web development
and progressive web apps (pwas) ember works best when it is the entire front end of your application. increasing cohesion among many team's technology stacks community-backed "best practices" allow for faster long-term development speed. ember has clear conventions that are useful for enforcing consistency and helping team members get up to speed quickly. ember with
add-ons emberjs has a plugin architecture, which means that
add-ons can be installed and provide
additional functionality without much, if any, configuration. examples include: prember: static website rendering for blogs or marketing content. fastboot: server-side rendering, including improving search-engine optimization (seo), or improving initial render performance of complex, highly interact...
...ng language is used to make build and runtime optimizations that otherwise wouldn't be possible. most importantly, it is a superset of html — meaning that anyone who knows html can make meaningful contributions to any ember project with minimal fear of breaking code. designers and other non-developers can contribute to page templates without any knowledge of javascript, and interactivity can be
added later. this language also enables lighter asset payloads due to compiling the templates into a "byte code" that can be parsed faster than javascript. the glimmer vm enables extremely fast dom change tracking without the need to manage and diff a cached virtual representation (which is a common approach to mitigating the slow i/o of dom changes). for more information on the technical aspects o...
...als of the ember framework along the way. todomvc is a basic to-do tracking app implemented in many different technologies. here is the completed ember version, for reference. a note on todomvc and accessibility the todomvc project has a few issues in terms of adhering to accessible/default web practices. there are a couple of github issues open about this on the todomvc family of projects:
add keyboard access to demos re-enable outline on focusable elements ember has a strong commitment to being accessible by default and there is an entire section of the ember guides on accessibility on what it means for website / app design. that said, because this tutorial is a focus on the javascript side of making a small web application, todomvc's value comes from providing pre-made css and re...
...And 4 more matches
Getting started with React - Learn web development
best for them, and to adopt react in any way they would like to. react can handle a single button, a few pieces of an interface, or an app's entire user interface. while react can be used for small pieces of an interface, it's not as easy to "drop into" an application as a library like jquery, or even a framework like vue — it is more approachable when you build your entire app with react. in
addition, many of the developer-experience benefits of a react app, such as writing interfaces with jsx, require a compilation process.
adding a compiler like babel to a website makes the code on it run slowly, so developers often set up such tooling with a build step. react arguably has a heavy tooling requirement, but it can be learned. this article is going to focus on the use case of using react...
...x, check out the react team's jsx in depth article. setting up your first react app there are many ways to use react, but we're going to use the command-line interface (cli) tool create-react-app, as mentioned earlier, which expedites the process of developing a react application by installing some packages and creating some files for you, handling the tooling described above. it's possible to
add react to a website without create-react-app by copying some <script> elements into an html file, but the create-react-app cli is a common starting point for react applications. using it will allow you spend more time building your app, and less time fussing with setup. requirements in order to use create-react-app, you need to have node.js installed. it's recommended that you use the long-term ...
...rving the application. creates a structure of files and directories that define the basic app architecture. initializes the directory as a git repository, if you have git installed on your computer. note: if you have the yarn package manager installed, create-react-app will default to using it instead of npm. if you have both package managers installed and explicitly want to use npm, you can
add the flag --use-npm when you run create-react-app: npx create-react-app moz-todo-react --use-npm create-react-app will display a number of messages in your terminal while it works; this is normal! this might take a few minutes, so now might be a good time to go make a cup of tea. when the process is complete, cd into the moz-todo-react directory and run the command npm start. the scripts insta...
...And 4 more matches
Deployment and next steps - Learn web development
nd compress our javascript files using terser. so, after running npm run build, our generated bundle.js and bundle.css files will be more like this: 504 jul 13 02:43 bundle.css 21782 jul 13 02:43 bundle.js try running npm run build in your app's root directory now. you might get a warning, but you can ignore this for now. our whole app is now just 21 kb — 8.3 kb when gzipped. there are no
additional runtimes or dependencies to download, parse, execute, and keep running in memory. svelte analyzed our components and compiled the code to vanilla javascript. a look behind the svelte compilation process by default, when you create a new app with npx degit sveltejs/template my-svelte-project, svelte will use rollup as the module bundler. note: there is also an official template for usin...
...elte application is using vercel. vercel is a cloud platform specifically tailored for static sites, which has out-of-the-box support for most common front-end tools, svelte being one of them. to deploy our app, follow these steps. register for an account with vercel. navigate to the root of your app and run npx vercel; the first time you do it, you'll be prompted to enter your email
address, and follow the steps in the email sent to that
address, for security purposes. run npx vercel again, and you'll be prompted to answer a few questions, like this: > npx vercel vercel cli 19.1.2 ? set up and deploy “./mdn-svelte-tutorial”? [y/n] y ? which scope do you want to deploy to? opensas ? link to existing project? [y/n] n ? what’s your project’s name? mdn-svelte-tutori...
...will deploy our todos app to gitlab pages. first you'll have to register at gitlab and then create a new project. give you new project a short, easy name like "mdn-svelte-todo". you will have a remote url that points to your new gitlab git repository, like git@gitlab.com:[your-user]/[your-project].git. before you start to upload content to your git repository, it is a good practice to
add a .gitignore file to tell git which files to exclude from source control. in our case we will tell git to exclude files in the node_modules directory by creating a .gitignore file in the root folder of your local project, with the following content: node_modules/ now let's go back to gitlab. after creating a new repo gitlab will greet you with a message explaining different options to up...
...And 4 more matches
Gecko info for Windows accessibility vendors
iaccessibles. windows applications based on the gecko layout engine gecko is a rendering engine that mozilla, netscape and other new browsers use. gecko can render a variety of content, not just html and supports key web standards such as cascading style sheets, javascript and the w3c dom. gecko also handles the users keystrokes and mouse clicks. gecko is the core architecture that we are
adding accessibility to, in order to support basic accessibility in all applications that are based on it. embedded clients (support msaa) embedded clients use gecko only in the content window, at the moment for html and generic xml only. they typically use standard windows controls for their user interface -- the area outside of the client content window, plus the context menu. m...
...ication, with an exception for plugins which create their own window. when you see the content window receive focus, first check the role. if it is role_pane or role_document then this should be treated as a document for the default modality of the screen reader. if it is a role_application, role_dialog or role_alert then stay in focus tracking mode -- there is no need to parse the document. in
addition, if it is a role_alert, a screen reader should treat it as a message box -- that is, to read the entire contents. these roles can occur on content because of the new accessible dhtml technology which allows the author to specify the type of document or container. once you know that you have a document, go up the ancestor chain of windows until you see a mozillacontentwindowclass or a mozil...
...r changes. this should indicate to a screen reader to read the contents of the alert (it may be a container who's descendents should be read). event_selection is fired on children of single selection containers along with the event_focus as selection/focus move together in that case. event_selectionwithin is fired on multi selection containers when the current selection changes within. in
addition, event_selection
add and event_selectionremove are fired on the the child who's selection changed. how to track where the event happened, within your own offscreen model ordinary zero-indexed child ids are not practical for representing events. the problem is that the child id system that is used by msaa doesn't work well when you have a deep tree of objects in a window. it would ...
...And 4 more matches
Theme concepts
these theme options can be implemented as static themes (although the theme images themselves may be animated) or as dynamic themes created in a browser extension. if you have a lightweight theme it will be converted to this new theme format automatically before lightweight themes are deprecated. you do not need to port your theme. however, please feel free to update your themes to use any of the new features described here. ...
... theme. however, please feel free to update your themes to use any of the new features described here. static themes static themes are specified using the same resources as a browser extension: a manifest.json file to define the theme components with 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 preview customizations to the browser's theme with options to share and export a theme. a theme and browser extension functionality cannot be defined...
...t 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 image theme): create a folder in a suitable location on your computer. ...
...And 4 more matches
Browser chrome tests
just using a bug number. you can collect common utils and helpers in a file called head.js, that must live in the same folder as the browser-chrome tests. this file will be injected into the test scope for each test living in the same folder. notice that any function call in head.js main scope will run before the main test() method. asynchronous tests when writing async tests, you can use the
add_task method with promises. the test suite also supports asynchronous tests, using the same function names as mochitest. call waitforexplicitfinish() from test() if you want to delay reporting a result until after test() has returned. call finish() once the test is complete. be aware that the test harness will mark tests that take too long to complete as failed (the current timeout is 30 seconds)...
...an up function for all tests in that folder. notice that you can register as many clean up functions as you will. clean up functions are also guaranteed to be called if your test timeouts, so you can ensure that in case of timeouts you won't pollute next running tests and causing them to fail. registercleanupfunction(function() { // clean up test related stuff here. }); function test() { //
add some test related stuff. } when writing tests, design for failure. it is much better to call registercleanupfunction() than doing the cleanup after you have successfully run your tests because the cleanup functions are always called, no matter what. for instance, if you change a preference you want to make sure that the preference is always reset so that it doesn't impact other tests after your...
...e test related stuff. } when writing tests, design for failure. it is much better to call registercleanupfunction() than doing the cleanup after you have successfully run your tests because the cleanup functions are always called, no matter what. for instance, if you change a preference you want to make sure that the preference is always reset so that it doesn't impact other tests after yours. ...
...And 4 more matches
Creating a Firefox sidebar
web publishers can offer visitors a firefox sidebar to encourage their engagement. there are two ways to create a sidebar for firefox users: the social api and an extension. you can choose either depending on your needs and resources. an extension an extension is a kind of
add-ons that
adds new functionalities to firefox. there is a wide range of extensions available, and some of them provide a sidebar. such kind of sidebar can be a simple web panel or a full-featured extension that is completely integrated with the browser. there are some ways to create an extension: the new sidebar api has been implemented in firefox 29 as part of the
add-on sdk. it's the easiest way to create an extension with a sidebar.obsolete since gecko 57 you can also build a restartless extension yourself with...
...a simple web panel or a full-featured extension that is completely integrated with the browser. there are some ways to create an extension: the new sidebar api has been implemented in firefox 29 as part of the
add-on sdk. it's the easiest way to create an extension with a sidebar.obsolete since gecko 57 you can also build a restartless extension yourself without the sdk. a sample extension to
add a web panel is available as a starter.obsolete since gecko 57 if you'd like to have a deeper integration with the browser to offer more complex features, a traditional overlay extension can be an option. the document might be obsolete, though.obsolete since gecko 57 the social api obsolete since gecko 57 (firefox 57 / thunderbird 57 / seamonkey 2.54)this feature is obsolete. although it may...
...ged since it could be removed at any time. try to avoid using it. this content covers features introduced in firefox 17. the window.sidebar api obsolete since gecko 23 (firefox 23 / thunderbird 23 / seamonkey 2.20)this 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. ...
...And 4 more matches
Creating reftest-based unit tests
running ipc reftests reftests can also be run in a separate process, which can differ from same-process rendering in significant ways. currently, ipc reftests are only being run on linux. to run: moz_layers_force_shmem_surfaces=1 make -c $(objdir) reftest-ipc note: right now, automation cu...
...$ congratulations! you have just created your first reftest! the re-direct and the grep reduce the amount of excess output from the browser. if you built a debug version of the browser, there can be a lot of extra console output. the reftest.list file can be named whatever you want, not necessarily reftest.list (but it has to end with .list). more to do create more reftests. new tests can be
added to the reftest.list file, which can contain any number of tests. the file can include other things, but it does not get very complicated. keep in mind new tests should fit a 600x600 window so we can test on mobile platforms easier. here is an example. include ../other.list == foo.html bar.html != aaa.html bbb.html the first line, as one might expect, includes another manifest. the second lin...
... and bbb.html should not produce visually identical output. more information on this file can be found in the readme.txt referenced below, which was written by the creator of the reftest tool. there is one thing about automated tests that may not be obvious. there is really no way to construct a test that is too small. if you want to check something, and it seems trivial, that is ok. the cost of
adding a new test to an automated suite is very, very low. for tests that are run manually, this is not true. the cost of thinking about and managing the execution of a manual test is fairly high. this is why manual tests tend to get longer, include more steps and ultimately become a long list that actually tests a lot of things. so, create small tests. for example, it occurs to me that we assume th...
...And 4 more matches
Old Thunderbird build
hardware requirements at least 4 gb of ram. 8 gb or more is recommended. while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram. good internet connection for the initial source download. build prerequisites depending on your operating system you will need to carry out a different process to prepare your machine. ...
...s case, you need a bundle for comm-central, and a bundle for mozilla-central. unbundle mozilla-central into a "mozilla" subdirectory of your comm-central repo after unbundling comm-central. (make sure the unbundled folder's name is now "mozilla" and not "mozilla-central"). then run "python client.py checkout" to ensure you are up-to-date. ...
...al into a "mozilla" subdirectory of your comm-central repo after unbundling comm-central. (make sure the unbundled folder's name is now "mozilla" and not "mozilla-central"). then run "python client.py checkout" to ensure you are up-to-date. the source code requires 3.6gb of free space or more and
additionally 5gb or more for default build. ...
...And 4 more matches
Simple Sunbird build
libidl autoconf213 problems? see mac os x build prerequisites. windows: if you're using windows xp, you must have windows xp service pack 2 and .net framework 2.0. install visual c++ 2005 or 2008. both the professional edition and the express edition will work. you may need to install one or more windows sdks. see windows sdk versions for a quick guide. install mozillabuild, a package of
additional build tools. (if you get a message saying this application did not install properly then you should see a windows dialog giving you the option to re-install with the 'correct settings'. after that all should be well.) open a shell window by running: c:\mozilla-build\start-msvcx.bat (where x is 8 for vs 2005, and 9 for vs 2008). problems? see windows build prerequisites. building sunbi...
...ile folder which often contains spaces ( c:\documents and settings\...). this causes problems while building. to avoid this issue, change to a directory without spaces (i.e. c:\ ) before doing the following steps. you can use the "cd" command to do so. # get the source hg clone http://hg.mozilla.org/comm-central/ cd comm-central python client.py checkout # setup a basic .mozconfig file echo 'ac_
add_options --enable-application=calendar' > .mozconfig # let's build sunbird... echo 'mk_
add_options moz_objdir=@topsrcdir@/objdir-sb-release' >> .mozconfig # ...in this directory... # use this only if not on windows! parallel compilation on windows is # unreliable now due to bug 524149. echo 'mk_
add_options moz_make_flags="-j4"' >> .mozconfig # ...quickly. #...
...ozconfig # ...in this directory... # use this only if not on windows! parallel compilation on windows is # unreliable now due to bug 524149. echo 'mk_
add_options moz_make_flags="-j4"' >> .mozconfig # ...quickly. # build make -f client.mk for a debug build, you need different configuration options in your .mozconfig file. this requires more disk space, about 2.5 gb. mk_
add_options moz_objdir=@topsrcdir@/objdir-sb-debug ac_
add_options --enable-application=calendar ac_
add_options --enable-debug ac_
add_options --disable-optimize running sunbird the sunbird executable can be found in objdir-sb-release/mozilla/dist/bin/ (on mac, objdir-sb-release/dist/calendar.app/contents/macos/). building sunbird and lightning if you've set up you build environment as above, then ...
...And 4 more matches
Simple Thunderbird build
hardware requirements at least 4 gb of ram. 8 gb or more is recommended. while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram. good internet connection for the initial source download. ...
...latest thunderbird source code from mozilla's comm-central mercurial code repository. ...
...o be placed inside the mozilla source code, in a directory named comm/ (this is inverse from thunderbird 59 and earlier): hg clone https://hg.mozilla.org/mozilla-central source/ cd source/ hg clone https://hg.mozilla.org/comm-central comm/ the source code requires 3.6gb of free space or more and
additionally 5gb or more for default build. build configuration to build thunderbird, you need to
add a file named mozconfig to the root directory of the mozilla-central checkout that contains the following line: ac_
add_options --enable-application=comm/mail you can create a file with this line by doing this in the source/ directory: echo 'ac_
add_options --enable-application=comm/mail' > mozconfig if you omit this line, the build system will build firefox instead. other build configuration o...
...And 4 more matches
Embedding Tips
. how do i load a page? get thensiwebnavigation interface on your webbrowser and call the loaduri method with the appropriate uri and flags. this interface also has methods for reloading, stopping a load and going back and forward in the history. how do i block a load? implement the nsiwebprogresslistener interface and register it with the appropriate web browser object via the nsiwebbrowser::
addwebbrowserlistener() method. use the callbacks for after-the-fact cancellation. alternatively, implement a nsiuricontentlistener as described below. how do i watch/intercept a load before it happens? implement the nsiuricontentlistener interface, and register it with the appropriate web browser object via the nsiwebbrowser::parenturicontentlistener attribute. watch for changes in nsiuricontentli...
...example, if you wanted to check the server response headers, you might check onstatechange for state_start | state_is_request flags, and from the nsirequest argument qi fornsihttpchanne and call methods on that to determine response codes and other information from the server. it is left as an exercise to make this sample synchronous, i.e. wait for persistence to complete before returning. hint,
add a native message 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 ...
...or(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 previous; catman->
addcategoryentry(javascript_global_property_category, "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(previous)); 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 multiple times withi...
...And 4 more matches
IPDL Tutorial
all ipdl messages are sent between parent and a child end points, called actors. ...
...and because the base ipc library knows how to serialize and deserialize these types. see ipc/ipdl/ipdl/builtin.py for the most up-to-date list of automatically imported types. actors may be passed as parameters. the c++ signature will accept a pprotocolparent* on one side and convert it to a pprotocolchild* on the other. maybe types if you want to pass a potentially undefined argument, you can
add ? postfix after the type name. then you can pass a mozilla::maybe object instead of a concrete value. protocol pmaybe { child: async maybe(nscstring? maybe); }; custom primitive types when you need to send data of a type other than one built into ipdl, you can
add a using declaration in an ipdl specification. a custom serializer and deserializer must be provided by your c++ code. using mo...
...alue()); // named accessor functions return references to the members arrays ipdl has simple syntax for arrays: invokemethod(nscstring[] args); in c++ this is translated into a nstarray reference: virtual bool recvinvokemethod(nstarray<nscstring>& args); ipdl's generated data structures can be used in several protocols if they are defined in a separate .ipdlh file. these files must be
added to the ipdl.mk makefile like regular .ipdl files, and they use the same syntax (except they cannot declare protocols). to use the structures defined in foo.ipdlh, include it as follows. // in a .ipdl file include foo; synchronous and rpc messaging up until now, all the messages have been asynchronous. the message is sent, and the c++ method returns immediately. but what if we wanted to wait...
...And 4 more matches
AsyncShutdown.jsm
h the exception of telemetry). consequently, if any service has requested i/o to the profile directory before or during phase profilebeforechange, the system must be informed that these requests need to be completed before the end of phase profilebeforechange. failing to inform the system of this requirement can (and has been known to) cause data loss. example at some point during shutdown, the
add-on manager needs to ensure that all
add-ons have safely written their data to disk, before writing its own data. since the data is saved to the profile, this must be completed during phase profilebeforechange. asyncshutdown.profilebeforechange.
addblocker( "
add-on manager: shutting down", function condition() { let promise = ... // do whatever must be done before the end of phase profileb...
...anteed 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, preventing the user from restarting firefox or burning through a battery. ...
...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 phase
added to asyncshutdown, please file a bug. ...
...And 4 more matches
Using JavaScript code modules
ime: app - alias to the location of the xul application gre - alias to the location of the xul runtime the <relative-path> can be multiple levels deep and is always relative to the location defined by the <alias>. the common relative path is "modules" and is used by xul runner and firefox. code modules are simple javascript files with a .js or .jsm extension. ...
...s relative to the location defined by the <alias>. the common relative path is "modules" and is used by xul runner and firefox. code modules are simple javascript files with a .js or .jsm extension. <alias> must be unique to your
add-on, as the application and other extensions share the same namespace for all aliases. ...
...for example: // import services.jsm unless in a scope where it's already been imported components.utils.import("resource://gre/modules/services.jsm"); var resprot = services.io.getprotocolhandler("resource") .queryinterface(components.interfaces.nsiresproto...
...And 4 more matches
Mozilla Content Localized in Your Language
this section of the style guide is for you to author. the content here should be what you and your localization team have decided, together, to follow when 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 abbreviations how are abbreviations 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 ...
...unctuation in your language? what are language specific puntuations used? even if there are same or similar punctuations, are they used differently than those in english. reference material on other languages can be found here. pluralization what is the appropriate form of expressing pluralization in your language? if yes, list all forms of plural forms and examples if there is more than one.
additional discussions can be found here. voice what is the appropriate form of expressing voice in your language? how should emphasis be made in your language? character styles how are bold, italics, underlines, etc. used to express certain concepts in your language? if these are not applicable styles, what are some of the corresponding ways to express, emphasis or highlight some of the texts. ...
...ional discussions can be found here. voice what is the appropriate form of expressing voice in your language? how should emphasis be made in your language? character styles how are bold, italics, underlines, etc. used to express certain concepts in your language? if these are not applicable styles, what are some of the corresponding ways to express, emphasis or highlight some of the texts. ...
...And 4 more matches
NSS_3.12_release_notes.html
vfychain.main leaks memory bug 396044: warning: usage of uninitialized variable in ckfw/object.c(174) bug 396045: warning: usage of uninitialized variable in ckfw/mechanism.c(719) bug 401986: mac os x leopard build failure in legacydb bug 325805: diff considers mozilla/security/nss/cmd/pk11util/scripts/pkey a binary file bug 385151: remove the link time dependency from nss to softoken bug 387892:
add entrust root ca certificate(s) to nss bug 433386: when system clock is off by more than two days, oscp check fails, can result in crash if user tries to view certificate [[@ secitem_compareitem_util] [[@ memcmp] bug 396256: certutil and pp do not print all the generalnames in a crldp extension bug 398019: correct confusing and erroneous comments in der_asciitotime bug 422866: vfychain -pp command...
... bug 416508: fix a _msc_ver typo in sha512.c, and use sec_begin_protos/sec_end_protos in secport.h bug 419242: 'all' is not the default makefile target in lib/softoken and lib/softoken/legacydb bug 419523: export cert_newtempcertificate. bug 287061: crl number should be a big integer, not ulong bug 301213: combine internal libpkix function tests into a single statically linked program bug 324740:
add generation of sia and aia extensions to certutil bug 339737: libpkix ocsp checking calls cert_verifycert bug 358785: merge nss_libpkix_branch back to trunk bug 365966: infinite recursive call in vfy_verifydigestdirect bug 382078: pkix default http client returns error when try to get an ocsp response. bug 384926: libpkix build problems bug 389411: mingw build error - undefined reference to `_imp_...
...'t reject certs with critical netscapecerttype extensions in libpkix bug 395427: pkix_pl_initialize must not call nss_init bug 395850: build of libpkix tests creates links to nonexistant shared libraries and breaks windows build bug 398401: memory leak in pkix init. bug 399326: libpkix is unable to validate cert for certusagestatusresponder bug 400947: thread unsafe operation in pkix_pl_hashtable_
add cause selfserv to crash. bug 402773: verify the list of public header files in nss 3.12 bug 403470: strsclnt + tstclnt crashes when pkix enabled. bug 403685: application crashes after having called cert_pkixverifycert bug 408434: crash with pkix based verify bug 411614: explicit policy does not seem to work. bug 417024: convert libpkix error code into nss error code bug 422859: libpkix builds & v...
...And 4 more matches
NSS 3.14 release notes
introduction the nss team has released network security services (nss) 3.14, which is a minor release with the following new features: support for tls 1.1 (rfc 4346) experimental 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. previous 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, ...
...cipher suites are disabled by default. non-ecc aes and triple des cipher suites are enabled by default. nss 3.14 source tarballs can be downloaded from https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_rtm/src/. the cvs tag is nss_3_14_rtm. new in nss 3.14 the sections that follow discuss specific changes in nss 3.14 in more detail. ...
...been
added (https://bugzilla.mozilla.org/show_bug.cgi?id=565047). to better support tls 1.1 and future versions of tls, a new version range api was introduced to allow applications to specify the desired minimum and maximum versions. these functions are intended to replace the now-deprecated use of the ssl_enable_ssl3 and ssl_enable_tls socket options. ...
...And 4 more matches
Enc Dec MAC Output Public Key as CSR
filename, prbool ascii) { certsigneddata signeddata; secitem reqder; certcertificaterequest *certreq = null; secstatus rv = secsuccess; prarenapool *arena = null; seckeypublickey *publickey = null; arena = port_newarena(der_default_chunksize); if (arena == null) { rv = secfailure; goto cleanup; } rv = re
adderfromfile(&reqder, infilename, ascii); if (rv) { rv = secfailure; goto cleanup; } certreq = (certcertificaterequest*) port_arenazalloc (arena, sizeof(certcertificaterequest)); if (!certreq) { rv = secfailure; goto cleanup; } certreq->arena = arena; /* since cert request is a signed data, must decode to get the inner ...
...ied format */ if (ascii) { char *obuf; char *name, *email, *org, *state, *country; secitem *it; int total; it = &result; obuf = btoa_convertitemtoascii(it); total = pl_strlen(obuf); name = cert_getcommonname(subject); if (!name) { name = strdup("(not specified)"); } email = cert_getcertemail
address(subject); if (!email) email = strdup("(not specified)"); org = cert_getorgname(subject); if (!org) org = strdup("(not specified)"); state = cert_getstatename(subject); if (!state) state = strdup("(not specified)"); country = cert_getcountryname(subject); if (!country) country = strdup("(...
...xt[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength = 0; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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, i...
...And 4 more matches
JSAPI User Guide
re available for javascript code to use. whenever javascript code does something like window.open("http://www.mozilla.org/"), it is accessing a global property, in this case window. jsapi applications have full control over what global properties scripts can see. the application starts out by creating an object and populating it with the standard javascript classes, like array and object. then it
adds whatever custom classes, functions, and variables (like window) the application wants to provide; see 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 a...
...fects using the jsapi. note that the most important example is in the "a minimal example" section above. more jsapi code samples appear in the jsapi phrasebook. defining objects and properties /* statically initialize a class to make "one-off" objects. */ jsclass my_class = { "myclass", /* all of these can be replaced with the corresponding js_*stub function pointers. */ my_
addproperty, my_delproperty, my_getproperty, my_setproperty, my_enumerate, my_resolve, my_convert, my_finalize }; jsobject *obj; /* * define an object named in the global scope that can be enumerated by * for/in loops. the parent object is passed as the second argument, as * with all other api calls that take an object/name pair. the prototype * passed in is null, so the default...
...'s prototype link. */ my_props, my_methods, /* class constructor properties and methods */ my_static_props, my_static_methods); running scripts /* these should indicate source location for diagnostics. */ char *filename; unsigned int lineno; /* * the return value comes back here -- if it could be a gc thing, you must *
add it to the gc's "root set" with js_
add*root(cx, &thing) where thing * is a jsstring *, jsobject *, or jsdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; jsbool ok; /* * some example source in a c string. larger, non-null-terminated buffers * can be used, if you pass the buffer length to js_evaluatescript. */ char *source = "x *...
...And 4 more matches
Thread Sanitizer
compiled binaries for llvm/clang 3.3 on the llvm releases page. we recommend using clang 3.6 or later. building firefox getting the source if you don't have a source code repository clone yet, you need to get yourself a clone of mozilla-central. ...
...ases page. we recommend using clang 3.6 or later. building firefox getting the source if you don't have a source code repository clone yet, you need to get yourself a clone of mozilla-central. adjusting the build configuration create the build configuration file .mozconfig with the following content in your mozilla-central directory: mk_
add_options moz_objdir=@topsrcdir@/objdir-ff-tsan mk_
add_options moz_make_flags=-j12 # enable llvm specific code and build workarounds ac_
add_options --enable-thread-sanitizer # if clang is already in your $path, then these can simply be: # export cc=clang # export cxx=clang++ export cc="/path/to/clang" export cxx="/path/to/clang++" # llvm-symbolizer displays much more complete backtraces when data races are detected. # if it's not already in you...
... --enable-thread-sanitizer # if clang is already in your $path, then these can simply be: # export cc=clang # export cxx=clang++ export cc="/path/to/clang" export cxx="/path/to/clang++" # llvm-symbolizer displays much more complete backtraces when data races are detected. # if it's not already in your $path, then uncomment this next line: #export llvm_symbolizer="/path/to/llvm-symbolizer" #
add tsan to our compiler flags export cflags="-fsanitize=thread -fpic -pie" export cxxflags="-fsanitize=thread -fpic -pie" #
additionally, we need the tsan flag during linking. normally, our c/cxxflags would # be used during linking as well but there is at least one place in our build where # our cflags are not
added during linking. # note: the use of this flag causes clang to automatically link the...
...And 4 more matches
History Service Design
this document provides a high-level overview of the overall history service design of the places system. places is designed to be a complete replacement for the firefox bookmarks and history systems using storage. this system provides
additional performance, flexibility, and querying capabilities over the old one, for both end users and extensions developers. view the service interface definition: nsinavhistoryservice.idl. objectives the primary objectives 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. t...
...ties are removed when closing the connection. temporary storage is used to avoid too frequent writes to the disk, since those are most likely to cause fsyncs (to ensure data integrity) on the target filesystem. the temporary data (actually visits and pages) are synced to disk either on a timer and on bookmark's inserts. performance to ensure performance a bunch of statements, commonly used when
adding or reading visit informations, are created at startup. these statements can be reused avoiding the overhead due to createstatement calls, before closing the connection these statements need to be finalized though, since not doing that would cause leaking. the internal syncing service takes care of initializing places, syncing data to disk and finalize statements, so usually that's not a proble...
...ternal syncing service takes care of initializing places, syncing data to disk and finalize statements, so usually that's not a problem. the same pre-compiled statements approach is used in other dependant services and in autocomplete. another step to improve performance is mainly dedicated to not locking ui. since places is actually not thread-safe and doing most of the work in the main-thread,
adding visits (the most common action usually executed on user interaction) could end up locking the ui till the database i/o to save data is complete. for this reason visits and favicons are
added lazily on a timer. in future this will probably change in favour of storage asynchronous statements, so that the inserts will be queued-up by mozstorage itself in a separate thread. sql queries are built ...
...And 4 more matches
Using XPCOM Components
nctionality such as nswebbrowserfind, which provides find() and findnext() methods for finding content in web pages, and in low-level tasks such as the manipulation of data. though not every api in mozilla is or should be "xpcomified", much if not all of the typical functionality that browsers provide is available in components that can be reused via browser extensions and/or gecko embedders. in
addition to the cookiemanager component, for example, the webbrowserfind component is another part of a large set of web browsing interfaces you can use. its nsiwebbrowserfind interface is shown in the nsiwebbrowserfind interface. to use this component, you access it through the nsiwebbrowserfind interface and call its methods. the nsiwebbrowserfind interface findnext find the next occu...
...s functionality will be achieved. so we'll put aside the details of the implementation until the next chapter and look at the component from the outside-at the interface to the weblock component. the iweblock interface lock lock the browser to the current site (or to the whitelist of approved sites read from disk). unlock unlock the browser for unrestricted use.
addsite
add a new site to the whitelist. removesite remove a given site from the whitelist. sites enumerator for the list of approved sites read in from the whitelist. the weblock component is software that implements all of these methods in the way described by the interface definition. it registers itself for use when the browser starts up, and provides a factory t...
... clients, however, is that the process of freezing the interfaces that are implemented by these components is still ongoing. the component viewer does not distinguish between components that are frozen and those that are not. in the source code you view in mxr, interfaces that have been frozen are marked at the top with @status frozen. the xpcom component viewer the xpcom component viewer is an
add-on you can install in your browser (in sandbox, not available for now). alternatively, you can try xpcomviewer, a similar
add-on. xpcom component viewer the left column shows the components - in this case a subset returned from a search on "gfx" as part of the contract id and the right column a list of the interfaces. when you open a component on the left, you can see the interfaces it imple...
...And 4 more matches
imgIEncoder
modules/libpr0n/public/imgiencoder.idlscriptable please
add a summary to this article. ...
... modules/libpr0n/public/imgiencoder.idlscriptable please
add a summary to this article. ...
... 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. "0" will repeat forever. the following options can be used for each frame, with
addimageframe(): transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. delay=# -- default: "500" number of milliseconds to display the frame, before moving to the next frame. dispose=[none|background|previous] -- default: "none" what to do with the image's canvas before rendering the next frame. see apng spec. blend=[sourc...
...And 4 more matches
mozIPersonalDictionary
introduced gecko 1.4.1 inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/spellchecker/personaldictionary;1. ...
... in gecko 1.7 implemented by: @mozilla.org/spellchecker/personaldictionary;1. ...
...e_is(count)] out wstring words, out pruint32 count); void ignoreword(in wstring word); void load(); void removecorrection(in wstring word,in wstring correction, in wstring lang); void removeword(in wstring word, in wstring lang); void save(); attributes attribute type description wordlist nsistringenumerator get the (lexicographically sorted) list of words. read only. ...
...And 4 more matches
nsIBrowserHistory
toolkit/components/places/public/nsibrowserhistory.idlscriptable a browser-specific interface to global history. it
adds functions used by the basic browser like, marking pages as typed in the url bar, and removing pages as from the history interface. inherits from: nsiglobalhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1. ...
...e. inherits from: nsiglobalhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1. ...
...al number of entries. read only. lastpagevisited obsolete since gecko 10.0 autf8string the last page that was visited in a top-level window. read only. note: the count attribute was removed in gecko 15.0 because it was only used to determine if there were any entries at all anyway, so the nsinavhistoryservice.hashistoryentries attribute is better for this. ...
...And 4 more matches
nsIComponentManager
xpcom/components/nsicomponentmanager.idlscriptable this interface provides methods to access factory objects and instantiate instances of classes. ...
...until gecko 10 you h...
...nifestlocation(in nsilocalfile alocation); methods
addbootstrappedmanifestlocation() loads a "bootstrapped" chrome.manifest file from the specified directory or xpi file. a "bootstrapped" chrome manifest supports some of the instructions allowed in a regular chrome manifest, see the chrome registration documentation for details. this method was introduced in gecko 8 to let bootstrapped
add-ons provide content at chrome:// uris. until gecko 10 you had to call this method manually from within the
add-on's startup() method (with a matching removebootstrappedmanifestlocation() call in the
add-on's shutdown() method). ...
...And 4 more matches
nsIDNSRecord
netwerk/dns/nsidnsrecord.idlscriptable this interface represents the result of a dns lookup. since a dns query may return more than one resolved ip
address, the record acts like an enumerator, allowing the caller to easily step through the list of ip
addresses. inherits from: nsisupports last changed in gecko 1.7 method overview prnet
addr getnext
addr(in pruint16 aport); native code only! ...
...ecord.idlscriptable this interface represents the result of a dns lookup. since a dns query may return more than one resolved ip
address, the record acts like an enumerator, allowing the caller to easily step through the list of ip
addresses. inherits from: nsisupports last changed in gecko 1.7 method overview prnet
addr getnext
addr(in pruint16 aport); native code only! ...
...e list of ip
addresses. inherits from: nsisupports last changed in gecko 1.7 method overview prnet
addr getnext
addr(in pruint16 aport); native code only! ...
...And 4 more matches
nsIMIMEInputStream
allows automatic creation of the content-length header. inherits from: nsiinputstream last changed in gecko 1.3 implemented by: @mozilla.org/network/mime-input-stream;1. to create an instance, use: var mimeinputstream = components.classes["@mozilla.org/network/mime-input-stream;1"] .createinstance(components.interfaces.nsimimeinputstream); method overview void
addheader(in string name, in string value); void setdata(in nsiinputstream stream); attributes attribute type description
addcontentlength boolean when true a "content-length" header is automatically
added to the stream. the value of the content-length is automatically calculated using the available() method on the data stream. the value is recalculated ev...
... value value of the header. setdata() sets data-stream. may not be called once the stream has been started to be read. ...
... value value of the header. setdata() sets data-stream. may not be called once the stream has been started to be read. ...
...And 4 more matches
nsIMessageListenerManager
introduced gecko 17 inherits from: nsisupports last changed in gecko 41 (firefox 41 / thunderbird 41 / seamonkey 2.38) implemented by: @mozilla.org/globalmessagemanager;1. ...
... all listener callbacks for a particular message are invoked when that message ...
...) void removemessagelistener(in astring messagename, in nsimessagelistener listener); void
addweakmessagelistener(in astring messagename, in nsimessagelistener listener); void removeweakmessagelistener(in astring messagename, in nsimessagelistener listener); methods
addmessagelistener() register listener to receive messagename. all listener callbacks for a particular message are invoked when that message is received. the message manager holds a strong reference to listener. ...
...And 4 more matches
Storage
jsm"); components.utils.import("resource://gre/modules/fileutils.jsm"); let file = fileutils.getfile("profd", ["my_db_file_name.sqlite"]); let dbconn = services.storage.opendatabase(file); // will also create the file if it does not exist likewise, the c++ would look like this: nscomptr<nsifile> dbfile; rv = ns_getspecialdirectory(ns_app_user_profile_50_dir, getter_
addrefs(dbfile)); ns_ensure_success(rv, rv); rv = dbfile->append(ns_literal_string("my_db_file_name.sqlite")); ns_ensure_success(rv, rv); nscomptr<mozistorageservice> dbservice = do_getservice(moz_storage_service_contractid, &rv); ns_ensure_success(rv, rv); nscomptr<mozistorageconnection> dbconn; rv = dbservice->opendatabase(dbfile, getter_
addrefs(dbconn)); ns_ensure_success(rv, rv); note: moz_s...
...atestatement("select * from table_name where column_name = :parameter"); this example uses a named placeholder called "parameter" to be bound later (described in binding parameters). similarly, the c++ looks like this: nscomptr<mozistoragestatement> statement; rv = dbconn->createstatement(ns_literal_cstring("select * from table_name where column_name = ?1"), getter_
addrefs(statement)); ns_ensure_success(rv, rv); this example uses the numbered placeholder indexed by zero for a parameter to be bound later (described in binding parameters). note: numerical indexes for parameters are always one less than the number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use...
...erally accepted to use numerical placeholders instead. the example below uses mozistoragestatement.bindint32parameter(). the full list of binding functions can be found with the mozistoragestatement documentation. c++ example: nscomptr<mozistoragestatement> statement; rv = mdbconn->createstatement(ns_literal_cstring("select * from table_name where id = ?1"), getter_
addrefs(statement)); ns_ensure_success(rv, rv); rv = statement->bindint32parameter(0, 1234); ns_ensure_success(rv, rv); note: numerical indexes for parameters are always one less than the number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. binding multiple sets of parameters starting in ge...
...And 4 more matches
XUL Overlays
xul files and xul overlays overlays are xul files used to describe extra content in the ui. though overlays often define ui elements that have been
added as a result of an update or enhancement of some kind, they can be used in many different ways. overlays provide a general mechanism for:
adding ui for
additional components, as described in the example above overriding small pieces of a xul file without having to resupply the whole ui reusing particular pieces of the ui xul files and overlays work together to describe a single master document. ...
...a xul file without having to resupply the whole ui reusing particular pieces of the ui xul files and overlays work together to describe a single master document. ...
...tent is located in "base" xul files and what kind should be put in overlays, xul overlays generally define items that are not present in the basic versions of the ui, such as
additional components. when plug-ins, browser extensions, or other applications provide new ui elements to the browser, these elements should be defined in overlay files. ...
...And 4 more matches
Xray vision
achinery in gecko ensures that there's asymmetric access between code at different privilege levels: so for example, content code can't access objects created by chrome code, but chrome code can access objects created by content. however, even the ability to access content objects can be a security risk for chrome code. javascript's a highly malleable language. scripts running in web pages can
add extra properties to dom objects (also known as expando properties) and even redefine standard dom objects to do something unexpected. if chrome code relies on such modified objects, it can be tricked into doing things it shouldn't. for example: window.confirm() is a dom api that's supposed to ask the user to confirm an action, and return a boolean depending on whether they clicked "ok" or "can...
...sfer all my money?"); // calls the native implementation xrays for dom objects the primary use of xray vision is for dom objects: that is, the objects that represent parts of the web page. in gecko, dom objects have a dual representation: the canonical representation is in c++, and this is reflected into javascript for the benefit of javascript code. any modifications to these objects, such as
adding expandos or redefining standard properties, stays in the javascript reflection and does not affect the c++ representation. the dual representation enables an elegant implementation of xrays: the xray just directly accesses the c++ representation of the original object, and doesn't go to the content's javascript reflection at all. instead of filtering out modifications made by content, the xra...
...s well as a string or a primitive the return value of evalinsandbox() and any properties attached to the sandbox object may be pure javascript objects also, the webidl specifications are starting to use javascript types such as date and promise: since webidl definition is the basis of dom xrays, not having xrays for these javascript types starts to seem arbitrary. so, in gecko 31 and 32 we've
added xray support for most javascript built-in objects. like dom objects, most javascript built-in objects have an underlying c++ state that is separate from their javascript representation, so the xray implementation can go straight to the c++ state and guarantee that the object will behave as its specification defines: // chrome code var sandboxscript = 'date.prototype.getfullyear = function() ...
...And 4 more matches
Gloda examples
mples. ...
...ages in a conversation regardless of the folder in which they are stored, b) search messages by subject assuming that you have a message (glodamessage) in the conversation already, this is straight forward using glodamessage.conversation.getmessagescollection() alistener = { /* called when new items are returned by the database query or freshly indexed */ onitems
added: function _onitems
added(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: function _onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ ...
....tagarray); let collection = query.getcollection(mylistener); search messages by daterange searches for all messages within a date range id_q=gloda.newquery(gloda.noun_message); // define a date range form yesterday to now id_q.daterange([new date() - 86400000, new date()]); var mylistener = { /* called when new items are returned by the database query or freshly indexed */ onitems
added: function _onitems
added(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: function _onitemsremoved(aitems, acollection) { }, /* called when our database...
...And 4 more matches
MailNews Filters
filters these are one or more filters run on one or more folders *after* the headers have been downloaded. these filters are initiated in the filter editor, and implemented in nsmsgfilterservice.cpp. this is implemented by doing a search using the filter criteria and applying the actions en masse on the resulting hits. ...
...ters run on one or more folders *after* the headers have been downloaded. these filters are initiated in the filter editor, and implemented in nsmsgfilterservice.cpp. this is implemented by doing a search using the filter criteria and applying the actions en masse on the resulting hits. the search is executed locally, not on the server, so that criteria like "in
address book" still work. ...
...e folders *after* the headers have been downloaded. these filters are initiated in the filter editor, and implemented in nsmsgfilterservice.cpp. this is implemented by doing a search using the filter criteria and applying the actions en masse on the resulting hits. the search is executed locally, not on the server, so that criteria like "in
address book" still work. ...
...And 4 more matches
Using the Multiple Accounts API
comingserver): an incoming server represents a remote message store such as a pop, imap, or nntp server. it holds all the information necessary to retrieve mail from the remote server, such as hostname, user login name, and biff settings. identities (nsimsgidentity): an identity contains all the information necessary to compose and outgoing mail message. it includes a user's full name and e-mail
address. smtp servers (nsismtpserver): an smtp server is not tied to any of the above and can be retrieved from the smtp service (nsismtpservice). here's an example of a common setup. (you'll have to pardon the crude drawing for now) account manager +- account 1 | +- incoming server 1 (imap.mywork.com imap server, my work account) | +- identity 1 (alec flett <alecf@mywork.com>) +- ac...
...with createincomingserver(). you will need to pass it the server type as a string, from the list above. assign values to the various server properties as necessary. the most important properties here are the username and the hostname. create a fresh account with createaccount(); assign the server to the account with the incomingserver attribute. ...
... it is possible, through 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. ...
...And 4 more matches
Examine and edit CSS - Firefox Developer Tools
you can examine and edit css in the inspector's css pane. examine css rules the rules view lists all the rules that apply to the selected element, ordered from most-specific to least-specific: the four buttons on the right top of the rules view allow you to change the display of certain css and rules view features. you can: toggle pseudo-classes; toggle classes;
add a new rule; change the display based on the 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); change the display based on print media rules. a warning icon appears next to unsupported css properties or rules that have invalid values. this can help you understand why certain styles are not being app...
... with a list of selectors followed by a list of property:value; declarations. highlight matched elements: next to the selector is a target icon: click this to highlight all nodes in the page that match this selector. overridden declaration: declarations that are overridden by later rules are crossed out. see overridden declarations. inactive rules (not shown): if a rule is inactive (e.g., p
adding on a :visited pseudo-element), it is colored gray, with an info icon that gives more information when clicked. filter rules containing this property: next to overridden declarations is an icon you can click to filter the rules list to show only those rules that include that property. see overridden declarations. enable/disable: if you hover over a declaration, a checkbox appears next to it: ...
... click the button to see checkboxes that you can use to enable the :hover, :active and :focus, :focus-within and :visited pseudo-classes for the selected element: this feature can also be accessed from the popup menu in the html view. if you enable one of these pseudo-classes for a node, an orange dot appears in the markup view next to all nodes to which the pseudo-class has been applied. in
addition, the information that appears on the page itself show you what pseudo-class you are examining. for example: viewing and changing classes on an element with an element selected in the html pane, you can click the .cls button in the rules pane toolbar, to display the classes defined on that element. you can clear the checkbox for a particular class name, to see how the element would app...
...And 4 more matches
Console messages - Firefox Developer Tools
ime the time the message was recorded. this is not shown by default: you can opt to see timestamps by selecting show timestamps in the console settings menu (gear icon in the console toolbar). icon not all console messages contain icons. the following icons may be used: informational message warning error blocked; for network messages in
addition, a disclosure triangle indicates that further information is available; clicking it displays or collapses that information. message the message itself. number of occurrences if a line that generates a warning or error is executed more than once, it is only logged once and this counter appears to indicate how many times it was encountered. filename and lin...
...o a specific line of code. the console then provides a link to the filename and line number that generated the message. by default, the console is cleared each time you navigate to a new page or reload the current page. to override this behavior, enable persist logs in the console settings menu (gear icon). the context menu options listed below are available on all message categories.
additional context menu options are described in the subsection for the message category they apply to. copy message copies the selected message to the clipboard. select all selects all messages available in the message display pane. export visible messages to clipboard copies all messages available in the display pane to the clipboard. file opens a file dialog box so you can save an ex...
...sages available in the display pane. message categories network network log messages are not shown by default. use the filtering feature to show them. network requests are logged with a line that looks like this: time the time the message was recorded. method the specific http request method. if the request was made as an xmlhttprequest, there's an
additional "xhr" tag indicating this. if more information is available, a disclosure triangle lets you display it, in an embedded panel that is identical to the network monitor request details. uri the target uri. summary the http version, response code, and time taken to complete. clicking the response code takes you to the reference page for that code. the ...
...And 4 more matches
CacheStorage - Web APIs
objects tracked by the cachestorage. use this method to iterate over a list of all the cache objects. examples this code snippet is from the mdn sw-test example (see sw-test running live.) this service worker script waits for an installevent to fire, then runs waituntil to handle the install process for the app. ...
...acked by the cachestorage. use this method to iterate over a list of all the cache objects. examples this code snippet is from the mdn sw-test example (see sw-test running live.) this service worker script waits for an installevent to fire, then runs waituntil to handle the install process for the app. ...
...f calling cachestorage.open to create a new cache, then using cache.
addall to
add a series of assets to it. in the second code block, we wait for a fetchevent to fire. we construct a custom response like so: check whether a match for the request is found in the cachestorage. if so, serve that. if not, fetch the request from the network, then also open the cache created in the first block and
add a clone of the request to it using cache.put (cache.put(event.request, response.clone()).) if this fails (e.g. because the network is down), return a fallback response. finally, return whatever the custom response ended up being equal to, using fetchevent.respondwith. ...
...And 4 more matches
Using images - Web APIs
g.src = 'myimage.png'; // set source path when this script gets executed, the image starts loading. if you try to call drawimage() before the image has finished loading, it won't do anything (or, in older browsers, may even throw an exception). so you need to be sure to use the load event so you don't try this before the image has loaded: var img = new image(); // create new img element img.
addeventlistener('load', function() { // execute drawimage statements here }, false); img.src = 'myimage.png'; // set source path if you're only using one external image this can be a good approach, but once you need to track more than one we need to resort to something more clever. it's beyond the scope of this tutorial to look at image pre-loading tactics, but you should keep that in mind. emb...
... example: tiling an image in this example, we'll use an image as a wallpaper and repeat it several times on the canvas. this is done simply by looping and placi...
... ctx.lineto(70, 66); ctx.lineto(103, 76); ctx.lineto(170, 15); ctx.stroke(); }; img.src = 'https://mdn.mozillademos.org/files/5395/backdrop.png'; } the resulting graph looks like this: screenshotlive sample scaling the second variant of the drawimage() method
adds two new parameters and lets us place scaled images on the canvas. drawimage(image, x, y, width, height) this
adds the width and height parameters, which indicate the size to which to scale the image when drawing it onto the canvas. example: tiling an image in this example, we'll use an image as a wallpaper and repeat it several times on the canvas. this is done simply by looping and placing the scaled images at different positions. in the code below, the first for loop iterates over the rows. the second ...
...And 4 more matches
Content Index API - Web APIs
the content index api allows developers to register their offline enabled content with the browser. concepts and usage as it stands, offline web content is not easily discoverable by users. content indexing allows developers to tell the browser about their specific offline content. this allows users to discover and view what is available, whilst giving developers the ability to
add and manage this content. examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. the content index api is an extension to service workers, which allows developers to
add urls and metadata of already cached pages, under the scope of the current service worker. the browser can then use these entries to display offline...
...an't be indexed directly. instead, you need to provide a url for a page that displays media, and which works offline. interfaces contentindex the contentindex interface provides functionality to register content available offline. contentindexevent the contentindexevent interface of the content index api defines the object used to represent the contentdelete event. service worker
additions the following
additions to the serviceworker have been specified in the content index api spec to provide an entry point for using content indexing. serviceworkerregistration.index read only returns a reference to the contentindex interface for indexing cached pages. serviceworkerglobalscope.oncontentdelete an event handler fired whenever a contentdelete event occurs. this happ...
...ection and interface access here we get a reference to the serviceworkerregistration, then check for the index property, which gives us access to the content index interface. // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; }
adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the
add() method to register it with the content index. // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ s...
...And 4 more matches
Element.innerHTML - Web APIs
ou do not use innerhtml when inserting plain text; instead, use node.textcontent. this doesn't parse the passed content as html, but instead inserts it as raw text. warning: if your project is one that will undergo any form of security review, using innerhtml most likely will result in your code being rejected. for example, if you use innerhtml in a browser extension and submit the extension to
addons.mozilla.org, it will not pass the automated review process. example this example uses innerhtml to create a mechanism for logging messages into a box on a web page. javascript function log(msg) { var logelem = document.queryselector(".log"); var time = new date(); var timestr = time.tolocaletimestring(); logelem.innerhtml += timestr + ": " + msg + "<br/>"; } log("logging mouse e...
...ar timestr = time.tolocaletimestring(); logelem.innerhtml += timestr + ": " + msg + "<br/>"; } log("logging mouse events inside this container..."); the log() function creates the log output by getting the current time from a date object using tolocaletimestring(), and building a string with the timestamp and the message text. then the message is appended to the box with the class "log". ...
... <div class="box"> <div><strong>log:</strong></div> <div class="log"></div> </div> the <div> with the class "box" is...
...And 4 more matches
HTMLElement: transitioncancel event - Web APIs
the transitioncancel event is fired when a css transition is canceled. see globaleventhandlers.ontransitioncancel for more information. ...
....ontransitioncancel for more information. ...
...er property globaleventhandlers.ontransitioncancel examples this code gets an element that has a transition defined and
adds a listener to the transitioncancel event: const transition = document.queryselector('.transition'); transition.
addeventlistener('transitioncancel', () => { console.log('transition canceled'); }); the same, but using the ontransitioncancel property instead of
addeventlistener(): const transition = document.queryselector('.transition'); transition.ontransitioncancel = () => { console.log('transition canceled'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition"></div> <div class="message"></div> .transition { width: 100px; height: 100px; background...
...And 4 more matches
HTMLImageElement.alt - Web APIs
to get into the habit of using it. usage notes the fundamental guideline for the alt attribute is that every image's alternate text should be able to replace the image without altering the meaning of the page. you should never use alt for text that could be construed as a caption or title. there are separate attributes and elements designed for those purposes. examples beyond that, there are
additional guidelines for using alt appropriately which vary depending on what the image 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 t...
...he result below. they're not crucial to the concept shown in the html above, but you may expand the view below if you wish to read the css used. view the css editors: if you change the css below, please be sure to close the details box using the toggle at the top of the css view before saving. otherwise, readers will find it open by default, which is not the intent here. ...
... open by default, which is not the intent here. ...
...And 4 more matches
IDBObjectStore.indexNames - Web APIs
the indexnames read-only property of the idbobjectstore interface returns a list of the names of indexes on objects in this object store. note: this feature is available in web workers. syntax var myindexnames = objectstore.indexnames; value a domstringlist. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store using
add(). after the object store has been created, we log objectstore.indexnames to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the data...
.... for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...xample, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBObjectStore.keyPath - Web APIs
d-only property of the idbobjectstore interface returns the key path of this object store. if this property is null, the application must provide a key for each modification operation. note: this feature is available in web workers. syntax var mykeypath = objectstore.keypath; value any value type. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store using
add(). after the object store has been created, we log objectstore.keypath to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // ...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBObjectStore.name - Web APIs
n deleted or the current transaction is not an upgrade transaction; you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange". transactioninactiveerror the current transaction is not active. constrainterror an object store is already using the specified name. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store using
add(). after the object store has been created, we log objectstore.name to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // sto...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBObjectStore.transaction - Web APIs
the transaction read-only property of the idbobjectstore interface returns the transaction object to which this object store belongs. note: this feature is available in web workers. syntax var mytransaction = objectstore.transaction; value an idbtransaction object. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store using
add(). after the object store has been created, we log objectstore.transaction to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening ...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBTransaction.error - Web APIs
it can be a reference to the same error as the request object that raised it, or a transaction failure (for example quotaexceedederror or unknownerror). this property is null if the transaction is not finished, is finished and successfully committed, or was aborted with the idbtransaction.abort method. example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful. for a full working example, see our to-do notificat...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBTransaction.onabort - Web APIs
the onabort event handler of the idbtransaction interface handles the abort event, fired, when the current transaction is aborted via the idbtransaction.abort method. note: this feature is available in web workers. syntax transaction.onabort = function(event) { ... }; example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.onabort = function(event) { }; block, reporting when the transaction has been aborted. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.inde...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBTransaction.oncomplete - Web APIs
event by creating a transaction using the experimental (non-standard) readwriteflush mode (see idbdatabase.transaction.) this is currently experimental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. syntax transaction.oncomplete = function(event) { ... }; example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.oncomplete = function(event) { }; block, which reports back when the transaction was successful. for a full working example, see our to-do notifications app (view example live.) // let us open our...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
IDBTransaction.onerror - Web APIs
r event, fired when a request returns an error and bubbles up to the transaction object. note: consider using idbtransaction.onabort instead to handle non- successful completion of the transaction. note: this feature is available in web workers. syntax transaction.onerror = function(event) { ... }; example in the following code snippet, we open a read/write transaction on our database and
add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful. for a full working example, see our to-do notificat...
...ull working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...ee our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
...And 4 more matches
Online and offline events - Web APIs
that you can queue your server requests for a later time. it is this process that online/offline events help to simplify. api navigator.online navigator.online is a property that maintains a true/false value (true for online, false for offline). this property is updated whenever the user switches into "offline mode" by selecting the corresponding menu item (file -> work offline in firefox).
additionally, this property should update whenever a browser is no longer capable of connecting to the network. according to the specification: the navigator.online attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail)... firefox 2 updates this property when switching ...
...efox and internet explorer (the specification based itself off of these prior implementations), so you can begin using it immediately. 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. ...
...(note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup. ...
...And 4 more matches
Pointer Lock API - Web APIs
ic release gesture. it is not limited by browser or screen boundaries. it continues to send events regardless of mouse button state. it hides the cursor. method/properties overview this section provides a brief description of each property and method related to the pointer lock specification. requestpointerlock() the pointer lock api, similar to the fullscreen api, extends dom elements by
adding a new method, requestpointerlock(). 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 g...
...default unlock gesture, or pointer lock has not previously 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 property is used for accessing the currently locked element (if any), and is named pointerlockelement and the new method on document is exitpointerlock() and, as the name implies, it is used to exit the pointer lock. the pointerlockelement property is useful for determining if any element is currently pointer locked (e.g., for doing a boolean chec...
...exitpointerlock; // attempt to unlock document.exitpointerlock(); pointerlockchange event when the pointer lock state changes—for example, when calling requestpointerlock(), exitpointerlock(), the user pressing the esc key, etc.—the pointerlockchange event is dispatched to the document. this is a simple event and contains no extra data. ...
...And 4 more matches
RTCTrackEvent - Web APIs
this event is sent by the webrtc layer to the web site or application, so you will not typically need to instantiate an rtctrackevent yourself. constructor rtctrackevent() creates and returns a new rtctrackevent object, initialized with properties taken from the specified rtctrackeventinit dictionary. ...
...erties taken from the specified rtctrackeventinit dictionary. you will probably not need to create new track events yourself, since they're typically created by the webrtc infrastructure and sent to the connection's ontrack event handler. properties since rtctrackevent is based on event, its properties are also available. receiver read only the rtcrtpreceiver used by the track that's been
added to the rtcpeerconnection. streams read only optional an array of mediastream objects, each representing one of the media streams to which the
added track belongs. by default, the array is empty, indicating a streamless track. track read only the mediastreamtrack which has been
added to the connection. transceiver read only the rtcrtptransceiver being used by the new track. track even...
...ams to which the
added track belongs. by default, the array is empty, indicating a streamless track. track read only the mediastreamtrack which has been
added to the connection. transceiver read only the rtcrtptransceiver being used by the new track. track event types there is only one type of track event. track the track event is sent to the rtcpeerconnection when a new track has been
added to the connection. by the time the track event is delivered to the rtcpeerconnection's ontrack handler, the new media has completed its negotiation for a specific rtcrtpreceiver (which is specified by the event's receiver property). ...
...And 4 more matches
Range.setStart() - Web APIs
h set to the specified start position. syntax range.setstart(startnode, startoffset); parameters startnode the node where the range should start. startoffset an integer greater than or equal to zero representing the offset for the start of the range from the start of startnode. ...
...ecified start position. syntax range.setstart(startnode, startoffset); parameters startnode the node where the range should start. startoffset an integer greater than or equal to zero representing the offset for the start of the range from the start of startnode. examples highlight part of an element this example uses the range.setstart() and range.setend() methods to
add part of an
address to a range. ...
...e the node where the range should start. startoffset an integer greater than or equal to zero representing the offset for the start of the range from the start of startnode. examples highlight part of an element this example uses the range.setstart() and range.setend() methods to
add part of an
address to a range. the selected range is then highlighted using range.surroundcontents(). the
address contains nine nodes: five text nodes, and four <br> elements. html <p id="
address">wyatt earp<br> 101 e. ...
...And 4 more matches
Using Touch Events - Web APIs
) 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 each touch event type. // register touch event handlers someelement.
addeventlistener('touchstart', process_touchstart, false); someelement.
addeventlistener('touchmove', process_touchmove, false); someelement.
addeventlistener('touchcancel', process_touchcancel, false); someelement.
addeventlistener('touchend', process_touchend, false); process an event in an event handler, implementing the application's gesture semantics. // touchstart handler function process_touch...
...ion process_touchstart(ev) { // use the event's data to call out to the appropriate gesture handlers switch (ev.touches.length) { case 1: handle_one_touch(ev); break; case 2: handle_two_touches(ev); break; case 3: handle_three_touches(ev); break; default: gesture_not_supported(ev); break; } } access the attributes of a touch point. // 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); prevent the browser from processing emulated mouse events. // touchmove handler function process_touchmove(ev) { // set call ...
...ngth; i++) { process_target(ev.targettouches[i].target); } }, false); prevent the browser from processing emulated mouse events. // touchmove handler function process_touchmove(ev) { // set call preventdefault() ev.preventdefault(); } 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 entire document or nodes higher up in the document tree).
add touchmove, touchend and touchcancel event handlers within the touchstart. the target touch element or node should be large enough to accommodate a finger touch. if the target area is too small, touching it could result in firing other events for adjacent element...
...And 4 more matches
WebGLRenderingContext.blendEquationSeparate() - Web APIs
is used to set the rgb blend equation and alpha blend equation separately. the blend equation 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. ...
...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 glenum specifying how the alpha component (transparency) of source and destination colors are combined. ...
...ion, 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 glenum specifying how the alpha component (transparency) of source and destination colors are combined. ...
...And 4 more matches
WebRTC API - Web APIs
one dialing) signals. connections between peers can be made without requiring any special drivers or plug-ins, and can often be made without any intermediary servers. connections between two peers are represented by the rtcpeerconnection interface. once a connection has been established and opened using rtcpeerconnection, media streams (mediastreams) and/or data channels (rtcdatachannels) can be
added to the connection. media streams can consist of any number of tracks of media information; tracks, which are represented by objects based on the mediastreamtrack interface, may contain one of a number of types of media data, including audio, video, and text (such as subtitles or even chapter names). most streams consist of at least one audio track and likely also a video track, and can be used...
...y an rtcpeerconnection. only one event is of this type: icecandidate. rtcrtpsender manages the encoding and transmission of data for a mediastreamtrack on an rtcpeerconnection. rtcrtpreceiver manages the reception and decoding of data for a mediastreamtrack on an rtcpeerconnection. rtctrackevent the interface used to represent a track event, which indicates that an rtcrtpreceiver object was
added to the rtcpeerconnection object, indicating that a new incoming mediastreamtrack was created and
added to the rtcpeerconnection. rtcsctptransport provides information which describes a stream control transmission protocol (sctp) transport and also provides a way to access the underlying datagram transport layer security (dtls) transport over which sctp packets for all of an rtcpeerconnecti...
...at an error occurred on the data channel. error an rtcerrorevent 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 which needs to be
added to the local peer by calling setlocaldescription(). icecandidateerror an rtcpeerconnectioniceerrorevent 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 s...
...And 4 more matches
Lighting a WebXR setting - Web APIs
ight sources in the scene, instead of actually calculating the true effect of light scattering. care needs to be taken to try to match the ambient light to what would really be the effect of the scene's lighting when doing this, however. ambient light can also be used to apply a color tint to a scene; for example, in a game in which the player has a special pair of yellow-tinted glasses, you can
add a yellow ambient light. saturn's fifth-largest moon, tethys, bathed in sunlight, coming from the lower left. diffuse light diffuse light is light which is evenly and directionally emitted from or reflected off a surface. this is the majority of the light we usually see. diffuse light comes from a particular position or direction and casts shadows. due to its directionality, the faces o...
.... ambient light sources generally don't correspond to any object within the scene, and have no real-world analogues, either. earth and moon both half-lit by the sun's directional lighting. directional light sources a directional light source is a light source that comes from a specific direction, but not from a specific source, so its emitted light rays are parallel to one another. in
addition, the intensity of the light doesn't change over distance. this means that shadows cast by directional lights are very sharp, with an essentially instant transition between lighted and shadowed. the most common example of a directional light is the sun. while the sun is in actuality a single (large) object, it's very far away, so the rays of light coming from it are essentially parallel. whi...
... of them. each light source substantially increases the amount of calculation needed to determine the final color and brightness of each displayed pixel. performing the shading for each of these light source types is more computationally demanding than the one before it; so ambient light is the least expensive to apply, followed by directional light sources, point lights, and finally spotlights. ...
...And 4 more matches
Starting up and shutting down a WebXR session - Web APIs
before you can begin to render your augmented or virtual reality scenario, you need to create and set up the webxr session, and you should know how to shut it down properly as well. you will learn how to do these things in this article. accessing the webxr api your app's access to the webxr api begins with the xrsystem object. ...
...ebxr specification has published a webxr polyfill which you can use to simulate webxr on browsers which don't have support for the webxr apis. if the browser supports the older webvr api, that is used. otherwise, the polyfill falls back to an implementation which uses google's cardboard vr api. the polyfill is maintained alongside the specification, and is kept up to date with the specification.
additionally, it is updated to maintain compatibility with browsers as their support for webxr and other technologies related to it and to the implementation of the polyfill change over time. be sure to read the readme carefully; the polyfill comes in several versions depending on what degree of compatibility with newer javascript features your target browsers include. webxr api emulator extension ...
... mentioning. version 0.4.0 of the extension was announced on march 26, 2020. it introduced support for augmented reality (ar) through the webxr ar module, which has is approaching a stable state. documentation for ar is forthcoming shortly here on mdn. other improvements include updating the emulator to rename the xr interface to xrsystem, introduce support for squeeze (grip) input sources, and
add support for the xrinputsource property profiles. context requirements a webxr compatible environment starts with a securely-loaded document. your document needs to either have been loaded from the local drive (such as by using an url such as http://localhost/...), or using https when loading the page. the javascript code must, likewise, have been loaded securely. if the document wasn't loaded ...
...And 4 more matches
Example and tutorial: Simple synth keyboard - Web APIs
on> <option value="square" selected>square</option> <option value="sawtooth">sawtooth</option> <option value="triangle">triangle</option> <option value="custom">custom</option> </select> </div> </div> css .container { overflow-x: scroll; overflow-y: hidden; width: 660px; height: 110px; white-space: nowrap; margin: 10px; } .keyboard { width: auto; p
adding: 0; margin: 0; } .key { cursor: pointer; font: 16px "open sans", "lucida grande", "arial", sans-serif; border: 1px solid black; border-radius: 5px; width: 20px; height: 80px; text-align: center; box-shadow: 2px 2px darkgray; display: inline-block; position: relative; margin-right: 3px; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-us...
...: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } .key div { position: absolute; bottom: 0; text-align: center; width: 100%; pointer-events: none; } .key div sub { font-size: 10px; pointer-events: none; } .key:hover { background-color: #eef; } .key:active { background-color: #000; color: #fff; } .octave { display: inline-block; p
adding: 0 6px 0 0; } .settingsbar { p
adding-top: 8px; font: 14px "open sans", "lucida grande", "arial", sans-serif; position: relative; vertical-align: middle; width: 100%; height: 30px; } .left { width: 50%; position: absolute; left: 0; display: table-cell; vertical-align: middle; } .left span, .left input { vertical-align: middle; } .right { width: 50%; position: abs...
...t exist. if (!object.entries) { object.entries = function entries(o) { return reduce(keys(o), (e, k) => concat(e, typeof k === 'string' && isenumerable(o, k) ? [[k, o[k]]] : []), []); }; } building the keyboard the setup() function is responsible for building the keyboard and preparing the app to play music. function setup() { notefreq = createnotetable(); volumecontrol.
addeventlistener("change", changevolume, false); mastergainnode = audiocontext.creategain(); mastergainnode.connect(audiocontext.destination); mastergainnode.gain.value = volumecontrol.value; // create the keys; skip any that are sharp or flat; for // our purposes we don't need them. each octave is inserted // into a <div> of class "octave". notefreq.foreach(function(keys, idx) { ...
...And 4 more matches
Using the Web Audio API - Web APIs
ng our audio element into the api. for the most part, you don't need to create an output node, you can just connect your other nodes to baseaudiocontext.destination, which handles the situation for you: track.connect(audiocontext.destination); a good way to visualise these nodes is by drawing an audio graph so you can visualize it. ...
...es to baseaudiocontext.destination, which handles the situation for you: track.connect(audiocontext.destination); a good way to visualise these nodes is by drawing an audio graph so you can visualize it. this is what our current audio graph looks like: now we can
add the play and pause functionality. ...
...lay(); this.dataset.playing = 'true'; } else if (this.dataset.playing === 'true') { audioelement.pause(); this.dataset.playing = 'false'; } }, false); we also need to take into account what to do when the track finishes playing. our htmlmediaelement fires an ended event once it's finished playing, so we can listen for that and run code accordingly: audioelement.
addeventlistener('ended', () => { playbutton.dataset.playing = 'false'; }, false); modifying sound let's delve into some basic modification nodes, to change the sound that we have. this is where the web audio api really starts to come in handy. first of all, let's change the volume. this can be done using a gainnode, which represents how big our sound wave is. there are two ways you can creat...
...And 4 more matches
Using the aria-invalid attribute - Accessibility
aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. ...
... 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. ...
...quired is false, it is not strictly necessary to
add the attribute to input. <input name="name" id="name" aria-required="true" aria-invalid="false" onblur="checkvalidity('name', ' ', 'invalid name entered (requires both first and last name)');"/> <br /> <input name="email" id="email" aria-required="true" aria-invalid="false" onblur="checkvalidity('email', '@', 'invalid e-mail
address');"/> note that it is not necessary to validate the fields immediately on blur; the application could wait until the form is submitted (though this is not necessarily recommended). the snippet below shows a very simple validation function, which only checks for the presence of a particular character (in the real world, validation will likely be more sophisticated): function checkvalidity(...
...And 4 more matches
Cognitive accessibility - Accessibility
ke to improve the cognitive accessibility of their web sites and applications. overview cognitive and intellectual disabilities cover a large spectrum, and may be momentary, temporary, or permanent conditions. for example, dementia and alzheimer's are permanent cognitive impairments that get progressively worse. ...
...nent cognitive impairments that get progressively worse. other permanent cognitive impairments include aphasia, speech and language, autism,
add/adhd, dyslexia, and dyscalculia. an example of a temporary cognitive impairment could be people affected by substances such as alcohol or drugs. another form it can take is depression, such as when mourning the loss of a loved one, or being momentarily s
addened by a tweet or video they just saw online. a third example could be sleep deprivation. it may seem like an overwhelming challenge to
address the wide range of cognitive differences, especially when solutions for two different people may be conflicting. one way to handle this is to focus on cognitive skills. cognitive skills include: attention memory processing speed time management let...
...users enough time to read and use content." a time limit is any process that happens without user initiation after a set time or on a periodic basis, such as being logged out after 30 minutes or having 15 minutes to make a purchase. people with cognitive disabilities may require more time to read content, or to perform functions such as filling out forms. solutions include providing users enough
additional time to complete tasks or eliminate time constraints altogether. timers options for adjusting time requirements include: allowing the user to turn off or adjust the time to at least 10 times the original limit before encountering it. alerting the user and providing a buffer of at least 20 seconds to extend the timeout duration by a factor of 10 with a simple action, such as hi...
...And 4 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
t downloading the sdk, you won't get the extremely useful tools, which help a great deal in the learning process. the accessible event watcher shows what accessible events are being generated by a given piece of software. the accessible explorer and inspect object tools show the tree of data nodes the accessible object is exposing through com, and what the screen boundaries of each object are. in
addition, msdn has improved their msaa documentation. when to use msaa, and when not to it's a common mistake to say that msaa is not worth using, for a number of reasons. myths for not using msaa myth: msaa doesn't really work reality: msaa works really well for dialogs and ui. true, it's not great for documents, but it's the only existing widely-used standard for exposing accessibility. myth...
...object_destroy [don't implement, watching system generated versions of this event causes assistive technology crashes] event_object_show [can be important, depending on project] event_object_hide [can be important, depending on project] event_object_reorder [important for mutating docs] event_object_focus [important] event_object_selection [important] event_object_selection
add [important for multiple selection] event_object_selectionremove [important for multiple selection] event_object_selectionwithin [important for multiple selection] event_object_statechange [important for checkboxes and radio buttons] event_object_locationchange event_object_namechange event_object_descriptionchange event_object_valuechange [important for sliders and pro...
...ed [important] state_haspopup msaa roles cheat sheet for information on what each role does, see the msdn role constants page. check with your assistive technology partners to find out what roles you need to support. there's a very good chance they won't ask for more than the roles marked [important]: there is no need to support the objects marked [inserted by system]. windows will
add those objects to your hierarchy for you. role_titlebar [inserted by system] role_menubar [important if you don't use native menus] role_scrollbar role_grip role_sound role_cursor role_caret role_alert role_window [inserted by system] role_client [important] role_menupopup [important] role_menuitem [important] role_tooltip role_applicat...
...And 4 more matches
Perceivable - Accessibility
anscript information. no audio description tutorial is available yet. 1.2.2 provide captions for web-based video (a) you should provide captions for video presented on the web (e.g., html5 video). this is for the benefit of people who can't hear the audio part of the video. see video text tracks for html5 video captions, and other multimedia content for other technologies. see also
add your own subtitles & closed captions (youtube). 1.2.3 provide text transcript or audio description for web-based video (a) you should provide text transcripts or audio descriptions for video presented on the web (e.g., html5 video. this is for the benefit of people who can't see the visual part of the video, and don't get the full content from the audio alone. see audio transcripts...
...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. 1.3.4 orientation (aa)
added in 2.1 content does not restrict its view and operation to a single display orientation, such as portrait or landscape, unless a specific display orientation is essential. understanding orientation 1.3.5 identify input purpose (aa)
added in 2.1 follow the list of 53 input fields to programmatically identify the purpose of a field. understanding identif...
...eration to a single display orientation, such as portrait or landscape, unless a specific display orientation is essential. understanding orientation 1.3.5 identify input purpose (aa)
added in 2.1 follow the list of 53 input fields to programmatically identify the purpose of a field. understanding identify input purpose 1.3.6 identify purpose (aaa)
added in 2.1 in content implemented using markup languages, the purpose of user interface components, icons, and regions can be programmatically determined. understanding identify purpose note: also see the wcag description for guideline 1.3: adaptable: create content that can be presented in different ways without losing information or structure. guideline 1.4: make it easier for use...
...And 4 more matches
::before (:before) - CSS: Cascading Style Sheets
in css, ::before creates a pseudo-element that is the first child of the selected element. it is often used to
add cosmetic content to an element with the content property. it is inline by default. /*
add a heart before links */ a::before { content: "♥"; } note: the pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. syntax /* css3 syntax */ ::before /* css2 syntax */ :before note: css3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :before, introduced in css2. examples
adding quotation marks one simple example of using ::before pseudo-elements is to provide quotation marks. her...
...st any way we want. html <span class="ribbon">notice where the orange box is.</span> css .ribbon { background-color: #5bc8f7; } .ribbon::before { content: "look at this orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result to-do list in this example we will create a simple to-do list using pseudo-elements. ...
...ist in this example we will create a simple to-do list using pseudo-elements. this method can often be used to
add small touches to the ui and improve user experience. ...
...And 4 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
u might use flexbox for today. navigation a common pattern for navigation is to have a list of items displayed as a horizontal bar. this pattern, as basic as it seems, was difficult to achieve before flexbox. it forms the most simple of flexbox examples, and could be considered the ideal flexbox use case. when we have a set of items that we want to display horizontally, we may well end up with
additional space. we need to decide what to do with that space, and have a couple of options. we either display the space outside of the items — therefore spacing them out with white space between or around them — or we absorb the extra space inside the items and therefore need a method of allowing the items to grow and take up this space. space distributed outside the items to distribute the s...
...perties 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 prevent 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: 1, they will grow and shrink from a...
...n proportion. if you set both sides to flex: 1, they will grow and shrink from a flex-basis of 0, so you will end up with two equal-sized columns. you could either take the content as a guide and set both to flex: auto, in which case they would grow and shrink from the size of the content or any size applied directly to the flex items such as a width on the image. .media .content { flex: 1; p
adding: 10px; } .image { flex: 1; } you could also give each side different flex-grow factors, for example setting the side with the image to flex: 1 and the content side to flex: 3. this will mean they use a flex-basis of 0 but distribute that space at different rates according to the flex-grow factor you have assigned. the flex properties we use to do this are described in detail in the guide c...
...And 4 more matches
Grid template areas - CSS: Cascading Style Sheets
we can see the layout described as the value o...
... . . ft ft ft ft ft ft"; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">...
... will be counted as one cell. for a complex layout there is a benefit to having the rows and columns neatly aligned. it means that you can actually see, right there in the css, what this layout looks like. spanning multiple cells in our example each of the areas spans multiple grid cells and we achieve this by repeating the name of that grid area multiple times with white space between. you can
add extra white space in order to keep your columns neatly lined up in the value of grid-template-areas. you can see that i have done this in order that the hd and ft line up with main. the area that you create by chaining the area names must be rectangular, at this point there is no way to create an l-shaped area. the specification does note that a future level might provide this functionality. you...
...And 4 more matches
content - CSS: Cascading Style Sheets
the content css property replaces an element with a generated value. objects inserted using the content property are anonymous replaced elements. ...
... html <h1>5</h1> <p>according to sir tim berners-lee, <q cite="http://www.w3.org/people/berners-lee/faq.html#internet">i was lucky enough to invent the web at the time when the internet already existed - and had for a decade and a half.</q> we must understand that there is nothing fundamentally wrong with building on the contributions of others.
... internet and their own experiences on the internet.</q> therefore, we can infer that contributing to the open web can protect our own individual experiences on it. </p> css q { color: blue; } q::before { content: open-quote; } q::after { content: close-quote; } h1::before { content: "chapter "; /* the trailing space creates separation between the
added content and the rest of the content */ } result image combined with text this example inserts an image before the link. if the image is not found, it inserts text instead. html <a href="http://www.mozilla.org/">mozilla home page</a> css a::before { content: url("https://mozorg.cdn.mozilla.net/media/img/favicon.ico") / " mozilla: "; font: x-small arial, sa...
...And 4 more matches
display - CSS: Cascading Style Sheets
-flex; } for more information on these changes to the specification, see the article adapting to the new two-value syntax of display. global /* global values */ display: inherit; display: initial; display: unset; description the individual pages for the different types of value that display can have set on it feature multiple examples of those values in action — see the syntax section. in
addition, see the following material, which covers the various values of display in depth. adapting to the new two-value syntax of display css flow layout (display: block, display: inline) block and inline layout in normal flow flow layout and overflow flow layout and writing modes formatting contexts explained in flow and out of flow display: flex basic concepts of flexbox aligning...
... inline-flex | inline-grid examples display value comparison in this example we have two block-level container elements, each one with three inline children. below that, we have a select menu that allows you to apply different display values to the containers, allowing you to compare and contrast how the different values affect the element's layout, and that of their children. we've included p
adding and background-color on the containers and their children, so that it is easier to see the effect the display values are having. note: we've not included any of the modern two-value syntax, as support for that is still fairly limited. html <article class="container"> <span>first</span> <span>second</span> <span>third</span> </article> <article class="container"> <span>first</span...
... <option selected>block</option> <option>inline</option> <option>inline-block</option> <option>none</option> <option>flex</option> <option>inline-flex</option> <option>grid</option> <option>inline-grid</option> <option>table</option> <option>list-item</option> </select> </div> css html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; p
adding-top: 10px; } article { background-color: red; } article span { background-color: black; color: white; margin: 1px; } article, span { p
adding: 10px; border-radius: 7px; } article, div { margin: 20px; } javascript const articles = document.queryselectorall('.container'); const select = document.queryselector('select'); function updatedisplay() { articles.foreach((article) ...
...And 4 more matches
mask-clip - CSS: Cascading Style Sheets
the mask-clip css property determines the area which is affected by a mask. the painted content of an element must be restricted to this area. /* <geometry-box> values */ mask-clip: content-box; mask-clip: p
adding-box; mask-clip: border-box; mask-clip: margin-box; mask-clip: fill-box; mask-clip: stroke-box; mask-clip: view-box; /* keyword values */ mask-clip: no-clip; /* non-standard keyword values */ -webkit-mask-clip: border; -webkit-mask-clip: p
adding; -webkit-mask-clip: content; -webkit-mask-clip: text; /* multiple values */ mask-clip: p
adding-box, no-clip; mask-clip: view-box, fill-box, border-box; /* global values */ mask-clip: inherit; mask-clip: initial; mask-clip: unset; syntax one or more of the keyword values listed below, separated by commas. values content-box the ...
... border-box the painted content is clipped to the border box. margin-box the painted content is clipped to the margin box. fill-box the painted content is clipped to the object bounding box. stroke-box the painted content is clipped to the stroke bounding box. view-box uses the nearest svg viewport as reference box. ...
... border-box the painted content is clipped to the border box. margin-box the painted content is clipped to the margin box. fill-box the painted content is clipped to the object bounding box. stroke-box the painted content is clipped to the stroke bounding box. view-box uses the nearest svg viewport as reference box. ...
...And 4 more matches
position - CSS: Cascading Style Sheets
sition; the left and right properties specify the horizontal offset. an absolutely positioned element is an element whose computed position value is absolute or fixed. the top, right, bottom, and left properties specify offsets from the edges of the element's containing block. (the containing block is the ancestor relative to which the element is positioned.) if the element has margins, they are
added to the offset. the element establishes a new block formatting context (bfc) for its contents. a stickily positioned element is an element whose computed position value is sticky. it's treated as relatively positioned until its containing block crosses a specified threshold (such as setting top to value other than auto) within its flow root (or the container it scrolls within), at which point i...
...performance and accessibility issues. as a user scrolls, the browser must repaint the sticky or fixed content in a new location. depending on the content needing to be repainted, the browser performance, and the device's processing speed, the browser may not be able to manage repaints at 60 fps, causing accessibility concerns for people with sensitivities and jank for everyone. one solution is to
add will-change: transform to the positioned elements to render the element in its own layer, improving repaint speed and therefore improving performance and accessibility. formal definition initial valuestaticapplies toall elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax static | relative | absolute | sticky | fixed examples relative ...
...see also the w3c definition), which is the containing block of the document's root element. html <h1>absolute positioning</h1> <p>i am a basic block level element. my adjacent block level elements sit on new lines below me.</p> <p class="positioned">by default we span 100% of the width of our parent element, and we are as tall as our child content. our total width and height is our content + p
adding + border width/height.</p> <p>we are separated by our margins. because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. overflowing inline elements <span>wrap onto a new line if possib...
...And 4 more matches
Index - Developer guides
ive streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. ...
... 8 creating a cross-browser video player apps, html5, video, full screen this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. ...
..., needscontent, events this article demonstrates how to create and dispatch dom events. such events are commonly called synthetic events, as opposed to the events fired by the browser itself. 19 dom onevent handlers beginner, dom, dom beginner, needsbeginnerupdate, needsupdate the web platform provides several ways to be notified of dom events. ...
...And 4 more matches
Date and time formats used in HTML - HTML: Hypertext Markup Language
, the underlying value always uses the gregorian calendar. while the gregorian calendar wasn't created until the year 1582 (replacing the similar julian calendar), for html's purposes, the gregorian calendar is extended back to the year 1 c.e. make sure any older dates account for this. for the purposes of html dates, years are always at least four digits long; years prior to the year 1000 are p
added with leading zeroes ("0"), so the year 72 is written as 0072. years prior to the year 1 c.e. are not supported, so html doesn't support years 1 b.c.e. (1 b.c.) or earlier. a year is normally 365 days long, except during leap years. leap years a leap year is any year which is divisible by 400 or the year is divisible by 4 but not by 100. although the calendar year is normally 365 days long, i...
...ng leap years. leap years a leap year is any year which is divisible by 400 or the year is divisible by 4 but not by 100. although the calendar year is normally 365 days long, it actually takes the planet earth approximately 365.2422 days to complete a single orbit around the sun. leap years help to adjust the calendar to keep it synchronized with the actual position of the planet in its orbit. ...
... while month 02, february, normally has 28 days, it has 29 days in leap years. months of the year there are 12 months in the year, numbered 1 through 12. ...
...And 4 more matches
<details>: The Details disclosure element - HTML: Hypertext Markup Language
licit aria role group permitted aria roles no role permitted dom interface htmldetailselement attributes this element includes the global attributes. open this boolean attribute indicates whether or not the details — that is, the contents of the <details> element — are currently visible. the default, false, means the details are not visible. events in
addition to the usual events supported by html elements, the <details> element supports the toggle event, which is dispatched to the <details> element whenever its state changes between open and closed. it is sent after the state is changed, although if the state changes multiple times before the browser can dispatch the event, the events are coalesced so that only one is sent. you can use an event ...
...orts the toggle event, which is dispatched to the <details> element whenever its state changes between open and closed. it is sent after the state is changed, although if the state changes multiple times before the browser can dispatch the event, the events are coalesced so that only one is sent. you can use an event listener for the toggle event to detect when the widget changes state: details.
addeventlistener("toggle", event => { if (details.open) { /* the element was toggled open */ } else { /* the element was toggled closed */ } }); examples a simple disclosure example this example shows a <details> element with no provided summary. <details> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term st...
.... <details> <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> in this situation, the browser will use a default summary string (usually "details"). here's what your browser does with it: providing a summary this example
adds a summary to the above example by using the <summary> element inside <details>, like this: <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> the result from this html is t...
...And 4 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
heckbox is unchecked when its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g. value=unchecked); the value is not submitted to the server at all. if you wanted to submit a default value for the checkbox when it is unchecked, you could include an <input type="hidden"> inside the form with the same name and value, generated by javascript perhaps. ...
...its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g. value=unchecked); the value is not submitted to the server at all. if you wanted to submit a default value for the checkbox when it is unchecked, you could include an <input type="hidden"> inside the form with the same name and value, generated by javascript perhaps. ...
...is present on the <input> element defining a checkbox, the checkbox's value is neither true nor false, but is instead indeterminate, meaning that it's state cannot be determined or stated in pure binary terms. this may happen, for instance, if the state of the checkbox depends on multiple other checkboxes, and those checkboxes have different values. essentially, then, the indeterminate attribute
adds a third possible state to the checkbox: "i don't know." in this state, the browser may draw the checkbox in grey or with a different mark inside the checkbox. for instance, browsers on macos may draw the checkbox with a hyphen "-" inside to indicate an unexpected state. value the value attribute is one which all <input>s share; however, it serves a special purpose for inputs of type checkbox: ...
...And 4 more matches
HTML elements reference - HTML: Hypertext Markup Language
nt. there can be only one <body> element in a document. content sectioning content sectioning elements allow you to organize the document content into logical pieces. use the sectioning elements to create a broad outline for your page content, including header and footer navigation, and heading elements to identify sections of content. element description <
address> the html <
address> element indicates that the enclosed html provides contact information for a person or people, or for an organization. <article> the html <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). <aside> the html <...
...sents an unordered list of items, typically rendered as a bulleted list. inline text semantics use 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 abbreviation element (<abbr>) represents an abbreviation or acronym; the optional title attribute can provide an expansion or description for the abbreviation. <b> the html bring attention to element (<b>) is used to draw the reader's attention to the element's contents, which are no...
...irectional algorithm to treat the text it contains in isolation from its surrounding text. <bdo> the html bidirectional text override element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. <br> the html <br> element produces a line break in text (carriage-return). it is useful for writing a poem or an
address, where the division of lines is significant. <cite> the html citation element (<cite>) is used to describe a reference to a cited creative work, and must include the title of that work. <code> the html <code> element displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code. <data> the html <data...
...And 4 more matches
Link types - HTML: Hypertext Markup Language
ay. note: although recognized, the singular archive is incorrect and must be avoided. <a>, <area>, <link> <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> eleme...
...while still providing the referer http header (unless noreferrer is used as well). note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab. ...
... <a>, <area>, <form> <link> pingback defines an external resource uri to call if one wishes to make a comment or a citation about the webpage. ...
...And 4 more matches
HTTP caching - HTTP
rmance 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 documents available for back/forward navigation, saving, viewing-as-source, etc. without requiring an
additional trip to the server. it likewise improves offline browsing of cached content. shared proxy caches a shared cache is a cache that stores responses to be reused by more than one user. for example, an isp or your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a number of times, reducing network traffi...
.... a private browser cache may store the response in this case. cache-control: private cache-control: public expiration the most important directive here is "max-age=<seconds>" which is the maximum amount of time a resource will be considered fresh. contrary to expires, this directive is relative to the time of the request. for the files in the application that will not change, you can usually
add aggressive caching. this includes static files such as images, css files and javascript files, for example. for more details, see also the freshness section below. cache-control: max-age=31536000 validation when using the "must-revalidate" directive, the cache must verify the status of the stale resources before using it and expired ones should not be used. for more details, see the validatio...
...update. this is typical of the technical resources included and linked from each web pages: javascript and css files change infrequently, but when they change you want them to be updated quickly. web developers invented a technique that steve souders called revving[1]. ...
...And 4 more matches
Index - HTTP
an http header consists of its case-insensitive name followed by a colon ':', then by its value (without line breaks). leading white space before the value is ignored. ...
...l response if the content has not changed. on the other side, if the content has changed, etags are useful to help prevent simultaneous updates of a resource from overwriting each other ("mid-air collisions"). 59 early-data client hints, http, header, request the early-data header is set by an intermediate to indicates that the request has been conveyed in tls early data, and
additionally indicates that an intermediary understands the 425 (too early) status code. the early-data header is not set by the originator of the request (i.e., a browser). 60 expect http, http header, reference, request header the expect http request header indicates expectations that need to be fulfilled by the server in order to properly handle the request. 61 exp...
... securityerror domexception to be be thrown. 74 forwarded http, http header, reference, request header, header the forwarded header contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. 75 from http, reference, header the from request header contains an internet email
address for a human user who controls the requesting user agent. 76 host http, reference, header the host request header specifies the domain name of the server (for virtual hosting), and (optionally) the tcp port number on which the server is listening. 77 if-match conditional requests, http, http header, reference, request header the if-match http request h...
...And 4 more matches
X-Frame-Options - HTTP
the x-frame-options http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites. the
added security is provided only if the user accessing the document is using a browser that supports x-frame-options. note: the content-security-policy http header has a frame-ancestors directive which obsoletes this header for supporting browsers. header type response header forbidden header name no syntax there are two possible directives for x-frame-options: x-frame-options: deny x-frame-options: sameorigin directives if you specify deny, not only will attempts to ...
...ors directive which you can use instead. examples note: setting x-frame-options inside the <meta> element is useless! for instance, <meta http-equiv="x-frame-options" content="deny"> has no effect. do not use it! x-frame-options works only by setting through the http header, as in the examples below. ...
... http-equiv="x-frame-options" content="deny"> has no effect. do not use it! x-frame-options works only by setting through the http header, as in the examples below. configuring apache to configure apache to send the x-frame-options header for all pages,
add this to your site's configuration: header always set x-frame-options "sameorigin" to configure apache to set the x-frame-options deny,
add this to your site's configuration: header set x-frame-options "deny" configuring nginx to configure nginx to send the x-frame-options header,
add this either to your http, server or location configuration:
add_header x-frame-options sameorigin always; configuring iis to configure iis to send the x-frame-options header,
add this to your site's web.config file: <system.webserver> ... ...
...And 4 more matches
Indexed collections - JavaScript
s this let arr = array(arraylength) // this has exactly the same effect let arr = [] arr.length = arraylength note: in the above code, arraylength must be a number. otherwise, an array with a single element (the provided value) will be created. calling arr.length will return arraylength, but the array doesn't contain any elements. a for...in loop will not find any property on the array. in
addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object: let obj = {} // ... obj.prop = [element0, element1, ..., elementn] // or let obj = {prop: [element0, element1, ...., elementn]} if you wish to initialize an array with a single element, and the element happens to be a number, you must use the bracket syntax. when a single...
...ength = 42 calling array(n) results in a rangeerror, if n is a non-whole number whose fractional portion is non-zero. the following example illustrates this behavior. let arr = array(9.3) // rangeerror: invalid array length if your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. alternatively, create an empty array first before
adding the single element to it. in es2015, you can use the array.of static method to create arrays with single element. let wisenarray = array.of(9.3) // wisenarray contains only one element 9.3 referring to array elements because elements are also properties, you can access the using property accessors. suppose you define the following array: let myarray = ['wind', 'rain', 'fire'] you can ...
... the foreach() method provides another way of iterating over an array: let colors = ['red', 'green', 'blue'] colors.foreach(function(color) { console.log(color) }) // red // green // blue alternatively, you can shorten the code for the foreach parameter with es2015 arrow functions: let colors = ['red', 'green', 'blue'] colors.foreach(color => console.log(color)) // red // gre...
...And 4 more matches
Function.prototype.bind() - JavaScript
ed algorithm are: the partial implementation relies on array.prototype.slice(), array.prototype.concat(), function.prototype.call() and function.prototype.apply(), built-in methods to have their original values. the partial implementation creates functions that do not have immutable "poison pill" caller and arguments properties that throw a typeerror upon get, set, or deletion. (this could be
added if the implementation supports object.defineproperty, or partially implemented [without throw-on-delete behavior] if the implementation supports the __definegetter__ and __definesetter__ extensions.) the partial implementation creates functions that have a prototype property. (proper bound functions have none.) the partial implementation creates bound functions whose length property does not ...
...ions the next simplest use of bind() is to make a function with pre-specified initial arguments. these arguments (if any) follow the provided this value and are then inserted at the start of the arguments passed to the target function, followed by whatever arguments are passed bound function at the time it is called. ...
...nts (if any) follow the provided this value and are then inserted at the start of the arguments passed to the target function, followed by whatever arguments are passed bound function at the time it is called. ...
...And 4 more matches
Image file type and format guide - Web media technologies
image file type details the fo...
...ts used to represent each color component. for example, an rgb color depth of 8 indicates that each of the red, green, and blue components are represented by an 8-bit value. bit depth, on the other hand, is the total number of bits used to represent each pixel in memory. apng (animated portable network graphics) apng is a file format first introduced by mozilla which extends the png standard to
add support for animated images. conceptually similar to the animated gif format which has been in use for decades, apng is more capable in that it supports a variety of color depths, whereas animated gif supports only 8-bit indexed color. apng is ideal for basic animations that do not need to synchronize to other activities or to a sound track, such as progress indicators, activity throbbers, and o...
...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 occupying 3 bytes representing its red, green, and blue components, and each row p
added with 0x00 bytes to a multiple of 4 bytes wide. while other data representations are defined in the specification, they are not widely used and often completely unimplemented. these features include: support for different bit depths, indexed color, alpha channels, and different pixel orders (by default, bmp is written from bottom-left corner toward the right and top, rather than from the top-le...
...And 4 more matches
Progressive web app structure - Progressive web apps (PWAs)
d when needed. the first page load is quick because of the ssr, and the navigation between pages is smooth because the client can re-render the page with only the parts that have changed. pwas can be built using any approach you like, but some will work better than the others. the most popular approach is the "app shell" concept, which mixes ssr and csr in exactly the way described above, and in
addition follows the "offline first" methodology which we will explain in detail in upcoming articles and use in our example application. there is also a new approach involving the streams api, which we'll mention briefly. app shell the app shell concept is concerned with loading a minimal user interface as soon as possible and then caching it so it is available offline for subsequent visits before...
...ested from the server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article — for now let's focus on the structure itself. why should i use it? this architecture allows a website to benefit the most from all the pwa features — it caches the app shell and manages the dynamic content in a way that greatly improves the performance. in
addition to the basic shell, you can
add other features such as
add to home screen or push notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement. the website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. being linkable, ...
...gn it's important to remember the pwa advantages and keep them in mind when designing the application. the app shell approach allows websites to be: linkable: even though it behaves like a native app, it is still a website — you can click on the links within the page and send a url to someone if you want to share it. progressive: start with the "good, old basic website” and progressively
add new features while remembering to detect if they are available in the browser and gracefully handle any errors that crop up if support is not available. for example, an offline mode with the help of service workers is just an extra trait that makes the website experience better, but it's still perfectly usable without it. responsive: responsive web design also applies to progressive web apps, as...
...And 4 more matches
SDK and XUL Comparison - Archive of obsolete content
compatibility although we can't promise we'll never break a high-level api, maintaining compatibility across firefox versions is a top priority for us. we've designed the apis to be forward-compatible with the new multiple process architecture (codenamed electrolysis) planned for firefox. ...
...y for us. we've designed the apis to be forward-compatible with the new multiple process architecture (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. ...
...re (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. security if they're not carefully designed, firefox
add-ons can open the browser to attack by malicious web pages. ...
...And 3 more matches
windows - Archive of obsolete content
enumerate and examine open browser windows, open new windows, and listen for window events. usage the windows module provides basic functions for working with browser windows. with this module, you can: enumerate the currently opened browser windows open new browser windows listen for common window events such as open and close private windows if your
add-on has not opted into private browsing, then you won't see any private browser windows. private browser windows won't appear in the browserwindows property, you won't receive any window events, and you won't be able to open private windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. converting to chrome ...
...s example uses the action button api, which is only available from firefox 29 onwards. parameters options : object required options: name type url string string url to be opened in the new window. this is a required property. isprivate boolean boolean which will determine whether the new window should be private or not. if your
add-on does not support private browsing this will have no effect. see the private-browsing documentation for more information. optional options: name type onopen function a callback function that is called when the window has opened. this does not mean that the url content has loaded, only that the window itself is fully functional and its propert...
...ndows").browserwindows; windows.on('activate', function(window) { console.log("a window was activated."); var activewindowtitle = windows.activewindow.title; console.log("active window title is: " + activewindowtitle); }); events the browserwindows property emits the following events which can be listened to using its on function. ...
...And 3 more matches
core/promise - Archive of obsolete content
returns an object that represents a eventual result, either successful or failed. this object is a promise, both figuratively and by name, to eventually resolve. we can call a function on the promise to observe either its fulfillment or rejection. if the promise is rejected and the rejection is not explicitly observed, any derived promises will be implicitly rejected for the same reason. in the
add-on sdk we follow commonjs promises/a specification and model a promise as an object with a then method, which can be used to get the eventual return (fulfillment) value or thrown exception (rejection): foo().then(function success(value) { // ... }, function failure(reason) { // ... }); if foo returns a promise that gets fulfilled with the value, success callback (the value handler) will be ...
...olved to a return value of an operation and errors propagate through the promise chains. in general good rule of thumb is to prefer then based flat chaining. it makes code easier to read and make changes later: var data = readasync(url). // read content of url asynchronously then(parse). // parse content from the url then(extractquery). ...
...se). // parse content from the url then(extractquery). ...
...And 3 more matches
Finding window handles - Archive of obsolete content
k, see for example http://developer.mozilla.org/en/docs..._of_interfaces another way to find a window handle... is to query it from an object. once you have a docshell, queryinterface it into nsibasewindow, call getmainwidget on result, and then call getnativedata(ns_native_window). like this hwnd gethwnd(nsibasewindow *window) { nscomptr< nsiwidget > widget; window->getmainwidget(getter_
addrefs(widget)); if (widget) return (hwnd) widget->getnativedata(ns_native_window); } yet another way to find a window handle (parent window handle) this method is for people who want to get the top level window hwnd from the window object in javascript. comparing to the method above, by using this method, you don't have to compile your component with nsiwidget.h and other bunchs of h fil...
...the string is made into an actual gdkwindow* like this: var gdkwindow = ctypes.structtype('gdkwindow'); var gdkwindowptrstring = basewindow.nativehandle; var gdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); working with gdkwindow* gdkwindow* to xid var gdkwindow = ctypes.structtype('gdkwindow'); var gdkdrawable = ctypes.struct...
...nce. the "user data" is accessed by using the gdk function of gdk_window_get_user_data. var gdkwindow = ctypes.structtype('gdkwindow'); var gpointer = ctypes.voidptr_t; var gtkwindow = ctypes.structtype('gtkwindow'); var gdkwindowptrstring = basewindow.nativehandle; var gdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); var gptr = gpointer(); gdk_window_get_user_data(gdkwinptr, gptr.
address()); var gtkwinptr = ctypes.cast(gptr, gtkwindow.ptr); working with gtkwindow* gtkwindow* to xid // soon to come gtkwindow* to gdkwindow* how to get a gdkwindow* from the gtkwindow*? there is a gtk+ provided function for this, gtk_widget_get_window. the gtkwindow* is cast to a gtkwidget*, and this is passed to the gtk_widget_get_window function which returns a gdkwindow*. var gdkwindow ...
...And 3 more matches
On page load - Archive of obsolete content
plications you target) of the following xul documents: application uri to overlay firefox chrome://browser/content/browser.xul thunderbird chrome://messenger/content/messenger.xul navigator from seamonkey chrome://navigator/content/navigator.xul attaching a script attach a script to your overlay (see "attaching a script to an overlay") that
adds a load event listener to appcontent element (browsers) or messagepane (mail): window.
addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myextension.init(); },false); var myextension = { init: function() { var appcontent = document.getelementbyid("appcontent"); // browser if(appcontent){ a...
...vent listener to appcontent element (browsers) or messagepane (mail): window.
addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myextension.init(); },false); var myextension = { init: function() { var appcontent = document.getelementbyid("appcontent"); // browser if(appcontent){ appcontent.
addeventlistener("domcontentloaded", myextension.onpageload, true); } var messagepane = document.getelementbyid("messagepane"); // mail if(messagepane){ messagepane.
addeventlistener("load", function(event) { myextension.onpageload(event); }, true); } }, onpageload: function(aevent) { var doc = aevent.originaltarget; // doc is document that triggered "onload" event /...
...} }, onpageload: function(aevent) { var doc = aevent.originaltarget; // doc is document that triggered "onload" event // do something with the loaded page. // doc.location is a location object (see below for a link). // you can use it to make your code executed on certain pages only. if(doc.location.href.search("forum") > -1) alert("a forum page is loaded"); //
add event listener for page unload aevent.originaltarget.defaultview.
addeventlistener("unload", function(event){ myextension.onpageunload(event); }, true); }, onpageunload: function(aevent) { // do something } }; current firefox trunk nightlies will fire the onpageload function for not only documents, but xul:images (favicons in tabbrowser). if you only want to handle documents, ensu...
...And 3 more matches
Progress Listeners - Archive of obsolete content
note that the browser uses a weak reference to your listener object, so make sure to keep an external reference to your object to ensure...
...note that the browser uses a weak reference to your listener object, so make sure to keep an external reference to your object to ensure that it stays in memory. when used with a tabbrowser, you cannot choose which types of events that will be recei...
...mpted notifications are optional. the tabbrowser uses a strong reference to your listener object. gecko 2.0 note starting in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), all events are optional. the tabbrowser only notifies you of the events for which you provide a callback. remember to change mylistener to a unique identifier. example: notification when the value in
address bar changes a commonly asked question is how to get notified whenever the url in the
address bar (also known as location bar) changes. using the following code, you will get notified when user navigates to another page (by clicking a link, using the back/forward button, by typing an
address in the location bar, etc.) and also when user switches tabs. var myextension = { oldurl: null, ...
...And 3 more matches
JavaScript Daemons Management - Archive of obsolete content
s) and then to create a constructor for such a class of objects (daemon) in order to standardize and simplify the instantiation of them. note: a minimalistic version of it (minidaemon) is published here. this more complex version of it is nothing but a big and scalable collection of methods for the daemon constructor. but 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 will remain the recommended way for simple animations, because daemon without its collection of methods is essentially a clone of it. the architecture of the daemon constructor explicitly avoids the use of closures. it also offers an alternative way to pass the this object to t...
... way to pass the this object to the callback functions (see the "this" problem for details). advantages of this approch: abstraction passage of this object to javascript timers (both setinterval and settimeout) optimisation (avoiding closures) modularity the code the code of this framework is split into three files: daemon.js (the core) daemon-safe.js (an extension of the core which
adds a replacement of setinterval with a recursive invocation of settimeout) daemon-methods.js (a wide and highly scalable collection of methods) the only independent module is daemon.js: both the daemon-safe.js module and the daemon-methods.js module require daemon.js to work. for a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your ...
...s: both the daemon-safe.js module and the daemon-methods.js module require daemon.js to work. for a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your choice, directly download this .zip file. about the “callback arguments” polyfill in order to make this framework compatible with internet explorer (which doesn't support sending
additional parameters to timers' callback function, neither with settimeout() or setinterval()) we included the ie-specific compatibility code (commented code), which enables the html5 standard parameters' passage functionality in that browser for both timers (polyfill), at the end of the daemon.js module. daemon.js what follows is the module that declares the daemon constructor (the core of this f...
...And 3 more matches
JavaScript Object Management - Archive of obsolete content
« previousnext » chrome javascript in this section we'll look into how to handle javascript data effectively, beginning with chrome code, in ways which will prevent pollution of shared namespaces and conflicts with other
add-ons resulting from such global namespace pollution. 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. ...
...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. if your
add-on is called sergeant pepper, for instance, then sgtpepper would be a good namespace name. /** * 〈namespace〉 namespace. */ if (typeof 〈namespace〉 == "undefined") { var 〈namespace〉 = {}; }; note: the naming standard that we normally follow is that the first part of the namespace corresponds to the development group (or company), and the second to the specif...
...indexed arrays: // equivalent. 〈namespace〉.hello = {}; 〈namespace〉["hello"] = {}; // equivalent. 〈namespace〉.hello.init(); 〈namespace〉.hello["init"](); this is very useful in cases where you have to set attributes or functions with dynamically generated names. it's one of the funky properties of javascript: all objects are nothing more than name / value mappings. you can
add or replace functions and attributes to any javascript object, at any moment you want. this is an odd, but powerful feature that comes in handy at times when things get complicated. for instance, you could replace a method in any object in the firefox chrome, so that it behaves differently than how it normally does. this should be a last resort option, but it is very useful at times. you usuall...
...And 3 more matches
Security best practices in extensions - Archive of obsolete content
other items are recommendations. the difference will be clearly flagged. this is written from the perspective of a firefox extension, but most items apply to extensions for other mozilla-based applications such as thunderbird or seamonkey. ...
...other items are recommendations. the difference will be clearly flagged. this is written from the perspective of a firefox extension, but most items apply to extensions for other mozilla-based applications such as thunderbird or seamonkey. ...
...l, this means the content has been registered with firefox and has full access. content from a domain (such as http://www.example.com) can only access that same domain. files loaded using the file protocol can access files on the user's disk and other local devices. there are ways to get around the content/chrome security barrier, if for example, you want a web page to send a notification to the
add-on (or vice versa). one way to do this is to use custom dom events; see interaction between privileged and non-privileged pages. regardless of where the document comes from, you can further restrict what it can do by applying properties to the document holder, known as the docshell. frame.docshell.allowimages = false; frame.docshell.allowjavascript = false; frame.docshell.allowplugins = false...
...And 3 more matches
JXON - Archive of obsolete content
a javascript object tree (i.e. a tree of nested instances of object) and viceversa, with some different algorithms. it could be useful to read the xml introduction article first. if you want a complete bidirectional jxon library (modelled on the json global object), skip to the dedicated paragraph (but please read the note about the const statement compatibility). note: if you are interested to
address only some parts of an xml document (and are not starting in javascript/json for templating purposes), use xpath instead of converting the whole document into json. conversion snippets now imagine you have this sample xml document: example.xml <?xml version="1.0"?> <!doctype catalog system "catalog.dtd"> <catalog> <product description="cardigan sweater"> <catalog_item gender="men's"> ...
...tree.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 prevents new properties from being
added to it, prevents existing properties from being removed and prevents 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": { "keyvalue": "qwz5671" }, "p...
... = 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 prevents new properties from being
added to it, prevents existing properties from being removed and prevents 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": { "keyvalue": "qwz5671" }, ...
...And 3 more matches
Drag and Drop Example - Archive of obsolete content
x 3.5) and later supports a newer and simpler api. 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. we'll use some style properties to set the width and height of the stack. a maxi...
...o respond to the dragdrop event so that an element is created when the user drags onto it. <stack id="board" style="width:300px; height: 300px; max-width: 300px; max-height: 300px" ondragover="nsdraganddrop.dragover(event, boardobserver)" ondragdrop="nsdraganddrop.drop(event, boardobserver)"> </stack> the board only needs to respond to the dragdrop and dragover events. we'll
add a boardobserver to the file dragboard.js in a moment. next, a palette will be
added to the right side of the window. it will contain three buttons, one to create new buttons, one to create check boxes and the other to create textboxes. this buttons will respond to the draggesture event and start a drag. <vbox> <button label="button" elem="button" ondraggesture="nsdraganddrop...
... elem="checkbox" ondraggesture="nsdraganddrop.startdrag(event, listobserver)"/> <button label="text box" elem="textbox" ondraggesture="nsdraganddrop.startdrag(event, listobserver)"/> </vbox> the nsdraganddrop object will be called to do most of the work. we'll create a listobserver object that will set the data to be dragged. note that each button here has an
additional elem attribute. this is a made-up attribute. xul doesn't handle it and just ignores it, but we can still retrieve it with the dom's getattribute function. we need this so that we know what type of element to create when dragging. next, we'll define the two listener objects. first, the listobserver which needs a function to handle the start of the drag. var listobserver = { ondragstart: f...
...And 3 more matches
Block and Line Layout Cheat Sheet - Archive of obsolete content
odeep().) ns_frame_has_dirty_children ns_frame_has_view ns_frame_independent_selection ns_frame_is_special nsblockframe mflags these flags are the private flags that are meaningful to block frames. ns_block_shrink_wrap causes the block to "shrink-wrap" around its content. this means the block will determine its children's width and make its content area that wide. finally, it will
add p
adding and border to determine the final width. is this where the "tending towards zero width" stuff comes in? ns_block_no_auto_margins ns_block_margin_root indicates that this is a frame from which child margins can be calculated. the absence of this flag implies that child margin calculations should ignore the frame and look further up the parent chain. used in nsblockreflowcontext::comput...
...ly. a block frame has one nslinebox for each line, and one nslinebox for each block child. these are stored as a doubly-linked list in the mlines member of nsblockframe. ...
...ontent area, p
adding, border, or margin. nshtmlreflowstate the current state of reflow, built up as reflow recursively descends the frame tree. this is "passed in" to a child frame from its parent, and provides the constraints in which the child frame must size itself; e.g. the width and height available to the child frame. mcomputedwidth mcomputedheight mcomputedmargin mcomputedborderp
adding mcomputedp
adding mcomputedoffsets mcomputedminwidth mcomputedmaxwidth mcomputedminheight mcomputedmaxheight given the current container frame and the style applied to the child, these values are the resolved values for the child frame's box. nshtmlreflowmetrics the structure that is "filled in" by a frame during reflow, and is used to communicate the frame's desired size inform...
...And 3 more matches
Building Firefox with Rust code - Archive of obsolete content
this article is obsolete. please instead refer to the documentation found within the modern firefox build system documentation; specifically, the section called including rust code in firefox. firefox uses the rust programming language extensively. this page is a rough guide for people using rust in firefox. see also the documentation on this topic on the oxidation wiki page.
adding rust code we generally target stable rust, but sometimes issues temporarily require a beta or custom toolchain build. our goal is to always ship a firefox release build with a stable rust toolchain release. if you don't have rust already, use the rustup tool to install it and update as new releases become available, or use the ./mach bootstrap command. the build system will generate a special 'rust unifie...
...e the rustup tool to install it and update as new releases become available, or use the ./mach bootstrap command. the build system will generate a special 'rust unified library' crate, compiled to a static library (libgkrust.a) which is in turn linked into xul, so all public symbols will be available to c++ code. ...
...e the ./mach bootstrap command. the build system will generate a special 'rust unified library' crate, compiled to a static library (libgkrust.a) which is in turn linked into xul, so all public symbols will be available to c++ code. if you have new rust libraries that code in libxul calls directly, then you should
add the appropriate extern crate lines in toolkit/library/rust/shared/lib.rs, and
add those libraries (crates) as dependencies in toolkit/library/rust/cargo.toml. ...
...And 3 more matches
Layout System Overview - Archive of obsolete content
'navquirks' modes. (doctype and modes are explained in more detail in article mozilla's doctype sniffing. galley and page presentations: the presentation generally is constrained by the width of the window in which the presentation is to be displayed, and a height that extends as far as necessary. this is referred to as the galley mode presentation, and is what one expects from a typical browser.
additionally, layout must support a paginated presentation, where the width of the presentation is constrained by the dimensions of the printed output (paper) and the height of each page is fixed. this paged presentation presents several challenges not present in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimensions. ...
... for large documents because the user does not have to wait for the 200th page of text to be read in before the first page can be displayed - they can start reading something right away. so really, this sequence of operations resolve style, create frame, layout frame, gets repeated many times as the content becomes available. in the normal in-flow case this is quite natural because the sequential
addition of new content results in sequential
addition of new frames, and because everything is in-flow, the new frames do not influence the geometry of the frames that have already been formatted. when out-of-flow frames are present this is a more difficult problem, however. sometimes a content element comes in incrementally, and invalidates the formatting of some of the frames that precede it, fram...
... and reflow again the impacted frames. this is referred to as an incremental reflow. another responsibility of layout is to manage dynamic changes to the content model, changes that occur after the document has been loaded and (possibly) presented. these dynamic changes are caused by manipulations of the content model via the dom (generally through javascript). when a content element is modified,
added or removed, layout is notified. if content elements have been inserted, new frames are created and formatted (and impacts to other frames are managed by performing further incremental reflows). if content is removed, the corresponding frames are destroyed (again, impacts to other elements are managed). if a content element is modified, layout must determine if the change influences the formatti...
...And 3 more matches
Actionscript Acceptance Tests - Archive of obsolete content
in a package or define classes as the file will be wrapped in a function when used in the ats. if you must use classes, define them in a sub-dir with the same name as the test. you must create a testname.as.avm_args file with the uses_swfversion directive. support files: there are a variety of support files available for non-standard actionscript tests. testname.as.asc_args this file specifies
additional arguments to pass to asc when compiling the test: # asc args for file # two modes are available: # override| all command line arguments (except builtin.py) are ignored and replaced by these # merge| merge these args in with the current args # specifiy an arg that starts with -no will disable the arg... eg: -no-optimize merge| -as3 a dir.asc_args file can also be created with the same cont...
...re ignored and replaced by these # merge| merge these args in with the current args # specifiy an arg that starts with -no will disable the arg... eg: -no-optimize merge| -as3 a dir.asc_args file can also be created with the same contents that will apply to the entire directory. testname.as.asc_args files will take precedence over the dir.asc_args file. testname.as.avm_args this file specifies
additional arguments to pass to the shell when running the test - the user can use the special variable $dir to refer to the current directory. this example passes in another .abc file as an argument to the file being run: -- $dir/file.abc another use would be to pass a specific argument to the shell: -dtimeout this file can have multiple lines with different arguments. when there are multiple lin...
...hen there are multiple lines, the harness will re-run the test for every line passing along the different arguments. there is one special keyword that can be used, uses_swfversion. when that keyword is encountered, the test harness will run the test against all possible -swfversion versions: uses_swfversion is the equivalent of: -swfversion 9 -swfversion 10 -swfversion 11 -swfversion 12 ... any
additional args on the uses_swfversion line will be passed to each run of the vm. (see bug 587093 for details.) specifying multiple .abcs: if you desire to run a test with multiple .abc files (e.g: avmshell a.abc b.abc testname.abc) there is a special avm_args directive called multiabc that is specified surrounded by two pipe (|) symbols: |multiabc| $dir/testname_support/a.abc $dir/testname_support/...
...And 3 more matches
Install script template - Archive of obsolete content
/** doron rosenberg -- doronatnospamallowedherenetscape.com arun k. ranganathan -- aruneratnospamallowedherenetscape.com petter ericson -- petteratnospamallowedherecycore.com this is an install.js file that does the following -- 1. installs to the current browser that is invoking the installation 2.
additionally installs to a secondary location on the windows desktop, in this case c:\winnt\system32\myplugin\ 3. writes registry keys exposing the above secondary install location for other browsers to find. the keys are written according to the specification: http://mozilla.org/projects/plugins/first-install-problem.html and follows the plid specification: http://mozilla.org/projects/plugins/plugin-identifier.html **/ // define some global variables var plugin_file ...
...- if we fail here, cancel the installation // initinstall is quite an overloaded method, but i have invoked it here with three strings // which are globally defined err = initinstall(software_name, plid, version); if (err != 0) { // call initinstall again in case illegal characters in plid err = initinstall(software_name, software_name, version); if (err != 0) cancelinstall(err); } //
addfiles to current browser block var pluginsfolder = getfolder("plugins"); //verify disk space if(verifydiskspace(pluginsfolder, plugin_size+component_size)) { // start installing plugin shared library reseterror(); // install the plugin shared library to the current browser's plugin directory errblock1 =
addfile (plid, version, plugin_file, pluginsfolder, null); if (errblock1!=0) { lo...
...wser block var pluginsfolder = getfolder("plugins"); //verify disk space if(verifydiskspace(pluginsfolder, plugin_size+component_size)) { // start installing plugin shared library reseterror(); // install the plugin shared library to the current browser's plugin directory errblock1 =
addfile (plid, version, plugin_file, pluginsfolder, null); if (errblock1!=0) { logcomment("could not
add " + plugin_file + " to " + pluginsfolder + ":" + errblock1); cancelinstall(errblock1); } // start installing xpt file if this is a scriptable plugin // install to the plugins directory -- this works well in mozilla 1.0 clients // in mozilla 1.0 clients, the components directory can be avoided for xpt files errblock1 =
addfile (plid, version, component_file, pluginsfolder, null); if (er...
...And 3 more matches
appendItem - Archive of obsolete content
« xul reference home 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. ...
... « xul reference home 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. ...
... « xul reference home 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. ...
...And 3 more matches
Menus - Archive of obsolete content
ser may select a command to invoke it, or may cancel the operation by pressing escape or clicking outside the menu. xul provides a number of tags for creating menus. these tags can be used to create menus which sit on a menubar or are attached to buttons. submenus may be created by nesting one menu inside of another. no special code needs to be written to open or close a menu or submenu, and, in
addition, the menus are placed on screen in the appropriate locations automatically. there are four elements that a menupopup can be attached to. in each case, the menupopup element is placed as a direct child of the element. the following is a brief summary of these elements, examples of each will be provided later. menu the menu tag is used when placing menus on a menu bar. for example, the fi...
... to place other elements on a menubar, but remember that they will not appear on a macintosh. so you should ensure that the functionality of these elements is avialable elsewhere. or, you could write code that handles multiple platforms in different ways. if you do place other elements on a menubar, you may wish to align them on the far side rather than next to the other menus. you can do this by
adding a flexible spacer. <menubar id="sample-menubar"> <menu id="file-menu" label="file"> ... </menu> <spacer flex="1"/> <image src="logo.png"/> </menubar> in this example, a logo image is placed on the end of a menubar. the menupopup element the menupopup element is the popup that displays the menu items. when used for menus on a menubar, the menupopup should be a child of the menu...
... </menupopup> </menu> when the menu is clicked, it opens the menupopup contained within it. for this reason, a menupopup should be placed as a direct child of the menu. the menu can also be opened by using the keyboard. the user can press a key to highlight the menu labels and navigate with the cursor keys. the key is different for each platform; on windows f10 can be used. another way is to
add shortcut keys called access keys for each menu element to make it easier to access the menu commands. on some platforms,
adding an access key will underline a letter in the menu label indicating the key to press. for this reason, the access key should always correspond to a character that appears in the menu label. to set an access key for a menu, use the accesskey attribute, as in the example b...
...And 3 more matches
Containment Properties - Archive of obsolete content
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. <vbox datasources="template-guide-ex1.rdf" ref="http://www.xulplanet.com/rdf/a" containment="http://www.xulplanet.com/rdf/relateditem"> <template> <rule> <label uri="rdf:*" value="rdf:*"/> </rule> </template> </vbox> instead of iterating over a container, this example iterates over a specific predicate. this attribute is u...
...ng over a container, this example iterates over a specific predicate. this attribute is useful when the rdf data is structured in such a way that an rdf container isn't used. the builder treats the predicate in the containment attribute as an indicator that an element is a container. if the starting node (or ref) has that predicate as one of its triples in the rdf data, 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 previous example is a a couple of a...
...g 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 previous 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 starting resource is a container with two children. ...
...And 3 more matches
Filtering - Archive of obsolete content
« previousnext » adjusting the query sometimes you may wish to change the query at a later time. 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. function applyfilter(country) { var cond = document.getelementbyid("cond"); var triple = document.getelementbyid("filtertriple"); if (country) { if (!triple) { triple = document.createelement("triple"); triple.id = "filtertriple"; tr...
...ject", "?photo"); triple.setattribute("predicate", "http://www.xulplanet.com/rdf/country"); } triple.setattribute("object", country); cond.appendchild(triple); } else if (triple) { cond.removechild(triple); } document.getelementbyid("photoslist").builder.rebuild(); } the 'country' argument to the applyfilter function holds the value to filter by. if this is set, we
add a filter, otherwise we remove it. the code is fairly straightforward. a new <triple> element is created and the object attribute is set to the value to filter by. for example, the resulting triple for the netherlands might be: <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="http://www.daml.org/2001/09/countries/iso#nl"/> this triple is then appe...
... object="http://www.daml.org/2001/09/countries/iso#nl"/> this triple is then appended to the query. the triple is given an id so that it can be found later if a different filter is applied. naturally, we only want to apply one filter at a time, so we can just reuse the same triple for each filter. when removing the filter, we only need to remove the triple from the query. this example only
adds one triple, but you could
add others, or
add <member> elements. whether a triple or member is
added or removed, the template must be rebuilt by calling the rebuild method. this method will remove all of the existing generated content, delete all of the internal information pertaining to the results, and start again as if the template were just being examined for the first time. the template will...
...And 3 more matches
Template and Tree Listeners - Archive of obsolete content
existing content will be removed and generated fresh. the willrebuild method of any listeners will be called before the content is removed, and didrebuild method will be called when the content has been regenerated. this listener will also work for tree builders, and will call the appropriate methods before and after the tree has been generated. ...
...since the content goes away during a rebuild, the selection is lost, so it is restored here during the didrebuild method. the firefox bookmarks window uses this technique. ...
...it on to the tree. the tree widget informs the view when certain operations are performed that might affect the data. the tree view handles all of these operations, but allows an observer to be attached which is invoked during these operations. for instance, the observer may have an ontoggleopenstate method which will be called when the user opens or closes a row. the tree builder will handle the
adding or removing of rows, but will call the observer so that it can perform some task. the tree builder observer implements the nsixultreebuilderobserver interface and may be attached to a tree builder using the builder's
addobserver method. you can
add more than one observer if needed, and can remove them again with the builder's removeobserver method. the observer is always invoked before the app...
...And 3 more matches
Creating a Skin - Archive of obsolete content
wing: (if you are using firefox 1.5 or later, see manifest files instead of below) create a directory somewhere where you want to place the skin files. copy a manifest file (contents.rdf) from the classic or modern skin into this new directory. modify the references in the manifest file to a custom name for your skin. for example, change references of 'classic/1.0' to 'blueswayedshoes/1.0'. ...
...rom the classic or modern skin into this new directory. modify the references in the manifest file to a custom name for your skin. for example, change references of 'classic/1.0' to 'blueswayedshoes/1.0'.
add a line to the file 'chrome/installed-chrome.txt of the following form: skin,install,url,file:///stuff/blueswayedshoes/ where the last part points to the directory you created. make sure to
add a slash at the end. copy the original findfile.css into the new directory. we'll use this as a basis for the new skin. we can then refer to it using the url 'chrome://findfile/skin/findfile.css'.
adding style rules first, let's decide what kind of changes we want to make. we'll make some simple color changes, modify the button styles, and modify the spacing a bit. let's start with the menus, ...
...new directory. we'll use this as a basis for the new skin. we can then refer to it using the url 'chrome://findfile/skin/findfile.css'.
adding style rules first, let's decide what kind of changes we want to make. we'll make some simple color changes, modify the button styles, and modify the spacing a bit. let's start with the menus, toolbars and the overall tab panel. the following style rules
added to findfile.css will cause the changes shown in the accompanying image. window > box { background-color: #0088cc; } menubar,menupopup,toolbar,tabpanels { background-color: lightblue; border-top: 1px solid white; border-bottom: 1px solid #666666; border-left: 1px solid white; border-right: 1px solid #666666; } caption { background-color: lightblue; } the inner box of the w...
...And 3 more matches
Cross Package Overlays - Archive of obsolete content
feature. in the examples in the previous section, the overlays were imported by the window. 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. we'll use this feature to
add a toolbar to the mozilla browser window. the mozilla mail application uses overlays to
add content to the browser window. for example, if mail is not installed, there will be no new message command. however, if mail is installed, an overlay will be applied to the menu to
add the new message command. below, we'll a...
... our find files example first, let's create a simple overlay. ...
...wever, if mail is installed, an overlay will be applied to the menu to
add the new message command. below, we'll
add a find files toolbar to the browser. it probably wouldn't be useful to have this feature, but we'll do it anyway. mozilla allows you to
add a list of overlays to the contents.rdf file that you use to list chrome packages, skins and locales. once you have created an overlay, you can
add it to the contents.rdf file. then
add items, one for each window that you want the overlay to apply to. our find files example first, let's create a simple overlay. it will just have a few elements for entering a filename and directory to search. call the file foverlay.xul and
add it to the findfile directory along with findfile.xul. our foverlay.xul example source <?xml version="1.0"?
...And 3 more matches
Element Positioning - Archive of obsolete content
'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 elements, such as textboxes have a default size, which will be used. a box will be large enough to hold the elements inside the box. a horizontal box with three buttons in it will be as wide as the three buttons, plus a small amount of p
adding. in the image, the first two buttons have been given a suitable size to hold their text. the third button is larger because it contains more content. the width of the box containing the buttons is the total width of the buttons plus the p
adding between them. the height of the buttons is a suitable size to hold the text. width and height attributes you may need to have more control over th...
...an example is shown below: example 1: source view <button label="ok" width="100" height="40"/> however, it is not recommended that you do this. ...
...100em; height: 10px;"/> <button label="3" flex="1" style="min-width: 50px;"/> <button label="4" flex="1" style="min-height: 2ex; max-width: 100px"/> <textbox flex="1" style="max-width: 10em;"/> <description style="max-width: 50px">this is some boring but simple wrapping text.</description> example 1 the first button will be displayed with a width of 100 pixels (px means pixels). you need to
add the unit or the width will be ignored. example 2 the second button will be displayed with a height of ten pixels and a width of 100 ems (an em is the size of a character in the current font). example 3 the third button is flexible so it will grow based on the size of the box the button is in. however, the button will never shrink to be less than 50 pixels. other flexible components such as ...
...And 3 more matches
Install Scripts - Archive of obsolete content
findfile folder in the chrome folder and pass it directly to the setpackagefolder() function. the second argument to getfolder() is the subdirectory which we are going to install into, which doesn't have to exist. you can leave this argument out entirely if you don't need one. setting install files next, you need to specify which files should be installed. this involves the use of two functions,
adddirectory() and
addfile(). the
adddirectory() function tells the installer that a directory from the xpi archive (and all of its contents) should be installed to a particular location. the
addfile() is similar but for a single file. both the
adddirectory() and
addfile() functions have various forms. the simplest takes only one argument, the directory from the installer to install to the assigned i...
...we can call these functions multiple times to install other files. next, we'll want to register the find files in the chrome system so that it can be used with a chrome url. ...
...we can call these functions multiple times to install other files. ...
...And 3 more matches
More Event Handlers - Archive of obsolete content
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. ...
... 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. ...
...propagation, call the event object's stoppropagation method, as in the following example. example 2 : source view <hbox id="outerbox"> <button id="okbutton" label="ok"/> </hbox> <script> function buttonpressed(event){ alert('button was pressed!'); } function boxpressed(event){ alert('box was pressed!'); event.stoppropagation(); } var button = document.getelementbyid("okbutton"); button.
addeventlistener('command',buttonpressed,true); var outerbox = document.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 rem...
...And 3 more matches
More Menu Features - Archive of obsolete content
this is similar to the example above. <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem label="open search..." accesskey="o"/> <menuitem label="sa...
... label="new"> <menupopup id="new-popup"> <menuitem label="window"/> <menuitem label="message"/> </menupopup> </menu> <menuitem label="open"/> <menuitem label="save"/> <menuseparator/> <menuitem label="exit"/> </menupopup> </menu> </menubar> </toolbox>
adding a menu to our find files example let's
add a menu to the find files dialog. we'll just
add a few simple commands to a file menu and an edit menu. this is similar to the example above. <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem label="open search..." accesskey="o"/> <menuitem label="save search..." accesskey="s"/> <menuseparat...
...you will see in the image that this letter has been underlined in the menu label. also, the past...
...And 3 more matches
The Box Model - Archive of obsolete content
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. you can think of a box as one row or one column from an html table. various attributes placed on the child elements in
addition to some css style properties control the exact position and size of the children. box elements the basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox> <!-- vertical elements --> </vbox> the hbox element is used to create a horizontally oriented box. each element placed in the hbox will be placed horizontally in a row. the vbox element is used to crea...
...ties control the exact position and size of the children. box elements the basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox> <!-- vertical elements --> </vbox> the hbox element is used to create a horizontally oriented box. each element placed in the hbox will be placed horizontally in a row. the vbox element is used to create a vertically oriented box.
added elements will be placed underneath each other in a column. there is also a generic box element which defaults to horizontal orientation, meaning that it is equivalent to the hbox. however, you can use the orient attribute to control the orientation of the box. you can set this attribute to the value horizontal to create a horizontal box and vertical to create a vertical box. thus, the two lines...
...ee buttons vertically. example 1 : source view <vbox> <button id="yes" label="yes"/> <button id="no" label="no"/> <button id="maybe" label="maybe"/> </vbox> 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 previous 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 previous one. the example below shows a simple login pr...
...And 3 more matches
Trees and Templates - Archive of obsolete content
multiple rules can be used to indicate different content for different types of data. ...
...multiple rules can be used to indicate different content for different types of data. ...
...etscape.com/nc-rdf#name"/> <treecell label="rdf:http://home.netscape.com/web-rdf#lastmodifieddate"/> </treerow> </treeitem> </treechildren> </rule> </template> </tree> here, a tree is created with two columns, for the name and date of a file. the tree should display a list of the files in the root directory. only one rule is used, but you may
add others if needed. like with other templates, the uri attribute on an element indicates where to start generating content. the two cells grab the name and date from the datasource and place the values in the cell labels. this example shows why the uri attribute becomes useful. notice how it has been placed on the treeitem in the example, even though it is not a direct descendant of the rule elemen...
...And 3 more matches
Using Visual Studio as your XUL IDE - Archive of obsolete content
e / autocompletion for elements and attributes validation syntax coloring (okay, more sophisticated editors like notepad++ provide this as well) before you can use all of this, you have to adjust visual studio a little. 1. setting the correct editor as xul files are nothing but xml, you can use the normal xml-editor for writing xul. go to tools > options... > text editor > file extension and
add the extension "xul" with "xml editor". as you are already there, you can do the same for "xbl". 2. using xml schemas for validation and intellisense visual studio needs the xml schema for xul files. there is a very nice schema created by mihailo lalevic. you can download it at xulschema.codeplex.com under the downloads tab. you should be able to use the schema in other ide's too. there is also p...
...he downloads tab. you should be able to use the schema in other ide's too. there is also project that provides xml schema for install manifest files (install.rdf) - installrdfschema.codeplex.com - from the same author as a xul schema. the codeplex-page provides some instructions for installing the schema, but there is an easier way. if you already have a xml or xul file opened, visual studio will
add the menu item xml to the main menu. just use xml > schemas... to
add the xul.xsd from the package that you have downloaded. the other xsd files will be
added automatically. visual studio will use the schema based on the namespace, so make sure your window element uses the correct xul namespace http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul. 3. xbl if you are writing your own eleme...
...mihailo posted some instructions in this codeplex discussion. 4. ...
...And 3 more matches
XUL accessibility guidelines - Archive of obsolete content
s 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 previous 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 tool can replace human judgement for accessibility, and underst...
...user. toolbarbuttons by default, toolbar buttons cannot receive focus 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 preview" 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 ke...
... return true; } return false; } changing focus unexpectedly can confuse or disorient users. a common example of this occurrence in the us is with phone number form fields. us phone numbers are often displayed on the web in two main formats xxx-xxx-xxxx or (xxx) xxx-xxxx. to enforce this pattern some forms provide three form fields. the problem occurs when a developer decides to
add functionality that jumps the user to the second form field once 3 digits have been entered into the first form field. this behavior is then repeated for the next form field. users who are used to navigating form fields themselves often end up repeating the jump operation and thereby skipping ahead one form field. initial dialog focus the initial focus in a xul dialog (i.e., the focus when the d...
...And 3 more matches
label - Archive of obsolete content
l, it will move the focus to the associated control, specified with the control attribute. more information is available in the xul tutorial. attributes accesskey, control, crop, disabled, href, value properties accesskey, accessibletype, control, crop, disabled, value style classes header, indent, monospace, plain, small-margin, text-link examples <label value="email
address" control="email"/> <textbox id="email"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. control type: id this attribute specifies the id of the element with which the label is associated. when the user clicks on the labe...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. href type: string defines a url to open when this element is clicked. requires the class attribute to include text-link. value type: string the text to be used for the label. properties accesskey type: character gets and sets the value of the accesskey attribute. accessibletype type: integer a value indicating...
...And 3 more matches
prefwindow - Archive of obsolete content
window features: "chrome,titlebar,toolbar,centerscreen,dialog=yes". ...
...wing values can be used in the list: accept: the ok button, which will accept the changes when pressed. this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional
additional button. you can set its label with the buttonlabelextra1 attribute and its command with the ondialogextra1 attribute. extra2: a second optional
additional button. you can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a si...
...his attribute to "," (a single comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an
additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). defaultbutton type: string normally this attribute should not be set, but if it is, i...
...And 3 more matches
richlistbox - Archive of obsolete content
on. firefox 3 introduced multiple selection to rich list boxes. ...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. disablekeynavigation type: boolean if this attribute is not used, the user can navigate to specific items within the element by pressing keys corresponding to letters in the item's label. this is done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. preference type: id connects ...
...e suppressonselect attribute. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
...And 3 more matches
toolbar - Archive of obsolete content
these are toolbars that are not children of a toolbox element. ...
... 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() method. more information is available in the xul tutorial. note: starting in gecko 1.9.1, toolbar items are moved from the toolbarpalette and
added to the toolbar when a toolbar is first displayed. in earlier versions, a copy of each item was created and placed on the toolbar. this means that the palette now only contains items not already in the toolbar. this introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. attributes autohid...
...ar is visible. this only has an effect on windows and needs to be combined with type="menubar" and a menubar element. currentset not in seamonkey 1.x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or,
additionally, any of the following strings: "separator", "spring", "spacer". customindex not in seamonkey 1.x type: integer this value is the index of the toolbar in the list of the custom toolbars. the value is updated automatically by the toolbar customization dialog. customizable not in seamonkey 1.x type: boolean set this attribute to true on toolbars that can be customized. thi...
...And 3 more matches
Deploying XULRunner - Archive of obsolete content
le of one such solution may be found in the article: creating a windows inno setup installer for xulrunner applications. the installed files should be arranged in the following directory structure: installdir/ 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.exe (this is the "stub executable"... you should copy and rename this file from xulrunner-stub.exe in your xulrunner installation.) xulrunner/ ... copy xulrunner/ to this directory when deploying with xulrunner 2.0 and above do the following: move chrome.manifest to the root directory, and adjust ...
...able file. here's how the entire application bundle looks: myapp.app/ contents/ info.plist pkginfo resources/ application.ini app_icon.icns components/ ... components which are part of the application chrome/ ... chrome which is part of the application ...
additional application files such as icons, etc macos/ xulrunner (this is the "stub executable"... you should copy this file from /library/frameworks/xul.framework/versions/1.8/xulrunner.) libmozglue.dylib (the main xul library) ... other executables and libraries the core changes to xul and gecko that require this new file l...
... libmozglue.dylib (the main xul library) ... other executables and libraries the core changes to xul and gecko that require this new file layout were implemented in gecko 34, except that the xulrunner application was not updated to know about the change, so it will report an error: "unable to load xpcom." xulrunner was fixed in gecko 39. see this blog post for
additional background about this change. xulrunner 38 and earlier in xulrunner 38 and earlier, xulrunner is provided in a mac os x framework bundle, which is placed in your application bundle's frameworks directory. the complete bundle structure is as follows: myapp.app/ contents/ info.plist pkginfo frameworks/ xul.framework/ files cop...
...And 3 more matches
Mozprofile - Archive of obsolete content
this documentation is no longer maintained. please see the maintained documentation of mozprofile at http://mozbase.readthedocs.org/en/latest/mozprofile.html. mozprofile is a python tool for creating and managing profiles for mozilla's applications (firefox, thunderbird, etc.). in
addition to creating profiles, mozprofile can install
addons and set preferences. mozprofile can be utilized from the command line or as an api. command line usage mozprofile may be used to create profiles, set preferences in profiles, or install
addons into profiles. the profile to be operated on may be specified with the --profile switch. if a profile is not specified, one will be created in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1ieu.mozrunner (moz...
...e --profile switch. if a profile is not specified, one will be created in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1ieu.mozrunner (mozmill)> ls /tmp/tmp4q1ieu.mozrunner user.js to run mozprofile from the command line enter: mozprofile --help for a list of options. ...
... in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1ieu.mozrunner (mozmill)> ls /tmp/tmp4q1ieu.mozrunner user.js to run mozprofile from the command line enter: mozprofile --help for a list of options. api usage to use mozprofile as an api you can import mozprofile.profile and/or the
addonmanager. mozprofile.profile features a generic profile class. ...
...And 3 more matches
Processing XML with E4X - Archive of obsolete content
a full definition of e4x can be found in the ecma-357 specification. ...
...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 prevent <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 two principal ways of creating an xml object. the first is to pass a string to the xml constructor: var languages = new xml('<languages type="dynamic"><lang>javascript</lang><lang>python</lang></languages>'); the second is to embed the x...
...y. with e4x it is easy to embed dynamic values in markup. variables and expressions can be used to create attribute values by simply wrapping them with braces ({}) and omitting quotation marks that would normally go around an attribute value, as the following example illustrates: var a = 2; var b = <foo bar={a}>"hi"</foo>; upon execution the variable is evaluated and quotes are automatically
added where appropriate. the preceding example would result in an xml object which looks like this: <foo bar="2">"hi"</foo>. in attribute substitution, quotation marks are escaped as " while apostrophes are handled normally. var b = 'he said "don\'t go there."'; var el = <foo a={b}/>; alert(el.toxmlstring()); // gives: <foo a="he said "don't go there.""/> less than and ampersand si...
...And 3 more matches
Building Mozilla XForms - Archive of obsolete content
starting with firefox 3.5, you need to do two more mercurial checkouts: cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation that's it, you now have everything you need to get started. configure your build: the .mozconfig file mozilla uses a file called .mozconfig in your home directory to store the build configuration. ...
... you need to do two more mercurial checkouts: cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation that's it, you now have everything you need to get started. configure your build: the .mozconfig file mozilla uses a file called .mozconfig in your home directory to store the build configuration. ...
...eed to get started. configure your build: the .mozconfig file mozilla uses a file called .mozconfig in your home directory to store the build configuration. for xforms, you will need to
add the following line: ac_
add_options --enable-extensions="default,xforms" # if you're using a mozilla source before 2010-11-06 (e.g. an old firefox 3.6 release) use this instead (see bug 601570 for details): ac_
add_options --enable-extensions="default,xforms,schema-validation" a complete .mozconfig file for a release build might look like that: . ...
...And 3 more matches
bootstrap.js - Extensions
ormation, see bootstrapped extensions. the example below contains the required methods in vsdoc format. ...
...ped extensions. the example below contains the required methods in vsdoc format. ...
...mple below contains the required methods in vsdoc format. ...
...And 3 more matches
Audio for Web games - Game development
web-based audio is maturing fast, but there are still many browser differences to navigate. we often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. mobile audio caveats by far the most difficult platforms to provide web audio support for are mobile platforms. unfortunately these are also the platforms that people often use to play games. ...
...er vendors to make choices that can make web audio difficult for game developers to work with. let's look at these now. autoplay browser autoplay policy now affects desktop and mobile browsers. there is further information about it here from the google developers site. it is worth noting that autoplay with sound is allowed if: the user has interacted with the domain. on mobile the user has
added the site to their home screen. many browsers will simply ignore any requests made by your game to automatically play audio; instead playback for audio needs to be started by a user-initiated event, such as a click or tap. this means you will have to structure your audio playback to take account of that. this is usually mitigated against by loading the audio in advance and priming it on a user...
...ill mean we can now use javascript to play that file at arbitrary points. you can find out more about best practises with the autoplay policy here. note: playing part of your file at zero volume could also work if the browser allows you to change volume (see below). also note that playing and immediately pausing your audio does not guarantee that a small piece of audio won't be played. note:
adding a web app to your mobile's homescreen may change its capabilities. in the case of autoplay on ios, this appears to be the case currently. if possible, you should try your code on several devices and platforms to see how it works. volume programmatic volume control may be disabled in mobile browsers. the reason often given is that the user should be in control of the volume at the os level a...
...And 3 more matches
Create the Canvas and draw on it - Game development
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. ...
...ment. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element. using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and
add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev canvas workshop</title> <style> * { p
adding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascript code goes here </script> </body> </html> we have a charset defined, <title> and some basic css in the header. the body contains <canvas> and <script> elements — we will render the game inside the f...
...ond one. the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high. all the javascript code we will write in this tutorial will go between the opening <script> and closing </script> tags. canvas basics to actually be able to render graphics on the <canvas> element, first we have to grab a reference to it in javascript.
add the following below your opening <script> 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...
...And 3 more matches
Game over - Game development
« previousnext » this is the 5th step out of 10 of the gamedev canvas tutorial. 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 p
addle 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 p
addle 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. here's the piece of code from the third lesson where we made the ball bounce off the walls: if(x + dx > canvas.width-ba...
...update the last bit of code you modified again, to the following: if(y + dy < ballradius) { ...
...lace the second if statement with the following: if(y + dy < ballradius) { dy = -dy; } else if(y + dy > canvas.height-ballradius) { alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } letting the p
addle hit the ball the last thing to do in this lesson is to create some kind of collision detection between the ball and the p
addle, so it can bounce off it and get back into the play area. ...
...And 3 more matches
Physics - Game development
xt » this is the 5th 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/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. we don't need any heavy geometry calculations — after all it's just a ball bouncing off walls and bricks. first, let's initialize the arcade physics ...
...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. we don't need any heavy geometry calculations — after all it's just a ball bouncing off walls and bricks. first, let's initialize the arcade physics engine in our game. ...
...ball bouncing off walls and bricks. first, let's initialize the arcade physics engine in our game.
add the physics.startsystem() method at the beginning of the create function (make it the first line inside the function), as shown below: game.physics.startsystem(phaser.physics.arcade); next, we need to enable our ball for the physics system — phaser object physics is not enabled by default.
add the 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. ...
...And 3 more matches
Randomizing gameplay - Game development
« previous this is the 16th 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/lesson16.html. our game appears to be completed, but if you look close enough you'll notice that the ball is bouncing off the p
addle at the same angle throughout the whole game. this means that every game is quite similar. ...
...ut if you look close enough you'll notice that the ball is bouncing off the p
addle 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 p
addle, by modifying the x velocity each time the ballhitp
addle() function is run using a line along the lines of the below.
add this new line to your code now, and try it out. ...
...ve 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 p
addle, by modifying the x velocity each time the ballhitp
addle() function is run using a line along the lines of the below.
add this new line to your code now, and try it out. ...
...And 3 more matches
Idempotent - MDN Web Docs Glossary: Definitions of Web-related terms
is with a delete last entry functionality using the delete method. note that the idempotence of a method is not guaranteed by the server and some applications may incorrectly break the idempotence constraint. get /pagex http/1.1 is idempotent. ...
...te that the idempotence of a method is not guaranteed by the server and some applications may incorrectly break the idempotence constraint. get /pagex http/1.1 is idempotent. ...
... a method is not guaranteed by the server and some applications may incorrectly break the idempotence constraint. get /pagex http/1.1 is idempotent. ...
...And 3 more matches
Advanced styling effects - Learn web development
them. you can find the examples in this section at box-shadow.html (see the source code too). a simple box shadow let's look at a simple example to get things started. ...
...olor units that would make sense to do so to define these values. ...
...hapes of the content inside the box, not just the box itself as one big chunk, so it is worth knowing the difference. in this next example we are applying our filter to a box, and comparing it to a box shadow. as you can see, the drop-shadow filter follows the exact shape of the text and border dashes. the box shadow just follows the square of the box. blend modes css blend modes allow us to
add blend modes to elements that specify a blending effect when two elements overlap — the final color shown for each pixel will be the result of a combination of the original pixel color, and that of the pixel in the layer underneath it. blend modes are again very familiar to users of graphics applications like photoshop. there are two properties that use blend modes in css: background-blend-m...
...And 3 more matches
Handling different text directions - Learn web development
ch from one writing mode to another. you don't need to be working in a language which uses a vertical writing mode to want to do this — you could also change the writing mode of parts of your layout for creative purposes. in the example below we have a heading displayed using writing-mode: vertical-rl. the text now runs vertically. vertical text is common in graphic design, and can be a way to
add a more interesting look and feel to your web design. the three possible values for the writing-mode property are: horizontal-tb: top-to-bottom block flow direction. sentences run horizontally. vertical-rl: right-to-left block flow direction. sentences run vertically. vertical-lr: left-to-right block flow direction. sentences run vertically. so the writing-mode property is in reality set...
...g 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 nature of css. the web is not just for la...
...height — with logical, or flow relative versions. the property mapped to width when in a horizontal writing mode is called inline-size — it refers to the size in the inline dimension. the property for height is named block-size and is the size in the block dimension. you can see how this works in the example below where we have replaced width with inline-size. logical margin, border, and p
adding properties in the last two lessons we have learned about the css box model, and css borders. in the margin, border, and p
adding properties you will find many instances of physical properties, for example margin-top, p
adding-left, and border-bottom. in the same way that we have mappings for width and height there are mappings for these properties. the margin-top property is mapped to margin-b...
...And 3 more matches
What is a Domain Name? - Learn web development
prerequisites: first you need to know how the internet works and understand what urls are. objective: learn what domain names are, how they work, and why they are important. summary domain names are a key part of the internet infrastructure. they provide a human-readable
address for any web server available on the internet. any internet-connected computer can be reached through a public ip
address, either an ipv4
address (e.g. 173.194.121.32) or an ipv6
address (e.g., 2027:0da8:8b73:0000:0000:8a2e:0370:1337). computers can handle such
addresses easily, but people have a hard time finding out who's running the server or what service the website offers. ip
addresses are hard to remember and might change over time. to solve all those problems we use h...
... deeper dive structure of domain names a domain name has a simple structure made of several parts (it might be one part only, two, three...), separated by dots and read from right to left: each of those parts provides specific information about the whole domain name. tld (top-level domain). ...
...ction. click on it. fill out the form with all required details. make sure especially that you have not misspelled your desired domain name. once it's paid for, it's too late! the registrar will let you know when the domain name is properly registered. within a few hours, all dns servers will have received your dns information. note: in this process the registrar asks you for your real-world
address. make sure you fill it properly, since in some countries registrars may be forced to close the domain if they cannot provide a valid
address. dns refreshing dns databases are stored on every dns server worldwide, and all these servers refer to a few special servers called “authoritative name servers” or “top-level dns servers.” — these are like the boss servers that manage the sy...
...And 3 more matches
How to structure a web form - Learn web development
web forms, it's good to remember that form markup is just html. this means that you can use all the power of html to structure a web form. as you can see in the examples, it's common practice to wrap a label and its widget with a <li> element within a <ul> or <ol> list. <p> and <div> elements are also commonly used. lists are recommended for structuring multiple checkboxes or radio buttons. in
addition to the <fieldset> element, it's also common practice to use html titles (e.g. <h1>, <h2>) and sectioning (e.g. <section>) to structure complex forms. above all, it is up to you to find a comfortable coding style that results in accessible, usable forms. each separate section of functionality should be contained in a separate <section> element, with <fieldset> elements to contain radio butto...
...rk in the next article (basic native form controls). for now, read the descriptions carefully as you follow the below instructions, and start to form an appreciation of which wrapper elements we are using to structure the form, and why. to start with, make a local copy of our blank template file and the css for our payment form in a new directory on your computer. ...
...s, and start to form an appreciation of which wrapper elements we are using to structure the form, and why. to start with, make a local copy of our blank template file and the css for our payment form in a new directory on your computer. apply the css to the html by
adding the following line inside the html <head>: <link href="payment-form.css" rel="stylesheet"> next, create your form by
adding the outer <form> element: <form> </form> inside the <form> tags,
add a heading and paragraph to inform users how required fields are marked: <h1>payment form</h1> <p>required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p> next we'll
add a larger section of code into the form, below our previous entry. here you'll see that we are wrapping the contact inf...
...And 3 more matches
HTML basics - Learn web development
me of the element (in this case, p), wrapped in opening and closing angle brackets. this states where the element begins or starts to take effect — in this case where the paragraph begins. the closing tag: this is the same as the opening tag, except that it includes a forward slash before the element name. this states where the element ends — in this case where the paragraph ends. failing to
add a closing tag is one of the standard beginner errors and can lead to strange results. the content: this is the content of the element, which in this case, is just text. the element: the opening tag, the closing tag and the content together comprise the element. elements can also have attributes that look like the following: attributes contain extra information about the element that you do...
...llow you to specify that certain parts of your content are headings — or subheadings. in the same way that a book has the main title, chapter titles and subtitles, an html document can too. html contains 6 heading levels, <h1>–<h6>, although you'll commonly only use 3 to 4 at most: <h1>my main title</h1> <h2>my top level heading</h2> <h3>my subheading</h3> <h4>my sub-subheading</h4> now try
adding a suitable title to your html page just above your <img> element. note: you'll see that your heading level 1 has an implicit style. don't use heading elements to make text bigger or bold, because they are used for accessibility and other reasons such as seo. try to create a meaningful sequence of headings on your pages, without skipping levels. paragraphs as explained above, <p> elements ...
...'t use heading elements to make text bigger or bold, because they are used for accessibility and other reasons such as seo. try to create a meaningful sequence of headings on your pages, without skipping levels. paragraphs as explained above, <p> elements are for containing paragraphs of text; you'll use these frequently when marking up regular text content: <p>this is a single paragraph</p>
add your sample text (you should have it from what should your website look like?) into one or a few paragraphs, placed directly below your <img> element. lists a lot of the web's content is lists and html has special elements for these. marking up lists always consist of at least 2 elements. the most common list types are ordered and unordered lists: unordered lists are for lists where the orde...
...And 3 more matches
Mozilla splash page - Learn web development
objective: to test knowledge around embedding images and video in web pages, frames, and html responsive image techniques. ...
...ss, just the html inside the <body> element — as long as you insert the correct markup, the styling will make it look correct. project brief in this assessment we are presenting you with a mostly-finished mozilla splash page, which aims to say something nice and interesting about what mozilla stands for, and provide some links to further resources. unfortunately, no images or video have been
added yet — this is your job! you need to
add some media to make the page look nice and make more sense. the following subsections detail what you need to do: preparing images using your favourite image editor, create 400px wide and 120px wide versions of: firefox_logo-only_rgb.png firefox-
addons.jpg mozilla-dinosaur-head.png call them something sensible, e.g. firefoxlogo400.png and firefo...
...panda.jpg, and a 600px wide portrait version that shows the panda in more of a close up shot. again, call them something sensible so you can easily identify them. save a copy of both of these inside the same directory as index.html. note: you should optimise your jpg and png images to make them as small as possible, while still looking ok. tinypng.com is a great service for doing this easily.
adding a logo to the header inside the <header> element,
add an <img> element that will embed the small version of the firefox logo in the header.
adding a video to the main article content just inside the <article> element (right below the opening tag), embed the youtube video found at https://www.youtube.com/watch?v=ojcncvb1olg, using the appropriate youtube tools to generate the code. the video...
...And 3 more matches
Working with JSON - Learn web development
ources from a server via javascript (e.g. images, text, json, even html snippets), meaning that we can update small sections of content without having to reload the entire page. this has led to more responsive web pages, and sounds exciting, but it is beyond the scope of this article to teach it in much more detail. to start with, we store the url of the json we want to retrieve in a variable. ...
...to teach it in much more detail. to start with, we store the url of the json we want to retrieve in a variable.
add the following at the bottom of your javascript code: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; to create a request, we need to create a new request object instance from the xmlhttprequest constructor, using the new keyword.
add the following below your last line: let request = new xmlhttprequest(); now we need to open the request using the open() method.
add the following line: request.open('get', requesturl); this takes at least two parameters — there are other optional parameters available. we only need the two mandatory ones for this simple example: the http method to use when making the network re...
...uesturl); this takes at least two parameters — there are other optional parameters available. we only need the two mandatory ones for this simple example: the http method to use when making the network request. in this case get is fine, as we are just retrieving some simple data. the url to make the request to — this is the url of the json file that we stored earlier. next,
add the following two lines — here we are setting the responsetype 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...
...And 3 more matches
Framework main features - Learn web development
d this data: { subject: "world" } handlebars will build html like this: <header> <h1>hello, world!</h1> </header> typescript typescript is a superset of javascript, meaning it extends javascript — all javascript code is valid typescript, but not the other way around. typescript is useful for the strictness it allows developers to enforce on their code. for instance, consider a function
add(), which takes integers a and b and returns their sum. in javascript, that function could be written like this: function
add(a, b) { return a + b; } this code might be trivial for someone accustomed to javascript, but it could still be clearer. javascript lets us use the + operator to concatenate strings together, so this function would technically still work if a and b were strings — it j...
...e might be trivial for someone accustomed to javascript, but it could still be clearer. javascript lets us use the + operator to concatenate strings together, so this function would technically still work if a and b were strings — it just might not give you the result you'd expect. what if we wanted to only allow numbers to be passed into this function? typescript makes that possible: function
add(a: number, b: number) { return a + b; } the : number written after each parameter here tells typescript that both a and b must be numbers. if we were 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 sour...
...names of the equivalent native browser events. in react, listening for the click event requires a special property, onclick. let’s update our counterbutton code from above to allow it to count clicks: function counterbutton() { const [count, setcount] = usestate(0); return ( <button onclick={() => setcount(count + 1)}>clicked {count} times</button> ); } in this version we are using
additional usestate() functionality to create a special setcount() function, which we can invoke to update the value of count. we call this function on line 4, and set count to whatever its current value is, plus one. styling components each framework offers a way to define styles for your components — or for the application as a whole. although each framework’s approach to defining the styles ...
...And 3 more matches
Componentizing our React app - Learn web development
r components. the following commands make a components directory and then, within that, a file called todo.js. make sure you're in the root of your app before you run these! mkdir src/components touch src/components/todo.js our new todo.js file is currently empty! open it up and give it its first line: import react from "react"; since we're going to make a component called todo, you can start
adding the code for that to todo.js too, as follows. in this code, we define the function and export it on the same line: export default function todo() { return ( ); } this is ok so far, but our component has to return something! go back to src/app.js, copy the first <li> from inside the unordered list, and paste it into todo.js so that it reads like this: export default function todo() { ...
...ame="btn btn__danger"> delete <span classname="visually-hidden">eat</span> </button> </div> </li> ); } note: components must always return something. if at any point in the future you try to render a component that does not return anything, react will display an error in your browser. our todo component is complete, at least for now; now we can use it. in app.js,
add the following line near the top of the file to import todo: import todo from "./components/todo"; with this component imported, you can replace all of the <li> elements in app.js with <todo /> component calls. your <ul> should read like this: <ul role="list" classname="todo-list stack-large stack-exception" aria-labelledby="list-heading" > <todo /> <todo /> <todo /> </ul> when you...
... the file should read like this: import react from "react"; function filterbutton...
...And 3 more matches
Handling common JavaScript problems - Learn web development
also study examples like this one, which shows a typical pattern of saving a this scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct this scope. ...
...see good-for-loop.html (see the source code also) for a version that works. making sure asynchronous operations have returned before trying to use the values they return. ...
......
...And 3 more matches
Debugging Frame Reflow
lable width, available height computed width, computed height the previous and the next frame in flow and a count number. when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max. element width maximum width frame status overflow area getting the log make sure that your build is a debug build (in short you need ac_
add_options --enable-debug in your .mozconfig file). create a text file (for instance reflow_rules.txt). enter this line in the text file * 1 this should look like: point the gecko_display_reflow_rules_file environment variable to the path of the reflow_rules.txt file. run the debug build, saving stdout to a file. on mac this is accomplished with: $ env dyld...
...olg 02d7bfb0 d=0,0 tbl 02d7b7ec d=1500,390 tblo 02d7b5f0 d=1500,390 text 02d7c130 r=0 a=8940,uc c=uc,uc cnt=885 text 02d7c130 d=0,0 block 02d7b210 d=8940,390 area 02d7afe4 d=9180,630 canvas 00b97c6c d=9180,4470 scroll 00b97ee0 d=9180,4470 scroll 00b97ee0 d=9180,4470 vp 00b97c30 d=9180,4470 the first line shows the reflow of the viewport (vp). this viewport has the
address 00b97c30. it is the initial reflow: r=0. other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow the available width is 9180 twips. the available height is 4470 twips (a=9180,4470). the computed width is 9180 twips. the computed height is 4470 twips (c=9180,4470). the line count is 856 (cnt=856). below this is a line that reads: tblo 02d7b5f0 r=0 ...
... 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 previous 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 previous 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 area is specified as (x,y) origin and width x height. the reflow finishes at the same level where it started. advanced reflow debugging the previously described technique ...
...And 3 more matches
How Mozilla's build system works
u don't have to worry about how you obtain a configure file: the build system does this for you. the primary job of configure is to determine characteristics of the system and compiler, apply options passed into it, and validate everything looks ok to build. the primary output of the configure script is an executable file in the object directory called config.status. configure also produces some
additional files (like autoconf.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 pytho...
...ol how to build the tree. to do this, config.status must first scan the build system definition. the build system definition consists of various moz.build files in the tree. there is roughly one moz.build file per directory or per set of related directories. each moz.build file defines how its part of the build configuration works. for example, it says i want these c++ files compiled or look for
additional information in these directories. config.status starts with the main moz.build file and then recurses into all referenced files and directories. as the moz.build files are read, data structures describing the overall build system definition are emitted. these data structures are then read by a build backend generator, which then converts them into files, function calls, and so on. in the c...
...for example, there is a tier for the netscape portable runtime (nspr), one for the javascript engine, one for the core gecko platform, one for the xul app being built, and so on. the main moz.build file defines the tiers and directories in the tiers. in reality, the main moz.build files include other moz.build files, such as /toolkit/toolkit.mozbuild, which define the tiers. they do this via the
add_tier_dir() function. at build time, the tiers are traversed in the order they are defined. typically, the traversal order looks something like base, nspr, nss, js, platform, app. each tier consists of three sub-tiers: export, libs, and tools. these sub-tiers roughly correspond to the actions of pre-build, main-build, and post-build. this naming, however, can be misleading because all three sub-...
...And 3 more matches
Simple Instantbird build
this should be kept in sync with simple thunderbird build, you might want to take a look at that page too. build prerequisites hardware requirements: while you can build instantbird on older hardware it can take quite a bit of time to compile on slower machines, and having 8gb of ram is recommended (though you can probably still get away with 4gb). good internet connection for the initial source download. ...
... setup: depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites tip: after completing setup for your os, and before you get the source, you can opt to
add the progressextension to your mercurial.ini (for windows) or .hgrc (for *nix / mac) file. this will provide status feedback during the lengthy clone / download process. see: configure mercurial .hgrc file for progress extension. get the source note: on windows, you won't be able to build the instantbird source code if it's under a directory with spaces in the path (e.g., don't use "documents an...
..., there are many build configuration options to choose from, although it's strongly recommended that you only use options that you fully understand. the normal way to specify build options is to place them in a file called '.mozconfig' at the root of your mozilla source tree, i.e. your comm-central repo. ...
...And 3 more matches
Storage access policy: Block cookies from trackers
fox nightly may also contain experimental features that we don't yet plan to ship to release users; experimental features will not be included in this documentation, but may nevertheless impact the functionality of domains classified as trackers. we recommend sites test with firefox nightly, as this includes the newest version of our protections. as described above, note that nightly may include
additional protections that end up getting removed or changed before they reach our release users. we’ll keep this page updated with the newest information as we strengthen our protections. these protections are on by default in nightly. the cookie policy can be enabled in other versions of firefox through the content blocking settings (these steps will vary by version; the linked documentation in...
...e which resources are tracking resources. 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 prevents 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 e...
...r when tracker.example is visited directly (i.e., as a first party). http referrers the default referrer policy for 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 prevent 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 ...
...And 3 more matches
IME handling guide
ition string as a selected item off the list and commits composition string without any conversion. ime is used by chinese, japanese, korean and taiwan users for inputting chinese characters because the number of them is beyond thousands and cannot be input from the keyboard directly. however, especially on mobile devices nowadays, ime is also used for inputting latin languages like autocomplete.
additionally, ime may be used for handwriting systems or speech input systems on some platforms. if ime is available on focused elements, we call that state "enabled". if ime is not fully available(i.e., user cannot enable ime), we call this state "disabled". if ime is enabled but users use direct input mode (e.g., for inputting latin characters), we call it "ime is closed". otherwise, we call it "...
...rent. if all sent widgetcompositionevents and widgetselectionevents are already handled in the remote process, contentcacheinparent sending the notifications to widget. and also this handles widgetquerycontentevents with its cache. supported event messages of them are: equeryselectedtext (only with selectiontype::enormal) equerytextcontent equerytextrect equerycaretrect equeryeditorrect
additionally, this does not support query content events with xp line breakers but this must not be any problem since native ime handlers query contents with native line breakers. contentcacheinparent also manages sent widgetcompositionevents and widgetselectionevents. after these events are handled in the remote process, tabparent receives it with a call of recvoneventneedingackhandled(). then, it ...
... and notify_ime_of_composition_event_handled are always sent by following order: notify_ime_of_text_change notify_ime_of_selection_change notify_ime_of_position_change notify_ime_of_composition_event_handled if sending one of above notifications causes higher priority notification, the sender should abort to send remaning notifications and restart 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 previous imecontentobserver notified widget of noti...
...And 3 more matches
Implementing QueryInterface
( aiid.equals(nscomtypeinfo<nsisupports>::getiid()) ) foundinterface = ns_static_cast(nsisupports*, ns_static_cast(nsix*, this)); // i (may) have multiple |nsisupports| in me, // so first i cast to a specific base to avoid ambiguity else foundinterface = 0; nsresult status; if ( !foundinterface ) status = ns_nointerface; else { ns_
addref(foundinterface); status = ns_ok; } *ainstanceptr = foundinterface; return status; } what's so good about it? it's clear and simple. ok. it has more than one return, but the primary return is at the end of the function as expected; and the
additional return is clear and alone at the top of the function. it only has one
addref. it
addrefs the resulting interface...
...stanceptr, which compilers have trouble optimizing. it clears the result, *ainstanceptr, when returning an error. it generates less code than the typical implementation of queryinterface. it tests for bad input with an ns_assertion, to find logic errors immediately in debug builds. some alternatives the ns_impl_query_interface[012] macros the sample above implements two xpcom interfaces in
addition to nsisupports. the ns_impl_query_interface2 macro can write this function for you (though it pains me to recommend macros), e.g., ns_impl_query_interface2(nsmyimplementation, nsix, nsiy) // implements |nsmyimplementation::queryinterface| as above ns_impl_query_interface1(nsfoo, nsifoo) // |nsfoo::queryinterface| provides |nsifoo| and |nsisuppo...
... // implements |nsmyimplementation::queryinterface| as above ns_impl_query_interface1(nsfoo, nsifoo) // |nsfoo::queryinterface| provides |nsifoo| and |nsisupports| ns_impl_query_interface0(nsbar) // |nsbar::queryinterface| can only provide an |nsisupports| similarly, you can use the macro ns_impl_query_interface1 when you implement only one
additional interface; and ns_impl_query_interface0 when you only implement nsisupports. these macros will be invoked for you if you use the ns_impl_isupports* macros, which give the corresponding queryinterface implementation, plus an
addref and a release. calling an inherited queryinterface sometimes you are just
adding one or two new interfaces to an implementation that already supports many othe...
...And 3 more matches
Downloads.jsm
ne 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 previous 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 list based on their properties. promise resolves to the requested downloadlist object. getsummary() retrieves the specified type of downloadsummary object. there is one download summ...
...oved from the list when the message box is closed, regardless of whether it has been completed or not. ...
...age box is closed, regardless of whether it has been completed or not. ...
...And 3 more matches
PromiseWorker.jsm
which content to use in your worker and main thread files, in order to use promiseworker objects. worker file there is some standard templating that must be dropped into the worker file by the developer. the require.js file must be imported with workerglobalscope/importscripts(). next, the promiseworker.js file should be brought in with the require() method. finally, the template code should be
added in. the code below is what should be copied and pasted: importscripts('resource://gre/modules/workers/require.js'); let promiseworker = require('resource://gre/modules/workers/promiseworker.js'); // instantiate abstractworker (see below). let worker = new promiseworker.abstractworker() worker.dispatch = function(method, args = []) { // dispatch a call to method `method` with args `args` ...
...method` with args `args` return self[method](...args); }; worker.postmessage = function(...args) { // post a message to the main thread self.postmessage(...args); }; worker.close = function() { // close the worker self.close(); }; worker.log = function(...args) { // log (or discard) messages (optional) dump('worker: ' + args.join(' ') + '\n'); }; // connect it to message port. self.
addeventlistener('message', msg => worker.handlemessage(msg)); abstractworker is a base class for the worker, and it's designed to be used by derived class, which provides above four methods (dispatch, postmessage, close, and log). but you can instantiate abstractworker itself and set its properties later, instead of creating derived class. main thread file the basepromiseworker object needs to b...
... can be found here: github :: promiseworker transfer arraybuffer - worker side rejecting the promise to reject the promise from the worker, simply throw. various error objects are supported; each one has its specific meaning; they're described below. supported built-in javascript error are following: evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror in
addition to them, stopiteration is also supported (note that stopiteration is deprecated). you can also construct and throw your own custom error objects as needed. when custom error is caught by abstractworker, tomsg method will be called to convert it into message. the tomsg function should return an object which has exn property, that is the property key for the frommsg function in main thread s...
...And 3 more matches
XPCOMUtils.jsm
m factory (an object implementing nsifactory). if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(iid)| in its createinstance(). _xpcom_factory: { ... }, // [optional] an array of categories to register this component in. _xpcom_categories: [{ // each object in the array specifies the parameters to pass to // nsicategorymanager.
addcategoryentry(). 'true' is passed for // both apersist and areplace params. category: "some-category", // optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless // 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' // is not specifi...
...// optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless // 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' // is not specified, the concatenation of the string "service," and the // object's contractid is passed as avalue parameter of
addcategoryentry. service: true, // optional array of applications' ids in the form: // [ "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", ... ] // if this is defined, the component is registered in this // category only on the specified applications. apps: [ ... ] }], // queryinterface implementation, e.g. using the generateqi helper queryinterface: xpcomutils.generateqi( ...
.../xxx;1", classdescription: "unique text description", interfaces: [components.interfaces.nsiobserver, components.interfaces.nsimyinterface, "nsifoo", "nsibar"], flags: ci.nsiclassinfo.singleton}), // ...component implementation... }; note: the ability to register the component in a category only on specific applications by
adding the apps field to a category entry was
added in gecko 2. notice that the queryinterface() method implemented by the component simply calls the generateqi() method provided by the xpcomutils code module. create an array of component constructors you need to create an array that lists the constructors for each component. this array can of course have just one entry: var components = [mycomp...
...And 3 more matches
Localizing XLIFF files for iOS
you will store your copy of the github repo and navigate there in your terminal. enter the command git clone https://github.com/mozilla-l10n/firefoxios-l10n/your-locale-code/ you should now see the firefox-ios project in your selected directoy with the firefox-ios.xliff file in it. translating the xliff file open the firefox-ios.xliff file in your favorite text editor. in the <file> tag,
add the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). be aware that there may be many <file> tags within one xliff document. each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). strings are located within <trans-unit> tags. source english strings are contained in <source> child tags.
...alue (e.g., target-language="xx-xx"). be aware that there may be many <file> tags within one xliff document. each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). strings are located within <trans-unit> tags. source english strings are contained in <source> child tags. ...
...-xx"). be aware that there may be many <file> tags within one xliff document. each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-xx"). strings are located within <trans-unit> tags. source english strings are contained in <source> child tags. ...
...And 3 more matches
Initial setup
g an existing one. this will determine what information is most applicable to you throughout the rest of this guide. here's what you do: look through the existing localization community directory to see if one already exists for your locale. if a community already exists, reach out to them and ask how you can help. if a community doesn't exist, send an email to the new-locales newsgroup for
additional guidance. accounts there are a handful of 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 officia...
... 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 outlined there. here is an example bug that illustrates the process well. use this bug template when filing your hg account registration bug. ...
...stration 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 talk about these in a little bit. for now, just be aware that should you choose to use them, you may need to create a personal account. ...
...And 3 more matches
Fonts for Mozilla 2.0's MathML engine
you may also want to check out the mozilla mathml torture test to test your installation against concrete examples. ...
...on mac os x lion (10.7) and higher versions, stix fonts are already installed and can be used for mathml. on most linux distributions and similar open source platforms, you can install math fonts (stix, asana or mathjax fonts) from your package manager or get them from this zip archive. on android, firefox os and other platforms where the instructions above do not work: install the mathml-fonts
add-on. this requires gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) or higher. overview mathematical formulas make use of various symbols represented by specific unicode characters. mozilla can display any of these symbols provided suitable unicode fonts are installed. furthermore, in accordance with the w3c css2 recommendation on fonts, authors can specify an ordered list of particu...
...eset old preferences if users have previously changed the "font.mathfont-family" preference for a previous 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. ...
...And 3 more matches
Gecko Profiler FAQ
s in decreasing order from top to bottom. then the call stacks whose cost increased the most in the “after” profile will be at the top, and those are the ones you usually want to look at if you caused a regression. in this view, the timestamps of individual samples / stacks will not be meaningful. profiler.firefox.com does not have a comparison view at the moment. i can help you
add one, though. there is documentation for the gecko profile format. is it worth slowing down cpu to increase the profiler resolution? it depends on what you are trying to profile to some extent. usually you should be really careful when changing the characteristics of the environment that you are trying to measure to avoid measuring the wrong thing. ...
...o 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. [mstange] this question is more about benchmarking than about profiling. if you want to measure things, please measure without the profiler running, because the profiler can
add its own overhead. how do we find performance regressions caused by third-party and system
addons, especially ones that only show up after extended uptime? by running into them. i wish i had a better answer to this question. in general, the gecko profiler is a profiling tool that helps you figure out what happens inside the browser as a performance issue is happening, it ...
...example, they will show up as part of the same call stack as the user-space call stack for the program you are profiling. if so, how complicated is to find out the reason the page has been purged? [mstange] i don’t know. [ehsan] i don’t think this is very interesting in the general situation, since oses can basically decide to swap out part of your virtual
address space and you’d page fault when you access that page next and there is very little that the program can do about that. many times the reason you incur a page fault is merely that you are touching a memory page that hasn’t been touched in awhile. for example, we have observed that the first access to large hashtables when doing a hashtable lookup can incur a page fault in many cases, and...
...And 3 more matches
Leak-hunting strategies and tips
better to go after the large graphs of leaks first. a good general pattern for finding and fixing leaks is to start with a task that you want not to leak (for example, reading email). start finding and fixing leaks by running part of the task under nstracerefcnt logging, gradually building up from as little as possible to the complete task, and fixing most of the leaks in the first steps before
adding
additional steps. (by most of the leaks, i mean the leaks of large numbers of different types of objects or leaks of objects that are known to entrain many non-logged objects such as js objects. seeing a leaked globalwindowimpl, nsxulpdglobalobject, nsxbldocglobalobject, or nsxpcwrappedjs is a sign that there could be significant numbers of js objects leaked.) for example, start with bringing...
...or examples. (is this advice still accurate now that we have a cycle collector? --jesse) dropping a reference on the floor by: forgetting to release (because you weren't using nscomptr when you should have been): see bug 99180 or bug 93087 for an example or bug 28555 for a slightly more interesting one. this is also a frequent problem around early returns when not using nscomptr. double-
addref: this happens most often when assigning the result of a function that returns an
addrefed pointer (bad!) into an nscomptr without using dont_
addref(). see bug 76091 or bug 49648 for an example. [obscure] double-assignment into the same variable: if you release a member variable and then assign into it by calling another function that does the same thing, you can leak the object assigned int...
... 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 objects closely, you can get detailed printouts of the paths js uses to mark objects when it is determining the set of live objects by using the functions
added in bug 378261 and bug 378255. (more documentation of this replacement for gc_mark_debug, the old way of doing it, would be useful. it may just involve setting the xpc_shutdown_heap_dump environment variable to a file name, but i haven't tested that.) post-processing of stack traces on mac and linux, the stack traces generated by our internal debugging tools don't have very good symbol informa...
...And 3 more matches
A guide to searching crash reports
first group has over 100,000 crash reports, which accounts for 7.77% of all matching crashes. this indicates there are over 1.3 million crash reports matching this search. you can reorder the groups in various ways by clicking on the column headers. the links within the results do the following things. the first link in each "signature" column cell links to a signature report, which contains
additional details about crash reports with that signature. the "
add term" link in each "signature" column cell lets you perform a narrower subsequent search among crash reports with that signature. the links in each "bugs" column cell link to bug reports in bugzilla. the default search: crash reports if you switch to the "crash reports" tab you will see results like the ones in the following sc...
...ing the links at the top right of the tab. the links within the results do the following things. the link in each "crash id" column cell links to an individual crash report. the links in each "signature" column cell have the same effect that they did in the "signature facet" tab. the links in the remaining column cells also let you perform a narrower subsequent search with that link's value
added to the search criteria. a narrower search you can
add criteria to perform a narrower search. for example, to perform a search for all mac crash reports that occurred while javascript garbage collection was running, do the following.
add "mac os x" to the "platform" field. select "new line", and then choose a field ("is garbage collecting") and an operator ("is true"). the operators avail...
... 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. ...
...And 3 more matches
L20n Javascript API
llback) { yourapp.getallavailablelanguages(function(allavailable) { var fallbackchain = yourapp.intersect(allavailable, requested); cb(fallbackchain); }); }); ctx.requestlocales(...requestedlocales: string?) specify the user's preferred locales for the context instance to negotiate against and freeze the context instance. when a context instance is frozen, no more resources can be
added or linked. all io related to fetching the resource files takes place when a context instance freezes. when all resources have been fetched, parsed and compiled, the context instance will emit a ready event. the final list of locales supported by the context instance will be negotiated asynchronously by the negotiator registered by registerlocalenegotiator. ctx.requestlocales('pl'); ctx.
...x.requestlocales('fr-ca', 'fr'); if requestedlocales argument list is empty or undefined, the default locale from registerlocales will be used. ctx.requestlocales('pl'); if registerlocales hasn't been called, the special i-default locale is used, which means that the following minimal code is valid and will result in a fully operational context instance. var ctx = l20n.getcontext(); ctx.
addresource('<hello "hello, world!">'); ctx.requestlocales(); requestlocales can be called multiple times after the context instance emitted the ready event, in order to change the current language fallback chain, for instance if requested by the user. ctx.supportedlocales a read-only property which holds the current fallback chain of locales which was negotiated between all the available locale...
... instance if requested by the user. ctx.supportedlocales a read-only property which holds the current fallback chain of locales which was negotiated between all the available locales, the default locale and the user's preferred locales. ctx.registerlocales('en-us', ['en-us', 'fr', 'pl']); ctx.requestlocales('fr-ca', 'fr'); ctx.ready(function() { // ctx.supportedlocales == ['fr']; }); ctx.
addresource(text: string)
add a string as the content of a resource to the context instance. the resource is
added to all registered locales. ctx.
addresource('<hello "hello, world!">'); ctx.linkresource(uri: string)
add a resource identified by a url to the context instance. the resource is
added to all registered locales. ctx.linkresource('../locale/strings.l20n'); ctx.linkresource(templ...
...And 3 more matches
Leak And Bloat Tests
build to build where no source code has changed. provide reasonable coverage for the normal activities that a user performs. method current method: measure leaks and bloats, in a similar way to firefox (using xpcom_mem_leak_log and --trace-malloc). the method of testing memory bloat and leaks will be the same sequence of events, using the same set of test data. startup main mail window open
address book and message composition windows close
address book and message composition windows quit the application future improvements will be discussed on the discussion page of the mozilla wiki. results printed on tinderbox output, these consist of: mail rlk reference count leaks mail lk total bytes malloc'ed and not free'd mail mh maximum heap size mail a allocations - number of c...
...ese consist of: mail rlk reference count leaks mail lk total bytes malloc'ed and not free'd mail mh maximum heap size mail a allocations - number of calls to malloc and friends. there are currently no graphs for these results. manually running tests setting up build set up build thunderbird or seamonkey with your standard mozconfig file, but with the following options set: ac_
add_options --enable-debug ac_
add_options --enable-trace-malloc running the tests in your <objdir> run the following command: make mailbloat this will run the tests and produce some result files. see debugging memory leaks for more information on what to do with this data. todo:
add more information on processing output. code locations the files specific to leak and bloat testing are be stored in: ...
...nd produce some result files. see debugging memory leaks for more information on what to do with this data. todo:
add more information on processing output. ...
...And 3 more matches
PR_AcceptRead
accepts a new connection and receives a block of data. syntax #include <prio.h> print32 pr_acceptread( prfiledesc *listensock, prfiledesc **acceptedsock, prnet
addr **peer
addr, void *buf, print32 amount, printervaltime timeout); parameters the function has the following parameters: listensock a pointer to a prfiledesc object representing a socket descriptor that has been called with the pr_listen function, also known as the rendezvous socket. acceptedsock a pointer to a pointer to a prfiledesc object. on return, *acceptedsock points to the prfiledesc object for the newly connected socket. ...
...listensock a pointer to a prfiledesc object representing a socket descriptor that has been called with the pr_listen function, also known as the rendezvous socket. acceptedsock a pointer to a pointer to a prfiledesc object. on return, *acceptedsock points to the prfiledesc object for the newly connected socket. this parameter is valid only if the function return does not indicate failure. peer
addr a pointer a pointer to a prnet
addr object. on return, peer
addr points to the
address of the remote socket. the prnet
addr object that peer
addr points to will be in the buffer pointed to by buf. this parameter is valid only if the function return does not indicate failure. buf a pointer to a buffer to hold data sent by the peer and the peer's
address. this buffer must be large enough to receive...
...if 0, no data will be read from the peer. timeout the timeout interval only applies to the read portion of the operation. ...
...And 3 more matches
PR_RecvFrom
timeout a value of type printervaltime specifying the time limit for completion of the receive operation. ...
... timeout a value of type printervaltime specifying the time limit for completion of the receive operation. ...
... timeout a value of type printervaltime specifying the time limit for completion of the receive operation. ...
...And 3 more matches
Encrypt Decrypt MAC Keys As Session Objects
xt[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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, i...
...oto 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 previously created iv */ if (ptextlen != blocksize) { p
addinglength = blocksize - ptextlen; for ( j=0; j < p
addinglength; j++) { ptext[ptextlen+j] = (unsigned char)p
addinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt fa...
...secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = p
addinglength; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write pad failure\n"); goto cleanup; } rv = secsuccess; cleanup: if (ctxmac != null) { pk11_destroycontext(ctxmac, pr_true); ...
...And 3 more matches
Encrypt and decrypt MAC using token
xt[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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, i...
...oto 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 previously created iv */ if (ptextlen != blocksize) { p
addinglength = blocksize - ptextlen; for ( j=0; j < p
addinglength; j++) { ptext[ptextlen+j] = (unsigned char)p
addinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt fa...
...secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = p
addinglength; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write pad failure\n"); goto cleanup; } rv = secsuccess; cleanup: if (ctxmac != null) { pk11_destroycontext(ctxmac, pr_true); ...
...And 3 more matches
NSS 3.35 release notes
db, key3.db and secmod.db. parallel database access, by multiple applications, is forbidden as it will likely result in data corruption. sql: the newer file format, based on sqlite, using filenames cert9.db, key4.and and pkcs11.txt. parallel database access, by multiple applications, is supported. applications using nss may explicitly request to use a specific database format, by
adding a type prefix to the database directory, provided at nss initialization time. without a prefix, the default database type will be used (dbm in versions prior to 3.35, and sql in version 3.35 and later.) when using the sql type (either explicitly, or because of the new default), with a database directory which already contains a dbm type database, nss will automatically perform a one time mi...
...database, nss will automatically perform a one time migration of the information contained in the dbm files to the newer sql files. if a master password was set on the dbm database, then the initial migration may be partial, and migration of keys from dbm to sql will be delayed, until this master password is provided to nss. (conversely, nss will never synchronize data from sql to dbm format.)
additional information can be found on this fedora linux project page: https://fedoraproject.org/wiki/changes/nssdefaultfileformatsql
added formally verified implementations of non-vectorized chacha20 and non-vectorized poly1305 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 on...
... note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used ...
...And 3 more matches
NSS 3.39 release notes
ss) 3.39, which is a minor release. distribution information the hg tag is nss_3_39_rtm. nss 3.39 requires nspr 4.20 or newer. ...
... a pkcs#11 uri can be used as an identifier for a pkcs#11 token. ...
...w functionality the tstclnt and selfserv utilities
added support for configuring the enabled tls signature schemes using the -j parameter. nss will use rsa-pss keys to authenticate in tls. support for these keys is disabled by default but can be enabled using ssl_signatureschemeprefset(). certutil
added the ability to delete an orphan private key from an nss key database.
added the nss-policy-check utility, which can be used to check an nss policy configuration for problems. a pkcs#11 uri can be used as an identifier for a pkcs#11 token. new functions in cert.h cert_getcertkeytype - query the key type associated with the given certificate. ...
...And 3 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
xt[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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, i...
...oto 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 previously created iv */ if (ptextlen != blocksize) { p
addinglength = blocksize - ptextlen; for ( j=0; j < p
addinglength; j++) { ptext[ptextlen+j] = (unsigned char)p
addinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt fa...
...secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = p
addinglength; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write pad failure\n"); goto cleanup; } rv = secsuccess; cleanup: if (ctxmac != null) { pk11_destroycontext(ctxmac, pr_true); ...
...And 3 more matches
EncDecMAC using token object - sample 3
ed char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char ptext[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int p
addinglength; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, 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 */ wh...
...printf(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 previously created iv */ if (ptextlen != blocksize) { p
addinglength = blocksize - ptextlen; for ( j=0; j < p
addinglength; j++) { ptext[ptextlen+j] = (unsigned char)p
addinglength; } 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 the next iv */ iv = encbuf; ivlen = encbuflen; /* writ...
...xmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = p
addinglength; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write pad failure\n"); goto cleanup; } rv = secsuccess; cleanup: if (ctxmac != null) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc != null) { pk11_destroycontext(ctxenc, pr_true); ...
...And 3 more matches
NSS_3.12.3_release_notes.html
bug 464406: fix signtool regressions bug 465270: uninitialised value in devutil.c::create_object() bug 465273: dead assignment in devutil.c::nssslotarray_clone() bug 465926: during import of pkcs #12 files bug 466180: ssl_co...
... 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 p...
...4532: softoken cannot import certs with empty subjects and non-empty nicknames bug 474777: wrong deallocation when modifying crl. bug 476126: cert_asciitoname fails when avas in an rdn are separated by '+' bug 477186: infinite loop in cert_getcertchainfromcert bug 477777: selfserv crashed in client/server tests. ...
...And 3 more matches
Rhino scopes and contexts
ipt, the object is first searched for a property with the given name. if none is found, the object's prototype is searched. this continues until either the object is found or the end of the prototype chain is reached. so to share information across multiple scopes, we first create the object we wish to share. typically this object will have been created with initstandardobjects and may also have
additional objects specific to the embedding. then all we need to do is create a new object and call its setprototypemethod to set the prototype to the shared object, and the parent of the new scope to null: scriptable newscope = cx.newobject(sharedscope); newscope.setprototype(sharedscope); newscope.setparentscope(null); the call to newobject simply creates a new javascript object with no propert...
... as properties of the instance scope. uses of standard objects like function, string, or regexp will find the definitions in the shared scope. multiple instance scopes can be defined and have their own variables for scripts yet share the definitions in the shared scope. these multiple instance scopes can be used concurrently. ...
...or scripts yet share the definitions in the shared scope. these multiple instance scopes can be used concurrently. sealed shared scopes the ecmascript standard defines that scripts can
add properties to all standard library objects and in many cases it is also possible to change or delete their properties as well. such behavior may not be suitable with shared scopes since if a script by mistake
adds a property to a library object from the shared scope, that object would not be garbage collected until there are no active references to the shared scope potentially leading to memory leaks. in
addition if a script alters some of the standard objects, the library may not work properly for other scripts. such bugs are hard to debug and to remove a possibility for them to occur one can seal the sh...
...And 3 more matches
JS::PersistentRooted
this article covers features introduced in spidermonkey 31 a copyable, assignable global gc root type with arbitrary lifetime, an infallible constructor, and automatic unrooting on destruction. syntax js::persistentrooted<t> var; //
added in spidermonkey 38 js::persistentrooted<t> var(cx); js::persistentrooted<t> var(cx, initial); js::persistentrooted<t> var(rt); js::persistentrooted<t> var(rt, initial); name type description cx jscontext * the context to get the runtime in which to
add the root rt jsruntime * the runtime in which to
add the root. initial t an initial value for the persistent rooted variable. methods here, ptr represents the private member of js::persistentrooted<t>, typed with t. met...
...the runtime in which to
add the root. initial t an initial value for the persistent rooted variable. methods here, ptr represents the private member of js::persistentrooted<t>, typed with t. method description void init(jscontext* cx) initialize with optional initial value (if not provided, it will be initialized with the initial value of the type).
added in spidermonkey 38 void init(jscontext* cx, t initial) void init(jsruntime* rt) void init(jsruntime* rt, t initial) void reset() reset the value to initial value of the type.
added in spidermonkey 38 t& get() returns ptr. ...
... persistentrooted<t>& operator=(const persistentrooted<t>& other) bool operator!=(const t& other) const compares ptr and other. ...
...And 3 more matches
JS::Rooted
this article covers features introduced in spidermonkey 17 local variable of type t whose value is always rooted. syntax js::rooted<t> var(cx); js::rooted<t> var(cx, initial); js::rooted<t> var(rt); js::rooted<t> var(rt, initial); name type description cx jscontext * the context in which to
add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime in which to
add the root. initial t an initial value for the rooted variable. methods here, ptr represents the private member of js::rooted<t>, typed with t. method description t &get() returns ptr. const t &get() const operator const t&() const ...
... t &operator=(const rooted &value) void set(t value) bool operator!=(const t &other) const compares ptr and other. ...
... t &operator=(const rooted &value) void set(t value) bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const description js::rooted<t> declares a local variable of type t whose value is always rooted. ...
...And 3 more matches
JSClass
a jsclass describes a class of javascript objects. a c/c++ program can use a jsclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++. ...
...this field is the bitwise or of one or more of the jsclass_* constants described in jscla...
...17 */ jsclassinternal reserved1; /* obsolete since spidermonkey 13 */ void *reserved[n]; /* sizeof 'reserved' depends on version */ }; name type description name const char * class name flags uint32_t class flags. this field is the bitwise or of one or more of the jsclass_* constants described in jsclass.flags.
addproperty jspropertyop a hook called just after
adding a new property. may modify the new property value. use null or js_propertystub (spidermonkey 31 or older) for default behavior. delproperty jsdeletepropertyop a hook called when deleting a property. may veto. use null or js_deletepropertystub (spidermonkey 31 or older) for default behavior. ...
...And 3 more matches
SpiderMonkey 45
wnpropertybyid (bug 1211607) js_hasownproperty (bug 1211607) js_deleteucproperty (bug 1211607) js::newfunctionfromspec (bug 1054756) js::compilefornonsyntacticscope (bug 1165486) js_checkforinterrupt (bug 1058695) js::mapdelete (bug 1159469) js::mapforeach (bug 1159469) js::newsetobject (bug 1159469) js::setsize (bug 1159469) js::sethas (bug 1159469) js::setdelete (bug 1159469) js::set
add (bug 1159469) js::setclear (bug 1159469) js::setkeys (bug 1159469) js::setvalues (bug 1159469) js::setentries (bug 1159469) js::setforeach (bug 1159469) js::exceptionstackornull (bug 814497) js::copyasyncstack (bug 1160307) js::getsavedframesource (bug 1216819) js::getsavedframeline (bug 1216819) js::getsavedframecolumn (bug 1216819) js::getsavedframefunctiondisplayname (bug 1216819) ...
...ng (bug 1181175) js::resetperformancemonitoring (bug 1181175) js::disposeperformancemonitoring (bug 1208747) js::setstopwatchismonitoringcpow (bug 1156264) js::getstopwatchismonitoringcpow (bug 1156264) js::setstopwatchismonitoringjank (bug 1156264) js::getstopwatchismonitoringjank (bug 1156264) js::isstopwatchactive (bug 674779) js::getperfmonitoringtestcpurescheduling (bug 1181175) js::
addcpowperformancedelta (bug 1181175) js::setstopwatchstartcallback (bug 1208747) js::setstopwatchcommitcallback (bug 1208747) js::setgetperformancegroupscallback (bug 1208747) js_stringhasbeeninterned renamed to js_stringhasbeenpinned (bug 1178581) js_internjsstring renamed to js_atomizeandpinjsstring (bug 1178581) js_internstringn renamed to js_atomizeandpinstringn (bug 1178581) js_internstr...
... known issues detail any known issues here... future direction jscontext and ...
...And 3 more matches
Redis Tips
edis-server on your machine, and use the redis-cli at the command-line for hacking. node.js redis client: https://github.com/mranney/node_redis npm install redis python redis client: https://github.com/andymccurdy/redis-py there are some gotchas with the python api: https://github.com/andymccurdy/redis-py#api-reference select statement not implemented del is 'delete' in python z
add argument order is wrong setex argument order is wrong the default redis port is 6379. in node, create client with explicit host and port like so: > var r = require('redis').createclient(6379, '127.0.0.1') commands are asynchronous. in standard node fashion, first return value is error or null; second return value is result of redis command. > r.set('foo', 42, console.log) null 'ok' > r.g...
...e optional parameters are done. > var r = require('redis').createclient(); // and i'll define these utility functions just for this example > function now() { return (new date()).gettime() / 1000 } > function print(err, results) { console.log(json.stringify(results, null, 2)) } whenever someone logs into my site, i record them in my 'last-login' zset. ...
... = require('redis').createclient(); // and i'll define these utility functions just for this example > function now() { return (new date()).gettime() / 1000 } > function print(err, results) { console.log(json.stringify(results, null, 2)) } whenever someone logs into my site, i record them in my 'last-login' zset. i'll simulate some logins like so: > r.z
add('last-login', now(), 'lloyd'); > r.z
add('last-login', now(), 'jparsons'); > r.z
add('last-login', now(), 'zarter'); > r.z
add('last-login', now(), 'lloyd'); // he logged in again! w00t! here's what the zset contains now: > r.zrange('last-login', 0, -1, print); // remember, i defined 'print' above ["jparsons", "zcarter", "lloyd"] since this is a set, lloyd only appears once, with updated login timestamp. zrange gives you everythi...
...And 3 more matches
Receiving startup notifications
times, for example. receiving startup notifications in gecko 2.0 (firefox 4) and later in order to improve startup times, changes were made to the xpcom startup process. see the startup process for details on how this now works, if you're interested in specifics. ...
...the startup process during application startup, the application's manifest is used to get a list of the components it needs to register, and those components are loaded. ...
...u. for example: category profile-after-change mycomponent @foobar/mycomponent;1 important: in the past, the contract id of the category entry started with "service," if the component was implemented as a service. this is no longer the case, so be sure to remove that when migrating existing code.
additionally, the earliest startup time notification you can receive is now profile-after-change. your
add-on will not receive xpcom-startup or app-startup notifications. the startup process during application startup, the application's manifest is used to get a list of the components it needs to register, and those components are loaded. this gets enough of xpcom and the application loaded and running that the extension manager can then be loaded and handle installing, uninstalling, and updating any ...
...And 3 more matches
amIWebInstallListener
toolkit/mozapps/extensions/amiwebinstalllistener.idlscriptable starts all installs. the registered amiwebinstalllistener is used to notify about new installs triggered by websites. the default implementation displays a confirmation dialog when
add-ons are ready to install and uses the observer service to notify when installations are blocked. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview boolean onwebinstallblocked(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); void onwebinstalldisabled(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivarian...
...nt32 acount); boolean onwebinstallrequested(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindowinternal. ...
... return value true if the caller should start the installs. onwebinstalldisabled() called when installation by websites is currently disabled. ...
...And 3 more matches
nsICookieManager2
the nsicookiemanager2 interface contains
additional methods that expand upon the nsicookiemanager interface. netwerk/cookie/nsicookiemanager2.idlscriptable please
add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsicookiemanager this interface is included in the services.jsm javascript code module. ...
...d a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsicookiemanager this interface is included in the services.jsm javascript code module. ...
...presence of a leading...
...And 3 more matches
nsIDBChangeListener
the nsidbchangelistener interface is used by components wanting to receive notification when the current database changes somehow. ...
...ropertychanged: function(ahdrtochange, aprechange, astatus, ainstigator) {}, onevent: function(adb, aevent) {}, queryinterface: function(aiid) { if (!aiid.equals(components.interfaces.nsidbchangelistener) && !aiid.equals(components.interfaces.nsisupports)) throw components.results.ns_error_no_interface; return this; } }; and to attach it in thunderbird, we must call
addlistener on a nsidbchangeannouncer, typically through a nsimsgdatabase. there are a couple of ways to access the message database: if you have a nsimsgfolder, you can do this like so: somefolder.msgdatabase.
addlistener(mylistener); alternately, you can access the message database through the nsimsgdbview like so: gfolderdisplay.view.dbview.db.
addlistener(mylistener); method overview ...
...imsgdbview like so: gfolderdisplay.view.dbview.db.
addlistener(mylistener); method overview void onhdrflagschanged(in nsimsgdbhdr ahdrchanged, in unsigned long aoldflags, in unsigned long anewflags, in nsidbchangelistener ainstigator); void onhdrdeleted(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in nsidbchangelistener ainstigator); void onhdr
added(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in nsidbchangelistener ainstigator); void onparentchanged(in nsmsgkey akeychanged, in nsmsgkey oldparent, in nsmsgkey newparent, in nsidbchangelistener ainstigator); void onannouncergoingaway(in nsidbchangeannouncer instigator); void onreadchanged(in nsidbchangelistener ainstigator); void onj...
...And 3 more matches
nsIDocShell
s last changed in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9) implemented by @mozilla.org/docshell;1. do not create an instance directly. instead, retrieve an nsidocshell from a browser or other document container element. note that out-of-process browsers do not have an nsidocshell; instead you can access the nsidocshell object from a frame script. ...
...nted by @mozilla.org/docshell;1. do not create an instance directly. instead, retrieve an nsidocshell from a browser or other document container element. note that out-of-process browsers do not have an nsidocshell; instead you can access the nsidocshell object from a frame script. ...
...t 13 kcharsetfromparentforced 14 the parent's character set was forced onto this content; all descendents will have this character set forced onto it. kcharsetfromuserforced 15 the user specified a character set to force onto this content; all descendents will have this character set forced onto it. kcharsetfrompreviousloading methods
addsessionstorage()
add a webapps session storage object to the docshell. void
addsessionstorage( in nsiprincipal principal, in nsidomstorage storage ); parameters principal the principal to use for the new storage object. storage the storage object to
add.
addstate() do either a history.pushstate() or history.replacestate() operation, depending on the value of areplace. void a...
...And 3 more matches
nsIFaviconService
ced gecko 1.8 inherits from: nsisupports last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/favicon-service;1. ...
...e gecko 22.0 void setfavicondatafromdataurl(in nsiuri afaviconuri, in astring adataurl, in prtime aexpiration); obsolete since gecko 22.0 void setfaviconurlforpage(in nsiuri apageuri, in nsiuri afaviconuri); obsolete since gecko 22.0 attributes attribute type description defaultfavicon nsiuri the default favicon uri. read only. ...
...avicondatafromdataurl(in nsiuri afaviconuri, in astring adataurl, in prtime aexpiration); obsolete since gecko 22.0 void setfaviconurlforpage(in nsiuri apageuri, in nsiuri afaviconuri); obsolete since gecko 22.0 attributes attribute type description defaultfavicon nsiuri the default favicon uri. read only. methods
addfailedfavicon() this method
adds a given favicon's uri to the failed favicon cache. the lifespan of the favicon cache is up to the caching system. this cache will also be written to if you use setandloadfaviconforpage() method and it encounters an error while fetching an icon. void
addfailedfavicon( in nsiuri afaviconuri ); parameters afaviconuri the uri of an icon in the favicon service. can be null. expireallfavi...
...And 3 more matches
nsIGlobalHistory3
y3.idlscriptable this interface provides information about global history to gecko. 1.0 66 introduced gecko 1.8 obsolete gecko 9.0 inherits from: nsiglobalhistory2 last changed in gecko 1.9 (firefox 3) this interface was originally created as part of nsiglobalhistory2, but was split off during the transition to places. method overview void
adddocumentredirect(in nsichannel aoldchannel, in nsichannel anewchannel, in print32 aflags, in boolean atoplevel); unsigned long geturigeckoflags(in nsiuri auri); void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods
adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implement...
...hannel aoldchannel, in nsichannel anewchannel, in print32 aflags, in boolean atoplevel); unsigned long geturigeckoflags(in nsiuri auri); void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods
adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally
add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. ...
...signed long aflags); methods
adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally
add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. this function is preferred if nsiglobalhistory3 is available. otherwise, nsiglobalhistory2.
adduri() should be called with redirect=true. this function is preferred to nsiglobalhistory2.
adduri() because it provides more information (including the redirect destination, channels involved, and redirect flags) to the history implementation. for implementors of nsiglobalhistory3: the history implementation is responsible for sending ns_link_visited_event_topic to observers for redirect pages. th...
...And 3 more matches
nsIIOService
ss stylesheet it's the document whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for ) then pass in the document node instead. for loads that are not related to any document, such as loads coming from
addons or internal browser features, use null here. aloadingprincipal the loadingprincipal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this argument must be passed. for example for loads from a webworke...
...ngprincipal the loadingprincipal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this argument must be passed. for example for loads from a webworker, pass the principal of that worker. for loads from an
addon or from internal browser features, pass the system principal. this principal should almost always be the system principal if aloadingnode is null. the only exception to this is for loads from webworkers since they don't have any nodes to be passed as aloadingnode. please note, aloadingprincipal is *not* the principal of the resource being loaded. but rather the principal of the context where th...
...sheet it's the document whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for <img>) then pass in the document node instead. for loads that are not related to any document, such as loads coming from
addons or internal browser features, use null here. aloadingprincipal the loadingprincipal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this arg...
...And 3 more matches
nsIIdleService
ill still consider the user to be active. currently nsiidleservice implementations exist for windows, mac os x, and linux (via xscreensaver). implemented by: @mozilla.org/widget/idleservice;1. to create an instance, use: var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidleservice); method overview void
addidleobserver(in nsiobserver observer, in unsigned long time); void removeidleobserver(in nsiobserver observer, in unsigned long time); attributes attribute type description idletime unsigned long the amount of time in milliseconds that has passed since the last user activity. can be 0 if there is no valid idle time to report (this can happen if the us...
...igned long time); attributes attribute type description idletime unsigned long the amount of time in milliseconds that has passed since the last user activity. can be 0 if there is no valid idle time to report (this can happen if the user never interacted with the browser at all, and if we are unable to poll for idle time manually). read only. methods
addidleobserver()
add an observer to be notified when the user idles for some period of time, and when they get back from that. the subject of the notification the observer will get is always the nsiidleservice itself. when the user goes idle, the observer topic is 'idle' and when they get back, the observer topic is 'back' in gecko 15 and earlier or 'active' in gecko 16 and later. the data param...
...t. the subject of the notification the observer will get is always the nsiidleservice itself. when the user goes idle, the observer topic is 'idle' and when they get back, the observer topic is 'back' in gecko 15 and earlier or 'active' in gecko 16 and later. the data parameter for the notification contains the current user idle time in gecko 15 and earlier or 0 in gecko 16 and later. you can
add the same observer twice. most implementations need to poll the os for idle info themselves, meaning your notifications could arrive with a delay up to the length of the polling interval in that implementation. current implementations use a delay of 5 seconds. gecko 1.9.2 note starting in gecko 1.9.2, there is a once a day notification sent out if the user remains idle for an extended peri...
...And 3 more matches
nsILoadGroup
netwerk/base/public/nsiloadgroup.idlscriptable a load group maintains a collection of nsirequest objects. ...
...sult astatus); attributes attribute type description activecount unsigned long returns the count of "active" requests (that is requests without the load_background bit set). read only. defaultloadrequest nsirequest accesses the default load request for the group. ...
...uests are
added to a group, the defaultloadrequest may be set to indicate that all of the requests are related to a base request. the load group inherits its load flags from the default load request. if the default load request is null, then the group's load flags are not changed. groupobserver nsirequestobserver the group observer is notified when requests are
added to and removed from this load group. the groupobserver is weak referenced. notificationcallbacks nsiinterfacerequestor notification callbacks for the load group. requests nsisimpleenumerator returns the requests contained directly in this group. enumerator element type: nsirequest. read only. ...
...And 3 more matches
nsIMacDockSupport
selected, since doing so does not automatically activate the application. void activateapplication( in boolean aignoreotherapplications ); parameters aignoreotherapplications if true, the application is activated regardless of the state of other applications. if false, the application is only activated if other applications are not currently active. about dockmenu by default firefox
adds two menu items to the dock menu. the menu items are "new window" and "new private window". if permanent private browsing mode is enabled then the "new private window" menu item is hidden. this is created by using the dockmenu attribute of nsimacdocksupport here: http://mxr.mozilla.org/mozilla-release/source/browser/base/content/browser.js#1562 this is seen here: if you were to copy and follow ...
... = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menupopup'); macmenu.setattribute('id', 'mymacmenu'); var macmenuitem = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem'); macmenuitem.setattribute('label', 'show most recent window'); macmenuitem.setattribute('id', 'mymacmenuitem'); macmenuitem.
addeventlistener('command', function(){ var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksupport); docksupport.activateapplication(true); services.wm.getmostrecentwindow(null).focus() }) macmenu.appendchild(macmenuitem); var mainpopupset = win.document.getelementbyid('mainpopupset'); mainpopupset.appendchild(macmenu); let dockmenuelement = macmenu; //documen...
...vemenu.init(dockmenuelement); docksupport.dockmenu = nativemenu; this replaces the default menu with this one menuitem that says "show most recent window". notice the activateapplication(true), if this is not done then firefox will not be activated. the result of this code is shown below. notice how the "new window" and "new private window" menuitem's are missing. ...
...And 3 more matches
nsINavHistoryObserver
methods onbeforedeleteuri() obsolete since gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18) note: this method was removed in gecko 21.0 as part of bug 826409. the specified page and all its visits are about to be deleted. n...
...age. onendupdatebatch() called once a batch of updates is completed. once this has been called, you can perform processing, user interface updates, and so forth. this is called sometime after onbeginupdatebatch(). void onendupdatebatch(); parameters none. onpagechanged() some attribute on the specified page has changed. note that for typed and hidden pages, the page might not actually have been
added yet. this needs to be clarified; what are typed and hidden? void onpagechanged( in nsiuri auri, in unsigned long awhat, in astring avalue ); parameters auri the uri of the page on which an attribute changed. awhat the attribute whose value changed. avalue the attribute's new value. onpageexpired() obsolete since gecko 2.0 (firefox 4 / thunderbir...
...e) are not displayed in history results (unless includehidden is set). many observers can ignore _embed notifications (which will comprise the majority of visit notifications) to save work. void onvisit( in nsiuri auri, in long long avisitid, in prtime atime, in long long asessionid, in long long areferringid, in unsigned long atransitiontype, in acstring aguid, out unsigned long a
added ); parameters auri the uri of the page being visited. avisitid id of the visit that was just created. atime time of the visit. asessionid the id of one connected sequence of visits. areferringid the id of the visit the user came from. 0 if empty. atransitiontype the type of the item that is about to be removed; this is one of the nsinavbookmarks...
...And 3 more matches
Component; nsIPrefBranch
accessed off of this root by using just the final portion of the preference. for example, if this object is created with the root "browser.startup.", the preferences "browser.startup.page", "browser.startup.homepage", and "browser.startup.homepage_override" can be accessed by simply passing "page", "homepage", or "homepage_override" to the various get/set methods. ...
... attribute type description root string called to get the root on which this branch is based, such as "browser.startup." read only. constants constant value description pref_invalid 0 long pref_string 32 long data type. pref_int 64 long data type. pref_bool 128 long data type. methods
addobserver()
adds a preference change observer. on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this). atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of ...
...following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this). atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of the modified preference. for example, if your observer is registered with
addobserver("bar.", ...) on a branch with root "foo.", modifying the preference "foo.bar.baz" will trigger the observer, and adata parameter will be "bar.baz". void
addobserver( in string adomain, in nsiobserver aobserver, in boolean aholdweak ); parameters adomain the preference on which to listen for changes. this can be the name of an entire branch to observe. for example holding the ...
...And 3 more matches
nsISHEntry
ument from history. inherits from: nsihistoryentry last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/browser/session-history-entry;1. ...
...ynamiccreation); native code only! nsdocshelleditordataptr forgeteditordata(); violates the xpcom interface guidelines nsicontentviewer getanycontentviewer(out nsishentry ownerentry); void getscrollposition(out long x, out long y); void getviewerbounds(in nsintrect bounds); native code only! boolean hasdetachededitor(); violates the xpcom interface guidelines boolean hasdynamically
addedchild(); boolean isdynamically
added(); void seteditordata(in nsdocshelleditordataptr adata); violates the xpcom interface guidelines void setissubframe(in boolean aflag); void setscrollposition(in long x, in long y); void settitle(in astring atitle); void setuniquedocidentifier(); void seturi(in nsiuri auri); void setviewerbounds(in nsintrect bounds); native code only! voi...
...an indicate whether layouthistorystate should be saved. statedata nsistructuredclonecontainer get/set data associated with this history state via a pushstate() call, serialized using structured clone. (prior to gecko 6.0 returned a json encoded string.) sticky boolean whether the content viewer is marked "sticky" windowstate nsisupports saved state of the global window object. ...
...And 3 more matches
nsITelemetry
[optional] in boolean clear); nsisupports getloadedmodules(); jsval snapshotkeyedhistograms(in uint32_t adataset, in boolean asubsession, in boolean aclear); void sethistogramrecordingenabled(in acstring id, in boolean enabled); void asyncfetchtelemetrydata(in nsifetchtelemetrydatacallback acallback); double mssinceprocessstart(); void scalar
add(in acstring aname, in jsval avalue); void scalarset(in acstring aname, in jsval avalue); void scalarsetmaximum(in acstring aname, in jsval avalue); jsval snapshotscalars(in uint32_t adataset, [optional] in boolean aclear); void keyedscalar
add(in acstring aname, in astring akey, in jsval avalue); void keyedscalarset(in acstring aname, in astring akey, i...
... 1 the extended dataset that is opt-in on release, opt-out on pre-release channels. methods gethistogrambyid() get an histogram by id for histograms registered in histograms.json. jsval gethistogrambyid( in acstring id ); parameters id unique identifier from toolkit/components/telemetry/histograms.json. return value the returned jsval object has the following functions:
add(value) -
adds an integer value to the appropriate bucket snapshot() - returns a snapshot of the histogram with the same data fields as in histogramsnapshots. getkeyedhistogrambyid() get a keyed histogram for histograms registered in histograms.json. jsval getkeyedhistogrambyid( in acstring id ); parameters id unique identifier from toolkit/components/telemetry/histograms.json. retu...
...) - returns a snapshot of the histogram with the same data fields as in histogramsnapshots. getkeyedhistogrambyid() get a keyed histogram for histograms registered in histograms.json. jsval getkeyedhistogrambyid( in acstring id ); parameters id unique identifier from toolkit/components/telemetry/histograms.json. return value the returned jsval object has the following functions:
add(key, [optional] value) -
adds an integer value to the appropriate bucket. for count histograms providing the value is optional. snapshot([optional] key) - returns a snapshot of the keyed histogram or (if key is provided) the snapshot of the contained histogram with that key. keys() - returns an array with the string keys of the currently registered histograms. clear() - clear out the registere...
...And 3 more matches
nsITransactionManager
editor/txmgr/idl/nsitransactionmanager.idlscriptable this interface is implemented by an object that wants to manage/track transactions. ...
...ist at any time on both the undo and redo stacks. this method will prune the necessary number of transactions on the undo and redo stacks if the value specified is less than the number of items that exist on both the undo and redo stacks. numberofredoitems long the number of items on the redo stack. read only. numberofundoitems long the number of items on the undo stack. read only. methods
addlistener()
adds a listener to the transaction manager's notification list. listeners are notified whenever a transaction is done, undone, or redone. the listener's nsitransactionlistener.
addref() method is called. void
addlistener( in nsitransactionlistener alistener ); parameters alistener the nsitransactionlistener to
add. beginbatch() turns on the transaction manager's batch mode, forcing ...
...n to execute and group together several independent transactions so they can be undone with a single call to undotransaction(). void beginbatch(); parameters none. clear() clears the undo and redo stacks. void clear(); parameters none. dotransaction() calls a transaction's nsitransaction.dotransaction() method, then pushes it on the undo stack. this method calls the transaction's nsitransaction.
addref() method. the transaction's nsitransaction.release() method will be called when the undo or redo stack is pruned or when the transaction manager is destroyed. void dotransaction( in nsitransaction atransaction ); parameters atransaction the nsitransaction to do. endbatch() turns off the transaction manager's batch mode. void endbatch(); parameters none. getredolist() returns the list of ...
...And 3 more matches
nsIWebProgress
the nsiwebprogress interface is used to
add or remove nsiwebprogresslistener instances to observe the loading of asynchronous requests (usually in the context of a dom window). nsiwebprogress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective dom windows. however, in some cases a nsiwebprogress instance may not have an associated dom window. the parent-child relationship of nsiwebprogress instances is not made explicit by this interface, but the relationship may exist in some implementations. ...
...ent-child configuration of their respective dom windows. however, in some cases a nsiwebprogress instance may not have an associated dom window. the parent-child relationship of nsiwebprogress instances is not made explicit by this interface, but the relationship may exist in some implementations. ...
...s instances is not made explicit by this interface, but the relationship may exist in some implementations. a nsiwebprogresslistener instance receives notifications for the nsiwebprogress instance to which it
added itself, and it may also receive notifications from any nsiwebprogress instances that are children of that nsiwebprogress instance. uriloader/base/nsiwebprogress.idlscriptable please
add a summary to this article. last changed in gecko 1.8.0 inherits from: nsisupports method overview void
addprogresslistener(in nsiwebprogresslistener alistener, in unsigned long anotifymask); void removeprogresslistener(in nsiwebprogresslistener alistener); attributes attribute type description domwindow nsidomwindow the dom window associated with this nsiwebprogress instance. ...
...And 3 more matches
LDAP Support
this document is intended to "fill in the gaps" about how enterprise customers can leverage and customize ldap support in mozilla thunderbird. it is not intended as an introduction to ldap and mozilla products. it assumes you are already familiar with configuring preferences for deployed builds in
addition to setting up thunderbird to use an ldap directory. it should be noted that all of this information applies to both thunderbird and the seamonkey application suite. mail compose typedown in mail compose, when typing a partial mail
address, a typedown window appears listing possible matches against
address books and ldap directories. for large companies, there may be a large number of users in the directory with the same name. in such a scenario, it may be hard to tell which person...
... this example, we are setting the organization unit as the ldap attribute. you can also insert arbitrary text to clarify the ldap attribute. i.e. "department: [ou]" would yield a type down entry that looks like "john smit department: client engineering". ldap schema the following table summarizes the schema used by thunderbird to map between ldap attributes and attributes within the the
address book. some notes about the relationship: there is a many to one relationship between ldap attributes and its
address book counterpart. there is a one to one relationship between a
address book attribute and its ldap counterpart. if there are multiple entries for a
address book attribute, the first takes precedence. these relationships ensure: generality is maintained when mapping from l...
...tes about the relationship: there is a many to one relationship between ldap attributes and its
address book counterpart. there is a one to one relationship between a
address book attribute and its ldap counterpart. if there are multiple entries for a
address book attribute, the first takes precedence. these relationships ensure: generality is maintained when mapping from ldap attributes to
address book. consistent round tripping when editing
address book attributes which are stored on an ldap server. ...
...And 3 more matches
Using COM from js-ctypes
ialize(); return 0; } to run the code, save it as test.c, and run following command in the directory. $ cl ole32.lib test.c c code with pseudo struct needs pseudo struct description here. ...
...js-ctypes in almost straightforward way. clsid and iid needs clsid and iid of spvoice and ispvoice description here. com types and functions needs com types (guid) and functions (coinitialize etc) description here. converted js-ctypes code here's converted code. this example uses busy loop and thus firefox won't respond until the speaking is done. if this code were used in a production
add-on, then to avoid firefox locking up, run this code from a chromeworker. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); // some groundwork let is64bit; if (ctypes.voidptr_t.size == 4 /* 32-bit */) { is64bit = false; } else if (ctypes.voidptr_t.size == 8 /* 64-bit */) { is64bit = true; } let winabi = is64bit ? ctypes.default_abi : ctypes.winapi_abi; l...
...} ]); // advanced structures let clsid = guid; let iid = guid; // super advanced structures let refiid = iid.ptr; let refclsid = clsid.ptr; // vtables let ispvoicevtbl = ctypes.structtype('ispvoicevtbl'); let ispvoice = ctypes.structtype('ispvoice', [{ 'lpvtbl': ispvoicevtbl.ptr }]); ispvoicevtbl.define([ // start inherit from iunknown { 'queryinterface': ctypes.voidptr_t }, { '
addref': ctypes.voidptr_t }, { 'release': ctypes.functiontype(callback_abi, ulong, // return [ ispvoice.ptr ]).ptr }, // end inherit from iunknown // start inherit from ispnotifysource // can set to ctypes.voidptr_t if arent going to use it { 'setnotifysink': ctypes.voidptr_t }, { 'setnotifywindowmessage': ctypes.voidptr_t }, ...
...And 3 more matches
Debugger.Object - Firefox Developer Tools
ther metadata about the referent, or null if none is available. the metadata object is in the same compartment as this debugger.object instance. the same metadata object is returned each time for a given debugger.object instance. a typical javascript embedding provides "host objects" to expose application-specific functionality to scripts. the hostannotations accessor consults the embedding for
additional information about the referent that might be of interest to the debugger. the returned object's properties' meanings are up to the embedding. for example, a web browser might provide host annotations for global objects to distinguish top-level windows, iframes, and internal javascript scopes. by convention, host annotation objects have a string-valued "type" property that, taken together...
... defineproperty(name,attributes) define a property on the referent namedname, as described by the property descriptordescriptor. any value, get, and set properties ofattributes must be debuggee values. (this function behaves like object.defineproperty, except that the target object is implicit, and in a different compartment from the function and descriptor.) defineproperties(properties)
add the properties given byproperties to 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 propert...
... 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() prevent 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() prevent properties from being
added to or deleted from the referent, and mark each property as non-writable. return this debugger.object instance. (thi...
...And 3 more matches
Animation.playbackRate - Web APIs
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. ...
...oes 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. ...
...change.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() { alicechange.playbackrate = 1; alicechange.play(); } // on tap or click, alice will grow. ...
...And 3 more matches
AudioTrackList - Web APIs
given html media element, with each track represented by a separate audiotrack object in the list. retrieve an instance of this object with htmlmediaelement.audiotracks. the individual tracks can be accessed using array syntax. properties this interface also inherits properties from its parent interface, eventtarget. length read only the number of tracks in the list. event handlers on
addtrack an event handler to be called when the
addtrack event is fired, indicating that a new audio track has been
added to the media element. onchange an event handler to be called when the change event occurs. this occurs when one or more tracks have been enabled or disabled by their enabled flag being changed. onremovetrack an event handler to call when the removetrack event is sent, indicat...
...nremovetrack an event handler to call when the removetrack event is sent, indicating that an audio track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the audiotrack found within the audiotracklist whose id matches the specified string. if no match is found, null is returned. ...
...removetrack event is sent, indicating that an audio track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the audiotrack found within the audiotracklist whose id matches the specified string. if no match is found, null is returned. events
addtrack fired when a new audio track has been
added to the media element. ...
...And 3 more matches
Basic animations - Web APIs
text ctx = document.getelementbyid('canvas').getcontext('2d'); // set refresh rate return setinterval(draw, speed); } function draw() { ctx.clearrect(0, 0, clearx, cleary); // clear the canvas // if image is <= canvas size if (imgw <= canvasxsize) { // reset, start from beginning if (x > canvasxsize) { x = -imgw + x; } // draw
additional image1 if (x > 0) { ctx.drawimage(img, -imgw + x, y, imgw, imgh); } // draw
additional image2 if (x - imgw > 0) { ctx.drawimage(img, -imgw * 2 + x, y, imgw, imgh); } } // image is > canvas size else { // reset, start from beginning if (x > (canvasxsize)) { x = canvasxsize - imgw; ...
... c.fillstyle = "rgba(0,0,0,0.05)"; c.fillrect(0, 0, cn.width, cn.height); a.foreach(function(e, i) { e.dr(); }); } </script> <style> #cw { position: fixed; z-index: -1; } body { margin: 0; p
adding: 0; background-color: rgba(0,0,0,0.05); } </style> </head> <body> <canvas id="cw"></canvas> </body> </html> output snake game <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" conten...
...w(), void (document.getelementbyid("score").innertext = number(document.getelementbyid("score").innertext) + 1); this.sn.pop(), console.log(6) } this.sn.foreach((t, e, i) => { if (0 == e || i.length - 1 == e) { var n = c.createlineargradient(t.x, t.y, t.x + this.w, t.y + this.h); i.length - 1 == e ? ...
...And 3 more matches
DOMTokenList - Web APIs
number of objects stored in the object. domtokenlist.value a stringifier property that returns the value of the list as a domstring. methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. domtokenlist.contains(token) returns true if the list contains the given token, otherwise false. domtokenlist.
add(token1[, token2[, ...tokenn]])
adds the specified token(s) to the list. domtokenlist.remove(token1[, token2[, ...tokenn]]) removes the specified token(s) from the list. domtokenlist.replace(oldtoken, newtoken) replaces token with newtoken. domtokenlist.supports(token) returns true if a given token is in the associated attribute's supported tokens. domtokenlist.toggle(token [, force]) rem...
...specified token(s) to the list. domtokenlist.remove(token1[, token2[, ...tokenn]]) removes the specified token(s) from the list. domtokenlist.replace(oldtoken, newtoken) replaces token with newtoken. domtokenlist.supports(token) returns true if a given token is in the associated attribute's supported tokens. domtokenlist.toggle(token [, force]) removes token from the list if it exists, or
adds token to the list if it doesn't. returns a boolean indicating whether token is in the list after the operation. domtokenlist.entries() returns an iterator, allowing you to go through all key/value pairs contained in this object. domtokenlist.foreach(callback [, thisarg]) executes a provided callback function once per domtokenlist element. domtokenlist.keys() returns an iterator, allowing y...
...domtokenlist.keys() returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object. domtokenlist.values() returns an iterator, allowing you to go through all values of the key/value pairs contained in this object. ...
...And 3 more matches
Document.execCommand() - Web APIs
when using contenteditable, execcommand() affects the currently active editable element. ...
...gument for the hyperlink's href. the uri must contain at least a single character, which may be whitespace. (internet explorer will create a link with a null value.) cut removes the current selection and copies it to the clipboard. when this behavior is enabled varies between browsers, and its conditions have evolved over time. check the compatibility table for usage details. decreasefontsize
adds a <small> tag around the selection or at the insertion point. (not supported by internet explorer.) defaultparagraphseparator changes the paragraph separator used when new paragraphs are created in editable text regions. see differences in markup generation for more details. delete deletes the current selection. enableabsolutepositioneditor enables or disables the grabber that allows absol...
... selection or at the insertion point. this requires a font name string (like "arial") as a value argument. fontsize changes the font size for the selection or at the insertion point. this requires an integer from 1-7 as a value argument. forecolor changes a font color for the selection or at the insertion point. this requires a hexadecimal color value string as a value argument. ...
...And 3 more matches
Introduction to the DOM - Web APIs
table object that implements the special htmltableelement dom interface for accessing html tables, and so forth). this documentation provides an object-by-object reference to the dom. the modern dom is built using multiple apis that work together. the core dom defines the objects that fundamentally describe a document and the objects within it. this is expanded upon as needed by other apis that
add new features and capabilities to the dom. for example, the html dom api
adds support for representing html documents to the core dom. dom and javascript the short example above, like nearly all of the examples in this reference, is javascript. that is to say, it's written in javascript, but it uses the dom to access the document and its elements. the dom is not a programming language, but witho...
...ing the alert() function from the window object, or it may use more sophisticated dom methods to actually create new content, as in the longer example below. this following javascript will display an alert when the document is loaded (and when the whole dom is available for use): <body onload="window.alert('welcome to my home page!');"> another example. ...
...ndow object, or it may use more sophisticated dom methods to actually create new content, as in the longer example below. this following javascript will display an alert when the document is loaded (and when the whole dom is available for use): <body onload="window.alert('welcome to my home page!');"> another example. ...
...And 3 more matches
EffectTiming.fill - Web APIs
igger the animation to begin. ...
...to begin. ...
...that css looks like this: #box { width: 200px; height: 200px; left: 50px; ...
...And 3 more matches
Using FormData Objects - Web APIs
ting <form>, specify that form element when creating the formdata object: note: formdata will only use input fields that use the name attribute. ...
...o the formdata object between retrieving it from a form and sending it, like this: var formelement = document.queryselector("form"); var formdata = new formdata(formelement); var request = new xmlhttprequest(); request.open("post", "submitform.php"); formdata.append("serialnumber", serialnumber++); request.send(formdata); this lets you augment the form's data before sending it along, to include
additional information that's not necessarily user-editable. sending files using a formdata object you can also send files using formdata. simply include an <input> element of type file in your <form>: <form enctype="multipart/form-data" method="post" name="fileinfo"> <label>your email
address:</label> <input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required s...
...d size="32" maxlength="64" /><br /> <label>custom file label:</label> <input type="text" name="filelabel" size="12" maxlength="32" /><br /> <label>file to stash:</label> <input type="file" name="file" required /> <input type="submit" value="stash the file!" /> </form> <div></div> then you can send it using code like the following: var form = document.forms.nameditem("fileinfo"); form.
addeventlistener('submit', function(ev) { var ooutput = document.queryselector("div"), odata = new formdata(form); odata.append("customfield", "this is some extra data"); var oreq = new xmlhttprequest(); oreq.open("post", "stash.php", true); oreq.onload = function(oevent) { if (oreq.status == 200) { ooutput.innerhtml = "uploaded!"; } else { ooutput.innerhtml = "...
...And 3 more matches
Guide to the Fullscreen API - Web APIs
we can put that video into full-screen mode as follows: var elem = document.getelementbyid("myvideo"); if (elem.requestfullscreen) { elem.requestfullscreen(); } this code checks for the existence of the requestfullscreen() method before calling it. ...
...erences it's worth noting a key difference here between the gecko and webkit implementations at this time: gecko automatically
adds css rules to the element to stretch it to fill the screen: "width: 100%; height: 100%". webkit doesn't do this; instead, it centers the fullscreen element at the same size in a screen that's otherwise black. ...
... the document is entering or exiting fullscreen mode, but if the document has a non null fullscreenelement, you know you're in fullscreen mode. when a fullscreen request fails it's not guaranteed that you'll be able to switch into fullscreen mode. for example, <iframe> elements have the allowfullscreen attribute in order to opt-in to allowing their content to be displayed in fullscreen mode. in
addition, certain kinds of content, such as windowed plug-ins, cannot be presented in fullscreen mode. attempting to put an element which can't be displayed in fullscreen mode (or the parent or descendant of such an element) won't work. instead, the element which requested fullscreen will receive a mozfullscreenerror event. when a fullscreen request fails, firefox will log an error message to the web...
...And 3 more matches
HTMLElement: animationcancel event - Web APIs
cancel event is fired when a css animation unexpectedly aborts. in other words, any time it stops running without sending an animationend event. this might happen when the animation-name is changed such that the animation is removed, or when the animating node is hidden using css. therefore, either directly or because any of its containing nodes are hidden. an event handler for this event can be
added by setting the onanimationcancel property, or using
addeventlistener(). bubbles yes cancelable no interface animationevent event handler property onanimationcancel examples this code gets an element that's currently being animated and
adds a listener to the animationcancel event. it then sets the element's display property to none, which ...
... cancelable no interface animationevent event handler property onanimationcancel examples this code gets an element that's currently being animated and
adds a listener to the animationcancel event. it then sets the element's display property to none, which will trigger the animationcancel event. ...
...ted and
adds a listener to the animationcancel event. it then sets the element's display property to none, which will trigger the animationcancel event. ...
...And 3 more matches
HTMLElement: transitionend event - Web APIs
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. ...
...sition 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. ...
...in this example, to cancel the transition, stop hovering over the transitioning box before the transition ends. for the transition end event to fire, stay hovered over the transition until the transition ends. const message = document.queryselector('.message'); const el = document...
...And 3 more matches
HTMLElement - Web APIs
the htmlelement interface represents any html element. some elements directly implement this interface, while others implement it via an interface that inherits it. ...
... order. htmlelement.title is a domstring containing the text that appears in a popup box when mouse is over the element. htmlelement.translate is a boolean representing the translation. event handlers most event handler properties, of the form onxyz, are defined on the documentandelementeventhandlers, globaleventhandlers or toucheventhandlers interfaces and implemented by htmlelement. in
addition, the following handlers are specific to htmlelement. htmlelement.oncopy returns the event handling code for the copy event (bug 280959). htmlelement.oncut returns the event handling code for the cut event (bug 280959). htmlelement.onpaste returns the event handling code for the paste event (bug 280959). toucheventhandlers.ontouchstart returns the event handling code for the...
...ementinternals instance to the custom element. htmlorforeignelement.blur() removes keyboard focus from the currently focused element. htmlelement.click() sends a mouse click event to the element. htmlorforeignelement.focus() makes the element the current keyboard focus. htmlelement.forcespellcheck() runs the spell checker on the element's contents. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. invalid fired when an element does not satisfy its constraints during constraint validation. also available via the oninvalid property. animation events animationcancel fired when an animation unexpectedly aborts. also available via the onanimationcancel property. animationend fired when ...
...And 3 more matches
HTMLFormElement - Web APIs
the htmlformelement interface represents a <form> element in the dom. it allows access to—and, in some cases, modification of—aspects of the form, as well as access to its component elements. ...
...ver accepts. htmlformelement.autocomplete a domstring reflecting the value of the form's autocomplete html attribute, indicating whether the controls in this form can have their values automatically populated by the browser. htmlformelement.novalidate a boolean reflecting the value of the form's novalidate html attribute, indicating whether the form should not be validated. named inputs are
added to their owner form instance as properties, and can overwrite native properties if they share the same name (e.g. a form with an input named action will have its action property return that input instead of the form's action html attribute). methods this interface also inherits methods from its parent, htmlelement. checkvalidity() returns true if the element's child controls are subject t...
...uestautocomplete() triggers a native browser interface to assist the user in completing the fields which have an autofill field name value that is not off or on. the form will receive an event once the user has finished with the interface, the event will either be autocomplete when the fields have been filled or autocompleteerror when there was a problem. events listen to these events using
addeventlistener(), or by assigning an event listener to the oneventname property of this interface. formdata the formdata event fires after the entry list representing the form's data is constructed. also available via the onformdata property. reset the reset event fires when a form is reset. also available via the onreset property. submit the submit event fires when a form is submitted. ...
...And 3 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
know that computers have evolved into powerful multi-core systems, and javascript has become one of the most prolifically-used languages in the computing world. a vast number of the most popular applications are based at least in part on javascript code. to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. starting with the
addition of timeouts and intervals as part of the web api (settimeout() and setinterval()), the javascript environment provided by web browsers has gradually advanced to include powerful features that enable scheduling of tasks, multi-threaded application development, and so forth. to understand where queuemicrotask() comes into play here, it's helpful to understand how the javascript runtime operate...
...eetuser() function returns and its context is removed from the stack and destroyed. the main program exits and its execution context is removed from the execution stack; as there are no contexts remaining on the stack, program execution ends. using execution contexts in this manner, each program and function is able to have its own set of variables and other objects. each context
additionally tracks the next line in the program that should be run and other information critical to that context's operation. by using the contexts and the context stack in this manner, many of the fundamentals of how a program operates can be managed, including local and global variables, function calls and returns, and so forth. a special note about recursive functions—that is, functions which...
...rsion and the return of results through that recursion, but it also means that each time a function recurses, more memory is needed to create the new context. run, javascript, run to run javascript code, the runtime engine maintains a set of agents in which to execute javascript code. each agent is made up of a set of execution contexts, the execution context stack, a main thread, a set for any
additional threads that may be created to handle workers, a task queue, and a microtask queue. other than the main thread—which some browsers share across multiple agents—each component of an agent is unique to that agent. here we look at how the runtime functions in slightly more detail. event loops each agent is driven by an event loop, which collects any user and other events, enqueuing ...
...And 3 more matches
Drag Operations - Web APIs
e pointer as the drag occurs. however, this behavior is only the default drag behavior, if no listeners adjust the data to be dragged. in html, apart from the default behavior for images, links, and selections, no other elements are draggable by default. to make other html elements draggable, three things must be done: set the draggable="true" on the element that you wish to make draggable.
add a listener for the dragstart event. set the drag data in the above listener. here is an example which allows a section of content to be dragged. <p draggable="true" ondragstart="event.datatransfer.setdata('text/plain', 'this text may be dragged')"> this text <strong>may</strong> be dragged. </p> the draggable attribute is set to "true", so this element becomes draggable. if this attribute...
... draggable attribute with a value of false to disable dragging of these elements. note: when an element is made draggable, text or other elements within it can no longer be selected in the normal way by clicking and dragging with the mouse. instead, the user must hold down the alt key to select text with the mouse, or use the keyboard. starting a drag operation in this example, a listener is
added for the dragstart event by using the ondragstart attribute. <p draggable="true" ondragstart="event.datatransfer.setdata('text/plain', 'this text may be dragged')"> this text <strong>may</strong> be dragged. </p> when a user begins to drag, the dragstart event is fired. in this example the dragstart listener is
added to the draggable element itself. however, you could listen to a higher an...
... within a textbox, the data associated with the drag data item is the text itself. similarly, when dragging a link on a web page, the drag data item is the link's url. the drag data contains two pieces of information, the type (or format) of the data, and the data's value. the format is a type string (such as text/plain for text data), and the value is a string of text. when the drag begins, you
add data by providing a type and the data. during the drag, in an event listener for the dragenter and dragover events, you use the data types of the data being dragged to check whether a drop is allowed. for instance, a drop target that accepts links would check for the type text/uri-list. during a drop event, a listener would retrieve the data being dragged and insert it at the drop location. the ...
...And 3 more matches
Dragging and Dropping Multiple Items - Web APIs
caution: all of the methods and properties with a moz prefix (such as mozsetdataat() are gecko specific interfaces. these interfaces will only work with gecko based browsers. mozilla supports the ability to drag multiple items using some
additional non-standard methods. these are methods that mirror the types property as well as the getdata(), setdata() and cleardata() methods, however, they take an
additional argument that specifies the index of the item to retrieve, modify or remove. the drag processing described in this document use the datatransfer interface. this processing does not use the datatransferitem interface nor the datatransferitemlist interface. setting and getting with indices the mozsetdataat() method allows you to
add multiple items during a dragstart event. this f...
...essing does not use the datatransferitem interface nor the datatransferitemlist interface. setting and getting with indices the mozsetdataat() method allows you to
add multiple items during a dragstart event. this function similarly to setdata() var dt = event.datatransfer; dt.mozsetdataat("text/plain", "data to drag", 0); dt.mozsetdataat("text/plain", "second data to drag", 1); this example
adds two items to be dragged. the last argument specifies the index of the item to
add. you should
add them in order starting with 0 as you cannot
add items at positions farther than the last item, however you can replace existing items by using indices you have already
added. using 0 as the index is equivalent to calling setdata(). you can clear an item using the mozcleardataat() method. event.dat...
...ar dt = event.datatransfer; dt.mozsetdataat("text/uri-list", "url1", 0); dt.mozsetdataat("text/plain", "url1", 0); dt.mozsetdataat("text/uri-list", "url2", 1); dt.mozsetdataat("text/plain", "url2", 1); dt.mozsetdataat("text/uri-list", "url3", 2); dt.mozsetdataat("text/plain", "url3", 2); // [item1] data=url1, index=0 // [item2] data=url2, index=1 // [item3] data=url3, index=2 after you
added three items in two different formats, dt.mozcleardataat("text/uri-list", 1); dt.mozcleardataat("text/plain", 1); you've removed the second item clearing all types, then the old third item becomes new second item, and its index decreases. // [item1] data=url1, index=0 // [item2] data=url3, index=1 fortunately, you don't normally need to clear items often; it's more common to just
add the i...
...And 3 more matches
IDBRequest: error event - Web APIs
the error handler is executed when an error caused a request to fail. ...
... the error handler is executed when an error caused a request to fail. ...
... cancelable no interface event event handler property onerror examples this example opens a database and tries to
add a record, listening for the error event for the
add() operation (this will occur if, for example, a record with the given tasktitle already exists): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.
addeventlistener('upgradeneeded', event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); o...
...And 3 more matches
Checking when a deadline is due - Web APIs
s to enter (7, sunday, sun? 04, 4, april, apr? 2013, '13, 13?), i decided 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.preventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in. if not, ...
...duplicate items not allowe...
...ue, month : month.value, year : year.value, notified : "no" } ]; // open a read/write db transaction, ready for
adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction opened for task
addition.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. ...
...And 3 more matches
KeyboardEvent.key - Web APIs
. ...
...fx"> <div> <textarea rows="5" name="test-target" id="test-target"></textarea> <button type="button" name="btn-clear-console" id="btn-clear-console">clear console</button> </div> <div class="flex"> <pre id="console-log"></pre> </div> </div> css .fx { -webkit-display: flex; display: flex; margin-left: -20px; margin-right: -20px; } .fx > div { p
adding-left: 20px; p
adding-right: 20px; } .fx > div:first-child { width: 30%; } .flex { -webkit-flex: 1; flex: 1; } #test-target { display: block; width: 100%; margin-bottom: 10px; } javascript let textarea = document.getelementbyid('test-target'), consolelog = document.getelementbyid('console-log'), btnclearconsole = document.getelementbyid('btn-clear-console'); function logmessage(message) { docu...
...t-flex: 1; flex: 1; } #test-target { display: block; width: 100%; margin-bottom: 10px; } javascript let textarea = document.getelementbyid('test-target'), consolelog = document.getelementbyid('console-log'), btnclearconsole = document.getelementbyid('btn-clear-console'); function logmessage(message) { document.getelementbyid("console-log").innerhtml += message + "<br>"; } textarea.
addeventlistener('keydown', (e) => { if (!e.repeat) logmessage(`key "${e.key}" pressed [event: keydown]`); else logmessage(`key "${e.key}" repeating [event: keydown]`); }); textarea.
addeventlistener('beforeinput', (e) => { logmessage(`key "${e.data}" about to be input [event: beforeinput]`); }); textarea.
addeventlistener('input', (e) => { logmessage(`key "${e.data}" input [event...
...And 3 more matches
Recording a media element - Web APIs
so forth. below the playback element is a button for downloading the recorded video. ...
... playback element is a button for downloading the recorded video. ...
... let preview = document.getelementbyid("p...
...And 3 more matches
Using the Notifications API - Web APIs
in response to a user gesture (e.g. clicking a button). this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notification permission requests not triggered in response to a user gesture. firefox is already doing this from version 72, for example, and safari has done it for some time. in
addition, in chrome and firefox you cannot request notifications at all unless the site is a secure context (i.e. https), and you can no longer allow notification permissions to be requested from cross-origin <iframe>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 th...
... to the user and user agent. the dismissal may also happen at the operating system level and users should remain in control of this. old versions of chrome didn't remove notifications automatically so you can do so after a settimeout() only for those legacy versions in order to not remove notifications from notification trays on other browsers. var n = new notification('my great song'); document.
addeventlistener('visibilitychange', function() { if (document.visibilitystate === 'visible') { // the tab has become visible so clear the now-stale notification. 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, ...
...notification is closed. error triggered if something goes wrong with the notification; this is usually because the notification couldn't be displayed for some reason. show triggered when the notification is displayed to the user. these events can be tracked using the onclick, onclose, onerror, and onshow handlers. because notification also inherits from eventtarget, it's possible to use the
addeventlistener() method on it. replacing existing notifications it is usually undesirable for a user to receive a lot of notifications in a short space of time — for example, what if a messenger application notified a user for each incoming 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, re...
...And 3 more matches
Page Visibility API - Web APIs
ews a site wants to switch off sounds when a device is in standby mode (user pushes power button to turn screen off) developers have historically used imperfect proxies to detect this. for example, watching for blur and focus events on the window helps you know when your page is not the active page, but it does not tell you that your page is actually hidden to the user. the page visibility api
addresses this. note: while onblur and onfocus will tell you if the user switches windows, it doesn't necessarily mean it's hidden. pages only become hidden when the user switches tabs or minimizes the browser window containing the tab. policies in place to aid background page performance separately from the page visibility api, user agents typically have a number of policies in place to mitigat...
...estanimationframe() callbacks to background tabs or hidden <iframe>s in order to improve performance and battery life. timers such as settimeout() are throttled in background/inactive tabs to help improve performance. see reasons for delays longer than specified for more details. budget-based background timeout throttling is now available in modern browsers (firefox 58+, chrome 57+), placing an
additional limit on background timer cpu usage. this operates in a similar way across modern browsers, with the details being as follows: in firefox, windows in background tabs each have their own time budget in milliseconds — a max and a min value of +50 ms and -150 ms, respectively. chrome is very similar except that the budget is specified in seconds. windows are subjected to throttling...
...ined") { hidden = "webkithidden"; visibilitychange = "webkitvisibilitychange"; } var videoelement = document.getelementbyid("videoelement"); // if the page is hidden, pause the video; // if the page is shown, play the video function handlevisibilitychange() { if (document[hidden]) { videoelement.pause(); } else { videoelement.play(); } } // warn if the browser doesn't support
addeventlistener or the page visibility api if (typeof document.
addeventlistener === "undefined" || hidden === undefined) { console.log("this demo requires a browser, such as google chrome or firefox, that supports the page visibility api."); } else { // handle page visibility change document.
addeventlistener(visibilitychange, handlevisibilitychange, false); // when the video pauses, set the...
...And 3 more matches
PaymentResponse: payerdetailchange event - Web APIs
const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerp...
... const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } =...
...rname) { promisestovalidate.push(validatename(payername)); oldpayername = payername; } if (oldpayeremail !== payeremail) { promisestovalidate.push(validateemail(payeremail)); oldpayeremail = payeremail; } if (oldpayerphone !== payerphone) { promisestovalidate.push(validatephone(payerphone)); oldpayerphone = payerphone; } // as each validation promise resolves,
add the results of the // validation to the errors list const errors = await promise.all(promisestovalidate).then(results => results.reduce((errors, result), object.assign(errors, result)) ); // if we found any errors, wait for them to be corrected if (object.getownpropertynames(errors).length) { await response.retry(errors); } else { // we have a good payment; send the dat...
...And 3 more matches
PaymentResponse.retry() - Web APIs
the paymentresponse interface's retry() method makes it possible to ask the user to retry a payment after an error occurs during processing. this lets your app gracefully deal with situations such as invalid shipping
addresses or declined credit cards. syntax retrypromise = paymentrequest.retry(errorfields); parameters errorfields a paymentvalidationerrors object, with the following properties: error optional a general description of a payment error from which the user may attempt to recover by retrying the payment, possibly after correcting mistakes in the payment information. error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in s...
...ect which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user chose to pay by credit card using the basic-card payment method, this is a basiccarderrors object. shipping
address optional an
addresserrors object which contains error messages for any of the fields in the shipping
address that failed validation. return value a promise which is resolved when the payment is successfully completed. the promise is rejected with an appropriate exception value if the payment fails again. typically you will use this by calling show(), then entering a loop or recursive ...
...(methoddata, details, options); const response = await request.show(); await recursivevalidate(request, response); await response.complete("success"); } // keep validating until the data looks good! ...
...And 3 more matches
Pointer events - Web APIs
pointer events are dom events that are fired for a pointing device. they are designed to create a single dom event model to handle pointing input devices such as a mouse, pen/stylus or touch (such as one or more fingers). ...
... user's hardware. however, for scenarios when device-specific handling is desired, pointer events defines a pointertype property to inspect the device type which produced the event. the events needed to handle generic pointer input are analogous to mouse 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 pointerevent interface inherits all of the mouseevent properties, thus facilitating the migration of content from mouse events to pointer events. termin...
...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 pointer any pointer input device that can produce events. a pointer is considered active if it can still produce further events. for example, a pen that is a down state is considered active because it can produce
additional events when the pen is lifted or moved. digitizer a sensing device with a surface that can detect contact. most commonly, the sensing device is a touch-enabled screen that can sense input from an input device such as a pen, stylus, or finger. some sensing devices can detect the close proximity of the input device, and the state is expressed as a hover following the mouse. hit test the ...
...And 3 more matches
RTCIceCandidate.relatedPort - Web APIs
the rtcicecandidate interface's read-only relatedport property indicates the port number of reflexive or relay candidates. if the candidate is a host candidate (that is, its ip is in fact the real ip
address of the remote peer), relatedport is null. the relatedport field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedport in the options object, but the
address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. the related
address (related
address) and port are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relpor...
... are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relport = rtcicecandidate.relatedport; value an unsigned 16-bit value containing the candidate's related port number, if any. ...
...s only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relport = rtcicecandidate.relatedport; value an unsigned 16-bit value containing the candidate's related port number, if any. for both peer and server reflexive candidates, the related
address and port describe the base for that candidate. for relay candidates, the related
address and port provide the mapped
address selected by the turn server. for host candidates, relatedport is null, meaning the field is not included in the candidate's a-line. usage notes the related
address and port are not used by ice itself, and are only present for diagnostic and quality-of-service purposes. they may in fact be omitted for security reasons, but if present can be a useful tool ...
...And 3 more matches
RTCPeerConnection: icecandidate event - Web APIs
bubbles no cancelable no interface rtcpeerconnectioniceevent event handler property rtcpeerconnection.onicecandidate description there are three reasons why the icecandidate event is fired on an rtcpeerconnection. ...
... bubbles no cancelable no interface rtcpeerconnectioniceevent event handler property rtcpeerconnection.onicecandidate description there are three reasons why the icecandidate event is fired on an rtcpeerconnection. ...
... a new candidate has been gathered. this candidate needs to be delivered to the remote peer over the signaling channel your code manages. rtcpeerconnection.onicecandidate = (event) => { if (event.candidate) { sendcandidatetoremotepeer(event.candidate) } else { /* there are no more candidates coming during this negotiation */ } } the remote peer, upon receiving the candidate, will
add the candidate to its candidate pool by calling
addicecandidate(), passing in the candidate string you have passed along using the signaling server. indicating the end of a generation of candidates when an ice negotiation session runs out of candidates to propose for a given rtcicetransport, it has completed gathering for a generation of candidates. that this has occurred is indicated by an icec...
...And 3 more matches
TextTrackList - Web APIs
represented by a separate texttrack object in the list. retrieve an instance of this object with htmlmediaelement.texttracks. the individual tracks can be accessed using array syntax or functions such as foreach() for example. properties this interface also inherits properties from its parent interface, eventtarget. length read only the number of tracks in the list. event handlers on
addtrack an event handler to be called when the
addtrack event is fired, indicating that a new text track has been
added to the media element. onchange an event handler to be called when the change event occurs. onremovetrack an event handler to call when the removetrack event is sent, indicating that a text track has been removed from the media element. methods this interface also inherits m...
.... onremovetrack an event handler to call when the removetrack event is sent, indicating that a text track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the texttrack found within the texttracklist whose id matches the specified string. if no match is found, null is returned. ...
... the removetrack event is sent, indicating that a text track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the texttrack found within the texttracklist whose id matches the specified string. if no match is found, null is returned. events
addtrack fired when a new text track has been
added to the media element. ...
...And 3 more matches
VideoTrackList - Web APIs
htmlmediaelement.videotracks. the individual tracks can be accessed using array syntax or functions such as foreach() for example. properties this interface also inherits properties from its parent interface, eventtarget. length read only the number of tracks in the list. selectedindex read only the index of the currently selected track, if any, or −1 otherwise. event handlers on
addtrack an event handler to be called when the
addtrack event is fired, indicating that a new video track has been
added to the media element. onchange an event handler to be called when the change event occurs — that is, when the value of the selected property for a track has changed, due to the track being made active or inactive. onremovetrack an event handler to call when the removetrack ...
...onremovetrack an event handler to call when the removetrack event is sent, indicating that a video track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the videotrack found within the videotracklist whose id matches the specified string. if no match is found, null is returned. ...
... removetrack event is sent, indicating that a video track has been removed from the media element. methods this interface also inherits methods from its parent interface, eventtarget. gettrackbyid() returns the videotrack found within the videotracklist whose id matches the specified string. if no match is found, null is returned. events
addtrack fired when a new video track has been
added to the media element. ...
...And 3 more matches
Raining rectangles - Web APIs
layed 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 preview of a full graphical application that manipulates various phases of the webgl graphics pipeline and state machine. in
addition, the example demonstrates how to integrate the webgl function calls within a game loop. the game loop is responsible for drawing the animation frames, and keeping the animation responsive to user input. here, the game loop is implemented using timeouts. <p>you caught <strong>0</strong>. you missed <strong>0</strong>.</p> <canvas>your browser does not seem to support html5 canvas.
...drawing the animation frames, and keeping the animation responsive to user input. here, the game loop is implemented using timeouts. <p>you caught <strong>0</strong>. ...
...s. <p>you caught <strong>0</strong>. ...
...And 3 more matches
Simple color animation - Web APIs
webgl, performed by clearing the drawing buffer with a different random color every second. 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). <p>a simple webgl program that shows color animation.</p> <p>you can click the button below to toggle the color anim...
... var timer; // click event handlers. v...
... var timer; // click event handlers. var button = document.queryselector("#animation-onoff"); var verb = document.queryselector("strong"); function startanimation(evt) { ...
...And 3 more matches
Matrix math for the web - Web APIs
ginal matrix. the identity matrix looks like this in javascript: let identitymatrix = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; what does multiplying by the identity matrix look like? the easiest example is to multiply a single point by the identity matrix. ...
... the easiest example is to multiply a single point by the identity matrix. since a 3d point only needs three values (x, y, and z), and the transformation matrix is a 4x4 value matrix, we need to
add a fourth dimension to the point. by convention, this dimension is called the perspective, and is represented by the letter w. for a typical position, setting w to 1 will make the math work out. after
adding the w component to the point, notice how neatly the matrix and the point line up: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] [4, 3, 2, 1] // point at [x, y, z, w] the w component has some
additional uses that are out of scope for this article. check out the webgl model view projection article for a look into how it comes in handy. multiplying a matrix and a point in our example...
... 5], c2r1 = matrix[ 6], c3r1 = matrix[ 7]; let c0r2 = matrix[ 8], c1r2 = matrix[ 9], c2r2 = matrix[10], c3r2 = matrix[11]; let c0r3 = matrix[12], c1r3 = matrix[13], c2r3 = matrix[14], c3r3 = matrix[15]; // now set some simple names for the point let x = point[0]; let y = point[1]; let z = point[2]; let w = point[3]; // multiply the point against each part of the 1st column, then
add together let resultx = (x * c0r0) + (y * c0r1) + (z * c0r2) + (w * c0r3); // multiply the point against each part of the 2nd column, then
add together let resulty = (x * c1r0) + (y * c1r1) + (z * c1r2) + (w * c1r3); // multiply the point against each part of the 3rd column, then
add together let resultz = (x * c2r0) + (y * c2r1) + (z * c2r2) + (w * c2r3); // multiply the point agai...
...And 3 more matches
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. ...
... 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. ...
...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 router that would prevent 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...
...And 3 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
webvtt is a text based format, which must be encoded using utf-8. where you can use spaces you can also use tabs. there is also a small api available to represent and manage these tracks and the data needed to perform the playback of the text at the correct times. webvtt files the mime type of webvtt is text/vtt. ...
...nk liquid nitrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. webvtt body the structure of a webvtt consists of the following components, some of them optional, in this order: an optional byte order mark (bom). the string "webvtt". an optional text header to the right of webvtt. there must be at least one space after webvtt. you could use this to
add a description to the file. you may use anything in the text header except newlines or the string "-->". a blank line, which is equivalent to two consecutive newlines. zero or more cues or comments. zero or more blank lines. example 1 - simplest possible webvtt file webvtt example 2 - very simple webvtt file with a text header webvtt - this file has no cues. example 3 - common w...
...ation about the parts of our file. these should be on separate lines, starting with the string note. you'll find more about these in the below section. it is important to not use "extra" blank lines within a cue, for example between the timings line and the cue payload. webvtt is line based; a blank line will close the cue. webvtt comments comments are an optional component that can be used to
add information to a webvtt file. comments are intended for those reading the file and are not seen by users. comments may contain newlines but cannot contain a blank line, which is equivalent to two consecutive newlines. a blank line signifies the end of a comment. a comment cannot contain the string "-->", the ampersand character (&), or the less-than sign (<). if you wish to use such characters, ...
...And 3 more matches
Using the Web Animations API - Web APIs
s 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 preview 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 demonstration purposes. the css version here’s a tumbling animation written in css showing al...
...nimation, so she gets bigger as the cupcake gets eaten. we can achieve this via the following function: var growalice = function() { // play alice's animation. alicechange.play(); // play the cake's animation. nommingcake.play(); } when a user holds their mouse down or presses their finger on the cake on a touch screen, we can now call growalice to make all the animations play: cake.
addeventlistener("mousedown", growalice, false); cake.
addeventlistener("touchstart", growalice, false); other useful methods in
addition to pausing and playing, we can use the following animation methods: animation.finish() skips to the end of the animation. animation.cancel() aborts the animation and removes its effects. animation.reverse() sets the animation’s playback rate (animation.play...
...laybackrate) to a negative value so it runs backward. let’s take a look at playbackrate first — a negative playbackrate will cause an animation to run in reverse. when alice drinks from the bottle, she grows smaller. ...
...And 3 more matches
Window - Web APIs
lways represents the tab in which the code is running. that said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pertains to the window instead. ...
...an alias for window.scrollx. window.pageyoffset read only an alias for window.scrolly window.parent read only returns a reference to the parent of the current window or subframe. window.performance read only returns a performance object, which includes the timing and navigation attributes, each of which is an object providing performance-related data. see also using navigation timing for
additional information and examples. window.personalbar read only returns the personalbar object, whose visibility can be toggled in the window. window.screen read only returns a reference to the screen object associated with the window. window.screenx and window.screenleft read only both properties return the horizontal distance from the left border of the user's browser viewport to the lef...
...tes a function after the browser has finished other heavy tasks window.setresizable() toggles a user's ability to resize a window. window.sizetocontent() sizes the window according to its content. window.stop() this method stops window loading. window.updatecommands() updates the state of commands of the current chrome window (ui). methods implemented from elsewhere eventtarget.
addeventlistener() register an event handler to a specific event type on the window. eventtarget.dispatchevent() used to trigger an event. windoworworkerglobalscope.atob() decodes a string of data which has been encoded using base-64 encoding. windoworworkerglobalscope.btoa() creates a base-64 encoded ascii string from a string of binary data. windoworworkerglobalscope.clearinterval() cancel...
...And 3 more matches
Synchronous and asynchronous requests - Web APIs
line 1 declares a function invoked when the xhr operation completes successfully. it, in turn, invokes the callback function specified in the invocation of the loadfile function (in this case, the function showmessage) which has been assigned to a property of the xhr object (lin...
...uments that are passed through the xhr object (via the arguments property) to the success callback function. line 1 declares a function invoked when the xhr operation completes successfully. it, in turn, invokes the callback function specified in the invocation of the loadfile function (in this case, the function showmessage) which has been assigned to a property of the xhr object (line 11). the
additional arguments (if any) supplied to the invocation of function loadfile are "applied" to the running of the callback function. line 5 declares a function invoked when the xhr operation fails to complete successfully. line 11 stores the success callback given as the second argument to loadfile in the xhr object's callback property. line 12 slices the arguments array given to the invocation of...
... synchronous request note: starting with gecko 30.0 (firefox 30.0 /...
...And 3 more matches
Using the log role - Accessibility
description this technique demonstrates how to use the log role and describes the effect it has on browsers and assistive technology. the log role is used to identify an element that creates a live region where new information is
added in a meaningful order and old information may disappear. for example, chat logs, messaging history or an error log. in contrast to other types of live region, this role is sequentially ordered and new information is only
added to the end of the log. when this role is
added to an element, the browser will send out an accessible log event to assistive technology products which can then notify the user about it. by default updates contain only the changes to the live region and these are announced when the user is idle. where the user needs to hear the ...
...nges to the live region and these are announced when the user is idle. where the user needs to hear the entire live region upon a change aria-atomic="true" should be set. to have announcements made as soon as possible and where the user may be interrupted, aria-live="assertive" can be set for more aggressive updates. possible effects on user agents and assistive technology when the log role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a log role in the operating system's accessibility api. fire an accessible log event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers should ...
...anges inside a log when the user is idle, unless aria-live=”assertive” has been set and in which case the user may be interrupted. screen magnifiers may visually indicate that a log update has occurred. note: opinons 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:
adding the role in the html code the snippet below shows how the log role is
added directly into the html source code. <div id="liveregion" class="region" role="log"></div> example 2: snippet from an example application this snippet creates the chat log in an ajax chat application. <div id="chatarea" role="log"> <ul id="chatregion" aria-live="polite" aria-atomic="false"> <li>please choose...
...And 3 more matches
ARIA Test Cases - Accessibility
roviding this information: help browser vendors provide correct implementations help at vendors provide correct implementations inform authors as to what actually works reliably in general we're testing with the latest public releases. however, where things don't work we may test with nightly builds if they are available, in order to show what is already fixed in upcoming releases. we can
add more screen readers if people are willing to step up and provide test results for them. tested ua/at combinations: dragon 10 with firefox 3 and ie 8 beta 2 jaws 9 & 10 with firefox 3 jaws 9 & 10 with ie beta 2 nvda 0.6p2 with firefox 3 orca with firefox 3 window-eyes 7 with ie 8 beta 2 and firefox 3 voiceover (leopard) with safari 4.0.2 zoom (leopard) with safari 4.0.2, firefox 3.x and...
...d 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 at sign to test the alert expected at behavior: a screen reader or screen magnifier must speak an alert when it becomes visible. a screen magnifier should move the current view to the alert or open a new panel with the alert information optional, but desired: if there are widgets within the alert, their role and any keyboard mnemonic (accesskey) should be spoken. for example...
...when pressing space, new state should be announced automatically. markup used: role="checkbox" aria-checked="true" or "false" notes: need testcase where aria-checked attribute is removed ...
...And 3 more matches
ARIA annotations - Accessibility
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. ...
...rds, currently behind the #enable-accessibility-expose-aria-annotations flag (go to chrome://flags to enable this.) unfortunately, you won’t be able to use any of these yet, as screenreader support is currently not there. for the moment, you can see the annotations data being exposed with tools like firefox accessibility inspector. the annotations should just work once screenreader support is
added. associating annotated elements with their details there are a number of different ways in which you can associate ui features with text labels or descriptions for accessibility purposes. it is useful to know when to use each. you’ll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it isn'...
...ment to provide a description that can’t be gotten from the element’s text alone. ...
...And 3 more matches
ARIA: tab role - Accessibility
<div id="panel-1" role="tabpanel" tabindex="0" aria-labelledby="tab-1"> <p>content for the first panel</p> </div> <div id="panel-2" role="tabpanel" tabindex="0" aria-labelledby="tab-2" hidden> <p>content for the second panel</p> </div> <div id="panel-3" role="tabpanel" tabindex="0" aria-labelledby="tab-3" hidden> <p>content for the third panel</p> </div> </div> .tabs { p
adding: 1em; } [role="tablist"] { margin-bottom: -1px; } [role="tab"] { position: relative; z-index: 1; background: white; border-radius: 5px 5px 0 0; border: 1px solid grey; border-bottom: 0; p
adding: 0.2em; } [role="tab"][aria-selected="true"] { z-index: 3; } [role="tabpanel"] { position: relative; p
adding: 0 0.5em 0.5em 0.7em; border: 1px solid grey; border-radius: 0 ...
...lement. we then find all tabs with aria-selected=true inside the parent element and sets it to false, then sets the triggering element's aria-selected to true. after that, we find all tabpanel elements in the grandparent element, make them all hidden, and finally select the element whose id is equal to the triggering tab's aria-controls and removes the hidden attribute, making it visible. ...
... we find all tabpanel elements in the grandparent element, make them all hidden, and finally select the element whose id is equal to the triggering tab's aria-controls and removes the hidden attribute, making it visible. ...
...And 3 more matches
@counter-style - CSS: Cascading Style Sheets
css at-rule lets you define counter styles that are not part of the predefined set of styles. a @counter-style rule defines how to convert a counter value into a string representation. @counter-style thumbs { system: cyclic; symbols: "\1f44d"; suffix: " "; } ul { list-style: thumbs; } the initial version of css defined a set of useful counter styles. however, although more styles were
added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. the @counter-style at-rule
addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. syntax descriptors each @counter-style is identified by a name and has a s...
...identified by a name and has a set of descriptors. system specifies the algorithm to be used for converting the integer value of a counter to a string representation. negative lets the author specify symbols to be appended or prepended to the counter representation if the value is negative. prefix specifies a symbol that should be prepended to the marker representation. prefixes are
added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. suffix specifies, similar to the prefix descriptor, a symbol that is appended to the marker representation. suffixes come after the marker representation. range defines the range of values over which the counter style is applicable. if a counter style is used to ...
...bols have exhausted, the fallback style will be used for the rest of the list. the below @counter-style rule uses images instead of character symbols. image values for symbols is currently an 'at risk' feature, and is not implemented in any browser. @counter-style winners-list { system: fixed; symbols: url(gold-medal.svg) url(silver-medal.svg) url(bronze-medal.svg); suffix: " "; }
additive-symbols while the symbols specified in the symbols descriptor is used for constructing marker representation by most algorithms, some systems such as '
additive' rely on
additive tuples described in this descriptor. each
additive tuple consists of a counter symbol and a non negative integer weight. the
additive tuples must be specified in the descending order of their weights. speak-as ...
...And 3 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
s text modules, and for the first time in box alignment we have full horizontal and vertical alignment capabilities. if you initially learned flexbox then you may consider these properties to be part of the flexbox specification, and some of the properties are indeed listed in level 1 of flexbox. however the specification notes that the box alignment specification should be referred to as it may
add additional capabilities over what is currently in flexbox. basic examples the following examples demonstrate how some of the box alignment properties are applied in grid and flexbox. css grid layout alignment example in this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. this space is distributed using j...
...k axis is the axis along which blocks, such as paragraph elements, are laid out and it runs across the inline axis. when aligning items on the inline axis you will use the properties which begin with justify-: justify-items justify-self justify-content when aligning items on the block axis you will use the properties that begin align-: align-items align-self align-content flexbox
adds an
additional complication in that the above is true when flex-direction is set to row. the properties are swapped when flexbox is set to column. therefore, when working with flexbox it is easier to think about the main and cross axis rather than inline and block. the justify- properties are always used to align on the main axis, the align- properties on the cross axis. the alignment subject t...
...ues for content alignment with justify-content and align-content and also for self alignment with justify-self and align-self. baseline first baseline last baseline baseline content alignment — specifying a baseline alignment value for justify-content or align-content — works in layout methods that lay items out in rows. the alignment subjects are baseline aligned against each other by
adding p
adding inside the boxes. baseline self alignment shifts the boxes to align by baseline by
adding a margin outside the boxes. self alignment is when using justify-self or align-self, or when setting these values as a group with justify-items and align-items. distributed alignment the distributed alignment keywords are used with the align-content and justify-content properties. these keyword...
...And 3 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
s more space than is required to display the flex items inside the container. for example, if i have a 500 pixel-wide container, flex-direction is row, and i have three flex items each 100 pixels wide, then i have 200 pixels of positive free space, which could be distributed between the items if i wanted them to fill the container. we have negative free space when the natural size of the items
adds up to larger than the available space in the flex container. if i have a 500 pixel-wide container like the one above, but the three flex items are each 200 pixels wide, the total space i need will be 600 pixels, so i have 100 pixels of negative free space. this could be removed from the items in order to make them fit the container. it is this distribution of positive free space and removal o...
... the following live example can help to demonstrate this. in this example i have created a series of inflexible boxes, with both flex-grow and flex-shrink set to 0. here we can see how the first item — which has an explicit width of 150 pixels set as the main size — takes a flex-basis of 150px, whereas the other two items have no width and so are sized according to their content width. in
addition to the auto keyword, you can use the content keyword as the flex-basis. this will result in the flex-basis being taken from the content size even if there is a width set on the item. this is a newer keyword and has less browser support, however you can always get the same effect by using auto as the flex-basis and ensuring that your item does not have a width set, in order that it will be au...
...t flex-grow factors. if we keep our flex-basis at 0 so all of the space can be distributed, we could assign each of the three flex items a different flex-grow factor. in the example below i am using the following values: 1 for the first item. 1 for the second item. 2 for the third item. working from a flex-basis of 0 this means that the available space is distributed as follows. we need to
add up the flex grow factors, then divide the total amount of positive free space in the flex container by that number, which in this case is 4. we then share out the space according to the individual values — the first item gets one part, the second one part, the third two parts. this means that the third item is twice the size of the first and second items. remember that you can use any positi...
...And 3 more matches
Shapes from box values - CSS: Cascading Style Sheets
a straightforward way to create a shape is to use a value from the css box model. this article explains how to do this. the box values allowable as a shape value are: content-box p
adding-box border-box margin-box the border-radius values are also supported, this means that you can have something in your page with a curved border, and your shape can follow the created shape. css box model the values listed above correspond to the various parts of the css box model. a box in css has content, p
adding, border, and margin. ...
...omething in your page with a curved border, and your shape can follow the created shape. css box model the values listed above correspond to the various parts of the css box model. a box in css has content, p
adding, border, and margin. by using box values for shapes we can wrap our content around the edges defined by these values. in all of the examples below i am using an element which has p
adding, a border, and a margin defined in order that you can see the different ways in which content will flow. margin-box the margin-box is the shape defined by the outside margin edge and includes the corner radius of the shape, should border-radius have been used in defining the element. in the example below, we have a circular purple item which is a <div> with a height, width, and background c...
...a margin, you can see that the content is flowing around the circular shape and the margin applied to it. border-box the border-box value is the shape defined by the outside border edge. this shape follows all of the normal border radius shaping rules for the outside of the border. you still have a border, even if you have not used the css border property. in this case it will be the same as p
adding-box, the shape defined by the outside p
adding edge. in the example below you can see how the text now follows the line created by the border. change the border size and the content follows it. p
adding-box the p
adding-box value defines the shape enclosed by the outside p
adding edge. this shape follows all of the normal border radius shaping rules for the inside of the border. if you have n...
...And 3 more matches
background-clip - 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. if the element has no background-image or background-color, this property will only have a visual effect when the border has transparent regions or partially opaque regions (due to border-style or border-image); otherwise, the border masks the difference. ...
...hild element. the used values of that <body> element’s background properties are their initial values, and the propagated values are treated as if they were specified on the root element. it is recommended that authors of html documents specify the canvas background for the <body> element rather than the html element. syntax /* keyword values */ background-clip: border-box; background-clip: p
adding-box; background-clip: content-box; background-clip: text; /* global values */ background-clip: inherit; background-clip: initial; background-clip: unset; values border-box the background extends to the outside edge of the border (but underneath the border in z-ordering). p
adding-box the background extends to the outside edge of the p
adding. no background is drawn beneath the border. ...
...neath the border. content-box the background is painted within (clipped to) the content box. text the background is painted within (clipped to) the foreground text. formal definition initial valueborder-boxapplies toall elements. ...
...And 3 more matches
mask-origin - CSS: Cascading Style Sheets
the mask-origin css property sets the origin of a mask. /* keyword values */ mask-origin: content-box; mask-origin: p
adding-box; mask-origin: border-box; mask-origin: margin-box; mask-origin: fill-box; mask-origin: stroke-box; mask-origin: view-box; /* multiple values */ mask-origin: p
adding-box, content-box; mask-origin: view-box, fill-box, border-box; /* non-standard keyword values */ -webkit-mask-origin: content; -webkit-mask-origin: p
adding; -webkit-mask-origin: border; /* global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; for elements rendered as a single box, this property specifies the mask positioning area. in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as mult...
...ge specified by the mask-image css property. for elements rendered as multiple boxes, such as inline boxes on several lines or boxes on several pages, it specifies which boxes box-decoration-break operates upon to determine the mask positioning area. syntax one or more of the keyword values listed below, separated by commas. values content-box the position is relative to the content box. p
adding-box the position is relative to the p
adding box. for single boxes 0 0 is the upper left corner of the p
adding edge, 100% 100% is the lower right corner. border-box the position is relative to the border box. margin-box the position is relative to the margin box. fill-box the position is relative to the object bounding box. stroke-box the position is relative to the stroke bounding box...
...e bounding box. view-box uses the nearest svg viewport as reference box. if a viewbox attribute is specified for the element creating the svg viewport, the reference box is positioned at the origin of the coordinate system established by the viewbox attribute and the dimension of the reference box is set to the width and height values of the viewbox attribute. content same as content-box. p
adding same as p
adding-box. border same as border-box. formal definition initial valueborder-boxapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <geometry-box>#where <geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <shape-box> = ...
...And 3 more matches
shape-outside - CSS: Cascading Style Sheets
ther than simple boxes. 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. ...
...e the float area for float elements. the float area determines the shape around which inline content (float elements) wrap. values none the float area is unaffected. inline content wraps around the element's margin box, like usual. <shape-box> the float area is computed according to the shape of a float element's edges (as defined by the css box model). this can be margin-box, border-box, p
adding-box, or content-box. the shape includes any curvature created by the border-radius property (behavior which is similar to background-clip). margin-box defines the shape enclosed by the outside margin edge. the corner radii of this shape are determined by the corresponding border-radius and margin values. if the border-radius / margin ratio is 1 or more, then the margin box corner radiu...
...n values. if the border-radius / margin ratio is 1 or more, then the margin box corner radius is border-radius + margin. if the ratio is less than 1, then the margin box corner radius is border-radius + (margin * (1 + (ratio-1)^3)). border-box defines the shape enclosed by the outside border edge. the shape follows the normal border radius shaping rules for the outside of the border. p
adding-box defines the shape enclosed by the outside p
adding edge. the shape follows the normal border radius shaping rules for the inside of the border. content-box defines the shape enclosed by the outside content edge. each corner radius of this box is the larger of 0 or border-radius - border-width - p
adding. <basic-shape> the float area is computed based on the shape crea...
...And 3 more matches
Creating and triggering events - Developer guides
this article demonstrates how to create and dispatch dom events. such events are commonly called synthetic events, as opposed to the events fired by the browser itself. creating custom events events can be created with the event constructor as follows: const event = new event('build'); // listen for the event. elem.
addeventlistener('build', function (e) { /* ... */ }, false); // dispatch the event. ...
... the event. elem.
addeventlistener('build', function (e) { /* ... */ }, false); // dispatch the event. elem.dispatchevent(event); the above code example uses the eventtarget.dispatchevent() method. this constructor is supported in most modern browsers (with internet explorer being the exception). for a more verbose approach (which works with internet explorer), see the old-fashioned way below.
adding custom data – customevent() to
add more data to the event object, the customevent interface exists and the detail property can be used to pass custom data. ...
...the following shows an example with document.createevent(): // create the event. ...
...And 3 more matches
HTML attribute: multiple - HTML: Hypertext Markup Language
put reads "no files selected" when the attribute is present and "no file selected" when not, when no files are selected. most browsers displaying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-class if more than one comma-separated email
address is included if the attribute is not present. when multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email
addresses. <input type="email" multiple name="emails" id="emails"> if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail
addresses. any trailing and lea...
... when multiple is set on the file input type, the user can select one or more files. the user can choose multiple files from the file picker in any way that their chosen platform allows (e.g. ...
...others do not. file input when multiple is set on the file input type, the user can...
...And 3 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
r does not endorse the referenced document. not allowed annotation annotation noopener creates a top-level browsing context that is not an auxiliary browsing context if the hyperlink would create either of those to begin with (i.e., has an appropriate target attribute value). not allowed annotation annotation noreferrer no referer header will be included. ...
... external resource not allowed not allowed preconnect specifies that the user agent should preemptively connect to the target resource's origin. ...
...es, and that the previous 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 allowed tag gives a tag (identified by the given
address) that applies to the current document. not allowed link not allowed the rel attribute is relevant to the <link>, <a>, <area>, and <form> elements, but some values only relevant to a subset of those elements. like all html keyword attribute values, these values are case-insenstive. the rel attribute has no default value. if the attribute is omitted or if none of the values in ...
...And 3 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
image loading errors if an erro...
...he authorization request header). if the server does not opt into sharing credentials with the origin site (by sending back the access-control-allow-credentials: true response header), then the browser marks the image as tainted and restricts access to its image data. if the attribute has an invalid value, browsers handle it as if the anonymous value was used. see cors settings attributes for
additional information. decoding provides an image decoding hint to the browser. allowed values: sync decode the image synchronously, for atomic presentation with other content. async decode the image asynchronously, to reduce delay in presenting other content. auto default: no preference for the decoding mode. the browser decides what is best for the user. height the in...
...ment. use the id attribute instead. vspace the number of pixels of white space above and below the image. use the margin css property instead. styling with css <img> is a replaced element; it has a display value of inline by default, but its default dimensions are defined by the embedded image's intrinsic values, like it were inline-block. you can set properties like border/border-radius, p
adding/margin, width, height, etc. on an image. <img> has no baseline, so when images are used in an inline formatting context with vertical-align: baseline, the bottom of the image will be placed on the text baseline. you can use the object-position property to position the image within the element's box, and the object-fit property to adjust the sizing of the image within the box (for example, wh...
...And 3 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
putelement.value property, for example: var datecontrol = document.queryselector('input[type="datetime-local"]'); datecontrol.value = '2017-06-01t08:30'; there are several methods provided by javascript's date that can be used to convert numeric date information into a properly-formatted string, or you can do it manually. for example, the date.toisostring() method can be used for this purpose. ...
... for example: var datecontrol = document.queryselector('input[type="datetime-local"]'); datecontrol.value = '2017-06-01t08:30'; there are several methods provided by javascript's date that can be used to convert numeric date information into a properly-formatted string, or you can do it manually. for example, the date.toisostring() method can be used for this purpose. ...
...ent value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; display: flex; align-items: center; } label { display: inline-block; width: 300px; } input:invalid+span:after { content: '✖'; p
adding-left: 5px; } input:valid+span:after { content: '✓'; p
adding-left: 5px; } important: html form validation is not a substitute for scripts that ensure that the entered data is in the proper format. it's far too easy for someone to make adjustments to the html that allow them to bypass the validation, or to remove it entirely. it's also possible for someone to simply bypass your htm...
...And 3 more matches
<input type="image"> - HTML: Hypertext Markup Language
e attribute should not be specified. events none. supported common attributes alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. ...
...specified. events none. supported common attributes alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. ...
...so available on <input type="submit"> and <button> elements. formtarget a string which specifies a name or keyword that indicates where to display the response received after submitting the form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in
addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form. this will replace the current document with the received data. this is the default value used if none is specified. _blank loads the response into a new, unnamed, browsing context. this is t...
...And 3 more matches
<input type="submit"> - HTML: Hypertext Markup Language
ed as the button's label. buttons do not have a true value otherwise. <input type="submit" value="send request"> if you don't specify a value, the button will have a default label, chosen by the user agent. ...
...buttons do not have a true value otherwise. <input type="submit" value="send request"> if you don't specify a value, the button will have a default label, chosen by the user agent. ...
...lso available on <input type="image"> and <button> elements. formtarget a string which specifies a name or keyword that indicates where to display the response received after submitting the form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in
addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form. this will replace the current document with the received data. this is the default value used if none is specified. _blank loads the response into a new, unnamed, browsing context. this is t...
...And 3 more matches
CSP: report-uri - HTTP
rt-uri directive instructs the user agent to report attempts to violate the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. though the report-to directive is intended to replace the deprecated report-uri directive, report-to isn’t supported in most browsers yet. so for compatibility with current browsers while also
adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored. the directive has no effect in and of itself, but only gains meaning in combination with other directives. csp vers...
...<uri>; <uri> a uri where to post the report to. examples see content-security-policy-report-only for more information and examples. ...
...point/ /csp-violation-report-endpoint/ could for example run a php something like the following that logs the json detailing the violation and, if the violation is the first one
added to the log file, sends an email to an administrator: <?php // start configure $log_file = dirname(__file__) . ...
...And 3 more matches
HTTP headers - HTTP
an http header consists of its case-insensitive name followed by a colon (:), then by its value. whitespace before the value is ignored. custom proprietary headers have historically been used with an x- prefix, but this convention was deprecated in june 2012 because of the inconveniences it caused when nonstandard fields became standard in rfc 6648; others are listed in an iana registry, whose original content was defined in rfc 4229. iana also maintains a registry of proposed new http headers. ...
...t was defined in rfc 4229. iana also maintains a registry of proposed new http headers. headers can be grouped according to their contexts: general headers apply to both requests and responses, but with no relation to the data transmitted in the body. request headers contain more information about the resource to be fetched, or about the client requesting the resource. response headers hold
additional information about the response, like its location or about the server providing it. entity headers contain information about the body of the resource, like its content length or mime type. headers can also be grouped according to how proxies handle them: connection keep-alive proxy-authenticate proxy-authorization te trailer transfer-encoding upgrade (see also protocol upgrade...
... for the audience, so that it allows a user to differentiate according to the users' own preferred language. content-location indicates an alternate location for the returned data. proxies forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. ...
...And 3 more matches
Network Error Logging - HTTP
18, "method": "post", "phase": "dns", "protocol": "http/1.1", "referrer": "https://example.com/previous-page", "sampling_fraction": 1, "server_ip": "", "status_code": 0, "type": "dns.name_not_resolved", "url": "https://example-host.com/" } } the type of the network error may be one of the following pre-defined values from the specification, but browsers can
add and send their own error types: dns.unreachable the user's dns server is unreachable dns.name_not_resolved the user's dns server responded but was unable to resolve an ip
address for the requested uri. dns.failed request to the dns server failed due to reasons not covered by previous errors (e.g. servfail) dns.
address_changed for security reasons, if the server ip
address that delivered...
...er's dns server is unreachable dns.name_not_resolved the user's dns server responded but was unable to resolve an ip
address for the requested uri. dns.failed request to the dns server failed due to reasons not covered by previous errors (e.g. servfail) dns.
address_changed for security reasons, if the server ip
address that delivered the original report is different to the current server ip
address at time of error generation, the report data will be downgraded to only include information about this problem and the type set to dns.
address_changed. tcp.timed_out tcp connection to the server timed out tcp.closed the tcp connection was closed by the server tcp.reset the tcp connection was reset tcp.refused the tcp connection was refused by the server tcp.aborted the tcp connectio...
...or generation, the report data will be downgraded to only include information about this problem and the type set to dns.
address_changed. ...
...And 3 more matches
JavaScript data types and data structures - JavaScript
: six data types that are primitives, checked by typeof operator: undefined : typeof instance === "undefined" boolean : typeof instance === "boolean" number : typeof instance === "number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "object". special primitive type having
additional usage for its value: if object is not inherited, then null is shown; object : typeof instance === "object". special non-data but structural type for any constructed object instance also used as data structures: new object, new array, new map, new set, new weakmap, new set, new date and almost everything made with new keyword; function : a non-data structure, though it also answers for ty...
... one value: null. see null and null for more details. undefined type a variable that has not been assigned a value has the value undefined. see undefined and undefined for more details. number type ecmascript has two built-in numeric types: number and bigint (see below). the number type is a double-precision 64-bit binary format ieee 754 value (numbers between -(253 − 1) and 253 − 1). in
addition to representing floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan ("not a number"). to check for the largest available value or smallest available value within ±infinity, you can use the constants number.max_value or number.min_value. starting with ecmascript 2015, you are also able to check if a number is in the double-precision floating-po...
...anguages, symbols are called "atoms". for more details see symbol and the symbol object wrapper in javascript. objects in computer science, an object is a value in memory which is possibly referenced by an identifier. properties in javascript, objects can be seen as a collection of properties. with the object literal syntax, a limited set of properties are initialized; then properties can be
added and removed. property values can be values of any type, including other objects, which enables building complex data structures. properties are identified using key values. a key value is either a string or a symbol value. there are two types of object properties which have certain attributes: the data property and the accessor property. note: each property has corresponding attributes. attr...
...And 3 more matches
Grammar and types - JavaScript
// "42 is the answer" with all other operators, javascript does not convert numeric values to strings. for example: '37' - 7 // 30 '37' + 7 // "377" converting strings to numbers in the case that a value representing a number is in memory as a string, there are methods for conversion. parseint() parsefloat() parseint only returns whole numbers, so its use is diminished for decimals.
additionally, a best practice for parseint is to always include the radix parameter. the radix parameter is used to specify which numerical system is to be used. parseint('101', 2) // 5 an alternative method of retrieving a number from a string is with the + (unary plus) operator: '1.1' + '1.1' // '1.11.1' (+'1.1') + (+'1.1') // 2.2 // note: the parentheses are
added for clarity, not required. l...
... following example creates the coffees array with three elements and a length of three: let coffees = ['french roast', 'colombian', 'kona']; note : an array literal is a type of object initializer. see using object initializers. if an array is created using a literal in a top-level script, javascript interprets the array each time it evaluates the expression containing the array literal. in
addition, a literal used in a function is created each time the function is called. note: array literals are also array objects. see array and indexed collections for details on array objects. extra commas in array literals you do not have to specify all elements in an array literal. if you put two commas in a row, the array fills in the value undefined for the unspecified elements. the followin...
...he special property, uses an existing variable (sales). var sales = 'toyota'; function cartypes(name) { if (name === 'honda') { return name; } else { return "sorry, we don't sell " + name + "."; } } var car = { mycar: 'saturn', getcar: cartypes('honda'), special: sales }; console.log(car.mycar); // saturn console.log(car.getcar); // honda console.log(car.special); // toyota
additionally, you can use a numeric or string literal for the name of a property or nest an object inside another. the following example uses these options. var car = { manycars: {a: 'saab', b: 'jeep'}, 7: 'mazda' }; console.log(car.manycars.b); // jeep console.log(car[7]); // mazda object property names can be any string, including the empty string. if the property name would not be a valid java...
...And 3 more matches
JavaScript modules - JavaScript
= createreportlist(mycanvas.id); let square1 = draw(mycanvas.ctx, 50, 50, 100, 'blue'); reportarea(square1.length, reportlist); reportperimeter(square1.length, reportlist); note: although imported features are available in the file, they are read only views of the feature that was exported. you cannot change the variable that was imported, but you can still modify properties similar to const.
additionally, these features are imported as live bindings, meaning that they can change in value even if you cannot modify the binding unlike const. applying the module to your html now we just need to apply the main.js module to our html page. this is very similar to how we apply a regular script to a page, with a few notable differences. first of all, you need to include type="module" in the <...
... allowed per module, and we know that randomsquare is it. the above line is basically shorthand for: import {default as randomsquare} from './modules/square.js'; note: the as syntax for renaming exported items is explained below in the renaming imports and exports section. avoiding naming conflicts so far, our canvas shape drawing modules seem to be working ok. but what happens if we try to
add a module that deals with drawing another shape, like a circle or triangle? these shapes would probably have associated functions like draw(), reportarea(), etc. too; if we tried to import different functions of the same name into the same top-level module file, we'd end up with conflicts and errors. fortunately there are a number of ways to get around this. we'll look at these in the following s...
...ort { 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 previous 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, reportarea, reportperimeter } from './...
...And 3 more matches
Array.prototype.push() - JavaScript
return value the new length property of the object upon which the method was called. description the push method appends values to an array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. ...
...or more elements to the end of an array and returns the new length of the array. 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 arr.push([element1[, ...[, elementn]]]) parameters elementn the element(s) to
add to the end of the array. return value the new length property of the object upon which the method was called. description the push method appends values to an array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. the push method relies on a length property to determine where to start inserting the given values. if the length prope...
...ing the given values. if the length property cannot be converted into a number, the index used is 0. this includes the possibility of length being nonexistent, in which case length will also be created. although strings are native, array-like objects, they are not suitable in applications of this method, as strings are immutable. similarly for the native, array-like object arguments. examples
adding elements to an array the following code creates the sports array containing two elements, then appends 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 examp...
...And 3 more matches
Intl.Locale.prototype.hourCycle - JavaScript
tl.locale.prototype.hourcycle property is an accessor property that returns the time keeping format convention used by the locale. description there are 2 main types of time keeping conventions (clocks) used around the world: the 12 hour clock and the 24 hour clock. the hourcycle property makes it easier for javascript programmers to access the clock type used by a particular locale. like other
additional locale data, hour cycle type is an extension subtag, which extends the data contained in a locale string. the hour cycle type can have several different values, which are listed in the table below. valid hour cycle types hour cycle type description h12 hour system using 1–12; corresponds to 'h' in patterns. the 12 hour clock, with midnight starting at 12:00 ...
...ng 0–23; corresponds to 'h' in patterns. the 24 hour clock, with midnight starting at 0:00. h11 hour system using 0–11; corresponds to 'k' in patterns. the 12 hour clock, with midnight starting at 0:00 am. h24 hour system using 1–24; corresponds to 'k' in pattern. the 24 hour clock, with midnight starting at 24:00. ...
...he 24 hour clock, with midnight starting at 0:00. h11 hour system using 0–11; corresponds to 'k' in patterns. the 12 hour clock, with midnight starting at 0:00 am. h24 hour system using 1–24; corresponds to 'k' in pattern. the 24 hour clock, with midnight starting at 24:00. examples these examples will show you how to
add hour cycle data to your locale object. ...
...And 3 more matches
Object.defineProperty() - JavaScript
-examples and send us a pull request. syntax object.defineproperty(obj, prop, descriptor) parameters obj the object on which to define the property. prop the name or symbol of the property to be defined or modified. descriptor the descriptor for the property being defined or modified. return value the object that was passed to the function. ...
..., prop, descriptor) parameters obj the object on which to define the property. prop the name or symbol of the property to be defined or modified. descriptor the descriptor for the property being defined or modified. return value the object that was passed to the function. description this method allows a precise
addition to or modification of a property on an object. normal property
addition through assignment creates properties which show up during property enumeration (for...in loop or object.keys method), whose values may be changed, and which may be deleted. this method allows these extra details to be changed from their defaults. by default, values
added using object.defineproperty() are immutable and not enumerable. property descriptors present in objects come in two main...
...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, prevents
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() creates a n...
...And 3 more matches
Populating the page: how browsers work - Web Performance
er interactions. web performance can be improved by understanding the single-threaded nature of the browser and minimizing the main thread's responsibilities, where possible and appropriate, to ensure rendering is smooth and responses to interactions are immediate. navigation navigation is the first step in loading a web page. it occurs whenever a user requests a page by entering a url into the
address bar, clicking a link, submitting a form, as well as other actions. one of the goals of web performance is to minimize the amount of time a navigation takes to complete. in ideal conditions, this usually doesn't take too long, but latency and bandwidth are foes which can cause delays. dns lookup the first step of navigating to a web page is finding where the assets for that page are located...
... of web performance is to minimize the amount of time a navigation takes to complete. in ideal conditions, this usually doesn't take too long, but latency and bandwidth are foes which can cause delays. dns lookup the first step of navigating to a web page is finding where the assets for that page are located. ...
... lookup the first step of navigating to a web page is finding where the assets for that page are located. if you navigate to https://example.com, the html page is located on the server with ip
address of 93.184.216.34. if you’ve never visited this site, a dns lookup must happen. your browser requests a dns lookup, which is eventually fielded by a name server, which in turn responds with an ip
address. after this initial request, the ip will likely be cached for a time, which speeds up subsequent requests by retrieving the ip
address from the cache instead of contacting a name server again. dns lookups usually only need to be done once per hostname for a page load. however, dns lookups must be done for each unique hostname the requested page references. if your fonts, images, scripts, ads...
...And 3 more matches
Installing and uninstalling web apps - Progressive web apps (PWAs)
lable in modern browsers that allows users to choose to easily and conveniently “install” a web application on their device so they can access it in the same way they would any other installed app. depending on the device and features of the operating system and browser, this can result in what is essentially a fully featured application (for example, using webapk on android) or as a shortcut
added to their device’s screen. this guide explains how installation is performed, what it means, and what you need to do as a developer to let your users take advantage of it. why installation? the option to install a web application is part of the progressive web app philosophy—giving web apps the same user experience advantages as native apps so they can be competitive. installed application...
...ly, some form of user interface will be available to let you install the site as a web app. the ui for this varies from browser to browser, but the general idea is the same. unfortunately, there isn't a standard for icons and symbols used for operations such as this. firefox for android on an android device using firefox, you'll see a "home" icon with a plus (+) icon inside it—this is the "
add to home screen" icon displayed for any site that has the necessary features in place. tapping this will show a confirmation banner—pressing the banner's big "+
add to home screen" button completes the action,
adding the app to the home screen. note that in android 8 and higher, a system-level "
add to home screen" permission dialog will be shown first. samsung internet browser if you have...
... internet browser if you have samsung internet in your mobile device you will see a different icon. tapping that icon should then take you to the same confirmation banner shown in firefox above. google chrome for android if you have google chrome for android available, the experience is slightly different; upon loading our site, you'll see an install banner pop up asking whether you want to
add this app to your home screen. note: you can find out a lot more about chrome install banners from the article web app install banners. if you choose not to
add it to your home screen at this point, you can do so later using the "
add to home screen" icon in the main chrome menu. safari for ios / iphoneos / ipados on apple's ios (including iphoneos and ipados), the safari browser built into...
...And 3 more matches
Mobile first - Progressive web apps (PWAs)
ce mobile first is more about having the mobile implementation as a default layer to build on. we consider the overall experience during the planning stage, look at what subset of features will be available on mobile, desktop, etc. in tandem and how they will be implemented. then at implementation stage, we present the mobile layout and functionality as the default configuration provided, before
additional information is loaded on top of that, whenever appropriate. this means that mobiles (often the target devices with the least available memory, bandwidth or processing power available) can be given an experience suitable for them as quickly as possible, and as free as possible of extraneous information. for example: if you are serving different styling and layout information for differen...
...there is very little going on here, and anyone with a basic understanding of css should be able to understand most of it by just looking at the source code in app.css. particular bits of interest to point out are as follows. article { display: table; } nav { display: table-caption; caption-side: bottom...
...to create something more suitable for desktop, i put in the following media queries: @media (min-width: 480px) { #bottom, #top { display: none; } article, nav { display: block; } nav ul { text-align: center; } nav li { dis...
...And 3 more matches
Using custom elements - Web Components
is is just a simple example, but there is more you can do here. it is possible to define specific lifecycle callbacks inside the class, which run at specific points in the element's lifecycle. for example, connectedcallback is invoked each time the custom element is appended into a document-connected element, while attributechangedcallback is invoked when one of the custom element's attributes is
added, removed, or changed. you'll learn more about these in the using the lifecycle callbacks section below. there are two types of custom elements: autonomous custom elements are standalone — they don't inherit from standard html elements. you use these on a page by literally writing them out as an html element. for example <popup-info>, or document.createelement("popup-info"). customized b...
...d. note: connectedcallback may be called once your element is no longer connected, use node.isconnected to make sure. disconnectedcallback: invoked each time the custom element is disconnected from the document's dom. adoptedcallback: invoked each time the custom element is moved to a new document. attributechangedcallback: invoked each time one of the custom element's attributes is
added, removed, or changed. which attributes to notice change for is specified in a static get observedattributes method let's look at an example of these in use. the code below is taken from the life-cycle-callbacks example (see it running live). this is a trivial example that simply generates a colored square of a fixed size on the page. the custom element looks like this: <custom-square l="100"...
... function updatestyle(elem) { const shadow = elem.shadowroot; shadow.queryselector('style').textcontent = ` div { width: ${elem.getattribute('l')}px; height: ${elem.getattribute('l')}px; background-color: ${elem.getattribute('c')}; } `; } the actual updates are all handled by the life cycle callbacks, which are pl...
...And 3 more matches
Compiling a New C/C++ Module to WebAssembly - WebAssembly
still output the javascript glue code and .html. we've also specified --shell-file html_template/shell_minimal.html — this provides the path to the html template you want to use to create the html you will run your example through. now let's run this example. the above command will have generated hello2.html, which will have much the same content as the template with some glue code
added into load the generated wasm, run it, etc. open it in your browser and you'll see much the same output as the last example. note: you could specify outputting just the javascript "glue" file* rather than the full html by specifying a .js file instead of an html file in the -o flag, e.g. emcc -o hello2.js hello2.c -o3 -s wasm=1. you could then build your custom html completely from scratch,...
...ovided html template. emscripten requires a large variety of javascript "glue" code to handle memory allocation, memory leaks, and a host of other problems calling a custom function defined in c if you have a function defined in your c code that you want to call as needed from javascript, you can do this using the emscripten ccall() function, and the emscripten_keepalive declaration (which
adds your functions to the exported functions list (see why do functions in my c/c++ source code vanish when i compile to javascript, and/or i get no functions to process?)). let's look at how this works. to start with, save the following code as hello3.c in a new directory: #include <stdio.h> #include <emscripten/emscripten.h> int main(int argc, char ** argv) { printf("hello world\n");...
...m happening. you also need to import the emscripten.h library to use emscripten_keepalive. note: we are including the #ifdef blocks so that if you are trying to include this in c++ code, the example will still work. due to c versus c++ name mangling rules, this would otherwise break, but here we are setting it so that it treats it as an external c function if you are using c++. now
add html_template/shell_minimal.html into this new directory too, just for convenience (you'd obviously put this in a central place in your real dev environment). now let's run the compilation step again. from inside your latest directory (and while inside your emscripten compiler environment terminal window), compile your c code with the following command. (note that we need to compile with no...
...And 3 more matches
Modules - Archive of obsolete content
the cuddlefish loader. loading subscripts when a javascript project reaches a certain size, it becomes necessary to split it up into multiple files. unfortunately, javascript does not provide any means to load scripts from other locations: we have to rely on the host application to provide us with this functionality. applications such as firefox and thunderbird are based on xulrunner. xulrunner
adds a built-in object, known as components, to the global scope. this object forms the central access point for all functionality provided by the host application. a complete explanation of how to use components is out of scope for this document. however, the following example shows how it can be used to load scripts from other locations: const { classes: cc interfaces: ci } = components; ...
...return global; } if present, the loadsubscript function evaluates the script to be loaded in the scope of the second argument. ...
... so will any methods called by the loading script, even if that method was installed by a malicious script. to avoid problems like this, the object passed to loadsubscript should be a true global object, having its own instances of the built-in constructors. this is exactly what sandboxes are for. a sandbox is a global object that lives in a separate compartment. compartments are a fairly recent
addition to spidermonkey, and can be seen as a separate memory space. objects living in one compartment cannot be accessed directly from another compartment: they need to be accessed through an intermediate object, known as a wrapper. compartments are very useful from a security point of view: each compartment has a set of privileges that determines what a script running in that compartment can and c...
...And 2 more matches
Two Types of Scripts - Archive of obsolete content
on the web, javascript executes in the context of a web page, and has access to that page's dom content. this enables you to call functions like: window.alert("hello there"); in an
add-on's main scripts you can't do that, because the
add-on code does not execute in the context of a page, and the dom is therefore not available. if you need to access the dom of a particular page, you need to use a content script. so there are two distinct sorts of javascript scripts you might include in your
add-on and they have access to different sets of apis. ...
... scripts you can't do that, because the
add-on code does not execute in the context of a page, and the dom is therefore not available. if you need to access the dom of a particular page, you need to use a content script. so there are two distinct sorts of javascript scripts you might include in your
add-on and they have access to different sets of apis. in the sdk documentation we call one sort "
add-on code" and the other sort "content scripts".
add-on code this is the place where the main logic of your
add-on is implemented. your
add-on is implemented as a collection of one or more commonjs modules. each module is supplied as a script stored under the lib directory under your
add-on's root directory. minimally you'll have a single module implemented by a script called "main.js", but you...
... the other sort "content scripts".
add-on code this is the place where the main logic of your
add-on is implemented. your
add-on is implemented as a collection of one or more commonjs modules. each module is supplied as a script stored under the lib directory under your
add-on's root directory. minimally you'll have a single module implemented by a script called "main.js", but you can include
additional modules in lib, and import them using the require() function. to learn how to implement and import your own modules, see the tutorial on implementing reusable modules. content scripts while your
add-on will always have a "main.js" module, you will only need to write content scripts if your
add-on needs to manipulate web content. content scripts are injected into web pages using apis defi...
...And 2 more matches
tabs - Archive of obsolete content
}); note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page. attaching stylesheets new in firefox 34. you can't attach style sheets to a tab using tab.attach(), but from firefox 34 onwards you can attach and detach them using the low-level stylesheet/style and content/mod apis. ...
...e new page. attaching stylesheets new in firefox 34. you can't attach style sheets to a tab using tab.attach(), but from firefox 34 onwards you can attach and detach them using the low-level stylesheet/style and content/mod apis. here's an
add-on that uses a toggle button to attach a stylesheet to the active tab, and detach it again. ...
... tabs hosted by private browser windows won't be seen if you enumerate the tabs module itself, and you won't receive any events for them. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the priva...
...And 2 more matches
ui - Archive of obsolete content
k overview. actionbutton an action button is a button in the main firefox toolbar. you give it an icon, a label, and a click handler: var ui = require("sdk/ui"); var action_button = ui.actionbutton({ id: "my-button", label: "action button!", icon: "./icon.png", onclick: function(state) { console.log("you clicked '" + state.label + "'"); } }); you can make a button standalone or
add it to a toolbar. if it's standalone, it appears in the toolbar at the top right of the browser window: togglebutton a toggle button is a special kind of button that's for representing a binary on/off state, like a checkbox. so they have a checked property which is toggled when the user clicks the button, and the icon gets a "pressed" look when the button is checked. it's otherwise identical t...
...en the button is checked. it's otherwise identical to the action button. attaching panels to buttons is only supported from firefox 30 onwards. from firefox 30 onwards, you can attach panels to toggle buttons, by passing the button into the panel's constructor or its show() method: frame a frame enables you to create an html iframe, using bundled html, css and javascript. this can then be
added to a designated area of the firefox user interface. at the moment you can only
add frames to a toolbar. you initialize a frame with a url pointing to an html document supplied under your
add-on's "data" directory. this document can refer to bundled css and javascript files, and your main
add-on can communicate with a frame script using message passing. once you've created a frame you need to a...
... a toolbar gives you a horizontal strip of space which you can use for presenting a more complex user interface. ...
...And 2 more matches
lang/functional - Archive of obsolete content
als functions method(lambda) takes a function and returns a method associated with an object. when the method is invoked on an instance of the object, the original function is called. it is passed the object instance (i.e. this) as the first parameter, followed by any parameters passed into the method. let { method } = require("sdk/lang/functional"); let mynumber = { times: method(times),
add: method(
add), number: 0 }; function times (target, x) { return target.number *= x; } function
add (target, x) { return target.number += x; } console.log(mynumber.number); // 0 mynumber.
add(10); // 10 mynumber.times(2); // 20 mynumber.
add(3); // 23 parameters lambda : function the function to be wrapped and returned. returns function : the wrapped lambda. defer(fn) takes a function ...
... callee : function function to invoke. params : array parameters to be passed into callee. self : mixed object to be passed as the this context to callee. returns mixed : returns the return value of callee. partial(fn, arguments...) takes a function and bind values to one or more arguments, returning a new function of smaller arity. let { partial } = require("sdk/lang/functional"); let
add = function
add (x, y) { return x + y; } let
addone = partial(
add, 1);
addone(5); // 6
addone(10); // 11 partial(
add,
addone(20))(2); // 23 parameters fn : function function on which partial application is to be performed. arguments... : mixed
additional arguments returns function : the partial function. compose(fn...) returns the composition of a list of functions, where each function c...
...o: moe, after" function hello (name) { return "hello: " + name; } parameters fn : function the function to be passed into the wrapper function. wrapper : function the function that is called when the return function is executed, taking the wrapped fn as the first parameter. returns function : a function which, when called, executes wrapper with fn as the first parameter, and passes in any
additional parameters to the wrapper function. identity(value) returns the same value that is used as the argument. in math: f(x) = x. let { identity } = require("sdk/lang/functional"); let x = 5; identity(x); // 5 parameters value : mixed the value to be returned. returns mixed : the value that was originally passed in. memoize(fn, hasher) memoizes a given function by caching the computed ...
...And 2 more matches
remote/child - Archive of obsolete content
main things: access to web content loaded into this child process port mechanisms to communicate with the main process interacting with web content to interact with web content, the sdk/remote/child module provides a frames property that's a list of all content frames loaded into this child process. each frame then has a content property that's the top-level dom window for the frame, and
addeventlistener/removeeventlistener functions that enable you to listen to dom events dispatched by the frame. communicating with the parent process to communicate with the parent process, the process, frames, and frame objects in sdk/remote/child have a port object that you can use to receive messages from, and send messages to, code in the parent. see the documentation for sdk/remote/parent for...
...ames 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 forevery 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 previously 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 liste...
...eeventlistener removes an event listener that was previously 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/remote/child"); frames.on("attach", function(frame) { console.log("new frame"); frame.
addeventlistener("domcontentloaded", function(e) { console.log(e.target.location.href); }); }); detach triggered when a frame is removed (for example, the user closed a tab). frame a frame represents a content frame in this process and provides a w...
...And 2 more matches
ui/toolbar - Archive of obsolete content
experimental
add a toolbar to the firefox user interface. a toolbar is a horizontal strip of user interface real estate. like a panel, a toolbar's content is specified using html. unlike a panel, a toolbar: does not overlap with any web content is persistent, remaining visible until the user chooses to close it is a fixed size, and appears in a fixed location usage creating and destroying toolbars you don't specify toolbar content directly: instead, you create other ui components and supply them to the toolbar constructor. ...
...any web content is persistent, remaining visible until the user chooses to close it is a fixed size, and appears in a fixed location usage creating and destroying toolbars you don't specify toolbar content directly: instead, you create other ui components and supply them to the toolbar constructor. ...
...oss all browser windows. if you need to customize content for a particular browser window, you can do that by messaging the window-specific frame hosted by that toolbar. globals constructors toolbar(options) creates a toolbar. the only mandatory option is title, but for the toolbar to contain any actual content, the items parameter must also be supplied, and must contain at least object. ...
...And 2 more matches
util/array - Archive of obsolete content
. let { hasany } = require('sdk/util/array'); let a = ['rock', 'roll', 100]; hasany(a, ['rock', 'bright', 'light']); // true hasany(a, ['rush', 'coil', 'jet']); // false parameters array : array the array to search for elements. elements : array an array of elements to search for in array. returns boolean : a boolean indicating whether or not any of the elements were found in the array. ...
...'bright', 'light']); // true hasany(a, ['rush', 'coil', 'jet']); // false parameters array : array the array to search for elements. elements : array an array of elements to search for in array. returns boolean : a boolean indicating whether or not any of the elements were found in the array.
add(array, element) if the given array does not already contain the given element, this function
adds the element to the array and returns true. otherwise, this function does not
add the element and returns false. let {
add } = require('sdk/util/array'); let a = ['alice', 'bob', 'carol'];
add(a, 'dave'); // true
add(a, 'dave'); // false
add(a, 'alice'); // false console.log(a); // ['alice', 'bob', 'carol', 'dave'] parameters array : array the array to
add the element to. element : * the ...
... remove(array, element) if the given array contains the given element, this function removes the element from the array and returns true. otherwise, this function does not alter the array and returns false. ...
...And 2 more matches
util/list - Archive of obsolete content
experimental building blocks for composing lists. globals constructors list(element1, element2, ...) constructor can takes any number of elements and creates an instance of list populated with the specified elements. parameters element1 : object|string|number element2 : object|string|number ... : object|string|number functions
addlistitem(list, item) function
adds a item to a list. removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. list is composed out of iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list). list is a base trait and is meant to be part of a composition, since all of its api is priva...
... disallowing duplicate elements. list is composed out of iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list). list is a base trait and is meant to be part of a composition, since all of its api is private except for the length property. ...
...uplicate elements. list is composed out of iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list). list is a base trait and is meant to be part of a composition, since all of its api is private except for the length property. ...
...And 2 more matches
Low-Level APIs - Archive of obsolete content
modules in this section implement low-level apis. these modules fall roughly into three categories: fundamental utilities such as collection. many
add-ons are likely to want to use modules from this category. building blocks for higher level modules, such as events and worker. you're more likely to use these if you are building your own modules that implement new apis, thus extending the sdk itself. privileged modules that expose powerful low-level capabilities such as window/utils and net/xhr. you can use these modules in your
add-on if you need to, but should be aware that the cost of privileged access is the need to take more elaborate security precautions. in many cases these modules have simpler, more restricted analogs among the "high-level apis" (for example, windows...
... access is the need to take more elaborate security precautions. in many cases these modules have simpler, more restricted analogs among the "high-level apis" (for example, windows or request). these modules are still in active development, and we expect to make incompatible changes to them in future releases. /loader create commonjs module loaders. chrome the chrome module gives an
add-on sdk
add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis. console/plain-text constructor for a console instance. console/traceback functionality similar to python's traceback module. content/content re-exports three objects from three other modules: loader, worker, and symbiont. content/loader provides one of the buil...
...nd services. preferences/event-target listen to changes to the preferences system in firefox. preferences/service access the preferences system in firefox. remote/child enables an sdk module loaded into a child process to access web content in the child process and communicate with modules in the main process. remote/parent enables you to load modules, and privileged parts of your
add-on in general, into child processes. stylesheet/style modify styles using stylesheet files or css rules. stylesheet/utils helper functions for working with stylesheets. system/child_process an implementation of the node.js child_process api. system/environment access, set and clear environment variables. system/events api for working with the application observer service. system/runtim...
...And 2 more matches
Customizing the download progress bar - Archive of obsolete content
this example illustrates how to customize the progress bar displayed for a given download in the downloads window. first you need to overlay the downloads window so that you can
add a new stylesheet. ...
... this example illustrates how to customize the progress bar displayed for a given download in the downloads window. first you need to overlay the downloads window so that you can
add a new stylesheet. ...
... this is the product of some tweaking and experimentation, so perhaps there is a different and/or better way to achieve the same thing. we are specifying the height of the progress meter on windows and a background image on mac. the background image (the first one in the file) should be a segment of whatever you want the unfilled portion of the progress bar to look like. an i...
...And 2 more matches
Dialogs and Prompts - Archive of obsolete content
g boxes. see working with windows in chrome code for introductory information and more discussion and examples. describing dialog windows dialogs in mozilla whenever you want to create a dialog in your application, use <dialog> (instead of usual <window>) as root element in the xul file. this will: handle a few keyboard events (enter/esc and more), which is good for keyboard accessibility.
add ok and cancel buttons in an order that is consistent with os default (but the button set and layout is highly customizable, see below). simple dialog code the following xul code defines a simple dialog with two buttons, ok and cancel (buttons="accept,cancel" attribute on dialog). <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog xmlns="ht...
... dialog. they are: accept — ok button. cancel — cancel button. disclosure — more info button. help — help button (doesn't work in thunderbird 1.0 bug 256915) extra1, extra2 — two buttons without any predefined labels or meaning. extra2 is positioned at the left side of the dialog (by default). ...
... work in thunderbird 1.0 bug 256915) extra1, extra2 — two buttons without any predefined labels or meaning. extra2 is positioned at the left side of the dialog (by default). for each of these buttons you can set their label, accesskey and oncommand handler by
adding buttonlabel<buttonname>, buttonaccesskey<buttonname> and ondialog<buttonname> attributes to the dialog element. ...
...And 2 more matches
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
d on windows. if you've had experience developing with dynamic html, you'll probably find it relatively easy to pick up the knowledge you'll need to develop firefox extensions. the role of each technology firefox is largely built using four technologies: xul, css, javascript, and xpcom. extensions are also built 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 brevity, i will omit explanations of widely understood technologies, and focus instead on int...
...nsist of an opening tag, a closing tag, and content. note: elements that take no content can be expressed in compact form as <elementname/>. an element can include other elements as well as text in its content, and all information is structured as a tree. as in all trees, elements can have children (elements contained within them) and parents (elements that contain them). attributes can also be
added to opening tags, each with a value. as the "extensible" part of xml implies, elements from various xml-based languages such as xhtml and svg can be interspersed in one another as a means to extend the language. all elements can carry a "namespace uri" identifier, which is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguish...
...vely powerful features. the gecko rendering engine handles nearly all of css level 2 and some of css level 3. listing 2: css code sample body { color: black; background-color: white; } p { margin-bottom: 1em; text-indent: 1em; } javascript: the world's most misunderstood language javascript is a scripting language first developed in the 1990s, at which time it was created as a way to
add dynamic features to web pages. because it was often used at first to display pop-up windows, marching text in status bars, or in other ways that made web pages less useful to users, the language acquired a reputation as having little practical use and lacking in functionality. also, because a series of security holes were discovered in javascript and the compatible technology jscript, there was ...
...And 2 more matches
Mozilla Documentation Roadmap - Archive of obsolete content
en down. xulplanet allowed you to navigate between interfaces and their related components, which makes locating components very easy. hopefully this will be corrected in the future. in the meantime, you can still navigate xulplanet using the wayback machine. mdc should be your first stop when looking for documentation. if you find it lacking or missing some piece of information, please consider
adding it once you've found it. everyone looking for it later will thank you for it. the amo developer hub the amo developer hub is a great guide for
add-on developers. it includes links to tutorials and documentation, development tools, and most notably, the mozilla
add-ons forum. this is a great place to ask questions and have them answered by experienced developers. it also includes discussions ...
... the mozilla source sometimes you need more than just a tutorial. ...
... the mozilla source sometimes you need more than just a tutorial. there are various tricks that you can't learn anywhere, but you know that firefox implements them in some way. in these cases you should dive into mozilla's source code and try to locate the code you need. ...
...And 2 more matches
User Notifications and Alerts - Archive of obsolete content
s need to notify users about important events, often requiring some response. 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. they are thin boxes that appear from beneath the tab list and above the page content, with some text and maybe a fe...
...f displaying alerts and notifications. there's a catch, though: these notifications are inside the current tab, so switching tabs will make a notification disappear. the notification shows up again when you come back to the tab that displayed it. this means that these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an
add-on, or a site you just entered a password on. notification boxes are very easy to create, and are very customizable: let nb = gbrowser.getnotificationbox(); let acceptbutton = new object(); let declinebutton = new object(); let message = this._bundle.getstring("xulschoolhello.friendmessage.label"); let that = this; acceptbutton.label = this._bundle.getstring("xulschoolhello.acceptbutton.
...or when it is displayed. you should look for the level that better fits your message, and use the lowest applicable level, to prevent the user from getting used to dismissing high-level notifications. the 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, clicking on any of your custom buttons will cause the notification to be immediately closed, so you should only use notification boxes for single-step processes. the alerts service this is a very good option when you want to alert users about events without requiring i...
...And 2 more matches
Using the Stylesheet Service - Archive of obsolete content
the stylesheet service allows extensions to manage user and ua stylesheets without having to touch usercontent.css or userchrome.css files. the api is defined in nsistylesheetservice.idl. the stylesheets registered with this api apply to all documents; firefox 18 extended nsidomwindowutils with load
additionalstylesheet() and remove
additionalstylesheet() to manage stylesheets for a specific document (bug 737003). the examples in this document are all written in javascript using xpcom. using the api the string "chrome://myext/content/myext.css" in the examples below is just an example. replace it with the url of the css file you want to load. you can replace user_sheet with agent_sheet or author_sheet, depending where in the css cascade you want the sheet to be placed. see the css ...
...css specification for more details. note that ua stylesheets are allowed to do certain unsafe things that user stylesheets are not allowed to do. in particular, they can apply styles to native anonymous elements and to css anonymous boxes. getting such styles wrong can easily lead to very incorrect behavior, including crashes. be very careful with your css when using agent_sheet stylesheets.
adding a stylesheet to use the stylesheet service, you get a reference to the service, create a uri and pass the uri to the stylesheet service's loadandregistersheet 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"] ...
...vice;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("chrome://myext/content/myext.css", null, null); sss.loadandregistersheet(uri, sss.user_sheet); note: loadandregistersheet will load the stylesheet synchronously, so you should only call this method using local uris. determining whether a sheet has been loaded if you are writing an extension and
adding your stylesheet in an onload handler, you'll want to see if your sheet has already been
added. if you don't check, you will wind up
adding your sheet once per window load. 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"] ...
...And 2 more matches
XUL user interfaces - Archive of obsolete content
sskey="t" oncommand="settoday();"/> </hbox> </groupbox> <statusbar> <statusbarpanel id="status"/> </statusbar> </vbox> </window> make a new css file, style7.css. ...
...x> <statusbar> <statusbarpanel id="status"/> </statusbar> </vbox> </window> make a new css file, style7.css. ...
...tusbar> </vbox> </window> make a new css file, style7.css. ...
...And 2 more matches
List of Mozilla-Based Applications - Archive of obsolete content
ve applications 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. a list of former mozilla-based applications is also available. name description
additional information 389 directory server ldap server uses nss a380 seatback entertainment system media software this blog post mentions a reference to mozilla being used but i couldn't find more information about it. abstract accounting tool adobe acrobat and adobe reader portable document format (pdf) software uses mozilla spidermonkey ...
...ar assay data based on xul liaison groupware client for novell’s email and collaboration server previously called mozngw linbox kiosk browser (fr) web browser dedicated browser for french prefecture and town hall litl internet computer for home uses spidermonkey and gecko lizilayers gis application 3liz also creates some gis firefox
add-ons logitech harmony remote software software for remote control device uses gre or xulrunner longman dictionary of contemporary english cd-rom lotus notes / sametime groupware the latest version of ibm lotus notes and sametime can embed xul applications lucidor e-book reader lx-office accounting tool looks like it makes...
...ed for elderly people with dementia but other applications mac os x operating system makes use of some mpl files such as libsecurity_asn1 maemo browser browser for maemo internet tablet development name is microb magooclient business process management tool uses mozilla rhino mantra security tool mccoy secure update tool for
add-ons xulrunner application mediacoder media converter transcoder for video, audio, and even devices such as zen, zune, pocketpcs, ipods, and psps mekhala browser part of the khmeros linux distro midbrowser mobile web browser mockery mockup creation tool built on xulrunner mongodb database project uses spidermonkey ...
...And 2 more matches
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
create an empty project, then check it. otherwise you'll delete files later. again note that the resulting dll filename must start with "np", so either call your project like this or rename the file later delete the .cpp and .h and readme files from the project and disk (if you did not create an empty project) copy the npruntime sample plugin source code into the dir of the new vs project and
add the files to the project using the vs gui (.cpp files to "source files", .h files to "header files", .rc file to "resource files"). samples can be obtained from: https://developer.mozilla.org/en/plugins/samples_and_test_cases get the npapi sdk.
add the npapi sdk include path (example : c:\npapi-sdk\headers) to project properties|(all configurations)|c++|general|
additional include directories. n...
... files to "header files", .rc file to "resource files"). samples can be obtained from: https://developer.mozilla.org/en/plugins/samples_and_test_cases get the npapi sdk.
add the npapi sdk include path (example : c:\npapi-sdk\headers) to project properties|(all configurations)|c++|general|
additional include directories. note: if your project is still empty, the c++ tree might not be visible. so,
add some files first. ...
...", .rc file to "resource files"). samples can be obtained from: https://developer.mozilla.org/en/plugins/samples_and_test_cases get the npapi sdk.
add the npapi sdk include path (example : c:\npapi-sdk\headers) to project properties|(all configurations)|c++|general|
additional include directories. note: if your project is still empty, the c++ tree might not be visible. so,
add some files first. ...
...And 2 more matches
In-Depth - Archive of obsolete content
ton-send { -moz-image-region: rect(294px 23px 315px 0px); } #button-send:hover { -moz-image-region: rect(294px 46px 315px 23px); } #button-send:hover:active { -moz-image-region: rect(294px 69px 315px 46px); } #button-send[disabled="true"] { -moz-image-region: rect(294px 92px 315px 69px) !important; } the properties for rect are listed in a clockwise fashion - top, right, bottom, left.
adding an image to the right of a toolbar this tutorial is done with mozilla 1.2 in mind. the layout of files can and probably will change over time, but the basics should remain the same. by default, mozilla 1.2 doesn't support images on the right hand side of the toolbars, but that can be changed with some xbl hacking. place this xml file in \classic\skin\classic\communicator\toolbar\toolbarbindin...
...ge over time, but the basics should remain the same. by default, mozilla 1.2 doesn't support images on the right hand side of the toolbars, but that can be changed with some xbl hacking. place this xml file in \classic\skin\classic\communicator\toolbar\toolbarbindings.xml (you will need to create the sub directory). what this file does, is it takes the standard toolbar that is used in mozilla and
adds an image to the one side of it. if you look at the modern skin, you'll notice that it
adds the image to the other side of the toolbar. now that we have the code that will change the toolbar, it needs to be accessed. open up \classic\skin\classic\communicator\communicator.css and look for the .toolbar-primary section. there is a -moz-binding command there. point the url to the new location. chang...
...nicator.css and look for the .toolbar-primary section. there is a -moz-binding command there. point the url to the new location. change: -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-primary"); to -moz-binding: url("chrome://communicator/skin/toolbar/toolbarbindings.xml#toolbar-primary"); now every toolbar has a spot for an image on the right hand side and we can start
adding images, but first we need to make sure we can see the images that we
add. also in the communicator.css
add this code: .toolbar-primary-icon { width: 100px; background-repeat: no-repeat; background-position: top; } open up \classic\skin\classic\navigator\navigator.css and scroll down to the bottom. to style that image, we first need to get a handle to the toolbar, then the box inside of ...
...And 2 more matches
Repackaging Firefox - Archive of obsolete content
s you desire. once you have all the ingredients, the customization process is quite easy: download the firefox installer. install 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 abbreviated 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...
...rsion of the dex, and that will cause any users with the earlier version to get unnecessarily upgraded. on the other hand, if you create a dex which supports all locales, you can only ship on a few, and later expand your set without any upgrade hassles. of course, this strategy only works when your strings either do not need localization, or are programmatically localizable (for example, simply
adding the locale to a url, like http://<locale>.example.com/). but it's something to keep in mind when planning your locale support. preferences preferences are one of the two main things you will want to set in your extension (the other is bookmarks). there are two kinds of preferences in firefox, both set in the partner.js file: localizable preferences, which have a value of a chrome:// uri p...
... partner.js and do not need to be in the properties file. mozilla.partner.id=<name> app.partner.<name>=<name> app.distributor=<name> app.distributor.channel=<name> other preferences some settings are commonly set in partner distributions. this is not meant to be a comprehensive list of preferences, however. ...
...And 2 more matches
Introducing the Audio API extension - Archive of obsolete content
once the buffer is full, the event mozaudioavailable is triggered. this event therefore contains the raw samples of ...
...content scripts can specify the audio stream's characteristics, then write audio samples.
...content scripts can specify the audio stream's characteristics, then write audio samples. users must create an audio object and then use the mozsetup() function to...
...And 2 more matches
Monitoring downloads - Archive of obsolete content
idownloadmanager interface and create the database into which its data will be stored. ...
...s, but we don't care! dbconn.executesimplesql("create table items (source text, size integer," + " starttime integer, endtime integer," + " speed real, status integer)"); dbconn.close(); }, this is fairly simple stuff. the download manager instance is cached into a member variable in the downloadlogger object for reuse later, and its
addlistener() method is called to start listening for download status updates. the database file is opened, and an sqlite create table command is executed to create the table. finally, the database is closed. note: the mozistorageconnection method close() is being
added to firefox 3 alpha 8; in prior versions of firefox, there is no way to explicitly close the database. instead, it is closed when t...
... state changes once the code above is run, our ondownloadstatechange() method is called whenever a download's state changes. this is part of the nsidownloadprogresslistener interface. that code looks like this: ondownloadstatechange: function(astate, adownload) { var statement; switch(adownload.state) { case components.interfaces.nsidownloadmanager.download_downloading: //
add a new row for the download being started; each row includes the // source uri, size, and start time. the end time and download speed // are both set to 0 at first, since we don't know those yet. // status is the same status value that came from the download manager. var dbconn = this.storageservice.opendatabase(this.dbfile); statement = dbconn.createstatement...
...And 2 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
o develop "themes" for your application. themes are simply collections of images and css which can augment or replace your current ui elements. xul provides an excellent answer for organizations with heterogeneous computing environments. customized xul applications with significant business logic can be written once, and used on the range of platforms that exist within the organization. in
addition, if the organization maintains sophisticated, interactive websites, it will already possess a wealth of technical expertise that will be relevant for creating xul applications. in
addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. don't feel limited by the widgets that the framework already contains! xbl (exten...
... 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 web applications. gecko features full support for open internet standards such as css1, html 4.0, dom1, rdf, xml and javascript. modular, embeddable: gecko's modular architecture enables developers to
add or remove modules with little effort, fitting the software to the available hardware and adjusting functionality to match product requirements. gecko is implemented as a collection of xpcom components that can be easily
added or removed. flexible programming interfaces such as the web shell api, the java wrapper api and the gecko activex control make gecko easily embeddable into applications and ...
...ocols, multilingual character data, image data, java and plugins. open source: gecko represents the first software release from netscape and mozilla.org's open source initiative. by harnessing the talent of thousands of developers worldwide, mozilla.org has accelerated internet software development and increased the quality of the final product, delivering unmatched support for web standards. in
addition, independent software developers and corporate information technology departments now have complete access to the modular source code and freedom to freely license the source, make changes and build customized versions to accommodate their individual needs. free: gecko is free of charge. there is no charge for using the gecko browser engine or gecko technologies, including distributing geck...
...And 2 more matches
Extensions - Archive of obsolete content
prism has support for extensions. extensions are built using the same methods as any mozilla-based extension. since prism is a totally separate host application, there are some prism-specific issues that you need to handle when creating your extension. most notably, the prism application id and the differences in the user interface (ui). ...
... host application's ui to
add toolbar buttons, menus and other features. one of prism's features is an extreme lack of ui elements, which means that trying to use the same overlays in firefox and prism is really not possible. the basics in order to install an extension in prism, you need to follow the guidelines for building a mozilla-based extension. to support prism specifically, you'll need to
add prism to the list of target applications in the extension's install.rdf file. ...
...prism does have a few ui elements, such as a toolbox, toolbar, menubar, popup menus, statusbar and a container for the browser. you can use these ui elements to merge in your extension ui. ...
...And 2 more matches
Table Cellmap - Archive of obsolete content
colspan (a cell cell without a defined row- or colspan attribute assumes 1 as a default value), or a entry which is only covered by a row- or colspan. entries which are a origin have a direct corresponding tablecellframe. entries which are only spanned don't have that direct relationship. they belong to a entry which has a direct relationship to a tablecellframe. now that union uses the fact all
addresses of real tablecellframes are aligned at even boundaries, or in other words they cant have an odd
address. if the
address is odd then it holds some other info (mbits). easy table cellmap just imagine a 2x2 table. <table> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </table> this would create a cellmap with two rows and in each row 2 entries. each entr...
...t holds some other info (mbits). easy table cellmap just imagine a 2x2 table. <table> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </table> this would create a cellmap with two rows and in each row 2 entries. each entry in the cellmap wold have a direct link to the corresponding tablecellframes. tables with footers, headers etc. take the same table and
adder a header <table> <thead> <tr><td>head cell 1</td><td>head cell 2</td></tr> </thead> <tbody> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </tbody> </table> now we have two different rowgroups and and the rowspans can not cross the borders between the different rowgroups. (ref xhtml-2.0). further the table header and footer will be repeated on every ...
... the table header and footer will be repeated on every page when printed out. due to this behind the cellmap for the table we will find a cellmap for every rowgroup. in this low level cellmap the row count begins every time with 0. a typical code segment to come from the table level down to the rowgroup level nscellmap* map = mfirstmap; while (map) { if (map->getrowcount() > rowindex) { //
add your action here } rowindex -= map->getrowcount(); map = map->getnextsibling(); } data entry the usual way to populate the cellmap is via nstableframe::insertrows. enabling the debug code at the function entrance and exit gives a quite complete picture of the cellmap structure. below follows the dump for the 2x2 table. insertrowsbefore firstrow=0 ***start table dump*** mcolwidths= row(0...
...And 2 more matches
Mac stub installer - Archive of obsolete content
"macbuild" folder itself. now run the built installer from the "macbuild" itself or by running it from the miw.mcp codewarrior project. how we get setup to debug the xpinstall engine from the mac installer? once you have the mac installer built and ready to debug you may want to debug the xpinstall engine in the context of the installer rather than in the context of the browser. ...
...eamonkey/sou...ackages-mac#33> note that if you are using the debug target of the installer binary all shared libraries are expected to have the name format <libname>debug.shlb now set a break point at xpi_init() in the mac installer code and step into xpistub and eventually the xpinstall engine will load including symbols so you can set a break point in the xpinstall engine itself. how do i
add an installer package to the mac installer?
adding a package involves a few steps:
add a section named for your <component> to the packages-mac manifest that describes which files from dist belong to which module. for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually zipped with the directory structure preserved. read the top of the package...
...checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/mac/> directory. ...
...And 2 more matches
Unix stub installer - Archive of obsolete content
src2 directory as well). go to mozilla/xpinstall/packager/unix. on the shell prompt type "perl deliver.pl". now you will find an installer *and* the xpcom.xpi and other debug xpis delivered to mozilla/installer/raw. debug using "gdb mozilla-installer-bin" and set a breakpoint at xpi_init(). you can step into the xpinstall engine through the xpistub once the xpistub dll is loaded. how do i
add an installer package to the unix installer?
adding a package involves a few steps:
add a section named for your <component> to the packages-unix manifest that describes which files from dist belong to which module. for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually zipped with the directory structure preserved. read the top of the packa...
...checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/unix> directory. ...
...install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/unix> directory. note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. ...
...And 2 more matches
Writing to Files - Archive of obsolete content
arguments in this example. the first argument is the file to write to, and the second is a set of flags which control the writing. in this case, the 'text' flag is used which indicates that you will be writing text to the file. when writing text files, characters are writing using a chosen character set, encoded automatically. the default character set is 'utf-8' but this can be changed using an
additional, yet optional, argument to the newoutputstream method. see below for more details about this. creating and appending to files a number of flags control whether a new file is created when writing or whether data is appended to an existing file. these flags should be included in
addition to the 'text' or 'binary' flags when using the newoutputstream method. the default when writing is to cre...
...if this flag is not used, the data is written at the beginning of the file, overwriting what is already there. nocreate if used, don't create a new file if it does not already exist. in this case, an error will occur if the file does not exist, which you can capture using a try-catch block. ...
...(); in this example, a text input stream is created for the file 'myinfo.txt'. the writestring method is called to write a single string to the file, supplied as an argument to the method. finally, the stream is closed by calling the stream's close method. you should ensure that the file is closed, so that the data is properly written and that the file can be reopened for reading later. to write
additional strings, call the writestring method multiple times. writing other character encodings the default character encoding is utf-8. if you want to write using a different encoding, you can specify a third argument to nsiscriptableio.newoutputstream() which specifies the encoding. this example opens a file using the utf-16 encoding. var stream = io.newinputstream(file, "text", "utf-16"); this ...
...And 2 more matches
Building Hierarchical Trees - Archive of obsolete content
//www.xulplanet.com/rdf/myphotos' with three photos. three results will be generated from a simple rule with no extra conditions. it is the result, or the photo, that will be checked, not the container of photos. since a photo isn't a container, the tree rows will not become containers, so you will not be able to open them. as the rows are not containers, the tree builder does not recurse to find
additional data. the tree builder creates rows lazily, so a closed container will not have any data generated inside in it until the row is opened. when the user opens the tree row, the next level of rows are generated from the template and displayed in the tree. similarly, when the user closes a tree row, the rows inside it are removed, such that they will have to be generated again the next time th...
...late and displayed in the tree. similarly, when the user closes a tree row, the rows inside it are removed, such that they will have to be generated again the next time the row is opened. if you want to put rows inside the photo rows, you will either need to make each photo resource a container (for this rdf datasource, this will usually be an rdf seq), or use the containment attribute to specify
additional properties that indicate containership. if a particular photo had a value for one of the properties listed in the containment attribute, it would be accepted as a container, and the user could open the row. when the user opens the row, the template will be re-examined for results using the photo as the starting point instead of the top level ref value. here is an example for the streets da...
...the template will be re-examined for results using the photo as the starting point instead of the top level ref value. ...
...And 2 more matches
Template Builder Interface - Archive of obsolete content
interface. since this is a composite datasource, it may contain more than one datasource. these may be listed in the datasources attribute separated by spaces. for example: <vbox datasources="template-guide-photos5.rdf template-guide-streets.rdf"> sometimes, you will want to calculate the datasource to be used and attach it to the template later. you can do this using the composite datasource's
adddatasource method. you can
add as many datasources as you wish, and you can remove them using the removedatasource method. a common pattern is to use the following: var rdf = components.classes["@mozilla.org/rdf/rdf-service;1"]. getservice(components.interfaces.nsirdfservice); var ds = rdf.getdatasource("http://www.xulplanet.com/ndeakin/tests/xul/template-guide-streets.rdf"); var tre...
...you wish, and you can remove them using the removedatasource method. a common pattern is to use the following: var rdf = components.classes["@mozilla.org/rdf/rdf-service;1"]. ...
...common pattern is to use the following: var rdf = components.classes["@mozilla.org/rdf/rdf-service;1"]. ...
...And 2 more matches
Template Logging - Archive of obsolete content
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. in
addition, each result generated when the template is first created and initialized is logged. this logging of result changes is not done by default; it must be enabled with a flag. <vbox datasources="..." flags="logging"/> the flags attribute on the root element of the template should include the logging flag. if other flags are used as well, separate them with spaces. enabling logging will output d...
...he template works correctly, as the logging can take up extra time that is not necessary when the template is working. each result is logged in a form much like the following: in template with id root using ref http://www.some-fictitious-zoo.com/birds new active result for query 2 matching rule 1: http://www.some-fictitious-zoo.com/birds/emperorpenguin in the example above, a new result has been
added. for references, the value of the template's id and ref attributes are provided in each logged message. this is useful if multiple templates are being used. the second line gives details about the new result. the id of the result is specified at the end, in this case 'http://www.some-fictitious-zoo.com/b...emperorpenguin'. this corresponds to the id attribute set on a generated row. for an rdf ...
..., this may be a somewhat random value. however, calling getelementbyid using this id will retrieve the generated content for that result if you want to further study the content that was generated. the example also specifies 'query 2 matching rule 1'. this indicates that the result is for the second <query> element. if only one <query> is used, naturally this will always indicate a query of 1. in
addition, this result matches the first <rule> of query 2. this information may be used to determine if results are not matching the correct rules. if you, for example, were expecting rule 2 to match, examine the rules and ensure that the logic is correct. the final piece of information is the phrase 'new active result'. this indicates first, that this is a new result, as opposed to a result being re...
...And 2 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
ew in thunderbird 3 requires seamonkey 2.0 the user's email domain is suggested. history requires seamonkey 2.0 the user's url history is searched. form-history requires seamonkey 2.0 search the values that the user has entered into form fields. file (linux only) the local file system is searched. gloda new in thunderbird 3
addrbook new in thunderbird 3 requires seamonkey 2.0 the user's
address book is searched. ldap new in thunderbird 25 requires seamonkey 2.22 the user's ldap directory is searched. autocompletesearchparam new in thunderbird 2 requires seamonkey 1.1 type: string a string which is passed to the search component. completedefaultindex new in thunderb...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. disablekeynavigation type: boolean if this attribute is not used, the user can navigate to specific items within the element by pressing keys corresponding to letters in the item's label. this is done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. note: for seamonkey 2.0 and all ve...
...e. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2.0 a zero value will always open the popup. this can be used to display
additional items that are not autocomplete results. nomatch type: boolean this attribute will be set to true if the last search resulted in no matches. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox whe...
...And 2 more matches
Things I've tried to do with XUL - Archive of obsolete content
this is a grab-bag type of faq, with a list of things that should work (hopefully with bug numbers), things that don't work (hopefully with explanations), and workarounds for both of the above. feel free to
add your own xul experiences here. how do i use percentage-based height/width with xul? short answer: you can't easily, at least not yet. this means that creating any sort of visual display (not necessarily "ui"; my use case is for creating a calendar time display) that sizes sanely when the user resizes the window is unfortunately very difficult. (to
add insult, xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue inside b...
...: 100%; height: 100%;"> <box style="height: 30%" flex="1" style="background: green;"/> <box style="height: 20%" flex="1" style="background: green;"/> <box style="height: 50%" flex="1" style="background: green;"/> </html:div> using flex="3" flex="2" flex="5" would give the right display visually for the empty boxes; however, flex only applies to how empty space is allocated. so, as soon as you
add a label or some other element inside, there will be a different amount of "empty space" to allocate in different boxes. enn: percentages won't have any effect in these examples though, since the actual height of the container isn't known, and 30% of an unknown number is still an unknown number. vlad: sure; the snippets assume that there's some enclosing structure that will provide the actual hei...
...ig bug there: if you create from js an element you want to bind, and if it is hidden when the listbox is first rendered, the listbox does not create a frame for it, and the xbl doesn't get attached... a workaround for that is to create the element, insert it in the document and set its style attribute with a -moz-binding property, all of that from c++ instead of js. multi-column listboxes when
adding items to multi-column listboxes, you can't use the appenditem api: // auto-create and attach 1st cell var row = mylistbox.appenditem( label, value ); // create and attach 2nd cell var cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ... while this works at first, after a number of rows have...
...And 2 more matches
Creating an Installer - Archive of obsolete content
des 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 xpinstall (cross platform install). xpinstall installers are packaged into jar files. inside the jar file, you can
add all the various files that you want to have installed. in
addition, installers should contain an install script (a file named install.js) which can be used to script the installation process. this script has access to various install functions which can be used to install files and components. the jar file installers typically have the extension .xpi (pronounced zippy) to distinguish them from o...
...if you are installing multiple components. the second argument is a result code. if the result is 0, the installation completed successfully. if the result is non-zero, an error occured and the value is an error code. the function donefn() here just displays an alert box to the user. next, we create an array xpi which will hold the name (calendar) and url (calendar.xpi) of the installer. you can
add an
additional similar such line for each package you wish to have installed. finally, we call the install function. when this section of script is executed, the file calendar.xpi will be installed. our find files example let's try this with the find files dialog. function donefn ( name , result ){ if (result) alert("an error occured: " + result); } var xpi = new object(); xpi["find files"...
...they do not have to be. for chrome files, they might be structured like the chrome directory. often, the only files placed in an xpi archive will be the install script (install.js) and a jar file. this jar file contains all of the files used by your application. the components provided with mozilla are stored in this manner. ...
...And 2 more matches
Groupboxes - Archive of obsolete content
ption value="banana"/> <description value="tangerine"/> <description value="phone booth"/> <description value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed surrounded by a box with the label answer. note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. more complex captions you can also
add child elements inside the caption element to create a more complex caption. for example, mozilla's font preferences panel uses a drop-down menu as a caption. although any content can be used, usually you would use a checkbox or dropdown menu. example 2 : source view <groupbox flex="1"> <caption> <checkbox label="enable backups"/> </caption> <hbox> <label control="dir" value="dir...
...x label="compress archived files"/> </groupbox> in this example, a checkbox has been used as a caption. we might use a script to enable and disable the contents of the groupbox when the checkbox is checked and unchecked. the groupbox contains a horizontal box with a label and textbox. both the textbox and groupbox have been made flexible so the textbox expands when the window is expanded. the
additional checkbox appears below the textbox because of the vertical orientation of the groupbox. we'll
add a groupbox to the find files dialog in the next section. radio groups you can use the radiogroup element to group radio elements together. the radiogroup is a type of box. you can put any element you want inside it, and apart from its special handling of radio buttons, it works like any other ...
...og in the next section. radio groups you can use the radiogroup element to group radio elements together. the radiogroup is a type of box. you can put any element you want inside it, and apart from its special handling of radio buttons, it works like any other box. any radio buttons placed inside the radio group will be grouped together, even if they are inside nested boxes. ...
...And 2 more matches
Localization - Archive of obsolete content
es dialog, we will need a file called findfile.dtd. for non-installed chrome files, you can just put the dtd file in the same directory as the xul file. note: you should encode dtd files as utf-8 for non-ascii characters. that is, you should save them in utf-8 format (without bom). for more information, see mozilla language packs. once you have created a dtd file for your xul, you will need to
add a line to the xul file which indicates that you want to use the dtd file. otherwise, errors will occur as it won't be able to find the entities. to do this,
add a line of the following form somewhere near the top of the xul file: <!doctype window system "chrome://findfile/locale/findfile.dtd"> this line specifies that the url indicated is to be used as a dtd for the file. in this case, we have...
...ntities. to do this,
add a line of the following form somewhere near the top of the xul file: <!doctype window system "chrome://findfile/locale/findfile.dtd"> this line specifies that the url indicated is to be used as a dtd for the file. in this case, we have declared that we want to use the findfile.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 wherever the text "&findlabel;" appears in the xul file, it will be replaced with the text "find". note th...
...for japanese: <!entity findlabel "検索"> for example, the following text: <description value="&findlabel;"/> is translated as: english version: <description value="find"/> japanese version: <description value="検索"/> you would declare an entity for each label or string of text that you use in your interface. you should not have any directly displayed text in the xul file at all. in
addition to using entities for text labels, you should use them for any value that could be different in a different language. access keys and keyboard shortcuts for example. xul <menuitem label="&undo.label;" accesskey="&undo.key;"/> dtd <!entity undo.label "undo"> <!entity undo.key "u"> the example above uses two entities, one for the label on the undo menu item and the second for the acce...
...And 2 more matches
Manipulating Lists - Archive of obsolete content
anipulated 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. here is an example: example 1 : source view <script> function
additem(){ document.getelementbyid('thelist').appenditem("thursday", "thu"); } </script> <listbox id="thelist"/> <button label="
add" oncommand="
additem();"/> the appenditem() takes two arguments, the label, in this case 'thursday', and a value 'thu'. the two arguments correspond to the label attribute ...
...item element. the value is used only as an extra optional value associated with an item which you might wish to use in a script. similarly, there is also an insertitemat() and 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 previously 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 element...
...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 methods. this includes the menulist, radiogroup and tabs elements. for example, to
add a new item to a menulist, you can use the same syntax as for a listbox. the right kind of element will be appended in each situation. list selection the nsidomxulselectcontrolelement interface provides two
additonal properties, selectedindex and selecteditem. the former returns the index of the selected item while the latter returns the selected element. for instance the selecteditem of a menul...
...And 2 more matches
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. ...
...com/nc-rdf#date"/> </treerow> </treeitem> </treechildren> </rule> </template> </tree> other datasources the tables below list some of the other datasources available with mozilla. you can use any of the resources that you want. bookmarks (rdf:bookmarks) the bookmarks are generated from the user's bookmark list. ...
... </treechildren> </rule> </template> </tree> other datasources the tables below list some of the other datasources available with mozilla. you can use any of the resources that you want. bookmarks (rdf:bookmarks) the bookmarks are generated from the user's bookmark list. ...
...And 2 more matches
Skinning XUL Files by Hand - Archive of obsolete content
themselves appear, and other esoteric variables. if you create a style in your custom stylesheet for a button with a particular id, for example, some of the more basic style information for buttons in the global skin may take precedence over your new style and cause it not to be applied. make sure you are aware of the way that the global skin defines the skin and which elements, in general, it is
addressing. since the purpose of the global skin is to create a look for the entire application or chrome that can be changed dynamically, you should not create style information in a custom css file that controverts the global skin unless you really mean to. if your xul file is to be a part of a larger application that can be skinned, like mozilla, you probably want your xul file to pick up the glo...
...the following table shows the basic format for these two common types of style definitions: class id element.class { attribute: value; } element#id { attribute: value; } menu.baseline { border: 0px; font-size: 9pt;...
...ot itself hierarchical, as you saw in the global skin. instead, a css file is usually simply a list of style definitions that are applied to their respective elements and classes by the rendering engine. here is a very short (but complete!) cascading stylesheet that might be referenced and used by a xul file: toolbar.nav-bar { background-image: url("chrome://navigator/skin/navbar-bg.gif"); p
adding: 0px; p
adding-bottom: 2px; } box#navbar { background-color: lightblue; } a:link { color: #fa8072; } this stylesheet exhibits three of the different types of style definitions described above. each type uses a different grouping of elements. in the first definition, the selector "toolbar.nav-bar" is used to define style information for all xul toolbars of the class "nav-bar." unlike a...
...And 2 more matches
Stacks and Decks - Archive of obsolete content
sed 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. a scroll bar is just a special type of box that creates its own elements if you don't provide them. it also handles the moving of the scroll bar thumb. in the next few sections, we'll introduce some elements that are designed for holding other eleme...
... in a stack. the orient property has little meaning on a stack as children are laid out above each other rather than from side to side. the size of the stack is determined by its largest child, but you can use the css properties width, height, min-width and other related properties on both the stack and its children. the stack element might be used for cases where a status indicator needs to be
added over an existing element. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description ...
...nt. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description value="shadowed" style="p
adding-left: 1px; p
adding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points. the first, however is offset one pixel to the right and down by
adding a p
adding to its left and top sides. this has the result of drawing the same text 'shadowed' again but slightly offset from the o...
...And 2 more matches
XBL Inheritance - Archive of obsolete content
existing xbl definitions. 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. ...
... 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. for example, the following binding creates a textbox which
adds the text 'http://www' to the beginning of its value when the f4 key is pressed. example 1 : source <binding id="textboxwithhttp" ext...
...tent/bindings/textbox.xml#textbox"> <handlers> <handler event="keypress" keycode="vk_f4"> this.value="http://www"+value; </handler> </handlers> </binding> the xbl here extends from the xul textbox element. the url given in the extends attribute above is the url of the textbox binding. this means that we inherit all of the content and behavior provided by the textbox binding. in
addition, we
add a handler which responds to the keypress event. autocompleting textboxes the example above is similar to how the url autocomplete feature works in mozilla. a textbox that supports autocomplete is just one with a xbl binding that extends the basic textbox. the autocomplete textbox
adds extra event handling so that when a url is typed, a menu will pop up with possible completions. you ...
...And 2 more matches
XUL Event Propagation - Archive of obsolete content
s. in the diagram above, the alert dialog invoked by the menuitem itself is not displayed, since the root window element has used event capture to handle the event itself. ...
...register a box element to capture all the click events that are raised from its child elements: var bbox = document.getelementbyid("bigbox"); if (bbox) bbox.
addeventlistener("click", function() { alert('captured'); }, true); ... <box id="bigbox"> <menu value="file"> <menupopup> <menuitem value="new" onclick="alert('not captured')" /> ... <menupopup> </menu> </box>
adding an event listener in order to take advantage of event capturing (or event bubbling with elements that do not already have event listeners), you must
add an event listener to the element that wants to capture events taking place below it. any xul element may use the dom
addeventlistener method to register itself to capture events. the syntax for this in xul is as follows: element = document.g...
...ntage of event capturing (or event bubbling with elements that do not already have event listeners), you must
add an event listener to the element that wants to capture events taking place below it. any xul element may use the dom
addeventlistener method to register itself to capture events. the syntax for this in xul is as follows: element = document.getelementbyid("id of the element"); element.
addeventlistener(event name, event handler function, whether to register a capturing listener); the event handler code argument can be in-line code or a function. ...
...And 2 more matches
button - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } 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 el...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. dlgtype type: one of the values below the dialog type of the button, used only when the button is in a dialog box. you can use this feature to replace the standard dialog box buttons with custom buttons, yet the dialog event methods will still function. for example, if the dlgtype is set to accept, the button will replace the dialog box's accept button, which is usually l...
...a dialog box has no effect. the following values can be used as the dialog type: accept the ok button, which will accept the changes when pressed. cancel the cancel button which will cancel the operation. help a help button for displaying help about the dialog. disclosure a button to show more information. this might be a button or a disclosure triangle. extra1 an optional
additional button. extra2 a second optional
additional button. group type: string group name buttons with type="radio" and the same value for their group attribute are put into the same group. only one button from each group can be checked at a time. if the user selects one the buttons, the others in the group are unchecked. icon mozilla 1.8 type: string this attribute sho...
...And 2 more matches
datepicker - Archive of obsolete content
me [ examples | attributes | properties | methods | related ] a datepicker allows the user to enter a date. three types are available, which can be specified using the type attribute. normal - a datepicker with three fields for entering the year, month and date. grid - a datepicker with a calendar grid for selecting a date. popup - a normal datepicker with three fields, but with an
additional dropdown button to display a popup grid. there are several ways to set the selected day. in xul, the value attribute may be set to a value of the form yyyy-mm-dd to initialize the datepicker to a certain date. if not specified, the datepicker defaults to the current day. to change the selected date, the value property may be used to set a new value in the form yyyy-mm-dd. the datevalue ...
...to set the selected day. in xul, the value attribute may be set to a value of the form yyyy-mm-dd to initialize the datepicker to a certain date. if not specified, the datepicker defaults to the current day. to change the selected date, the value property may be used to set a new value in the form yyyy-mm-dd. the datevalue property may be used to retrieve and set the date using a date object. in
addition, the date, month and year properties may be used to retrieve and modify each component of the date separately. !!attention: there is also a datepicker in tb-calendar with differing definitions for members (value is a date there) the change event is fired whenever the date is changed. however, as described in mozilla bug #799219, a change event handler may encounter erratic behavior when th...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. firstdayofweek type: integer which day of the week to display as the first day in the grid. the values range from 0 to 6, where 0 is sunday and 6 is saturday. the default value is determined by the locale, so only use this attribute if you want to override it. readonly type: boolean if set to true, then the user cannot change the value of the element. however, th...
...And 2 more matches
scrollbox - Archive of obsolete content
this may also be used with any other container element. examples the following shows the xul for a bunch of labels. they come out in a box. ...
...this may also be used with any other container element. examples the following shows the xul for a bunch of labels. they come out in a box. ...
...e="06 that all men are created equal."/> </vbox> the next bunch of labels is similar, but if the container doesn't give enough room for it, scroll bars will sprout out of nowhere and allow the user to scroll around the big content in the small view space. for the most part, the horizontal and vertical scrollbars will independently handle too-tall and too-wide cases, but each scroll bar takes up
additional width and so the appearance of one scroll bar can trigger the other one if it's close to the edge anyway. use overflow:scroll if you want the scroll bars on all the time. <vbox flex="1" style="overflow:auto"> <label value="01 four score and seven years ago "/> <label value="02 our fathers brought forth on "/> <label value="03 this continent, a new nation, "/> <label value="04 conc...
...And 2 more matches
tabs - Archive of obsolete content
activating them will not change the selectedindex. more information is available in the xul tutorial. ...
... methods advanceselectedtab, appenditem, getindexofitem, getitematindex, insertitemat, removeitemat examples (example needed) attributes closebutton obsolete since gecko 1.9.2 type: boolean if this attribute is set to true, the tabs row will have a "new tab" button and "close" button on the ends. this feature is used by the tabbrowser to provide the facilities for
adding and closing tabs. you can set an image to the "new tab" and "close" buttons by applying them to the tabs-newbutton and tabs-closebutton classes respectively. disableclose type: boolean if this attribute is true the close button will be disabled. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. onclosetab type: script code this script will be called when the close tab button is clicked. onnewtab not in firefox type: script code this script will be called when the new tab button is clicked. onselect type: script code this event is sent to the tabs element when this tab is changed. selectedindex type: integer gets and sets the index of...
...And 2 more matches
textbox - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. focused type: boolean this attribute is true if the element is focused. emptytext deprecated since gecko 2 type: string a string that appears in the textbox when it has no value. this is superseded by the placeholder attribute in gecko 2.0. the old name is retained for compatibility, but you should update your code. hidespinbuttons type: boolean if true, t...
...to textboxes with the type search. size type: integer the number of characters that can be displayed in the textbox. spellcheck type: boolean if true, spell checking is enabled by default for the text box; if false, spell checking is disabled by default. ...
...am some content</div> <!-- spellcheck nothing! --> <input type="text" spellcheck="false" /><br /> <textarea spellcheck="false"></textarea> <div contenteditable="true" spellcheck="false">i am some content</div> you can use spellcheck on input, textarea, and contenteditable elements. thespellcheck attribute works well paired with the autocomplete, autocapitalize, and autocorrect attributes too!
added from david walsh's article on spell check. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. timeout type: integer for autocomplete textboxes, the number of milliseconds before the textbox starts searching for completions. ...
...And 2 more matches
CommandLine - Archive of obsolete content
the sake of simplicity, the proposed solution involves the observer service to notify observers that the updated arguments are available. a similar and better way to implement this solution is by defining argument specific handlers with registering and unregistering functions in your command line handler service. this has the advantage to accumulate unhandled arguments until a specific handler is
added. this approach has been used in songbird. example notice the changes since gecko 2.0 (component registration has moved into the manifest file). define your own command line handler component: components/clh.js const nsisupports = components.interfaces.nsisupports; const nsicategorymanager = components.interfaces.nsicategorymanager; const nsicomponentregistrar = compon...
...od_regself(acompmgr, afilespec, alocation, atype) { var compreg = acompmgr.queryinterface(nsicomponentregistrar); compreg.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.
addcategoryentry("command-line-handler", cld_category, contract_id, true, true); }, unregisterself : function mod_unreg(acompmgr, alocation, atype) { var compreg = acompmgr.queryinterface(nsicomponentregistrar); compreg.unregisterfactorylocation(class_id, alocation); var catman = components.classes["@mozilla.org/categorymanager;1"] ...
...ta) { var cmdline = asubject.queryinterface(components.interfaces.nsicommandline); var test = cmdline.handleflagwithparam("test", false); alert("test = " + test); }, register: function() { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.
addobserver(this, "commandline-args-changed", false); }, unregister: function() { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "commandline-args-changed"); } } var observer = new commandlineobserver(); // because we haven't ye...
...And 2 more matches
Gecko Compatibility Handbook - Archive of obsolete content
e earlier, non-standards based browsers differed in several ways from gecko: these browsers use proprietary (non-standard) html, css, and javascript. internet explorer 4 and netscape navigator 4 share support for a large part of the html 3.2 standard and basic javascript. while they support the css 1 standard to some degree, the implementations are not complete and have non-standard features
added. neither internet explorer 4 or netscape navigator 4 support the w3 dom. instead, each browser supports its own proprietary api for manipulating the content, style and position of html elements in a web page. in
addition, internet explorer 4 and netscape navigator 4 use completely different methods of embedding third-party software into the browser. gecko is a cross-platform browser engine,...
...g user-agent detection, you can install an extension in firefox or mozilla which allows you to "spoof" the user-agent strings of the various gecko browsers. here's how: launch mozilla or firefox. the benefit of using these browsers is that if you're only detecting netscape or netscape6 you'll see the issues right away. install the user agent switcher extension. after restarting your browser,
add the the user-agent strings that you want to test to the list (tools | user agent switcher | options | options... | user agents |
add...). once you filled the dialog box (it should look like the screenshot below), click 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 ve...
...ss names as case insensitive while gecko treats them correctly as case sensitive. inconsistent case between the css defining the style for html id's and classes results in gecko browsers not applying the styles to id's or class names that differ in case. internet explorer incorrectly specifies height and width of inline elements such as span. internet explorer implements the box model (p
adding, margins, borders) incorrectly. do not use internet explorer's invalid implementation of css. use only the cross-browser, standards conformant features of css. use consistent case when writing html id and class name attributes and css styles for those ids and classes. do not specify heights or widths on inline elements such as spans. use only cross-browser box specificat...
...And 2 more matches
Mozilla release FAQ - Archive of obsolete content
between netscape (aol) and the mozilla project is that mozilla develops its own releases, and when netscape (aol) is preparing to make a release, it takes the current version of mozilla, makes modifications, and does its own qa. in return for this, netscape (aol) contributes developers to work on the project. the netscape versions may have a different look/feel than mozilla versions, and also may
add proprietary features. the netscape versions are all branded as netscape (aol) products. what resources are available to the mozilla community? webpages mozilla project homepage netscape developer program website mozillazine (news service) mozilla evangelism effort mozdev projects irc server: irc.mozilla.org channel #mozillazine note that recent versions of mozilla include an ir...
...est source from mozilla. i made a patch! how do i submit it? the current best way to do this is to post it in bugzilla, either attached to the bug it fixes or a new entry describing what it changes. if that doesn't work, it also could be posted in diff format in the newsgroup. netscape.public.mozilla.patches note that context-sensitive patches (diff -c) are preferred over other formats. i want to
add x feature to mozilla. who do i contact? first, you should make sure that mozilla doesn't already have the feature you wish to
add. there have been changes since communicator 4.0. check out section 3 for details. assured that it's not already there, you should post to the mozilla usenet groups, asking for help. finally, you should make sure that someone is not already working on the code you would...
...e, but that it will be difficult. how to help what projects are there for programmers? this project is largely about coding. you could tackle: porting mozilla to the os you use work on moving #ifdef platform to #ifdef feature/bug if you're on unix, port mozilla to the toolkit you prefer modularize/clean up apis fix bugs work on the expermental features (mail/news, aurora, nglayout)
add new things: make opendoc and ole nglayout controls write new skins (see themes.org)
add preference interfaces for the hidden features there's plenty to do.. what subprojects are there for documentation people? mozilla currently has far more developers than documenters. as a result, the project is in dire need of documentation work. maintenance of old documentation w...
...And 2 more matches
2006-10-20 - Archive of obsolete content
to his original post and expanded on the original content of his question. marcus claims that when he builds firefox using centos he encounters crashes (segmentation faults) under linux distributions such as gentoo, suse and fedora. he also points out that when he performs a local build any of those platforms (gentoo, suse and fedora) he doesn't encounter any problems on the same machine.
adding extension to extensions/ folder originally posted on oct 19th: christopher finke is currently learning how to compile firefox. though he has succeeded in building firefox he has so far failed to compile firefox with his own extensions of choice so that his custom build would have those extensions enabled in the end product. christopher finke is asking the community members for tutorials or ...
...for tutorials or any tips on how to get started. on october 20th christopher finke responded to his original post. he stated that he was able to pre-package the extensions that he wanted by following this walkthrough and a little bit of help from this post. christopher would not like to learn how to create a build of firefox with custom extensions and not have those extensions appear in the
addons window. on october 20th jeff walden responded christopher finke's question. jeff provided this link as an answer to christopher finkes' question. nsis and my extension jan vávra is wondering how he could create a win32 installer of thunderbird that when executed, it would also install his extensions of choice. he has already "studied" the makefiles but has had no success in achie...
.... nsis and my extension jan vávra is wondering how he could create a win32 installer of thunderbird that when executed, it would also install his extensions of choice. he has already "studied" the makefiles but has had no success in achieving his goal. on october 20th benjamin smedberg responded jan vávra's question. benjamin smedberg mentioned in his post that jan vávra needs to
add the extension files to the packaging manifest, which is used to create the installer. in jan vávra's case he is modifying the thunderbird installer so he needs to modify "mail/installer/windows/packages-static" announcements decommissioning sparky on friday on october 17th j. paul reed announced that: sparky, the linux performance test machine for the 1.8 branchs, is being decommissioned...
...And 2 more matches
ECMAScript 2015 support in Mozilla - Archive of obsolete content
bug fixing period. finally, ecma-262 edition 6 got officially approved and published as a standard on june 17, 2015 by the ecma general assembly. it will also appear as the international industry standard iso/iec 16262:2016. a pdf and html version of the standard can be freely downloaded on ecma-international.org. a channel for feedback on ecmascript standards is es-discuss. ...
...r argument: new map(null) (firefox 37) monkey-patched set() in constructor (firefox 37) get map[@@species] (firefox 41) set (firefox 13) set iteration with for...of (firefox 17) set.prototype.foreach() (firefox 25) set.prototype.entries(), set.prototype.keys(), set.prototype.values() (firefox 24) constructor argument: new set(null) (firefox 37) monkey-patched
add() in constructor (firefox 37) get set[@@species] (firefox 41) weakmap (firefox 6) weakmap.clear() (firefox 20) optional iterable argument in weakmap constructor (firefox 36) constructor argument: new weakmap(null) (firefox 37) monkey-patched set() in constructor (firefox 37) weakset (firefox 34) constructor argument: new weakset(null) (firefox 37) monkey-pat...
... constructor (firefox 37) get set[@@species] (firefox 41) weakmap (firefox 6) weakmap.clear() (firefox 20) optional iterable argument in weakmap constructor (firefox 36) constructor argument: new weakmap(null) (firefox 37) monkey-patched set() in constructor (firefox 37) weakset (firefox 34) constructor argument: new weakset(null) (firefox 37) monkey-patched
add() in constructor (firefox 37) new math functions math.imul() (firefox 20) math.clz32() (firefox 31) math.fround() (firefox 26) math.log10(), math.log2(), math.log1p(), math.expm1(), math.cosh(), math.sinh(), math.tanh(), math.acosh(), math.asinh(), math.atanh(), math.hypot(), math.trunc(), math.sign(), math.cbrt() (firefox 25)
additions to the number object number.isnan() (firef...
...And 2 more matches
Describing microformats in JavaScript - Archive of obsolete content
ng the name of the microformat's class as referenced in html (class="classname"). required an array indicating the names of any properties that must be specified. this may be left out if all properties are optional. properties a structure describing the properties of the microformat. property specifications each property in the properties structure is specified by its name, and may include
additional attributes if the property so requires. standard attributes are: plural a boolean value indicating that, if true indicates that the property can have multiple values. if a property is plural, it is returned as an array. virtual a boolean value indicating whether or not the property is virtual. if it's virtual, the virtualgetter() method will be called to attempt to create the propert...
...to get a virtual property's value. this is only used if virtual is true. value the property's default value. subproperties it's possible for a property to itself include more properties; to do so, include them in a subproperties structure within the property. datatype the type of data contained by the property. possible values are: datetime an iso date anyuri a uri email an email
address tel a telephone number html html including tags float a floating-point number microformat a microformat microformat_property a specific property within the microformat specified by microformat. custom custom data a simple example the hcard microformat for defining contact information makes use of the adr microformat to define an
address. the adr microformat is defined as follow...
...d microformat for defining contact information makes use of the adr microformat to define an
address. the adr microformat is defined as follows: var adr_definition = { mfversion: 0.8, mfobject: adr, classname: "adr", properties: { "type" : { plural: true, types: ["work", "home", "pref", "postal", "dom", "intl", "parcel"] }, "post-office-box" : { }, "street-
address" : { plural: true }, "extended-
address" : { }, "locality" : { }, "region" : { }, "postal-code" : { }, "country-name" : { } } }; the properties are quite simple here. the type property indicates the type of
address represented by the object (work, home, and so forth). since the plural property is true, multiple types can be specified. this ...
...And 2 more matches
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
racks. this gives us 4 column lines and 3 row lines. * {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; p
adding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px 100px; } lines can be
addressed using their line number. in a left-to-right language such as english, column line 1 will be on the left of ...
...rs respect the writing mode of the document and so in a right-to-left language for example, column line 1 will be on the right of the grid. the image below shows the line numbers of the grid, assuming the language is left-to-right. lines are also created in the implicit grid when implicit tracks are created to hold content positioned outside of the explicit grid, however these lines cannot be
addressed by a number. placing items onto the grid by line number having created a grid, you can place items onto the grid by line number. in the following example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display:...
...to column line 3, and from row line 1 to row line 3. ...
...And 2 more matches
CSS and JavaScript accessibility best practices - Learn web development
lists should look like lists. your text color should contrast well with your background color. see html text fundamentals and styling text for more information. emphasised text inline markup that confers specific emphasis to the text that it wraps: <p>the water is <em>very hot</em>.</p> <p>water droplets collecting on surfaces 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. abbreviations an element that allows an abbreviation, acronym, or ini...
... a:hover, a:visited, a:focus { color: #a60000; text-decoration: none; } a:active { color: #000000; background-color: #a60000; } the standard link conventions are underlined and a different color (default: blue) in their standard state, another color variation when the link has previously been visited (default: purple), and yet another color when the link is activated (default: red). in
addition, the mouse pointer changes to a pointer icon when links are moused over, and the link receives a highlight when focused (e.g. via tabbing) or activated. the following image shows the highlight in both firefox (a dotted outline) and chrome (a blue outline): you can be creative with link styles, as long as you keep giving users feedback when they interact with the links. something should ...
...unless of course, there is a good reason why you want this content to be hidden from screen readers. note: invisible content just for screen reader users has a lot more useful detail surrounding this topic. accept that users can override styles accept that users can override your styles it is possible for users to override your styles with their own custom styles, for example: see sarah m
addox's how to use a custom style sheet (css) with firefox for a useful guide covering how to do this manually in firefox, and how to use a custom style sheet (css) with internet explorer by adrian gordon for the equivalent ie instructions. it is probably easier to do it using an extension, for example the stylish extension is available for firefox, safari, opera, and chrome. users might do this f...
...And 2 more matches
Fundamental CSS comprehension - Learn web development
nd image files. call it something really imaginative like style.css. link your css to your html file via a <link> element. the first two rulesets in the css resource file are yours, for free! after you've finished rejoicing at your good fortune, copy and paste them into the top of your new css file. use them as a test to make sure your css is properly applied to your html. ...
...the css resource file are yours, for free! after you've finished rejoicing at your good fortune, copy and paste them into the top of your new css file. use them as a test to make sure your css is properly applied to your html. above the two rules,
add a css comment with some text inside it to indicate that this is a set of general styles for the overall page. "general page styles" would do. also
add three more comments at the bottom of the css file to indicate styles specific to the setup of the card container, styles specific to the header and footer, and styles specific to the main business card contents. from now on, subsequent styles
added to the stylesheet should be organized in an appropriate place. taking care of the selectors and rulesets provided in the css resource file: next ...
...rovided in the css resource file: next up, we'd like you to look at the four selectors, and calculate the specificity for each one. write these down somewhere where they can be found later on, such as in a comment at the top of your css. now it's time to put the right selector on the right rule set! you've got four pairs of selector and ruleset to match in your css resources. do this now, and
add them to your css file. you need to: give the main card container a fixed width/height, solid background color, border, and border-radius (rounded corners!), amongst other things. give the header a background gradient that goes from darker to lighter, plus rounded corners that fit in with the rounded corners set on the main card container. give the footer a background gradient that goe...
...And 2 more matches
Type, class, and ID selectors - Learn web development
n 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. all instances of <span>, <em> and <strong> elements are therefore styled accordingly. try
adding a css rule to select the <h1> element and change its color to blue. the universal selector the universal selector is indicated by an asterisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). in the following example we have used the universal selector to remove the margins on all elem...
...its color to blue. the universal selector the universal selector is indicated by an asterisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). in the following example we have used the universal selector to remove the margins on all elements. this means that instead of the default styling
added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. this kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. ...
... bold, i could use the :first-child selector, which we will learn more about in the lesson on pseudo-classes and pseudo-elements, as a descendant selector along with the <article> element selector: article :first-child { } this could be confused however with article:first-child, which will select any <article> element that is the first child of another element. to avoid this confusion we can
add the universal selector to the :first-child selector, so it is obvious what the selector is doing. it is selecting any element which is the first-child of any descendant element of <article>: article *:first-child { } although both do the same thing, the readability is significantly improved. class selectors the class selector starts with a full stop (.) character and will select everything ...
...And 2 more matches
Sizing items in CSS - Learn web development
is described as the intrinsic size — which comes from the image itself. if you place an image on a page and do not change its height and width, either using attributes on the <img> tag or css, it will be displayed using that intrinsic size. we have given the image in the example below a border so that you can see the extent of the file. an empty <div> however, has no size of its own. if you
add a <div> to your html with no content, then give it a border as we did with the image, you will see a line on the page. this is the collapsed border on the element — there is no content to hold it open. in our example below, that border stretches to the width of the container, because it is a block level element, a behavior that should be starting to become familiar to you. it has no height (or ...
...you will see a line on the page. this is the collapsed border on the element — there is no content to hold it open. in our example below, that border stretches to the width of the container, because it is a block level element, a behavior that should be starting to become familiar to you. it has no height (or size in the block dimension) because there is no content. in the example above, try
adding some text inside the empty element. the border now contains that text because the height of the element is defined by the content. therefore the size of this <div> in the block dimension comes from the size of the content. again, this is the intrinsic size of the element — its size is defined by its content. setting a specific size we can of course give elements in our design a specific si...
...box a percentage width it will be a percentage of the width of the parent container. this is because percentages resolve against the size of the containing block. with no percentage applied our <div> would take up 100% of the available space, as it is a block level element. if we give it a percentage width, this becomes a percentage of the space it would normally fill. percentage margins and p
adding if you set margins and p
adding as a percentage, you may notice some strange behavior. in the below example we have a box. we have given the inner box a margin of 10% and a p
adding of 10%. the p
adding and margin on the top and bottom of the box are the same size as the margin on the left and right. you might expect for example the percentage top and bottom margins to be a percentage of the ...
...And 2 more matches
Responsive design - Learn web development
the responsive design mode in firefox devtools. as the mobile web started to become a reality with the first feature phones, companies who wished to embrace mobile would generally create a special mobile version of their site, with a different url (often something like m.example.com, or example.mobi). this meant that two separate versions of the site had to be developed and kept up-to-date. in
addition, these mobile sites often offered a very cut down experience. as mobile devices became more powerful and able to display full websites, this was frustrating to mobile users who found themselves trapped in the site's mobile version and unable to access information they knew was on the full-featured desktop version of the site. flexible layout before responsive design a number of approaches ...
...tely for the user's needs. for example, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the viewport is at least 800 pixels wide. the css for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em; } } you can
add multiple media queries within a stylesheet, tweaking your whole layout or parts of it to best suit the various screen sizes. the points at which a media query is introduced, and the layout changed, are known as breakpoints. a common approach when using media queries is to create a simple single-column layout for narrow-screen devices (e.g mobile phones), then check for larger screens and impleme...
...e built on flexible grids. a flexible grid means that you don't need to target every possible device size that there is, and build a pixel perfect layout for it. that approach would be impossible given the vast number of differently-sized devices that exist, and the fact that on desktop at least, people do not always have their browser window maximized. by using a flexible grid, you only need to
add in a breakpoint and change the design at the point where the content starts to look bad. for example, if the line lengths become unreadably long as the screen size increases, or a box becomes squashed with two words on each line as it narrows. in the early days of responsive design, our only option for performing layout was to use floats. flexible floated layouts were achieved by giving each ele...
...And 2 more matches
What are browser developer tools? - Learn web development
ols ➤ developer tools safari: develop ➤ show web inspector. if you can't see the develop menu, go to safari ➤ preferences ➤ advanced, and check the show develop menu in menu bar checkbox. opera: developer ➤ developer tools context menu: press-and-hold/right-click an item on a webpage (ctrl-click on the mac), and choose inspect element from the context menu that appears. (an
added bonus: this method straight-away highlights the code of the element you right-clicked.) the inspector: dom explorer and css editor the developer tools usually open by default to the inspector, which looks something like the following screenshot. this tool shows what the html on your page looks like at runtime, as well as what css is applied to each element on the page. it also allows you t...
...ing else to appear in the window. press the style button to see the css. exploring the dom inspector for a start, right-click (ctrl-click) an html element in the dom inspector and look at the context menu. the available menu options vary among browsers, but the important ones are mostly the same: delete node (sometimes delete element). deletes the current element. edit as html (sometimes
add attribute/edit text). lets you change the html and see the results on the fly. very useful for debugging and testing. :hover/:active/:focus. forces element states to be toggled on, so you can see what their styling would look like. copy/copy as html. copy the currently selected html. some browsers also have copy css path and copy xpath available, to allow you to copy the css selector or xpath ...
...ly new declaration for your page. you'll notice a number of clickable tabs at the top of the css viewer: computed: this shows the computed styles for the currently selected element (the final, normalized values that the browser applies). layout: in firefox, this area includes two sections: box model: represents visually the current element's box model, so you can see at a glance what p
adding, border and margin is applied to it, and how big its content is. grid: if the page you are inspecting uses css grid, this section allows you to view the grid details. fonts: in firefox, the fonts tab shows the fonts applied to the current element. find out more find more out about the inspector in different browsers: firefox page inspector ie dom explorer chrome dom inspector ...
...And 2 more matches
Test your skills: Form validation - Learn web development
n article. note: you can try out solutions locally, however it may be helpful to put your code in 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. form validation 1 in this task, we are providing you with a simple support query form, and we want you to
add some validation features to it: make all of the input fields mandatory to complete before the form can be submitted. change the type of the "email
address" and "phone number" fields to make the browser apply some more specific validation suitable for the data being asked for. give the "user name" field a required length of between 5 and 20 characters, the "phone number" field a maximum lengt...
...le for the data being asked for. give the "user name" field a required length of between 5 and 20 characters, the "phone number" field a maximum length of 15 characters, and the "comment" field a maximum length of 200 characters. try submitting 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 previous task (use your previous answer if you want to), and
add some more specific pattern validation to the first three fields using regular expressions. all o...
...2 now we want you to take the same form you saw in the previous task (use your previous 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 (lower or upper case) or numbers, followed by "@bigcorp.eu". remove the length validation from the phone number field if it is present, and set it so that it accepts 10 digits — either 10 digits in a row, or a pattern of three digits, three digits, then four digits, separated by either spaces, dashes, or dots. note: regular expressions are ...
...And 2 more matches
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. ...
...s one single piece of functionality (e.g., a mini map, or a set of article headlines and summaries). it's considered best practice to begin each section with a heading; also note that you can break <article>s up into different <section>s, or <section>s up into different <article>s, depending on the context. <aside> contains content that is not directly related to the main content but can provide
additional information indirectly related to it (glossary entries, author biography, related links, etc.). <header> represents a group of introductory content. if it is a child of <body> it defines the global header of a webpage, but if it's a child of an <article> or <section> it defines a specific header for that section (try not to confuse this with titles and headings). <nav> contains the main ...
...entity with some css or javascript. for cases like these, html provides the <div> and <span> elements. you should use these preferably with a suitable class attribute, to provide some kind of label for them so they can be easily targeted. <span> is an inline non-semantic element, which you should only use if you can't think of a better semantic text element to wrap your content, or don't want to
add any specific meaning. for example: <p>the king walked drunkenly back to his room at 01:00, the beer doing nothing to aid him as he staggered through the door <span class="editor-note">[editor's note: at this point in the play, the lights should be down low]</span>.</p> in this case, the editor's note is supposed to merely provide extra direction for the director of the play; it is not supposed ...
...And 2 more matches
Marking up a letter - Learn web development
ate document structure including doctype, and <html>, <head> and <body> elements. in general, the letter should be marked up as an organization of headings and paragraphs, with the following exception. there is one top level heading (the "re:" line) and three second level headings. use an appropriate list type to mark up the semester start dates, study subjects, and exotic dances. ...
...ture including doctype, and <html>, <head> and <body> elements. in general, the letter should be marked up as an organization of headings and paragraphs, with the following exception. there is one top level heading (the "re:" line) and three second level headings. use an appropriate list type to mark up the semester start dates, study subjects, and exotic dances. put the two
addresses inside <
address> elements. ...
...<head> and <body> elements. in general, the letter should be marked up as an organization of headings and paragraphs, with the following exception. there is one top level heading (the "re:" line) and three second level headings. use an appropriate list type to mark up the semester start dates, study subjects, and exotic dances. put the two
addresses inside <
address> elements. each line of the
address should sit on a new line, but not be in a new paragraph. inline semantics the names of the sender and receiver (and tel and email) 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 yo...
...And 2 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. ...
... use arrow functions: let hello = async () => { return "hello" }; these all do basically the same thing. to actually consume the value returned when the promise fulfills, since it is returning a promise, we could use a .then() block: hello().then((value) => console.log(value)) or even just shorthand such as hello().then(console.log) like we saw in the last article. so the async keyword is
added to functions to tell them to return a promise rather than directly returning the value. in
addition, this lets synchronous functions avoid any potential overhead that comes with running with support for using await. by only
adding the necessary handling when the function is declared async, the javascript engine can optimize your program for you. sweet! the await keyword the real advantage of ...
...e 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 previous 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 call has returned its result. once that's complete, your code continues to execute starting on the next line. for example: let response = await fetch('coffee.jpg...
...And 2 more matches
General asynchronous programming concepts - Learn web development
s an intensive chunk of code without returning control to the browser, the browser can appear to be frozen. this is called blocking; the browser is blocked from continuing to handle user input and perform other tasks until the web app returns control of the processor. let's look at a couple of examples that show what we mean by blocking. ...
... handle user input and perform other tasks until the web app returns control of the processor. let's look at a couple of examples that show what we mean by blocking. ...
...the processor. let's look at a couple of examples that show what we mean by blocking. ...
...And 2 more matches
Introducing asynchronous JavaScript - Learn web development
hronous javascript is. this section recaps some of the information we saw in the previous article. a lot of the functionality we have looked at in previous learning area modules is synchronous — you run some code, and the result is returned as soon as the browser can do so. ...
...in previous 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 paragraph.'; document.body.appendchild(pelem); }); in this block, the lines are executed one after the other: we grab a reference to a <button> element that is already available in the 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...
...rt executing code in the background. when the background code finishes running, it calls the callback function to let you know the work is done, or to let you know that something of interest has happened. using callbacks is slightly old-fashioned now, but you'll still see them in use in a number of older-but-still-commonly-used apis. ...
...And 2 more matches
Silly story generator - Learn web development
all of the code underneath the heading "1. complete variable and function definitions" and paste it into the top of the main.js file. this gives you three variables that store references to the "enter custom name" text field (customname), the "generate random story" button (randomize), and the <p> element at the bottom of the html body that the story will be copied into (story), respectively. in
addition you've got a function called randomvaluefromarray() that takes an array, and returns one of the items stored inside the array at random. now look at the second section of the raw text file — "2. raw text strings". this contains text strings that will act as input into our program. we'd like you to contain these inside variables inside main.js: store the first, big long, string of te...
.... store the second set of three strings inside an array called inserty. store the third set of three strings inside an array called insertz. placing the event handler and incomplete function: now return to the raw text file. copy the code found underneath the heading "3. event listener and partial function definition" and paste it into the bottom of your main.js file. this:
adds a click event listener to the randomize variable so that when the button it represents is clicked, the result() function is run.
adds a partially-completed result() function definiton to your code. for the remainder of the assessment, you'll be filling in lines inside this function to complete it and make it work properly. completing the result() function: create a new variable call...
...he method equal to newstory, so each time it is called, newstory is made equal to itself, but with substitutions made. so each time the button is pressed, these placeholders are each replaced with a random silly string. as a further hint, the method in question only replaces the first instance of the substring it finds, so you might need to make one of the calls twice. inside the first if block,
add another string replacement method call to replace the name 'bob' found in the newstory string with the name variable. in this block we are saying "if a value has been entered into the customname text input, replace bob in the story with that custom name." inside the second if block, we are checking to see if the uk radio button has been selected. if so, we want to convert the weight and temperat...
...And 2 more matches
Solve common problems in your JavaScript code - Learn web development
using colons, and members must be separated by commas. ...
...ed by commas. ...
... character is at a certain position in a string? how do you find and extract a specific substring from a string? how do you change the case of a string? how do you replace one specific substring with another? arrays how do you create an array? how do you access and modify the items in an array? (this includes multidimensional arrays) how do you find the length of an array? how do you
add and remove array items? how do you split a string into array items, or join array items into a string? debugging javascript what are the basic types of error? what are browser developer tools, and how do you access them? how do you log a value to the javascript console? how do you use breakpoints and other javascript debugging features? for more information on javascript debugging, see...
...And 2 more matches
Accessibility API cross-reference
used for kde accessibility via at-spi . we find that it uses very similar naming conventions as java accessibility, and for those purposes the two to be nearly the same. however, only about one third of the states and roles in sun's accessibility api's are the same as in msaa. ...
... only about one third of the states and roles in sun's accessibility api's are the same as in msaa. to do fill out mac api column.(mac os x - carbon accessibility api and accessibility constants) finish aria column -
add explanation of the term 'abstract role' fill out html column create aom column fill out xul column. ...
... feed a landmark region that contains a collection of items and objects that, as a whole, combine to create a form. form <form> presumably msaa's graphic is aria's and html's img? graphic n/a n/a img <img> a cell in a grid or treegrid. ...
...And 2 more matches
Accessibility Features in Firefox
en 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 work with ai squared, the makers of zoomtext, in order to enable complete support of advanced zoomtext features such as the doc reader and app reader. we are also optimistic that the the makers of magic and lunar/supernova will
add firefox support in the coming year. mozilla has support for dragon naturally speaking. some users of the professional version are happily playing with dragon and firefox. we are optimistic that nuance will work to improve access to the user interface in the coming year. firefox on linux currently boasts the best onscreen keyboard support in the industry via gok, the gnome onscreen keyboard. bas...
...ers by putting all of the browsed documents in one firefox application window rather than cluttering the alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. bookmarks can have a keyword assigned to them which can be typed into the
address bar to bring up the bookmark. a "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the s...
...ywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the search tool's web site. custom searches can be
added to this quick search bar and the user can switch between them by choosing from a drop down available via the standard alt+down arrow key combination. the built-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. the find bar allows for quick navigation t...
...And 2 more matches
Mozilla accessibility architecture
ic xpcom interfaces that return information about objects we want to expose. all focusable nodes, tables and text have accessibility interfaces. we call these objects "accessible nodes". each of these accessible nodes supports at minimum the generic cross-platform accessibility interface nsiaccessible (which provides a text name, enumerated role identifier and a set of state flags) and sometimes
additional interfaces. for example, tables support nsiaccessibletable, text supports nsiaccessibletext and edit boxes support nsieditabletext., although this code has been moved into the atk specific directories because it is not currently used in windows. we will not rule out the possibility of supporting some of the rich atk interfaces on windows. the toolkit-specific classes then use these xpcom i...
...a tree is a subset of the dom tree. the situation for other accessibility apis is similar. the problem is, what happens if there are dom nodes that the assistive technology vendors wants to know about, which are not exposed? also, what if they want to get dom information, like css rules, tag names and attributes, that msaa's iaccessible does not provide? on windows, we solve this by supporting an
additional interface beyond msaa's iaccesible, for every dom node. queryinterface() can be used to switch between the two interfaces. if there is no msaa node for a dom node, paccessible->queryinterface(iid_iaccessible) will return null. in
addition, some vendors had asked us to provide information and support for pieces of text smaller than a text node (i.e. a word), and mozilla supports isimpledomt...
...ld have caused a lot of difficulty when implementing the accessibility cache, the code was moved in to the "wrap" classes in a source directory specific to each toolkit. classes with "wrap" in the name, such as nstextaccessiblewrap and nsdocaccessiblewrap, inherit from cross-platform classes of similar name without "wrap" in them. they may override some methods, such as init() and shutdown(), and
add other methods to support interfaces needed only by the given toolkit. for example, nsaccessiblewrap implements the methods in iaccessible, but because it is also an nsaccessible, it only needs to call the nsiaccessible methods in "this" to get at the information it needs. class inheritence diagram view the class inheritence diagram. 3. accessible tree construction and traversal the accessible tre...
...And 2 more matches
CSUN Firefox Materials
firefox 1.5, beyond the status quo "...firefox is a great little browser. it's a quick download, occupies very little disk space, and has a clean, no-nonsense interface." - pc magazine firefox 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 attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. websites such as online magazines with sophisticated audiences are now reporting upwards of 25% firefox usage. why do the most discerning users switch to firefox? because firefox rethinks the web, and does away with many of ...
...s by putting all of the browsed documents in one firefox application window rather than cluttering the alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. bookmarks can have a keyword assigned to them which can be typed into the
address bar to bring up the bookmark. a "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the ...
...words" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the search tool's web site. custom searches can be
added to this quick search bar and the user can switch between them by choosing from a drop down available via the standard alt+down arrow key combination. the built-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. caret browsing allows you to move throu...
...And 2 more matches
Multiprocess on Windows
ed to work with 1990s-era visual basic. typelib metadata is limited to supporting the same language features which were supported by vb at that time. given those two options, it may seem that oicf is the preferred format. however, for various reasons, our com interceptor currently only supports typelib metadata. in order for the interceptor to be able to work with our interfaces, we must do some
additional work to compensate for typelib's weaknesses. the required steps are as follows: ensure that you generate typelibs for all of your com interfaces; ensure that those interfaces are registered; register any outparams that consist of arrays of interfaces. we will now further detail each of these items: generating typelibs for all com interfaces you first need to include a library stat...
...your code, as const. for example: static const mozilla::mscom::arraydata kmyarraydata[] { { // first arraydata definition }, { // second arraydata definition } }; mozilla::mscom::registerarraydata(kmyarraydata); each arraydata struct corresponds to one function; with length_is and/or size_is annotations. if your interface contains two functions with those annotations, then you will need to
add two arraydata entries. arraydata contains seven fields: iid miid; ulong mmethodindex; ulong marrayparamindex; vartype marrayparamtype; iid marrayparamiid; ulong mlengthparamindex; flag mflag; miid is the uuid of the interface owning the function. mmethodindex is the vtable index of the function within its interface. this index must take into account the vtable(s) of parent...
... it is okay to just use refptr. on the other hand, some apis in the mscom library require you to use smart pointers that are able to cross apartment boundaries. as you should already know, you can't directly touch a com object's reference count unless you're already inside the apartment which contains that object. this is a problem for smart pointers that are not apartment aware; they will try to
addref() and release() on whichever thread they happen to be running. the mscom library provides a set of smart pointers that are aware of com apartments: mscom smart pointer types pointer type release semantics stauniqueptr<t> forces reference to be released on the main thread. mtauniqueptr<t> forces reference to be released on an mta thread. proxyu...
...And 2 more matches
Frequently Asked Questions for Lightweight themes
start looking here for designs that fit 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. ...
...ight 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. you can easily preview a design and install it without needing to restart. ...
... are lightweight themes free? yes. themes are free to download and free to use. using lightweight themes how do i change my current lightweight theme? there are two easy ways to change your theme. ...
...And 2 more matches
Debugging on Windows
iables vc++ 6.0: to change or set the command line options, go to project > settings..., debug tab and select general from the drop down list. "program arguments:" should show the options. some common options would be the url of the file you want the browser to open as soon as it starts, starting the profile manager, or selecting a profile. ...
...g a profile. you can also redirect the console output to a file (by
adding "> filename.txt" for example, without the quotes). in vc 7 and 8 this option is called project > properties > debugging > command arguments. vc 8 also allows you to set environment variables there. setting breakpoints in dlls which are not yet loaded in memory vc++ 6.0: go to project > settings..., debug tab and select "
additional dlls" from the drop down list. check "locate
additional dlls" option. for each dll, click the "new" button which creates a new entry and then hit the "..." buttons which lets you browse to the dll. you will only be able to
add one dll at a time. vc++ 7.0 automatically finds
additional dlls. customizing the debugger's variable value view you can customize how visual c++ displays classes ...
...ive version of this file in progress in autoexpforvc8. avoiding stepping into certain functions you can avoid stepping into certain functions, such as nscomptr methods, using an undocumented feature of vc. see the blog post how to not step into functions using the visual c++ debugger for details. ...
...And 2 more matches
Creating Custom Events That Can Pass Data
for example, if you want firefox to perform an action whenever something happens (i.e., something other than the standard mouse/keyboard events) and, depending on the data passed along with this event, you want firefox to react differently. note that starting with version 6, firefox supports dom level 3 customevent, which lets you dispatch custom events with arbitrary data from javascript. ...
...aware of a way to do this that doesn't involve modifications to trunk. what follows a list of the files you'll need to modify, as well as a discussion of each change. mozilla/dom/base/nsdomclassinfoclasses.h the change you make here is really rather small but it is incredibly important. if you peruse nsdomclassinfoclasses.h you'll see of list of macros of the form domci_class(foo). you'll want to
add an entry to it which looks like this: domci_class({truncated name}) here's the fun part: above i mentioned that you must name your events as nsdom. however, here you want to put the other part of the name (e.g. if you have an event named nsdommyfirstevent your nsdomclassinfoclasses entry would be domci_class(myfirstevent)). mozilla/dom/src/base/nsdomclassinfo.cpp mozilla contains many convenienc...
... nscomptr<nsidomdocument> adoc; // a handle to the document nscomptr<nsidomeventtarget> twindow; // the target window (really the same window as above but you need // a different inteface :/ nscomptr<nsidomevent> event; //this will be the event we throw. nscomptr<nsidommyevent> myevent; //this is a handle to the your inteface to the event. ...
...And 2 more matches
Firefox and the "about" protocol
t useful is the url about:config, which displays preferences and settings that can be inspected and changed. available about: urls depend on your specific firefox version. ...
...s the url about:config, which displays preferences and settings that can be inspected and changed. available about: urls depend on your specific firefox version. ...
...about:compat lists overriding site compatability fixes, linked to specific bug issues. ...
...And 2 more matches
Browser API
the html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. it currently works in (privileged) chrome code on firefox desktop (version 47 and above). browser api concepts and usage the browser api consists of two major parts: custom <iframe> attributes: by
adding a mozbrowser attribute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the htmliframeelement interface. browser api interfaces to support...
...lume() sets the current volume of the browser <iframe>. htmliframeelement.mute() mutes any audio playing in the browser <iframe>. htmliframeelement.unmute() unmutes any audio playing in the browser <iframe>. htmliframeelement.getmuted() indicates whether the browser <iframe> is currently muted. event-related methods in order to manage the browser <iframe>'s content, many new events were
added (see below). the following methods are used to deal with those events: the <iframe> gains support for the methods of the eventtarget interface
addeventlistener(), removeeventlistener(), and dispatchevent(). htmliframeelement.sendmouseevent() sends a mouseevent to the <iframe>'s content. utility methods last, there are some utility methods, useful for apps that host a browser <iframe>. ...
...son. browser api methods removed in firefox 65 in firefox 65, several of the mozilla browser api methods were removed in an effort to cut down on domrequest usage in the browser, and remove the parts of the browser api that are no longer needed (it is used only by the firefox devtools at this point). see bug 1503070 for more details. the methods removed in firefox 65 are: htmliframeelement.
addnextpaintlistener() defines a handler to listen for the next mozafterpaint event in the browser <iframe>. htmliframeelement.clearmatch() clears any content highlighted by findall() or findnext(). htmliframeelement.download() downloads a specified url, storing it at the specified filename/path. htmliframeelement.executescript() allows a specified script to be executed against a page loaded i...
...And 2 more matches
HTML parser threading
arser instance. nshtml5parser has one tokenizer/tree builder pair for parsing data from document.write(). it also has another lazily initialized tokenizer/tree builder for speculatively scanning the tail of document.write() data when the parser blocks without parsing the document.write() data to completion. nshtml5streamparser has one tokenizer/tree builder pair for parsing data from the network.
additionally, each nshtml5parser has an associated nshtml5treeopexecutor that turns the output (tree operations; discussed later) of the portable parser core into actions performed on the gecko dom. initialization an nshtml5parser is constructed without an nshtml5streamparser due to legacy code structure around parser creation. if the parser is not script-created, nshtml5parser::markasnotscriptcreate...
...ong with timerflush (discussed later) are the entry points from the parser thread event loop into nshtml5streamparser. the runnables hold mtokenizermutex for the entire duration of the dodataavailable or dostoprequest call. mtokenizermutex protects most data structures on nshtml5streamparser from concurrent access. the runnables need to keep the nshtml5streamparser instance alive, so they have to
addref it. however, if they released on the parser thread, nshtml5streamparser could be deleted from the parser thread, which would lead to all sorts of badness, because nshtml5streamparser has fields that hold objects that aren't safe to release except from the main thread. the runnables use nshtml5refptr<nshtml5streamparser>. nshtml5refptr sends runnables back to the main thread to call release on ...
...erated.) thus, a tree op that may cause the parser to block can only occur as the last op in a queue that runflushloop sees. preparing the parser thread for script execution when the parser thread sees that it has generated a tree op that attempts to execute a (non-async, non-defer) script, it starts speculating. it acquires mspeculationmutex and while holding it, it creates a new speculation and
adds it to the queue of speculations, flushes the tree ops to the main thread, marks the nshtml5streamparser as being in a speculating state and sets the newly created speculation object as the tree op sink (instead of the tree op stage described earlier) of the tree builder. the speculation object has a queue of tree ops (into which the tree builder will now flush ops to instead of the tree op stage...
...And 2 more matches
HTTP Cache
is returns a new empty entry to write the meta data and data to, the writer exchanges its cache entry by this new one and handles it as a new one. the writer then (in this order) fills the necessary meta data of the cache entry, opens the output stream on it and calls metadataready on it. any other pending openers, if any, are now given this new entry to examine and read as an existing entry.
adding a new storage should there be a need to
add a new distinct storage for which the current scoping model would not be sufficient - use one of the two following ways: [preffered]
add a new <your>storage method on nsicachestorageservice and if needed give it any arguments to specify the storage scope even more. implementation only should need to enhance the context key generation and parsing ...
...g model would not be sufficient - use one of the two following ways: [preffered]
add a new <your>storage method on nsicachestorageservice and if needed give it any arguments to specify the storage scope even more. implementation only should need to enhance the context key generation and parsing code and enhance current - or create new when needed - nsicachestorage implementations to carry any
additional information down to the cache service. [not preferred]
add a new argument to nsiloadcontextinfo; be careful here, since some arguments on the context may not be known during the load time, what may lead to inter-context data leaking or implementation problems.
adding more distinction to nsiloadcontextinfo also affects all existing storages which may not be always desirable. see context ...
...rray of cacheentry::callback objects. cacheentry::callback keeps a strong reference to the opener plus the opening flags. ...
...And 2 more matches
How to get a stacktrace for a bug report
eport, it is important to know whether the crash occurs with firefox safe mode. this helps engineers determine whether a particular extension or plugin is the cause of the crash. how to get a crash id with the mozilla crash reporter 1. crash and submit a report to the system. the mozilla crash reporter window should automatically come up after firefox crashes. ...
... occurs with firefox safe mode. this helps engineers determine whether a particular extension or plugin is the cause of the crash. how to get a crash id with the mozilla crash reporter 1. crash and submit a report to the system. the mozilla crash reporter window should automatically come up after firefox crashes. ...
...firefox should open a list of ids for your submitted crash reports. ...
...And 2 more matches
OS.File for the main thread
see the promise object documentation for details. also, os.file plays very nicely with task.jsm. ...
... is enough, but crucial, to set the correct append flag. var outfile = yield os.file.open("file.tmp", {write: true, append: false}, options); try { // ... do something with that file } finally { yield outfile.close(); } }); example of opening file and keeping it locked this uses tasks.jsm to open a file and keep it open. when you are done with it, like in shutdown of restartless
add-on, you should close the file so it becomes editable again. let options = { winshare: 0 // exclusive lock on windows }; if (os.constants.libc.o_exlock) { // exclusive lock on *nix options.unixflags = os.constants.libc.o_exlock; } let file = yield os.file.open(..., options); then when you want to unlock the file so it can be edited from other places, close the file. file.close(); this ex...
...m stackoverflow: os.file check last modified date before os.read os.file.openunique() creates and opens a file with a unique name. by default, generate a random hex number and use it to create a unique new file name. promise<object> openunique( in string path, [optional] in object options ) throws os.file.error arguments path the full native name of the file to open. optionsoptional
additional options for file opening. this implementation interprets the following fields: humanreadable if true, create a new filename appending a decimal number, e.g., filename-1.ext, filename-2.ext. if false use hex numbers, e.g., filename-a65bc0.ext. maxattempts used to limit the amount of tries after a failed file creation. default is 99. promise resolves to an object contains a ...
...And 2 more matches
Localizing with Mercurial
uild mozilla products on windows. trust us, you'll want this eventually. for a graphical interface, you may want to install tortoisehg, which integrates with your windows explorer shell. it also installs the command line utility. part of the command line hg install for windows involves making sure the hg executable is in the system's %path% variable (tortoisehg doesn't need this step). use the
add_path.exe utility found in c:\mozilla-build\hg to do this. ps c:\users\your_id> cd c:\mozilla-build\hg ps c:\mozilla-build\hg> .\
add_path.exe /result . note the dot (".") at the end of the second command, which means the current directory. if the utility modified your %path% successfully, a dialog will open saying, "%path% has been updated correctly." alternatively, you can edit the %path% var...
...ans the current directory. if the utility modified your %path% successfully, a dialog will open saying, "%path% has been updated correctly." alternatively, you can edit the %path% variable manually. in order to do so, right-click on your computer icon, choose properties > advanced > environmental variables, select path and click edit. if you don't see path among the options, you'll have to click
add and edit it within the
add dialog. see the screenshot for an example. did it work? go to start > run... type cmd.exe and click ok. a new shell window should appear. type hg --version in the new shell window. if you see a message about the version of mercurial (e.g. mercurial distributed scm (version 1.3.1)), you have installed mercurial successfully! more details for more details on ins...
...ry: hg pull -u creating l10n patches another thing you can do with hg without needing account priviledges is creating l10n patches of your work for someone else to commit to your remote l10n repo on the mozilla servers. doing this ensures that your dashboards are always accurate, as they look at your remote repo. here's how to create a l10n patch with hg and the mq extension: enable mq by
adding hg.ext = to your mercurial config file (~/.hgrc on unix-like systems 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 ...
...And 2 more matches
Translation phase
n localizing for that particular project group. it's up to you and your community to determine which l10n tool will best suit your needs. as you gain more experience, you may want to localize independent of mozilla-developed l10n tools, which we'll also discuss here. projects the mozilla projects and their l10n workflows are divided into these groups: mozilla applications, mozilla websites, and
add-ons. below you'll find the list of all mozilla projects, their associated l10n tools, and links to tutorials outlining their workflows. mozilla applications so you're interested in localizing mozilla applications. each l10n tool follows a different workflow for localizing mozilla application projects. we've linked a brief tutorial to each l10n tool name below. follow the tutorials to help you d...
...ials 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. version 5.26 is the latest version. virtaal an offline, stand-alone version of pootle that is also built on the translate toolkit api.
... enjoy safe, fast and easy email, mozilla-style. the thunderbird® email client includes intelligent spam filters, 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 wherever 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 n...
...And 2 more matches
Uplifting a localization from Central to Aurora
cd workrepo # pull in the changesets you have on aurora hg pull -r default ../releases/l10n/mozilla-aurora/ab-cd now, there are two routes forward: 1) things are pretty silent. good luck, you're basically done. all you need to do is to push from your l10n-central clone to your aurora repo. 2) new heads, you need to merge. ...
... in the changesets you have on aurora hg pull -r default ../releases/l10n/mozilla-aurora/ab-cd now, there are two routes forward: 1) things are pretty silent. good luck, you're basically done. all you need to do is to push from your l10n-central clone to your aurora repo. 2) new heads, you need to merge. ...
...you have on aurora hg pull -r default ../releases/l10n/mozilla-aurora/ab-cd now, there are two routes forward: 1) things are pretty silent. good luck, you're basically done. all you need to do is to push from your l10n-central clone to your aurora repo. 2) new heads, you need to merge. ...
...And 2 more matches
BloatView
ytes per-inst) x (objects rem). use this number to look for the worst offenders. (should be zero!) objects total - the total count of objects allocated of a given class. objects rem - the number of objects allocated of a given class that weren't deleted. (should be zero!) interesting things to look for: are your classes in the list? - look! if they aren't, then you're not using the ns_impl_
addref and ns_impl_release (or ns_impl_isupports which calls them) for xpcom objects, or moz_count_ctor and moz_count_dtor for non-xpcom objects. not having your classes in the list is not ok. that means no one is looking at them, and we won't be able to tell if someone introduces a leak. (see below for how to fix this.) the bytes leaked for your classes should be zero! - need i say more? if it isn'...
...ve a large number of refcounts. if you find leaks, you can use refcount tracing and balancing to discover the root cause. combining and sorting bloat logs you can view one or more bloat logs in your browser by running the following program. perl tools/bloatview/bloattable.pl log1 log2 ... logn > htmlfile this will produce an html file that contains a table similar to the following (but with
added javascript so you can sort the data by column). byte bloats name file date blank blank.txt tue aug 29 14:17:40 2000 mozilla mozilla.txt tue aug 29 14:18:42 2000 yahoo yahoo.txt tue aug 29 14:19:32 2000 netscape netscape.txt tue aug 29 14:20:14 2000 the numbers do not include malloc 'd data such as string conten...
...th log file. these columns provide an idea of how hard the memory allocator has to work, but they do not indicate the size of the working set. the second set of columns, bytes allocated but not freed, shows the net memory gain or loss by subtracting the amount of 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. perl tools/bloatview/bloatdiff.pl <previous-log> <current-log> this will give you output of the form: bloat/leak delta report current file: dist/win32_d.obj/bin/bloatlogs/...
...And 2 more matches
Memory reporting
t any objects pointed to by fields inherited from b are measured. however, if d does not have any of its own fields that point to other objects, then d::sizeofexcludingthis is not necessary. alternatively, if d does have fields that point to other objects but you don't want to measure them because they're insignificant, then d::sizeofexcludingthis is again not necessary. but it's a good idea to
add a comment indicating this decision not to measure, and the names of the unmeasured fields. the obvious place for this comment is within d, but if b has many sub-classes like that, it might be easier to put the comment above b::sizeofincludingthis. things to note about sizeofincludingthis when it is virtual. d::sizeofincludingthis is identical to b::sizeofincludingthis. you might think that d...
...e enough that it's clear what's being measured. sometimes you might want to split the measurements of an object into two or more numbers, e.g. because you want to show them separately in about:memory. in this case it's often clearer to increment the numbers rather than assigning to them, especially if you're measuring multiple entities and summing their measurements. ...
...obviously, if you increment you have to zero the values at some point. ...
...And 2 more matches
Profiling with Xperf
on (typically program files/microsoft sdks/windows/v7.1/redist/windows performance toolkit) to actually install the windows performance toolkit tools. it might already be installed by the windows sdk. check if c:\program files\microsoft windows performance toolkit already exists. for 64-bit windows 7 or vista, you'll need to do a registry tweak and then restart to enable stack walking: reg
add "hklm\system\currentcontrolset\control\session manager\memory management" -v disablepagingexecutive -d 0x1 -t reg_dword -f symbol server setup with the latest versions of the windows performance toolkit, you can modify the symbol path directly from within the program via the trace menu. just make sure you set the symbol paths before enabling "load symbols" and before opening a summary view. you c...
...ry view. you can also modify the _nt_symbol_path and _nt_symcache_path environment variables to make these changes permanent. the standard symbol path that includes both mozilla's and microsoft's symbol server configuration is as follows: _nt_symcache_path: c:\symbols _nt_symbol_path: srv*c:\symbols*http://msdl.microsoft.com/download/symbols;srv*c:\symbols*http://symbols.mozilla.org/firefox/ to
add symbols from your own builds,
add c:\path\to\objdir\dist\bin to _nt_symbol_path. as with all windows paths, the symbol path uses semicolons (;) as separators. make sure you select the trace -> load symbols menu option in the windows performance analyzer (xperfview). there seems to be a bug in xperf and symbols; it is very sensitive to when the symbol path is edited. if you change it within the ...
... path data. you'll have to agree to a eula for the microsoft symbols -- if you're not prompted for this, then something isn't configured right in your symbol path. (again, make sure that the directories exist; if they don't, it's a silent error.) quick start all these tools will live, by default, in c:\program files\microsoft windows performance toolkit. either run these commands from there, or
add the directory to your path. you will need to use an elevated command prompt to start or stop profiling. start recording data: xperf -on latency -stackwalk profile "latency" is a special provider name that turns on a few predefined kernel providers; run "xperf -providers k" to view a full list of providers and groups. you can combine providers, e.g., "xperf -on diageasy+file_io". "-stackwalk profi...
...And 2 more matches
TimerFirings logging
observer), which are the three kinds of timers that gecko supports. then comes the function kind, one of one_shot (a single-use timer), slack or precise (repeating timers of differing precision). then comes the timer period, measured in milliseconds. finally there is the identifying information for the timer. function timers have an informative label. interface and observer timers only have an
address, which is less useful, but they are uncommon enough that this usually doesn't matter much. the above example shows only timers from c++ within gecko. there are also timers for settimer 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[7f...
...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 code uses dl
addr to get the name immediately, and the output will look like the following. 2082435840[100445640]: [81190] fn timer (one_shot 8000 ms): [from dl
addr] gfxfontinfoloader::delayedstartcallback(nsitimer*, void*) second, on linux the code uses dl
addr to get the symbol library and
address, which can be post-processed by tools/rb/fix_stacks.py. the following two lines show the output before and after b...
...imer (one_shot 8000 ms): [from dl
addr] gfxfontinfoloader::delayedstartcallback(nsitimer*, void*) second, on linux the code uses dl
addr to get the symbol library and
address, which can be post-processed by tools/rb/fix_stacks.py. the following two lines show the output before and after being post-processed by that script. 2088737280[7f606bf68140]: [30710] fn timer (one_shot 16 ms): [from dl
addr] #0: ???[/home/njn/moz/mi1/o64/dist/bin/libxul.so +0x2144f94] 2088737280[7f606bf68140]: [30710] fn timer (one_shot 16 ms): [from dl
addr] #0: mozilla::refreshdrivertimer::timertick(nsitimer*, void*) (/home/njn/moz/mi1/o64/layout/b third, on other platforms dl
addr is not implemented or doesn't work well, and the output will look like the followin. 711637568[7f3219c48000]: [6835] fn...
...And 2 more matches
About NSPR
scribed by c.a.r. hoare in monitors: an operating system structuring concept , communications of the acm, 17(10), october 1974 and then formalized by xerox' mesa programming language ("mesa language manual", j.g. mitchell et al, xerox parc, csl-79-3 (apr 1979)). this mechanism provides the basic mutual exclusion (mutex) and thread notification facilities (condition variables) implemented by nspr.
additionally, nspr provides synchronization methods more suited for use by java. the java-like facilities include monitor reentrancy, implicit and tightly bound notification capabilities with the ability to associate the synchronization objects dynamically. i/o nspr's i/o is a slightly augmented bsd sockets model that allows arbitrary layering. it was originally intended to export synchronous i/o m...
... dynamically. i/o nspr's i/o is a slightly augmented bsd sockets model that allows arbitrary layering. it was originally intended to export synchronous i/o methods only, relying on threads to provide the concurrency needed for complex applications. that method of operation is preferred though it is possible to configure the network i/o channels as non-blocking in the traditional sense. network
addresses part of nspr deals with manipulation of network
addresses. nspr defines a network
address object that is internet protocol (ip) centric. while the object is not declared as opaque, the api provides methods that allow and encourage clients to treat the
addresses as polymorphic items. the goal in this area is to provide a migration path between ipv4 and ipv6. to that end it is possible to pe...
... time timing facilities are available in two forms: interval timing and calendar functions. interval timers are based on a free running, 32-bit, platform dependent resolution timer. ...
...And 2 more matches
Introduction to NSPR
abnormally terminates. (prthread and functions for creating and manipulating threads are described in detail in threads.) nspr threads are lightweight in the sense that they are cheaper than full-blown processes, but they are not free. they achieve the cost reduction by relying on their containing process to manage most of the resources that they access. this, and the fact that threads share an
address space with other threads in the same process, makes it important to remember that threads are not processes . nspr threads are scheduled in two separate domains: local threads are scheduled within a process only and are handled entirely by nspr, either by completely emulating threads on each host operating system (os) that doesn't support threads, or by using the threading facilities of e...
...spr guarantees that for each virtual processor the highest-priority, schedulable local thread is the one executing. this thread implementation strategy is referred to as the m x n model. preempting threads preemption is the act of taking control away from a ready thread at an arbitrary point and giving control to another appropriate thread. it might be viewed as taking the executing thread and
adding it to the end of the ready queue for its appropriate priority, then simply running the scheduling algorithm to find the most appropriate thread. the chosen thread may be of higher priority, of the same priority, or even the same thread. it will not be a thread of lower priority. some operating systems cannot be made preemptable (for example, mac os and win 16). this puts them at some risk in ...
...ate among threads. when a programmer associates a mutex with an arbitrary collection of data, the mutex provides a protective monitor around the data. locks and monitors in general, a monitor is a conceptual entity composed of a mutex, one or more condition variables, and the monitored data. monitors in this generic sense should not be confused with the monitor type used in java programming. in
addition to prlock, nspr provides another mutex type, prmonitor, which is reentrant and can have only one associated condition variable. prmonitor is intended for use with java and reflects the java approach to thread synchronization. to access the data in the monitor, the thread performing the access must hold the mutex, also described as being "in the monitor." mutual exclusion guarantees that onl...
...And 2 more matches
PRSocketOptionData
type for structure used with pr_getsocketoption and pr_setsocketoption to specify options for file descriptors that represent sockets. syntax #include <prio.h> typedef struct prsocketoptiondata { prsockoption option; union { pruintn ip_ttl; pruintn mcast_ttl; pruintn tos; prbool non_blocking; prbool reuse_
addr; prbool keep_alive; prbool mcast_loopback; prbool no_delay; prsize max_segment; prsize recv_buffer_size; prsize send_buffer_size; prlinger linger; prmcastrequest
add_member; prmcastrequest drop_member; prnet
addr mcast_if; } value; } prsocketoptiondata; fields the structure has the following fields: ip_ttl ip time-to-live. mcast_ttl ip multicast time-to-live. tos ip type-of-service and prece...
... keep_alive periodically test whether connection is still alive. mcast_loopback ip multicast loopback. no_delay disable nagle algorithm. don't delay send to coalesce packets. max_segment tcp maximum segment size. recv_buffer_size receive buffer size. ...
... prsize send_buffer_size; prlinger linger; prmcastrequest
add_member; prmcastrequest drop_member; prnet
addr mcast_if; } value; } prsocketoptiondata; fields the structure has the following fields: ip_ttl ip time-to-live. mcast_ttl ip multicast time-to-live. tos ip type-of-service and precedence. non_blocking nonblocking (network) i/o. reuse_
addr allow local
address reuse. keep_alive periodically test whether connection is still alive. mcast_loopback ip multicast loopback. no_delay disable nagle algorithm. don't delay send to coalesce packets. max_segment tcp maximum segment size. recv_buffer_size receive buffer size. send_buffer_size send buffer size. ...
...And 2 more matches
PR_Connect
timeout a value of type printervaltime specifying the time limit for completion of the connect operation. returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. ...
... timeout a value of type printervaltime specifying the time limit for completion of the connect operation. returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. ...
... timeout a value of type printervaltime specifying the time limit for completion of the connect operation. returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. ...
...And 2 more matches
NSS Certificate Download Specification
ime content-type that is used on the object being downloaded. for nss-based servers it will depend upon the options selected in the server's administration interface. subsequent certificates are all treated the same. if the certificates contain a basicconstraints certificate extension that indicates they are ca certificates, and do not already exist in the local certificate database, they are
added as untrusted cas. in this way they may be used for certificate chain validation, as long as there is a trusted ca somewhere along the chain. importing certificates into mozilla browsers mozilla browsers import certificates found in http protocol responses. there are several mime content types that are used to indicate to the browser what type of certificate is being imported. these mime type...
...downloaded is a user certificate belonging to the user operating the browser. if the private key associated with the certificate does not exist in the user's local key database, then an error dialog is generated and the certificate is not imported. if a certificate chain is being imported then the first certificate in the chain must be the user certificate, and any subsequent certificates will be
added as untrusted ca certificates to the local database. application/x-x509-ca-cert the certificate being downloaded represents a certificate authority. when it is downloaded the user will be shown a sequence of dialogs that will guide them through the process of accepting the certificate authority and deciding if they wish to trust sites certified by the ca. if a certificate chain is being importe...
...oaded represents a certificate authority. when it is downloaded the user will be shown a sequence of dialogs that will guide them through the process of accepting the certificate authority and deciding if they wish to trust sites certified by the ca. if a certificate chain is being imported then the first certificate in the chain must be the ca certificate, and any subsequent certificates will be
added as untrusted ca certificates to the local database. application/x-x509-email-cert the certificate being downloaded is a user certificate belonging to another user for use with s/mime. if a certificate chain is being imported then the first certificate in the chain must be the user certificate, and any subsequent certificates will be
added as untrusted ca certificates to the local database. thi...
...And 2 more matches
JSS Provider Notes
, there is no clear timeframe for fixing them. meanwhile, the org.mozilla.jss.crypto.cryptostore class can be used for some of this functionality. ...
...me of this functionality. ...
...rted algorithms notes aes des desede (des3 ) rc2 rc4 rsa the following modes and p
adding schemes are supported: algorithm mode p
adding des ecb nop
adding cbc nop
adding pkcs5 p
adding desede des3 ecb nop
adding cbc nop
adding pkcs5 p
adding aes ...
...And 2 more matches
NSS_3.12.2_release_notes.html
es lib - nss shared libraries bin< - nss tools and test programs you also need to download the nspr 4.7.1 binary distributions to get the nspr 4.7.1 header files and shared libraries, which nss 3.12.2 requires. nspr 4.7.1 binary distributions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. new in nss 3.12.2 new functions in the nss shared library: sec_pkcs12
addcertorchainandkey (see p12.h) new pkcs11 errors (see secerr.h) sec_error_pkcs11_general_error sec_error_pkcs11_function_failed sec_error_pkcs11_device_error bugs fixed the following bugs have been fixed in nss 3.12.2. bug 200704: pkcs11: invalid session handle 0 bug 205434: fully implement new libpkix cert verification api from bug 294531 bug 302670: use the installed libz.so wher...
...c_error_pkcs11_device_error bugs fixed the following bugs have been fixed in nss 3.12.2. ...
...er to sec_pkcs12
addcertandkey bug 390527: get rid of pkixerrormsg variable in pkix_error bug 391560: libpkix does not consistently return pkix_validatenode tree that truly represent failure reasons bug 408260: certutil usage doesn't give enough information about trust arguments bug 412311: replace pr_interval_no_wait with pr_interval_no_timeout in client initialization calls bug 423839:
add multiple pkcs#11 token password command line option to nss tools. bug 432260: [[@ pkix_pl_httpdefaultclient_hdrcheckcomplete - pkix_pl_memcpy] crashes when there is no content-length header in the http response bug 436599: pkix: aia extension is not used in some bridge ca / known certs configuration bug 437804: certutil -r for cert renewal should derive the subject from the cert if none is ...
...And 2 more matches
NSS 3.14.3 release notes
tag is nss_3_14_3_rtm. nss 3.14.3 requires nspr 4.9.5 or newer. nss 3.14.3 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_3_rtm/src/ new in nss 3.14.3 new functionality no new major functionality is introduced in this release. this release is a patch release to
address cve-2013-1620. new functions in pk11pub.h pk11_signwithsymkey - similar to pk11_sign, performs a signing operation in a single operation. however, unlike pk11_sign, which uses a seckeyprivatekey, pk11_signwithsymkey performs the signature using a symmetric key, such as commonly used for generating macs. new types ck_nss_mac_constant_time_params - parameters for use ...
...ign, which uses a seckeyprivatekey, pk11_signwithsymkey performs the signature using a symmetric key, such as commonly used for generating macs. new types ck_nss_mac_constant_time_params - parameters for use with ckm_nss_hmac_constant_time and ckm_nss_ssl3_mac_constant_time. ...
...nerating macs. new types ck_nss_mac_constant_time_params - parameters for use with ckm_nss_hmac_constant_time and ckm_nss_ssl3_mac_constant_time. new pkcs #11 mechanisms ckm_nss_hmac_constant_time - constant-time hmac operation for use when verifying a p
added, mac-then-encrypted block of data. ckm_nss_ssl3_mac_constant_time - constant-time mac operation for use when verifying a p
added, mac-then-encrypted block of data using the sslv3 mac. notable changes in nss 3.14.3 cve-2013-1620 recent research by nadhem alfardan and kenny patterson has highlighted a weakness in the handling of cbc p
adding as used in ssl, tls, and dtls that allows an attacker to exploit timing differences in mac processing. the details of their research and the attack can be found at http://www.is...
...And 2 more matches
NSS 3.24 release notes
andards 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 prevent 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 (by setting an appropriate ...
... 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 caller is no longer required to use sslkeatype explicitl...
... type from the certificate and private key. the caller is no longer required to use sslkeatype explicitly to select a "slot" into which the certificate is configured (which incorrectly identifies a key agreement type rather than a certificate). separate functions for configuring online certificate status protocol (ocsp) responses or signed certificate timestamps are not needed, since these can be
added to the optional sslextraservercertdata struct provided to ssl_configservercert. also, partial support for rsa probabilistic signature scheme (rsa-pss) certificates has been
added. although these certificates can be configured, they will not be used by nss in this version. for functions that use temporary arenas, allocating a portcheaparena on the stack is more performant than allocating a pla...
...And 2 more matches
NSS 3.48 release notes
red 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 details. certificate authority changes the following ca certificates were
added: bug 1591178 - entrust root certification authority - g4 cert sha-256 fingerprint: db3517d1f6732a2d5ab97c533ec70779ee3270a62fb4ac4238372460e6f01e88 upcoming changes in nss 3.49 the legacy dbm database, libnssdbm, will no longer be built by default. see bug 1594933 for details. bugs fixed in nss 3.48 bug 1600775 - require nspr 4.24 for nss 3.48 bug 15934...
...ha-256 fingerprint: db3517d1f6732a2d5ab97c533ec70779ee3270a62fb4ac4238372460e6f01e88 upcoming changes in nss 3.49 the legacy dbm database, libnssdbm, will no longer be built by default. see bug 1594933 for details. ...
...ing changes in nss 3.49 the legacy dbm database, libnssdbm, will no longer be built by default. see bug 1594933 for details. ...
...And 2 more matches
nss tech note4
he client cert's handle, if client auth happened if ssl server, this will get you the server's cert handle don't forget to clean up the cert handle when you're done with it void cert_destroycertificate(certcertificate *cert); some info is readily available cert->subjectname (char*) cert->issuername (char*) cert->email
addr (char*) or char *cert_getcertificateemail
address(certcertificate *cert); cert->keyusage (unsigned int) to break the issuer and subject names into components pass &(cert->issuer) or &(cert->subject) to the following functions char *cert_getcommonname(certname *name); char *cert_getcertemail
address(certname *name); char *cert_getcoun...
...to illustrate access to the info is given below. background on cert extensions an extension has the following attributes object id (oid) : a unique oid represents an algorithm, a mechanism, a piece of information, etc. examples: x500 rsa encryption, certificate basic constraints, pkcs#7 digested data, etc. there is a long list of pre-defined oids, and new ones can be
added dynamically by an application. the oid data structure contains an array of identifier bytes (each byte is a "level" in a hierarchical namespace), a text description, and some other things. critical : indicates whether the extension is critical value : the value of the extension looping through all extensions certcertextension** extensions =cert-...
... { case a_tag_that_app_recognizes: ..... case ..... ...... ...
...And 2 more matches
sslerr.html
part of the ssl reference that we are migrating into the format described in the mdn style guide. if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference nss and ssl error codes chapter 8 nss and ssl error codes nss error codes are retrieved using the nspr function pr_geterror. in
addition to the error codes defined by nspr, pr_geterror retrieves the error codes described in this chapter. ssl error codes sec error codes ssl error codes table 8.1 error codes defined in sslerr.h constant value description ssl_error_export_only_server -12288 "unable to communicate securely. peer does not support high-grade encryption." the local syst...
..." possible causes: (a) all cipher suites have been configured to be disabled, (b) the only cipher suites that are configured to be enabled are those that are disallowed by cipher export policy, (c) the socket is configured to handshake as a server, but the certificate associated with that socket is inappropriate for the key exchange algorithm selected. ssl_error_bad_block_p
adding -12264 "ssl received a record with bad block p
adding." ssl was using a block cipher, and the last block in an ssl record had incorrect p
adding information in it. this usually indicates that the client and server have failed to come to agreement on the set of keys used to encrypt the application data and to check message integrity. if this occurs frequently on a server, an activ...
...ificate issuer has been marked as not trusted by the user. sec_error_untrusted_cert -8171 peer's certificate has been marked as not trusted by the user. sec_error_duplicate_cert -8170 certificate already exists in your database. sec_error_duplicate_cert_name -8169 downloaded certificate's name duplicates one already in your database. sec_error_
adding_cert -8168 error
adding certificate to database. sec_error_filing_key -8167 error refiling the key for this certificate. sec_error_no_key -8166 the private key for this certificate cannot be found in key database. sec_error_cert_valid -8165 this certificate is valid. sec_error_cert_not_valid -8164 this certificate is not valid. ...
...And 2 more matches
Scripting Java
erited from the base class java.lang.object (like wait). this makes it easier to work with objects in deeply nested inheritance hierarchies since you can see all the methods that are available for that object. rhino provides another convenience by allowing properties of javabeans to be accessed directly by their property names. a javabean property foo is defined by the methods getfoo and setfoo.
additionally, a boolean property of the same name can be defined by an isfoo method. for example, the following code actually calls the file object's getname and isdirectory methods. js> f.name test.txt js> f.directory false calling overloaded methods the process of choosing a method to call based upon the types of the arguments is called overload resolution. in java, overload resolution is perfo...
...fields, methods, and properties of those objects, we have a great deal of power at our fingertips. however, there are a few instances where that is not enough: many apis in java work by providing interfaces that clients must implement. one example of this is the thread class: its constructor takes a runnable that contains a single method run that will be called when the new thread is started. to
address this need, rhino provides the ability to create new java objects that implement interfaces. first we must define a javascript object with function properties whose names match the methods required by the java interface. to implement a runnable, we need only define a single method run with no parameters. if you remember from chapter 3, it is possible to define a javascript object with the {pro...
...n of interface method. here is the simplified runnable example: js> t = java.lang.thread(function () { print("\nrunning"); }); thread[thread-0,5,main] js> t.start() js> running rhino also allows use of javascript functions as implementations of java interfaces with more than one method if all the methods have the same signature. ...
...And 2 more matches
Self-hosted builtins in SpiderMonkey
guments. in contrast to function.prototype.call, this syntax makes it impossible for other code to interfere and gets compiled to bytecode that doesn't have any overhead compared to a normal function invocation. otoh, normal method calls are forbidden in self-hosted 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 prevent accidentally calling content functions when assuming that content can't interfere with behavior. e.g., if receiver is an object that c...
... receiver) has to be used. self-hosted functions by default are not constructors and do not have a prototype property, so that they meet the requirements for standard built-in functions as described in the ecmascript language specification 5.1, clause 15. to make a self-hosted function a constructor, call makeconstructible(functionname) after the function declaration. a prototype property can be
added from the self-hosted code itself. all self-hosted functions have direct access to each other and can rely on references being stable, i.e. not changeable by client js code. otoh, self-hosted code doesn't have access to most of the c++-implemented builtins. you can not, for example, use function.prototype.apply directly. a select set of c++-implemented builtins is installed via the intrinsic_f...
...ovided in this way are: the abstract operations toobject, tointeger, and iscallable specified in the ecmascript language specification. throwtypeerror, throwrangeerror, throwsyntaxerror, which self-hosted code should use instead of throw so that the error message is specified in js.msg and can be localized. the makeconstructible function described above. the file utilities.js provides some
additional, js-implemented helper functions. of note, it provides implementations of list and record, types defined in the ecmascript specifications that are similar to array and object, but can't be modified by application code. the selfhostingdefines.h header contains
adding self-hosted functions to host objects first, the code has to be embedded into spidermonkey. the easiest way to accomplish ...
...And 2 more matches
JSPropertyOp
jspropertyop and jsstrictpropertyop are the type of property getter and setter callbacks in the jsapi. they are also the types of the jsclass.
addproperty, getproperty, and setproperty callbacks, which are called during object property accesses. syntax typedef bool (* jspropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); typedef bool (* jsstrictpropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, bool strict, js::mutablehandlevalue vp); //
added in spidermonkey 1.9.3 name type description cx jscontext * the context in which the property access is taking place. provides request. in js_threadsafe builds, the javascript engine calls this callback only fro...
...::value variable. the meaning of this variable is different for each of the hooks; see below. description jspropertyop and jsstrictpropertyop callbacks are hooks that applications may install to be called at some point during property access. a jspropertyop may be installed on an individual property as a getter or setter; or it may be installed on a jsclass to hook property gets, sets, or
adds. these different cases are described in more detail in the sections below. if a jspropertyop or jsstrictpropertyop does nothing and returns true, then property get, set, or
add is unaffected. it proceeds as normal. each of these callbacks may veto the ongoing property operation by optionally reporting an error or raising an exception and then returning false. the operation then fails, and the ...
...t properties from its prototype. getters (and sometimes setters; see js_setproperty for details) are called even when the property being accessed is found on a prototype and not on obj itself. in this case obj points to the object from which the property is being accessed, not the object on which the property was defined. jsclass hooks jsclass offers following hooks: jspropertyop jsclass.
addproperty is called just after a new property is
added to an object. this happens when a program sets a property that isn't already an own property of the target object. it also happens in jsapi functions such as js_defineproperty. on entry, *vp contains the value provided by the code defining or setting the property. the callback may modify *vp. on success, the post-callback value of *vp becomes t...
...And 2 more matches
JS_ExecuteScript
execute a compiled script. ...
... execute a compiled script. ...
...piled script. ...
...And 2 more matches
JS_GetSecurityCallbacks
this article covers features introduced in spidermonkey 1.8.1 configure spidermonkey security hooks. syntax /*
added in spidermonkey 17 */ void js_setsecuritycallbacks(jsruntime *rt, const jssecuritycallbacks *callbacks); const jssecuritycallbacks * js_getsecuritycallbacks(jsruntime *rt); /* obsolete since jsapi 13 */ jssecuritycallbacks * js_setcontextsecuritycallbacks(jscontext *cx, jssecuritycallbacks *callbacks); jssecuritycallbacks * js_getruntimesecuritycallbacks(jsruntime *rt); jssecuritycallbacks * js_setruntimesecuritycallbacks(jsruntime *rt, jssecuritycallbacks *callbacks); name type description rt jsruntime * a runtime to get/set the security callbacks. callbacks const jssecuritycallbacks * a pointer to the new ...
...mesecuritycallbacks(jsruntime *rt, jssecuritycallbacks *callbacks); name type description rt jsruntime * a runtime to get/set the security callbacks. callbacks const jssecuritycallbacks * a pointer to the new callbacks for the runtime. ...
... name type description rt jsruntime * a runtime to get/set the security callbacks. callbacks const jssecuritycallbacks * a pointer to the new callbacks for the runtime. ...
...And 2 more matches
JS_InitClass
his function must not call js_this or js_this_object. instead it must create a new object and return it. nargs unsigned number of arguments for the constructor. ps jspropertyspec * either null or a pointer to the first element of an array of jspropertyspecs, terminated by the null jspropertyspec, which can be written {0, 0, 0, 0, 0}. these properties, if any, are
added to the class's new prototype object. all instances of the new class will inherit these properties via the prototype chain. fs jsfunctionspec * either null or a pointer to the first element of an array of jsfunctionspecs, terminated by js_fs_end. these functions, if any, are
added to the class's new prototype object. all instances of the new class will inherit these methods via th...
...re
added to the class's new prototype object. all instances of the new class will inherit these methods via the prototype chain. (this is the javascript equivalent of public, non-static methods in c++ or java.) static_ps jspropertyspec * either null or a pointer to the first element of an array of jspropertyspecs, terminated by the null jspropertyspec. these properties, if any, are
added to the new class's constructor. (this is the nearest javascript equivalent of public static member variables in c++ or public static fields in java.) static_fs jsfunctionspec * either null or a pointer to the first element of an array of jsfunctionspecs, terminated by js_fs_end. these functions, if any, are
added to the new class's constructor. (this is the javascript equivalent ...
...ass might be overkill. js_definefunction is simpler. a jsapi class consists of a jsclass structure, a constructor, a prototype object, and properties and functions. the jsclass is an internal data structure that is not exposed outside the javascript engine. it specifies the name of the class, its flags, and its property access functions. these include native c functions for instance finalization,
adding and deleting properties, getting and setting property values, and enumerating, converting, and resolving properties. the jsapi provides reasonable default behavior for all of these; ordinarily you don't want to overload any of them. after a successful call to js_initclass, javascript code can see and manipulate the class's constructor and prototype just as if it were an ordinary javascript fun...
...And 2 more matches
JS_NewObjectForConstructor
convenience function to create a new object exactly as a constructor function would. syntax jsobject * js_newobjectforconstructor(jscontext *cx, const jsclass *clasp, const js::callargs& args); //
added in jsapi 32 jsobject * js_newobjectforconstructor(jscontext *cx, jsclass *clasp, const jsval *vp); //
added in jsapi 14, obsolete since jsapi 32 jsobject * js_newobjectforconstructor(jscontext *cx, const jsval *vp); // obsolete since jsapi 14 name type description cx jscontext * the context in which to create the new object. requires request. ...
...te since jsapi 32 jsobject * js_newobjectforconstructor(jscontext *cx, const jsval *vp); // obsolete since jsapi 14 name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp const jsclass * the class of the object to create.
added in spidermonkey 17 vp jsval * pointer to a constructor. this must be an object that has a prototype property. args js::callargs & call argument to get a constructor as callee.
added in spidermonkey 38 description js_newobjectforconstructor creates a new object exactly as the given constructor would if invoked with new. this function does not run the code ...
...totype, and parent of the new object. ...
...And 2 more matches
JS_Remove*Root
jscontext *cx, jsval *vp); jsbool js_removestringroot(jscontext *cx, jsstring **spp); jsbool js_removeobjectroot(jscontext *cx, jsobject **opp); jsbool js_removegcthingroot(jscontext *cx, void **rp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...veobjectroot(jscontext *cx, jsobject **opp); jsbool js_removegcthingroot(jscontext *cx, void **rp); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. vp jsval *
address of the jsval variable to remove from the root set. this must have been passed to either js_
addvalueroot or js_
addnamedvalueroot. spp jsstring *
address of the jsstring* variable to remove from the root set. this must have been passed to either js_
addstringroot or js_
addnamedstringroot. opp jsobject *
address of the jsobject* variable to remove from the root set. this must have been passed to either js_
addobjectroot or js_
addnamedobjectroot. rp vo...
... description js_removeroot removes the variable that rp points to from the garbage collector's root set. the entry for rp is removed from the root set for the jsruntime associated with the context cx. js_removeroot always returns js_true. ...
...And 2 more matches
JS_ValueToId
convert a js::value to type jsid. syntax bool js_valuetoid(jscontext *cx, js::handlevalue v, js::mutablehandleid idp); bool js_stringtoid(jscontext *cx, js::handlestring s, js::mutablehandleid idp); //
added in spidermonkey 38 bool js_indextoid(jscontext *cx, uint32_t index, js::mutablehandleid idp); //
added in spidermonkey 17 bool js_charstoid(jscontext* cx, js::twobytechars chars, js::mutablehandleid idp); //
added in spidermonkey 24 void js::protokeytoid(jscontext *cx, jsprotokey key, js::mutablehandleid idp); //
added in spidermonkey 38 name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the js value to convert. s ...
...o a jsid. on success, js_valuetoid stores the converted value in *idp and returns true. otherwise it returns false. ...
...id stores the converted value in *idp and returns true. otherwise it returns false. the inverse of js_valuetoid is js_idtovalue. ...
...And 2 more matches
TPS Bookmark Lists
y in verify and modify actions. before: the title of the bookmark item expected to be found before this bookmark; used only in verify and modify actions. changes: an object containing new properties to be set for this bookmark when this asset list is used in a modify action. ...
...ter this livemark; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this livemark; used only in verify and modify actions. changes: an object containing new properties to be set for this livemark when this asset list is used in a modify action. ...
...o be found after this folder; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this folder; used only in verify and modify actions. changes: an object containing new properties to be set for this folder when this asset list is used in a modify action. ...
...And 2 more matches
Using the Places annotation service
'page annotation' taking an nsiuri and the others labeled as an 'item annotation' and taking the id of an item in the places database. which one to use is usually dictated by the application. uri's are easier to use for services that want to annotate a web page loaded in the browser, while id's are easier to use for services already working with the places database. id's also offer the ability to
add annotations to containers and queries of the database. creating the annotation service the annotation contract id is @mozilla.org/browser/annotation-service;1 var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice); note that the annotation service is not thread-safe. you...
...s.interfaces.nsiannotationservice); note that the annotation service is not thread-safe. you should only use it from the main thread. naming your annotations for your annotation name, you should use the format <namespace>/<name>. for example, "my_extension/page_state". the annotation service does not currently enforce the annotation name format, but this may change in the future. also, we may
add functions to get all of "your" annotations matching a given namespace. you should not use any characters in your annotation names that are not valid as part of an html path. this includes colons, spaces, most punctuation, and non-ascii characters. you should try to have relatively few annotation names. the service stores these names in a separate table, and the fewer names there are, the more e...
...tation(auri, aname); getitemannotation(aitemid, aname); these functions will return/throw ns_error_not_available if the annotation requested does not exist. you can use the annotations service's hasannotation method to determine in advance if the page has the requested annotation. however, it is more efficient to just try to do the operation and catch the exception; the extra check requires an
additional database lookup (which has higher overhead). but then again you won't know if the exception meant that the annotation did not exist or something else is broken. the getter functions return only the value of the annotation (with the exception of the c++ getpageannotationbinary and getitemannotationbinary methods which return the mimetype as well). four functions are provided to get this in...
...And 2 more matches
Detailed XPCOM hashtable guide
hashtables may seem like arrays, but there are important differences: array hashtable keys: integer: arrays are always keyed on integers, and must be contiguous. ...
...u can store entries with keys 1, 5, and 3000). lookup time: o(1): lookup time is a simple constant o(1): lookup time is mostly-constant, but the constant time can be larger than an array lookup sorting: sorted: stored sorted; iterated over in a sorted fashion. unsorted: stored unsorted; cannot be iterated over in a sorted manner. inserting/removing: o(n):
adding and removing items from a large array can be time-consuming o(1):
adding and removing items from hashtables is a quick operation wasted space: none: arrays are packed structures, so there is no wasted space. some: hashtables are not packed structures; depending on the implementation, there may be significant wasted memory. in their implementation, hashtables take the k...
...n use the hash to find the location in the hashtable. good hashtable implementations will automatically resize the hashtable in memory if extra space is needed, or if too much space has been allocated. when should i use a hashtable? hashtables are useful for sets of data that need swift random access; with non-integral keys or non-contiguous integral keys; or where items will be frequently
added or removed. hashtables should not be used for sets that need to be sorted; very small datasets (less than 12-16 items); data that does not need random access. in these situations, an array, a linked-list, or various tree data structures are more efficient. mozilla's hashtable implementations mozilla has several hashtable implementations, which have been tested and, tuned, and hide th...
...And 2 more matches
Interfacing with the XPCOM cycle collector
pcom/base/nscyclecollector.h, but there are convenience macros for annotating your classes in xpcom/glue/nscyclecollectionparticipant.h that are much easier to use. in general, assuming you are modifying class nsfoo with two nscomptr edges mbar and mbaz, the process can be distilled to a few simple modifications: include the header nscyclecollectionparticipant.h in both nsfoo.h and nsfoo.cpp.
add a line declaring that your class nsfoo participates in the cycle collection in nsfoo.cpp: ns_impl_cycle_collection_class(nsfoo) change the line ns_decl_isupports to ns_decl_cycle_collecting_isupports in the definition of nsfoo.
add a line ns_decl_cycle_collection_class(nsfoo) within the public portion of definition of nsfoo. or ns_decl_cycle_collection_class_ambiguous(nsfoo, nsibar) if n...
..._isupports in the definition of nsfoo.
add a line ns_decl_cycle_collection_class(nsfoo) within the public portion of definition of nsfoo. or ns_decl_cycle_collection_class_ambiguous(nsfoo, nsibar) if nsfoo inherits from multiple interfaces, where nsibar is the interface which is returned when you queryinterface nsfoo to nsisupports. (we call nsibar the canonical isupports type for nsfoo.)
add a line ns_interface_map_entries_cycle_collection(nsfoo) to the interface map of nsfoo in nsfoo.cpp. ...
...e canonical isupports type for nsfoo.)
add a line ns_interface_map_entries_cycle_collection(nsfoo) to the interface map of nsfoo in nsfoo.cpp. or if that doesn't work: ns_interface_table_head(nsfoo) ns_interface_table2(nsfoo, nsibar, nsibaz) ns_interface_table_to_map_segue_cycle_collection(nsfoo) ns_interface_map_end change the line ns_impl_
addref(nsfoo) to ns_impl_cycle_collecting_
addref(nsfoo) in nsfoo.cpp, and similarly change the line ns_impl_release(nsfoo) to ns_impl_cycle_collecting_release(nsfoo) in nsfoo.cpp.
add the appropriate ns_impl_cycle_collection_# macro, where # is the number of member variables in your class. ...
...And 2 more matches
Components.utils.Sandbox
incipal for a particular origin in one of three ways: as an nsiprincipal, for example by using the nodeprincipal property of a dom node as an nsidomwindow, such as that returned by the dom window property as a string uri like "http://www.example.com/" (discouraged) when possible, specify a window or an nsiprincipal object instead of using a string uri. window objects and nsiprincipal carry
additional information such as origin attributes and same-origin privilege changes caused by setting document.domain. example of obtaining content principal from the window: var principal = gbrowser.selectedtab.linkedbrowser.contentprincipal; var sandbox = components.utils.sandbox(principal); expanded principal an expanded principal is specified as an array of the principals it subsumes. each it...
...].createinstance(ci.nsiprincipal); from firefox 37 onwards, you can also specify the null principal by simply passing null as the principal argument. options the constructor accepts an optional parameter. this parameter is an object with the following optional properties: freshzone if true creates a new gc region separate from both the calling context's and the sandbox prototype's region.
addons creating sandboxes whose expected lifetime is tied to that of a content window object will want to use samezoneas instead. samezoneas a javascript object in whose garbage collection region the sandbox should be created in. this helps to improve memory usage by allowing sandboxes to be discarded when that zone goes away. content scripts should pass the window they're running in as this par...
...to be discarded when that zone goes away. content scripts should pass the window they're running in as this parameter, in order to ensure that the script is cleaned up at the same time as the content itself. sandboxname a string value which identifies the sandbox in about:memory (and possibly other places in the future). this property is optional, but very useful for tracking memory usage of
add-ons and other javascript compartments. a recommended value for this property is an absolute path to the script responsible for creating the sandbox. as of gecko 13 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10), if you don't specify a sandbox name it will default to the caller's filename. sandboxprototype a prototype object for the sandbox. the sandbox will inherit the contents of this ...
...And 2 more matches
Components.utils.evalInWindow
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 original context will see that through an xraywrapper already), so it's guaranteed to behave predictably. this is useful for privileged code, such as
add-on code, to access variables and apis defined in web content. even so, while the code is being evaluated it is in the content's context, so the caller has to be prepared for the possibility that the content could have redefined behavior (for example, a setter in the script may have been redefined to do something unexpected). this function is made available as a global in sandboxes which have the ...
...e returned content, otherwise the result is structured-cloned. this does impose some restrictions on the sorts of things that can be returned: in particular, the result can't contain any functions, because functions can't be structured-cloned. ...
...ictions on the sorts of things that can be returned: in particular, the result can't contain any functions, because functions can't be structured-cloned. ...
...And 2 more matches
nsICategoryManager
each value is a list of strings. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/categorymanager;1. ...
...("protocol") aentry the name of the category e...
...g aentry, in boolean apersist); nsisimpleenumerator enumeratecategories(); nsisimpleenumerator enumeratecategory(in string acategory); string getcategoryentry(in string acategory, in string aentry); methods
addcategoryentry() this method sets the value for the given entry on the given category. the category and/or entry are created if they do not exist. string
addcategoryentry( in string acategory, in string aentry, in string avalue, in boolean apersist, in boolean areplace ); parameters acategory the name of the category being modified. ("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 a...
...And 2 more matches
nsIDOMMozNetworkStatsManager
networkstats is available */ } else { alert("i'm sorry, but networkstats services are not supported."); } method overview nsidomdomrequest getsamples(in nsisupports network, in jsval start, in jsval end, [optional] in jsval options /* networkstatsgetoptions */); nsidomdomrequest
addalarm(in nsisupports network, in long threshold, [optional] in jsval options /* networkstatsalarmoptions */); nsidomdomrequest getallalarms([optional] in nsisupports network); nsidomdomrequest removealarms([optional] in long alarmid); nsidomdomrequest clearstats(in nsisupports network); nsidomdomrequest...
...ates. if the filtering start date is greater than the end date, an exception is thrown. exceptions thrown ns_error_invalid_arg the filtering start date is greater than the end date. ns_error_not_implmented both appmanifesturl and servicetype are specified at the same time in the networkstatsgetoptions dictionary. invalidnetwork the network must be in the return of getavailablenetworks. ...
... servicetype are specified at the same time in the networkstatsgetoptions dictionary. invalidnetwork the network must be in the return of getavailablenetworks.
addalarm() install an alarm on a network. when total data usage reaches threshold bytes, a "networkstats-alarm" system message is sent to the application, where the optional parameter data must be a cloneable object. nsidomdomrequest
addalarm(in nsisupports network, in long threshold, [optional] in jsval options /* networkstatsalarmoptions */); parameters network the origin of the data. it can specify wifi, mobile, or null. if null, data measurement from both origins are merged. to know in advance which kind of origin is available, the moznetworkstatsmanager.getavailablenet...
...And 2 more matches
nsIDeviceMotion
om/system/nsidevicemotion.idlscriptable this interface is used to implement accelerometer support. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named nsidevicemotion prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3). ...
...s used to implement accelerometer support. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named nsidevicemotion prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3). ...
...e: this interface was named nsidevicemotion prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3). method overview void
addlistener(in nsidevicemotionlistener alistener); void
addwindowlistener(in nsidomwindow awindow); native code only! void removelistener(in nsidevicemotionlistener alistener); void removewindowlistener(in nsidomwindow awindow); native code only! ...
...And 2 more matches
nsIEditorSpellCheck
nstances. inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/editor/editorspellchecker;1. ...
... canspellcheck() determines whether or not spell checking can be enabled. boolean canspellcheck(); parameters none. return value returns true if spell checking can be enabled. if there are no ava...
... canspellcheck() determines whether or not spell checking can be enabled. boolean canspellcheck(); parameters none. return value returns true if spell checking can be enabled. if there are no available dictionaries, t...
...And 2 more matches
nsIMsgDBHdr
agged); void markhasattachments(in boolean hasattachments); void setprioritystring(in string priority); unsigned long orflags(in unsigned long flags); unsigned long andflags(in unsigned long flags); void setreferences(in string references); acstring getstringreference(in long refnum); void setrecipientsarray(in string names, in string
addresses,in unsigned long num
addresses); void setcclistarray(in string names, in string
addresses,in unsigned long num
addresses); void setbcclistarray(in string names, in string
addresses,in unsigned long num
addresses);new in thunderbird 3.1 [noscript] void getauthorcollationkey(out octetptr key, out unsigned long len); [noscript] void getsubjectcollationkey(out o...
...boolean readonly: indicates whether or not the message is starred in the ui. iskilled boolean readonly: indicates whether or not this message belongs to a subthread that has been ignored in the ui. if you want to know whether the message is the root of an ignored subthread then you should check for the ignored flag. any children of the ignored message will be marked as read when
added to the database. priority nsmsgpriorityvalue indicates the priority of this message. flags unsigned long indicates the flags of the message. see nsmsgmessageflags for a list of what may or may not be set on this message. note that the elided flag should not be set on messages, as it is a flag strictly dealing with the database view. threadid nsmsgkey ...
...attachments() void markhasattachments(in boolean hasattachments); parameters hasattachments if true, mark as having attachments. if false mark as not having attachments. setprioritystring() void setprioritystring(in string priority); parameters priority string describing the priority. orflags() unsigned long orflags(in unsigned long flags); parameters flags flags to be
added to the current message flags. andflags() unsigned long andflags(in unsigned long flags); parameters flags flags to be retained on the current message flags. all other flags are cleared. setreferences() void setreferences(in string references); parameters references sets the list of references for a news message. getstringreference() returns one of the references in the li...
...And 2 more matches
nsIPrefBranch2
in gecko 13 this interface was merged into the nsiprefbranch interface. method overview void
addobserver(in string adomain, in nsiobserver aobserver, in boolean aholdweak); void removeobserver(in string adomain, in nsiobserver aobserver); methods
addobserver()
add a preference change observer. on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this). atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. ...
...following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this). atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of the modified preference. for example, if your observer is registered with
addobserver("bar.", ...) on a branch with root "foo.", modifying the preference "foo.bar.baz" will trigger the observer, and adata parameter will be "bar.baz". void
addobserver( in string adomain, in nsiobserver aobserver, in boolean aholdweak ); parameters adomain the preference on which to listen for changes. this can be the name of an entire branch to observe. for example holding the ...
... aobserver the object to be notified if the preference changes. aholdweak true holds a weak reference to aobserver. ...
...And 2 more matches
nsISearchEngine
when non-null, this is a unique identifier. ...
...when non-null, this is a unique identifier. ...
... value description type_mozsearch 1 type_sherlock 2 type_opensearch 3 search engine data type constants constant value description data_xml 1 data type is xml data_text 2 data type is text. methods
addparam()
adds a parameter to the search engine's submission data. this should only be called on engines created via nsibrowsersearchservice.
addenginewithdetails(). void
addparam( in astring name, in astring value, in astring responsetype ); parameters name the name of the parameter to
add. value the value to pass. if value is "{searchterms}", it will be substitut...
...And 2 more matches
nsISocketProvider
ls, ssl, and so on. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/network/socket;2?type=foo. ...
..., in long aproxyport, in unsigned long aflags, out prfiledescstar afiledesc, out nsisupports asecurityinfo); native code only! constants constant value description proxy_resolves_host 1 << 0 this flag is set if the proxy is to perform hostname resolution instead of the client. ...
...ient. when set, the hostname parameter passed in this interface will be used instead of the
address structure passed for a later request. anonymous_connect 1 << 1 when setting this flag, the socket will not apply any credentials when establishing a connection. for example, an ssl connection would not send any client-certificates if this flag is set. methods native code only!
addtosocket this function is called to allow the socket provider to layer a prfiledesc (a file descriptor) on top of another prfiledesc. for example, ssl via a socks proxy. parameters are the same as newsocket() with the exception of afiledesc, which is an input parameter instead. ...
...And 2 more matches
nsIUpdateItem
iextensionmanager.idlscriptable describes an item managed by the extension system, providing metadata describing the item. 1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is obsolete; instead of using the extension manager, you should use the
addon manager. method overview void init(in astring id, in astring version, in astring installlocationkey, in astring minappversion, in astring maxappversion, in astring name, in astring downloadurl, in astring xpihash, in astring iconurl, in astring updateurl, in astring updatekey, in long type, in astring targetappid); attributes attribute type description ...
...ion astring the minimum version of the application that this item works with, in fvf format. read only. name astring the name of this item. read only. objectsource astring returns a js object source representing an nsiupdateitem. read only. targetappid astring the target application id used for checking compatibility for this item. note:
add-ons can specify a targetapplication id of toolkit@mozilla.org in their install manifest for compatibility with all apps using a specific release of the toolkit. read only. type long the type of this item. read only. updatekey astring the public key to verify updates for this item. this must be the public part of the key that was used to sign update manifests for thi...
...ns can specify a targetapplication id of toolkit@mozilla.org in their install manifest for compatibility with all apps using a specific release of the toolkit. read only. type long the type of this item. read only. updatekey astring the public key to verify updates for this item. this must be the public part of the key that was used to sign update manifests for this
add-on. read only. updaterdf astring the url of the update rdf file for this item. read only. version astring the version of the item, in fvf format. read only. xpihash astring the string hash for the xpi file. can be null and if supplied must be in the format of "type:hash" (see the types in nsicryptohash and nsixpinstallmanager.initmanagerwithhashes(). ...
...And 2 more matches
nsIWebBrowser
instance with the embedders chrome and to register any listeners. the interface may also be used at runtime to obtain the content dom window and from that the rest of the dom. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. method overview void
addwebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); void removewebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); attributes attribute type description containerwindow nsiwebbrowserchrome the chrome object associated with the browser instance. the embedder must create one chrome object for each browser object that...
...t is instantiated. the embedder must associate the two by setting this property to point to the chrome object before creating the browser window via the browser's nsibasewindow interface. the chrome object must also implement nsiembeddingsitewindow. the chrome may optionally implement nsiinterfacerequestor, nsiwebbrowserchromefocus, nsicontextmenulistener and nsitooltiplistener to receive
additional notifications from the browser object. the chrome object may optionally implement nsiwebprogresslistener instead of explicitly calling
addwebbrowserlistener() and removewebbrowserlistener() to register a progress listener object. if the implementation does this, it must also implement nsiweakreference. note: the implementation should not refcount the supplied chrome object; it shou...
...o 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 the parent content listener is destroyed before the browser object. ...
...And 2 more matches
nsIWebContentHandlerRegistrar
xpfe/appshell/public/nsiwebcontenthandlerregistrar.idlscriptable applications wishing to use web content handlers need to implement this interface. typically they will prompt the user to confirm
adding an entry to the local list. inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) implemented by @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 as a service: var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); method overview void registercontenthandler(in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow) void registerprotocolhandler(in domstring protoc...
...ser as a string. contentwindow the dom content window from which the method has been called. note: script must execute from same domain as uri or else it will throw permission error. can bypass this by opening about:config and setting preference of gecko.handlerservice.allowregisterfromdifferenthost to true. examples register a webmail service as mailto handler the following code aims to
add "outlook.com live mail" to list of webservice handlers. in the image below "gmail" and "yahoo! mail" already exist as webservice handlers. cu.import('resource://gre/modules/services.jsm'); var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); var htmlcontentwindow = undefined; var registeruri = 'ht...
...erprotocolhandler. must have a content window to pass to registerprotocolhandler as it prompts the user for permission'); } nsiwchr.registerprotocolhandler("mailto", registeruri, "outlook.com live mail", htmlcontentwindow); in this example the services.wm.getenumerator was used to find a window that had the same host name (contentwindow.location.hostname) as the uri (uri.host) we are trying to
add. ...
...And 2 more matches
nsIWebProgressListener
n is for a request, which includes but is not limited to document requests. (see below for a description of document requests.) other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. state_is_document 0x00020000 this flag indicates that the state transition is for a document request. this flag is set in
addition to state_is_request. a document request supports the nsichannel interface and its loadflags attribute includes the nsichannel::load_document_uri flag. a document request does not complete until all requests associated with the loading of its corresponding document have completed. this includes other document requests (for example corresponding to html <iframe> elements). the document cor...
...ows you how to detect what flags are popping up where. it puts the messages into the browser console. /** * this example assumes that it's being run within the context of a browser * window, and uses a frame script that will be loaded into every * browser tab. */ let mm = window.getgroupmessagemanager("browsers"); mm.loadframescript("chrome://path/to/some/example-framescript.js", true); mm.
addmessagelistener("my
addonmessage", (message) => { let data = message.data; let browser = message.target; let outerwindowid = data.outerwindowid; // browser is now the <xul:browser> that saw the web progress activity // occur. if you need to hold onto an identifier for whichever frame // (be it the top-level, or a subframe) was using the webprogress, use // the outerwindowid. this can ...
... "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindowutils) .outerwindowid; sendasyncmessage("my
addonmessage", { name: "onstatechange", flag: aflag, status: astatus, }); }, onlocationchange: function(aprogress, arequest, auri, aflag) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindowutils) ...
...And 2 more matches
nsIXMLHttpRequest
irefox 60 / thunderbird 60 / seamonkey 2.57)this 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. nsixmlhttprequest along with nsijsxmlhttprequest and nsixmlhttprequesteventtarget are mozilla's implementation details of the dom xmlhttprequest object. note: if you're a web developer or a mozilla
add-on developer, please refer to the xmlhttprequest documentation instead. this page contains documentation, specific to mozilla application and
add-on developers. the interface definition: //github.com/realityripple/uxp/blob/master/dom/xhr/nsixmlhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only. when using the xpcom interface...
.../blob/master/dom/xhr/nsixmlhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only. when using the xpcom interface, as seen below in example 2, we can get access to this. the most obvious benefit is that we can set nsirequest - constants in the xhr.channel.loadflags. ...
...s
added, this strips all user data (cookies, tokens, etc). using event handlers from native code (not sure if it's up-to-date) from native code, the way to set up onload and onerror handlers is a bit different. here is a comment from johnny stenback <jst@netscape.com>: the mozilla implementation of nsixmlhttprequest implements the interface nsidomeventtarget and that's how you're supported to
add event listeners. try something like this: nscomptr<nsidomeventtarget> target(do_queryinterface(myxmlhttpreq)); target->
addeventlistener(ns_literal_string("load"), mylistener, pr_false) where mylistener is your event listener object that implements the interface nsidomeventlistener. the 'onload', 'onerror', and 'onreadystatechange' attributes moved to nsijsxmlhttprequest, but if you're coding in c...
...And 2 more matches
nsIXPCScriptable
note: this is not really an xpcom interface. for example, callers must guarantee that they set the *_retval of the various methods that return a boolean to pr_true before making the call. implementations may skip writing to *_retval unless they want to return pr_false. js/src/xpconnect/idl/nsixpcscriptable.idlnot scriptable please
add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void precreate(in nsisupports nativeobj, in jscontextptr cx, in jsobjectptr globalobj, out jsobjectptr parentobj); void create(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr o...
...3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void precreate(in nsisupports nativeobj, in jscontextptr cx, in jsobjectptr globalobj, out jsobjectptr parentobj); void create(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); prbool
addproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool delproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool getproperty(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in jsvalptr vp); prbool setproperty(in n...
...in jsobjectptr obj); void postcreateprototype(in jscontextptr cx, in jsobjectptr proto); attributes attribute type description classname string scriptableflags pruint32 the bitwise or'd set of flags (define below) that indicate the behavior of this object. constants constant value description want_precreate 1 << 0 want_create 1 << 1 want_postcreate 1 << 2 want_
addproperty 1 << 3 want_delproperty 1 << 4 want_getproperty 1 << 5 want_setproperty 1 << 6 want_enumerate 1 << 7 want_newenumerate 1 << 8 indicates that the object wants to have its newenumerate method called. want_newresolve 1 << 9 indicates that the object wants to have its newresolve method called. want_convert 1 << 10 want_finalize 1 << 11 want_checkaccess 1 << 1...
...And 2 more matches
nsIXULTemplateQueryProcessor
paque to the template builder and defined by a query processor. the query is expected to consist of either text or dom nodes that, when executed by a call to the generateresults() method, will allow the generation of a list of results. the template builder will supply two variables, the reference variable and the member variable to further indicate what part of the datasource is to be examined in
addition to the query itself. the reference is always a placeholder for the starting point and the member is always a placeholder for the end points (the results). the reference point is important when generating output recursively, as the query will be the same for each iteration, however, the reference point will differ. for instance, when examining an xml source, an xml query processor might begin...
...etbindingfor() and nsixultemplateresult.getbindingobjectfor() methods. the template builder must call initializeforbuilding() before the other methods, except for translateref(). the builder will then call compilequery() for each query in the template to compile the queries. when results need to be generated, the builder will call generateresults(). ...
...y() and
addbinding() methods may not be called after generateresults() has been called until the builder indicates that the generated output is being removed by calling the done() method. currently, the datasource supplied to the methods will always be an nsirdfdatasource or a dom node, and will always be the same one in between calls to initializeforbuilding() and done(). ...
...And 2 more matches
Spam filtering
on happens after filters are run. white listing happens after filters, but before spam detection. the purge code is implemented as a search of the "junk" folder, looking for "old" message that have the proper junk status. when does purging happens? elaborate on the mime changes that were made for spam. ...
... message that have the proper junk status. when does purging happens? elaborate on the mime changes that were made for spam. currently, spam filtering is does not work for news, but it would be possible to
add support for this. (there is a bug on it.). ...
...es that were made for spam. currently, spam filtering is does not work for news, but it would be possible to
add support for this. (there is a bug on it.). ...
...And 2 more matches
Filter Incoming Mail
filter incoming mail to filter incoming mail, the first step is to detect new messages inconming. the, you've got components.interfaces.nsimsgdbhdr from where you can modify the mail. by example, to modify the mail subject : var newmaillistener = { msg
added: function(amsghdr) { if( !amsghdr.isread ) { // here we are, a new mail has popped // let get a javascript string object from the subject property // querying mime conversion interface var mimeconvert = components.classes["@mozilla.org/messenger/mimeconverter;1"] .getservice(components.interfaces.nsimimeconverter); var subject = mimeconvert.decodemimeheader(amsghdr.subject, null, false, true); // here with have a string to modify with javascript. by example, setting it to lower case ...
... ...
... ...
...And 2 more matches
Network request list - Firefox Developer Tools
column is empty. or you might see a red circle with a diagonal slash for responses that were blocked by the browser or the server. method: the http request method used. domain: domain of the path requested. if the request used ssl/tls and the connection had security weaknesses such as weak ciphers, you'll see a warning triangle next to the domain. y hover over the domain to see the ip
address. there's an icon next to the domain that gives you extra information about the security status of that request. see security icons. file: the basename of the file requested. (starting in firefox 80) on the right edge of the file column, a turtle icon appears if the server waiting time exceeds a threshhold (default: 500 ms). a tooltip explains the problem. you can configure the ...
...oblem. you can configure the threshhold in the configuration editor (about:config) by modifying the devtools.netmonitor.audits.slow setting. url: the url of the file requested. protocol: the network protocol used to transfer the data, this column is hidden by default. scheme: the scheme (https/http/ftp/...) of the path requested. this column is hidden by default. remote ip: the ip
address of the server answering the request. this column is hidden by default. type: content-type of the response. cookies: the number of request cookies associated to the request. this column is hidden by default. this is new in firefox 55. set-cookies: the number of response cookies associated to the request. this column is hidden by default. this is new in firefox 55. transferred: the number o...
...ist. disable all disables blocking of all items in the list. remove all deletes all items in the list. blocking a specific url from the request list you can also block a url from the request list: hover over the item you want to block in the request list. select block url from the context menu. when you refresh the page, that specific url will be blocked and a message will be
added to the item in the list indicating that it has been blocked by the devtools. stop blocking a url from the request list hover over the item. select unblock url. now when you refresh the page, the item will once enabled. note: (starting in firefox 80) you can also block and unblock urls from the web console, using the :block and :unblock helper commands. these accept any string, and...
...And 2 more matches
AbstractRange - Web APIs
tion of content within the document. as an abstract interface, you will not directly instantiate an object of type abstractrange. instead, you will use the range or staticrange interfaces. to understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...in terms of nodes and positions within nodes. second, in order to support the mutability of the dom tree as much as possible, you need a way to represent positions relative to nodes in the tree, rather than simply global positions within the entire document. by defining points within the document as offsets within a given node, those positions remain consistent with the content even as nodes are
added to, removed from, or moved around within the dom tree—within reason. there are fairly obvious limitations (such as if a node is moved to be after the endpoint of a range, or if the content of a node is heavily altered), but it's far better than nothing. third, using node-relative positions to define the start and end positions will generally be easier to make perform well. rather than having...
...rt(startnode, 11); let endnode = document.queryselector("#entry1 p em").childnodes[0]; r.setend(endnode, 2); let fragment = r.clonecontents(); here an interesting problem arises—we are capturing content from multiple nodes located at different levels of the dom hierarchy, and then only part of one of them. what should the result look like? as it turns out, the dom specification fortunately
addresses this exact issue. for example, in this case, we're calling clonecontents() on the range to create a new documentfragment object providing a dom subtree which replicates the contents of the specfied range. to do this, clonecontents() constructs all the nodes needed to preserve the structure of the indicated range, but no more than necessary. in this example, the start of the specified range...
...And 2 more matches
BasicCardResponse - Web APIs
properties basiccardresponse.cardnumber read only secure context contains the number of the card used to make the payment. basiccardresponse.cardholdername read only secure context optional contains the cardholder name of the card used to make the payment. ...
...securitycode read only secure context optional contains the security code of the card used to make the payment. basiccardresponse.expirymonth read only secure context optional contains the expiry month of the card used to make the payment. basiccardresponse.expiryyear read only secure context optional contains the expiry year of the card used to make the payment. basiccardresponse.billing
address read only secure context optional contains the billing
address of the card used to make the payment. examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as item...
... // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. }) .catch(function(err) { // do something with the error from request.show(). }); } catch (e) { // catch any other errors. } once the payment flow has been triggered using paymentrequest.show() and the pr...
...And 2 more matches
CanvasRenderingContext2D - Web APIs
point to the start. if the shape has already been closed or has only one point, this function does nothing. canvasrenderingcontext2d.moveto() moves the starting point of a new sub-path to the (x, y) coordinates. canvasrenderingcontext2d.lineto() connects the last point in the current sub-path to the specified (x, y) coordinates with a straight 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 previous point by a straight line. canvasrenderingcontex...
... 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. ...
...remain for historical and compatibility reasons as svgmatrix objects are used in most parts of the api nowadays and will be used in the future instead. canvasrenderingcontext2d.currenttransform current transformation matrix (svgmatrix object). canvasrenderingcontext2d.gettransform retrieves the current transformation matrix being applied to the context. ...
...And 2 more matches
Using channel messaging - Web APIs
ly, passing messages between one another through two-way channels (or pipes) with a port at each end. in this article we'll explore the basics of using this technology. note: this feature is available in web workers. ...
... cases where you've got a social site that embeds capabilities from other sites into its main interface via iframes, such as games,
address book, or an audio player with personalized music choices. when these act as standalone units, things are ok, but the difficulty comes when you want interaction between the main site and the iframes, or the different iframes. for example, what if you wanted to
add a contact to the
address book from the main site,
add high scores from your game into your main profile, or
add new background music choices from the audio player onto the game? such things are not so easy using conventional web technology, because of the security models the web uses. you have to think about whether the origins trust one another, and how the messages are passed. message channels...
... use later on to display confirmation messages that we will receive back from the <iframe>. ...
...And 2 more matches
console - Web APIs
ays an interactive listing of the properties of a specified javascript object. this listing lets you use disclosure triangles to examine the contents of child objects. console.dirxml() displays an xml/html element representation of the specified object if possible or the javascript object view if it is not possible. console.error() outputs an error message. you may use string substitution and
additional arguments with this method. console.exception() an alias for error(). console.group() creates a new inline group, indenting all following output by another level. to move back out a level, call groupend(). console.groupcollapsed() creates a new inline group, indenting all following output by another level. however, unlike group() this starts with the inline group collapsed requir...
...upcollapsed() creates a new inline group, indenting all following output by another level. however, unlike group() this starts with the inline group collapsed requiring the use of a disclosure button to expand it. to move back out a level, call groupend(). console.groupend() exits the current inline group. console.info() informative logging of information. you may use string substitution and
additional arguments with this method. console.log() for general output of logging information. you may use string substitution and
additional arguments with this method. console.profile() starts the browser's built-in profiler (for example, the firefox performance tool). you can specify an optional name for the profile. console.profileend() stops the profiler. you can see the resulting pro...
...rmance tool). console.table() displays tabular data as a table. console.time() starts a timer with a name specified as an input parameter. up to 10,000 simultaneous timers can run on a given page. console.timeend() stops the specified timer and logs the elapsed time in seconds since it started. console.timelog() logs the value of the specified timer to the console. console.timestamp()
adds a marker to the browser's timeline or waterfall tool. console.trace() outputs a stack trace. console.warn() outputs a warning message. you may use string substitution and
additional arguments with this method. examples outputting text to the console the most frequently-used feature of the console is logging of text and other data. there are four categories of output you can generate, usi...
...And 2 more matches
ContentIndex - Web APIs
contentindex.delete unregisters an item from the currently indexed content. contentindex.getall returns a promise that resolves with an iterable list of content index entries. ...
...ection and interface access here we get a reference to the serviceworkerregistration, then check for the index property, which gives us access to the content index interface. // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; }
adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the
add() method to register it with the content index. // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ s...
...d() method to register it with the content index. ...
...And 2 more matches
DOMTokenList.toggle() - Web APIs
return value a boolean indicating whether token is in the list after the call. ...
... return value a boolean indicating whether token is in the list after the call. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. ...
... return value a boolean indicating whether token is in the list after the call. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then replace a token in the list, and write the list into the <span>'s node.textcontent. ...
...And 2 more matches
DataTransferItem.webkitGetAsEntry() - Web APIs
"dropzone", and an unordered list element with the id "listing". <p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here. #dropzone { text-align: center; width: 300px; height: 100px; margin: 10px; p
adding: 10px; border: 4px dashed red; border-radius: 10px; } #boxtitle { display: table-cell; vertical-align: middle; text-align: center; color: black; font: bold 2em "arial", sans-serif; width: 300px; height: 100px; } body { font: 14px "arial", sans-serif; } javascript content first, let's look at the recursive scanfiles() function. this function takes as input a filesystemen...
...contents in the next level down in the list's hierarchy. after that, 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. ...
...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. ...
...And 2 more matches
DataTransferItemList.DataTransferItem() - Web APIs
ue the datatransferitem object at the specified index in the item list. if the index is less than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. ...
...than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. ...
...st (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. javascript function dragstart_handler(ev) { console.log("dragstart"); //
add this element'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>... ...
...And 2 more matches
DataTransferItemList.length - Web APIs
length = datatransferitemlist.length; value the number of drag data items in the list, or 0 if the list is empty or disabled. the drag item list is considered to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. ...
... 0 if the list is empty or disabled. the drag item list is considered to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. ...
...ed to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. javascript function dragstart_handler(ev) { console.log("dragstart"); //
add this element'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>... ...
...And 2 more matches
DataTransferItemList.remove() - Web APIs
e drag data list to remove. if the index doesn't correspond to an existing item in the list, the list is left unchanged. return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
...he list is left unchanged. return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
... invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. javascript function dragstart_handler(ev) { console.log("dragstart"); //
add this element'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>... ...
...And 2 more matches
Document: DOMContentLoaded event - Web APIs
propriate. synchronous javascript pauses parsing of the dom. if you want the dom to get parsed as fast as possible after the user has requested the page, you can make your javascript asynchronous and optimize loading of stylesheets. if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document. ...
...ge, you can make your javascript asynchronous and optimize loading of stylesheets. if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document. examples basic usage document.
addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); delaying domcontentloaded <script> document.
addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); for( let i = 0; i < 1000000000; i++) {} // this synchronous script is going to delay parsing of the dom, // so the domcontentloaded event is going to launch later. </script> checking whether loading is already complete domcontentloaded may fire before your script has a chance to run, so it i...
...ntloaded', (event) => { console.log('dom fully loaded and parsed'); }); for( let i = 0; i < 1000000000; i++) {} // this synchronous script is going to delay parsing of the dom, // so the domcontentloaded event is going to launch later. ...
...And 2 more matches
Element.getBoundingClientRect() - Web APIs
syntax domrect = element.getboundingclientrect(); value the returned value is a domrect object which is the union of the rectangles returned by getclientrects() for the element, i.e., the css border-boxes associated with the element. ...
...ort area (or any other scrollable element) is taken into account when computing the bounding rectangle. this means that the rectangle's boundary edges (top, right, bottom, left) change their values every time the scrolling position changes (because their values are relative to the viewport and not absolute). if you need the bounding rectangle relative to the top-left corner of the document, just
add the current scrolling position to the top and left properties (these can be obtained using window.scrollx and window.scrolly) to get a bounding rectangle which is independent from the current scrolling position. cross-browser fallback scripts requiring high cross-browser compatibility can use window.pagexoffset and window.pageyoffset instead of window.scrollx and window.scrolly. scripts without...
...: document.body).scrollleft // for scrolly (((t = document.documentelement) || (t = document.body.parentnode)) && typeof t.scrolltop == 'number' ? t : document.body).scrolltop examples this simple example retrieves the domrect object representing the bounding client rect of a simple <div> element, and prints out its properties below it. ...
...And 2 more matches
Element.getClientRects() - Web APIs
e outer-<svg>'s viewbox transform, if any). originally, microsoft intended this method to return a textrectangle object for each line of text. however, the cssom working draft specifies that it returns a domrect for each border box. for an inline element, the two definitions are the same. but for a block element, mozilla will return only a single rectangle. firefox 3.5 note firefox 3.5
adds width and height properties to the textrectangle object. the amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the rectangles. the returned rectangles do not include the bounds of any child elements that might happen to overflow. for html <area> elements, svg elements that do not render anything themselves, disp...
...cond example, and around <table>, <th>, and <td> elements for the third example. strong { text-align: center; } div { display: inline-block; width: 150px; } div p, ol, table { border: 1px solid blue; } span, li, th, td { border: 1px solid green; } javascript the javascript code draws the client rects for all html elements that have css class withclientrectsoverlay assigned. function
addclientrectsoverlay(elt) { /* absolutely position a div over each client rect so that its border width is the same as the rectangle's width. note: the overlays will be out of place if the user resizes or zooms. */ var rects = elt.getclientrects(); for (var i = 0; i != rects.length; i++) { var rect = rects[i]; var tablerectdiv = document.createelement('div'); tablerectdiv...
... tablerectdiv.style.width = (rect.width - 2) + 'px'; tablerectdiv.style.height = (rect.height - 2) + 'px'; document.body.appendchild(tablerectdiv); } } (function() { /* c...
...And 2 more matches
Element: mouseenter event - Web APIs
element when the mouse exits its content area), the mouseenter event acts in a very similar way to the css :hover pseudo-class. examples the mouseover documentation has an example illustrating the difference between mouseover and mouseenter. mouseenter the following trivial example uses the mouseenter event to change the 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. #mousetarget { box-sizing: border-box; width:15rem; border:1px solid #333; } javascript var entereventcount = 0; var leaveeventcount = 0; const mousetarget = document.getel...
...t'> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the div to make it more visible. ...
...ble. ...
...And 2 more matches
Element: mouseleave event - Web APIs
o the deepest element of the dom tree, then it bubbles up the hierarchy until it is canceled by a handler or reaches the root. examples the mouseout documentation has an example illustrating the difference between mouseout and mouseleave. mouseleave the following trivial example uses the mouseenter event to change the 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. #mousetarget { box-sizing: border-box; width:15rem; border:1px solid #333; } javascript var entereventcount = 0; var leaveeventcount = 0; const mousetarget = document.get...
...> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the <div> to make it more visible. ...
...ble. ...
...And 2 more matches
Element.scrollHeight - Web APIs
nt.scrollheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overflow. the scrollheight value is equal to the minimum height the element would require in order to fit all the content in the viewport without using a vertical scrollbar. the height is measured in the same way as clientheight: it includes the element's p
adding, but not its border, margin or horizontal scrollbar (if present). it can also include the height of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax elemsc...
...:before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax elemscrollheight = element.scrollheight; value an integer corresponding to the scrollheight pixel value of the element. example p
adding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt i...
...g elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. p
adding-bottom left top right bottom margin-top margin-bottom border-top border-bottom problems and solutions determine if an element has been totally scrolled the following equivalence returns true if an element is at the end of its scroll, false if it isn't. element.scrollheight - element.scrolltop === element.clientheight when the container does not scroll, but has overflowing children, th...
...And 2 more matches
Event.eventPhase - Web APIs
scription event.none 0 no event is being processed at this time. event.capturing_phase 1 the event is being propagated through the target's ancestor objects. this process starts with the window, then document, then the htmlhtmlelement, and so on through the elements until the target's parent is reached. event listeners registered for capture mode when eventtarget.
addeventlistener() 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 ...
...hain</li> <li>click next div and repeat the experience</li> <li>change capturing mode</li> <li>repeat the experience</li> </ul> <input type="checkbox" id="chcapture" /> <label for="chcapture">use capturing</label> <div id="d1">d1 <div id="d2">d2 <div id="d3">d3 <div id="d4">d4</div> </div> </div> </div> <div id="divinfo"></div> css div { margin: 20px; p
adding: 4px; border: thin black solid; } #divinfo { margin: 18px; p
adding: 8px; background-color:white; font-size:80%; } javascript let clear = false, divinfo = null, divs = null, usecapture = false; window.onload = function () { divinfo = document.getelementbyid('divinfo') divs = document.getelementsbytagname('div') chcapture = document.getelementbyid('chcapture') c...
...n: 18px; p
adding: 8px; background-color:white; font-size:80%; } javascript let clear = false, divinfo = null, divs = null, usecapture = false; window.onload = function () { divinfo = document.getelementbyid('divinfo') divs = document.getelementsbytagname('div') chcapture = document.getelementbyid('chcapture') chcapture.onclick = function () { removelisteners()
addlisteners() } clear()
addlisteners() } function removelisteners() { for (let i = 0; i < divs.length; i++) { let d = divs[i] if (d.id != "divinfo") { d.removeeventlistener("click", ondivclick, true) d.removeeventlistener("click", ondivclick, false) } } } function
addlisteners() { for (let i = 0; i < divs.length; i++) { let d = divs[i] if (d.id != "divin...
...And 2 more matches
FileSystemDirectoryReader.readEntries() - Web APIs
"dropzone", and an unordered list element with the id "listing". <p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here. #dropzone { text-align: center; width: 300px; height: 100px; margin: 10px; p
adding: 10px; border: 4px dashed red; border-radius: 10px; } #boxtitle { display: table-cell; vertical-align: middle; text-align: center; color: black; font: bold 2em "arial", sans-serif; width: 300px; height: 100px; } body { font: 14px "arial", sans-serif; } javascript content first, let's look at the recursive scanfiles() function. this function takes as input a filesystemen...
...contents in the next level down in the list's hierarchy. after that, 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. ...
...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. ...
...And 2 more matches
HTMLElement: transitionrun event - Web APIs
the transitionrun event is fired when a css transition is first created, i.e. before any transition-delay has begun. ...
... the transitionrun event is fired when a css transition is first created, i.e. before any transition-delay has begun. ...
...bbles yes cancelable no interface transitionevent event handler property ontransitionrun examples this code
adds a listener to the transitionrun event: el.
addeventlistener('transitionrun', () => { console.log('transition is running but hasn\'t necessarily started transitioning yet'); }); the same, but using the ontransitionrun property instead of
addeventlistener(): el.ontransitionrun = () => { console.log('transition started running, and will start transitioning when the transition delay has expired'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 1...
...And 2 more matches
HTMLElement: transitionstart event - Web APIs
the transitionstart event is fired when a css transition has actually started, i.e., after any transition-delay has ended. ...
... the transitionstart event is fired when a css transition has actually started, i.e., after any transition-delay has ended. ...
...nsition-delay has ended. ...
...And 2 more matches
HTMLMediaElement - Web APIs
the htmlmediaelement interface
adds to htmlelement the properties and methods needed to support basic media-related capabilities that are common to audio and video. the htmlvideoelement and htmlaudioelement elements both inherit this interface. ...
... the htmlmediaelement interface
adds to htmlelement the properties and methods needed to support basic media-related capabilities that are common to audio and video. the htmlvideoelement and htmlaudioelement elements both inherit this interface. ...
...been implemented for firefox os, and was removed in firefox 55. htmlmediaelement.onmozinterruptend sets the eventhandler called when the interruption is concluded. this was firefox-specific, having been implemented for firefox os, and was removed in firefox 55. methods this interface also inherits methods from its ancestors htmlelement, element, node, and eventtarget. htmlmediaelement.
addtexttrack()
adds a text track (such as a track for subtitles) to a media element. htmlmediaelement.capturestream() returns mediastream, captures a stream of the media content. htmlmediaelement.canplaytype() given a string specifying a mime media type (potentially with the codecs parameter included), canplaytype() returns the string probably if the media should be playable, maybe if there's ...
...And 2 more matches
Recommended Drag Types - Web APIs
only work with gecko-based browsers. dragging text for dragging text, use the text/plain type. the second data parameter should be the dragged string. for example: event.datatransfer.setdata("text/plain", "this is text to drag"); dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself. it is recommended to always
add data of the text/plain type as a fallback for applications or drop targets that do not support other types, unless there is no logical text alternative. always
add this text/plain type last, as it is the least specific and shouldn’t be preferred. note: in older code, you may find text/unicode or the text types. these are equivalent to text/plain, and will store and retrieve plain text data. d...
...but no comments. for example, this sample text/uri-list data contains two links and a comment: http://www.mozilla.org #a second link http://www.example.com when retrieving a dropped link, ensure you handle when multiple links are dragged, including any comments. for convenience, the special type url may be used to refer to the first valid link within data for the text/uri-list type. do not
add data with the url type — attempting to do so will set the value of the text/uri-list type instead. var url = event.datatransfer.getdata("url"); you may also see data with the mozilla-specific type text/x-moz-url. if it appears, it should appear before the text/uri-list type. it holds the urls of links followed by their titles, separated by a linebreak. for example: http://www.mozilla.org m...
...ot retrieve or modify data of this type. because a file is not a string, you must use the mozsetdataat() method to assign the data. similarly, when retrieving the data, you must use the mozgetdataat() method. event.datatransfer.mozsetdataat("application/x-moz-file", file, 0); if possible, include the file url of the file using both the text/uri-list and text/plain types. these types should be
added afterward so that the more specific application/x-moz-file type has higher priority. multiple files will be received during a drop as multiple items in the data transfer. see dragging and dropping multiple items for more details about this. the following example shows how to create an area for receiving dropped files: <listbox ondragenter="return checkdrag(event)" ondragover="return...
...And 2 more matches
Headers - Web APIs
for security reasons, some headers can only be controlled by the user agent. ...
... for security reasons, some headers can only be controlled by the user agent. ...
...directly be used in a for...of structure, instead of entries(): for (var p of myheaders) is equivalent to for (var p of myheaders.entries()). note: you can find more out about the available headers by reading our http headers reference. constructor headers() creates a new headers object. methods headers.append() appends a new value onto an existing header inside a headers object, or
adds the header if it does not already exist. headers.delete() deletes a header from a headers object. headers.entries() returns an iterator allowing to go through all key/value pairs contained in this object. headers.foreach() executes a provided function once for each array element. headers.get() returns a bytestring sequence of all the values of a header within a headers object with a give...
...And 2 more matches
IDBDatabase: error event - Web APIs
the error event is fired on idbdatabase when a request returns an error and the event bubbles up to the connection object. ...
... the error event is fired on idbdatabase when a request returns an error and the event bubbles up to the connection object. ...
...', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2020 }; const db = dbopenrequest.result; db.
addeventlistener('error', () => { console.log(`error
adding new item: ${newitem.tasktitle}`); }); // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); const objectstore = transaction.objectstore('todolist'); const objectstorerequest = objectstore.
add(newitem); }; the same example, using the onerror property inst...
...And 2 more matches
IDBObjectStore - Web APIs
this object store. if this attribute is null, the application must provide a key for each modification operation. idbobjectstore.name the name of this object store. idbobjectstore.transaction read only the idbtransaction object to which this object store belongs. idbobjectstore.autoincrement read only the value of the auto increment flag for this object store. methods idbobjectstore.
add() returns an idbrequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. this is for
adding new records to an object store. idbobjectstore.clear() creates and immediately returns an idbrequest object, and clears this object store in a separate thread. this is for deleting all current records out of an object store. id...
...d, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. this is for updating existing records in an object store when the transaction's mode is readwrite. example this example shows a variety of different uses of object stores, from updating the data structure with idbobjectstore.createindex inside an onupgradeneeded function, to
adding a new item to our object store with idbobjectstore.
add. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in db. db = dbopenreques...
...store.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object store created.</li>'; }; // create a new item to
add in to the object store var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: 'december', year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for
adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { ...
...And 2 more matches
IDBTransaction: complete event - Web APIs
the complete handler is executed when a transaction successfully completed. ...
...{ 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 => { const db = dbopenrequest.result; // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); //
add a listener for `complete` transaction.
addeventlistener('complete', event => { console.log('transaction was competed'); }); const objectstore = transaction.objectstore('todolist'); const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2019 }; const object...
...ction = db.transaction(['todolist'], 'readwrite'); //
add a listener for `complete` transaction.
addeventlistener('complete', event => { console.log('transaction was competed'); }); const objectstore = transaction.objectstore('todolist'); const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2019 }; const objectstorerequest = objectstore.
add(newitem); }; using the oncomplete property: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitl...
...And 2 more matches
IDBTransaction: error event - Web APIs
the error event is fired on idbtransaction when a request returns an error and the event bubbles up to the transaction object. ...
... the error event is fired on idbtransaction when a request returns an error and the event bubbles up to the transaction object. ...
...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) => { const db = dbopenrequest.result; // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); transaction.
addeventlistener('error', () => { console.log(`error
adding new item: ${newitem.tasktitle}`); }); const objectstore = transaction.objectstore('todolist'); const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2020 }; const objectstorerequest = object...
...And 2 more matches
MediaDevices.getUserMedia() - Web APIs
: true } if true is specified for a media type, the resulting stream is required to have that type of track in it. if one cannot be included for any reason, the call to getusermedia() will result in an error. while information about a user's cameras and microphones are inaccessible for privacy reasons, an application can request the camera and microphone capabilities it needs and wants, using
additional constraints. the following expresses a preference for 1280x720 camera resolution: { audio: true, video: { width: 1280, height: 720 } } the browser will try to honour this, but may return other resolutions if an exact match is not available, or the user overrides it. to require a capability, use the keywords min, max, or exact (a.k.a. min == max). the following demands a minimum r...
...tion 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, preventing 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 grants permission for a given <iframe> to do so using feature policy. otherwise, the user will never even be asked for permission to use the input devices. for ...
...ition, 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 grants permission for a given <iframe> to do so using feature policy. otherwise, the user will never even be asked for permission to use the input devices. for
additional details on these requirements and rules, how they are reflected in the context in which your code is running, and about how browsers manage user privacy and security issues, read on. user privacy as an api that may involve significant privacy concerns, getusermedia() is held by the specification to very specific requirements for user notification and permission management. first, getuser...
...And 2 more matches
MouseEvent - Web APIs
from uievent, which in turn derives from event. though the mouseevent.initmouseevent() method is kept for backward compatibility, creating of a mouseevent object should be done using the mouseevent() constructor. several more specific events are based on mouseevent, including wheelevent and dragevent. ...
...ey was down when the mouse event was fired. mouseevent.movementx read only the x coordinate of the mouse pointer relative to the position of the last mousemove event. mouseevent.movementy read only the y coordinate of the mouse pointer relative to the position of the last mousemove event. mouseevent.offsetx read only the x coordinate of the mouse pointer relative to the position of the p
adding edge of the target node. mouseevent.offsety read only the y coordinate of the mouse pointer relative to the position of the p
adding edge of the target node. mouseevent.pagex read only the x coordinate of the mouse pointer relative to the whole document. mouseevent.pagey read only the y coordinate of the mouse pointer relative to the whole document. mouseevent.region read only re...
... working draft redefines mouseevent from long to double. this means that a pointerevent whose pointertype is mouse will be a double. pointer lockthe definition of 'mouseeven...
...And 2 more matches
PaymentDetailsUpdate - Web APIs
ist below. displayitems optional an array of paymentitem objects, each describing one line item for the payment request. these represent the line items on a receipt or invoice. error optional a domstring specifying an error message to present to the user. when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message. ...
...ray of paymentitem objects, each describing one line item for the payment request. these represent the line items on a receipt or invoice. error optional a domstring specifying an error message to present to the user. when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message. for
address field specific errors, use shipping
addresserrors. ...
... shippingoptions optional an array of paymentshippingoption objects, each describing one available shipping option from which the user may choose. ...
...And 2 more matches
PaymentRequest.PaymentRequest() - Web APIs
ntifier for this payment request. if a value is not supplied, the browser will construct one. displayitems an array of optional line items for the payment request that the user agent may display, such as product details, tax, and shipping. shippingoptions the shipping options the user may choose from. ...
...hippingoptions the shipping options the user may choose from. if this sequence is blank, it indicates the merchant cannot ship to the current shipping
address. the default shipping option may be indicated in this sequence. modifiers modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. this parameter contains the following fields:
additionaldisplayitems an array of items to be appended to the details.displayitems property. this property is commonly used to
add a discount or surcharge line item indicating the different amount in details.modifiers.total. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to conform to the structure defined i...
...ating the different amount in details.modifiers.total. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to conform to the structure defined in the basiccardrequest dictionary. total a total amount for the payment request that overrides value in details.total. this is typically used when details.modifiers.
additionalitems
adds a discount or a surchase to the request. options optional lets you set options that control the behavior of the user agent. this parameter contains the following fields: requestpayername a boolean indicating whether the user agent should collect the payer's name and submit it with the payment request. the default is false. requestpayeremail a boolean indic...
...And 2 more matches
PaymentRequestUpdateEvent.updateWith() - Web APIs
t request: displayitems optional an array of paymentitem objects, each describing one line item for the payment request. these represent the line items on a receipt or invoice. error optional a domstring specifying an error message to present to the user. when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message. ...
...ray of paymentitem objects, each describing one line item for the payment request. these represent the line items on a receipt or invoice. error optional a domstring specifying an error message to present to the user. when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message. for
address field specific errors, use shipping
addresserrors. ...
... shippingoptions optional an array of paymentshippingoption objects, each describing one available shipping option from which the user may choose. ...
...And 2 more matches
Payment Request API - Web APIs
browser controls the input elements of the payment sheet, it can assure consistent keyboard and screen reader accessibility on every website without developers needing to do anything. a browser could also adjust the font size or color contrast of the payment sheet, making it more comfortable for the user to make a payment. credentials management: users can manage their credit cards and shipping
addresses directly in the browser. a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things. consistent error handling: the browser can check the validity of card numbers, and can tell the user if a card has expired (or is about to expire). the browser can automatically suggest which card to use based on pas...
... as clicking a "purchase" button. the paymentrequest allows the web page to exchange information with the user agent while the user provides input to complete the transaction. you can find a complete guide in using the payment request api. note: the api is available inside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them. interfaces payment
address an object that contains
address information; used for billing and shipping
addresses, for example. paymentrequest an object that provides the api for creating and managing the user agent's payment interface. paymentrequestevent an event delivered to a payment handler when a paymentrequest is made. paymentrequestupdateevent enables the web page to update the details of the payment reque...
...ayment instrument (e.g., switching from a credit card to debit card). paymentresponse an object returned after the user selects a payment method and approves a payment request. merchantvalidationevent represents the browser requiring the merchant (website) to validate themselves as allowed to use a particular payment handler (e.g., registered as allowed to use apple pay). dictionaries
addresserrors a dictionary containing strings providing descriptive explanations of any errors in any payment
address entries which have errors. payererrors a dictionary containing strings providing descriptive explanations of any errors in related to paymentresponse's email, phone, and name attributes. paymentdetailsupdate an object describing changes that need to be made to the payment details ...
...And 2 more matches
RTCConfiguration - Web APIs
rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance. although only one certificate is used by a given connection, providing certificates for multiple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for
additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconnection.setconfiguration(). icecandidatepoolsize optional an unsigned 16-bit integer value which specifies the size of the prefetched ice candidate pool. the default value is 0 (meaning no candidate prefetching...
...lly are closed at that point. note: in technical terms, a bundle lets all media flow between two peers flow across a single 5-tuple; that is, from a single ip and port on one peer to a single ip and port on the other peer, using the same transport protocol. constant description "balanced" the ice agent initially creates one rtcdtlstransport for each type of content
added: audio, video, and data channels. if the remote endpoint is not bundle-aware, then each of these dtls transports then handles all the communication for one type of data. "max-compat" the ice agent initially creates one rtcdtlstransport per media track and a separate one for data channels. if the remote endpoint is not bundle-aware, everything is negotiated on these separate dtls tra...
...be negotiated and the rest ignored. 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 public ip
addresses will be considered. removed from the specification's may 13, 2016 working draft. "relay" only ice candidates whose ip
addresses are being relayed, such as those being passed through a turn server, will be considered. rtcrtcpmuxpolicy enum the rtcrtcpmuxpolicy enum defines string constants which specify what ice candidates are gathered to support non-multiplexed rtcp. <<<...
...And 2 more matches
RTCIceCandidate - Web APIs
e. when starting a webrtc peer connection, typically a number of candidates are proposed by each end of the connection, until they mutually agree upon one which describes the connection they decide will be best. webrtc then uses that candidate's details to initiate the connection. for details on how the ice process works, see lifetime of a webrtc session. the article webrtc connectivity provides
additional useful details. constructor rtcicecandidate() creates an rtcicecandidate object to represent a single ice candidate, optionally configured based on an object based on the rtcicecandidateinit dictionary. note: for backward compatibility, the constructor also accepts as input a string containing the value of the candidate property instead of a rtcicecandidateinit object, since the cand...
... on an object based on the rtcicecandidateinit dictionary. note: for backward compatibility, the constructor also accepts as input a string containing the value of the candidate property instead of a rtcicecandidateinit object, since the candidate includes all of the information that rtcicecandidateinit does and more. properties candidate read only a domstring representing the transport
address for the candidate that can be used for connectivity checks. the format of this
address is a candidate-attribute as defined in rfc 5245. this string is empty ("") if the rtcicecandidate is an "end of candidates" indicator. component read only a domstring which indicates whether the candidate is an rtp or an rtcp candidate; its value is either "rtp" or "rtcp", and is derived from the "compo...
...ates whether the candidate is an rtp or an rtcp candidate; its value is either "rtp" or "rtcp", and is derived from the "component-id" field in the candidate a-line string. the permitted values are listed in the rtcicecomponent enumerated type. foundation read only returns a domstring containing a unique identifier that is the same for any candidates of the same type, share the same base (the
address from which the ice agent sent the candidate), and come from the same stun server. this is used to help optimize ice performance while prioritizing and correlating candidates that appear on multiple rtcicetransport objects. ip read only a domstring containing the ip
address of the candidate. port read only an integer value indicating the candidate's port number. priority read only a l...
...And 2 more matches
Sensor APIs - Web APIs
at sensor works, if it's still connected, or even whether the user has granted access to it. making all this information consistently available is costly to performance and battery life. therefore, feature detection for sensor apis must include both detection of the apis themselves and defensive programming strategies (see below). the examples below show three methods for detecting sensor apis.
additionally you can put object instantiation inside a try...catch block. notice that detection through the navigator interface is not one of the available options. if (typeof gyroscope === "function") { // run in circles... } if ("proximitysensor" in window) { // watch out! } if (window.ambientlightsensor) { // go dark... } defensive programming as stated in feature detection, check...
...e sensor type isn't supported by the device. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. ...
... if (error.name === 'securityerror') { // see the note above about feature policy. ...
...And 2 more matches
Storage Access API - Web APIs
cies are known to break embedded cross-origin content that requires access to its first-party storage. as an example, federated logins often require access to authentication cookies stored in first-party storage, and will require the user to sign in on each site separately (or completely break) if those cookies are not available. in the case of breakage, site owners have often encouraged users to
add their site as an exception or to disable the policy entirely. as a consequence, users who wish to continue to interact with embedded content are forced to greatly relax their blocking policy for resources loaded from all embedded origins and possibly across all websites. the storage access api is intended to solve this problem; embedded cross-origin content can request unrestricted access to its...
...ing policy for resources loaded from all embedded origins and possibly across all websites. the storage access api is intended to solve this problem; embedded cross-origin content can request unrestricted access to its first-party storage on a site-by-site basis via the document.requeststorageaccess() method, and check whether it already has access via the document.hasstorageaccess() method. ...
...intended to solve this problem; embedded cross-origin content can request unrestricted access to its first-party storage on a site-by-site basis via the document.requeststorageaccess() method, and check whether it already has access via the document.hasstorageaccess() method. in
addition, sandboxed <iframe>s cannot be granted storage access by default for security reasons. the api therefore also
adds the allow-storage-access-by-user-activation sandbox token. ...
...And 2 more matches
ValidityState.typeMismatch - Web APIs
ect indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's type attribute. if the type attribute expects specific strings, such as the email and url types and the value don't doesn't conform to the constraints set by the type, the typemismatch property will be true. the email input type expects one or more valid email
addresses, depending on whether the multiple attribute is present. a valid email
address includes an email prefix and a domain, with or without a top level domain. if the value of the email input is not an empty string, a single valid e-mail
address, or one or more comma separated email
address if the multiple attribute is present, there is a typemismatch. the url input type expects one or more vali...
...with or without a top level domain. if the value of the email input is not an empty string, a single valid e-mail
address, or one or more comma separated email
address if the multiple attribute is present, there is a typemismatch. the url input type expects one or more valid email urls, depending on whether the multiple attribute is present. a valid url includes a protocol, optionally with an ip
address, or an optional subdomain, domain, and top level domain combination. if the value of the url input is not an empty string, a single valid url, or one or more comma separated urls if the multiple attribute is present, there is a typemismatch. ...
...ocol, optionally with an ip
address, or an optional subdomain, domain, and top level domain combination. if the value of the url input is not an empty string, a single valid url, or one or more comma separated urls if the multiple attribute is present, there is a typemismatch. ...
...And 2 more matches
WebGLRenderingContext.blendEquation() - Web APIs
gcontext.blendequation() method of the webgl api is used to set both the rgb blend 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. ...
...ation 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: gl.func_
add exception if mode is not one of the three possible values, a gl.invalid_enum error is thrown. return value none. ...
... 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: 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. ...
...And 2 more matches
Hello vertex attributes - Web APIs
orld 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. ...
...nd sending data to gpu. ...
.../x-vertex" id="vertex-shader"> #version 100 precision highp float; attribute float position; void main() { gl_position = vec4(position, 0.0, 0.0, 1.0); gl_pointsize = 64.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 precision mediump float; void main() { gl_fragcolor = vec4(0.18, 0.54, 0.34, 1.0); } </script> ;(function(){ "use strict" window.
addeventlistener("load", setupwebgl, false); var gl, program; function setupwebgl (evt) { window.removeeventlistener(evt.type, setupwebgl, false); if (!(gl = getrenderingcontext())) return; var source = document.queryselector("#vertex-shader").innerhtml; var vertexshader = gl.createshader(gl.vertex_shader); gl.shadersource(vertexshader,source); gl.compileshader(vertexshader); sou...
...And 2 more matches
Scissor animation - Web APIs
var gl, color = getrandomcolor(), position; function setupanimation (...
...var gl, color = getrandomcolor(), position; function setupanimation (evt) { window.removeeventlistener(evt.type, setupanimation, false); if (!(gl = getrenderingcontext())) return; gl.enabl...
...animation</button> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; p
adding : 0; border : none; background-color : black; } button { display : block; font-size : inherit; margin : auto; p
adding : 0.6em; } ;(function(){ "use strict" window.
addeventlistener("load", setupanimation, false); // variables to hold the webgl context, and the color and // position of animated squares. var gl, color = getrandomcolor(), position; function setupanimation (evt) { window.removeeventlistener(evt.type, setupanimation, false); if (!(gl = getrenderingcontext())) return; gl.enable(gl.scissor_test); gl.clearcolor(color[0], color[1], col...
...And 2 more matches
Using textures in WebGL - Web APIs
viousnext » now that our sample program has a rotating 3d cube, let's map a texture onto it instead of having its faces be solid colors. 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. see cross-domain textures below for det...
...pping (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 above configuration, webgl requires all samples of npot textures to fail by returning transparent black: rgba(0,0,0,0). to load the image,
add a call to our loadtexture() 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 c...
...main(void) { gl_fragcolor = texture2d(usampler, vtexturecoord); } `; instead of assigning a color value to the fragment's color, the fragment's color is computed by fetching the texel (that is, the pixel within the texture) based on the value of vtexturecoord which like the colors is interpolated bewteen vertices. ...
...And 2 more matches
Taking still photos with WebRTC - Web APIs
ence to the <canvas> element after the page is done loading. photo this will be a reference to the <img> element after the page is done loading. startbutton this will be a reference to the <button> element that's used to trigger capture. we'll get that after the page is done loading. the startup() function the startup() function is run when the page has finished loading, courtesy of window.
addeventlistener(). this function's job is to request access to the user's webcam, initialize the output <img> to a default state, and to establish the event listeners needed to receive each frame of video from the camera and react when the button is clicked to capture an image. getting element references first, we grab references to the major elements we need to be able to access. function star...
... the error callback is called if opening the stream doesn't work. this will happen for example if there's no compatible camera connected, or the user denied access. listen for the video to start playing after calling htmlmediaelement.play() on the <video>, there's a (hopefully brief) period of time that elapses before the stream of video begins to flow. ...
...lement.play() on the <video>, there's a (hopefully brief) period of time that elapses before the stream of video begins to flow. to avoid blocking until that happens, we
add an event listener to video for the canplay event, which is delivered when the video playback actually begins. at that point, all the properties in the video object have been configured based on the stream's format. ...
...And 2 more matches
Using WebRTC data channels - Web APIs
once you've established a webrtc peer connection using the rtcpeerconnection interface, you're able to send and receive media data between the two peers on the connection. but there's a lot more you can do with webrtc. in this guide, we'll examine how to
add a data channel to a peer connection, which can then be used to securely exchange arbitrary data; that is, any kind of data we wish, in any format we choose. since all webrtc components are required to use encryption, any data transmitted on an rtcdatachannel is automatically secured using datagram transport layer security (dtls). see security below for more information. creating a data channel the underlying data transport used by the rtcdatachannel can be created in one of two ways: let webrtc create the transport and announce...
...ndle the negotiations for you, causing the remote peer to create a data channel and linking the two together across the network. the rtcdatachannel object is returned immediately by createdatachannel(); you can tell when the connection has been made successfully by watching for the open event to be sent to the rtcdatachannel. let datachannel = pc.createdatachannel("myapp channel"); datachannel.
addeventlistener("open", (event) => { begintransmission(datachannel); }); manual negotiation to manually negotiate the data channel connection, you need to first create a new rtcdatachannel object using the createdatachannel() method on the rtcpeerconnection, specifying in the options a negotiated property set to true. this signals to the peer connection to not attempt to negotiate the channel o...
...behalf. then negotiate the connection out-of-band, using a web server or other means. this process should signal to the remote peer that it should create its own rtcdatachannel with the negotiated property also set to true, using the same id. this will link the two objects across the rtcpeerconnection. let datachannel = pc.createdatachannel("myapp channel", { negotiated: true }); datachannel.
addeventlistener("open", (event) => { begintransmission(datachannel); }); requestremotechannel(datachannel.id); in this code snippet, the channel is created with negotiated set to true, then a function called requestremotechannel() is used to trigger negotiation, to create a remote channel with the same id as the local channel. doing this lets you create data channels with each peer using differ...
...And 2 more matches
Using the Web Storage API - Web APIs
g storageavailable('sessionstorage'). see here for a brief history of feature-detecting localstorage. example to illustrate some typical web storage usage, we have created an example, imaginatively called web storage demo. the landing page provides controls that can be used to customize the color, font, and decorative image: when you choose different options, the page is instantly updated; in
addition, your choices are stored in localstorage, so that when you leave the page and load it again, later on, your choices are remembered. we have also provided an event output page — if you load this page in another tab, then make changes 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...
...if there are already values there, we run setstyles() to update the page styling with the stored values. note: you could also use storage.length to test whether the storage object is empty or not. getting values from storage as noted above, values can be retrieved from storage using storage.getitem(). this takes the key of the data item as an a...
...s made to the storage object (note that this event is not fired for sessionstorage changes). this won't work on the same page that is making the changes — it is really a way for other pages on the domain using the storage to sync any changes that are made. pages on other domains can't access the same storage objects. ...
...And 2 more matches
Window.devicePixelRatio - Web APIs
/retina displays. other values may be returned as well in the case of unusually low resolution displays or, more often, when a screen has a higher pixel depth than simply double the standard resolution of 96 or 76 dpi. examples correcting resolution in a <canvas> a <canvas> can appear too blurry on retina screens. use window.devicepixelratio to determine how much extra pixel density should be
added to allow for a sharper image. html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // set display size (css pixels). var size = 200; canvas.style.width = size + "px"; canvas.style.height = size + "px"; // set actual size in memory (scaled to account for extra pixel density). var scale = window.devicepixelratio; /...
...checks the value of devicepixelratio any time it changes. let pixelratiobox = document.queryselector(".pixel-ratio"); let mqstring = `(resolution: ${window.devicepixelratio}dppx)`; const updatepixelratio = () => { let pr = window.devicepixelratio; let prstring = (pr * 100).tofixed(0); pixelratiobox.innertext = `${prstring}% (${pr.tofixed(2)})`; } updatepixelratio(); matchmedia(mqstring).
addlistener(updatepixelratio); the string mqstring is set up to be the media query itself. the media query, which begins as (resolution: 1dppx) (for standard displays) or (resolution: 2dppx) (for retina/hidpi displays), checks to see if the current display resolution matches a specific number of device dots per px. the updatepixelratio() function fetches the current value of devicepixelratio, the...
... px. the updatepixelratio() function fetches the current value of devicepixelratio, then sets the innertext of the element pixelratiobox to a string which displays the ratio both as a percentage and as a raw decimal value with up to two decimal places. then the updatepixelratio() function is called once to display the starting value, after which the media query is created using matchmedia() and
addeventlistener() is called to set up updatepixelratio() as a handler for the change event. html the html creates the boxes containing the instructions and the pixel-ratio box that will display the current pixel ratio information. <div class="container"> <div class="inner-container"> <p>this example demonstrates the effect of zooming the page in and out (or moving it to a screen with...
...And 2 more matches
Window.openDialog() - Web APIs
window.opendialog() is an extension to window.open(). it behaves the same, except that it can optionally take one or more parameters past windowfeatures, and windowfeatures itself is treated a little differently. the optional parameters, if present, are bundled up in a javascript array object and
added to the newly created window as a property named window.arguments. they may be referenced in the javascript of the window at any time, including during the execution of a load handler. these parameters may be used, then, to pass arguments to and from the dialog window. the call to opendialog() returns immediately. if you want the call to block until the user has closed the dialog, supply modal as a windowfeatures parameter. note that this also means the user won't be able to interac...
...to select the chrome that best fits a dialog on that operating system. passing extra parameters to the dialog to pass extra parameters into the dialog, you can simply supply them after the windowfeatures parameter: opendialog("http://example.tld/zzz.xul", "dlg", "", "pizza", 6.98); the extra parameters will then get packed into a property named arguments of type array, and this property gets
added to the newly opened dialog window. to access these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). returning values from the dialog since window.close() erases all properties associated with the dialog wind...
...ot possible to pass return values back past the close operation using globals (or any other constructs). to be able to pass values back to the caller, you have to supply some object via the extra parameters. you can then access this object from within the dialog code and set properties on it, containing the values you want to return or preserve past the window.close() operation. ...
...And 2 more matches
Using the group role - Accessibility
has on browsers and assistive technology. the group role is used to identify a set of user interface objects which, in contrast with a region, are not intended to be included in a table of contents or a page summary (such as the structures that are dynamically created by a script or assistive technologies); a group should not be considered a major perceivable section on a page. when the role is
added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. a group should be used to form a logical collection of items with related functionality, such as children in a tree widget forming a collection of siblings in a hierarchy, or a collection of items having the same container in a directory. however, when a ...
...lements may be nested. proper handling of a group by assistive technologies is determined by the context in which it is provided. if an author believes a section is significant enough to warrant inclusion in the page's table of contents, they should assign the section a role of region or a standard landmark role. possible effects on user agents and assistive technology when the group role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a group role in the operating system's accessibility api. fire an accessible group event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers sh...
...ription may be spoken. following this the focused control may be announced. screen magnifiers may enlarge the group. note: opinons 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: using the group role with a html tree view the snippet below shows how the group role is
added directly into the html source code. <div id="tree1" role="tree" tabindex="-1"> <div id="animals" class="groupheader" role="presentation" aria-owns="animalgroup" aria-expanded="true"> <img role="presentation" tabindex="-1" src="images/treeexpanded.gif" /> <span role="treeitem" tabindex="0">animals</span> </div> <div id="animalgroup" role="group"> <div id="birds" role="treeite...
...And 2 more matches
Using the link role - Accessibility
this technique demonstrates how to use the link role and describes the effect it has on browsers and assistive technology. the link role is used to identify an element that creates a hyperlink to a resource that is in the application or external. when this role is
added to an element, tab can be used to change focus to the link, and enter used to execute the link. note: where possible, it is recommended that you use a native <a> element rather than the link role, as native elements are more widely supported by older user agents and assistive technology. native <a> elements also support keyboard and focus requirements by default, without need for
additional customization. the tabindex attribute may optionally be used with this role to directly specify the position of the element in ...
... more widely supported by older user agents and assistive technology. native <a> elements also support keyboard and focus requirements by default, without need for
additional customization. the tabindex attribute may optionally be used with this role to directly specify the position of the element in the tab order. possible effects on user agents and assistive technology when the link role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a link role in the operating system's accessibility api. fire an accessible link event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers shoul...
...nk"]:focus { outline: 1px dotted black; } javascript const spanelem = document.queryselector('span'); //handles clicks and keydowns on the link function navigatelink(e) { if (e.type === 'click' || e.key === 'enter') { let ref = e.target != null ? ...
...And 2 more matches
Using the status role - Accessibility
description this technique demonstrates how to use the status role and describes the effect it has on browsers and assistive technology. the status role is a type of live region and a container whose content is advisory information for the user that is not important enough to justify an alert, and is often presented as a status bar. when the role is
added to an element, the browser will send out an accessible status event to assistive technology products which can then notify the user about it. status information content must be provided within a status object, and it should be ensured that this object does not receive focus. if another part of the page controls what appears in the status, the relationship should be made explicit via the aria-controls attribute. assistive technolo...
...hin a status object, and it should be ensured that this object does not receive focus. if another part of the page controls what appears in the status, the relationship should be made explicit via the aria-controls attribute. assistive technologies may reserve some cells of a braille display to render the status. possible effects on user agents and assistive technology when the status role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a status role in the operating system's accessibility api. fire an accessible status event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers ...
...y status live region. these should be announced when the user is idle, unless aria-live=”assertive” has been set and in which case the user may be interrupted. screen magnifiers may enlarge the status. note: opinons 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:
adding the status role in html the snippet below shows how the status role is
added directly into the html source code. <p role="status">your changes were automatically saved.</p> working 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 compatibi...
...And 2 more matches
ARIA: alert role - Accessibility
the alert role can be used to tell the user an element has been dynamically updated. screen readers will instantly start reading out the updated content when the role is
added. if the user is expected to close the alert, then the alertdialog role should be used instead. description one of the five live region roles, the alert role is used to provide the user with important, and usually time-sensitive, information, and often to tell the user an element has been dynamically updated. the alert role is
added to the node containing an alert message, not the element causing the alert to be triggered. alerts are assertive live regions. setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". they don't receive focus, and therefore focus does not need to be mana...
...egions. setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". they don't receive focus, and therefore focus does not need to be managed and no user interaction should be required. the most important thing to know about the alert role is that it is for dynamic content. ...
...when the display value is changed with css or javascript, it would automatically trigger the screen reader to read out the content. ...
...And 2 more matches
ARIA: switch role - Accessibility
the user clicks on the switch widget, a click event is fired, which must be handled in order to change the state of the widget. changing the aria-checked attribute when a click event is fired on the switch widget, the handler must change the value of the aria-checked attribute from true to false, or vice versa. possible effects on user agents and assistive technology when the switch role is
added to an element, the user agent handles it like this: 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 ...
...ng the following: screen readers should announce the element as a switch, optionally providing instructions as to how to activate the switch. there are varying opinions on how assistive technologies should handle this role; the above is a suggested practice and may differ from other sources. examples the following examples should help you understand how to apply and use the switch role.
adding the switch role in aria this simple example just creates a widget and assigns the aria switch role to it. the button is styled with an appearance reminiscent of an on/off power switch. html the html is fairly simple here. the switch is implemented as a <button> element which is initially checked courtesy of its aria-checked attribute being set to "true". the switch has two child elements co...
...r" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="switch">speaker power</label> javascript this javascript code defines and applies a function to handle click events on switch widgets. the function changes the aria-checked attribute from true to false, or vice versa. document.queryselectorall(".switch").foreach(function(theswitch) { theswitch.
addeventlistener("click", handleclickevent, false); }); function handleclickevent(evt) { let el = evt.target; if (el.getattribute("aria-checked") == "true") { el.setattribute("aria-checked", "false"); } else { el.setattribute("aria-checked", "true"); } } css the purpose of the css is to establish a look and feel for the switch that's reminiscent of the power switch paradigm. ...
...And 2 more matches
ARIA: table role - Accessibility
ucture with rows containing cells. the cells are not focusable or selectable, though widgets within individual cells of the table can be interactive. using a native html table element whenever possible is strongly encouraged. if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead. to create an aria table,
add role="table" to the container element. within that container, each row has role="row" set and contains child cells. each cell has a role of either columnheader, rowheader, or simply cell. rows can be children of the table or within a rowgroup. the table caption can be defined via aria-labelledby or aria-label. all other semantic table elements, such as <tbody>, <thead>, <tr>, <th>, and <td> nee...
...able" to the container element. within that container, each row has role="row" set and contains child cells. each cell has a role of either columnheader, rowheader, or simply cell. rows can be children of the table or within a rowgroup. the table caption can be defined via aria-labelledby or aria-label. all other semantic table elements, such as <tbody>, <thead>, <tr>, <th>, and <td> need to be
added via associated roles, such as rowgroup, row, columnheader, and cell. if the table contains sortable columns or rows, the aria-sort attribute should be
added on the header cell element (not the table itself). if any rows or columns are hidden, the aria-colcount or aria-rowcount should be included indicating the total number of columns or rows, respectively, along with the aria-colindex or aria-...
...e full table. set the value to the total number of rows in the full table. if unknown, set aria-colcount="-1". keyboard interactions none required javascript features none. for sortable columns, see the columnheader aria role. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and
adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. examples <div role="table" aria-label="semantic elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgro...
...And 2 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
onverts colors for you is tom jewett's "mini color selector" with hsl, rgb, hex options for checking contrast in the browser. luminance and contrast contrast contrast between colors ("hues") is a critical component, but the use of color ("hues") alone is not enough to create accessible content. as mentioned before, any calculation of contrast must include luminance in the calculation. in
addition, the "shape" of the text itself will matter. thin letters will be harder to read than thick ones; all type faces need space to "breathe" for human perception. in general, for accessibility purposes, the more contrast the better. that changes with animation. "safer" animation means images with less contrast, not more. for more on color contrast in animation, see three flashes or below thr...
...ated red of hex value #ff3300 has an rgb value of rgb(255, 51,0). a different saturated red with a hex value of #ff0000 has an rgb value of rgb(255, 0,0). both are "saturated" reds. they are two different "hues", but are both considered to be a saturated color. saturation is not brightness. brightness refers to how much white or black is mixed in with a color. one can decrease saturation by
adding white, black, or gray to the color; to take the example further, brightness can be increased by
adding the color white, which also reduces saturation. a common example is to
add white to red to get the color pink. pink is considered a desaturated red. saturation and luminance there is a loss of saturation at the extremes of luminance, at the extremes of black and white. nasa's article, lum...
...king at the image below to illustrate the concept of saturation in a color. wikimedia commons provides a great image for illustrating red saturation. it's the same "color" going from least saturated on the left hand side to most saturated on the right hand side. (thanks to the author, datumizer, for this example) more than one "red" color may be considered a "saturated" red. for example, in
addition to the color #990000 described above, the color #8b0000 also has a saturation of 100%. not all saturated reds may be represented well in the rgb spectrum, or other spectrums commonly used in web development. according to wikipedia's page on "shades of red", the color "carmine" is a saturated red in which, in its pigment form, mostly contains the red light with wavelengths longer than 600n...
...And 2 more matches
:disabled - CSS: Cascading Style Sheets
focus. the element also has an enabled state, in which it can be activated or accept focus. /* selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic shipping form. it uses the javascript change event to let the user enable/disable the billing fields. ...
... selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic shipping form. it uses the javascript change event to let the user enable/disable the billing fields. ...
...asic shipping form. it uses the javascript change event to let the user enable/disable the billing fields. ...
...And 2 more matches
Coordinate systems - CSS: Cascading Style Sheets
ates specified using the "offset" model use the top-left corner of the element being examined, or on which an event has occurred. for example, when a mouse event occurs, the position of the mouse as specified in the event's offsetx and offsety properties are given relative to the top-left corner of the node to which the event has been delivered. the origin is inset by the distances specified by p
adding-left and p
adding-top. client the "client" coordinate system uses as its origin the top-left corner of the viewport or browsing context in which the event occurred. this is the entire viewing area in which the document is presented. scrolling is not a factor. on a desktop computer, for example, the mouseevent.clientx and mouseevent.clienty properties indicate the position of the mouse cursor...
...ordinates of a given position within the document. page the "page" coordinate system gives the position of a pixel relative to the top-left corner of the entire document in which the pixel is located. that means that a given point in an element within the document will keep the same coordinates in the page model unless the element moves (either directly by changing its position or indirectly by
adding or resizing other content). mouse events' pagex and pagey properties provide the position of the mouse at the time the event was generated, given relative to the top-left corner of the document. screen finally, we come to the "screen" model. it's probably fairly obvious what this is: it's the coordinate system where the origin is located at the top-left corner of the user's entire screen sp...
... finally, we come to the "screen" model. it's probably fairly obvious what this is: it's the coordinate system where the origin is located at the top-left corner of the user's entire screen space. this means that the position of a given point within a document will change if the containing window is moved, for example, or if the user's screen geometry changes (by changing display resolution or by
adding or removing monitors to their system). the mouseevent.screenx and mouseevent.screeny properties give the coordinates of a mouse event's position relative to the screen's origin. example let's take a look at an example. this simple example creates a set of nested boxes. whenever the mouse enters, moves around inside, or exits the inner box, the corresponding event is handled by updating a se...
...And 2 more matches
CSS Animations tips and tricks - CSS: Cascading Style Sheets
nimation. <div class="box"> </div> <div class="runbutton">click me to run the animation</div> css content now we'll define the animation itself using css. some css that's not important (the style of the "run" button itself) isn't shown here, for brevity. .runbutton { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 12px; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { background: yellow } 100% { background: blue } } .box { width: 100px; height: 100px; border: 1px solid black; } .changing { animation: colorchange 2s; } there are two classes here. the "box" class is the basic descriptio...
...to make that happen, we have to be creative. here's what happens when the play() function gets called: the box's list of css classes is reset to simply "box". this has the effect of removing any other classes currently applied to the box, including the "changing" class that handles animation. in other words, we're removing the animation effect from th...
...ing a callback. our callback gets executed just before the next repaint of the document. the problem for us is that because it's before the repaint, the style recomputation hasn't actually happened yet! so... our callback cleverly calls requestanimationframe() a second time! this time, the callback is run before the next repaint, which is after the style recomputation has occurred. ...
...And 2 more matches
Flow Layout and Overflow - CSS: Cascading Style Sheets
when there is more content than can fit into a container, an overflow situation occurs. understanding how overflow behaves is important in dealing with any element with a constrained size in css. this guide explains how overflow works when working with normal flow. what is overflow? giving an element a fixed height and width, then
adding significant content to the box, creates a basic overflow example: the content goes into the box. once it fills the box, it continues to overflow in a visible way, displaying content outside the box, potentially displaying under subsequent content. the property that controls how overflow behaves is the overflow property which has an initial value of visible. this is why we can see the overflow content. controlling overflow there are other values...
...at controls how overflow behaves is the overflow property which has an initial value of visible. this is why we can see the overflow content. controlling overflow there are other values that control how overflow content behaves. to hide overflowing content use a value of hidden. this may cause some of your content to not be visible. using a value of scroll contains the content in its box and
add scrollbars to enable viewing it. scrollbars will be
added even if the content fits in the box. using a value of auto will display the content with no scrollbars if the content fits inside the box. if it doesn’t fit then scrollbars will be
added. comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and vertical scrollbars when it only ...
...dded even if the content fits in the box. using a value of auto will display the content with no scrollbars if the content fits inside the box. if it doesn’t fit then scrollbars will be
added. comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and vertical scrollbars when it only needs vertical scrolling. the auto example below only
adds the scrollbar in the direct we need to scroll. as we have already learned, using any of these values, other than the default of visible, will create a new block formatting context. note: in the working draft of overflow level 3, there is an
additional value overflow: clip. this will act like overflow: hidden however it does not allow for programmatic scrolling, the box becomes non-scrollable...
...And 2 more matches
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
e could create a semantic and well structured document, then apply css to create the layout we desired. sites such as the css zen garden showcased this ability. the css zen garden challenged us to take identical markup and create a unique design using css. css grid layout does not have the same issues that tables did, our grid structure is defined in css rather than in the mark-up. if we need to
add an element we can use something with no semantic meaning. on paper grid helps us properly fulfill that promise of content separated from mark-up, however is it possible to go too far with this idea? is it possible that we could create an accessibility issue through our use of grids? re-ordering content in css grid layout we’ve already seen in these guides that grid gives us power to re-order ...
...on-visual media (such as speech). likewise, rearranging grid items visually does not affect the default traversal order of sequential navigation modes (such as cycling through links, see e.g. tabindex html5). if you reorder things visually using grid layout, this will not change how the items are ordered if the content is being read out by a screen reader, or other text to speech user agent. in
addition, the reordering will not change tab order. this means that someone navigating using the keyboard could be tabbing through links on your site and suddenly find themselves jumping from the top to the bottom of the document due to a reordered item being next in line. the specification warns authors (the csswg term for web developers) not to do this reordering. authors must use order and the ...
...ally it now appears as the fourth item in the list. however, if i tab from link to link the tab order still begins with box 1, as it comes first in the source. ...
...And 2 more matches
CSS values and units - CSS: Cascading Style Sheets
ers and are therefore used without quotes. when viewing css property value syntax in a css specification or the mdn property page, allowable keywords will be listed in the following form. the following values are the pre-defined keyword values allowed for float. left | right | none | inline-start | inline-end such values are used without quotes: .box { float: left; } css-wide values in
addition to the pre-defined keywords that are part of the specification for a property, all css properties accept the css-wide property values initial, inherit, 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, prov...
... 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"); } .box { bac...
...in pages for min(), max() and clamp() functions.) some legacy functional notations such as rgba() use commas, but generally commas are only used to separate items in a list. if a comma is used to separate arguments, white space is optional before and after the comma. specifications specification status comment css values and units module level 4 editor's draft
adds the vi, vb, ic, cap, lh and rlh units.
adds the min(), max() and clamp() functional notation
adds toggle() css values and units module level 3 candidate recommendation
adds calc(), ch, rem, vw, vw, vmin, vmax, q css color module level 4 working draft
adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. allows alpha values in rgb() and ...
...And 2 more matches
Specificity - CSS: Cascading Style Sheets
(e.g., [type="radio"]) and pseudo-classes (e.g., :hover). id selectors (e.g., #example). universal selector (*), combinators (+, >, ~, ' ', ||) and negation pseudo-class (:not()) have no effect on specificity. (the selectors declared inside :not() do, however.) for more information, visit: "specificity" in "cascade and inheritance", you can also visit: https://specifishity.com inline styles
added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity. the !important exception when an important rule is used on a style declaration, this declaration overrides any other declarations. although technically !important has nothing to do with specificity, it interacts directly with it. u...
...t are considered very bad practice, but sometimes you need the latter to override the former. in this case, you could set certain styles in your global css file as !important, thus overriding inline styles set directly on elements. <div class="foo" style="color: red;">what color am i?</div> .foo[style*="color: red"] { color: firebrick !important; } many javascript frameworks and libraries
add inline styles. using !important with a very targeted selector is one way to override these inline styles. b) overriding high specificity #someelement p { color: blue; } p.awesome { color: red; } how do you make awesome paragraphs always turn red, even ones inside #someelement? without !important, the first rule will have more specificity and will win over the second rule. how to override...
...using !important with a very targeted selector is one way to override these inline styles. b) overriding high specificity #someelement p { color: blue; } p.awesome { color: red; } how do you make awesome paragraphs always turn red, even ones inside #someelement? without !important, the first rule will have more specificity and will win over the second rule. how to override !important a)
add another css rule with !important, and either give the selector a higher specificity (
adding a tag, id or class to the selector), or
add a css rule with the same selector at a later point than the existing one. this works because in a specificity tie, the last rule defined wins. some examples with a higher specificity: table td { height: 50px !important; } .mytable td { height: 50px !importan...
...And 2 more matches
Visual formatting model - CSS: Cascading Style Sheets
the layout of these boxes is governed by: box dimensions and type. positioning scheme (normal flow, float, and absolute positioning). relationships between elements in the document tree. external information (e.g., viewport size, intrinsic dimensions of images, etc.). much of the information about the visual formatting model is defined in css2, however, various level 3 specifications have
added to this information. when reading specifications you will often find references to the model as defined in css2, so an understanding of the model and the terms used to describe it in css2 is valuable when reading other layout specifications. in this document we define the model and introduce some of the related terms and concepts, linking to more specific pages on mdn for further details. the...
...dimension too. box generation box generation is the part of the css visual formatting model that creates boxes from the document's elements. generated boxes are of different types, which affect their visual formatting. the type of the box generated depends on the value of the css display property. initially defined in css2, the display property is extended in the css display module level 3. in
addition, some of the terminologies around the display have been updated and clarified in the years since css2. css takes your source document and renders it onto a canvas. to do this, it generates an intermediary structure, the box tree, which represents the formatting structure of the rendered document. each box in the box tree represents its corresponding element (or pseudo-element) in space and/...
...however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. the principal box when an element generates one or more boxes, one of them is the principal box, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme. some elements may generate
additional boxes in
addition to the principal box, for example display: list-item generates more than one box (e.g. a principal block box and a child marker box). and some values (such as none or contents) cause the element and/or its descendants to not generate any boxes at all. anonymous boxes an anonymous box is created when there is not an html element to use for the box. this situation happens...
...And 2 more matches
aspect-ratio - CSS: Cascading Style Sheets
of width / height. size calculations involving preferred aspect ratio work with the dimensions of the box specified by box-sizing. formal definition initial valueautoapplies toall elements except inline boxes and internal ruby or table boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <ratio> examples mapping width and height to aspect-ratio firefox has
added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet. chrome is also shipping this feature. in firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ra...
...data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...viewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaspect-ratio experimentalchrome partial support 79notes partial support 79notes notes chrome 79
adds internal support only for mapped valuesedge partial support 79notes partial support 79notes notes edge 79
adds internal support only for mapped valuesfirefox partial support 71notes partial support 71notes notes firefox 71
adds internal support only for mapped values no support 69 — 71notes disabled notes firefox 69
adds internal support only for mapped valuesdisabled from version 69 until version 71 (exclusive): this featur...
...And 2 more matches
background-origin - CSS: Cascading Style Sheets
the background-origin css property sets the background's origin: from the border start, inside the border, or inside the p
adding. 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 background-origin is ignored when background-attachment is fixed. syntax /* keyword values */ background-origin: border-box; background-origin: p
adding-box; background-origin: content-box; /* global values */ background-origin: inherit; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below. values border-box the background is positioned...
... syntax /* keyword values */ background-origin: border-box; background-origin: p
adding-box; background-origin: content-box; /* global values */ background-origin: inherit; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below. values border-box the background is positioned relative to the border box. p
adding-box the background is positioned relative to the p
adding box. content-box the background is positioned relative to the content box. formal definition initial valuep
adding-boxapplies toall elements. ...
...lative to the border box. p
adding-box the background is positioned relative to the p
adding box. content-box the background is positioned relative to the content box. formal definition initial valuep
adding-boxapplies toall elements. ...
...And 2 more matches
box-shadow - CSS: Cascading Style Sheets
you can set multiple effects separated by commas. a box shadow is described by x and y offsets relative to the element, blur and spread radius, and color. 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 box-shadow property enables you to cast a drop shadow from the frame of almost any element. if a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. ...
...component, and x, y, blur, and (when appropriate) spread (as length) components. for each shadow, if both input shadows are or are not inset, then the interpolated shadow must match the input shadows in that regard. if any pair of input shadows has one inset and the other not inset, the entire shadow list is uninterpolable. if the lists of shadows have different lengths, then the shorter list is p
added at the end with shadows whose color is transparent, all lengths are 0, and whose inset (or not) matches the longer list. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueany length made absolute; any specified color computed; otherwise as specifiedanimation typea shadow list formal syntax none | <shadow>#where <shadow> = i...
...shadows: an inset shadow, a regular drop shadow, and a 2px shadow that creates a border effect (we could have used an outline instead for that third shadow). html <blockquote><q>you may shoot me with your words,<br/> you may cut me with your eyes,<br/> you may kill me with your hatefulness,<br/> but still, like air, i'll rise.</q> <p>— maya angelou</p> </blockquote> css blockquote { p
adding: 20px; box-shadow: inset 0 -3em 3em rgba(0,0,0,0.1), 0 0 0 2px rgb(255,255,255), 0.3em 0.3em 1em rgba(0,0,0,0.3); } result setting zero for offset and blur when the x-offset, y-offset, and blur are all zero, the box shadow will be a solid-colored outline of equal-size on all sides. the shadows are drawn back to front, so the first shadow sits on top o...
...And 2 more matches
calc() - CSS: Cascading Style Sheets
oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* property: calc(expression) */ width: calc(100% - 80px); the calc() function takes a single expression as its parameter, with the expression's result used as the value. the expression can be any simple expression combining the following operators, using standard operator precedence rules: +
addition. - subtraction. * multiplication. at least one of the arguments must be a <number>. / division. the right-hand side must be a <number>. the operands in the expression may be any <length> syntax value. you can use different units for each value in your expression, if you wish. you may also use parentheses to establish computation order when needed. notes the + and - operators must...
...o use parentheses to establish computation order when needed. notes the + and - operators must be surrounded by whitespace. for instance, calc(50% -8px) will be parsed as a percentage followed by a negative length — an invalid expression — while calc(50% - 8px) is a percentage followed by a subtraction operator and a length. likewise, calc(8px + -50%) is treated as a length followed by an
addition operator and a negative percentage. the * and / operators do not require whitespace, but
adding it for consistency is both allowed and recommended. division by zero results in an error being generated by the html parser. math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed ...
...n screen with a margin calc() makes it easy to position an object with a set margin. ...
...And 2 more matches
clear - CSS: Cascading Style Sheets
d higher than earlier ones. the floats that are relevant to be cleared are the earlier floats within the same block formatting context. if an element contains only floated elements, its height collapses to nothing. if you want it to always be able to resize, so that it contains floating elements inside it, you need to self-clear its children. this is called clearfix, and one way to do it is to
add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } syntax /* keyword values */ clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end; /* global values */ clear: inherit; clear: initial; clear: unset; values none is a keyword indicating that the element is not moved down to clear ...
... inline-end examples clear: left html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit. phasellus sit amet diam. duis mattis varius dui. suspendisse eget dolor.</p> <p class="red">lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> <p class="left">this paragraph clears left.</p> </div> css .wrapper{ border:1px solid black; p
adding:10px; } .left { border: 1px solid black; clear: left; } .black { float: left; margin: 0; background-color: black; color: #fff; width: 20%; } .red { float: left; margin: 0; background-color: pink; width:20%; } p { width: 50%; } clear: right html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit. phasellus sit amet dia...
... width: 50%; } clear: right html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit. phasellus sit amet diam. duis mattis varius dui. suspendisse eget dolor.</p> <p class="red">lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> <p class="right">this paragraph clears right.</p> </div> css .wrapper{ border:1px solid black; p
adding:10px; } .right { border: 1px solid black; clear: right; } .black { float: right; margin: 0; background-color: black; color: #fff; width:20%; } .red { float: right; margin: 0; background-color: pink; width:20%; } p { width: 50%; } clear: both html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit. phasellus sit amet di...
...And 2 more matches
mask-composite - CSS: Cascading Style Sheets
the mask-composite css property represents a compositing operation used on the current mask layer with the mask layers below it. /* keyword values */ mask-composite:
add; mask-composite: subtract; mask-composite: intersect; mask-composite: exclude; /* global values */ mask-composite: inherit; mask-composite: initial; mask-composite: unset; syntax one or more of the keyword values listed below, separated by commas. values for the composition the current mask layer is referred to as source, while all layers below it are referred to as destination.
add the source is placed over the destination. subtract the source is placed, where it falls outside of the destination. intersect the parts of source that overlap the destination, replace the destination. exclude the non-overlapping...
...d to as source, while all layers below it are referred to as destination.
add the source is placed over the destination. subtract the source is placed, where it falls outside of the destination. intersect the parts of source that overlap the destination, replace the destination. exclude the non-overlapping regions of source and destination are combined. ...
...destination, replace the destination. exclude the non-overlapping regions of source and destination are combined. ...
...And 2 more matches
WAI ARIA Live Regions/API Support - Developer guides
readers. developers should use the aria live regions developer documentation. firefox 3 contains important improvements to the way the mozilla engine exposes live changes in a document. these features will help screen reader developers improve the quality and performance of live region support, both for pages that are marked up with aria live region markup, and for pages where the author did not
add any
additional markup. please read the aria spec or the live region report to learn about aria live region markup. as always, we're open to questions and suggestions for changes in community forums. events fired for web page mutations what changed in document? atk/at-spi event iaccessible2 event object about to be hidden or removed children_changed::remove (fired on th...
...utations what changed in document? ...
...bject shown or inserted children_changed::
add (fired on the parent, with event data pointing to the child index of the inserted accessible object) event_object_show* (fired on the actual new accessible object) object replaced with different object (this happens especially if an object's interfaces or role changes) children_changed::remove followed immediately by children_change::
add event_object_hide followed immediately by event_object_show text removed text_changed::delete ia2_event_text_removed (use iaccessibletext::get_oldtext to retrieve the offsets and removed text) text inserted text_changed::insert ia2_event_text_inserted (use iaccessibletext::get_newtext to retrieve the offsets and inserted text) text replaced text_change...
...And 2 more matches
Overview of events and handlers - Developer guides
ue in javascript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing. events and event handling become central to web programming with the
addition of the language to browsers, accompanying a switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering. initially, browsers wait, until they receive all of the resources associated with a page, to parse, process, draw, and present the page to the user. the displayed page remains unchanged until the browser requests a new ...
...eb browsers which define many events emitted in response to user input or browser activity. modern web browsers follow the event pattern using a standardized approach. browsers use as the data structure for the properties of the event, an object derived from the eventprototype object. browsers use as the registration method for the function which will handle those data structures a method called
addeventlistener which expects as arguments a string event type name and the handler function. finally, browsers define a large number of objects as event emitters and define a wide variety of event types generated by the objects. button event handler demo for example, browser <button> elements are intended to emit events named 'click' in response to a mouse click or, when displayed in touch sensit...
... this code relies on the agreement that there is a kind of event called 'click' which will call any listener (or 'handler') function with an event object argument (actually, in this cas...
...And 2 more matches
Making content editable - Developer guides
andlers, you can transform your web page into a full and fast rich text editor. this article provides some information about this functionality. note: in firefox 63 beta/dev edition, some of the rich-text editing features have been disabled by default, for better cross-browser compatibility. these are object resizing on <img>, <table>, and absolutely-positioned elements; inline table editing to
add or remove rows and columns; and the grabber that allows moving of absolutely-positioned elements. see bug 1449564 and firefox-specific html editing ui has been deprecated for
additional details. how does it work? all you have to do is set the contenteditable attribute on nearly any html element to make it editable. here's a simple example which creates a <div> element whose contents the user ...
...div> here's the above html in action: executing commands when an html element has contenteditable set to true, the document.execcommand() method is made available. this lets you run commands to manipulate the contents of the editable region. most commands affect the document's selection by, for example, applying a style to the text (bold, italics, etc), while others insert new elements (like
adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand() will affect the currently active editable element. differences in markup generation use of contenteditable across different browsers has been painful for a long time because of the differences in generated markup between browsers. for example, even something as simple as what happens when you pres...
...e above example. note: internet explorer, which is no longer being developed, uses <p> elements instead of <div>. if you want to use a different paragraph separator, the above browsers all support document.execcommand, which provides a defaultparagraphseparator command to allow you to change it. for example, to use <p> elements: document.execcommand("defaultparagraphseparator", false, "p");
additionally, firefox supports the non-standard argument, br, for defaultparagraphseparator since firefox 55. this is useful if your web application expects the older firefox behavior, and you don't want to or don't have the time to update it to use the new behavior. you can use the older firefox behavior with this line: document.execcommand("defaultparagraphseparator", false, "br"); security for ...
...And 2 more matches
Constraint validation - Developer guides
the creation of web forms has always been a complex task. while marking up the form itself is easy, checking whether each field has a valid and coherent value is more difficult, and informing the user about the problem may become a headache. html5 introduced new mechanisms for forms: it
added new semantic types for the <input> element and constraint validation to ease the work of checking the form content on the client side. basic, usual constraints can be checked, without the need for javascript, by setting new attributes; more complex constraints can be tested using the constraint validation api. for a basic introduction to these concepts, with examples, see the form validation tutorial. note: html5 constraint validation doesn't remove the need for validation on the server side. e...
...onstraints on the server side, in a way that is consistent with what is done on the client side. intrinsic and basic constraints in html5, basic constraints are declared in two ways: by choosing the most semantically appropriate value for the type attribute of the <input> element, e.g., choosing the email type automatically creates a constraint that checks whether the value is a valid e-mail
address. by setting values on validation-related attributes, allowing basic constraints to be described in a simple way, without the need for javascript. semantic input types the intrinsic constraints for the type attribute are: input type constraint description associated violation <input type="url"> the value must be an absolute url, as defined in the url living ...
... the need for javascript. semantic input types the intrinsic constraints for the type attribute are: input type constraint description associated violation <input type="url"> the value must be an absolute url, as defined in the url living standard. typemismatch constraint violation <input type="email"> the value must be a syntactically valid email
address, which generally has the format username@hostname.tld. typemismatch constraint violation for both of these input types, if the multiple attribute is set, several values can be set, as a comma-separated list, for this input. if any of these do not satisfy the condition described here, the type mismatch constraint violation is triggered. note that most input types don't have intrinsi...
...And 2 more matches
User input and controls - Developer guides
f keyboard accessibility where appropriate — many web users only use keyboard to navigate web sites and apps, and locking them out of your functionality is a bad idea. the following is a set of recommendations and best practices for using such tools in open web apps. decide what input mechanism you’re using keyboard keyboard input can be controlled by your app. for example if you want to
add controls when any key gets pressed, you need to
add an event listener on the window object: window.
addeventlistener("keydown", handlekeydown, true); window.
addeventlistener("keyup", handlekeyup, true); where handlekeydown and handlekeyup are the functions implementing the controls about the keydown and keyup events. note: have a look at the events reference and keyboardevent guide to find out...
...rag & drop (see below). finger touch when developing web applications meant to be installed on touchscreen devices, it’s a good practice to take into consideration the different capabilities in terms of screen resolution and user input. touch events can help you implement interactive elements and common interaction gestures on touchscreen devices. ...
... devices, it’s a good practice to take into consideration the different capabilities in terms of screen resolution and user input. touch events can help you implement interactive elements and common interaction gestures on touchscreen devices. if you want to use touch events, you need to
add event listeners and specify handler functions, which will be called when the event gets fired: element.
addeventlistener("touchstart", handlestart, false);
element.
addeventlistener("touchcancel", handlecancel, false);
element.
addeventlistener("touchend", handleend, false);
element.
addeventlistener("touchmove", handlemove, false); where element is the dom element you want to register the touch events on. note: for further information about what you can do with touch events, please read our t...
...And 2 more matches
HTML attribute: pattern - HTML: Hypertext Markup Language
attern attribute, notably the email and url input types, have expected value syntaxes that must be matched. if the pattern attribute isn't present, and the value doesn't match the expected syntax for that value type, the validitystate object's read-only typemismatch property will be true. usability when including a pattern, provide a description of the pattern in visible text near the control. ...
.... usability when including a pattern, provide a description of the pattern in visible text near the control.
additionally, include a title attribute which gives a description of the pattern. user agents may use the title contents during constraint validation to tell the user that the pattern is not matched. some browsers show a tooltip with title contents, improving usability for sighted users.
additionally, assistive technology may read the title aloud when the control gains focus, but this should not be relied upon for accessibility. constraint validation if the input’s value is not the empty string and the value does not match the entire regular expression, there is a from a patternmismatch . the pattern's regular expression, when matched against the value, must have its start ancho...
... relying on the title attribute for the visual displa...
...And 2 more matches
<input type="color"> - HTML: Hypertext Markup Language
any other form, and is never empty. note: setting the value to anything that isn't a valid, fully-opaque, rgb color in hexadecimal notation will result in the value being set to #000000. in particular, you can't use css's standardized color names, or any css function syntax, to set the value. this makes sense when you keep in mind that html and css are separate languages and specifications. in
addition, colors with an alpha channel are not supported; specifying a color in 9-character hexadecimal notation (e.g. #009900aa) will also result in the color being set to #000000. note: any web browser that doesn't support an input of type color will naturally fall back to the type text. because users can write colors in many different ways (such as rgb(255, 255, 0)), one way to work around this...
...there are two events that can be used to detect changes to the color value: input and change. input is fired on the <input> element every time the color changes. the change event is fired when the user dismisses the color picker. in both cases, you can determine the new value of the element by looking at its value. ...
...the color value: input and change. input is fired on the <input> element every time the color changes. the change event is fired when the user dismisses the color picker. in both cases, you can determine the new value of the element by looking at its value. ...
...And 2 more matches
<input type="hidden"> - HTML: Hypertext Markup Language
itted to the server. this specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools or "view source" functionality. do not rely on hidden inputs as a form of security. ...
...specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools or "view source" functionality. do not rely on hidden inputs as a form of security. ...
... value="my excellent blog post"> </div> <div> <label for="content">post content:</label> <textarea id="content" name="content" cols="60" rows="5"> this is the content of my excellent blog post. ...
...And 2 more matches
<input type="week"> - HTML: Hypertext Markup Language
h is always formatted yyyy-www. when the above value is submitted to the server, for example, browsers may display it as week 01, 2017, but the submitted value will always look like week=2017-w01. ...
...-www. when the above value is submitted to the server, for example, browsers may display it as week 01, 2017, but the submitted value will always look like week=2017-w01. ...
...d css properties to style the input based on whether or not the current value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. ...
...And 2 more matches
<table>: The Table element - HTML: Hypertext Markup Language
igit hexadecimal rgb code, prefixed by a '#'. one of the predefined color kewords can also be used. to achieve a similar effect, use the css background-color property. border this integer attribute defines, in pixels, the size of the frame surrounding the table. if set to 0, the frame attribute is set to void. to achieve a similar effect, use the css border shorthand property. cellp
adding this attribute defines the space between the content of a cell and its border, displayed or not. if the cellp
adding's length is defined in pixels, this pixel-sized space will be applied to all four sides of the cell's content. if the length is defined using a percentage value, the content will be centered and the total vertical space (top and bottom) will represent this value. the same is...
... applied to all four sides of the cell's content. if the length is defined using a percentage value, the content will be centered and the total vertical space (top and bottom) will represent this value. the same is true for the total horizontal space (left and right). to achieve a similar effect, apply the border-collapse property to the <table> element, with its value set to collapse, and the p
adding property to the <td> elements. cellspacing this attribute defines the size of the space between two cells in a percentage value or pixels. the attribute is applied both horizontally and vertically, to the space between the top of the table and the cells of the first row, the left of the table and the first column, the right of the table and the last column and the bottom of the table a...
... this helps people navigating with the aid of assistive technology such as a screen reader, people experiencing low vision condition...
...And 2 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
tegories none. permitted content zero or more <tr> elements. tag omission the <tbody> element is not a required child element for a parent <table> element to graphically render. however, it must not be present, if its parent <table> element has a <tr> element as a child. permitted parents within the required parent <table> element, the <tbody> element can be
added after a <caption>, <colgroup>, and a <thead> element. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the global attributes. deprecated attributes align this enumerated attribute specifies how horizontal alignment of each cell content will be handled. possible values ar...
...rial", sans-serif; } first, the table's overall style attributes are set, configuring the thickness, style, and color of the table's exterior borders and using border-collapse to ensure that the border lines are shared among adjacent cells rather than each having its own borders with space in between. font is used to establish an initial font for the table. ...
... own borders with space in between. font is used to establish an initial font for the table. th, td { border: 1px solid #bbb; p
adding: 2px 8px 0; text-align: left; } then the style is set for the majority of the cells in the table, including all data cells but also those styles shared between our <td> and <th> cells. the cells are given a light gray outline which is a single pixel thick, p
adding is adjusted, and all cells are left-aligned using text-align thead > tr > th { background-color: #cce; font-size: 18px; border-bottom: 2px solid #999; } finally, header cells contained within the <thead> block are given
additional styling. they use a darker background-color, a larger font size, and a thicker, darker bottom border than the other cell borders. result the resulting tabl...
...And 2 more matches
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
is subtitles. if the attribute contains an invalid value, it will use metadata (versions of chrome earlier than 52 treated an invalid value as subtitles). the following keywords are allowed: subtitles subtitles provide translation of content that cannot be understood by the viewer. for example dialogue or text that is not english in an english language film. subtitles may contain
additional content, usually extra background information. for example the text at the beginning of the star wars films, or the date, time, and location of a scene. captions closed captions provide a transcription and possibly a translation of audio. it may include important non-verbal information such as music cues or sound effects. it may indicate the cue's source (e.g. music, t...
... content. suitable for users who are blind or where the video cannot be seen. chapters chapter titles are intended to be used when the user is navigating the media resource. metadata tracks used by scripts. not visible to the user. label a user-readable title of the text track which is used by the browser when listing available text tracks. src
address of the track (.vtt file). must be a valid url. this attribute must be specified and its url value must have the same origin as the document — unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. ...
...ibute must be specified and its url value must have the same origin as the document — unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. usage notes track data types the type of data that track
adds to the media is set in the kind attribute, which can take values of subtitles, captions, descriptions, chapters or metadata. the element points to a source file containing timed text that the browser exposes when the user requests
additional data. a media element cannot have more than one track with the same kind, srclang, and label. detecting cue changes the underlying texttrack, indicated b...
...And 2 more matches
Global attributes - HTML: Hypertext Markup Language
global attributes may be specified on all html elements, even those not specified in the standard. that means that any non-standard elements must still permit these attributes, even though using those elements means that the document is no longer html5-compliant. for example, html5-compliant browsers hide content marked as <foo hidden>...</foo>, even though <foo> is not a valid html element. in
addition to the basic html global attributes, the following global attributes also exist: xml:lang and xml:base — these are inherited from the xhtml specifications and deprecated, but kept for compatibility purposes. the multiple aria-* attributes, used for improving accessibility. the event handler attributes: onabort, onautocomplete, onautocompleteerror, onblur, oncancel, oncanplay, oncanpla...
... primarily on <input> elements, but is usable on any element while in contenteditable mode. is allows you to specify that a standard html element should behave like a registered custom built-in element (see using custom elements for more details). note: the item* attributes are part of the whatwg html microdata feature. itemid the unique, global identifier of an item. itemprop used to
add properties to an item. every html element may have an itemprop attribute specified, where an itemprop consists of a name and value pair. itemref properties that are not descendants of an element with the itemscope attribute can be associated with the item using an itemref. it provides a list of element ids (not itemids) with
additional properties elsewhere in the document. itemscope itemscope...
...t can have the following values: empty string and yes, which indicates that the element will be translated. no, which indicates that the element will not be translated. specifications specification status comment html living standardthe definition of 'global attributes' in that specification. living standard shadow parts working draft
added the part and exportparts global attributes. html 5.2the definition of 'global attributes' in that specification. recommendation snapshot of html living standard. from html 5.1, itemid, itemprop, itemref, itemscope, and itemtype have been
added. html 5.1the definition of 'global attributes' in that specification. recommendation snapshot of html living standard. from...
...And 2 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
a web application executes a cross-origin http request when it requests a resource that has a different origin (domain, protocol, or port) from its own. an example of a cross-origin request: the front-end javascript code served from https://domain-a.com uses xmlhttprequest to make a request for https://domain-b.com/data.json. for security reasons, browsers restrict cross-origin http requests initiated from scripts. for example, xmlhttprequest and the fetch api follow the same-origin policy. ...
...type fonts that can only be cross-site loaded and used by web sites that are permitted to do so. webgl textures. images/video frames drawn to a canvas using drawimage(). css shapes from images. this article is a general discussion of cross-origin resource sharing and includes a discussion of the necessary http headers. ...
...ideo frames drawn to a canvas using drawimage(). css shapes from images. this article is a general discussion of cross-origin resource sharing and includes a discussion of the necessary http headers. functional overview the cross-origin resource sharing standard works by
adding new http headers that let servers describe which origins are permitted to read that information from a web browser.
additionally, for http request methods that can cause side-effects on server data (in particular, http methods other than get, or post with certain mime types), the specification mandates that browsers "preflight" the request, soliciting supported methods from the server with the http options request method, and then, upon "approval" from the server, sending the actual request. servers can also infor...
...And 2 more matches
X-Forwarded-For - HTTP
therefore the user's privacy must be kept in mind when deploying this header. ...
...therefore the user's privacy must be kept in mind when deploying this header. ...
...therefore the user's privacy must be kept in mind when deploying this header. ...
...And 2 more matches
Redirections in HTTP - HTTP
http has a special kind of response, called a http redirect, for this operation. redirects accomplish numerous goals: temporary redirects during site maintenance or downtime permanent redirects to preserve existing links/bookmarks after changing the site's urls, progress pages when uploading a file, etc. principle in http, redirection is triggered by a server sending a special redirect response to a request. redirect responses have status codes that start with 3, and a location header holding the url to redirect to. ...
...ress pages when uploading a file, etc. principle in http, redirection is triggered by a server sending a special redirect response to a request. redirect responses have status codes that start with 3, and a location header holding the url to redirect to. when browsers 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 forever. they imply that the original url should no longer be used, and replaced with the new one.search engine robots, rss readers, and ...
...ce with three ways to trigger redirections, several ways can be used at the same time. but which is applied first? http redirects always execute first — they exist when there is not even a transmitted page. html redirects (<meta>) execute if there weren't any http redirects. javascript redirects execute last, and only if javascript is enabled. when possible, use http redirects and don't
add <meta> element redirects. if someone changes the http redirects but forgets to change the html redirects, the redirects will no longer be identical, which could cause an infinite loop or other nightmares. use cases there are numerous use cases for redirects, but as performance is impacted with every redirect, their use should be kept to a minimum. domain aliasing ideally, there is one locatio...
...And 2 more matches
Using Promises - JavaScript
eaudiofileasync(audiosettings); promise.then(successcallback, failurecallback); we call this an asynchronous function call. this convention has several advantages. we will explore each one. guarantees unlike old-fashioned passed-in callbacks, a promise comes with some guarantees: callbacks will never be called before the completion of the current run of the javascript event loop. callbacks
added with then(), as above, will be called even after the success 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 t...
...ing(); const promise2 = promise.then(successcallback, failurecallback); or const promise2 = dosomething().then(successcallback, failurecallback); this second promise (promise2) represents the completion not just of dosomething(), but also of the successcallback or failurecallback you passed in, which can be other asynchronous functions returning a promise. when that's the case, any callbacks
added to promise2 get queued behind the promise returned by either successcallback or failurecallback. basically, each promise represents the completion of another asynchronous step in the chain. in the old days, doing several asynchronous operations in a row would lead to the classic callback pyramid of doom: dosomething(function(result) { dosomethingelse(result, function(newresult) { dothi...
...all errors will go to the same event handlers, regardless of source. one case of special usefulness: when writing code for node.js, it's common that modules you include in your project may have unhandled rejected promises. these get logged to the console by the node runtime. ...
...And 2 more matches
TypeError: can't define property "x": "obj" is not extensible - JavaScript
ies beyond the ones it had at the time it was 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. ...
...) 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.preventextensions() marked an object as no longer extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible. 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 strict'; var obj = {}; object.preventextensions(obj); obj.x = 'foo'; // typeerror: can't define property "x": "obj" is not extensible in both, strict mode and sloppy mode, a ca...
...ects 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 strict'; var obj = {}; object.preventextensions(obj); obj.x = 'foo'; // typeerror: can't define property "x": "obj" is not extensible in both, strict mode and sloppy mode, a call to object.defineproperty() throws when
adding a new property to a non-extensible object. ...
...And 2 more matches
Array - JavaScript
cannot be applied to these named properties. ...
...le.log(item, index) }) // apple 0 // banana 1
add an item to the end of an array let newlength = fruits.push('orange') // ["apple", "banana", "orange"] remove an item from the end of an array let last = fruits.pop() // remove orange (from the end) // ["apple", "banana"] remove an item from the beginning of an array let first = fruits.shift() // remove apple from the front // ["banana"]
add an item to the beginning of an array let newlength = fruits.unshift('strawberry') //
add to the front // ["strawberry", "banana"] find the index of an item in the array fruits.push('mango') // ["strawberry", "banana", "mango"] let pos = fruits.indexof('banana') // 1 remove an item by index position let removeditem = fruits.splice(pos, 1) // this is how to remove an item // ["strawberry",...
...ch index in the array. array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to an element, or -1 if none is found. array.prototype.map() returns a new array containing the results of calling a function on every element in this array. array.prototype.pop() removes the last element from an array and returns that element. array.prototype.push()
adds one or more 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. arr...
...And 2 more matches
Lexical grammar - JavaScript
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, but no point at which a line may break others other unicode space characters <usp> spaces in unicode on wikipedia line terminators in
addition to white space characters, line terminator characters are used to improve the readability of the source text. however, in some cases, line terminators can influence the execution of javascript code as there are a few places where they are forbidden. line terminators also affect the process of automatic semicolon insertion. line terminators are matched by the \s class in regular expressions. ...
...viation 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
add hints, notes, suggestions, or warnings to javascript code. this can make it easier to read and understand. they can also be used to disable code to prevent it from being executed; this can be a valuable debugging tool. javascript has two long-standing ways to
add comments to code. the first way is the // comment; this makes all text following it on the same line into a comment. for example: fu...
...s comment spans multiple lines. notice that we don't need to end the comment until we're done. */ console.log('hello world!'); } comment(); you can also use it in the middle of a line, if you wish, although this can make your code harder to read so it should be used with caution: function comment(x) { console.log('hello ' + x /* insert the value of x */ + ' !'); } comment('world'); in
addition, you can use it to disable code to prevent it from running, by wrapping code in a comment, like this: function comment() { /* console.log('hello world!'); */ } comment(); in this case, the console.log() call is never issued, since it's inside a comment. any number of lines of code can be disabled this way. hashbang comments a specialized third comment syntax, the hashbang comment, is i...
...And 2 more matches
this - JavaScript
e window object. to set the value of this to a particular value when calling a function, use call(), or apply() as in the examples below. class context the behavior of this in classes and functions is similar, since classes are functions under the hood. but there are some differences and caveats. within a class constructor, this is a regular object. all non-static methods within the class are
added to the prototype of this: class example { constructor() { const proto = object.getprototypeof(this); console.log(object.getownpropertynames(proto)); } first(){} second(){} static third(){} } new example(); // ['constructor', 'first', 'second'] note: static methods are not properties of this. they are properties of the class itself. derived classes unlike base class con...
...ction whatsthis() { return this.a; // the value of this is dependent on how the function is called } whatsthis(); // 'global' as this in the function isn't set, so it defaults to the global/window object whatsthis.call(obj); // 'custom' as this in the function is set to obj whatsthis.apply(obj); // 'custom' as this in the function is set to obj this and object conversion function
add(c, d) { return this.a + this.b + c + d; } var o = {a: 1, b: 3}; // the first parameter is the object to use as // 'this', subsequent parameters are passed as // arguments in the function call
add.call(o, 5, 7); // 16 // the first parameter is the object to use as // 'this', the second is an array whose // members are used as the arguments in the function call
add.apply(o, [10, 20]); // 34 ...
...hat this was bound to simply gets discarded. (this essentially makes the statement "this.a = 37;" dead code. it's not exactly dead because it gets executed, but it can be eliminated with no outside effects.) as a dom event handler when a function is used as an event handler, its this is set to the element on which the listener is placed (some browsers do not follow this convention for listeners
added dynamically with methods other than
addeventlistener()). // when called as a listener, turns the related element blue function bluify(e) { // always true console.log(this === e.currenttarget); // true when currenttarget and target are the same object console.log(this === e.target); this.style.backgroundcolor = '#a5d9f3'; } // get a list of every element in the document var elements ...
...And 2 more matches
MathML attribute reference - MathML
<mscarry> specifies what kind of line is drawn to cross out carries. unimplemented decimalpoint <mstyle> if the decimalpoint value is used to specify the alignment, this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns. denomalign <mfrac> the alignment of the denominator under the fraction. depth <mp
added> sets or increments the depth. see length. dir <math>, <mi>, <mo>, <mrow>, <ms>, <mtext> the text direction. possible values are either ltr (left to right) or rtl (right to left). display <math> specifies the rendering mode. the values block and inline are allowed. displaystyle <mstyle>, <mtable> a boolean value specifying whether more vertical sp...
...boolean value specifying whether the operator is a fence (such as parentheses). there is no visual effect for this attribute. unimplemented form <mo> specifies the role of the operator in an enclosed expression. frame <mtable> specifies borders of an entire <mtable>. possible values are: none (default), solid and dashed. framespacing <mtable> specifies
additional space
added between the table and frame. unimplemented groupalign <maligngroup>, <mtable>, <mtd>, <mtr> height <mglyph>, <mp
added>, <mspace> specifies the desired height. see lengths for possible values. href all used to set a hyperlink to a specified uri. id all sets up a unique identifier associated with the element. u...
...<mo>, <mspace> unimplemented linebreakstyle <mo>, <mspace> unimplemented lineleading <mo>, <mspace> linethickness <mfrac> the thickness of the horizontal fraction line. unimplemented location <mscarries> unimplemented longdivstyle <mlongdiv> controls the style of the long division layout. lspace <mo>, <mp
added> the amount of space before the operator (see length for values and units). lquote <ms> the opening quote character (depends on dir) to enclose the content. the default value is """. mathbackground all the background color. you can use #rgb, #rrggbb and html color names. mathcolor all the text color. you can use #rgb, #rrggbb and html color n...
...And 2 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
ing, and the specifics of how sites become whitelisted vary from browser to browser, but the above are good guidelines to go by. for details, 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 prevent autoplay from being allowed, we'll look at how your web site or app can automatically play media upon page load, how to detect when autoplay fails to occur, and tips for coping when autoplay is denied by the browser. the autoplay attribute the simplest w...
...ircumstances. autoplay of media elements now that we've covered what autoplay is and what can prevent autoplay from being allowed, we'll look at how your web site or app can automatically play media upon page load, how to detect when autoplay fails to occur, and tips for coping when autoplay is denied by the browser. 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 element to true, and when autoplay is true, the media will automatically begin to play as soon as possible after the following have occurred: the page is allowed to use autoplay functionality the element has been created during page load enough media has been received to begin playback and conti...
...e === "notallowederror") { showplaybutton(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 prevents 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 t...
...And 2 more matches
Codecs used by WebRTC - Web media technologies
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 video and audio synchronized, so that the movements and any ancillary information (such as slides or a projection) are presented at the same time as the audio that corresponds. general codec requirements before lo...
...), recommendations for webcam processing features (automatic focus, automatic white balance, automatic light level), and so on. note: these requirements are for web browsers and other fully-webrtc compliant products. non-webrtc products that are able to communicate with webrtc to some extent may or may not support these codecs, although they're encouraged to by the specification documents. in
addition to the mandatory codecs, some browsers support
additional codecs as well. those are listed in the following table. other video codecs codec name profile(s) browser compatibility vp9 — chrome (48+), firefox vp8 vp8, which we describe in general in the main guide to video codecs used on the web, has some specific requirements that must be followed ...
...se reduction, and audio leveling. note: the list above indicates the minimum required set of codecs that all webrtc-compatible endpoints are required to implement. a given browser may also support other codecs; however, cross-platform and cross-device compatibility may be at risk if you use other codecs without carefully ensuring that support exists in all browsers your users might choose. in
addition to the mandatory audio codecs, some browsers support
additional codecs as well. those are listed in the following table. other audio codecs codec name browser compatibility g.722 chrome, firefox, safari ilbc[1] chrome, safari isac[2] chrome, safari [1] internet low bitrate codec (ilbc) is an open-source narrow-band codec developed ...
...And 2 more matches
Graphic design for responsive sites - Progressive web apps (PWAs)
ds. textual content is not a problem, as text boxes are innately responsive, but the picture starts to get ugly when you start including graphics and complex layouts on your pages — especially when those graphics and layouts need to adapt to different displays! this is why we have included an entire docs section covering each of these topics (the one you are currently in, and app layout.) in
addition, these days there are so many more technologies to choose from than your humble bmps, jpgs, gifs and pngs. but what should you choose? this really depends on what target devices you have to support, how complex the graphics need to be, and how much interactivity your graphics require. serving images selectively via css in general, you will use mostly the same graphical assets for different...
...es a large header graphic and several programmatic graphics (e.g. css3 drop shadows and gradients), you may want to simplify or remove certain assets for the site's mobile layout, or even provide smaller assets to suit the smaller screen better. this is because in general mobile devices will have less processing power and bandwidth available, so you want to reduce the processing and downloads. in
addition, mobile devices have smaller screen sizes, so it makes sense to reduce visual clutter on a mobile layout. css media queries allow us to serve different css rules dependant on viewport dimensions, and you should consider using mobile first media queries where possible. this means that the default layout before any media queries are encountered in the css is the small screen/mobile layout, no...
...text properties to style your web font icons, such as text-shadow and color. making your own font file can be a bit fiddly, but there are a number of good icon font services available such as font awesome. interactive images if your images need to feature some level of interactivity, such as links, other clickable areas, or animation, there are a number of options available. css as well as
adding programmatic graphical effects to links (and anywhere else you might want them), css3 also allows you to write declarative animations and transitions. these may not be supported in older browsers like ie6-8, but they generally degrade gracefully, are fairly easy to write, and become much more flexible and powerful when combined with javascript and other technologies. javascript javascript ha...
...And 2 more matches
Subresource Integrity - Web security
grity (sri) is a security feature that enables browsers to verify that resources they fetch (for example, from a cdn) are delivered without unexpected manipulation. it works by allowing you to provide a cryptographic hash that a fetched resource must match. note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers
additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. how subresource integrity helps using content delivery networks (cdns) to host files such as scripts and stylesheets that are shared among multiple sites can improve site performance and conserve bandwidth. however, using cdns also...
...rary malicious content into files on the cdn (or replace the files completely) and thus can also potentially attack all sites that fetch files from that cdn. subresource integrity enables you to mitigate some risks of attacks such as this, by ensuring that the files your web application or web document fetches (from a cdn or anywhere) have been delivered without a third-party having injected any
additional content into those files — and without any other changes of any kind at all having been made to those files. using subresource integrity you use the subresource integrity feature by specifying a base64-encoded cryptographic hash of a resource (file) you’re telling the browser to fetch, in the value of the integrity attribute of any <script> or <link> element. an integrity value begi...
... }' | xxd -r -p | base64 notes: the pipe-through-xxd step takes the hexadecimal output from shasum and converts it to binary. the pipe-through-awk step is necessary because shasum will pass the hashed filename in its output to xxd. that can have disastrous consequences if the filename happens to have valid hex characters in it — because xxd will also decode that and pass it to base64. ...
...And 2 more matches
Web Components
the ecmascript 2015 class syntax (see classes for more information). register your new custom element using the customelementregistry.define() method, passing it the element name to be defined, the class or function in which its functionality is specified, and optionally, 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 wherever you like on your page, just like you would any regular html element. tutorials using custom elements a guide showing how t...
...r 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,
add to the shadow dom tree, style it, and more. using templates and slots a guide showing how to define a reusable html structure using <template> and <slot> elements, and then use that structure inside your web components. reference custom elements customelementregistry contains functionality related to custom elements, most notably the customelementregistry.define() method used to register...
...lass definition, which affect its behavior: connectedcallback: invoked when the custom element is first connected to the document's dom. disconnectedcallback: invoked when the custom element is disconnected from the document's dom. adoptedcallback: invoked when the custom element is moved to a new document. attributechangedcallback: invoked when one of the custom element's attributes is
added, removed, or changed. extensions for creating custom built-in elements the is global html attribute: allows you to specify that a standard html element should behave like a registered custom built-in element. the "is" option of the document.createelement() method: allows you to create an instance of a standard html element that behaves like a given registered custom buil...
...And 2 more matches
XPath snippets - XPath
g and serializing xml), the first argument to evaluatexpath() should be req.responsexml. ...
...responsexml. ...
...although walking the dom tree can achieve similar results, using xpath expressions is much qui...
...And 2 more matches
self - Archive of obsolete content
this article documents the self object that is available as a global in content scripts. self provides: access to the options object access to the port object access to a mostly deprecated messaging api for an overview of content scripts, see the main article. note that the self object in content scripts is completely different from the self module, which provides an api for an
add-on to access its data files and id. self properties options content-scripting apis such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content script as a json object via the contentscriptoptions option. if you do this, the data is available to the content script in the options property of self: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.
... this is an older api than the api provided by port, and for most purposes the port api is a better choice. the exception is the context-menu module, which still uses postmessage. postmessage() send a message...
..."./content-script.js", contentscriptoptions: { a: "blah" } }); } }); // content-script.js alert(self.options.a); port you can use port to receive messages from, and send messages to, the main
add-on code. see the documentation for port. methods the self object has four methods, which enable the content script to send messages to, and receive messages from, the main
add-on code. this is an older api than the api provided by port, and for most purposes the port api is a better choice. ...
...s the self object has four methods, which enable the content script to send messages to, and receive messages from, the main
add-on code. this is an older api than the api provided by port, and for most purposes the port api is a better choice. the exception is the context-menu module, which still uses postmessage. postmessage() send a message from a content script to a listener in the main
add-on code: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. on() start listening to messages from the main
add-on code: self.on("message", function(
addonmessage) { // handle the message }); this takes two parameters: the name of the event, and the handler function. the handler function is passed the message...
Classes and Inheritance - Archive of obsolete content
ary function calls in that javascript automatically creates a new object and binds it to the keyword this for the duration of the call. moreover, if the constructor does not return a value, the result of the call defaults to the value of this. constructors are just ordinary functions, however, so it is perfectly legal to perform ordinary function calls on them. in fact, some people (including the
add-on sdk team) prefer to use constructors this way. however, since the value of this is undefined for ordinary function calls, we need to
add some boilerplate code to convert them to constructor calls: function shape(x, y) { if (!this) return new shape(x, y); this.x = x; this.y = y; } prototypes every object has an implicit property, known as its prototype. when javascript l...
...ction is used in a constructor call, javascript makes the value of this property the prototype of the newly created object: let shape = shape(2, 3); object.getprototypeof(shape) == shape.prototype; // => true all instances of a class have the same prototype. this makes the prototype the perfect place to define properties that are shared between instances of the class. to illustrate this, let's
add a member function to the class shape: shape.prototype.draw = function () { throw error("not yet implemented"); } let shape = shape(2, 3); shape.draw(); // => error: not yet implemented inheritance and constructors suppose we want to create a new class, circle, and inherit it from shape. since every circle is also a shape, the constructor for shape must be called every time we call the con...
...ipt looks for 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 previous 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. ever...
...prototype.draw = function (ctx) { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, 2 * math.pi, false); ctx.fill(); }; with this definition in place, we get: let shape = shape(2, 3); shape.draw(); // error: not yet implemented let circle = circle(2, 3, 5); circle.draw(); // typeerror: ctx is not defined which is the behavior we were aiming for. classes in the
add-on sdk we have shown how to emulate classical inheritance in javascript using constructors and prototypes. however, as we have seen, this takes a significant amount of boilerplate code. the
add-on sdk team consists of highly trained professionals, but they are also lazy: that is why the sdk contains a helper function that handles this boilerplate code for us. it is defined in the module “core/...
self - Archive of obsolete content
access data that is bundled with the
add-on, and
add-on metadata. note that the self module is completely different from the global self object accessible to content scripts, which is used by a content script to communicate with the
add-on code. globals properties uri this property represents an
add-on associated unique uri string. this uri can be used for apis which require a valid uri string, such as the passwords module. id this property is a printable string that is unique for each
add-on. it comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). ...
...perties uri this property represents an
add-on associated unique uri string. this uri can be used for apis which require a valid uri string, such as the passwords module. id this property is a printable string that is unique for each
add-on. it comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). while not generally of use to
add-on code directly, it can be used by internal api code to index local storage and other resources that are associated with a particular
add-on. name this property contains the
add-on's short name. it comes from the name property in the main package's package.json file. version this property contains the
add-on's version string. it comes from the version property set in the package.json file in...
...associated with a particular
add-on. name this property contains the
add-on's short name. it comes from the name property in the main package's package.json file. version this property contains the
add-on's version string. it comes from the version property set in the package.json file in the main package. loadreason this property contains of the following strings describing the reason your
add-on was loaded: install enable startup upgrade downgrade isprivatebrowsingsupported this property indicates whether or not the
add-on supports private browsing. it comes from the private-browsing key in the
add-on's package.json file. data the data object is used to access data that was bundled with the
add-on. ...
...all files in this directory will be copied into the xpi and made available through the data object. the package specification article explains the package.json file. methods data.load(name) the data.load() method returns the contents of an embedded data file, as a string. ...
chrome - Archive of obsolete content
chrome is a built-in pseudo module of the toolkit loader. ...
... chrome is a built-in pseudo module of the toolkit loader. ...
... chrome is a built-in pseudo module of the toolkit loader. ...
... chrome is a built-in pseudo module of the toolkit loader. ...
event/target - Archive of obsolete content
ts that broadcast events. users of the object can listen to the events using the standard on() and once() functions. usage many objects in the sdk can broadcast events. for example, a panel instance emits an show event when the panel is shown. with this module you can create your own objects that emit events. this module provides an exemplar eventtarget object, that implements an interface for
adding and removing event listeners of a specific type. eventtarget is the base class for all objects in sdk on which events are emitted. also see the tutorial on implementing event targets to get started with this api. instantiation it's easy to create event target objects, no special arguments are required. const { eventtarget } = require("sdk/event/target"); let target = eventtarget(); for a ...
...ial arguments are required. const { eventtarget } = require("sdk/event/target"); let target = eventtarget(); for a convenience though optional options arguments may be used, in which case all the function properties with keys like: onmessage, onmyevent... will be auto registered for associated 'message', 'myevent' events on the created instance. all other properties of options will be ignored.
adding listeners eventtarget interface defines on method, that can be used to register event listeners on them for the given event type: target.on('message', function onmessage(message) { // note: `this` pseudo variable is an event `target` unless // intentionally overridden via `.bind()`. console.log(message); }); sometimes event listener may care only about very first event of specific typ...
...that can be used to register event listeners on them for the given event type: target.on('message', function onmessage(message) { // note: `this` pseudo variable is an event `target` unless // intentionally overridden via `.bind()`. console.log(message); }); sometimes event listener may care only about very first event of specific type. eventtarget interface defines convenience method for
adding one shot event listeners via method once. such listeners are called only once next time event of the specified type is emitted: target.once('ready', function onready() { // do the thing once ready! }); removing listeners eventtarget interface defines api for unregistering event listeners, via removelistener method: target.removelistener('message', onmessage); emitting events eventtarge...
...'); // info: caught an error: boom! if there is no listener registered for error event or if it also throws exception then such exceptions are logged into a console. chaining emitters can also have their methods chained: target.on('message', handlemessage) .on('data', parsedata) .on('error', handleerror); eventtarget eventtarget is an exemplar for creating an objects that can be used to
add / remove event listeners on them. events on these objects may be emitted via emit function exported by event/core module. methods initialize() method initializes this event source. it goes through properties of a given options and registers listeners for the ones that look like event listeners. on(type, listener) registers an event listener that is called every time events of specified type ...
frame/hidden-frame - Archive of obsolete content
i.e. xul <iframe> elements) that are not displayed to the user. this is useful in the construction of apis that load web content not intended to be directly seen or accessed by users, like page-worker. it is also useful in the construction of apis that load web content for intermittent display, such as panel. ...
...er. this is useful in the construction of apis that load web content not intended to be directly seen or accessed by users, like page-worker. it is also useful in the construction of apis that load web content for intermittent display, such as panel. usage the module exports a constructor function, hiddenframe, and two other functions,
add and remove. hiddenframe constructs a new hidden frame.
add registers a hidden frame, preparing it to load content. ...
... and two other functions,
add and remove. hiddenframe constructs a new hidden frame.
add registers a hidden frame, preparing it to load content. remove unregisters a frame, unloading any content that was loaded in it. the following code creates a hidden frame, loads a web page into it, and then logs its title: var hiddenframes = require("sdk/frame/hidden-frame"); let hiddenframe = hiddenframes.
add(hiddenframes.hiddenframe({ onready: function() { this.element.contentwindow.location = "http://www.mozilla.org/"; let self = this; this.element.
addeventlistener("domcontentloaded", function() { console.log(self.element.contentdocument.title); }, true, true); } })); see the panel module for a real-world example of usage of this module. globals constructors hiddenframe...
...ns) creates a hidden frame. parameters options : object required options: name type onready function,array functions to call when the frame is ready to load content. you must specify an onready callback and refrain from using the hidden frame until the callback gets called, because hidden frames are not always ready to load content the moment they are
added. functions
add(hiddenframe) register a hidden frame, preparing it to load content. parameters hiddenframe : hiddenframe the frame to
add remove(hiddenframe) unregister a hidden frame, unloading any content that was loaded in it. parameters hiddenframe : hiddenframe the frame to remove hiddenframe hiddenframe objects represent hidden frames. properties element the host ...
places/bookmarks - Archive of obsolete content
create, modify, and retrieve bookmarks. usage this module exports: three constructors: bookmark, group, and separator, corresponding to the types of objects, referred to as bookmark items, in the bookmarks database in firefox two
additional functions, save() to create, update, and remove bookmark items, and search() to retrieve the bookmark items that match a particular set of criteria. ...
... save() and search() are both asynchronous functions: they synchronously return a placesemitter object, which then asynchronously emits events as the operation progresses and completes. each retrieved bookmark item represents only a snapshot of state at a specific time. the module does not automatically sync up a bookmark instance with ongoing changes to that item in the database from the same
add-on, other
add-ons, or the user. examples creating a new bookmark let { bookmark, save } = require("sdk/places/bookmarks"); // create a new bookmark instance, unsaved let bookmark = bookmark({ title: "mozilla", url: "http://mozilla.org" }); // attempt to save the bookmark instance to the bookmarks database // and store the emitter let emitter = save(bookmark); // listen for events emitter.on...
...ndex number the index of the bookmark group within its parent group. last item within the group by default. functions save(bookmarkitems, options) creating, saving, and deleting bookmarks are all done with the save() function. this function takes in any of: a bookmark item (bookmark, group, separator) a duck-typed object (the relative properties 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 previous save() or from the res...
...thin a query object. multiple query objects are then or'd together. options : object optional options: name type count number the number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'date
added' and 'lastmodified'. descending boolean a boolean specifying whether the results should be in descending order. by default, results are in ascending order. properties menu this is a constant, default group on the firefox platform, the bookmarks menu. it can be used in queries or specifying the parent of a bookmark item, but it cannot be modified. toolbar t...
util/collection - Archive of obsolete content
rray, but its items are unique, like a set. globals constructors collection([array]) creates a new collection. the collection is backed by an array. parameters array : array if array is given, it will be used as the backing array. this way the caller can fully control the collection. otherwise a new empty array will be used, and no one but the collection will have access to it. functions
addcollectionproperty(object, propname, [backingarray])
adds a collection property to the given object. setting the property to a scalar value empties the collection and
adds the value. setting it to an array empties the collection and
adds all the items in the array. parameters object : object the property will be defined on this object. propname : string the name of the property. backingarra...
.... setting it to an array empties the collection and
adds all the items in the array. parameters object : object the property will be defined on this object. propname : string the name of the property. backingarray : array if given, this will be used as the collection's backing array. collection a collection object provides for...in-loop iteration. items are yielded in the order they were
added. for example, the following code... var collection = require("sdk/util/collection"); var c = new collection.collection(); c.
add(1); c.
add(2); c.
add(3); for (item in c) console.log(item); ... would print this to the console: 1 2 3 iteration proceeds over a copy of the collection made before iteration begins, so it is safe to mutate the collection during iteration; doing so does not ...
...any items already contained in the collection are ignored. parameters itemoritems : object an item or array of items. returns collection : the collection. remove(itemoritems) removes a single item or an array of items from the collection. ...
...any items already contained in the collection are ignored. parameters itemoritems : object an item or array of items. returns collection : the collection. remove(itemoritems) removes a single item or an array of items from the collection. ...
window/utils - Archive of obsolete content
to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. ...
... to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. globals functions getmostrecentbrowserwindow() get the topmost browser window, as an nsidomwindow instance. ...
..., see the window.opendialog documentation. optional, defaults to: 'chrome,all,dialog=no'. args object extra argument(s) to be attached to the new window as the window.arguments property. returns nsidomwindow windows() returns an array of all currently opened windows. note that these windows may still be loading. in order to see private windows in this list, your
add-on must have opted into private browsing and you must include the includeprivate key in the list of options: var allwindows = window_utils.windows(null, {includeprivate:true}); parameters type : string string identifying the type of window to return. this is passed directly into nsiwindowmediator.getenumerator(), so its possible values are the same as those expected by that function. in part...
... browser windows devtools:scratchpad: get scratchpad windows navigator:view-source: get view source windows if you're not also passing options, you can omit this, and it's the same as passing null. options : object options object containing the following property: name type includeprivate boolean whether to include private windows. defaults to false. the
add-on must also have opted into private windows for this to have an effect. returns array: array of nsidomwindow instances. isdocumentloaded(window) check if the given window's document is completely loaded. this means that its "load" event has been fired and all content is loaded, including the whole dom document, images, and any other sub-resources. parameters window : nsidomwindow re...
Displaying annotations - Archive of obsolete content
eated. when a page is loaded the matcher searches the dom for elements that match annotations. if it finds any it binds functions to that element's mouseenter and mouseleave events to send messages to the main module, asking it to show or hide the annotation. like the selector, the matcher also listens for the window's unload event and on unload sends a detach message to the main module, so the
add-on can clean it up. the complete content script is here: self.on('message', 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('...
....stoppropagation(); event.preventdefault(); }); $('.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'); $(annotationanchor).attr('annotation', annotation.annotationtext); } save this in data as matcher.js. updating main.js first, initialize an array to hold workers associated with the matcher's content scripts: var matchers = []; in the main function,
add the code to create the matcher: var matcher = pagemod.pagemod({ include: ['*'], contentscriptwhen: 'ready', cont...
... () { detachworker(this, matchers); }); matchers.push(worker); } }); when a new page is loaded the function assigned to onattach is called. this function: initializes the content script instance with the current set of annotations provides a handler for messages from that content script, handling the three messages - show, hide and detach - that the content script might send
adds the worker to an array, so we it can send messages back later. then in the module's scope implement a function to update the matcher's workers, and edit handlenewannotation to call this new function when the user enters a new annotation: function updatematchers() { matchers.foreach(function (matcher) { matcher.postmessage(simplestorage.storage.annotations); }); } function handlenewan...
...iptfile: [data.url('jquery-1.4.2.min.js'), data.url('annotation/annotation.js')], onshow: function() { this.postmessage(this.content); } }); execute cfx run one last time. activate the annotator and enter an annotation. you should see a yellow border around the item you annotated: when you move your mouse over the item, the annotation should appear: obviously this
add-on isn't complete yet. it could do with more beautiful styling, it certainly needs a way to delete annotations, it should deal with overquota more reliably, and the matcher could be made to match more reliably. but we hope this gives you an idea of the things that are possible with the modules in the sdk. ...
Implementing the widget - Archive of obsolete content
we want the widget to do two things: on a left-click, the widget should activate or deactivate the annotator. on a right-click, the widget should display a list of all the annotations the user has created. because the widget's click event does not distinguish left and right mouse clicks, we'll use a content script to capture the click events and send the corresponding message back to our
add-on. the widget will have two icons: one to display when it's active, one to display when it's inactive. so there are three files we'll need to create: the widget's content script and its two icons. inside the data subdirectory create another subdirectory widget. we'll keep the widget's files here. this hierarchy isn't mandatory; you could just keep them all under data. but it seems tidier this...
...the widget's content script and its two icons. inside the data subdirectory create another subdirectory widget. we'll keep the widget's files here. this hierarchy isn't mandatory; you could just keep them all under data. but it seems tidier this way. the widget's content script the widget's content script just listens for left- and right- mouse clicks and posts the corresponding message to the
add-on code: this.
addeventlistener('click', function(event) { if(event.button == 0 && event.shiftkey == false) self.port.emit('left-click'); if(event.button == 2 || (event.button == 0 && event.shiftkey == true)) self.port.emit('right-click'); event.preventdefault(); }, true); save this in your data/widget directory as widget.js. the widget's icons you can copy the widget's icons ...
...tton == 0 && event.shiftkey == true)) self.port.emit('right-click'); event.preventdefault(); }, true); save this in your data/widget directory as widget.js. 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. ...
...on() { console.log('show annotation list'); }); } the annotator is inactive by default. it creates the widget and responds to messages from the widget's content script by toggling its activation state. since we don't have any code to display annotations yet, we just log the right-click events to the console. now from the annotator directory type cfx run. you should see the widget in the
add-on bar: left- and right-clicks should produce the appropriate debug output, and a left-click should also change the widget icon to signal that it is active. next we'll
add the code to create annotations. ...
Listening for Load and Unload - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. if your
add-on exports a function called main(), then that function will be called whenever the
add-on is loaded, and it will be passed an object containing a string describing the reason it was loaded as well as any arguments passed to it. if your
add-on exports a function called onunload(), then that function will be called when the
add-on is unloaded, and it will be passed a string describing the reason it was unloaded. you don't have to use exports.main() or exports.onunload(). you can just place your
add-on's code at the top level instead of wrapping it in a function assigned to exports.main(). it will be loaded in the same circumstances, but you won't get access to the load/unload reason or arguments. exports.
...-on is unloaded, and it will be passed a string describing the reason it was unloaded. you don't have to use exports.main() or exports.onunload(). you can just place your
add-on's code at the top level instead of wrapping it in a function assigned to exports.main(). it will be loaded in the same circumstances, but you won't get access to the load/unload reason or arguments. exports.main() your
add-on's main.js code is executed as soon as it is loaded. it is loaded when it is installed, when it is enabled, or when firefox starts. if your
add-on exports a function called main(), that function will be called immediately after the overall main.js is evaluated, and after all top-level require() statements have run (so generally after all dependent modules have been loaded). exports.main = f...
...is enabled, or when firefox starts. if your
add-on exports a function called main(), that function will be called immediately after the overall main.js is evaluated, and after all top-level require() statements have run (so generally after all dependent modules have been loaded). exports.main = function (options, callbacks) {}; options is an object describing the parameters with which your
add-on was loaded. options.loadreason options.loadreason is one of the following strings describing the reason your
add-on was loaded: install enable startup upgrade downgrade exports.onunload() if your
add-on exports a function called onunload(), that function will be called when the
add-on is unloaded. exports.onunload = function (reason) {}; reason reason is one of the following strin...
...eason options.loadreason is one of the following strings describing the reason your
add-on was loaded: install enable startup upgrade downgrade exports.onunload() if your
add-on exports a function called onunload(), that function will be called when the
add-on is unloaded. exports.onunload = function (reason) {}; reason reason is one of the following strings describing the reason your
add-on was unloaded: uninstall disable shutdown upgrade downgrade if your
add-on is disabled, then uninstalled, your onunload listener will only be called once, with the disable reason. this happens because disabling an
add-on also disables its onunload listeners, so there is no listener remaining when the
add-on is uninstalled. for more, see bug 627432, in particular comment 12 on that bug. ...
Unit Testing - Archive of obsolete content
provides a framework to help create and run unit tests for your code. to demonstrate how it works we'll write some unit tests for a simple base64 encoding module. a simple base64 module in a web page, you can perform base64 encoding and decoding using the btoa() and atob() functions. unfortunately these functions are attached to the window object: since this object is not available in your main
add-on code, atob() and btoa() aren't available either. so we'll create a base64 module to expose these functions from the platform (see creating reusable modules). to begin with, create a new directory, navigate to it, and run jpm init. now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://gre/modules/services.jsm"); exports.atob ...
...in its place create a file called test-base64.
... onclick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); to run this example you'll also have to have an icon file named "icon-16.png" saved in your
add-ons "data" directory. you could download this icon: . now "index.js" imports the base64 module and calls its two exported functions. if we run the
add-on and click the button, we should see the following logging output: info: agvsbg8= info: hello testing the base64 module navigate to the
add-on's test directory and delete the test-index.js file. in its place create a file called test-base64.js with the following contents: var base64 = require("../base64"); exports["test atob"] = function(assert) { assert.ok(base64.atob("agvsbg8=") == "h...
...ed by the test/assert module and implements the commonjs unit testing specification. the first two functions call atob() and btoa() and use assert.ok() to check that the output is as expected. the second function tests the module's error-handling code by passing an empty string into atob() and using assert.throws() to check that the expected exception is raised. at this point your
add-on ought to look like this: /base64 /data icon-16.png package.json readme.md index.js base64.js /test test-base64.js now execute jpm --verbose test from the
add-on's root directory. you should see something like this: console.info: jpm-utest: executing './test/test-base64.test atob' console.info: jpm-utest: pass: atob works console.inf...
Tutorials - Archive of obsolete content
this page lists practical hands-on articles about how to accomplish specific tasks using the sdk. getting started installation how to install the jpm tool, which you will use for developing
add-ons. troubleshooting some pointers for fixing common problems and getting more help. getting started walkthrough of creating a simple
add-on with the sdk, using jpm. create user interfaces
add a toolbar button attach a button to the firefox
add-on toolbar.
add a menu item to firefox
add items to firefox's main menus. display a popup display a popup dialog implemented with html and javascript.
add a context menu item
add items to firefox's context menu. interact with the browser open a web page open a web page in a new browser tab or window u...
...ages based on url create filters for web pages based on their url: whenever a web page whose url matches the filter is loaded, execute a specified script in it. modify the active web page dynamically load a script into the currently active web page. development techniques logging log messages to the console for diagnostic purposes. creating reusable modules structure your
add-on in separate modules to make it easier to develop, debug, and maintain. create reusable packages containing your modules, so other
add-on developers can use them too. unit testing writing and running unit tests using the sdk's test framework. chrome authority get access to the components object, enabling your
add-on to load and use any xpcom object. creating event targets enable the ob...
...ning your modules, so other
add-on developers can use them too. unit testing writing and running unit tests using the sdk's test framework. chrome authority get access to the components object, enabling your
add-on to load and use any xpcom object. creating event targets enable the objects you define to emit their own events. listen for load and unload get notifications when your
add-on is loaded or unloaded by firefox, and pass arguments into your
add-on from the command line. using third-party modules (jpm) install and use
additional modules which don't ship with the sdk itself. localization writing localizable code. mobile development develop
add-ons for firefox mobile on android.
add-on debugger debug your
add-on's javascript. putting it together annot...
...s loaded or unloaded by firefox, and pass arguments into your
add-on from the command line. using third-party modules (jpm) install and use
additional modules which don't ship with the sdk itself. localization writing localizable code. mobile development develop
add-ons for firefox mobile on android.
add-on debugger debug your
add-on's javascript. putting it together annotator
add-on a walkthrough of a relatively complex
add-on. ...
Bookmarks - Archive of obsolete content
finding the folder containing an item if you need to know what folder contains an item (this can be especially handy after using nsinavbookmarksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. var parentfolderid = bmsvc.getfolderidforitem(newbkmkid); observing changes ...
...marksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. ...
...l need to create an nsinavbookmarkobserver object and use the nsinavbookmarksservice.
addobserver() and nsinavbookmarksservice.removeobserver() methods. note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method. ...
...(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my
add-on is loaded onload: function() { bmsvc.
addobserver(myext_bookmarklistener, false); }, // this function is called when my
add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function() { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome - bookm...
Forms related code snippets - Archive of obsolete content
document.attachevent("onmousedown", ondocclick) : (document.onmousedown = ondocclick); })(); </script> <style type="text/css"> tab...
..."oct", "nov", "dec"], sdays = ["m", "t", "w", "t", "f", "s", "s"], bzeroismonday = true, /* internal usage */ ainstances = [], amonthlengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], rbgnnan = /^\d+/, rbgnandend = /^\d+|\d+\d+$/g, rmonth = /\-month\-/, rdecrease = /\-decr\-/; var /* customizable by user */ nzindex = 1000; window.
addeventlistener ?
addeventlistener("load", buildcalendars, false) : window.attachevent ? attachevent("onload", buildcalendars) : (onload = buildcalendars); document.
addeventlistener ? document.
addeventlistener("mousedown", ondocclick, false) : document.attachevent ? document.attachevent("onmousedown", ondocclick) : (document.onmousedown = ondocclick); })(); </script> <style type="text/css"> table.zdp-calendar { ...
... { border: 1px solid #666666; border-collapse: collapse; background-color: #cccccc; cursor: default; font-family: verdana; font-size: 12px; } table.zdp-calendar th { border: 1px solid #666666; font-weight: bold; background-color: #ff6666; } table.zdp-calendar td { border: 1px solid #666666; text-align: center; } table.zdp-calendar caption { background-color: #333333; p
adding: 2px; } span.zdp-current-month { display: inline-block; width: auto; height: 16px; p
adding: 0 2px; line-height: 16px; margin: 0 auto; background-color: #999999; border-radius: 5px; } span.zdp-increase-month, span.zdp-increase-year, span.zdp-decrease-month, span.zdp-decrease-year { display: block; p
adding: 0 2px; height: 16px; font-weight: bold; background-color: #99...
..., span.zdp-decrease-month, span.zdp-decrease-year { display: block; p
adding: 0 2px; height: 16px; font-weight: bold; background-color: #999999; border-radius: 5px; cursor: pointer; } span.zdp-decrease-month, span.zdp-decrease-year { float: left; margin-right: 2px; } span.zdp-increase-month, span.zdp-increase-year { float: right; margin-left: 2px; } td.zdp-active-cell { p
adding: 1px 3px; cursor: pointer; color: #000000; text-align: center; vertical-align: middle; } td.zdp-active-cell:hover { background-color: #999999; cursor: pointer; } td.zdp-empty-cell { cursor: not-allowed; } </style> </head> <body> <form name="myform"> <p> from: <input type="text" readonly class="date-picker" name="date-from" /> to: <input type="text" readonly class="d...
StringView - Archive of obsolete content
the aims of this library are: to create a c-like interface for strings (i.e., an array of character codes — an arraybufferview in javascript) based upon the javascript arraybuffer interface to create a highly extensible library that anyone can extend by
adding methods to the object stringview.prototype to create a collection of methods for such string-like objects (since now: stringviews) which work strictly on arrays of numbers rather than on creating new immutable javascript strings to work with unicode encodings other than javascript's default utf-16 domstrings introduction as web applications become more and more powerful,
adding features such as audio and video manipulation, access to raw data using websockets, and so forth, it has become clear that there are times whe...
...|*| http://www.gnu.org/licenses/lgpl-3.0.html |*| \*/ function stringview (vinput, sencoding /* optional (default: utf-8) */, noffset /* optional */, nlength /* o...
...character. it is rappresented by a collection of 1-6 uint8 elements for utf-8, 1-2 uint16 elements for utf-16, 1 uint32 element for ucs4, 1 uint8 element for ascii, or something else. byte a collection of 8 bits. null codepoint the character whose codepoint is equal to 0 ('\0'). notes when you include the script stringview.js into a page, no variables other than stringview itself will be
added to the global scope. stringview is a highly extensible library, that anyone can extend by
adding methods to the object stringview.prototype. for example, imagine you want to create a method similar to string.replace(), but for stringview objects. maybe you would like to solve a situation like the following: var omystringview = new stringview("hello, strange people!"); // utf-8 va...
... stringview has been proposed as strawman for es2015 on ecmascript bugs. everyone can participate in the discussion at bug 1557 or at esdiscuss. ...
xml:base support in old browsers - Archive of obsolete content
heme = /(\w(\w|\d|\+|\- |\ .)*)\:\/\//; function getxmlbaselink (xlink, thisitem) { var xmlbase = ''; if (!xlink.match(scheme)) { // only check for xml base if there is no protocol // tests for 'scheme' per http://www.ietf.org/rfc/rfc2396.txt' xmlbase = getxmlbase (thisitem); if (!xmlbase.match(/\/$/) && !xlink.match(/\/$/)) { // if no preceding slash on xlink or trailing slash on xml:base,
add one in between xmlbase += '/'; } else if (xmlbase.match(/\/$/) && xlink.match(/\/$/)) { xmlbase = xmlbase.substring(0, xmlbase.length-2); // strip off last slash to join with xlink path with slash } // alert(xmlbase + '::' + xlink); } var link = xmlbase + xlink; if (!link.match(scheme)) { // if there is no domain, we'll need to use the current domain var l...
...f (abs) { var skipfile = (att.indexof('///') === protocolpos) ? ...
...tocol has an extra slashe, prepare to also skip it in the separator search var att2 = att.indexof('/', protocolpos+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 previous 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, ...
...null : xmlbase; return xmlbase; } ...
Custom about: URLs - Archive of obsolete content
this example creates an about page with url about:myaboutpage which takes a user to a page that writes some text out. make sure to generate a unique aboutpage_id, see this page to learn more about generating uuid's: uuid. it is imported to queryinterface the components.manager otherwise this will not work. this example can be easily modified, just modify the global const at in the // globals section. ...
...bals const aboutpage_description = 'this is my custom about page'; const aboutpage_id = 'aa132730-2278-11e5-867f-0800200c9a66'; // make sure you generate a unique id from https://www.famkruithof.net/uuid/uuidgen const aboutpage_word = 'myaboutpage' const aboutpage_uri = 'data:text/html,hi this is the page that is shown when navigate to about:myaboutpage'; // const aboutpage_uri = 'chrome://myabout
addon/content/index.html'; class aboutpage { static get classid() { return components.id(`{${aboutpage_id}}`); } static get classdescription() { return aboutpage_description; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { return xpcomutils.generateqi([ci.nsiaboutmodule]); } constructor() { object.free...
... factory.unregister(); // .... } and there you ha...
... this); } unregister() { cm.unregisterfactory(this.component.prototype.classid, this); } } instantiation firefox 4+ now in the startup procedure of your bootstrapped
addon make sure to do register the factory, for example: let factory; function startup(adata, areason) { // ... factory = new factory(aboutcustom); // ... } and then on shutdown of your bootstrapped
addon make sure to destroy the factory: function shutdown(adata, areason) { if (areason == app_shutdown) { return } // ... factory.unregister(); // .... } and there you have it, your own custom about page. ...
Local Storage - Archive of obsolete content
a labs have come up with a javascript implementation of a logger similar to the log4j logger used in java projects. the logger is called log4moz and it is implemented as a javascript code module, so it only works on firefox 3 and above. to use this logger, you need to copy the log4moz.js file to your modules directory. in the initialization method of your one of your "common" or startup objects,
add the following code: let formatter = new log4moz.basicformatter(); let root = log4moz.repository.rootlogger; let logfile = this.getlocaldirectory(); // remember this? let appender; logfile.append("log.txt"); // loggers are hierarchical, lowering this log level will affect all // output. root.level = log4moz.level["all"]; // this appender will log to the file system. appender = new log4moz.rota...
...4moz.repository.rootlogger; let logfile = this.getlocaldirectory(); // remember this? let appender; logfile.append("log.txt"); // loggers are hierarchical, lowering this log level will affect all // output. root.level = log4moz.level["all"]; // this appender will log to the file system. appender = new log4moz.rotatingfileappender(logfile, formatter); appender.level = log4moz.level["all"]; root.
addappender(appender); after that, you can create a logger object for any object in your project like this: this._logger = log4moz.repository.getlogger("xulschool.someobject"); this._logger.level = log4moz.level["all"]; note: we recommend that you create a logger instance in the constructor of every object and store it in a private variable. and then logging is done with any of the followi...
...n catch blocks include some logging at the error or warn levels, and in general you should use logging freely in order to have as much information as possible to fix bugs and know what is going on. don't log inside functions that are called too often, such as mouseover event handlers, or certain http activity listeners. this impacts performance and fills the log with useless messages. we normally
add a comment that indicates that logging is not done there for performance reasons. sqlite sqlite storage was introduced in firefox 2, and it's the preferred storage mechanism in firefox. it is the storage system used for the places api that manages bookmarks and history. it's also used for storing cookies, form inputs, and others. sqlite is a lightweight sql based storage system. it is ideal for...
...e recommend for local storage in extensions. the storage page has a good explanation on how to use the sqlite api, so we won't go over that again. if you're unfamiliar with sql or if you're interested in knowing the restrictions in the syntax used by sqlite, you can read more at the sqlite site. you should carefully design your database structure, taking into account features you're planning on
adding in the future.
adding or removing columns, or making other changes to your db structure from one version of your extension to the next will probably cause breakage of user data in older versions. you'll need to carefully
add migration code that moves the data from the old db format to the new, and this becomes increasingly complex as you
add new versions and new structure changes. so, be caref...
Useful Mozilla Community Sites - Archive of obsolete content
« previous 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. amo has a review process that prevents malicious, insecure or low quality extensions ...
... 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 follows amo's policies when you nominate it. you can still get a good number of downloads while being in the sandbox. one of the main advantages of using amo is that it handles updates automatically for published
add-ons. you just need to upload a new version of your extension, and once it's approved it will be pushed as an update to all your users. if you decide to host your own extension, you'll have to learn about the update system in order to push your own updates. babelzilla babelzilla is a worldwide community of localizers. developers submit their extensions using the web translation system (wts) and ...
... 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 community. it offers many necessary services such as bug tracking, source code repositories, download mirrors and many communication tools. there are other free hosting sites such as souceforge and google code that are also very good, but not as specialized as mozdev. you should pick the one that best fits your development ...
...ug tracking, source code repositories, download mirrors and many communication tools. there are other free hosting sites such as souceforge and google code that are also very good, but not as specialized as mozdev. you should pick the one that best fits your development needs. conclusion that's it! this is the end of the xul school tutorial. hopefully this guide has helped you get started with
add-on development and you're on your way to joining the large mozilla
add-ons developer community. the sheer volume of material can be overwhelming, but you can always come back and use this tutorial as a reference for your future development. now all you need is a good idea (in case you didn't have one already) and get started. happy coding! « previous this tutorial was kindly donated to ...
Performance best practices in extensions - Archive of obsolete content
degree can be counter-productive. code should be modularized to the extent that doing so increases clarity, and loading of large or expensive chunks of code fragments can be significantly deferred. defer everything that you can most extensions have a load event listener in the main overlay that runs their startup functions. do as little as possible here. the browser window is blocked while your
add-on's load handler runs, so the more it does, the slower firefox will appear to the user. if there is anything that can be done even a fraction of a second later, you can use an nsitimer or the window.settimeout() method to schedule that work for later. even a short delay can have a big impact. general performance tips avoid creating memory leaks memory leaks require the garbage collector and...
.... even a short delay can have a big impact. general performance tips avoid creating memory leaks memory leaks require the garbage collector and the cycle collector to work harder, which can significantly degrade performance. zombie compartments are a particular kind of memory leak that you can detect with minimal effort. see the zombie compartments page, especially the proactive checking of
add-ons section. see common causes of memory leaks in extensions for ways to avoid zombie compartments and other kinds of leaks. as well as looking for these specific kinds of leaks, it's worth exercising your extension's functionality and checking the contents of about:memory for any excessive memory usage. for example, bug 719601 featured a "system principal" javascript compartment containing 10...
... that any selector in your rule which might match many different nodes is a source of inefficiency during either selector matching or dynamic update processing. this is especially bad for the latter if the selector can dynamically start or stop matching. avoid unqualified ":hover" like the plague. avoid dom mutation event listeners dom mutation event listeners are extremely expensive and, once
added to a document even briefly, significantly harm its performance. as mutation events are officially deprecated, and there are many alternatives, they should be avoided at all costs. lazily load services the xpcomutils javascript module provides two methods for lazily loading things: definelazygetter() defines a function on a specified object that acts as a getter which will be created the fi...
... avoid mouse movement events avoid using mouse event listeners, including mouseover, mouseout, mouseenter, mouseexit, and especially mousemove. these events happen with high frequency, so their listeners can trivially create very high cpu overhead. when these events cannot be avoided, computation during the listeners should be kept to a minimum and real work throttled. the listeners should be
added to the most specific element possible, and removed when not immediately necessary. avoid animated images animated images are much more expensive than generally expected, especially when used in xul tree elements.. consider using chrome workers you can use a chromeworker to execute long running tasks or do data processing. ...
XML data - Archive of obsolete content
to be displayed like html paragraphs. in the document's stylesheet, you specify how info elements are to be displayed: info { display: block; margin: 1em 0; } the most common values for the display property are: block displayed like html's div (for headings, paragraphs) inline displayed like html's span (for emphasis within text)
add your own style rules that specify the font, spacing and other details in the same way as for html. more details other values of display display the element like a list item, or like a component of a table. for the full list of display types, see the display property in the css specification. using css alone, the structure of the display must be the same as the structure of th...
...html. more details other values of display display the element like a list item, or like a component of a table. for the full list of display types, see the display property in the css specification. using css alone, the structure of the display must be the same as the structure of the document. other technologies can modify the structure of the display—for example, xbl can
add content, and javascript can modify the dom. for more information about xml in mozilla, see the xml page in this wiki. action: an xml demonstration make a new xml file, doc9.xml. copy and paste the content from here, making sure that you scroll to get all of it: <?xml version="1.0"?> <!-- xml demonstration --> <?xml-stylesheet type="text/css" href="style9.css"?> <!doctype planet>...
...> </ocean> <ocean> <name>southern</name> <area>20,000</area> <depth>4,500</depth> </ocean> </planet> make a new css file, style9.css. ...
...style9.css. ...
Creating a status bar extension - Archive of obsolete content
reated by this tutorial won't work in firefox that don't have a static status bar (that is, firefox 4 and up). you can find a more up-to-date tutorial in the xul school tutorial the essentials of an 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. this sample will
add a static text string to the status bar at the bottom of firefox browser windows. if this sounds a lot like the existing building an extension article, you're right. however, this sample will be expanded upon in later articles in the series. 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 the install mani...
...ormation is needed so firefox can uniquely identify your extension. in this sample, these fields are: property name description id a unique identification string. before firefox 1.5, this was a guid. starting with firefox 1.5, however, you should use a string in the form extension-name@creator-domain. version the extension's version number. type the
addon type. for extensions, this is 2. human-readable information in this sample, we have four pieces of human-readable information; that is, information that is displayed to the user within the firefox interface. these are: property name description em:name the extension's name. this name is displayed in the extensions window. em:description a short, one-lin...
... # firefox overlay chrome://browser/content/browser.xul chrome://status-bar-sample-1/content/status-bar-sample-1.xul the first line registers the location on disk of the contents of the extension whose id is "status-bar-sample-1". this path is relative to the extension's root folder in this case, but can be absolute if you want it to be. the second line registers an overlay. an overlay lets you
add new content to an existing document. in this case, we want to augment the ui of the firefox browser, so we specify the uri of the firefox main window's xul file, "chrome://browser/content/browser.xul", as the interface to overlay onto, and the uri of our own xul file, "chrome://status-bar-sample-1/content/status-bar-sample-1.xul", as the interface to overlay onto the browser. see xul overlays for...
...rlay onto, and the uri of our own xul file, "chrome://status-bar-sample-1/content/status-bar-sample-1.xul", as the interface to overlay onto the browser. see xul overlays for details on how overlays work. you can also find more details about format of chrome manifests in the chrome manifest section. the xul overlay the xul overlay file contains the xul description of the user interface we want to
add to firefox. our overlay file, status-bar-sample-1.xul, looks like this: <?xml version="1.0" encoding="utf-8"?> <!doctype overlay > <overlay id="status-bar-sample-1-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- firefox --> <statusbar id="status-bar"> <statusbarpanel id="status-bar-sample-1" label="hello world" tooltiptext="sample...
Style System Overview - Archive of obsolete content
this is big, and slow to fill in. the rule tree allows sharing. to allow for optimizations, each style struct contains only inherited properties or only “reset” properties. (thus these structs can be called inherited structs or reset structs.) in the normal case, a style rule has a small number of declarations (hitting only a small number of structs). the rule tree...
...rs the first rule that contributed non-empty data. style data computation after walkruletree stops walking up, it calls nsrulenode::compute*data to turn the specified values into the mostly-computed style data in the style struct. compute*data use either a default or a start struct as the basis for the computation. a start struct is a cached struct in the rule tree that we can just copy and
add to. if the computation in compute*data used any data from the parent style context, we cache the struct on the style context. otherwise, we cache the struct in the rule tree, on the first rule node that contributed any data, and mark dependent bits on the path up to that rule node. managing style contexts style contexts must (in most cases) be created before frames are constructed, to dete...
...hat we don't have to walk the whole tree to find the nodes. nscssframeconstructor::attributechanged only re-resolves style on the subtree of the element, just like other attribute changes. different hint mechanism (from rule structs, not data structs) could make attributechanged just go straight to a frame-change, instead. bugs due to failure to call nsiframe::didsetstylecontext. style sheet
addition and removal handled in pres shell. presshell::reconstructstyledata calls framemanager::computestylechangefor (reresolve) and then processes the frame-change list. rebuilds rule tree if stylesheet was removed to avoid dangling pointers (and perhaps aliasing that would cause problems). otherwise we'd have to walk rule tree and compare each rule node to every rule in the sheet (o(rules * r...
...h is a document observer) and in the pres shell. code should be merged. rule change applies the rule-struct hint as if the rule matched the root element. (inefficient) it does clearing of style data (through stylesetimpl::clearstyledata) by walking the rule tree and then the style context tree. (could be handled by simultaneous clearing and difference calculation of data (somewhat tricky)) rule
addition and removal just rebuild the entire world. we could at least do what we do for sheet
addition/removal, or slightly better, by searching the rule tree (only one rule this time) instead of rebuilding it. lots of room for optimization here. (but beware didsetstylecontext) the style system style sheets & rules ↓ rule tree ↓ style context interface original document information a...
Table Layout Regression Tests - Archive of obsolete content
d or not. subject overview changes in layout, parser and content code can have unintended side effects, also known as regressions. it is good style to check for these unwanted regressions and fixing them before checkin rather than causing bugzilla avalanches. prerequisites in order to run these tests, you will need to have: make sure that your build is a debug build (in short you need ac_
add_options --enable-debug in your .mozconfig file). to build the layoutdebugger itself, build either all extensions or include layoutdebug in your .mozconfig file. for example ac_
add_options --enable-extensions=all. a mozilla tree with the test files at %moz_src%/layout/html/tests, disable_tests should not be defined (so ac_
add_options --enable-tests), patience and time. test runs go to the ...
...by set xpcom_debug_break=warn, the world would be a much better place if we could first fix those assertions. as you will probably run your normal mozilla in parallel with the testing issue then: set moz_no_remote=1 at the command prompt. start the layout debugger via mozilla -layoutdebug - p foo where foo is just another profile than your main profile. select from the regression-test menu the
add new list...entry. select %moz_src%/layout/html/tests/block/rtest.lst. execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make...
...ll 1[0x1]enum 0|1 1 [none]|left: auto top: auto right: auto bottom: auto auto 0[0x0]tw null auto 0[0x0]tw null 0 auto |0 0 0 normal normal 0[0x0]tw normal |0 11 1,000000 0 0 0 0 0 0 0 0 0 0 0 [none]|0 0 0 -1 1 |0 0 0 null comparison for file:///e:/moz_src/mozilla/layout/html/tests/table/core/baseline/standards1.rgd failed. the first regression test has failed and it is marked so.
adding new regression tests once you have checked in the code: please
add your testcase for the bug to the regression tests. a testcase should only contain local files. place the images in table/images block/images or (don't forget cvs commit -kb) and the test file in the table/bugs or block/bugs directory. update the rtest.lst file in the corresponding directory in order to include your file...
...please contact if you need help with running those tests. ...
Tamarin Acceptance Test Template - Archive of obsolete content
this is the test template for tamarin acceptance tests (placed in test/acceptance/feature_name): /* -*- mode: js; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ /* vi: set ts=4 sw=4 expandtab: (
add to ~/.vimrc: set modeline modelines=5) */ /* ***** begin license block ***** * version: mpl 1.1/gpl 2.0/lgpl 2.1 * * the contents of this file are subject to the mozilla public license version * 1.1 (the "license"); you may not use this file except in compliance with * the license. you may obtain a copy of the license at * http://www.mozilla.org/mpl/ * * software distributed under the license is distributed on an "as is" basis, * without warranty of any kind, either express or implied. see the license * for the specific language governing rights and limitations und...
...f any one of the mpl, the gpl or the lgpl. ...
...pl, the gpl or the lgpl. * * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscript section) var version = "as3"; // version of ecmascript or actionscript var title = "test"; // provide ecma section title or a description var bugnumber = ""; starttest(); // leave this alone /** * calls to
addtestcase here. ...
...e or a description var bugnumber = ""; starttest(); // leave this alone /** * calls to
addtestcase here.
addtestcase is a function that is defined * in shell.as and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * for example, a test might look like this: * * var helloworld = "hello world"; * *
addtestcase( * "var helloworld = 'hello world'", // description of the test * "hello world", // expected result * helloworld ); // actual result * */ //
add your tests here var helloworld = "hello world";
addtestcase( "var helloworld = 'hello world'", "hello world", helloworld ); test(); // leave this alone. this executes the test cases and ...
The new nsString class implementation (1999) - Archive of obsolete content
hy then am i proposing this? well, nsstring has served us well so far, but it's in need of a facelift. and xpcom has really taken off, so nsstring needs to be brought into alignment. justification the nsstring class is a wide character string class used throughout all of gecko (and other modules) as the default implementation. however, it suffers from a few implementation details which need to be
addressed and that are the subject of this document. the deficiencies of the current implementation are: class based -- making it unsuitable for cross-dll usage due to fragility little intrinsic i18n support few efficiencies, notably a lack of support for narrow (1-byte) character strings no support for external memory management policy lack of xpcom interface notable features of the new nsstr...
...); static print32 compare(const nsstrimpl& adest,const nsstrimpl& asource, print32 acount,prbool aignorecase); }; nsstring the nsstring class is still with us as a subclass (wrapper) of nsstrimpl. by default, nsstrings use a 2-byte ucs2 character storage model. the nsstring class is very lightweight since it gets its functionality from the nsstrimpl static library. in
addition to the nsstrimpl api shown above, nsstring, nsautostring and nscstring all offer
additional api's (that all degrade to those found in nsstrimpl) for construction, searching and comparison. also note that the new nsstring interface mimics fully the interface in the existing nsstring class found in mozilla/base/src/nsstring.h. nsautostring we still offer an nsautostring that provides its own s...
...n, searching and comparison. also note that the new nsstring interface mimics fully the interface in the existing nsstring class found in mozilla/base/src/nsstring.h. nsautostring we still offer an nsautostring that provides its own stack based buffer. this very useful class allows programmers to take advantage of the nsstring/nsstrimpl implementation, while eliminating heap based allocations. an
additional improvement has been made to nsautostring that allows it to use an arbitrarily sized stack based buffer rather than its own internal buffer. this means that you can continue to use efficient (temporary) stack buffers for string storage with the bonus of storage pools that serve your specific need. (sounds complicated, but it's really easy). this class fully interoperates with nsstring and ...
...r for this purpose. our minimalistic nsimemoryagent interface is just rich enough to support the nsstring idiom, and could be extended to serve as the general memory allocation idiom. here's it's api: class nsimemoryagent : 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 prevented from abusing the string classes in a number of ways. to wit: they want to ensure that the underlying b...
Creating XPI Installer Modules - Archive of obsolete content
introduction this article is rather old and only applies to mozilla suite and seamonkey (until it gets converted to toolkit).
addons for various toolkit applications, such as firefox or thunderbird, should be packaged in a different way. mozilla has introduced major changes to the way that themes and all the other parts of the ui are packaged. this new packaging scheme is called xpi (pronounced "zippy"), and interacts with xpinstall. a xpi file typically contains the resources to be installed (in this case the barley.jar we want to have installed in the mozilla/bin/chrome/ directory) and an install script that guides the installation process. ...
...all the other parts of the ui are packaged. this new packaging scheme is called xpi (pronounced "zippy"), and interacts with xpinstall. a xpi file typically contains the resources to be installed (in this case the barley.jar we want to have installed in the mozilla/bin/chrome/ directory) and an install script that guides the installation process. under the chrome/ directory, you'll notice that in
addition to the package subdirectories, there are now also a handful of jar files, or java archives (see figure below). jar is a file format based on the zip file format and is used for aggregating multiple files into a single file. these archives are redundant with the subdirectories: mozilla now installs both the compressed and uncompressed versions of the ui, though you can change this when you bu...
...chrome/ us/ us.jar chatzilla/ chatzilla.jar chrome.rdf chromelist.txt classic/ classic.jar comm/ comm.jar content-packs/ content-packs.jar embed-sample/ embed-sample.jar en-us/ en-us.jar en-mac/ en-mac.jar en-unix/ en-unix.jar en-win/ en-win.jar help/ help.jar inspector/ inspector.jar installed-chrome.txt messenger/ messenger.jar ... in
addition to these jar files, there are also several new rdf files. these new files represent a redesign of the way that the mozilla ui is packaged and installed. though the chrome directory still includes subdirectories of uncompressed files by default, a new way to aggregate and distribute the files has improved performance, made the ui components more portable and easier to install, and made the in...
...to package up your jar file in such a way that it can be installed using mozilla's xpinstall technology. the xpi file format is used to designate archives that use mozilla's xpinstall to install themselves. ...
Install Object - Archive of obsolete content
to the object methods. the following two lines, for example, are equivalent: f = getfolder("program"); f = install.getfolder("program"); an installation script is composed of calls to the install object, and generally takes the following form: initialize the installation call initinstall with the name of the installation and the necessary registry and version information. ...
... lines, for example, are equivalent: f = getfolder("program"); f = install.getfolder("program"); an installation script is composed of calls to the install object, and generally takes the following form: initialize the installation call initinstall with the name of the installation and the necessary registry and version information. ...
...llation script is composed of calls to the install object, and generally takes the following form: initialize the installation call initinstall with the name of the installation and the necessary registry and version information.
add the files to the installation
add files to the installation by calling getfolder to get file objects and passing those object refs to
addfile as many times as necessary. ...
... initialize the installation call initinstall with the name of the installation and the necessary registry and version information.
add the files to the installation
add files to the installation by calling getfolder to get file objects and passing those object refs to
addfile as many times as necessary. perform installation check that the files have been
added successfully (e.g., by checking the error return codes from many of the main installation methods, and go ahead with the install if everything is in order: performorcancel(); function performorcancel() { if (0 == getlasterror()) performinstall(); else cancelinstall(); } for complete script examples, see script examples. ...
XUL Events - Archive of obsolete content
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 previously attached listeners are disconnected. the attribute name is the event name with an 'on' prefix. ...
...t when one of its attributes is modified. in the event handler, you can retrieve the attribute that was modified using the event's attrname property, and you can retrieve the old and new values of the attribute using the event's prevvalue and newvalue properties. domnodeinserted this event is sent when a node is
added as a child of a element. if you capture this event at the document level, you can be notified of document changes. domnoderemoved this event is sent when a node is removed from an element. if you capture this event at the document level, you can be notified of document changes ...
...he document level, you can be notified of document changes. domnoderemoved this event is sent when a node is removed from an element. if you capture this event at the document level, you can be notified of document changes warning: it should be noted that the
addition of any mutation event listeners to a document degrades the performance of subsequent dom operations in that document, and that removing the listeners later does not mitigate or reverse the effect. see mutation events for more details and mutation observers for a more efficient alternative. common xul events event description ...
...s event bubbles. dommenuiteminactive this event is sent when a menu or menuitem is no longer being hovered over, or highlighted. this event bubbles. window events the following events are dispatched to top-level dom windows and can be listened to using window.
addeventlistener. event description activate sent when a window becomes active. deactivate sent when a window becomes inactive. sizemodechange sent when a window is minimized or un-minim...
insertItem - Archive of obsolete content
the third argument can be used to wrap the new item in another element. ...
...the third argument can be used to wrap the new item in another element. ...
...the third argument can be used to wrap the new item in another element. ...
...the third argument can be used to wrap the new item in another element. usually, the last argument will be null as it is mainly for the use of the customize dialog. the id should match an element in the toolbar's toolbarpalette. ...
Panels - Archive of obsolete content
use position. in this case, you may wish to have the popup appear below the label instead. the position attribute may be used to control the placement of the popup. here is a complete example: <panel id="search-panel" position="after_start"> <label control="search" value="terms:"/> <textbox id="search"/> </panel> <label value="search" popup="search-panel"/> the position attribute has been
added to the panel element with the value 'after_start'. this causes the panel to be displayed not where the mouse was clicked but aligned along the bottom edge of the label. for more information about this attribute and other possible values that can be used, see positioning popups. it is also possible to open a panel like a context menu using the context attribute instead of the popup attribute. t...
... openpopupatscreen method will open a panel at a specific screen position. for more details about both methods, see opening and closing popups. closing a panel a panel is closed automatically when the user clicks outside of the panel. it is quite common however, to have an element such as a button within the panel to close it as well. ...
...bute on the panel to true. <panel id="search-panel" noautohide="true"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> <button label="cancel" oncommand="this.parentnode.hidepopup();"/> </panel> because the panel can no longer be closed by clicking elsewhere, the panel should always provide a means to close the panel itself. in this example a cancel button has been
added. for more information about these types of panels, see floating panels. focus in panels elements within panels may be focused with the mouse, and the currently focused element may be adjusted by pressing the tab key. when a popup is opened, if an element in the main window is focused, that element is unfocused, and a blur event is fired at it. although no element within the popup panel is fo...
...ocus 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 prevent 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 prevent the previously 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 is fired, which means that if those events are cancelled, the focus is not adjusted. le...
Bindings - Archive of obsolete content
<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 previous triple. ...
...cate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> it works similarly to the previous 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 the ?description variable. the ?description variable would then be used in the action body. let assume though, that we are only going to
add a description to one of the photos in the datasource; the other two photos will not have a description. this may mean the description is not known, or that it wasn't filled in by the user. <rdf:description rdf:about="http://www.xulplanet.com/ndeakin/images/t/palace.jpg" dc:title="palace from above"/> dc:description="view from the top of the tower looking ea...
...for the second photo, the datasource doesn't have any matches for the description, so that potential result will be removed. the same happens for the third photo. in the end, only one photo remains. (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palac...
...for the second photo, the datasource doesn't have any matches for the description, so that potential result will be removed. the same happens for the third photo. in the end, only one photo remains. (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above', ?
Building Trees - Archive of obsolete content
, 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. ...
...e, 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. to use the tree builder, you need to
add a flags attribute to the root node: <tree datasources="template-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood" flags="dont-build-content"> the dont-build-content flag causes no content to be built for the template. but moreover, it uses a subtype of the main builder called the tree builder. without this flag, the template will be handled by the content builder.
...n use the view’s getcellvalue() method to retrieve it. naturally, this will retrieve the value after any variables have been substituted. besides the attributes mentioned above, any other attributes specified on the tree rows and cells are ignored. since no elements are generated, you won’t be able to retrieve the values for them either. thus, the value attribute may be useful to associate an
additional value with a row since it will be easier to retrieve. the src attribute may be used to set an image to appear in a cell. for example: <tree id="photoslist" flex="1" datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" flags="dont-build-content"> <treecols> <treecol id="photo" label="photo" flex="1"/> </treecols> <template> <treechildren> ...
...sing tree properties since we need to use special css for trees, the properties attribute on a cell becomes extremely useful. it can be used to define extra properties for reference later in a stylesheet. for example, if the properties attribute was set to the value "?creator", you could style the photos created by different people differently. alternatively, you could also use static values (in
addition to variables) in the properties attribute. for instance, consider the following css: treechildren::-moz-tree-cell(dave) { background-color: lightgreen; } this would set the background color of a cell to green for any cell with the “dave” property. you can also use the properties attribute on the treerow to change the style for an entire row. this example sets the country associated wi...
Result Generation - Archive of obsolete content
that are available where content should be generated information that indicates what to do when the rdf datasource changes this network of information remains for the lifetime of the template, or until it is rebuilt. the template builder uses a method based on the rete algorithm to match data. this allows for a fairly efficient means of updating results when, for instance, a new statement is
added to the rdf graph. rather than rebuild the entire template, the algorithm allows only specific parts of the network of information to be re-examined. a similar method can be used when removing rdf statements. while the information network created by the template builder contains a number of different pieces of necessary information, for the purposes of this discussion, we will only be interested...
...ilder begins with a single possible result, called the seed. the builder processes each of a query's statements in sequence. to do this for a particular statement, the builder iterates over the possible results found so far and either accepts each result or rejects each result. for the first statement, only the seed will be available as a possible result. at each step, new possible results may be
added, or more information pertaining to an existing result may be
added to the network. naturally, a rejected result will be removed. once all results have been examined, the builder moves on to the next statement in the query. once all statements have been analyzed, any results which still remain go on to become matches. the matches are the endpoints and will cause content to be generated. so, to s...
...d. once all results have been examined, the builder moves on to the next statement in the query. once all statements have been analyzed, any results which still remain go on to become matches. the matches are the endpoints and will cause content to be generated. so, to summarize: start out with a one possible result as the seed iterate over the results determined so far and augment them with
additional data
add any new possible results remove any rejected results repeat steps 2 to 4 for each query statement once done, all remaining results become matches each possible result is made up of a set of variable-value pairs. for instance, a result would look something like the following: (?name = fred, ?age = 5) this result has two variables, ?name with the value 'fred' and ?age with...
..., they might look like this: (?name = fred, ?age = 5) (?name = mary, ?age = 12) this is how we'll represent the potential results in this and the following discussions. later, we might have a statement which removes all male results. so, our results after this might look like the following: (?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. « previousnext » ...
Toolbar customization events - Archive of obsolete content
none of these events contain any data; if you need details, you'll need to look at the toolbar. beforecustomization this event is delivered when the user starts the toolbar customization process; for example, by right-clicking on a toolbar and choosing "customize". customizationchange this event is delivered when the user makes a change to a toolbar while editing the toolbars, either by dragging an item to the toolbar or by dragging an item out of it. ...
...by dragging an item to the toolbar or by dragging an item out of it. aftercustomization this event is delivered when the user closes the toolbar customization panel. in all cases, the event.target is the toolbox being customized. you can look at the contents of that element and its children to determine what changes were made. example in this example, we watch for toolbar changes. ...
... aftercustomization this event is delivered when the user closes the toolbar customization panel. in all cases, the event.target is the toolbox being customized. you can look at the contents of that element and its children to determine what changes were made. example in this example, we watch for toolbar changes. ...
...s the toolbar customization panel. in all cases, the event.target is the toolbox being customized. you can look at the contents of that element and its children to determine what changes were made. example in this example, we watch for toolbar changes. ...
Introduction to XBL - Archive of obsolete content
yout 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. ...
...like xul, xbl is an xml language, so it has similar syntax rules. ...
....xml'. the '#binding1' syntax is used to point to a specific binding, much like how you would point to an anchor in an html file. you will usually put all of your bindings in a single file. the result in this example, is that all scrollbar elements will have their behavior described by the binding 'binding1'. a binding has five types of things that it declares: content: child elements that are
added to the element that the binding is bound to. properties: properties
added to the element. they can be accessed through a script. methods: methods
added to the element. they can be called from a script. events: events, such as mouse clicks and keypresses that the element will respond to. the binding can
add scripts to provide default handling. in
addition new events can be defined. style...
...e box. the box has been declared to have a class of okcancelbuttons. the style sheet associated with the file says that boxes with the class okcancelbuttons 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. « previousnext » ...
More Tree Features - Archive of obsolete content
well as lines connecting the children to their parents. the tree will also handle drawing the rows with the right level of indenting. however, the view will need to make sure it keeps track of the level of the rows as necessary. this can sometimes be quite tricky, but fortunately, the built-in content tree view does all of the hard work for us. to create a set of nested rows, all we need to do is
add a second treechildren element inside the parent treeitem. you can then
add items inside that to specify the child rows of an item. don't put the inner treechildren element inside the treerow as this won't work. you can repeat this process to create deeply nested trees. essentially, a treeitem element can contain either single rows which are declared with the treerow element or a set of rows which...
...at this process to create deeply nested trees. essentially, a treeitem element can contain either single rows which are declared with the treerow element or a set of rows which are declared with the treechildren element. there are two other things you need to do to make sure the hierarchy works properly. first, you need to mark the treeitem element that has children as a container. you do this by
adding the container attribute to it as follows: <treeitem container="true" /> this allows the user to click on the row that corresponds to the treeitem to expand and collapse the inner rows. you can have the child rows initially displayed by
adding the open attribute. when the user expands and collapses the parent, the view's toggleopenstate function will be called to toggle the item between open a...
...nt, the view's toggleopenstate function will be called to toggle the item between open and closed. for a content tree view, this will set the open attribute to reflect the current state. the second change is that you must put the primary attribute on the first column. this causes a small triangle or plus sign to appear before the cells in that column to indicate the cells that can be expanded. in
addition, child rows are indented. note also that the user cannot hide the primary column using the drop down to the right of the columns. example hierarchical tree the following is a simple example: example 1 : source view <tree rows="6"> <treecols> <treecol id="firstname" label="first name" primary="true" flex="3" /> <treecol id="lastname" label="last name" flex="7" /> </treecol...
... as well. remember that you must use the container attribute on rows which contain child rows. the simple presence of child rows isn't sufficient to indicate this, as you may have a container that has no children but should still be treated like a container. for example, a directory with no files in it should still be treated like a container whereas a file should not. more about tree columns one
additional attribute you can
add to the tree is enablecolumndrag. (note the mixed case.) if set to true, the user may drag the column headers around to rearrange the order of the columns. a user will also likely want to change the column widths. you can do this by placing a splitter element in between each treecol element. a small notch will appear in between each column header which the user may dra...
Progress Meters - Archive of obsolete content
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. ...
...t if you do not specify this attribute. value the current value of the progress meter. you should only use this for a progress meter that is determinate. the value should be set to an integer percentage from 0 to 100. the value would be changed by a script as the task completes. max the maximum value of the progress meter. should be used only with determinate. ...
...tage from 0 to 100. the value would be changed by a script as the task completes. max the maximum value of the progress meter. should be used only with determinate. the find files example let's
add a progress meter to our find file dialog. we would normally put an indeterminate progress meter as we don't know how many files we'll be searching or how long the search will take. however, we'll
add a normal one for now as an animating one can be distracting during development. the progress meter would normally only appear while the search is taking place. we'll
add a script later to turn it on and off. <textbox id="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="find" default="true"/> the value has been set to 50% so that we can s...
...t="true"/> the value has been set to 50% so that we can see the meter on the window. a margin has been set to 4 pixels so that it is separated from the edge of the window. as was stated earlier, we only want the progress bar to be displayed while the search was occurring. a script will show and hide it as necessary. to make this work you will first have to define the namespace html. do this by
adding the below line to your opening window tag in the findfile.xul. xmlns:html="http://www.w3.org/1999/xhtml" the example so far. source view in the next section, we will learn how to
add additional elements to the window using html. « previousnext » ...
Simple Menu Bars - Archive of obsolete content
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. ...
...enuitems. menubar element the menubar is a box containing menus. note that it has been placed inside a flexible toolbox. the menubar has no special attributes but it is a type of box. this means that you could create a vertical menubar by setting the orient attribute to vertical. menu element the menu element works much like the button element. it accepts some of the same attributes plus some
additional ones: id the unique identifier of the menu title button. label the text to appear on the menu, such as file or edit. disabled this boolean attribute determines whether the menu is disabled. although you can, there's rarely a need to disable an entire menu. this attribute can be set to either true or false. of course, the latter is the default. accesskey this is the key t...
...lean attribute determines whether the menu is disabled. although you can, there's rarely a need to disable an entire menu. this attribute can be set to either true or false. of course, the latter is the default. accesskey this is the key that the user can press to activate the menu item. this letter is typically shown underlined on the menu title. mozilla will look at the label attribute and
add an underline character to the character specified here. for that reason, you should specify a character that exists in the text (although the key will still work if it doesn't). the menu element is normally placed on a menubar, although it does not have to be. however, it will be given a different look. the image here shows what the earlier example would look like without the menu bar. menup...
...ppear on the menu item, such as open or save. disabled this boolean attribute determines whether the menu item is disabled. this attribute can be set to either true or false where the latter is the default. accesskey this is the key that the user can press to activate the menu item. this letter is typically shown underlined on the menu title. mozilla will look at the label attribute and
add an underline character to the character specified here. for that reason, you should specify a character that exists in the text. acceltext this specifies the shortcut key text to appear next to the menu command text. it does not associate a key action with the menuitem however. we'll look at how to do this later. menuseparator element the menuseparator has no special attributes. it just c...
Tabboxes - Archive of obsolete content
switches to a new tab page. tabbox example example 1 : source view <tabbox> <tabs> <tab label="mail"/> <tab label="news"/> </tabs> <tabpanels> <tabpanel id="mailtab"> <checkbox label="automatically check for mail"/> </tabpanel> <tabpanel id="newstab"> <button label="clear news buffer"/> </tabpanel> </tabpanels> </tabbox> here, two tabs have been
added, the first labeled 'mail' and the other 'news'. when the user clicks on the mail tab, the contents of the first tab page will be displayed below the tabs. in this case, the page with the check box labeled 'automatically check for mail' will appear. when the second tab is clicked, the page containing the button labeled 'clear news buffer' will appear instead. the currently selected tab element ...
...t labeled 'mail' and the other 'news'. when the user clicks on the mail tab, the contents of the first tab page will be displayed below the tabs. in this case, the page with the check box labeled 'automatically check for mail' will appear. when the second tab is clicked, the page containing the button labeled 'clear news buffer' will appear instead. the currently selected tab element is given an
additional selected attribute which is set to true. this alters the appearance of the currently selected tab to make it look selected. only one tab will have a true value for this attribute at a time. position of the tabs finally, you can change the position of the tabs so that they appear on any side of the tab pages. there is no special syntax to do this. you simply set the orient and dir attribu...
...ement 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. ...
...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 demonstrate tabs. the label across the top and the search criteria box will need to go on the first tab. we'll
add some options on the second tab. the progress bar and the buttons can st...
Toolbars - Archive of obsolete content
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. ...
... toolbarbutton a button on a toolbar, which has all the same features of a regular button but is usually drawn differently. the toolbar is the main element that creates the actual toolbar. inside it are placed the individual toolbar items, usually buttons, but they can be other elements. in the example above, only one toolbar was created. ...
...t as easily by
adding more toolbar elements after the first one. the toolbox is a container for toolbars. in some applications, you will have several toolbars along the top of the window. you can put them all inside a toolbox. you do not have to put toolbar elements inside a toolbox. customizable toolbars firefox or other toolkit applications have customizable toolbars; therefore, many extensions
add their toolbar buttons to the toolbar palette, rather than
adding them directly to the toolbar. for more information about customizable toolbars, see creating toolbar buttons. our find files example let's
add a toolbar to the find files dialog. we don't really need one but we'll
add one anyway to demonstrate its use. two buttons will be
added, an open button and a save button. presumably, the...
...uttons will be
added, an open button and a save button. presumably, they would allow the user to save search results and re-open them later. <vbox flex="1"> <toolbox> <toolbar id="findfiles-toolbar"> <toolbarbutton id="opensearch" label="open"/> <toolbarbutton id="savesearch" label="save"/> </toolbar> </toolbox> <tabbox> a toolbar with two buttons has been
added here. in the image, you can see them appear horizontally along the top. notice that the toolbar has been placed inside the vertical box just above the tabbox. this is because we need the vertical orientation so that the toolbar will appear above everything else. the find files example so far: source view next, we'll find out how to
add a menu bar to a window. « previousnext » ...
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. ...
...e component. the component used here is the same one that handles the window-mediator rdf datasource. you can also get this component through the rdf service, which is another service that manages rdf datasources. the nsiwindowdatasource interface has a function getwindowforresource, which can be used to get the window given a resource. in the earlier example, we generated the list of windows and
added it to a menu via a template. the template generates an id attribute on each menuitem element. the value of this attribute can be used as the resource. that means that in order to switch the window focus, we need to do the following: determine the element that the user clicked on. get the value of the id attribute from the element. pass this value to getwindowforresource() to get a window...
...the function switchfocus(): first gets a reference to a component which implements the window mediator interface. next, we get the id attribute for the element. we can use the value of the id attribute as the resource. the function getwindowforresource() takes the r...
...s. an enumerator has a hasmoreelements() method which will return true until we get to the last cookie. the getnext() method gets a cookie and moves the enumerator index to the next cookie. since an enumerator just returns a generic object, we need to queryinterface() it to an nsicookie before we can use it. in this case, we just use the instanceof operator to accomplish this. 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. « previousnext » ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
in a web page, menu or dialog that indicates to a user a quick, keyboard method of simulating a click on that element. for example, an apply button may have the letter a underlined. on windows and unix, pressing alt+a is a convenient way to push that button. on macintosh, accesskeys are available only in html not in xul, and they are activated using ctrl+letter instead of alt. ...
...to a user a quick, keyboard method of simulating a click on that element. for example, an apply button may have the letter a underlined. on windows and unix, pressing alt+a is a convenient way to push that button. on macintosh, accesskeys are available only in html not in xul, and they are activated using ctrl+letter instead of alt. ...
...have the letter a underlined. on windows and unix, pressing alt+a is a convenient way to push that button. on macintosh, accesskeys are available only in html not in xul, and they are activated using ctrl+letter instead of alt. how is an accesskey
added to a form control? an accesskey can be
added to an html or xul form control or label by using the accesskey attribute. for example, here's how we
add an accesskey to a xul button: <button label="apply instantly" accesskey="a" /> apply instantly - or - <button label="apply instantly" accesskey="a" /> apply instantly in mozilla, we use dtd's for one more layer of abstraction, for purposes of internationalization. the above example should say: <button label="apply instantly" accesskey="&applyinstantly.access...
...r the rest of the dialog has accesskeys chosen). common elements that don't get accesskeys ok buttons. cancel buttons. close buttons. tab panel labels. toolbar buttons tree items list items column headers are there any crucial bugs i should know about? bug 143065 - scope of accesskeys is not limited to the current tab panel. where do accesskeys need to be
added? look for dependencies of bug 129179 (the xul accesskey hookup meta bug), or look for bugs with "accesskey" or "mnemonic" in the summary, or look for dialogs where there are no elements with underlined letters. file bugs under the keyboard navigation component, and make meta bug 129179 dependent on them. ...
XUL Changes for Firefox 1.5 - Archive of obsolete content
this lists the most notable changes to xul in firefox 1.5 (gecko 1.8). for other changes you should be aware of, see adapting xul applications for firefox 1.5. <scrollcorner> a <scrollcorner> element is
added which is used to create the small box in the intersection of the horizontal and vertical scrollbars. <richlistbox> and <richlistitem> the <richlistbox> and <richlistitem> elements are used for creating lists containing arbitrary content. this element works similarly to the <listbox> which is designed primarily for lists of textual items. ...
... elements are used for creating lists containing arbitrary content. this element works similarly to the <listbox> which is designed primarily for lists of textual items. the <richlistbox> supports much of the same api as the <listbox> and single items, created with the <richlistitem> element may be selected. see xul:richlistbox for more information. ...
...for more information, see preferences system. bfcache mozilla now caches the page's dom, so that navigating back and forward does not reload the page, making navigation much more efficient. ...
... to none - in which case no button is set to be the default. button: icon property the icon property on a button may be used to set stock icons on a button, used on some platforms. for instance <button icon="help"> will create a button with a help icon. this is used typically on gnome systems where possible values are: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print,
add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. <menulist> items in a <menulist> support the description attribute to allow for extra descriptive text to appear beside an item's label. the menulist modification methods appenditem and insertitemat take an extra description argument when creating items this way. <listbox> the removeitemat method was someti...
checkbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element that can be turned on and off. this is most commonly rendered as a box when the element is off and a box with a check when the element is on. the user can switch the state of the check box by selecting it with the mouse. a label, specified with the label attribute, may be
added beside the check box. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, disabled, src, label, preference, tabindex properties accesskey, accessibletype, checked, command, crop, disabled, src, label, tabindex examples <checkbox label="enable javascript" checked="true"/> <checkbox label="enable java" checked="false"/> attributes accesskey...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. src type: uri set this to an uri pointing to an image to appear in the checkbox. if this attribute is left out, no image appears. you can have both an image and a label. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value ...
...attribute. disabled type: boolean gets and sets the value of the disabled attribute. src type: url gets and sets the value of the src attribute. label type: string gets and sets the value of the label attribute. tabindex type: integer gets and sets the value of the tabindex attribute. ...
dialog - Archive of obsolete content
following values can be used in the list: accept: the ok button, which will accept the changes when pressed. this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional
additional button. you can set its label with the buttonlabelextra1 attribute. extra2: a second optional
additional button. you can set its label with the buttonlabelextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma). warning: if the accept and cancel buttons are actually shown is system dependent an...
... attribute to "," (a single comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an
additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). defaultbutton type: string normally this attribute should not be set, but if it is, it...
... following values can be used in the list: accept: the ok button, which will accept the changes when pressed. this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional
additional button. you can set its label with the buttonlabelextra1 attribute. extra2: a second optional
additional button. you can set its label with the buttonlabelextra2 attribute. defaultbutton type: string normally this attribute should not be set, but if it is, it specifies the default button in the dialog. typically, this means that the button will be activated when the enter key...
...th the buttonlabelextra2 attribute. defaultbutton type: string normally this attribute should not be set, but if it is, it specifies the default button in the dialog. typically, this means that the button will be activated when the enter key is pressed. this should be set to one of the same values as those for the buttons attribute. ...
listcell - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is c...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
...selectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes listcell-iconic use this class to have an image appear on the listcell. specify the image using the image attribute. note that both an image and a label are
added when this style is set. the label will take up extra space even when no label text is set. if it is desired to center the image, use css to hide the label. tips if you need to right-align a cell's contents, you can do so like this: cell = document.createelement("listcell"); cell.setattribute("label", "this is the cell's label"); cell.setattribute("style", "text-align:right"); related e...
menu - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be ...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. menuactive type: boolean this attribute is set on an item in a menu when it is being hovered over. typcially, the theme will u...
...false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
...you may optionally set a value. the function returns the newly created element. 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. ...
menuitem - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description type: string descriptive text to appear in
addition to the dialog title. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with gr...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. note: the menuitem must have a class of menuitem-iconic for the image to appear. key type: id set to the id of a key element whose key shortcut is displayed in the ...
...uitems or for radio button menuitems. checkbox the menuitem is checked. the checked attribute determines whether the menuitem is checked or not. radio the menuitem becomes part of a radio group. other menuitems that have the same value for their name attributes are part of the same radio group. only one menuitem in the same radio group can be checked at once. more information on
adding checkmarks to menus in the xul tutorial validate type: one of the values below this attribute indicates whether to load the image from the cache or not. this would be useful if the images are stored remotely or you plan on swapping the image frequently. the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
menulist - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect type: boolean if this attribute is true or omitted, the selected item on the menu will update to match what the user entered in the textbox. if the text does not match any of the items in the list, the menu selection is cleared. if this attri...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. editable type: boolean indicates that the value of the menulist can be modified by typing directly into the value field. this is rendered as a textbox with a drop-down arrow beside it. the user may enter text into the textbox or select one of the choices by clicking from the drop-down. focused type: boolean this attribute is true if the element is focused. im...
...operty, or changed by the user. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
...you may optionally set a value and description. the function returns the new item. contains( item ) return type: boolean returns true if the menulist contains the specified menuitem as one of its items. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed ...
radio - Archive of obsolete content
ethods | related ] an element that can be turned on and off. radio buttons are almost always listed together in groups. only one radio button within the same radiogroup may be selected at a time. the user can switch which radio button is turned on by selecting it with the mouse or keyboard. other radio buttons in the same group are turned off. a label, specified with the label attribute may be
added beside the radio button. more information is available in the xul tutorial. attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value properties accesskey, accessibletype, control, crop, disabled, image, label, radiogroup, selected, tabindex, value examples <radiogroup> <radio id="orange" label="red" accesskey="r"/> <radio id="viol...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. focused type: boolean this attribute is true if the element is focused. group type: string group name buttons with type="radio" and the same value for their group attribute are put into the same group. only one button from each group can be checked at a time. if the user selects one the buttons, the others in the group are unchecked. image type: uri t...
...arator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
toolbarbutton - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } 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 ele...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. dlgtype type: one of the values below the dialog type of the button, used only when the button is in a dialog box. you can use this feature to replace the standard dialog box buttons with custom buttons, yet the dialog event methods will still function. for example, if the dlgtype is set to accept, the button will replace the dialog box's accept button, which is usually la...
...a dialog box has no effect. the following values can be used as the dialog type: accept the ok button, which will accept the changes when pressed. cancel the cancel button which will cancel the operation. help a help button for displaying help about the dialog. disclosure a button to show more information. this might be a button or a disclosure triangle. extra1 an optional
additional button. extra2 a second optional
additional button. group type: string group name buttons with type="radio" and the same value for their group attribute are put into the same group. only one button from each group can be checked at a time. if the user selects one the buttons, the others in the group are unchecked. image type: uri the uri of the image to appear on...
... open type: boolean gets and sets the value of the open attribute. orient type: string gets and sets the value of the orient attribute. tabindex type: integer gets and sets the value of the tabindex attribute. type type: string gets and sets the value of the type attribute. ...
toolbox - Archive of obsolete content
a type of box but defaults to vertical orientation. if a toolbar is placed inside a toolbox, a grippy is displayed on its left or upper edge. the user may click the grippy to collapse the toolbar. if multiple toolbars are placed in the same toolbox, they will all collapse into the same row. the firefox browser does not have grippies so toolbars cannot be collapsed and expanded. note: gecko 2.0
adds support for external toolbars. these are toolbars that are not children of a toolbox. you can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. the external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's externaltoolbars property. more information is availabl...
...ltoolbars type: array of elements an array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox. palette firefox only type: element the toolbarpalette within the toolbox. toolbarset firefox only type: element the toolbarset within the toolbox. ...
...the method returns the dom element for the created toolbar. collapsetoolbar( toolbar ) not in firefox return type: no return value collapse the given toolbar which should be contained within the toolbox. expandtoolbar( toolba...
...the method returns the dom element for the created toolbar. ...
window - Archive of obsolete content
to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. disablechrome type: boolean set this attribute to true to disable chrome in the window. this is used to hide chrome when showing in-browser ui such as the about:
addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the
add-on bar) left showing. 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 ...
...d-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 prevent 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 platforms that don't support drawing into the title bar. fullscreenbutton type: boolean se...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
...ing or unreachable dtd file referenced in the xul file. a filename following the system keyword in a doctype declaration may silently fail to load and the only error message will be an undefined entity error on the next xul element. related elements prefwindow, dialog, dialogheader related topics user notes to change the icon to a window's title bar check this page on window icons. to
add a favicon to the
address bar and browser tab (ie dialog is not a popup) then use the following code snippet to use the html namespace and link. <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> <!-- icon from chrome --> <html:link rel="icon" href="chrome://myextension/content/path/to/favicon.png"/> <!-- from a remote site ...
Using LDAP XPCOM with XULRunner - Archive of obsolete content
by default, xulrunner is built without ldap xpcom support. if you want to use ldap components in your xul application, you have two options : compile xulrunner with ldap support enabled, or
add ldap xpcom directly to your xul app (in the components directory). in any case, you will have to build ldap xpcom, by
adding --enable-ldap build option. see the build_documentation for more information about how to build xulrunner. when configuring build options, just
add: ac_
add_options --enable-ldap to your .mozconfig file. this will create two files in the components directory of the build package: mozldap.dll (or libmozldap.so or...) mozldap.xpt and two files in the root directory of the build package: on windows: nsldap32v50.dll nsldappr32v50.dll on linux: libldap50.so li...
...oz_dll_prefix "prldap50" moz_dll_suffix, #endif //ns_unix nsnull }; // component.dll on windows, libcomponent.dll on linux static char krealcomponent[] = moz_dll_prefix "mozldap" moz_dll_suffix; nsresult nsgetmodule(nsicomponentmanager* acompmgr, nsifile* alocation, nsimodule* *aresult) { nsresult rv; nscomptr<nsifile> libraries; rv = alocation->getparent(getter_
addrefs(libraries)); if (ns_failed(rv)) return rv; nscomptr<nsilocalfile> library(do_queryinterface(libraries)); if (!library) return ns_error_unexpected; library->setnativeleafname(ns_literal_cstring("libraries")); library->appendnative(ns_literal_cstring("dummy")); // loop through and load dependent libraries for (char const *const *dependent = kdependentlibraries; *...
...this will create a new file in the components subdirectory of the built package, mozldap_stub.dll (on windows) or libmozldap_stub.so (on linux). copy mozldap.xpt and mozldap_stub.dll into your components xul app subdirectory. create a libraries subdirectory in your xul app directory, and copy mozldap.dll (or libmozldap.so...
...this will create a new file in the components subdirectory of the built package, mozldap_stub.dll (on windows) or libmozldap_stub.so (on linux). copy mozldap.xpt and mozldap_stub.dll into your components xul app subdirectory. create a libraries subdirectory in your xul app directory, and copy mozldap.dll (or libmozldap.so), and the native l...
2006-11-17 - Archive of obsolete content
there are also some perl code provided in this link. ...
...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. ...
...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. ...
... 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
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 note...
Create Your Own Firefox Background Theme - Archive of obsolete content
how to create your own background theme themes are made up of a "header" graphic image file, which skins the default firefox ui background. finished your design? you can submit it right now! creating a theme header image the header image is displayed as the background of the top of the browser window, nestling in behind the toolbars,
address bar, search bar and 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 po...
...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-use tools for creating and editing images within a browser. photoshop — tweak, rotate ...
...he browser reveals more of the left-hand side of the image. online image editor resources pixlr — pixlr offers professional and easy-to-use tools for creating and editing images within a browser. photoshop — tweak, rotate and touch up photos with photoshop® express, a free online photo editor. creating a theme footer image in older versions of firefox, or newer versions with certain
add-ons installed, the footer image is displayed as the background of the bottom of the browser window, behind the
add-on and find bars. it will be anchored 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...
...iew 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 to the theme submission page: name your theme — pick a unique name for your theme. du...
Making sure your theme works with RTL locales - Archive of obsolete content
le-dir(rtl) { -moz-image-region: rect(0px 516px 34px 480px); } this specifies the default, left-to-right version of the button, then offers an override if the user's interface is being rendered in right-to-left mode. gecko 1.9.1 (firefox 3.5) and earlier the chromedir attribute firefox, thunderbird and seamonkey expose an attribute named chromedir on certain elements. all you have to do is
add css rules to your theme that test for the value of this attribute, and use that to apply any rtl-specific rules that you may have. that's how the default theme works, so you can use it as an example. toolbar[iconsize="large"][mode="icons"] #back-button { -moz-image-region: rect(0px 398px 34px 360px); } toolbar[iconsize="large"][mode="icons"] #back-button[chromedir="rtl"] { -moz-image-region...
...rtl"] > #b > #c { /* rtl rules */ } tip: sometimes, like in the back and forward arrows, you don't really need new versions of the images. instead, just use the opposite arrow when in rtl context. using start/end rules instead of left/right rules directions are mirrored in rtl mode, so left becomes right and right becomes left. ...
...the images. instead, just use the opposite arrow when in rtl context. using start/end rules instead of left/right rules directions are mirrored in rtl mode, so left becomes right and right becomes left. as a result, you almost never want to use left/right rules for p
addings, borders, and margins. ...
... just use the opposite arrow when in rtl context. using start/end rules instead of left/right rules directions are mirrored in rtl mode, so left becomes right and right becomes left. as a result, you almost never want to use left/right rules for p
addings, borders, and margins. ...
Theme changes in Firefox 3 - Archive of obsolete content
de in the default theme for firefox 3; you can use this information as a starting point for figuring out the changes you need to make. all file list all platforms file description of change browser/themes/*/browser/browser.css the width of the drag and drop indicator is no longer calculated during the drag (tabbrowser.xml). instead a '-moz-margin-start' property must be
added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. as a result, the 'display' property should be removed from .tab-drop-indicator-bar (including for dragging="true"). mac os x file description of change browser/themes/pinstripe/brow...
...class. the go button is now located inside the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. ...
.... the go button is now located inside the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. ...
...bility: collapse; } images to
add add the following images: chrome://global/skin/icons/information-16.png used when presenting information notices. chrome://global/skin/icons/warning-16.png used when displaying warnings. images to remove the following images were removed: chrome://mozapps/skin/extensions/question.png no longer used. mac os x mac os x themes for firefox 3 should
add these two rules to the end of chrome://global/skin/wizard.css: .wizard-buttons-btm { p
adding:xpx; } .wizard-label-box { display: none; } the numeric value ofx, the number of pixels of p
adding in .wizard-buttons-btm, should be the same as the value of the margin for .wizard-buttons-box-2. image changes chrome://global/skin/icons/loading_16.gif was replaced with chrome://global/skin/icons...
::-ms-browse - Archive of obsolete content
browser compatibility historically supported in ...
... browser compatibility historically supported in internet explore...
... browser compatibility historically supported in internet explorer and edge bef...
... browser compatibility historically supported in internet explorer and edge before version 79.
::-ms-fill-lower - Archive of obsolete content
browser compatibility historically supported in internet explorer and edge before version 79. ...
... browser compatibility historically supported in internet explorer and edge before version 79. ...
... browser compatibility historically supported in internet explorer and edge before version 79. ...
... browser compatibility historically supported in internet explorer and edge before version 79. ...
::-ms-fill-upper - Archive of obsolete content
browser compatibility historically supported in internet explorer and edge before version 79. see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatib...
... browser compatibility historically supported in internet explorer and edge before version 79. see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatible range inputs ...
... browser compatibility historically supported in internet explorer and edge before version 79. see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatible range inputs with css quir...
... browser compatibility historically supported in internet explorer and edge before version 79. see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling...
::-ms-thumb - Archive of obsolete content
see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
... see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
... see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
... see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
Examples - Archive of obsolete content
</p> <p> this document contains inline css rules contained in a <code>style</code> element and surrounde...
... </p> <p> this document contains inline css rules contained in a <code>style</code> element and surrounded ...
... </p> <p> this document contains inline css rules contained in a <code>style</code>...
....com/samples/8a/9e64asf935.png" alt="valid xhtml 1.0!" height="31" width="88" /></a> </p> </body> </html> before testing this example by yourself, please read this. back to the article stylesheet /* * if you try to view the results of these examples, * you will need to put a file named style.css with * the following content in the same directory as * the examples. */ body { p
adding-top: 8em; } html { color: #fff; background: #000 no-repeat fixed;} p {width: 30em; font-weight: bold;} ...
Mozilla XForms Specials - Archive of obsolete content
or digest(). instead of using digest('abc', 'sha-1') explicitly use the third parameter (the results are equal): digest('abc', 'sha-1', 'base64') (limitation tracked in bug 477857) extensions enumerating instances the standardized nsixformsmodelelement does not allow one to enumerate over all possible instances, but only to retrieve instances by their name. ...
...that is, if instancenode is a node in an instance document, then: instancenode.getfeature("org.mozilla.xforms.instanceowner", "1.0") will return the <instance> element (in the main document) that the node belongs to. ...
...ocument, then: instancenode.getfeature("org.mozilla.xforms.instanceowner", "1.0") will return the <instance> element (in the main document) that the node belongs to. getting to the instance document from the instance element in the xforms 1.0 specification you have to go through the model element to get to the instance document. it seems a bit awkward if you have the instance element, so we have
added a getinstancedocument() function directly on the instance element as a shortcut. this is documented in nsixformsnsinstanceelement. custom control interface we have
added a lot of functionality to our user interface, which allows the form authors to create custom controls. it involves exposing some (script) functionality on all our controls, like output, input, etc. and allowing the ui to be rep...
...can be found in the release notes the cross domain check also includes forms loaded from file://. forms loaded from that url should be local files, and thus trusted, but it is not always the case. so there is not automatic "whitelisting" of local files. if you are wondering why we have this restriction, here is a simple example of why: <xforms:model> <xforms:instance src="http://intranetserver/
addrbook.xml"/> <xforms:submission id="sub" action="http://megaspammer.com/gather" method="post"/> <xforms:send submission="sub" ev:event="xforms-ready"/> </xforms:model> this imaginary would fetch something that is only accessible for you (f.x. behind a firewall) http://intranetserver/
addrbook.xml, and send it to http://megaspammer.com/gather as soon as you view the xform. ...
XForms Group Element - Archive of obsolete content
an effect on a group. all content elements (e.g. core form controls, groups, switches, repeats and host language content) within a non-relevant group are handled as non-relevant. ...
...ntent elements (e.g. core form controls, groups, switches, repeats and host language content) within a non-relevant group are handled as non-relevant. if a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. ...
...witches, repeats and host language content) within a non-relevant group are handled as non-relevant. if a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. ...
...oup are handled as non-relevant. if a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. representations the group element doesn't have visual presentation. ...
The Business Benefits of Web Standards - Archive of obsolete content
caught between a rock and a hard place, web designers face a formidable challenge. yet they are finding an unsuspected ally in the battle: web standards. this article discusses how adhering to web standards, and leaving behind proprietary markup and technologies, can contribute to a company's business goals. ...
...multiple pages of a site over many visits the savings in bandwidth are huge. improve search engine optimization without costs being well-placed in search engines is one of the hardest challenges faced by webmasters. in this case, every bit helps. by using semantic markup we greatly assist the search engines in their indexing process. these things come naturally to standards developers without
additional effort, time or thought. all their documents are properly marked up at the outset. the number of sites which do not include proper titles and descriptions in the meta is surprising. a lot of other sites would greatly increase their seo by simply using proper tags for the content.
adding h1, h2, and h3, tags and so on gives proper structure to hypertext documents. search engine agents craw...
...s-compliant markup ensures that data will still be re-usable for a long time, as specifications on how to parse the standard formats are well documented and here to stay. contrary to popular belief, coding to standards does not mean producing less compelling content. as a matter of fact, almost anything taking advantage of proprietary extensions can be done in a standards-compliant way, with the
added benefit of being cross-platform and future-proof. by ensuring that all of the digital content owned by the operator is marked up in a consistent and standards compliant way, the content base becomes a perennially reusable asset without any
additional costs in the future. extensibility using strict html and separating structure from content paves the way to xhtml, an xml-compatible version of...
...ying, navigating and displaying that content. content management systems attempt with some success to supply that level of functionality. they act as a very good example of real separation not only of style and content but the process by which those items - which are very different - are implemented. the process is therefore one of three stages:- the creation of content, applying the markup, and
adding the style. looked at in that light it may seem surprising how clean, elegant and simple the web development process really is. in a multi headed and possibly commercial environment such as a web development agency, this approach also lends itself to a very strict demarcation, between disciplines within a common framework. the content creator - who may be a journalist, a music producer, or may ...
Archive of obsolete content
best to discuss it in the mdn web docs room on matrix before moving content here. .htaccess ( hypertext access ) file accessing : htaccess files can be opened using any text editor, like windows notepad, vin, sublime text editor or any other. syntax highliting support for .htaccess files less. ...
...e mdn web docs room on matrix before moving content here. .htaccess ( hypertext access ) file accessing : htaccess files can be opened using any text editor, like windows notepad, vin, sublime text editor or any other. syntax highliting support for .htaccess files less. 2015 mdn fellowship program
add-ons archived
add-ons documentation.
adding preferences to an extension this article takes the creating a dynamic status bar extension sample to the next level,
adding a popup menu that lets you quickly switch between multiple stocks to watch. it also
adds a preference dialog that lets you switch to a stock other than one of the ones included in the popup menu. a...
...logies. 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 previous 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 spate of furious reorganization. ...
...basics of web services summary: a current hot topic on the web right now are web services. this short guide will allow you to learn more about web services. themes archived 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 (previous versions worked only in firefox). using firebug and jquery (screencast) note: this screencast is originally from: http://ejohn.org/blog/hacking-digg-w...ug-...
Game monetization - Game development
et as much money from the players as possible instead of delivering a fun experience. the worst cases were when you could use real money to pay for getting advantages over other players, or when they restricted access to the next stages of the game unless the players paid. the term "pay to win" was coined and this approach is disliked by many players and devs. if you want to implement iaps try to
add value to the game with something players will enjoy instead of taking it out and then charging for it.
add-ons and dlcs
add-ons and downloadable content are a good way to provide extra value to an already released game, but remember that you'll have to offer decent, entertaining content to attract people to buy it. a totally new set of levels with new characters, weapons and story is a good mat...
...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 previous 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 to show adverts in exchange for a percentage of the earnings. google adsense is said to...
...ith you. video ads are getting more and more popular, especially in the form of a pre-roll — they are shown at the beginning of your game while it's still loading. and on the topic of where to put the advertisements in your game it really depends on you. it should be as subtle as possible so as to not annoy the players too much, but visible enough to make them click it or at least take notice.
adding adverts between game sessions on game over screens is a popular approach. licensing there's an approach that can work as a monetization model on it's own, and that's selling licenses for distribution of your game. there are more and more portals interested in showing your games on their websites. they follow various strategies to earn money via your games, but you don't have to worry about a...
...implementing their own apis, which could take extra work, so consider that in your rates too. branding you can sell rights to use your game for branding, or do it yourself. in the first case it's almost like non-exclusive licensing, but the client will usually buy rights for the code and implement their own graphics. in the second case it's like a freelance deal, but you're reusing the code and
adding graphics provided by the client, sometimes implementing them as they instruct you. as an example if you've got a game where a player taps items of food, you could change the food to the client's products to give them advertising. prices in this model vary greatly depending on the brand, client, and amount of work you put in. other non-game focused monetization strategies there are other ways...
Bounce off the walls - Game development
o 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. to make the calculations easier let's define a variable called ballradius that will hold the radius of the drawn circle and be used for calculations.
add this to your code, somewhere below the existing 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. we need to check, on every frame, whether the ball is touching the ...
... ball hits each wall it sinks into it slightly before changing direction: this is because we're calculating the collision point of the wall and the center of the ball, while we should be doing it for its circumference. the ball should bounce right after if touches the wall, not when it's already halfway in the wall, so let's adjust our statements a bit to include that. ...
... compare your code lets again check the finished code for this part against what you've got, and have a play: exercise: try changing the color of the ball to a random colour every time it hits the wall. ...
...e walls as it should do. compare your code lets again check the finished code for this part against what you've got, and have a play: exercise: try changing the color of the ball to a random colour every time it hits the wall. next steps we've now got to the stage where our ball is both moving and staying on the game board. in the fourth chapter we'll look at implementing a controllable p
addle — see p
addle and keyboard controls. « previousnext » ...
Collision detection - Game development
s is the 10th 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/lesson10.html. now onto the next challenge — the collision detection between the ball and the bricks. ...
...er-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 p
addle), 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. ...
...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 p
addle), 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. first,
add a new line inside your update() function that checks for collision detection between ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, p
addle); game.physics.arcade.collide(ball, bricks, ballhitbrick); p
addle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the positions of all the bricks in the group. the thi...
... when using pure javascript. that's the beauty of using the framework — you can leave a lot of boring code to phaser, and focus on 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. « previousnext » ...
The score - Game development
« previousnext » 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. ...
...t 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 previously 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', fill: '#0095dd' }); the text() method can take four parameters: the x and y coordinates to draw the text at. the actual text that wi...
...e font style to render the text with. the last parameter looks very similar to css styling. in our case the score text will be blue, sized at 18 pixels, and use the arial font. updating the score when bricks are destroyed we will increase the number of points every time the ball hits a brick and update the scoretext to display the current score. this can be done using the settext() method —
add the two new lines seen below to the ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.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...
... « previousnext » ...
Plug-in Development Overview - Gecko Plugin API Reference
browser versions are compatible and possibly provide alternative processing for different versions: use the npn_version method to check for changes in major and minor version numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an
addition to current browser capabilities. to make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. use the npn_status method to display a message on the status line. for information about using this method, see version, ui, and status information. making plug-ins scriptable scriptable plug-ins...
...tly"); </script> in the past, liveconnect and later xpconnect were used to make plug-ins scriptable. 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 previous 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. ...
...aller should either package the plug-in into an extension and install it using normal extension installation practices, or install the plug-in to the system standard install locations. windows installation using the registry on windows, plug-ins should be installed to a plug-in-specific directory such as c:\program files\plugin name\nppluginname.dll. ...
...stry (the plug-in-identifier should follow the specification): hklm/software/mozillaplugins/plugin-identifier descripton: reg_sz "description of the plugin" path: reg_sz "c:\..path to the plugin.dll" productname: reg_sz "the plugin name" vendor: reg_sz "the plugin author/vendor" version: reg_sz "0.5.whatever plugin version string" hklm/software/mozillaplugins/plugin-identifier/mimetypes
add a sub-key for each mime type the plugin supports, with no values install to known locations on linux and mac on linux and mac, plug-ins are installed to well-known locations: linux: /usr/lib/mozilla/plugins or /usr/lib64/mozilla/plugins mac: /library/internet plug-ins or ~/library/internet plug-ins ...
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
// assignment gives the primitive a new (not a mutated) value bar = bar.touppercase(); // baz a primitive can be replaced, but it can't be directly altered. another example [ step-by-step ] the following example will help you go through how javascript deals with primitives. ...
... // baz a primitive can be replaced, but it can't be directly altered. another example [ step-by-step ] the following example will help you go through how javascript deals with primitives. ...
...step ] the following example will help you go through how javascript deals with primitives. javascript // the primitive let foo = 5; // defining a function that should change the primitive value function
addtwo(num) { num += 2; } // another function trying to do the same thing function
addtwo_v2(foo) { foo += 2; } // calling our first function while passing our primitive as an argument
addtwo(foo); // getting the current primitive value console.log(foo); // 5 // trying again with our second function...
addtwo_v2(foo); console.log(foo); // 5 did you expect it to be 7 instead of 5? if so, read how this code runs: for both the
addtwo and
addtwo_v2 functions calls, javascript looks up the value for the identifier foo. it correctly finds our variable instantiated with our firs...
...ced by 5 and the javascript engine passes that value to the functions as an argument before executing the statements inside the functions' bodies, javascript takes a copy of the originally passed argument (which is a primitive) and creates a local copy. these copies, existing only inside the functions' scopes, are accessible via the identifiers we specified in the functions' definitions (num for
addtwo, foo for
addtwo_v2) then, the functions' statements are executed: in the first function, a local num variable had been created. we are increasing its value by 2, not the original foo's value! in the second function, a local foo variable had been created. we are increasing its value by 2, not the original (external) foo's value! also, in this situation, the external foo variable canno...
Assessment: Accessibility troubleshooting - Learn web development
to make it easier for screenreader users to navigate? the navigation menu part of the site (wrapped in <div class="nav"></div>) could be made more accessible by putting it in a proper html5 semantic element. which one should it be updated to? make the update. note: you'll need to update the css rule selectors that style the tags to their proper equivalents for the semantic headings. ...
... note: you'll need to update the css rule selectors that style the tags to their proper equivalents for the semantic headings. once you
add paragraph elements, you'll notice the styling looking better. the images the images are currently inaccessible to screenreader users. can you fix this? the audio player the <audio> player isn't accessible to hearing impaired (deaf) people — can you
add some kind of accessible alternative for these users? the <audio> player isn't accessible to those using older browsers that don't support html5 audio. how can you allow them to still access the audio? the forms the <input> element in the search form at the top could do with a label, but we don't want to
add a visible text label that would potentially spoil the design and isn't really needed...
...ative for these users? the <audio> player isn't accessible to those using older browsers that don't support html5 audio. how can you allow them to still access the audio? the forms the <input> element in the search form at the top could do with a label, but we don't want to
add a visible text label that would potentially spoil the design and isn't really needed by sighted users. how can you
add a label that is only accessible to screenreaders? the two <input> elements in the comment form have visible text labels, but they are not unambiguously associated with their labels — how do you achieve this? note that you'll need to update some of the css rule as well. the show/hide comment control the show/hide comment control button is not current keyboard-accessible. can you make it keyb...
...ontrol button is not current keyboard-accessible. can you make it keyboard accessible, both in terms of focusing it using the tab key, and activating it using the return key? the table the data table is not currently very accessible — it is hard for screenreader users to associate data rows and columns together, and the table also has no kind of summary to make it clear what it shows. can you
add some features to your html to fix this problem? other considerations? can you list two more ideas for improvements that would make the website more accessible? assessment or further help 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. write a post asking for assessment and/or h...
Mobile accessibility - Learn web development
one model and android version you have, and then look up where the talkback menu is. it tends to differ widely between android versions and even between different phone models. some phone manufacturers (e.g. samsung) don't even have talkback in newer phones, and instead opted for their own screen reader. when you've found the talkback menu, press the slider switch to turn talkback on. follow any
additional on-screen prompts that you are presented with. when talkback is turned on, your android device's basic controls will be a bit different. for example: single-tapping an app will select it, and the device will read out what the app is. swiping left and right will move between apps, or buttons/controls if you are in a control bar. the device will read out each option. double-tapping any...
...how to implement different control mechanisms at implementing game control mechanisms. responsive design responsive design is the practice of making your layouts and other features of your apps dynamically change depending on factors such as screen size and resolution, so they are usable and accessible to users of different device types. in particular, the most common problems that need to be
addressed for mobile are: suitability of layouts for mobile devices. a multi-column layout won't work as well on a narrow screen, for example, and the text size may need to be increased so it is legible. such issues can be solved by creating a responsive layout using technologies such as media queries, viewport, and flexbox. conserving image sizes downloaded. in general, small screen devices won'...
..., it is wise to serve smaller images to narrow screen devices as appropriate. you can handle this using responsive image techniques. thinking about high resolutions. many mobile devices have high-resolution screens, and therefore need higher-resolution images so that the display can continue to look crisp and sharp. again, you can serve images as appropriate using responsive image techniques. in
addition, many image requirements can be fulfilled using the svg vector images format, which is well-supported across browsers today. svg has a small file size and will stay sharp regardless of whatever size is being displayed (see
adding vector graphics to the web for more details). note: we won't provide a full discussion of responsive design techniques here, as they are covered in other places...
... not disabling zoom using viewport, it is possible to disable zoom. ...
Cascade and inheritance - Learn web development
ys look up the details if you forget! even experienced developers don't remember all the details. the below video shows how you can use the firefox devtools to inspect a page's cascade, specificity, and more: understanding inheritance we'll start with inheritance. in the example below we have a <ul>, with two levels of unordered lists nested inside it. ...
...pecificity, and more: understanding inheritance we'll start with inheritance. in the example below we have a <ul>, with two levels of unordered lists nested inside it. we have given the outer <ul> a border, p
adding, and a font color. the color has applied to the direct children, but also the indirect children — the immediate child <li>s, and those inside the first nested list. we have then
added a class of special to the second nested list and applied a different color to it. this then inherits down through its children. things like widths (as mentioned above), margins, p
adding, and borders do not inherit. if a border were to be inherited by the children of our list, every single list and list item would gain a border — probably not an effect we would ever want! which properties...
...erties and values. the values defined initially are applied to all headings, then the more specific values are applied to the headings with the classes. let's now have a look at how the browser will calculate specificity. we already know that an element selector has low specificity and can be overwritten by a class. essentially a value in points is awarded to different types of selectors, and
adding these up gives you the weight of that particular selector, which can then be assessed against other potential matches. the amount of specificity a selector has is measured using four different values (or components), which can be thought of as thousands, hundreds, tens and ones — four single digits in four columns: thousands: score one in this column if the declaration is inside a style ...
...d to make a particular property and value the most specific thing, thus overriding the normal rules of the cascade. take a look at this example where we have two paragraphs, one of which has an id. let's walk through this to see what's happening — try removing some of the properties to see what happens if you are finding it hard to understand: you'll see that the third rule's color and p
adding values have been applied, but the background-color hasn't. why? really all three should surely apply, because rules later in the source order generally override earlier rules. however, the rules above it win, because class selectors have higher specificity than element selectors. both elements have a class of better, but the 2nd one has an id of winning too. since ids have an even higher spe...
Overflowing content - Learn web development
n there is too much content to fit in a box. css provides various tools to manage overflow. as you go further with css layout and writing css, you will encounter more overflow situations. css tries to avoid "data loss" let's consider two examples that demonstrate the default behavior of css when there is overflow. the first example is a box that has been restricted by setting a height. then we
add content that exceeds the allocated space. 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 th...
...e browser how it should behave. the default value of overflow is visible. with this default, we can see content when it overflows. to crop content when it overflows, you can set overflow: hidden. this does exactly what it says: it hides overflow. beware that this can make some content invisible. you should only do this if hiding content won't cause problems. instead, perhaps you would like to
add scrollbars when content overflows? using overflow: scroll, browsers with visible scrollbars will always display them—even if there is not enough content to overflow. this offers the advantage of keeping the layout consistent, instead of scrollbars appearing or disappearing, depending upon the amount of content in the container. remove some content from the box below. notice how the scrollbars ...
...need to scroll on the y axis, however we get scrollbars in both axes. to just scroll on the y axis, you could use the overflow-y property, setting overflow-y: scroll. you can also scroll on the x axis using overflow-x, although this is not a recommended way to accommodate long words! if you have a long word in a small box, you might consider using the word-break or overflow-wrap properties. in
addition, some of the methods discussed in sizing items in css may help you create boxes that scale better with varying amounts of content. as with scroll, you get a scrollbar in the scrolling dimension whether or not there is enough content to cause a scrollbar. note: you can specify x and y scrolling using the overflow property, passing two values. if two keywords are specified, the first appl...
...ent on the page. now you can recognize that this happens with overflow. ideally, you will refactor the layout to not rely on fixed-height containers. when developing a site, always keep overflow in mind. test designs with large and small amounts of content. increase the font sizes of text. generally ensure that your css works in a robust way. changing the value of overflow to hide content, or to
add scrollbars, is likely to be reserved for a few select use cases. (for example, where you intend to have a scrolling box) test your skills! there is a lot to absorb from this lesson! can you remember the 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 m...
Test your skills: The Box Model - Learn web development
ver, 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. the box model one with the two boxes below, one is using the standard box model, the other the alternate box model. ...
... second box by
adding rules to the .alternate class, so that it matches the visual width of the first box. your final result will look like the image below. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. the box model two in this task,
add to the box: a 5px, black, dotted border. a top margin of 20px. a right margin of 1em. a bottom margin of 40px. a left margin of 2em. p
adding on all sides of 1em. try updating the live code below to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. t...
... right margin of 1em. a bottom margin of 40px. a left margin of 2em. p
adding on all sides of 1em. try updating the live code below to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. the box model three in this example the inline element has a margin, p
adding and border however the lines above and below are overlapping it. ...
...l sides of 1em. try updating the live code below to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. the box model three in this example the inline element has a margin, p
adding and border however the lines above and below are overlapping it. what can you
add to your css to cause the size of the margin, p
adding, and border to be respected by the other lines, while still keeping the element inline? try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice the...
Normal Flow - Learn web development
ow elements behave either by adjusting their position in that normal flow, or removing them from it altogether. starting with a solid, well-structured document that is readable in normal flow is the best way to begin any webpage. it ensures that your content 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 previous modules with regard to normal document flow. how are elements laid out by default...
...e 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 previous 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 p
adding, 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 is 100% of the width of its parent element, and as tall as its content. inline elements are as tall as their content, and as wide as their content. you can't set width or height on inline elements — they just sit inside the content of blo...
...alled margin collapsing, and we have met this before too. let's look at a simple example that explains all of this: <h1>basic document flow</h1> <p>i am a basic block level element. my adjacent block level elements sit on new lines below me.</p> <p>by default we span 100% of the width of our parent element, and we are as tall as our child content. our total width and height is our content + p
adding + border width/height.</p> <p>we are separated by our margins. because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. overflowing inline elements will <span>wrap onto a new line if p...
... space on the same line. overflowing inline elements will <span>wrap onto a new line if possible (like this one containing text)</span>, or just go on to a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> body { width: 500px; margin: 0 auto; } p { background: rgba(255,84,104,0.3); border: 2px solid rgb(255,84,104); p
adding: 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. previous overview: css layout next in this module introduction to css layout normal flow flexbox g...
Using CSS generated content - Learn web development
one of the important advantages of css is that it helps you to separate a document's style from its content. however, there are situations where it makes sense to specify certain content as part of the stylesheet, not as part of the document. you can specify text or image content within a stylesheet when that content is closely linked to the document's structure. note: content specified in a stylesheet does not become part of the dom. specifying content in a stylesheet can cause complications. ...
...n, you have to put those parts of your stylesheet in different files and arrange for them to be linked with the appropriate language versions of your doucment. this issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. examples text content css can insert text content before or after an element. to specify this, make a rule and
add ::before or ::after to the selector. in the declaration, specify the content property with the text content as its value. html a text where i need to <span class="ref">something</span> css .ref::before { font-weight: bold; color: navy; content: "reference "; } output the character set of a stylesheet is utf-8 by default, but it can also be specified in the link, in the stylesheet i...
...etails, see 4.4 css style sheet representation in the css specification. individual characters can also be specified by an escape mechanism that uses backslash as the escape character. for example, "\265b" is the chess symbol for a black queen ♛. for details, see referring to characters not represented in a character encoding and characters and case in the css specification. ...
...mechanism that uses backslash as the escape character. for example, "\265b" is the chess symbol for a black queen ♛. for details, see referring to characters not represented in a character encoding and characters and case in the css specification. image content to
add an image before or after an element, you can specify the url of an image file in the value of the content property. ...
Learn to style HTML using CSS - Learn web development
cascading stylesheets — or css — is the first technology you should start learning after html. while html is used to define the structure and semantics of your content, css is used to style it and lay it out. for example, you can use css to alter the font, color, size, and spacing of your content, split it into multiple columns, or
add animations and other decorative features. 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 you should learn the basics of html before attempting any css. we recommend that you work through our introduction to html module first. in that module, you will learn about: css, starting with the introduction to css module m...
...that includes all the essential information you need to work towards your goal. get started prerequisites you should learn the basics of html before attempting any css. we recommend that you work through our introduction to html module first. in that module, you will learn about: css, starting with the introduction to css module more advanced html modules javascript, and how to use it to
add dynamic functionality to web pages once you understand the fundamentals of html, we recommend that you learn html and css at the same time, moving back and forth between the two topics. this is because html is far more interesting and much more fun to learn when you apply css, and you can't really learn css without knowing html. before starting this topic, you should also be familiar with usin...
...s first steps module, albeit in a lot more detail. modules this topic contains the following modules, in a suggested order for working through them. you should definitely start with the first one. css first steps css (cascading style sheets) is used to style and lay out 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 like, and how you can start using it to
add styling to html. css building blocks this module carries on where css first steps left off — now you've gained familiarity with the language and its syntax, and got some basic exp...
... and some of the legacy techniques you might still want to know about. solving common css problems use css to solve common problems provides links to sections of content explaining how to use css to solve very common problems when creating a web page. from the beginning, you'll primarily apply colors to html elements and their backgrounds; change the size, shape, and position of elements; and
add and define borders on elements. but there's not much you can't do once you have a solid understanding of even the basics of css. one of the best things about learning css is that once you know the fundamentals, usually you have a pretty good feel for what can and can't be done, even if you don't actually know how to do it yet! "css is weird" css works a bit differently to most programming langu...
How does the Internet work? - Learn web development
ial tiny computer called a router. this router has only one job: like a signaler at a railway station, it makes sure that a message sent from a given computer arrives at the right destination computer. to send a message to computer b, computer a must send the message to the router, which in turn forwards the message to computer b and makes sure the message is not delivered to computer c. once we
add a router to the system, our network of 10 computers only requires 10 cables: a single plug for each computer and a router with 10 plugs. a network of networks so far so good. but what about connecting hundreds, thousands, billions of computers? of course a single router can't scale that far, but, if you read carefully, we said that a router is a computer like any other, so what keeps us from ...
...l routers that are all linked together and can also access other isps' routers. so the message from our network is carried through the network of isp networks to the destination network. the internet consists of this whole infrastructure of networks. finding computers if you want to send a message to a computer, you have to specify which one. thus any computer linked to a network has a unique
address that identifies it, called an "ip
address" (where ip stands for internet protocol). it's an
address made of a series of four numbers separated by dots, for example: 192.168.2.10. that's perfectly fine for computers, but we human beings have a hard time remembering that sort of
address. to make things easier, we can alias an ip
address with a human readable name called a domain name. for exam...
...so using the domain name is the easiest way for us to reach a computer over the internet. internet and the web as you might notice, when we browse the web with a web browser, we usually use the domain name to reach a website. ...
...so using the domain name is the easiest way for us to reach a computer over the internet. ...
What is the difference between webpage, website, web server, and search engine? - Learn web development
ped together and usually connected together in various ways. often called a "web site" or simply a "site." web server a computer that hosts a website on the internet. search engine a web service that helps you find other web pages, such as google, bing, yahoo, or duckduckgo. search engines are normally accessed through a web browser (e.g. you can perform search engine searches directly in the
address bar of firefox, chrome, etc.) or through a web page (e.g. bing.com or duckduckgo.com). let's look at a simple analogy — a public library. this is what you would generally do when visiting a library: find a search index and look for the title of the book you want. make a note of the catalog number of the book. go to the particular section containing the book, find the right catalog nu...
... four terms are related and why they are sometimes confused with each other. web page a web page is a simple document displayable by a browser. such documents are written in the html language (which we look into in more detail in other articles). ...
... style information — controlling a page's look-and-feel scripts — which
add interactivity to the page media — images, sounds, and videos. note: browsers can also display other documents such as pdf files or images, but the term web page specifically refers to html documents. otherwise, we only use the term document. all web pages available on the web are reachable through a unique
address. to access a page, just type its
address in your browser
address bar: web site a website is a collection of linked web pages (plus their associated resources) that share a unique domain name. each web page of a given website provides explicit links—most of the time in the form of clickable portion of text—that allow the user to move from one page of the website to another. to access ...
...such a website is sometimes called a single-page website. web server a web server is a computer hosting one or more websites. ...
Publishing your website - Learn web development
hod that can work right away for many readers. getting hosting and a domain name to have more control over content and website appearance, most people choose to buy web hosting and a domain name: web hosting is rented file space on a hosting company's web server. you put website files on the web server. the web server provides website content to website visitors. ...
...on a hosting company's web server. you put website files on the web server. the web server provides website content to website visitors. a domain name is the unique
address where people find your website, such as http://www.mozilla.org or http://www.bbc.co.uk. you can rent your domain name for as many years as you want from a domain registrar. many professional websites go online this way. in
addition, you will need a file transfer protocol (ftp) program (see how much does it cost: software for more details) to actually transfer the website files over to the server. ftp programs vary widely, but generally, you have to connect to your web server using details provided by your hosting company (typically username, password, hostname). then the program shows you your local files and the web ...
...er html, css and javascript, and then display the result of that code as a website — all in one browser tab. generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different office), and free (for basic features). they host your rendered page at a unique web
address. however, the features are limited, and these apps usually don't provide hosting space for assets (like images). try playing with some of these examples to find out which one works best for you: jsfiddle glitch js bin codepen publishing via github now let's examine how to easily publish your site via github pages. first of all, sign up for github and verify your email
address. ...
... note: it may take a few minutes for your website to go live. if your website does not display immediately, wait a few minutes. try again. to learn more, see github pages help. further reading what is a web server understanding domain names how much does it cost to do something on the web? deploy a website: a nice tutorial from codecademy that goes a bit further and shows some
additional techniques. cheap or free static website hosting by scott murray has some useful ideas on available services. previous overview: getting started with the web next in this module installing basic software what will your website look like? dealing with files html basics css basics javascript basics publishing your website how the web works ...
Use JavaScript within a webpage - Learn web development
ou're linking to an external script or embedding a script right in your webpage. linking an external script usually, you'll be writing scripts in their own .js files. ...
...al script usually, you'll be writing scripts in their own .js files. if you want to execute a .js script from your webpage, just use <script> with an src attribute pointing to the script file, using its url: <script src="path/to/my/script.js"></script> writing javascript within html you may also
add javascript code between <script> tags rather than providing an src attribute. ...
...cus on your work write self-sufficient html write structured javascript applications use scripting accessibly accessibility is a major issue in any software development. javascript can make your website more accessible if you use it wisely, or it can become a disaster if you use scripting without care. to make javascript work in your favor, it's worth knowing about certain best practices for
adding javascript: make all content available as (structured) text. rely on html for your content as much as possible. for example, if you've implemented a nice javascript progress bar, make sure to supplement it with matching text percentages inside the html. likewise, your drop-down menus should be structured as unordered lists of links. make all functionality accessible from the keyboard. ...
...sing a keyboard only. don't set nor even guess time limits. it takes extra time to navigate with the keyboard or hear content read out. you can hardly ever predict just how long it will take for users or browsers to complete an process (especially asynchronous actions such as loading resources). keep animations subtle and brief with no flashing. flashing is annoying and can cause seizures.
additionally, 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 iss...
Structuring a page of content - Learn web development
ked 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. the zip file contains: the html you need to
add structural markup to. css to style your markup. images that are used on the page. create the example on your local computer, or alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for this project, your task is to ta...
...are used on the page. create the example on your local computer, or alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for this project, your task is to take the content for the homepage of a bird watching website and
add structural elements to it so it can have a page layout applied to it. it needs to have: a header spanning the full width of the site containing the main title for the page, the site logo, and the navigation menu. the title and logo appear side by side once styling is applied, and the navigation appears below those two items. a main content area containing two columns — a main block to conta...
...te containing the main title for the page, the site logo, and the navigation menu. the title and logo appear side by side once styling is applied, and the navigation appears below those two items. a main content area containing two columns — a main block to contain the welcome text, and a sidebar to contain image thumbnails. a footer containing copyright information and credits. you need to
add a suitable wrapper for: the header the navigation menu the main content the welcome text the image sidebar the footer you should also: apply the provided css to the page by
adding another <link> element just below the existing one provided at the start. hints and tips use the w3c nu html checker to catch unintended mistakes in your html, css, and svg — mistakes you might have ...
...e provided at the start. hints and tips use the w3c nu html checker to catch unintended mistakes in your html, css, and svg — mistakes you might have otherwise missed — so that you can fix them. you don't need to know any css to do this assessment; you just need to put the provided css inside an html element. the provided css is designed so that when the correct structural elements are
added to the markup, they will appear green in the rendered page. if you are getting stuck and can't envisage what elements to put where, draw out a simple block diagram of the page layout, and write on the elements you think should wrap each block. this is extremely helpful. example the following screenshot shows an example of what the homepage might look like after being marked up. assessmen...
Assessment: Structuring planet data - Learn web development
hat you need to do to complete the table example. all the data you'll need is contained in the planets-data.txt file. if you have trouble visualising the data, look at the live example above, or try drawing a diagram. open your copy of blank-template.html, and start the table off by giving it an outer container, a table header, and a table body. you don't need a table footer for this example. ...
...example. all the data you'll need is contained in the planets-data.txt file. if you have trouble visualising the data, look at the live example above, or try drawing a diagram. open your copy of blank-template.html, and start the table off by giving it an outer container, a table header, and a table body. you don't need a table footer for this example.
add the provided caption to your table. ...
... hints and tips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. ...
...e all the content rows inside the table body, remembering to make all the row headings into headings semantically. ensure all the content is placed into the right cells — in the raw data, each row of planet data is shown next to its associated planet.
add attributes to make the row and column headers unambiguously associated with the rows, columns, or rowgroups that they act as headings for.
add a black border just around the column that contains all the planet name row headers. hints and tips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. jovian planets) that sit to the left of the planet name row headings (e.g. saturn) are a little tricky to sort out — you need to make sure each one spans the correct number of rows and col...
JavaScript object basics - Learn web development
ell() one useful aspect of bracket notation is that it can be used to set not only member values dynamically, but member names too. let's say we wanted users to be able to store custom value types in their people data, by typing the member name and value into two text inputs. ...
... names too. let's say we wanted users to be able to store custom value types in their people data, by typing the member name and value into two text inputs. ...
... what is "this"? you may have noticed something slightly strange in our methods. ...
...safely locked away in their own package, out of harm's way. ...
Aprender y obtener ayuda - Learn web development
, or in an online code editor like jsbin, codepen, or glitch. in fact, you'll be called to do so as part of this course when you are learning! note: online code editors are also really useful for sharing code you've written, for example, if you are collaborating on learning with someone else who isn't in the same location, or are sending it someone to ask for help with it. you can share the web
address of the example with them so they can see it. note: you might favor one learning method over the others, but realistically a hybrid approach is probably what you will end up with. and you'll probably come up with other methods than the three we covered above. making a plan it is a good idea to create a plan to help you achieve what you want to achieve through your learning. a goal state...
... if you are a complete beginner to web development, you'll have to do some study and web searches and lookup 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 writi...
...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 previous 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. this is pretty mu...
...ant to find out more about responsive web design, you could search for "responsive web design". if you want to find out more about a specific technology feature, such as the html <video> element, or the css background-color or opacity properties, or the javascript date.settime() method, you should just search for the feature's name. if you are looking for some more specific information, you can
add other keywords as modifiers, for example "<video> element autoplay attribute", or "date.settime parameters". if you want to search for something that has less obvious buzzwords, you need to think about what is most likely to return what you want. run code after several promises are fulfilled play a video stream from a webcam in the browser create a linear gradient in the background of your...
Multimedia: Images - Learn web development
e 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. for a more in-depth guide, see https://images.guide. why optimize your multimedia? for the average website, 51% of its bandwidth comes from imagery, followed by video at 25%, so it's safe to say it's important to
address and optimize your multi-media content. you need to be considerate of data usage. many people are on capped data plans or even pay-as-you-go where they are literally paying by the megabyte. this isn't an emerging market problem either. as of 2018, 24% of the united kingdom still use pay-as-you-go. you also need to be considerate of memory as many mobile devices have limited ram. it's importa...
... jpeg-xr — created by microsoft and only available in internet explorer and edgehtml based edge. doesn't support progressive display and the image decoding is not hardware accellerated and therefore resource intensive on the browser's main thread. jpeg2000 — once to be successor to jpeg but only supported in safari. doesn't support progressive display either. in the future browsers might
add support for even more advanced formats like high efficiency image file format (heif) or av1 still image file format (avif). given the narrow support for jpeg-xr and jpeg2000, and also taking decode costs into the equation, the only serious contender for jpeg today is webp. which is why you could consider offering your images in that flavor, too, for the browsers that support it. this can be done...
...s that you can use as image cdns that will automate the serving of the correct image format on-the-fly, according to the type of device or browser requesting the image. the biggest ones are cloudinary and image engine. and finally, should you want to include animated images into your page, then know that safari allows using video files within <img> and <picture> elements. these also allow you to
add in an animated webp for all other modern browsers. <picture> <source type="video/mp4" src="giphy.mp4"> <source type="image/webp" src="giphy.webp"> <img src="giphy.gif"> </picture> serving the optimal size in image delivery the "one size fits all" approach will not yield the best results, meaning that for smaller screens you would want to serve images with smaller resolution and vis-ve...
...han the less important can deliver improved perceived performance. the first thing to check is that your content images use <img> elements and your background images are defined in css with background-image — images referenced in <img> elements are assigned a higher loading priority than background images. secondly, with the adoption of priority hints, you can control the priority further by
adding an importance attribute to your image tags. an example use case for priority hints on images are carousels where the first image is a higher priority than the subsequent images. rendering strategy as images are loaded asynchronously and continue to load after the first paint, if their dimensions aren't defined before load, they can cause reflows to the page content. for example, when text ge...
Introduction to the server side - Learn web development
overview: first steps next welcome to the mdn beginner's server-side programming course! in this first article, we look at server-side programming from a high level, answering questions such as "what is it?", "how does it differ from client-side programming?", and "why it is so useful?". after reading this article you'll understand the
additional power available to websites through server-side coding. prerequisites: basic computer literacy. a basic understanding of what a web server is. objective: to gain familiarity with what server-side programming is, what it can do, and how it differs from client-side programming. most large-scale websites use server-side code to dynamically display different data when needed, generally pulled out of a database sto...
...ing? web browsers communicate with web servers using the hypertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, an http request is sent from your browser to the target server. the request includes a url identifying the affected resource, a method that defines the required action (for example to get, delete, or post the resource), and may include
additional information encoded in url parameters (the field-value pairs sent via a query string), as post data (data sent by the http post method), or in associated cookies. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response contains a status line indicating whether or not the request succeeded (e.g. "...
... have logged in can edit them. to try this, click on the edit button at the top of this page — if you are logged in you will be shown the edit view; if you are not logged in you will be taken to the sign-up page. note: consider other real examples where access to content is controlled. for example, what can you see if you go to the online site for your bank? log in to your account — what
additional information can you see and modify? what information can you see that only the bank can change? store session/state information server-side programming allows developers to make use of sessions — basically, a mechanism that allows a server to store information on the current user of a site and send different responses based on that information. this allows, for example, a site to kno...
...bought or viewed that you might be interested in. a web server might send warning messages to site administrators alerting them to low memory on the server, or suspicious user activity. note: the most common type of notification is a "confirmation of registration". pick almost any large site that you are interested in (google, amazon, instagram, etc.) and create a new account using your email
address. you will shortly receive an email confirming your registration, or requiring acknowledgment to activate your account. data analysis a website may collect a lot of data about users: what they search for, what they buy, what they recommend, how long they stay on each page. server-side programming can be used to refine responses based on analysis of this data. for example, amazon and google...
Website security - Learn web development
s 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. 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 prevent 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...
...money. john constructs a form that includes his bank details and an amount of money as hidden fields, and emails it to other site users (with the submit button disguised as a link to a "get rich quick" site). if a user clicks the submit button, an http post request will be sent to the server containing the transaction details and any client-side cookies that the browser associated with the site (
adding associated site cookies to requests is normal browser behavior). the server will check the cookies, and use them to determine whether or not the user is logged in and has permission to make the transaction. the result is that any user who clicks the submit button while they are logged in to the trading site will make the transaction. john gets rich. note: the trick here is that john doesn't...
... limited to data in url parameters of get requests, post requests, http headers and cookies, and user-uploaded files. always check and sanitize all incoming data. always assume the worst. a number of other concrete steps you can take are: use more effective password management. encourage strong passwords that are changed regularly. consider two-factor authentication for your site, so that in
addition to a password the user must enter another authentication code (usually one that is delivered via some physical hardware that only the user will have, such as a code in an sms sent to their phone). configure your web server to use https and http strict transport security (hsts). https encrypts data sent between your client and server. this ensures that login credentials, cookies, post reques...
...ll have, such as a code in an sms sent to their phone). configure your web server to use https and http strict transport security (hsts). https encrypts data sent between your client and server. this ensures that login credentials, cookies, post requests data and header information are not easily available to attackers. keep track of the most popular threats (the current owasp list is here) and
address the most common vulnerabilities first. use vulnerability scanning tools to perform automated security testing on your site. later on, your very successful website may also find bugs by offering a bug bounty like mozilla does here. only store and display data that you need. for example, if your users must store sensitive information like credit card details, only display enough of the card n...
Routing in Ember - Learn web development
t also updated an existing file, app/router.js. it contains the following contents: import emberrouter from '@ember/routing/router'; import config from './config/environment'; export default class router extends emberrouter { location = config.locationtype; rooturl = config.rooturl; } router.map(function() { this.route('completed'); this.route('active'); }); the highlighted lines were
added when the 2nd and 3rd commands above were run. router.js behaves as a "sitemap" for developers to be able to quickly see how the entire app is structured. it also tells ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the url. since our data is static, we won't get to any of those fancy feat...
...re app is structured. it also tells ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the url. since our data is static, we won't get to any of those fancy features, but we'll still make sure that the route provides the minimally required data to view a page. creating the "index" route did not
add a route definition line to router.js, because like with url navigation and javascript module loading, "index" is a special word that indicates the default route to render, load, etc. to adjust our old way of rendering the todolist app, we'll first need to replace the todolist component invocation from the application template with an {{outlet}} call, which means "any sub-route will be rendered i...
...application.hbs. so we have our routes in place. great! but now we need a way to differentiate between each of these routes, so that they show what they are supposed to show. first of all, return once more to our todo-data.js file. it already contains a getter that returns all todos, and a getter that returns incomplete todos. the getter we are missing is one to return just the completed todos.
add the following below the existing getters: get completed() { return this.todos.filter(todo => todo.iscompleted); } models now we need to
add models to our route javascript files to allow us to easily return specific data sets to display in those models. model is a data loading lifecycle hook. for todomvc, the capabilities of model aren't that important to us; you can find more information in ...
...react resources ember getting started with ember ember app structure and componentization ember interactivity: events, classes and state ember interactivity: footer functionality, conditional rendering routing in ember ember resources and troubleshooting vue getting started with vue creating our first vue component rendering a list of vue components
adding a new todo form: vue events, methods, and models styling vue components with css using vue computed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelt...
Strategies for carrying out testing - Learn web development
rowser testing choices is browser support stats. there are a number of sites that provide such stats, for example: netmarketshare statcounter these are both very north america-centric, and not particularly accurate, but they can give you an idea of broad trends. for example, let's go to netmarketshare. you can see that opera is listed as having small but visible usage figures, so we should
add it to our support chart too as grade c. ie8 is listed as being significant too, but it is older and no longer capable. opera mini is also significant, but it isn't very capable in terms of running complex javascript at runtime, etc (see opera mini and javascript for more details). we should put this into grade b as well. using analytics a much more accurate source of data, if you can get it, c...
... like google analytics. this is an application that will give you accurate stats on exactly what browsers people are using to browse your site. of course, this relies on you already having a site to use it on, so it isn't much good for completely new sites. but an analytics history can be useful for finding support stats to influence say a new version of a company's site, or new features you are
adding to an existing site. if you have these available, they are far more accurate than global browser stats like those mentioned above. you may also consider using open source and privacy focussed analytics platforms like open web analytics and matomo. they expect you to self-host the analytics platform. setting up google analytics first of all, you'll need a google account. use this account ...
...i for mac, edge and ie for windows (last two versions of each), ios safari for iphone/ipad, android stock browser (last two versions) on phone/tablet, chrome and firefox for android (last two versions) on phone tablet. accessibility passing common tests. b grade: ie 8 and 9 for windows, opera mini. c grade: opera, other niche modern browsers. what are you going to test? when you've got a new
addition to your codebase that needs testing, before you start testing you should write out a list of testing requirements that need to pass to be accepted. these requirements can be visual or functional — both combine to make a usable web site feature. consider the following example (see the source code, and also the example running live): test criteria for this feature could be written like s...
... use browser's private mode functionality when running tests, where available (e.g. private browsing in firefox, incognito mode in chrome) so things like cookies and temp files are not saved. these steps are designed to make sure that the browser you are testing in is as "pure" as possible, i.e. there is nothing installed that could affect the results of the tests. not...
Accessibility/LiveRegionDevGuide
document for the latest firefox api with regards to live regions. as always, we're open to questions and suggestions for changes in community forums. priority queue the heart of any live region support module is the priority queue. it is responsible for queuing messages derived from live region events, where priority is determined by chronological order and the live politeness properties. in
addition to the standard priority queue methods,
additional methods will need to be implemented that purge the queue based on one of the priority criterion. the "purge by timestamp" method will be used to remove old messages that are no longer deemed relevant while "purge by politeness" is used to satisfy the aria live politeness specification. the later method will be explained in detail below. ev...
... in at-spi and iaccessible2. in at-spi, the object changed event are called object:children-changed events because the event is triggered on the parent of the object. the actual object that change can then be found in the event.any_data field. in iaccessible2, the event_object_* events are triggered on the actual object that changed. the object changed events can be further subdivided into object
addition and removal events. in at-spi, this is accomplished by appending ":
add" or ":remove" to the event string. in iaccessible2, there are two separate event types, namely event_object_show and event_object_hide. text changed the text changed events are quite similar in at-spi and iaccessible2 with both having an insert and delete or removal events. the text changed event type in at-spi has a s...
...pi text changed event is directly in the event object. the event.any_data field holds the entire text string while event.detail1 is the start index while event.detail2 is the text string length. in iaccessible2, iaccessibletext::get_oldtext and iaccessibletext::get_newtext are used to acquire the text and offsets. filtering events text changed events certain web page mutation events, such as
adding to a list, trigger both an object changed and a text changed event. both events should not be acted upon or double announcements would result. instead, all text changed events should be examined for the presence of an embed character. if one is present, the text changed event should be discarded because an object changed event will follow. filtering user actions this paragraph describes ob...
... "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 prevent 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 allowed to finish but the 'rude' messages should be output as soon as possible. containe...
Mozilla’s UAAG evaluation report
3.2 toggle audio, video, animated images. (p1) p animated images can be made still with the escape key animated images can be made still as a preference under preferences, privacy & security, images - "animated images should loop" mozilla has no preference or command to toggle audio or video 3.3 toggle animated/blinking text. (p1) p the following line can be
added to a user's prefs.js file to control blinking: user_pref("browser.blink_allowed", false); bug 89144 has been filed to expose this pref in the ui. mozilla doesn't support <marquee> by default. 3.4 toggle scripts. (p1) g preferences, advanced, scripts & windows - enable javascript for when toggled off, we don't notify the user when a page is loaded with scripts ...
... 4.1 configure text size. (p1) c can be changed through preferences, zooming or user style sheet. zooming is really the best solution, because the document retains its look - all font sizes are increased the same percentage. zooming can be controlled via hotkeys ctrl+plus and ctrl+minus the prefs are at preferences, appearances, fonts there is also a hidden pref line that can be
added to prefs.js, if you just want to change the minimum font size for a certain font: user_pref("font.minimum-size.x-western", newfontsizeinpoints); for other i18n charsets, change x-western to x-central-euro, x-cyrillic, x-unicode, x-user-def, x-baltic, el, tr, he, ar, th, ja, zh-cn or zh-tw 4.2 configure font family. (p1) c can be changed through preferences or user style s...
...th the current focus is always on top. 5.3 manual viewport open only. (p2) vg preferences, advanced, scripts & windows - allow scripts to "open unrequested windows" we do not have a strategy to "alert the user and allow the user to open it on demand" we do not have exposed prefs for all of our popup control options. ...
...lly supported for all configuration options. unfortunately, switching profiles requires the entire application to be relaunched. there is still very little end-user documentation for editing profiles by hand. 11.7 configure tool bars. (p3) p can turn on and off toolbars under show/hide can customize personal bookmarks toolbar bug 15144 is for the ability to
add/remove toolbar icons bug 47418 is for the ability to rearrange toolbars guideline 12. provide accessible user agent documentation and help. checkpoint title status notes/plans 12.1 accessible documentation. (p1) nr some end user docs are under help, help contents in mozilla here is the main page for mozilla end user documentation n...
Command line options
./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 prevents 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 profile manager, the profile_name must not contain spaces ( ). do not run profile_name while running an instance of the application, you can use the -no-remote option to avoid connecting to a runn...
...t the application as the default browser. firefox only. -url url open url in a new tab or window, depend on the browser option. -url can be omitted. you may list multiple urls, separated by spaces. firefox and seamonkey only. firefox www.mozilla.com firefox www.mozilla.com developer.mozilla.org note: when opening multiple urls, firefox always opens them as tabs in a new window. mail/news -
addressbook start with
address book. thunderbird and seamonkey only. -compose message_options start with mail composer. see syntax rules. thunderbird and seamonkey only. thunderbird -compose "to=foo@nowhere.net" -mail start with the mail client. thunderbird and seamonkey only. -news news_url start with the news client. if news_url (optional) is given, open the specified newsgroup. thunderbird...
... users. must be run as admin / root. --register-user registers xulrunner for a single user. --unregister-global unregisters xulrunner for all users. --unregister-user unregisters xulrunner for a single user. chrome -chrome chrome_url load the specified chrome. firefox -chrome chrome://inspector/content -register chrome_url register the specified chrome, but do not start application.
add-ons gecko 1.9.2 note -install-global-extension and -install-global-theme have been removed from gecko 1.9.2 and upwards. -install-global-extension /path/to/extension installs the extension into the application directory. the parameter is the path to the extension. you must have administrative privileges. -install-global-theme /path/to/theme same as above, but for themes. you must have ...
...xtension into the application directory. the parameter is the path to the extension. you must have administrative privileges. -install-global-theme /path/to/theme same as above, but for themes. you must have administrative privileges. note: since firefox 2.0.0.7, use of the -install-global-extension and -install-global-theme command line arguments have been restricted to only allow installing
add-ons that are on local disks or mapped drives. installing from a network share directly will no longer succeed. -safe-mode launches the application with all extensions disabled, for that launch only (extensions are not loaded, but are not permanently disabled in the extension manager data source). remote control -remote remote_command this feature was removed in firefox 36.0, restored in ...
Creating a Language Pack
this page is out of date. please consult the documentation on localized builds on firefox-source-docs. to create a language pack, or a localization repack, you first need to go through the initial setup process. pre-build steps in the .mozconfig, you want to have mk_
add_options moz_objdir=@topsrcdir@/obj-firefox-build ac_
add_options --disable-compile-environment ac_
add_options --with-l10n-base=../l10n-central # path relative to moz_objdir ac_
add_options --enable-application=[browser or mail] the given path should have your localization directory as child (i.e., a subdirectory ab-cd where ab-cd is your locale code). you still need to specify which application you're localizing (e.g., for firefox, that's browser, thunderbird would be mail). configure step you need to prepare ...
... want to create a langpack, you need to be in the directory obj-firefox-build/browser/locales. it is likely that you will continue to generate language packs as your progress just to test your work. while in that directory, issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir 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 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 preview the contents of the mergedir. you'll see that it contains the files ...
...o the dist directory to find your langpack ready to use! $ cd ../../dist the xpi file can be found in the directory win32/xpi on windows, linux-i686/xpi or linux-x86_64 on linux or mac/xpi on mac. open the xpi file contained in this directory with firefox to see your work. you have to set your selected language still. you can either use the locale switcher extension, or set it in about:config.
add the preference intl.locale.requested and set it to your language code, in this case, x-testing, or
add it in front of the current setting, seperated with a comma. before gecko 59 you had to set the preference general.useragent.locale to your language code. l10n binary repack for apps currently in development, you need to get the right strings for the build you use. best is to create an installe...
... en-us files from the original source. issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir rm -f -rf mergedir macosx_deployment_target= compare-locales -m mergedir /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 preview 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 repacka...
Creating Sandboxed HTTP Connections
ies, which the browser processes. as of mozilla 1.8.1 (firefox 2), it is now possible to intercept those two cases. for example, this means that if the user was logged into an webmail account, another account on the same domain could be checked without changing the user's cookies. the observer service (nsiobserverservice) is used to send general notifications, including the two cookie ones. the
addobserver method is used to
add an observer for a certain topic and takes in three agruments: an object than implements nsiobserver the topic to listen for. for cookies, the two topics are: http-on-modify-request - happens after the cookie data has been loaded into the request, but before the request is sent. http-on-examine-response - happens after the response is received, b...
...erfaces.nsisupports) || aiid.equals(components.interfaces.nsiobserver)) return this; throw components.results.ns_nointerface; } }; // get the observer service and register for the two coookie topics. var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.
addobserver(listener, "http-on-modify-request", false); observerservice.
addobserver(listener, "http-on-examine-response", false); the final piece is to manipulate the cookies. in order to manipulate cookies, the nsichannel needs to be converted into a nsihttpchannel by using queryinterface (qi): var httpchannel = asubject.queryinterface(components.interfaces.nsihttpchannel); cookies are actually...
... avalue, amerge) - sets the response header's value. if amerge is true, the new value is appened, otherwise the old value is overwritten. these methods provide all the required functionality needed to modify cookies before they are processed/sent, allowing for sandboxed cookie connections that don't affect the user's cookies. http referrer if the http request needs to have a referrer set, two
additional steps are needed after the nsichannel is created, but before it is opened. first, a nsiuri needs to be generated for the referrer url. like before, the nsiioservice is used: var referreruri = ioservice.newuri(referrerurl, null, null); next, the nsichannel is qied to nsihttpchannel and the referrer property is set to the generated nsiuri: var httpchannel = channel.queryinterface(compone...
...for the referrer url. like before, the nsiioservice is used: var referreruri = ioservice.newuri(referrerurl, null, null); next, the nsichannel is qied to nsihttpchannel and the referrer property is set to the generated nsiuri: var httpchannel = channel.queryinterface(components.interfaces.nsihttpchannel); httpchannel.referrer = referreruri; creating http posts to create an http post, a few
additional steps are required after the nsichannel is created. first, a nsiinputstream instance is created, after which the setdata method is called. the first argument is the post data as a string, while the second argument is the length of that data. in this case, the data is url encoded, meaning that the string should look like this: foo=bar&baz=eek. var inputstream = components.classes["@mozill...
Building Firefox with Debug Symbols
ll not generate debug symbols suitable for debugging or post-processing into the breakpad symbol format. use the following mozconfig settings to do a build with symbols: building firefox with symbols there is a single configure option to enable building with symbols on all platforms. this is enabled by default so unless you have explcitly disabled it your build you should include symbols. ac_
add_options --enable-debug-symbols this can optionally take an argument for the type of symbols that need to be produced (like "-g3"). by default it uses "-g" on linux and macos. this value takes precedence over the flags set in moz_debug_flags note that this will override the values provided for cflags and cxxflags. breakpad symbol files after the build is complete, run the following command to...
...bols that need to be produced (like "-g3"). by default it uses "-g" on linux and macos. this value takes precedence over the flags set in moz_debug_flags note that this will override the values provided for cflags and cxxflags. ...
...tinderbox uses an
additional uploadsymbols target to upload symbols to a socorro server. see https://dxr.mozilla.org/mozilla/source/toolkit/crashreporter/tools/upload_symbols.sh for more information about the environment variables used by this target. make package if you use make package to package your build, symbols will be stripped. ...
...adsymbols target to upload symbols to a socorro server. ...
Simple SeaMonkey build
ac os x build prerequisites. windows: install visual c++ 2013. both the professional edition and the express edition will work. you may need to install one or more windows sdks. see windows sdk versions for a quick guide. if you decided on the windows 8 sdk, you also need the outlook 2010 mapi header files from microsoft. install mozillabuild, a package of
additional build tools. (if you get a message saying this application did not install properly then you should see a windows dialog giving you the option to re-install with the 'correct settings'. after that all should be well.) open a shell window by running: c:\mozilla-build\start-msvc2013.bat. even if you're on 64-bit windows, do not use the files ending in -x64.bat. by default you will ar...
... # build! # note: this re...
...beta, use https://hg.mozilla.org/releases/comm-beta/ and comm-beta instead # for release, use https://hg.mozilla.org/releases/comm-release/ and comm-release instead hg clone https://hg.mozilla.org/comm-central/ cd comm-central python client.py checkout # set up a basic .mozconfig file echo 'ac_
add_options --enable-application=suite' > .mozconfig # let's build seamonkey... echo 'mk_
add_options moz_objdir=/path/to/comm-central/obj-sm-release' >> .mozconfig # specify amount of parallel building. if the below is left out, a best guess will be taken automatically. echo 'mk_
add_options moz_make_flags="-j4"' >> .mozconfig # ...quickly. # build! # note: this requires autoconf 2.13 (at least initially). # on windows, be sure to use mozmake instead of make, otherwi...
... >> .mozconfig # ...quickly. # build! # note: this requires autoconf 2.13 (at least initially). # on windows, be sure to use mozmake instead of make, otherwise parallel building will break. make -f client.mk for a debug build, you need different configuration options in your .mozconfig file. this requires more disk space, about 3 gb, and twice as much available ram. mk_
add_options moz_objdir=/path/to/comm-central/obj-sm-debug ac_
add_options --enable-application=suite ac_
add_options --enable-debug ac_
add_options --disable-optimize normally a shared build suffices for debugging purposes but current nightly releases are actually static builds which require even more memory to link. the support for libxul builds is still experimental but it should work if you --dis...
Updating NSPR or NSS in mozilla-central
apply the patches. if merging is required, update the patch f...
...apply the patches. if merging is required, update the patch file. if a patch is n...
...nss/coreconf/coreconf.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_n...
... in your commit message, include the required keywords, upgrade_nspr_release and/or upgrade_nss_release. push the update: $ hg push ...
Obsolete Build Caveats and Tips
these tips, while helpful, are jarring and superfluous to the majority of new mozilla builders who are mainly interested in building the latest version of firefox. therefore, instead of deleting all these nuggets of information, it's best to collect them all here and remove them from the majority happy path documentation. ...
...windows vista sdk from the microsoft download center. you may choose not to install the sample code and documentation to save space and download time. if you are using windows xp, you must have windows xp service pack 2 and .net framework 2.0 installed before installing the vista sdk. use visual studio 2008 professional. gecko 1.9.2 through 11: if you would like to use this sdk,
add ac_
add_options --with-windows-version=600 to your .mozconfig. windows server 2003 r2 platform sdk obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)this 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 is your only option if you're on windows 2000. this also use...
...ns (see atlbase.h for more). you can download the sdk from the microsoft download center. you need to install at least the "windows core sdk", "web workshop (ie) sdk", and the "data access services (mdac) sdk". for all sdks, you may choose not to install sample code and documentation to save space and download time. gecko 1.9.2 through 11: if you're building with this sdk, you will need to
add ac_
add_options --with-windows-version=502 to your .mozconfig. for mozilla-1.9.1 and mozilla-1.9.0, you need to
add ac_
add_options --disable-vista-sdk-requirements to your .mozconfig instead. unsupported sdks the windows sdk for windows server 2008 is not supported, and has been found to cause the following problems: breaks the vcvars32.bat file from visual studio 2008 no longer sets the co...
...you want to build (see below), and you will probably also need to set at least some of the other basic configuration options (such as whether to build a debug build or not) to get the type of build that you need. if you are building from an older project branch that still uses cvs, you will need to set moz_co_project to the appropriate value or values, using a comma-separated list, such as "mk_
add_options moz_co_project=browser,mail,calendar,suite,xulrunner". this setting is ignored by most mozilla project branches, which now use mercurial instead of cvs for source control. note: starting in gecko 2.0, objdir builds are enabled by default. if you do not specify a moz_objdir it will be automatically set to @topsrcdir@/obj-@config_guess@ alternatively, you can run client.mk directly f...
SVG Guidelines
dering. in general the best way to combat this is to first run svg files through a linter such as svgo (see the tools section below). however, when authoring svgs by hand here are some best practices to help keep them lightweight. these rules are based on some real examples seen in mozilla's code. ...
... such as svgo (see the tools section below). however, when authoring svgs by hand here are some best practices to help keep them lightweight. these rules are based on some real examples seen in mozilla's code. ...
... if they help make the file readable. you should avoid line breaks between every single element or within attribute values. it's recommended to put the attributes on the same line as their tag names, if possible. you should also put the shortest attributes first, so they are easier to spot. ...
...typical examples of this are <title> and <desc> tags. although this kind of data is supported by the browser, it can only be displayed when the svg is opened in a new tab. ...
Error codes returned by Mozilla APIs
s the following table lists the errors that could occur when using files. while these errors can occur when using the file apis, they can also occur with other components that use files. ns_error_file_unrecognized_path (0x80520001) this error occurs when an attempt is made to set a path that isn't valid for the platform. for example, if a character in the path is not valid for a filename. in
addition, this error may occur when a relative path is supplied to a method that expects an absolute path and vice versa. ns_error_file_unresolvable_symlink (0x80520002) an attempt was made to access a symbolic link to a file or directory which does not exist. ns_error_file_execution_failed (0x80520003) an attempt to launch or execute a file failed because the file is not executable. nsifile.isex...
... ns_error_dom_file_not_found_err (0x80650000) file was not found. ns_error_dom_file_not_readable_err (0x80650001) file could not be read. network errors the following errors can occur when creating connections over the network, or when reading or writing data. ns_binding_failed ...
...ed). this error code is used with load groups to notify the load group observer when a request in the load group is redirected to another request. ns_binding_retargeted (0x804b0004) the asynchronous request has been "retargeted" to a different "handler." this error code is used with load groups to notify the load group observer when a request in the load group is removed from the load group and
added to a different load group. ns_error_malformed_uri (0x804b000a) the uri is malformed. ns_error_already_connected (0x804b000b) the connection is already established. xxx currently unused - consider removing. ns_error_not_connected (0x804b000c) the connection does not exist. xxx currently unused - consider removing. ns_error_connection_refused (0x804b000d) ns_error_net_timeout (0x804b00...
..._manager_veto (0x80570027) ns_error_xpc_interface_not_scriptable (0x80570028) ns_error_xpc_interface_not_from_nsisupports (0x80570029) ns_error_xpc_cant_get_jsobject_of_dom_object (0x8057002a) ns_error_xpc_cant_set_read_only_constant (0x8057002b) ns_error_xpc_cant_set_read_only_attribute (0x8057002c) ns_error_xpc_cant_set_read_only_method (0x8057002d) ns_error_xpc_cant_
add_prop_to_wrapped_native (0x8057002e) ns_error_xpc_call_to_scriptable_failed (0x8057002f) ns_error_xpc_jsobject_has_no_function_named (0x80570030) ns_error_xpc_bad_id_string (0x80570031) ns_error_xpc_bad_initializer_name (0x80570032) ns_error_xpc_has_been_shutdown (0x80570033) ns_error_xpc_cant_modify_prop_on_wn (0x80570034) ns_error_xpc_bad_convert_js_zero_isnot_null (0...
Message manager overview
there are three different subtypes of frame message manager: the global message manager, the window message manager, and the browser message manager. all three enable chrome code to: load a script into a frame in the content the content process using a loadframescript() function. these scripts are called "frame ...
...lar but different kind of script. there are three different subtypes of frame message manager: the global message manager, the window message manager, and the browser message manager. all three enable chrome code to: load a script into a frame in the content the content process using a loadframescript() function. these scripts are called "frame scripts". communicate with frame scripts using
addmessagelistener() and broadcastasyncmessage() or sendasyncmessage() functions. note that in this context, "browser" refers to the xul <browser> object, which is a frame that hosts a single web document. it does not refer to the more general sense of a web browser. global message manager the global message manager operates on every <browser> (that is, every open content tab). loadframes...
...arent process: these messages are received first by the corresponding ppmm, then by the gppmm. from firefox 38 onwards, you can also use a parent process message manager to load a script into a child process. this is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example,
adding listeners to observer notifications or registering components). accessing process message managers you can access the global parent process manager with code like this: // parent process let parentprocessmessagemanager = cc["@mozilla.org/parentprocessmessagemanager;1"] .getservice(ci.nsimessagebroadcaster); you can also access it as the ppmm property of se...
... ...
ChromeWorker
the standard worker object. it works exactly like a standard worker, except that it has access to js-ctypes via a global ctypes object available in the global scope of the worker. examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below. to use a postmessage with callback version of chromeworker that features promises, see promiseworker.
addons must use absolute urls to load their workers, and those urls have to be using a chrome:// or resource:// protocol (file:// is not accepted).
addons that wish to use file:// urls must first register a resource replacement path, using code like this: var fileuri = services.io.newfileuri(file); services.io.getprotocolhandler('resource'). queryinterface(ci.nsiresprotocolhandler). ...
...see using workers in javascript code modules for details. you can use chromeworker modules in chromeworkers. ...
...see using workers in javascript code modules for details. you can use chromeworker modules in chromeworkers. see using web workers for examples and details. ...
... can use chromeworker from javascript code modules. see using workers in javascript code modules for details. you can use chromeworker modules in chromeworkers. see using web workers for examples and details. see also using web workers using workers in javascript code modules worker sharedworker web workers specification workerglobalscope github :: chromeworker - a fully working demo
addon using js-ctypes from a chrome worker. uses winapi example. promiseworker github :: promiseworker - shows how to uses promises as an twist on postmessage feature of chromeworker ...
Dict.jsm
e description count number the number of items in the dictionary. items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first element being the key and the second being the value. note: the order in which items are returned is arbitrary, and may change without notice. in
addition, if the dictionary changes during iteration, no guarantees are made as to what will happen. keys iterator returns an iterator over all the keys in the dictionary. note: the order in which items are returned is arbitrary, and may change without notice. in
addition, if the dictionary changes during iteration, no guarantees are made as to what will happen. ...
... constructor dict() creates and returns a new dictionary object. ...
...r in which items are returned is arbitrary. array listkeys(); parameters none. return value an array of the keys in the dictionary. listvalues() returns an array of the values in the dictionary. note: the order in which items are returned is arbitrary. array listvalues(); parameters none. return value an array of the values in the dictionary. set() sets the value for a given key,
adding a new key to the dictionary if necessary. void set( string akey, object avalue ); parameters akey the key whose value is to be set. avalue the value to assign to the given key. tojson() returns a json string representation of the dictionary. string tojson(); parameters none. return value a json string representation of the dictionary's key/value pairs. this will be "{}" f...
...ation of the dictionary's key/value pairs. this will be "{}" for an empty dictionary. tostring() returns a string representation of the dictionary. string tostring(); parameters none. return value a string representation of the dictionary's key/value pairs. this will be "{}" for an empty dictionary. examples creating and populating a dictionary this example creates a new dictionary and
adds some key/value pairs to it. var mydict = new dict(); mydict.set("name", "john smith"); mydict.set("email", "jsmith@example.com"); mydict.set("phone", "650-555-1234"); working with existing keys you can then check to see if a given key exists: if (mydict.has("email")) { /* an "email" key exists on the object */ } ...
DownloadSummary
provides an aggregated view on the contents of a downloadlist. a reference to a downloadsummary object can be obtained using the downloads.getsummary() function. method overview promise bindtolist(downloadlist alist); promise
addview(object aview); promise removeview(object aview); properties attribute type description allhavestopped read only boolean indicates whether all the downloads are currently stopped. progresstotalbytes read only number indicates the total number of bytes to be transferred before completing all the downloads that are currently in progress. for downloads that do not have a known final size, the number of b...
...summary to be used without requiring the initialization of the downloadlist first. note: this method is already called internally by the downloads.getsummary() function. promise bindtolist( downloadlist alist ); parameters alist underlying downloadlist whose contents should be summarized. promise resolves to undefined when the view on the underlying list has been registered.
addview()
adds a view that will be notified of changes to the summary. the newly
added view will receive an initial onsummarychanged 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 undef...
...promise removeview( object aview ); parameters aview the view object to remove. promise resolves to undefined when the view has been removed. ...
...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. ...
Index
l12y this document provides best practices for developers to create localizable code, and describes how to avoid some localizability (l12y) common mistakes. 10 localization notes guide, internationalization, localization, mozilla localizers usually work on the localizable files without the context of the source files including the localized strings; it is important to
add comments to the localizable files themselves, too. these comments are generally referred to as localization notes. there is an established format for those, which is described in this document. 11 localization prerequisites internationalization, localization, delete to work on localization, you need a subset of the mozilla build prerequisites. on mac and linux, you should be ...
...n. most translation tools support the xliff standard, making localizing the xliff files for firefox for ios easy to do using translation tools. editing the raw xliff file is also rather easy, especially if you're already familiar with xml. this tutorial will walk you through the steps you need to take to translation strings within an xliff file. 21 localizing extension descriptions
add-ons, extensions, guide, internationalization, localization this article 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...
...ns, 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, we use the the mercurial version control system (hg) to manage our source code and localizations. mercurial allows localizers to work locally (on their machines) and then push (an hg term) changes to a remote repository, which...
...tent localized in your language localization, mdn, mozilla, reference, style guide no summary! 30 mozilla content localized in your language localization this section of the style guide is for you to author. the content here should be what you and your localization team have decided, together, to follow when 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! 31 patching a localization localization say you have found a problem with an ...
gettext
ative, but for a dialog title, the localizer may choose to use a different form, like gerund (much like "logging in"). gettext's context feature allows the developer to distinguish between two identical english strings and disambiguate the translation. in the po file, msgctxt looks like this: msgctxt "button label" msgid "log in" msgstr "" msgctxt "dialog title" msgid "log in" msgstr "" you can
add context to your strings by passing an
additional argument to the gettext function call and then having xgettext extract it as the context. in php, however, the default gettext functions don't support passing such
additional argument. to fix this, you may choose to write your own helper gettext functions. the following example illustrates this. <?php // implement gettext context if (!function_exi...
...se xgettext. you can specify the function calls to look for with the --keyword option. for example, --keyword=n___:1,2,4c tells xgettext to look for n___() calls, and extract the first argument as the singular string, the second argument as the plural string and the fourth argument as the context (the third argument is reserved for the number in this example). ...
... --
add-comments=l10n \ --keyword=___:1 \ --keyword=___:1,2c \ --keyword=n___:1,2 \ --keyword=n___:1,2,4c \ file.php 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. ...
...riptive 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. #: file.php:12 msgid "a simple string." msgstr "" #. l10n: this is an in...
Fonts for Mozilla's MathML engine
ve-fontsextra # mageia however, you might need to ensure that the fonts are known by your system. typically, use a fontconfig configuration /etc/fonts/conf.avail/09-texlive-fonts.conf that points to the opentype directory of texlive, such as: <?xml version="1.0"?> <!doctype fontconfig system "fonts.dtd"> <fontconfig> <dir>/your/path/to/texmf-dist/fonts/opentype</dir> </fontconfig> finally,
add this configuration file to the system font location list and regenerate the fontconfig cache: ln -sf /etc/fonts/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/ fc-cache -sf android you must use the mathml-fonts
add-on. note: there is an enhancement request opened on the noto bug tracker to improve math support. firefox os you must use the mathml-fonts
add-on. note: we plan to bundl...
... advanced setup arabic mathematical alphabetic symbols currently, very few fonts have appropriate glyphs for the arabic mathematical alphabetic symbols. if you are likely to need these characters, we recommend to install the xits or amiri fonts. ...
...mathematical alphabetic symbols currently, very few fonts have appropriate glyphs for the arabic mathematical alphabetic symbols. if you are likely to need these characters, we recommend to install the xits or amiri fonts. installation without administrator privilege if you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the mathml-fonts
add-on. note that using the
add-on is not optimal since it forces your gecko browser to load a css stylesheet on each page you visit as well as web math fonts on all pages with mathml content. a better alternative on unix systems is to install the otf files for latin modern math and stix into some local font folder and (if necessary) to run fc-cache on it. on os x and linux, the standard paths are ~/...
...e on it. on os x and linux, the standard paths are ~/library/fonts/ and ~/.fonts. fonts with a math table you can actually render mathml using any font with a math table and related open font format features. a list of such math fonts is provided below. you can use the advanced font preference menu to configure the default font for mathematics. alternatively, you can try the mathml-fontsettings
add-on. asana math cambria math dejavu math tex gyre garamond math (under development) latin modern math libertinus math lucida bright math minion math stix math tex gyre bonum math tex gyre pagella math tex gyre schola math tex gyre termes math xits math fira math (sans-serif typeface, under development) gfs neohellenic math (sans-serif typeface) using mathematical fonts on web p...
Mozilla Web Developer FAQ
wo and a half layout modes: quirks, almost standards and standards. in the standards mode gecko aims to treat documents authored in compliance with the applicable web format specifications. in the quirks mode—for the purpose of backwards compatibility—gecko mimics some behaviors of legacy browsers in ways that are spec violations. the almost standards mode is like the standards mode except it
addresses the issue of the next question by rendering table cells with images in the traditional way. the mode is picked based on the doctype declaration (or the lack thereof) at the beginning of an html document. the easiest way to make sure that the standards mode is activated for html, is to use this doctype declaration: <!doctype html> the easiest way to make sure that the almost standards ...
...plemented 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 accepts both application/xhtml+xml and text/html. should i serve application/xhtml+xml to gecko? application/xhtml+xml was
added to the accept header in order to enable the serving of mathml to both mozilla and ie with apache without scripting back when the mathplayer plug-in for ie did not handle application/xhtml+xml. if your document mixes mathml or svg with xhtml, you should use application/xhtml+xml (until html5 parsing is supported). however, if you are using the usual html features (no mathml or svg) and are ser...
...tml+xml (until html5 parsing is supported). however, if you are using the usual html features (no mathml or svg) and are serving your content as text/html to other browsers, there is no need to serve application/xhtml+xml to mozilla. serving valid html as text/html ensures the widest browser and search engine support. there is a fad of serving text/html to ie but serving the same markup with no
added value as application/xhtml+xml to gecko. this is usually done without a mechanism that would ensure the well-formedness of the served documents. mechanisms that ensure well-formed output include serializing from a document tree object model (eg. dom) and xslt transformations that do not disable output escaping. when xhtml output has been retrofitted to a content management system that was not d...
...irst, of course). ...
Reporting a Performance Problem
ce completed will write out a link. before uploading, the publish button asks you what data you'd like to publish to our servers. note that while it's possible to strip profiles of potentially privacy sensitive information, the less information a profile contains, the harder it is to analyze and turn into actionable data. ...
...and turn into actionable data. once uploaded, copy permalink url to your clipboard by right clicking and
add the profile url to a bug for your performance problem and/or send it to the appropriate person. try to give some context about what you were doing when the performance problem arose such as the url you were viewing and what actions were you doing (ex. scrolling on gmail.com). viewing
addon performance in geckoview sometimes an
addon or more are slowing down firefox. these
addons might be using the extension api in ways that were not meant to. you can see which of these
addons are causing problems by
adding the "moz-extension" filter. make sure you are selecting the process that is using up the cpu since all of the processes are shown. you might have a content process using up...
...gecko profiler allows you to share a link with the profile. ...
... are selecting the process that is using up the cpu since all of the processes are shown. you might have a content process using up the cpu and not the main one. make sure you are doing whatever it is that slows down firefox while recording the profile. for example you might have one
addon that slows down page load and another one that slows down tab switch. your first reflex once you find what
addon is slowing down the profile might be to disable it and search for alternatives. before you do this, please share the performance profile with the
addon authors through a bug report. gecko profiler allows you to share a link with the profile. ...
Performance
the articles linked to from here will help you improve performance, whether you're developing core mozilla code or an
add-on. documentation reporting a performance problem a user friendly guide to reporting a performance problem. a development environment is not required. benchmarking tips on generating valid performance metrics. performance best practices in extensions a performance "best practices" guide for extension developers. measuring
add-on startup performance a guide for
add-on developers on how to set up a performance testing environment. xul school:
add-on performance tips for
add-on developers to help them avoid impairing application performance. gpu performance tips for profiling and improvin...
... including leaks. valgrind is used as part of mozilla's continuous integration testing, though the coverage is limited because valgrind is slow. leaksanitizer leaksanitizer (a.k.a. lsan) is similar to valgrind, but it runs faster because it uses static source code instrumentation. lsan is part of mozilla's continuous integration testing, with most tests running through it as part of the
addresssanitizer (a.k.a. asan) test jobs. apple tools apple provides some tools for mac os x that report similar problems to those reported by lsan and valgrind. the "leaks" tool is not recommended for use with spidermonkey or firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see bug 390944). leak gauge leak gauge is a tool tha...
...ofile mozilla code. profiling with concurrency visualizer how to use visual studio's concurrency visualizer tool to profile mozilla code. profiling with zoom zoom is a profiler for linux done by the people who made shark measuring performance using the perfmeasurement.jsm code module using perfmeasurement.jsm to measure performance data in your javascript code.
adding a new telemetry probe information on how to
add a new measurement to the telemetry performance-reporting system profiling javascript with shark (obsolete - replaced by instruments) how to use the mac os x shark profiler to profile javascript code in firefox 3.5 or later. profiling with shark (obsolete - replaced by instruments) how to use apple's shark tool to profile ...
... turbostat is a command-line utility that gathers and displays various power-related measurements, with a focus on per-cpu measurements such as frequencies and c-states. powertop (linux-only) powertop is an interactive command-line utility that gathers and displays various power-related measurements. related topics javascript, xpcom, developing mozilla, extensions,
addons ...
Profile Manager
pecific installation of firefox, so that version of firefox will be launched when that profile is selected. for example, profilea might be linked with a copy of firefox 3.6.10, while profileb might be linked with a copy of firefox 3.5.3. when launched, profile manager will look in some default locations for installed versions of firefox (or other application you're using profile manager with).
additionally, you can manually
add firefox versions by clicking the "manage firefox versions..." button: each firefox version in the list has the following properties: path, version, and default. the default property indicates that this version of firefox will be used with profiles that don't have a specific application version associated with them. creating a profile to create a new profile...
...h this profile: launching firefox with a profile to launch firefox with a specific profile, select the profile in the main window, and hit the "start firefox" button: firefox will be launched with that profile, and profile manager will terminate. the version of firefox which will be launched is indicated in the "firefox version" dropdown in the launch options box: there are several
additional launch options available for firefox. these cause firefox to be launched with various command-line arguments. see command line options for a description of these. launch option command line argument run firefox in offline mode -offline run firefox in safe mode -safe-mode start firefox with a console -console start new instance...
...ode -safe-mode start firefox with a console -console start new instance -no-remote note: it isn't possible to start a second instance of firefox without passing it the -no-remote command line argument. for this reason, if you attempt to launch firefox using profile manager, and it detects that another instance of firefox is already running, it will automatically
add the -no-remote argument for you, regardless of whether this launch option was checked. locked profiles some profiles may be shown as locked in the main window. such profiles are currently being used by an instance of firefox. if you attempt to perform any operation on a locked profile, you'll get a warning; if you choose to continue despite the warning, you may encounter errors or corrupt ...
... properties - shows a dialog that displays the profile's path and last-modified date. rename - allows you to specify a new name for the profile. version - allows you change the default application version to be used with the profile. future enhancements ability to install/uninstall/enable/disable extensions in profiles. ability to copy certain assets (e.g., bookmarks) between profiles.
add 'profile size' to the properties dialog. ability to reset a profile (return it to a default state excluding bookmarks and passwords).
add option to specify the location of profiles.ini. ...
Midas
es editable, authors often load the editable document into an iframe and do the bulk of the scripting in the parent document. according to standards, the iframe element has the contentdocument property that refers to the document in the inline frame. it also has a property called contentwindow that refers to the window object inside the inline frame. this also avoids problems with bug 198155. in
addition to the built-in commands, advanced editing can be done by manipulating the selection and range objects. it is beneficial to be familiar with these objects when working with an editable document. examples this example shows the basic structure described in the notes section : <html> <head> <title>simple edit box</title> </head> <body> <iframe id="midasform" src="about:blank" ...
...on from the edit control. if there isn't a selection, nothing will happen. note: this command won't work without setting a pref or using signed js. see: more about security preferences note: the shortcut key will automatically trigger this command (typically accel-x) with or without the signed js or any code on the page to handle it. decreasefontsize this command will
add a <small> tag around selection or at insertion point. delete this command will delete all text and objects that are selected. if no text is selected it deletes one character to the right. this is similar to the delete button on the keyboard. fontname a font name this command will set the font face for a selection or at the insertion point if there is no selection. ...
... fontsize a number this command will set the fontsize for a selection or at the insertion point if there is no selection. the given number is such as would be used in the "size" attribute of the font tag. forecolor a color code this command will set the text color of the selection or at the insertion point. formatblock h1, h2, h3, h4, h5, h6, p, div,
address, blockquote (more?) the selection surrounded by the given block element. heading h1, h2, h3, h4, h5, h6 selected block will be formatted as the given type of heading. hilitecolor a color code this command will set the hilite color of the selection or at the insertion point. it only works with stylewithcss enabled. increasefontsize this command ...
... blockquote (more?) the selection surrounded by the given block element. heading h1, h2, h3, h4, h5, h6 selected block will be formatted as the given type of heading. hilitecolor a color code this command will set the hilite color of the selection or at the insertion point. it only works with stylewithcss enabled. increasefontsize this command will
add a <big> tag around selection or at insertion point. indent indent the block where the caret is located. if the caret is inside a list, that item becomes a sub-item one level deeper. insertbronreturn true/false selects whether pressing return inside a paragraph creates another paragraph or just inserts a <br> tag. inserthorizontalrule null/string (when st...
NSPR Contributor Guide
on to be licensed under the mpl or gpl. bugfixes use bugzilla to track bugs. document the bug or use an existing report. be verbose in describing what you are doing and why. include your changes as diffs in an attachment to the bugzilla report. use a coding style consistent with the source file you are changing. new features for purposes of this paper, a "new feature" is defined as some api
addition that goes into the core nspr library, for example: libnspr4.dll nspr is mostly complete. new apis are driven mostly by the os vendors as they
add new features. should you decide that there's something that nspr does not cover that should be covered, let's talk. your proposed api should encapsulate a relatively low level capability as would be found in a system call or libc. your new feature ...
...y that it really is not a good candidate for inclusion in nspr; we may give you suggestions on what would make it more generalized, hence a good candidate for inclusion in nspr. use bugzilla to track your work. be verbose. nspr wants you to document your work. if we accept it, we are going to have to answer questions about it and/or maintain it. these are some guidelines for new apis that you may
add to nspr. header file descriptions. provide header file descriptions that fully document your public typedefs, enums, macros and functions. see: prshm.h as an example of how your header file(s) should be documented. source file descriptions. provide descriptive documentation in your source (*.c) files. alas, we have no source files documented as we think they should be. the following are some gene...
... your header file(s) should be documented. source file descriptions. provide descriptive documentation in your source (*.c) files. alas, we have no source files documented as we think they should be. the following are some general guidelines to use when implementing new features: don't export global variables your code must be thread safe you must provide test cases that test all apis you are
adding. see: [#testcases test cases] new libraries all the guidelines applicable to [#newfeatures new features] applies to new libraries. for purposes of this paper, a "new library" is defined as a libary under the mozilla/nsprpub/lib directory tree and built as a separate library. these libraries exist, for the most part, as "legacy" code from nspr 1.0. [note that the current nspr module owners d...
... appropriate word processor and the derived html shows up on mozilla.org test cases you should provide test cases for all new features and new libraries. give consideration to providing a test case when fixing a bug if an existing test case did not catch a bug it should have caught. the new test cases should be implemented in the style of other nspr test cases. test cases should prove that the
added api items work as advertized. test cases should serve as an example of how to use the api items. test cases should provoke failure of every api item and report its failure. frequently asked questions (faq) q: why was my contribution rejected? a: check the bugzilla report covering your contribution. original document information author: reed@reedloden.com last updated date: november 2, ...
Anonymous Shared Memory
rom the prfilemap object. ... see the examples below. both sides should adhere strictly to the protocol for proper operation. the pseudo-code below shows the use of a file-mapped shared memory by a parent and child processes. in the examples, the server creates the file-mapped shared memory, the client attaches to it. ...
...file-mapped shared memory by a parent and child processes. in the examples, the server creates the file-mapped shared memory, the client attaches to it. first protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot);
addr = pr_memmap(fm); attr = pr_newprocessattr(); pr_processattrsetinheritablefilemap( attr, fm, shmname ); pr_createprocess(client); pr_destroyprocessattr(attr); ... y
adda ... pr_memunmap(
addr ); pr_closefilemap(fm); client: ... started by server via pr_createprocess() fm = pr_getinheritedfilemap( shmname );
addr = pr_memmap(fm); ... y
adda ... pr_memunmap(
addr); pr_closefilemap(fm); second protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot); fmstring = pr_exportfilemapasstring( fm );
addr = pr_memmap(fm); ... application specific technique...
...osefilemap(fm); client: ... started by server via pr_createprocess() fm = pr_getinheritedfilemap( shmname );
addr = pr_memmap(fm); ... y
adda ... pr_memunmap(
addr); pr_closefilemap(fm); second protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot); fmstring = pr_exportfilemapasstring( fm );
addr = pr_memmap(fm); ... application specific technique to pass fmstring to child ... y
adda ... server uses his own magic to create child pr_memunmap(
addr ); pr_closefilemap(fm); client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = pr_importfilemapfromstring( fmstring )
addr = pr_memmap(fm); ... y
adda ... ...
...ring( fm );
addr = pr_memmap(fm); ... application specific technique to pass fmstring to child ... y
adda ... server uses his own magic to create child pr_memunmap(
addr ); pr_closefilemap(fm); client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = pr_importfilemapfromstring( fmstring )
addr = pr_memmap(fm); ... y
adda ... ...
I/O Functions
le i/o, and socket (network) i/o. for sample code that illustrates basic i/o operations, see introduction to nspr. for information about the types most commonly used with the functions described in this chapter, see i/o types. functions that operate on pathnames functions that act on file descriptors directory i/o functions socket manipulation functions converting between host and network
addresses memory-mapped i/o functions anonymous pipe function polling functions pollable events manipulating layers functions that operate on pathnames a file or directory in a file system is specified by its pathname. nspr uses unix-style pathnames, which are null-terminated character strings. only the ascii character set is supported. the forward slash (/) separates the directories in a pat...
...s or volumes. pr_open pr_delete pr_getfileinfo pr_getfileinfo64 pr_rename pr_access type praccesshow functions that act on file descriptors pr_close pr_read pr_write pr_writev pr_getopenfileinfo pr_getopenfileinfo64 pr_seek pr_seek64 pr_available pr_available64 pr_sync pr_getdesctype pr_getspecialfd pr_createpipe directory i/o functions pr_opendir pr_re
addir pr_closedir pr_mkdir pr_rmdir socket manipulation functions the network programming interface presented here is a socket api modeled after the popular berkeley sockets. differences include the following: the blocking socket functions in nspr take a timeout parameter. two new functions, pr_transmitfile and pr_acceptread, can exploit the new system calls of some operating systems for hi...
...or higher performance. list of functions: pr_openudpsocket pr_newudpsocket pr_opentcpsocket pr_newtcpsocket pr_importtcpsocket pr_connect pr_connectcontinue pr_accept pr_bind pr_listen pr_shutdown pr_recv pr_send pr_recvfrom pr_sendto pr_transmitfile pr_acceptread pr_getsockname pr_getpeername pr_getsocketoption pr_setsocketoption converting between host and network
addresses pr_ntohs pr_ntohl pr_htons pr_htonl pr_familyinet memory-mapped i/o functions the memory-mapped i/o functions allow sections of a file to be mapped to memory regions, allowing read-write accesses to the file to be accomplished by normal memory accesses. memory-mapped i/o functions are currently implemented for unix, linux, mac os x, and win32 only. pr_createfilemap pr_memmap ...
...le event is a special kind of file descriptor. the only i/o operation you can perform on a pollable event is to poll it with the pr_poll_read flag. you cannot read from or write to a pollable event. the purpose of a pollable event is to combine event waiting with i/o waiting in a single pr_poll call. pollable events are implemented using a pipe or a pair of tcp sockets connected via the loopback
address, therefore setting and/or waiting for pollable events are expensive operating system calls. do not use pollable events for general thread synchronization; use condition variables instead. a pollable event has two states: set and unset. events are not queued, so there is no notion of an event count. a pollable event is either set or unset. pr_newpollableevent pr_destroypollableevent pr_s...
I/O Types
this chapter describes the most common nspr types, enumerations, and structures used with the functions described in i/o functions and network
addresses. these include the types used for system access, normal file i/o, and socket (network) i/o. types unique to a particular function are described with the function itself. for sample code that illustrates basic i/o operations, see introduction to nspr. directory type file descriptor types file info types network
address types types used with socket options functions type used with memory-mapped i/o offset interpretation for seek functions directory type prdir file descriptor types nspr represents i/o objects, such as open files and sockets, by file descriptors of type prfiledesc. this section introduces prfiledesc and relate...
... prfiledesc structure, and the prfiledesc structures for the layers are chained together. each prfiledesc structure has a field (of type prdescidentity) to identify itself in the layers. ...
... and the prfiledesc structures for the layers are chained together. each prfiledesc structure has a field (of type prdescidentity) to identify itself in the layers. ...
...iledesc structures for the layers are chained together. each prfiledesc structure has a field (of type prdescidentity) to identify itself in the layers. ...
PR_EnumerateHostEnt
evaluates each of the possible
addresses of a prhostent structure, acquired from pr_gethostbyname or pr_gethostby
addr. syntax #include <prnetdb.h> printn pr_enumeratehostent( printn enumindex, const prhostent *hostent, pruint16 port, prnet
addr *
address); parameters the function has the following parameters: enumindex the index of the enumeration. to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive
addresses from the host entry structure), the value should be set to the function's last returned value. the enumeration is complete when a value of zero is returned. hostent a pointer to a prhostent structure obtained from pr_gethostbyname or pr_gethostby
addr. ...
...on output, this structure is filled in by the runtime if the result of the call is greater than 0. ...
...on output, this structure is filled in by the runtime if the result of the call is greater than 0. returns the function returns one of the following values: if successful, the function returns the value you should specify in the enumindex parameter for the next call of the enumerator. ...
...on output, this structure is filled in by the runtime if the result of the call is greater than 0. ...
PR_QueueJob_Connect
fn the function to be executed when the job is executed. ...
... fn the function to be executed when the job is executed. ...
... fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. ...
... 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. ...
Mozilla-JSS JCA Provider notes
dsakpg was created. ...
...(); supported classes cipher dsaprivatekey dsapublickey keyfactory keygenerator keypairgenerator mac messagedigest rsaprivatekey rsapublickey secretkeyfactory secretkey securerandom signature cipher supported algorithms notes aes des desede (des3) rc2 rc4 rsa the following modes and p
adding schemes are supported: algorithm mode p
adding des ecb nop
adding cbc nop
adding pkcs5 p
adding desede des3 ecb nop
adding cbc nop
adding pkcs5 p
adding aes ecb nop
adding cbc nop
adding pkcs...
... des ecb nop
adding cbc nop
adding pkcs5 p
adding desede des3 ecb nop
adding cbc nop
adding pkcs5 p
adding aes ecb nop
adding cbc nop
adding pkcs5 p
adding rc4 none none rc2 cbc nop
adding pkcs5p
adding the securerandom argument passed to initsign() and initverify() is ignored, because nss does not support specifying an external source of randomness. dsaprivatekey getx() is not supported because nss does not support extracting...
...kcs #11. if that fails, it calls getencoded() on the source key, and then tries to create a new key on the target token from the encoded bits. both of these operations will fail if the source key is not extractable. the class java.security.spec.pbekeyspec in jdk versions earlier than 1.4 does not contain the salt and iteration fields, which are necessary for pbe key generation. these fields were
added in jdk 1.4. if you are using a jdk (or jre) version earlier than 1.4, you cannot use class java.security.spec.pbekeyspec. instead, you can use org.mozilla.jss.crypto.pbekeygenparams. if you are using jdk (or jre) 1.4 or later, you can use java.security.spec.pbekeyspec or org.mozilla.jss.crypto.pbekeygenparams. secretkey supported algorithms notes aes des desede (des3) hmacsha1 rc2 rc4 ...
NSS 3.12.5 release_notes
raryfromorigin modified functions sgn_update (see cryptohi.h) the parameter "input" of this function is changed from unsigned char * to const unsigned char *. pk11_configurepkcs11 (see nss.h) the name of some parameters have been slightly changed ("des" became "desc"). deprecated headers the header file key.h is deprecated. please use keyhi.h instead.
additional documentation in pk11pub.h: the caller of pk11_derencodepublickey should free the returned secitem with a secitem_freeitem(..., pr_true) call. pk11_readrawattribute allocates the buffer for returning the attribute value. the caller of pk11_readrawattribute should free the data buffer pointed to by item using a secitem_freeitem(item, pr_false) or port_free(item->data) call. ...
...item_freeitem(dest, pr_false) or port_free(dest->data) call. environment variables nss_fips will start nss in fips mode. nss_ssl_enable_renegotiation nss_ssl_require_safe_negotiation see ssl3 & tls renegotiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. ...
...ssl3 & tls renegotiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. ...
... 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 relea...
NSS 3.12.6 release notes
note: the code must be built with trace defined to use this functionality. bugs fixed the following bugs have been fixed in nss 3.12.6. ...
...5: the input buffer for sgn_update should be declared const bug 519550: allow the specification of an alternate library for sqlite bug 524167: crash in [[@ find_objects_by_template - nsstoken_findcertificatebyissuerandserialnumber] bug 526910: maxresponselength (initialized to pkix_default_max_response_length) is too small for downloading some crls. ...
...bug 532417: build problem with spaces in path names bug 534943: clean up the makefiles in lib/ckfw/builtins bug 534945: lib/dev does not need to include headers from lib/ckfw bug 535669: move common makefile code in if and else to the outside bug 536023: der_utctimetotime and der_generalizedtimetotime ignore all bytes after an embedded null bug 536474:
add support for logging pre-master secrets bug 537356: implement new safe ssl3 & tls renegotiation bug 537795: nss_initcontext does not work with nss_registershutdown bug 537829: allow nss to build for android bug 540304: implement ssl_handshakenegotiatedextension bug 541228: remove an obsolete nspr version check in lib/util/secport.c bug 541231: ...
...l3 & tls renegotiation bug 537795: nss_initcontext does not work with nss_registershutdown bug 537829: allow nss to build for android bug 540304: implement ssl_handshakenegotiatedextension bug 541228: remove an obsolete nspr version check in lib/util/secport.c bug 541231: nssinit.c doesn't need to include ssl.h and sslproto.h. ...
NSS 3.14.1 release notes
.14.1 requires nspr 4.9.4 or newer. nss 3.14.1 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_1_rtm/src/ new 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_createocspsingleresponserevoked cert_createencodedocspsuccessresponse cert_createencodedocsperrorresponse new types in ocspt.h certocspresponderi...
...eridtype 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 only affected applications that initialize nss via the nss_nodb_init function. nss 3.14.1 includes the complete fix for this issue. ...
...nss now correctly respects the supplied cipherorder. ...
...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 previous 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: the criteria for false start may change again in future nss releases. bugs fix...
NSS 3.21 release notes
introduction the nss team has released network security 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 - prevent md5 downgrade in tls 1.2 signatures. ...
... 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 - prevent md5 downgrade in tls 1.2 signatures. ...
... ckm_tls_mac - computes tls finished mac in secoidt.h nss_use_alg_in_ssl_kx - policy flag indicating that keys are used in tls key exchange in sslerr.h ssl_error_rx_short_dtls_read - error code for failure to include a complete dtls record in a udp packet ssl_error_no_supported_signature_algorithm...
...enliği hizmetleri a.Ş. ...
NSS 3.22 release notes
th pss. pseudorandom functions based on hashes other than sha-1 are now supported with pbkdf (bug 554827). pk11_createpbev2algorithmid() now supports sec_oid_pkcs5_pbkdf2 with cipheralgtag and prfalgtag set to sec_oid_hmac_sha256, sec_oid_hmac_sha224, sec_oid_hmac_sha384, or sec_oid_hmac_sha512. enforce an external policy on nss from a config file (bug 1009429) you can now
add a config= line to pkcs11.txt (assuming you are using sql databases), which will force nss to restrict the application to certain cryptographic algorithms and protocols. a complete list can be found in nss config options. new functions in pk11pub.h pk11_signwithmechanism - this function is an extended version pk11_sign(). pk11_verifywithmechanism - this function is an extended ...
... in pk11pub.h pk11_signwithmechanism - this function is an extended version pk11_sign(). pk11_verifywithmechanism - this function is an extended version of pk11_verify(). these functions take an explicit mechanism and parameters as arguments rather than inferring it from the key type using pk11_mapsignkeytype(). ...
...pkcs_pss is now supported for rsa in
addition to ckm_rsa_pkcs. the ck_rsa_pkcs_pss mechanism takes a parameter of type ck_rsa_pkcs_pss_params. ...
... new macros in nss.h nss_rsa_min_key_size nss_dh_min_key_size nss_dsa_min_key_size nss_tls_version_min_policy nss_tls_version_max_policy nss_dtls_version_min_policy nss_dtls_version_max_policy in pkcs11t.h ckp_pkcs5_pbkd2_hmac_gostr3411 - prf based on hmac with gostr3411 for pbkdf (not supported) ckp_pkcs5_pbkd2_hmac_sha224 - ...
NSS 3.42 release notes
utions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_42_rtm/src/ other releases are available in nss releases. ...
... https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_42_rtm/src/ other releases are available in nss releases. new in nss 3.42 new functionality bug 818686 - support xdg basedir specification new functions none notable changes in nss 3.42 the following ca certificates were
added: none the following ca certificates were removed: none
added support for some of the testcases from the wycheproof project: bug 1508666 -
added aes-gcm test cases bug 1508673 -
added chacha20-poly1305 test cases bug 1514999 -
added the curve25519 test cases thanks to jonas allmann for adapting these tests. bugs fixed in nss 3.42 bug 1490006 - reject invalid ch.legacy_versi...
...thanks to hanno böck and damian poddebniak for the discovery and fixes. note: this was mistakenly not in release 3.42, and is instead in nss 3.42.1. ...
...thanks to hanno böck and damian poddebniak for the discovery and fixes. note: this was mistakenly not in release 3.42, and is instead in nss 3.42.1. ...
NSS 3.45 release notes
he given subject distinguished name and returns them as der bytes. if no such certificates can be found, returns secsuccess and sets *results to null. if a failure is encountered while fetching any of the matching certificates, secfailure is returned and *results will be null. notable changes in nss 3.45 bug 1540403 - implement delegated credentials (draft-ietf-tls-subcerts) this
adds a new experimental function: ssl_delegatecredential note: in 3.45, selfserv does not yet support delegated credentials. see bug 1548360. note: in 3.45 the sslchannelinfo is left unmodified, while an upcoming change in 3.46 will set sslchannelinfo.authkeybits to that of the delegated credential for better policy enforcement. see bug 1563078. bug 1550579 - replace arm32 curve25519 impl...
... 3.46 will set sslchannelinfo.authkeybits to that of the delegated credential for better policy enforcement. see bug 1563078. bug 1550579 - replace arm32 curve25519 implementation with one from fiat-crypto bug 1551129 - support static linking on windows bug 1552262 - expose a function pk11_findrawcertswithsubject for finding certificates with a given subject on a given slot bug 1546229 -
add ipsec ike support to 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...
...e tags could be faked. ...
...a program ...
NSS 3.46 release notes
ug 1575411 for details. ...
...ith ./build.sh --enable-libpkix fails bug 1539788 -
add length checks for cryptographic primitives (cve-2019-17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bounds in der_decodetimechoice_util from sslexp_delegatecredential bug 1560593 - cleanup.sh script does not set error exit code for tests that "failed with core" bug 1566601 -
add wycheproof test vectors for aes-kw bug 1571316 - curve25519_32.c:280: undefined reference to `pr_assert' when building nss 3.45 on armhf-linux bug 1516593 - client to generate new random during renegotiation bug 1563258 - fips.sh fails due to non-existent "resp" directories bug 1561598 - remove -wmaybe-uninitialized warning in pqg.c bug 1560806 - increase softoken password max size to 500 ch...
... alert description after unencrypted finished msg bug 1564715 - read /proc/cpuinfo when at_hwcap2 returns 0 bug 1532194 - remove or fix -ddebug_$user from make builds bug 1565577 - visual studio's cl.exe -? ...
...ng gpg key bug 1563786 - update hacl-star docker image to pull specific commit bug 1559012 - improve gcm perfomance using pmull2 bug 1528666 - correct resumption validation checks bug 1568803 - more tests for client certificate authentication bug 1564284 - support profile mobility across windows and linux bug 1573942 - gtest for pkcs11.txt with different breaking line formats bug 1575968 -
add strsclnt option to enforce the use of either ipv4 or ipv6 bug 1549847 - fix nss builds on ios bug 1485533 - enable nss_ssl_tests on taskcluster this bugzilla query returns all the bugs fixed in nss 3.46: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.46 compatibility nss 3.46 shared libraries are back...
NSS 3.50 release notes
mitives from hacl* were updated, bringing performance improvements for several platforms. note that intel processors with sse4 but without avx are currently unable to use the improved chacha20/poly1305 due to a build issue; such platforms will fall-back to less optimized algorithms. see bug 1609569 for details. updated dtls 1.3 implementation to draft-30. see bug 1599514 for details.
added nist sp800-108 kbkdf - pkcs#11 implementation. see bug 1599603 for details. bugs fixed in nss 3.50 bug 1599514 - update dtls 1.3 implementation to draft-30 bug 1603438 - fix native tools build failure due to lack of zlib include dir if external bug 1599603 - nist sp800-108 kbkdf - pkcs#11 implementation bug 1606992 - cache the most recent pbkdf1 password hash, to speed up repeated sdr o...
... bug 1547639 - update zlib in...
... bug 1547639 - update zlib in nss to 1.2.11 bug 1609181 - detect arm (...
...it curve25519 bug 1608327 - two problems with neon-specific code in freebl bug 1575843 - detect aarch64 cpu features on freebsd bug 1607099 - remove the buildbot configuration bug 1585429 -
add more hkdf test vectors bug 1573911 -
add more rsa test vectors bug 1605314 - compare all 8 bytes of an mp_digit when clamping in windows assembly/mp_comba bug 1604596 - update wycheproof vectors and
add support for cbc, p256-ecdh, and cmac tests bug 1608493 - use aes-ni for non-gcm aes ciphers on platforms with no assembly-optimized implementation, such as macos. bug 1547639 - update zlib in nss to 1.2.11 bug 1609181 - detect arm (32-bit) cpu features on freebsd bug 1602386 - fix build on freebsd/powerpc* bug 1608151 - introduce nss_disable_altivec bug 1612623 - depend on nspr 4.25 bug 16...
NSS 3.54 release notes
ps download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_54_rtm/src/ other releases are available in nss releases. notable changes in nss 3.54 support for tls 1.3 external pre-shared keys (bug 1603042). use arm cryptography extension for sha256, when available. (bug 1528113). ...
... 1641716 - microsoft ecc root certificate authority 2017 sha-256 fingerprint: 358df39d764af9e1b766e9c972df352ee15cfac227af6ad1d70e8e4a6edcba02 bug 1641716 - microsoft rsa root certificate authority 2017 sha-256 fingerprint: c741f70f4b2a8d88bf2e71c14122ef53ef10eba0cfa5e64cfa20f418853073e0 the following ca certificates were removed: bug 1645199 -
addtrust class 1 ca root sha-256 fingerprint: 8c7209279ac04e275e16d07fd3b775e80154b5968046e31f52dd25766324e9a7 bug 1645199 -
addtrust external ca root sha-256 fingerprint: 687fa451382278fff0c8b11f8d43d576671c6eb2bceab413fb83d965d06d2ff2 bug 1641718 - luxtrust global root 2 sha-256 fingerprint: 54455f7129c20b1447c418f997168f24c58fc5023b...
...6df bug 1618402 - verisign class 3 public primary certification authority - g3 sha-256 fingerprint: eb04cf5eb1f39afa762f2bb120f296cba520c1b97db1589565b81cb9a17b7244 a number of certificates had their email trust bit disabled. see bug 1618402 for a complete list. bugs fixed in nss 3.54 bug 1528113 - use arm cryptography extension for sha256. bug 1603042 -
add tls 1.3 external psk support. bug 1642802 -
add uint128 support for hacl* curve25519 on windows. bug 1645186 -
add "certsign root ca g2" root certificate. bug 1645174 -
add microsec's "e-szigno root ca 2017" root certificate. bug 1641716 -
add microsoft's non-ev root certificates. bug 1621151 - disable email trust bit for "o=government root certification authority; c=tw" root. bug 1645199 -...
... bug 1641718 - remove "luxtrust global root 2" root certificate. bug 1639987 - remove "staat der nederlanden root ca - g2" root certificate. bug 1618402 - remove symantec root certificates and disable email trust bit. bug 1640516 - nss 3.54 should depend on nspr 4.26. ...
NSS 3.55 release notes
https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_55_rtm/src/ other releases are available in nss releases. notable changes in nss 3.55 p384 and p521 elliptic curve implementations are replaced with verifiable implementations from fiat-crypto and ecckiila. special thanks to the network and information security group (nisec) at tampere university. pk11_findcertinslot is
added. with this function, a given slot can be queried with a der-encoded certificate, providing performance and usability improvements over other mechanisms. see bug 1649633 for more details. dtls 1.3 implementation is updated to draft-38. see bug 1647752 for details. nspr dependency updated to 4.27. known issues on some platforms, using the makefile builds fails to locate seccomon.h; ensure...
...se the gyp-based build.sh script. if this affects you, please help us narrow down the cause in bug 1653975. bugs fixed in nss 3.55 bug 1631583 (cve-2020-6829, cve-2020-12400) - replace p384 and p521 with new, verifiable implementations from fiat-crypto and ecckiila. bug 1649487 - move overzealous assertion in vfy_endwithsignature. bug 1631573 (cve-2020-12401) - remove unnecessary scalar p
adding. bug 1636771 (cve-2020-12403) - explicitly disable multi-part chacha20 (which was not functioning correctly) and more strictly enforce tag length. bug 1649648 - don't memcpy zero bytes (sanitizer fix). bug 1649316 - don't memcpy zero bytes (sanitizer fix). bug 1649322 - don't memcpy zero bytes (sanitizer fix). bug 1653202 - fix initialization bug in blapitest when compiled with nss_disa...
... functioning correctly) and more strictly enforce tag length. bug 1649648 - don't memcpy zero bytes (sanitizer fix). bug 1649316 - don't memcpy zero bytes (sanitizer fix). bug 1649322 - don't memcpy zero bytes (sanitizer fix). bug 1653202 - fix initialization bug in blapitest when compiled with nss_disable_deprecated_seed. bug 1646594 - fix avx2 detection in makefile builds. bug 1649633 -
add pk11_findcertinslot to search a given slot for a der-encoded certificate. bug 1651520 - fix slotlock race in nsc_gettokeninfo. bug 1647752 - update dtls 1.3 implementation to draft-38. bug 1649190 - run cipher, sdr, and ocsp tests under standard test cycle in ci. bug 1649226 -
add wycheproof ecdsa tests. bug 1637222 - consistently enforce iv requirements for des and 3des. bug 1067214 - ...
... bug 1643528 - fix compilation error with -werror=strict-prototypes. ...
Notes on TLS - SSL 3.0 Intolerant Servers
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 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 preview 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 th...
...eferences | 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 concerning netscape browsers and problem servers, please contact us using the feedback
address at the top of this page. detecting intolerant servers because newer versions of netscape and mozilla have built-in workaround for the problem servers, it is now unlikely that you will experience this problem. but if you're running netscape 6.0/6.01/6.1 pr 1 or mozilla build (prior to 6/11/2001), you should look out for the symptom described below. you may also run this test with versions l...
...edit | preferences | privacy and security | ssl | enable tls is turned on. if so, turn it off. now re-visit the problem site. if the content displays this time, you are most likely witnessing a tls/ssl 3.0 intolerant server. report such a problem to the server's administrator. how to report an intolerant server optional:get the name of the ssl server software used by the website. to do so,
add http://toolbar.netcraft.com/site_report?url= to the beginning of the url. the server software will appear next to server under ssl certificate information. for instance, to check https://bugzilla.mozilla.org/, then visit http://toolbar.netcraft.com/site_rep...a.mozilla.org/.
add the information on such a server (software, url) to bug 59321 at bugzilla. (note: you will be asked to provide yo...
...oolbar.netcraft.com/site_report?url= to the beginning of the url. the server software will appear next to server under ssl certificate information. for instance, to check https://bugzilla.mozilla.org/, then visit http://toolbar.netcraft.com/site_rep...a.mozilla.org/.
add the information on such a server (software, url) to bug 59321 at bugzilla. (note: you will be asked to provide your email
address before you can file a bug at bugzilla.) original document information author : katsuhiko momoi last updated date: january 27th, 2003 copyright © 2001-2003 netscape. all rights reserved. ...
PKCS 7 functions
uired by mail and news applications and by some of the nss tools. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
...mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
... to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
... sec_pkcs7encoderupdate mxr 3.2 and later sec_pkcs7getcertificatelist mxr 3.2 and later sec_pkcs7getcontent mxr 3.2 and later sec_pkcs7getencryptionalgorithm mxr 3.2 and later sec_pkcs7getsignercommonname mxr 3.4 and later sec_pkcs7getsigneremail
address mxr 3.4 and later sec_pkcs7getsigningtime mxr 3.4 and later sec_pkcs7includecertchain mxr 3.2 and later sec_pkcs7iscontentempty mxr 3.2 and later sec_pkcs7setcontent mxr 3.4 and later sec_pkcs7verifydetachedsignature mxr 3.4 and later ...
NSS tools : pk12util
pk12util -i p...
... pk12util -i p12file [-h tokenname] [-v] [-d [sql:]directory] [-p dbprefix] [-k slotpasswordfile|-k...
...common legacy type. using the sqlite databases must be manually specified by using the sql: prefix with the given security directory. for example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb to set the shared database type as the default type for the tools, set the nss_default_db_type environment variable to sql: export nss_default_db_type="sql" this line can be set
added to the ~/.bashrc file to make the change permanent. most applications do not use the shared database by default, but they can be configured to use them. for example, this how-to article covers how to configure firefox and thunderbird to use the new shared nss databases: o https://wiki.mozilla.org/nss_shared_db_howto for an engineering draft on the changes in the shared nss databases, see ...
...zilla.org/nss_shared_db_howto for an engineering draft on the changes in the shared nss databases, see the nss project wiki: o https://wiki.mozilla.org/nss_shared_db see also certutil (1) modutil (1) the nss wiki has information on the new database design and how to configure applications to use it. o https://wiki.mozilla.org/nss_shared_db_howto o https://wiki.mozilla.org/nss_shared_db
additional resources for information about nss and other tools related to nss (like jss), check out the nss project wiki at [1]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto irc: freenode at #dogtag-pki authors the nss tools were written and maintained by devel...
gtstd.html
such as netscape certificate management system. the instructions that follow assume you are using the certificate database tool to set up both the server and client databases for testing purposes. you can use the security module database tool, a command-line utility that comes with nss, to manage pkcs #11 module information within secmod.db files. the security module database tool allows you to
add and delete pkcs #11 modules, change passwords, set defaults, list module contents, enable or disable slots, enable or disable fips-140-1 compliance, and assign default providers for cryptographic operations. setting up the certificate and key databases before you can run the sample programs (server.c and client.c) that come with nss, you must set up certificate, key, and security module dat...
...suing a new server certificate based on the server's certificate request. the new cert is signed with the ca's private key, so this operation uses the ca's databases. this step leaves the server's new certificate in a file. >certutil -c -d ca_db -c "myco's root ca" -a -i server_db/server.req -o server_db/server.crt -2 -6 enter password or pin for "communicator certificate db": import (
add) the new server certificate to the server's certificate database in the server_db directory with the appropriate nickname. notice that no trust is explicitly needed for this certificate. >certutil -a -d server_db -n myco.mcom.org -a -i server_db/server.crt -t ",," display the contents of the server's certificate databases. >certutil -l -d server_db the trust flag settings "u,u,u" i...
...g and issuing a new client certificate based on the client's certificate request. the new cert is signed with the ca's private key, so this operation uses the ca's databases. this step leaves the client's new certificate in a file. >certutil -c -d ca_db -c "myco's root ca" -a -i client_db/client.req -o client_db/client.crt -2 -6 enter password or pin for "communicator certificate db":
add the new client certificate to the client's certificate database in the client_db directory with the appropriate nickname. notice that no trust is required for this certificate. >certutil -a -d client_db -n "joe client" -a -i client_db/client.crt -t ",," display the contents of the client's certificate databases. >certutil -l -d client_db the trust flag settings "u,u,u" indicate tha...
...rg certutil: certificate is valid >certutil -v -d client_db -u c -n "joe client" certutil: certificate is valid building nss programs on unix, use the gnu utility gmake to run the makefile. on windows nt, use the nmake utility that comes with visual c++. ...
S/MIME functions
nss_cmsencoder_start mxr 3.2 and later nss_cmsencoder_update mxr 3.2 and later nss_cmsencrypteddata_create mxr 3.2 and later nss_cmsencrypteddata_destroy mxr 3.2 and later nss_cmsencrypteddata_getcontentinfo mxr 3.2 and later nss_cmsenvelopeddata_
addrecipient mxr 3.2 and later nss_cmsenvelopeddata_create mxr 3.2 and later nss_cmsenvelopeddata_destroy mxr 3.2 and later nss_cmsenvelopeddata_getcontentinfo mxr 3.2 and later nss_cmsmessage_contentlevel mxr 3.2 and later nss_cmsmessage_contentlevelcount ...
...ientinfo_destroy mxr 3.2 and later nss_cmsrecipientinfo_encode mxr 3.8 and later nss_cmsrecipientinfo_getcertandkey mxr 3.8 and later nss_cmsrecipientinfo_unwrapbulkkey mxr 3.7.2 and later nss_cmsrecipientinfo_wrapbulkkey mxr 3.7.2 and later nss_cmssigneddata_
addcertchain mxr 3.2 and later nss_cmssigneddata_
addcertlist mxr 3.2 and later nss_cmssigneddata_
addcertificate mxr 3.2 and later nss_cmssigneddata_
adddigest mxr 3.2 and later nss_cmssigneddata_
addsignerinfo mxr 3.2 and later nss_cmssigneddata_create mxr ...
...data_setdigests mxr 3.2 and later nss_cmssigneddata_setdigestvalue mxr 3.4 and later nss_cmssigneddata_signerinfocount mxr 3.2 and later nss_cmssigneddata_verifycertsonly mxr 3.2 and later nss_cmssigneddata_verifysignerinfo mxr 3.2 and later nss_cmssignerinfo_
addmssmimeenckeyprefs mxr 3.6 and later nss_cmssignerinfo_
addsmimecaps mxr 3.2 and later nss_cmssignerinfo_
addsmimeenckeyprefs mxr 3.2 and later nss_cmssignerinfo_
addsigningtime mxr 3.2 and later nss_cmssignerinfo_create mxr 3.2 and later nss_cmssignerinfo_create...
...reate mxr 3.2 and later nss_cmssignerinfo_createwithsubjkeyid mxr 3.6 and later nss_cmssignerinfo_destroy mxr 3.2 and later nss_cmssignerinfo_getcertlist mxr 3.2 and later nss_cmssignerinfo_getsignercommonname mxr 3.2 and later nss_cmssignerinfo_getsigneremail
address mxr 3.2 and later nss_cmssignerinfo_getsigningcertificate mxr 3.2 and later nss_cmssignerinfo_getsigningtime mxr 3.2 and later nss_cmssignerinfo_getverificationstatus mxr 3.2 and later nss_cmssignerinfo_getversion mxr 3.2 and later nss_cmssignerinfo_inclu...
Rhino shell
ions is no longer available. note if the shell is invoked with the system property rhino.use_java_policy_security set to true and with a security manager installed, the shell restricts scripts permissions based on their urls according to java policy settings. this is available only if jvm implements java2 security model. predefined properties scripts executing in the shell have access to some
additional properties of the top-level object. arguments the arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. environment 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 exten...
......, argn, options) all except the last arguments to runcommand are converted to strings and denote command name and its arguments. if the last argument is a javascript object, it is an option object. otherwise it is converted to string denoting the last argument and options objects assumed to be empty. the following properties of the option object are processed: args - provides an array of
additional command arguments env - explicit environment object. all its enumeratable properties define the corresponding environment variable names. input - the process input. if it is not java.io.inputstream, it is converted to string and sent to the process as its input. if not specified, no input is provided to the process. output - the process output instead of java.lang.system.out. if it is n...
... converted to string and put as the new value of the output property. err - the process error output instead of java.lang.system.err. if it is not instance of java.io.outputstream, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property. seal(object) seal the specified object so any attempt to
add, delete or modify its properties would throw an exception. serialize(object, filename) serialize the given object to the specified file. spawn(functionorscript) run the given function or script in a different thread. sync(function) creates a synchronized function (in the sense of a java synchronized method) from an existing function. the new function synchronizes on the this object of its i...
...cognized option `--bad-arg' try `/bin/sort --help' for more information. ...
Creating JavaScript jstest reftests
re a few important subdirectories. non262 tests the directory js/src/tests/non262/ should contain all tests of the following type: regressions of spidermonkey non-standard spidermonkey extensions to the javascript language test of "implementation-defined" details of the ecmascript standard for example, the exact definition of pi or some details of array sorting. you should not
add tests of the following type: tests of the jit test of jit correctness belong in the jit-test suite, read more here. performance tests or stress tests tests of spidermonkey's comformance to the ecmascript standard a brief history: in 2017, spidermonkey started comsuming test262, a comprehensive tests suite for ecmascript implementations. before using test262, spidermonkey had a f...
...ad the high level advice for test writing in the parent article here. jstests has a special requirement: the call to reportcompare in every jstest is required by the test harness. except in old tests or super strange new tests, it should be the last line of the test. comparison functions and shared test functionality the jstest runner loads the code in js/src/tests/shell.js for every test.
additionally, it loads every shell.js and broswer.js file in the subdirectories on the path from js/src/tests to the location of your test. if you have functionality several tests share in a given folder, you can
add the functionality to the shell.js or broswer.js file in the directory. asserteq asserteq(v1, v2[, message]) checks that v1 and v2 are the same value. if they're not, throw an exception...
... { return 1; }'; actual = f + ''; comparesource(expect, actual, 'decompile simple function'); handling shell or browser specific features jstests run both in the browser and in the javascript shell. if your test needs to use browser-specific features, either: make the test silently pass if those features aren't present; or write a mochitest instead (preferred); or at the top of the test,
add the comment // skip-if(xulruntime.shell), so that it only runs in the browser. if your test needs to use shell-specific features, like gc(), either: make the test silently pass if those features aren't present; or make it a jit-test (so that it never runs in the browser); or at the top of the test,
add the comment // skip-if(!xulruntime.shell), so that it only runs in the shell. it is e...
... uncaught error or exception will not cause the browser to terminate with a non-zero exit code. to make the situation even more complex, newer c++ compilers will abort the browser with a typical exit code of 5 by throwing a c++ exception when an out of memory error occurs. simply testing the exit code does not allow you to distinguish the variety of causes a particular abnormal exit may have. in
addition, some tests pass if they do not crash; however, they may not terminate unless killed by the test driver. a modification will soon be made to the javascript tests to allow an arbitrary string to be output which will be used to post process the test logs to better determine if a test has passed regardless of its exit code. ...
Creating JavaScript tests
jstests is intended for tests of language-visible functionality. ...
... only in the shell. jit-tests do not load extra test functionality automatically. writing a new test file have a look at the existing files and follow what they do. all tests, in both suite, can use the asserteq function. asserteq(v1, v2[, message]) check that v1 and v2 are the same value. if they're not, throw an exception (which will cause the test to fail). if you are writing a jstests,
additional testing functionality is provided for you in shell.js files. you can read about them here. performance testing and general advice do not attempt to test the performance of engine features in the test suite. please keep in mind that the javascript test suite is run on a wide variety of wildly varying hardware plaforms, from phones all the way up to servers. even tests that check for pol...
... complexity will start to fail in a few years when they have sped up enough to run faster than the granularity of the os scheduler or when run on platforms with higher latencies than your development workstation. these tests will also show up as infrequent oranges on our heavily loaded test machines, lowering the value of our test suite for everyone. just don't do it, it's never worth it. do not
add performance tests to the test suite. it is not generally even possible to tell if the speed of any particular feature is going to be important in the real world without running a real-world benchmark. it is very hard to write a good real-world benchmark. for this reason, the best place to find out if a change is performance sensitive is on arewefastyet.com. focus on writing fast, light tests th...
...y even possible to tell if the speed of any particular feature is going to be important in the real world without running a real-world benchmark. it is very hard to write a good real-world benchmark. for this reason, the best place to find out if a change is performance sensitive is on arewefastyet.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 instruct...
GCIntegration - SpiderMonkey Redirect 1
. 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 when the incremental gc started will be marked. in
addition, objects allocated during the incremental gc are marked unconditionally. at the end of the gc, any reachable object must have been newly allocated or else reachable at the beginning, since objects can never go from unreachable to reachable. the end result is that all reachable objects are marked. a simple way to visualize the invariant is that, when an incremental gc starts, an "initial sna...
...m. if these pointers are ever used again, the program will crash. we expect to test heavily with this analysis. there's also a static analysis in the works that uses sixgill. heap pointers pointers to gc things from the heap must be treated differently because they don't have stack-like lifetimes. for pointers that are traced using js_call_tracer we will most likely change the api so that the
address of the pointer being traced is passed in, rather than the pointer itself. then, if we need to move the object, we'll update the pointer to it as well. for pointers that are not traced, the solutions become more ad-hoc. it's likely that js_isabouttobefinalized() will also be changed to take the
address of the pointer. if the given object is still alive, but it moved, then we can update the po...
...s passed in, rather than the pointer itself. then, if we need to move the object, we'll update the pointer to it as well. for pointers that are not traced, the solutions become more ad-hoc. it's likely that js_isabouttobefinalized() will also be changed to take the
address of the pointer. if the given object is still alive, but it moved, then we can update the pointer. for wrapper caches, we may
add a new class hook that is invoked if the object moves. objects with wrapper caches could implement that hook to find their corresponding c++ object and update the wrapper field to point to the new location. undoubtedly there will be more esoteric cases. we will need to handle pointers to array slots and string characters specially, since those may actually be pointers into the middle of gc things...
...ns occur in the browser now, and how best to handle them. write barriers generational gc needs its own write barrier. the goal is to keep a list, called the remembered set, of all pointers from the tenured generation into the nursery. so every time a pointer is written somewhere, we need to check if the source is in the tenured gen and if the destination is in the nursery. if so, the pointer is
added to the remembered set. the remembered set allows us to collect the nursery without needing to look at the tenured generation at all, aside from the remembered set entries. there are three simplifications, similar to the ones for incremental write barriers, that will allow us to avoid write barriers in some cases. only strings and objects without finalizers will be stored in the nursery, at ...
How to embed the JavaScript engine
return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *script = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; bool ok = js_evaluatescript(cx, global, script, strlen(script), filename, lineno, rval.
address()); if (!ok) return 1; } jsstring *str = rval.tostring(); printf("%s\n", js_encodestring(cx, str)); } js_destroycontext(cx); js_destroyruntime(rt); js_shutdown(); return 0; } spidermonkey 31 // following code might be needed in some case // #define __stdc_limit_macros // #include <stdint.h> #include "jsapi.h" /* the class of the gl...
...l.tostring(); printf("%s\n", js_encodestring(cx, str)); } js_destroycontext(cx); js_shutdown(); return 0; } build and run the hello world example build command line depends on the os and the tools. here are sample mac and linux command lines (where <objdir> is the directory where spidermonkey was built): # if you're using debug build of spidermonkey, you need -ddebug in
addition to the command below. # if you're using version other than spidermonkey 31, please change -lmozjs-xx to your version. [mac] clang++ -std=c++11 -i<objdir>/dist/include -l<objdir>/dist/lib helloworld.cpp -o helloworld -lmozjs-31 -lz [linux] g++ -std=c++11 -i<objdir>/dist/include -l<objdir>/dist/lib helloworld.cpp -o helloworld -lmozjs-31 -lz -lpthread -ldl it should print "helloworld, it ...
...f the caller supplies fewer, the js engine should ensure that undefined is passed for the missing ones): #define doit_minargs 2 // [spidermonkey 24] use jsbool instead of bool. static bool doit(jscontext *cx, unsigned argc, jsval *vp) { js::callargs args = callargsfromvp(argc, vp); /* * look in argv for argc actual parameters, set *rval to return a * value to the caller. * * ex.
add two arguments as integer. * args.rval().setint32(args[0].toint32() + args[1].toint32()); */ return true; } then to wire it up to js, you could write: ok = js_definefunction(cx, global, "doit", doit, doit_minargs, 0); or, if you had a bunch of native functions to define, you would probably put them in a table: static jsfunctionspec my_functions[] = { js_fn("doit", doit, doit_minarg...
...ts for the call, here i create arguments with 2 items: // [spidermonkey 24] js::autovaluearray is not defined. // js::autovaluevector argv(cx); // argv.resize(2); js::autovaluearray<2> argv(cx); argv[0].setint32(1); argv[1].setint32(2); then call the function: // [spidermonkey 24] pass arguments length and the 'jsval *' pointer. // js_callfunctionname(cx, global, "func", 2, argv.begin(), rval.
address()); js_callfunctionname(cx, global, "func", argv, &rval); example say the click event is for the top-most or focused ui element at position (x, y): jsobject *target, *event; js::autovaluearray<1> argv(cx); /* * find event target and make event object to represent this click. * pass cx to neweventobject so js_newobject can be called. */ target = findeventtargetat(cx, global, x, y); eve...
Exact Stack Rooting
s, so the gc cannot automatically handle this slot. this means it must be manually traced by the object's owner: this is both fragile and more expensive than using an extra reserved slot, or even just putting a new property on the object. class fooclass = { "fooprototype", /* name */ jsclass_has_private | jsclass_has_reserved_slots(1), /* flags */ js_propertystub, /*
addproperty */ js_propertystub, /* delproperty */ ... etc ... }; rootedobject obj(cx, newobject(cx, &fooclass, nullptr(), nullptr(), &obj)); rootedvalue v(cx, object_to_value(othergcthing)); jsobject::setreservedslot(obj, 0, v); storing a gcpointer on the cheap todo: tracing and heapptr storing a gcpointer on the cstack gcpointers stored on the cstack are special. unlike other gc...
...bj, 0, v); storing a gcpointer on the cheap todo: tracing and heapptr storing a gcpointer on the cstack gcpointers stored on the cstack are special. unlike other gcpointers, they are not traced as part of the gc. instead, every pointer on the cstack should be considered part of the rootset. to that end, we have a special "rooting" mechanism for stack pointers that is very efficiently able to
add and remove gcpointers to the rootedset. the downside of this efficiency is that gcpointers must be
added to and removed from this rootedset tracking structure in lifo order. for this reason it is highly recommended that this rooting mechanism only be used on the cstack. js::rooted<t> typedef js::rooted<t> rootedt; -> rootedobject, rootedstring, rootedscript, etc. because of the lifo restricti...
...value, jsid, etc.) gcheap - the graph of gcthings allocated by spidermonkey's allocator. the goal of spidermonkey's gc is to partition this heap into regions reachable from the rootset and not. root - a gcpointer held live because it is a member of the rootset. rootset - this is a set of gcpointers that are de-facto alive, regardless of the gcthing's reachability. gcpointers must be explicitly
added to and removed from the rootset. liveset - the set of all gcthings that are reachable from roots. deadset - the set of all gcthings that are not reachable from roots. cheap - the c/c++ program heap: e.g., memory allocated by malloc/calloc/realloc. cstack - the c/c++ program stack. rooted - a gcthing in the liveset is said to be "rooted" even if it is not a root as such, but is only reachab...
...lds an object live by storing its pointer on the stack so that the conservative scanner will find it. this distinction should not be noticable to the end user. performance tweaking in aggregate, exact and conservate stack rooting should have similar performance. the performance tradeoffs that these techniques make, however, are quite different. if the extra overhead of exact rooting does end up
adding an unacceptable cost to a specific code path that is not mitigated by a faster gc, there are some tricks you can use to get better performance at the cost of more complex code. move js::rootedt declarations above loops. modern c++ compilers are not smart enough to do licm on js::rootedt, so forward declaring a single js::rootedt above the loop and re-using it on every iteration can save som...
SpiderMonkey Internals
this document is talking about partially obsolete things. design walk-through at heart, spidermonkey is a fast interpreter that runs an untyped bytecode and operates on values of type js::value—type-tagged values that represent the full range of javascript values. in
addition to the interpreter, spidermonkey contains a just-in-time (jit) compiler, a garbage collector, code implementing the basic behavior of javascript values, a standard library implementing ecma 262-5.1 §15 with various extensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to t...
...rting. in general, both functions inside spidermonkey and jsapi callback functions signal errors by calling js_reporterror or one of its variants, or js_setpendingexception, and returning js_false or null. public apis the public c/c++ interface, called the jsapi, is in most places a thin (but source-compatible across versions) layer over the implementation. see the jsapi user guide. there is an
additional public api for javascript debuggers, jsdbgapi, but js/jsd/jsdebug.h might be a better api for debuggers. another api, jsxdrapi, provides serialization for javascript scripts. (xul fastload uses this.) just-in-time compiler spidermonkey contains a baseline compiler as first tier. a second tier jit, code-named ionmonkey was enabled in firefox 18. ionmonkey is an optimizing compiler. self-...
... are used in jsscript.cpp to map line number to program counter and back. jstypes.h fundamental representation types and utility macros. this file alone among all .h files in spidermonkey must be included first by .cpp files. it is not nested in .h files, as other prerequisite .h files generally are, since it is also a direct dependency of most .cpp files and would be over-included if nested in
addition to being directly included. jsbit.h, jslog2.cpp bit-twiddling routines. most of the work here is selectively enabling compiler-specific intrinsics such as gcc's __builtin_ctz, which is useful in calculating base-2 logarithms of integers. jsutil.cpp, jsutil.h the js_assert macro is used throughout the source as a proof device to make invariants and preconditions clear to the reader, and t...
...mission to use notice included. jsdtoa.cpp #includes this file. jshash.cpp, jshash.h, jsdhash.cpp, jsdhash.h portable, extensible hash tables. these use multiplicative hash for strength reduction over division hash, yet with very good key distribution over power of two table sizes. jshash resolves collisions via chaining, so each entry burns a malloc and can fragment the heap. jsdhash uses open
addressing. jslong.cpp, jslong.h 64-bit integer emulation, and compatible macros that use intrinsic c types, like long long, on platforms where they exist (most everywhere, these days). jsprf.* portable, buffer-overrun-resistant sprintf and friends. for no good reason save lack of time, the %e, %f, and %g formats cause your system's native sprintf, rather than js_dtoa(), to be used. this bug does...
JS::CompileOptions
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. version jsversion javascript version used to compile the script. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. version jsversion javascript version used to compile the script. ...
...rce should not be cached by the js engine and should be lazily loaded from the embedding as-needed. introductiontype const char a statically allocated c string: one of following in general: "eval" - code passed to eval "function" - code passed to the function constructor. "generatorfunction" - code passed to the generatorfunction constructor. in
addition to above, the following are used in browser: "worker" - code loaded by calling the web worker constructor—the worker's main script. "importscript" - code by calling importscripts in a web worker. "eventhandler" - code assigned to dom elements' event handler idl attributes as a string. "scriptelement" - code belonging to <script> elements. "javascripturl" - co...
...ns with a non-stack-like lifetime. for example, js::compileoffthread needs to save compilation options where a worker thread can find them, and then return immediately. the worker thread will come along at some later point, and use the options. the compiler itself just needs to be able to access a collection of options; it doesn't care who owns them, or what's keeping them alive. it does its own
addrefs/copies/tracing/etc. so, we have a class hierarchy that reflects these three use cases: readonlycompileoptions is the common base class. it can be used by code that simply needs to access options set elsewhere, like the compiler. the usual compileoptions class must be stack-allocated, and holds non-owning references to the filename, element, and so on. it's derived from readonlycompileopt...
JS::Handle
cle covers features introduced in spidermonkey 17 reference to a t that has been rooted elsewhere. this is most useful as a parameter type, which guarantees that the t value is properly rooted. syntax bool somefunction(jscontext *cx, js::handle<t> var) { ... } methods here, ptr represents the private member of js::handle<t>, typed with t. method description const t *
address() const returns a pointer to ptr. const t &get() const returns ptr. operator const t&() const t operator->() const bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const description js::handle<t> is a const reference to a js::rooted<t>. functions which take gc things or values as a...
... use handles for those arguments and avoid any explicit rooting. this has two benefits. first, when several such functions call each other then redundant rooting of multiple copies of the gc thing can be avoided. second, if the caller does not pass a rooted value a compile error will be generated, which is quicker and easier to fix than when relying on a separate rooting analysis. if you want to
add additional methods to js::handle for a specific specialization, define a js::handlebase<t> specialization containing them. there are typedefs available for the main types: namespace js { typedef handle<jsfunction*> handlefunction; typedef handle<jsid> handleid; typedef handle<jsobject*> handleobject; typedef handle<jsscript*> handlescript; typedef handle<jsstring*> handlestring; ty...
...cific specialization, define a js::handlebase<t> specialization containing them. ...
...ndle<value> handlevalue; } see also mxr id search for js::handle mxr id search for js::handlefunction mxr id search for js::handleid mxr id search for js::handleobject mxr id search for js::handlescript mxr id search for js::handlestring mxr id search for js::handlesymbol mxr id search for js::handlevalue js::rooted js::mutablehandle gc rooting guide bug 714647 bug 761391 -
added js::handlescript bug 645416 -
added js::handlesymbol ...
JS::Remove*Root
bject *> *rp); void removescriptrootrt(jsruntime *rt, js::heap<jsscript *> *rp); name type description cx jscontext * the context from which to remove the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime from which to remove the root. ...
...e description cx jscontext * the context from which to remove the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime from which to remove the root. vp js::heap<js::value>
address of the js::value variable to remove from the root set. this must have been passed to one of js::
addvalueroot, js::
addnamedvalueroot or js::
addnamedvaluerootrt. ...
...est. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime from which to remove the root. vp js::heap<js::value>
address of the js::value variable to remove from the root set. this must have been passed to one of js::
addvalueroot, js::
addnamedvalueroot or js::
addnamedvaluerootrt. rp js::heap<jsstring *>
address of the jsstring * variable to remove from the root set. this must have been passed to either js::
addstringroot or js::
addnamedstringroot. ...
...lue>
address of the js::value variable to remove from the root set. this must have been passed to one of js::
addvalueroot, js::
addnamedvalueroot or js::
addnamedvaluerootrt. rp js::heap<jsstring *>
address of the jsstring * variable to remove from the root set. this must have been passed to either js::
addstringroot or js::
addnamedstringroot. rp js::heap<jsobject *>
address of the jsobject * variable to remove from the root set. this must have been passed to either js::
addobjectroot or js::
addnamedobjectroot. rp js::heap<jsscript *>
address of the jsscript * variable to remove from the root set. this must have been passed to js::
addnamedscriptroot. description js::remove*root removes the variable that rp points to from the garbage collecto...
JSClass.flags
has_private jsclass_private_is_nsisupports mozilla extension. the private field of each object of this class points to an xpcom object (see nsisupports). this is only meaningful if spidermonkey is built with xpconnect and the jsclass_has_private flag is also set. mxr id search for jsclass_private_is_nsisupports jsclass_is_domjsclass
added in spidermonkey 17 objects are dom. mxr id search for jsclass_is_domjsclass jsclass_emulates_undefined
added in spidermonkey 24 causes objects which have this class to emulate undefined in certain circumstances. an object obj that emulates undefined behaves like any other object, except in the following ways: typeof obj === "undefined" obj converts to ...
... needs custom marking. spidermonkey reserves a few other flags for its internal use. they are jsclass_is_anonymous, jsclass_is_global, jsclass_is_proxy, and jsclass_has_cached_proto. jsapi applications should not use these flags. ...
...s_proxy, and jsclass_has_cached_proto. jsapi applications should not use these flags. ...
...pi applications should not use these flags. ...
JSID_IS_STRING
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
... string. jsid_to_string converts a specified js id, id to a jsstring *. ...
...fied js id, id to a jsstring *. ...
JS_ConvertArguments
obsolete since jsapi 38this 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. converts a series of js values, passed in an argument array, to their corresponding js types. syntax bool js_convertarguments(jscontext *cx, const js::callargs &args, const char *format, ...); //
added in spidermonkey 31 bool js_convertarguments(jscontext *cx, unsigned argc, jsval *argv, const char *format, ...); // obsolete since jsapi 30 name type description cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_
addargumentformatter has been called. requires r...
...obsolete since jsapi 30 argv jsval * pointer to the vector of arguments to convert. ...
...nversion) * n/a none. if an asterisk (*) is present in format, it tells the conversion routine to skip converting the current argument. / n/a none. arguments after the slash are optional. if an optional argument is missing from argv, js_convertarguments neither assigns anything to any variable nor reports an error. this function also takes in consideration any
additional custom types defined on cx using js_
addargumentformatter. for example, if format is "biob", then js_convertarguments converts the first js value in argv into a bool, the second value into a double, the third value into a jsobject *, and the last value into a bool. to skip a given argument, pass an asterisk in the corresponding position in format. if argc is less than the number of argum...
... success, js_convertargument returns true. ...
JS_DefineProperty
const char16_t *name, size_t namelen, uint32_t value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_defineucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, double value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); // ----
added in spidermonkey 45 ---- bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handle<jspropertydescriptor> desc, js::objectopresult &result); bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handle<jspropertydescriptor> desc); bool js_defineucproperty(jscontext...
...andle<jspropertydescriptor> desc, js::objectopresult &result); bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handle<jspropertydescriptor> desc); bool js_defineucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::handle<jspropertydescriptor> desc); // ----
added in spidermonkey 1.8.1 ---- bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handleobject value, unsigned attrs, ...
...fineproperty is the fundamental operation on which several more convenient, higher-level functions are based, including js_definefunction, js_definefunctions, js_defineproperties, js_defineconstdoubles, js_defineobject, and js_initclass. it differs from js_setproperty in that: it does not behave like ordinary property assignment in the javascript language; it allows the application to specify
additional details (getter, setter, and attrs) governing the new property's behavior; it never calls a setter; it can call the jsclass.
addproperty callback when js_setproperty would not, because it can replace an existing property. the parameters specify the new property's name, initial stored value, getter, setter, and property attributes (attrs). if obj already has an own property with the giv...
...ints to a javascript function, cast to type jspropertyop. for more about javascript getters and setters, see defining getters and setters. on success, js_defineproperty returns true. on error or exception, it returns false. see also mxr id search for js_defineproperty mxr id search for js_defineucproperty mxr id search for js_definepropertybyid js_defineelement bug 461163 bug 1113369 --
added desc and result parameters ...
JS_DumpNamedRoots
d roots. dump void (*)(const char *, void *, void *) pointer to function that actually dumps the named roots. this may not be null. data void * a pointer that is passed to dump each time it is called. the javascript engine does not read from or write to this pointer at all. it is passed to the dump function unchanged. it may be null. description each call to js_
addnamedroot creates a record in a table of named roots maintained by the garbage collector. js_dumpnamedroots provides a way for the application to access the contents of that table. it calls the dump function once for each named root in the given runtime rt. in pseudocode: /* pseudocode explanation of what js_dumpnamedroots does */ void js_dumpnamedroots(jsruntime *rt, dumpfn dump, void *data) { ...
...y the garbage collector. js_dumpnamedroots provides a way for the application to access the contents of that table. it calls the dump function once for each named root in the given runtime rt. ...
...oot.
address, data); } callback syntax dump is a pointer to a function provided by the application. when js_dumpnamedroots calls it, it passes three arguments: argument type description name const char * the name of the named root. rp void * a pointer to the rooted variable, array element, or field. this is the pointer that the application passed to js_
addnamedroot. it points to a variable, array element, or field of type jsval, jsobject *, jsstring *, or jsdouble *. data void * the data argument that the application passed to js_dumpnamedroots. example static void dumproot(const char *name, void *
addr, void *data) { /* the application may use `data` for anything. in this example, we use it to pass the desired outpu...
...r jsdouble *. data void * the data argument that the application passed to js_dumpnamedroots. example static void dumproot(const char *name, void *
addr, void *data) { /* the application may use `data` for anything. in this example, we use it to pass the desired output file. */ file *f = (file *) data; fprintf(f, "there is a root named '%s' at %p\n", name,
addr); } int main() { ... js_dumpnamedroots(rt, dumproot, stderr); ... } see also bug 803907 ...
JS_NewFunction
create a new javascript function that is implemented in c/c++ as a jsnative. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. call jsnative native c/c++ implementation of this function. nargs unsigned number of arguments the function expects. flags ...
...erwise 0. parent js::handle<jsobject*> pointer to the parent object for this function. if this is null, a default parent object is used. obsolete since jsapi 39 name const char * name to assign to the new function. if this is null, the new function has no name. id js::handle<jsid> a pointer to jsid of the name to assign to the new function.
added in spidermonkey 17 description js_newfunction creates a new javascript function implemented in c/c++. (to create a new function implemented in javascript, use js_compilefunction instead.) call is a c/c++ function pointer that the new function wraps. nargs is the number of arguments the function expects. if flags is jsfun_constructor, a created function can be called as a constructor. p...
...unction returns a pointer to the newly created function. otherwise it reports an out-of-memory error and returns null. ...
JS_NewObject
requires request. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp const jsclass * pointer to the class to use for the new object. if this is null, an ordinary javascript object is created. the jsclass may b...
...st. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp const jsclass * pointer to the class to use for the new object. if this is null, an ordinary javascript object is created. the jsclass may be used to override low-level object behavior, including such details as the physical memory layout of the object and how property lookups are done.
added in spidermonkey 1.8.1 clasp->flags must not have the jsclass_global_flags bits set (use js_newglobalobject instead). if clasp is non-null, the caller must ensure that the jsclass remains alive throughout the lifetime of the new object, including the garbage collection cycle that finally frees it. the usual way to do this is to make jsclasses global or static. proto js::handle<...
...ption js_newobject creates a new object based on a specified class. cx is a pointer to a context associated with the runtime in which to establish the new object. clasp is a pointer to an existing class to use for internal methods, such as finalize. the javascript engine selects a prototype object for you. on success, js_newobject returns a pointer to the new object. otherwise it returns null.
added in spidermonkey 1.8 js_newobjectwithgivenproto creates a new object with the specified prototype. if null is passed as proto, the new object will have a prototype with the js value of null. to create a new object as a property of an existing object, use js_defineobject, a convenience function that combines js_newobject and js_defineproperty. obsolete ? starting with gecko 8.0 (firefox 8.0 /...
JS_NewRuntime
int32_t maxbytes, jsusehelperthreads usehelperthreads, jsruntime *parentruntime = nullptr); // deprecated since jsapi 32 name type description maxbytes uint32 maximum number of allocated bytes after which garbage collection is run. maxnurserybytes uint32 nursery size in bytes. maxnurserybytes is rounded down to a multiple of chunk size.
added in spidermonkey 38 parentruntime jsruntime * the topmost parent or nullptr .
added in spidermonkey 31 description js_newruntime initializes the javascript runtime environment. call js_newruntime before making any other api calls except js_init. js_newruntime allocates memory for the jsruntime and initializes certain internal runtime structures. maxbytes specifies the numb...
...s, js_newruntime returns a pointer to the newly created runtime, which the caller must later destroy using js_destroyruntime. otherwise it returns null. ...
... created runtime, which the caller must later destroy using js_destroyruntime. otherwise it returns null. ...
...turns null. notes ordinarily, js_newruntime should be the first jsapi call in an application, and js_destroyruntime and js_shutdown should be the last ones. ...
JS_RemoveRootRT
unregisters a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. syntax jsbool js_removerootrt(jsruntime *rt, void *rp); name type description rt jsruntime * pointer to the runtime with which the root was registered. rp void *
address of the pointer to no longer protect. this must have been passed to one of js_
addroot, js_
addnamedroot, or js_
addnamedrootrt earlier. description js_removerootrt removes the gc thing that rp points to from the list of gc things that are protected from garbage collection. rp is thus a pointer to a pointer to a js double, string, or object. do not pass a pointer to a js double, string, or obj...
...er to a js double, string, or object. ...
...ouble, string, or object. ...
... object. ...
JS_SetElement
assign a value to a numeric property of an object. ...
...the element. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to modify, commonly an array object. index uint32_t index number of the element to set. v js::handlevalue or js::handleobject or js::handlestring or int32_t or uint32_t or double the value to assign to the element.
added in spidermonkey 31 vp js::mutablehandlevalue in/out parameter. *vp is the value to assign to the element. js_setelement ordinarily leaves *vp unchanged, but a jsclass.
addproperty hook or non-default setter may modify it. obsolete since jsapi 29 description js_setelement assigns a value to a numeric property of an object. it behaves like the javascript expression obj[index]...
...etter may modify it. obsolete since jsapi 29 description js_setelement assigns a value to a numeric property of an object. it behaves like the javascript expression obj[index] = v. ...
... success, js_setelement returns true. on error or exception, js_setelement returns false. ...
JS_SetOptions
mber ["filename"] option supported for the xul preprocessor and kindred beasts. mxr id search for jsoption_atline jsoption_xml obsolete since jsapi 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags. mxr id search for jsoption_xml jsoption_allow_xml
added in spidermonkey 15 if this is off, e4x syntax isn't supported no matter what version number is set. mxr id search for jsoption_allow_xml jsoption_moar_xml
added in spidermonkey 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags. only used if jsoption_allow_xml is set. mxr id s...
...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, prevent 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 spidermonkey 1.8 disallow function () {} in statement context, per ecma-262 edition 3. this behavior is the default in releases where this option has been removed. ...
... where n is the length of the input string. mxr id search for jsoption_relimit jsoption_anonfunfix
added in spidermonkey 1.8 disallow function () {} in statement context, per ecma-262 edition 3. this behavior is the default in releases where this option has been removed. mxr id search for jsoption_anonfunfix jsoption_jit obsolete since jsapi 11
added in spidermonkey 1.8.1 enables the jit compilation of code in the context. note that you may currently (jan 2009) experience bugs with this option enabled. ...
...he default in releases where this option has been removed. mxr id search for jsoption_anonfunfix jsoption_jit obsolete since jsapi 11
added in spidermonkey 1.8.1 enables the jit compilation of code in the context. note that you may currently (jan 2009) experience bugs with this option enabled. mxr id search for jsoption_jit jsoption_no_script_rval
added in spidermonkey 1.8.1 by setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to js_executescript. mxr id search for jsoption_no_script_rval jsoption_unrooted_global
added in spidermonkey 1.8.1 instructs the garbage collector not to consider the context's global object a root. the application must ensure th...
JS_SetProperty
bject. syntax bool js_setproperty(jscontext *cx, js::handleobject obj, const char *name, js::handlevalue v); bool js_setucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::handlevalue v); bool js_setpropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue v); //
added in spidermonkey 1.8.1 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. obj js::handlevalue object to which the property to set belongs. name or id const char * or const char16_t *or js::han...
...r id const char * or const char16_t *or js::handleid name of the property to set. namelen size_t (only in js_setucproperty) the length of name in characters; or -1 to indicate that name is null-terminated. v js::handlevalue in/out parameter. *vp is the value to assign to the property. ordinarily this function leaves v unchanged, but it is possible for a jsclass.
addproperty hook or a non-default 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 me...
...l 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 below. the new property is jsprop_enumerate. otherwise, if the lookup found a read-only property or obj non-extensible, nothing happens, but this is not an error. in strict mode, a warning is issued. otherwise, if obj has an own property with the given name, then the existing property's value is set as described below. creation of new properties one of the cases above ...
... described below. creation of new properties one of the cases above involves creating a new own property on obj. the name of the new property is given by name or id. the initial stored value of the new property is undefined. its getter and setter are the jsclass.getproperty and setproperty hooks of obj's class, and its property attributes are exactly jsprop_enumerate. after the new property is
added, the jsclass.
addproperty hook is called with the arguments (cx, obj, id, &v). this hook may assign to v. if the hook succeeds and the property has a stored value, then the value left in v by the
addproperty hook becomes the stored value of the property. setting the value. two of the cases above can involve setting the value of a new or existing property of obj. this is done as follows. if the...
SpiderMonkey 24
s in an interpreter, as in previous 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 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...
...rateresolvedstandardclasses js_getglobalobject js_setcstringsareutf8 ...list other deleted apis... api changes break out and discuss all api changes here... jsoption_strict has been renamed to jsoption_extra_warnings. js_setversion has been removed, js version is now set on the compartment instead of context. js_getprototype, takes context as first argument js_encodestringtobuffer takes
add context as first argument, js_newruntime
adds a js_[use|no]_helper_threads flag delete property in jsclass definitions now use js_deletepropertystub 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 cha...
... known issues detail any known issues here... future direction ...insert details on future plans... spidermonkey embedders should be aware that mozilla has no plans to keep the jsapi, nor the jsdbgapi stable for embedders. we have chosen to concentrate on performance and correctness as primary concerns instead. ...
...nce and correctness as primary concerns instead. the team is considering the removal of tinyids js_threadsafe is going away, with future versions supporting only thread-safe builds a new debugging api is on the way to replace jsd. release notes errata this is a list of changes which need to be made to the release notes asap. feel free to fix any problems you spot -- this is a wiki! don't
add anything here -- this is for after the release notes are completed. :-) ...
Shell global objects
ther if its set bits are a superset of the other's. thus, a principal of 0 subsumes nothing, while a principals of ~0 subsumes all other principals. the absence of a principal is treated as if its bits were 0xffff, for subsumption purposes. if this property is omitted, supply no principal. createmappedarraybuffer(filename, [offset, [size]]) create an array buffer that mmaps the given file.
addpromisereactions(promise, onresolve, onreject) calls the js::
addpromisereactions jsapi function with the given arguments. getmaxargs() return the maximum number of supported args for a call. objectemulatingundefined() return a new object obj for which typeof obj === "undefined", obj == null and obj == undefined (and vice versa for !=), and toboolean(obj) === false. iscachingenabled() return...
...tecodes. dissrc([fun/code]) disassemble functions with source lines. notes([fun]) show source notes for functions. stackdump(showargs, showlocals, showthisprops) tries to print a lot of information about the current stack. similar to the dumpjsstack() function in the browser. arrayinfo(a1, a2, ...) report statistics about arrays. functions available only if enable_intl_api is defined
addintlextras(obj)
adds various not-yet-standardized intl functions as properties on the provided object (this should generally be intl itself). the
added functions and their behavior are experimental: don't depend upon them unless you're willing to update your code if these experimental apis change underneath you. functions available if --fuzzing-safe is not specified clone(fun[, scope]) clon...
...ns available only if js_gc_zeal is defined gczeal(level, [n]) specifies how zealous the garbage collector should be. some of these modes can be set simultaneously, by passing multiple level options, e.g. "2;4" will activate both modes 2 and 4. modes can be specified by name or number. ...
... deterministicgc(true|false) if true, only allow determinstic gcs to run. functions available only if js_trace_logging is defined starttracelogger() start logging the mainthread. note: tracelogging starts automatically. disable it by setting environment variable tloptions=disablemainthread stoptracelogger() stop logging the mainthread. functions available only in nightly build object
address(obj) return the current
address of the object. for debugging only--this
address may change during a moving gc. shared
address(obj) return the
address of the shared storage of a sharedarraybuffer. functions available only in debug build dumpobject() dump an internal representation of an object. dumpstringrepresentation(str) print a human-readable description of how the string str is ...
Exploitable crashes
p you determine if a crash is exploitable, find crashes which are exploitable, and to fix exploitable crashes. what is an exploitable crash? a crash report from your debugger, your os, or mozilla crash-stats can tell you a lot about whether or not a crash is potentially exploitable. you want to look primarily for three things, in order: look at the top frame of the stack trace. if you see a hex
address such as 0x292c2830 rather than a function name such as nslistboxbodyframe::getrowcount at the top of the stack, a bug has caused the program 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 0x000...
...bug has caused the program 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 prevented 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-recurs...
...the stack trace. if it's over 300 functions long, it's likely to be a too-much-recursion crash. like null dereferences, these crashes are not exploitable. any other crash where firefox tries to use memory it does not have access to indicates some kind of memory safety bug. these crashes can often be exploited to run arbitrary code, but you can't be as certain as in the case where you see a bogus
address at the top of the stack in step 1. finding exploitable crashes exploitable crashes are most often discovered through normal testing and usage, when developers recognize a crash stack in gdb or submitted to a bug as exploitable.
additionally, mozilla developers make heavy use of two tools in particular to find exploitable situations before they show up as exploitable crash reports. the first t...
...there is an mdn article documenting its use with mozilla projects. the other tool is valgrind. ...
Secure Development Guidelines
r (eip) points to register being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory saved return
addr or function pointer get altered introduction: gaining control (3) common issues used to gain control buffer overflows format string bugs integer overflows/underflows writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation could save you without knowing it examples: if it do...
... } $ ./test 0x8fe0103 un-initialized data: prevention initialize your variables! ...
...ed data: prevention initialize your variables! ...
...sastring common read-only methods length() isempty() equals() common methods for modifying the string assign() append() insert() truncate() checking return values often causes problems return value not handled certain cases not handled or interpreted incorrectly double meaning malloc() can return a pointer or null, but null by itself is a valid
address checking return values int main() { int fds[2]; pipe(fds); write(fds[0], "data", 4); } the pipe() return value is not checked if pipe() fails, fds is not initialized write to un-initialized file descriptor checking return values check all return values—no matter how unlikely the api failure for example: close() can fail and leak file descriptor se...
Mork
those of tables. however, since the meta-row of a row never appears to be used, i will generally use 'meta-row' to refer to the meta-row of a table, unless otherwise qualified. dictionaries a dictionary establishes a series of aliases. if inside the meta-dictionary, the only cell we care about is if the key is 'a' (for atom scope). this value is used to establish which dictionary the aliases are
added to. most files will have just two dictionaries: the column scope dictionary ('c') and the value scope dictionary ('v', the default). the keys are hexadecimal numbers starting at 0x80, because the values less than 0x80 are theoretically their representative ascii values. tables a table is set of rows, potentially with a meta-row. the table id is specified using the mid at the beginning of the ta...
...tains arbitrary properties for the entire table just like a normal row. for example, the message summary format files use a table for each thread, where the meta-rows represent information about the thread in general. the last important point about tables is the meaning of the minuses. a minus before the table id indicates that all the rows currently stored in the table should be removed before
adding more rows. a minus sign before a row or rowreference indicates that said row should be removed from the table. rows for the most part, a row should not be seen outside of a table; the only time i have seen one outside a table is for table meta-rows. the first mid, as you should expect by now, is the row id, with the scope being an important part of the id, in that 1:scope1 is not the same row ...
...ws. the first mid, as you should expect by now, is the row id, with the scope being an important part of the id, in that 1:scope1 is not the same row as 1:scope2. if the scope is not specified, then it is the default scope of the table (if it has one) or 'r' otherwise. these row ids are global, even if defined in a table. ...
...t part of the id, in that 1:scope1 is not the same row as 1:scope2. if the scope is not specified, then it is the default scope of the table (if it has one) or 'r' otherwise. these row ids are global, even if defined in a table. indeed, defining a row in a table is a shortcut for both defining a row and
adding the row to the table. the presence of an initial minus means to delete all cells before
adding new cells. a minus after the mid indicates that the next cell should be deleted. i haven't seen that case though, so it may not be an issue in practice. the rowreference is a mid that refers to a specific row. if it occurs in a table, you can treat it as
adding that row to a table; in a meta-table, it is the same as making that row the meta-row of the table. groups, a.k.a. changesets a group i...
Manipulating bookmarks using Places
finding the folder containing an item if you need to know what folder contains an item (this can be especially handy after using nsinavbookmarksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. var parentfolderid = bmsvc.getfolderidforitem(newbkmkid); observing changes ...
...marksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. ...
...l need to create an nsinavbookmarkobserver object and use the nsinavbookmarksservice.
addobserver() and nsinavbookmarksservice.removeobserver() methods. note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method. ...
...(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my
add-on is loaded onload: function() { bmsvc.
addobserver(myext_bookmarklistener, false); }, // this function is called when my
add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function() { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome - bookm...
Avoiding leaks in JavaScript XPCOM components
e longest. reference counting reference counting is a simple solution to the problem of allowing multiple owners to influence the lifetime of an object. in this strategy, the object has a member that is the number of other objects that "own" it. when this count goes to zero, the object destroys itself. this is the strategy used by xpcom, partly because it can be used through a very simple api,
addref and release. in c++, we use nscomptr to help manage ownership, and we use macros to implement
addref and release. the major problem with reference counting is that it can cause leaks through ownership cycles. if object a owns object b, and object b owns object a, then neither one will ever be destroyed. this tends to be solved in one of two ways: either break the cycle at some point or ensure ...
...t marked and returns the memory they used to the heap. garbage collection (at least when the term is not used to refer to lesser algorithms like reference counting) is pretty good at freeing memory that should be freed. however, in a fully garbage-collected system the programmer can still create leaks by leaving objects reachable that are no longer needed. for example, if an object's constructor
adds the object to a list that is reachable from a global variable and nothing ever removes it from the list, the object will never be destroyed since it is always reachable from the list. memory management in xpcom and javascript javascript code that uses xpcom through xpconnect uses two different memory management models. javascript uses garbage collection. xpcom uses reference counting. authors ...
...pt) would just work the other way around. and in the simple case, they do. the wrapper owns a reference to the native object that it wraps, and the wrapper object is kept alive by the javascript garbage collector. this problem is only in versions of mozilla prior to mozilla 1.8. however, it's not quite that simple, because of the convention that dom nodes can have arbitrary javascript properties
added to them by the programmer. these properties have to be preserved across garbage collections, even if the wrapper is not reachable from any garbage collection root, since the javascript programmer could access the dom node again the same way he did the first time, and would then expect the
added properties to still be there. we currently implement this by making the wrapper a root in the javascr...
...(but since service is a global variable, just fixing the cycle doesn't fix the leak.) don't store short-lived objects as javascript properties of short-lived dom nodes i mentioned earlier that, in versions of mozilla before 1.8, setting arbitrary javascript properties on el...
How to build an XPCOM component in JavaScript
this is a "hello world" tutorial for creating an xpcom component in javascript. this tutorial does not describe how and why xpcom works the way it does, or what every bit of the example code does. that's been detailed elsewhere. this tutorial will show you what you need to do to get a component working in as few and as simple steps as possible. implementation this example component will expose a single method, which returns the string "hello world!". defining the interface if you want to use your component in other xpcom components, you must define the interfaces that you want exposed. ...
...y in which you unpacked the gecko sdk. {sdk_dir}/bin/xpidl -m typelib -w -v -i {sdk_dir}/idl -e helloworld.xpt helloworld.idl note: on windows you must use forward slashes for the include path. note: (the -i flag is an uppercase i, not a lowercase l.) this will create the typelib file helloworld.xpt in the current working directory. for a new component in firefox/thunderbird/b2g if you are
adding a new feature to applications in the mozilla-central repository, you can create a makefile listing the idl files and the build system will automatically generate the typelib. a sample makefile.in # this source code form is subject to the terms of the mozilla public # license, v. 2.0. if a copy of the mpl was not distributed with this # file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
... factory (an object implementing nsifactory). if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(iid)| in its createinstance(). _xpcom_factory: { ... }, // [optional] an array of categories to register this component in. _xpcom_categories: [{ // each object in the array specifies the parameters to pass to // nsicategorymanager.
addcategoryentry(). 'true' is passed for both // apersist and areplace params. category: "some-category", // optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' is not // specified, ...
... // optional, defaults to the object's classdescription entry: "entry name", // optional, defaults to the object's contractid (unless 'service' is specified) value: "...", // optional, defaults to false. when set to true, and only if 'value' is not // specified, the concatenation of the string "service," and the object's contractid // is passed as avalue parameter of
addcategoryentry. service: true }], // queryinterface implementation, e.g. using the generateqi helper (remove argument if skipped steps above) queryinterface: xpcomutils.generateqi([components.interfaces.nsihelloworld]), // optional, but required if you want your component to be exposed to dom classinfo: xpcomutils.generateci({classid: components.id("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxx...
XPCOM changes in Gecko 2.0
erve profile-after-change instead. typically, extensions observed app-startup because in the past, you needed to load for app-startup in order to be able to register to observe profile-after-change in the first place. as of gecko 1.9.1, this is no longer the case, however; you can now register for profile-after-change using the category manager. see receiving startup notifications for details. to
add a category entry, you must insert the following line to your chrome.manifest: category profile-after-change mycomponent @foobar/mycomponent;1 important: formerly, the contract id of the category entry was prefixed with "service," if the component was implemented as a service. this prefix needs to be dropped when migrating to chrome.manifest. changed category names the xpcom category manager is u...
...this was necessary in order to ensure that any components that should no longer be available are disposed of properly, and to re-register everything, loading any new components that may be nee...
...component registrations during startup. xpcnativewrapper changes you can't disable xpcnativewrappers from your manifest specifying xpcnativewrappers=no in your manifest (that is, xpcnativewrapper automation) is no longer supported. this was always intended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use xpcnativewrappers. if your
add-on depends upon xbl bindings attached to content objects—for example, the ability to call functions or get and set properties created by the xbl binding—you will need to use the xpcnativewrapper property wrappedjsobject to access wrapped objects. if you need to be able to call functions or access properties defined by web content, you'll need to do this as well. this may be the case if, for e...
... content objects—for example, the ability to call functions or get and set properties created by the xbl binding—you will need to use the xpcnativewrapper property wrappedjsobject to access wrapped objects. if you need to be able to call functions or access properties defined by web content, you'll need to do this as well. this may be the case if, for example, you've written an extension that
adds a delete button to a web mail service, and the service defines a window.delete() function that you need to call. if, on the other hand, all you're doing with content is accessing dom methods and properties, you've never needed to be using xpcnativewrappers=no in the first place, and should simply remove it from your manifest. miscellaneous xpcnativewrapper changes using the delete operator on "...
Creating XPCOM components
work. for example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with mozilla - prompts a discussion of the relationship between components and modules, of xpcom interfaces, and of the registration process in general. note: in general, you should try to avoid having to create xpcom components.
add-ons should try to use the new
add-on sdk as much as possible; however, there may be cases when it's unavoidable. note:this article describes a method that uses xpidl but you should use webidl instead. preface who should read this book organization of the tutorial following along with the examples conventions acknowledgements an overview of xpcom the xpcom solution gecko compone...
...mplementing weblock declaration macros representing return values in xpcom xpidl code generation getting the weblock service from a client implementing the iweblock interface the directory service modifying paths with nsifile manipulating files with nsifile using nsilocalfile for reading data processing the white list data iweblock method by method lock and unlock
addsite removesite setsites getnext getsites hasmoreelements finishing the component using frozen interfaces copying interfaces into your build environment implementing the nsicontentpolicy interface receiving notifications implementing the nsicontentpolicy uniform resource locators checking the white list creating nsiuri objects building the weblock ui ...
...ing frozen interfaces copying interfaces into your build environment implementing the nsicontentpolicy interface receiving notifications implementing the nsicontentpolicy uniform resource locators checking the white list creating nsiuri objects building the weblock ui user interface package list client code overview xul the xul document the locking ui site
adding ui weblock.xul overlaying new user interface into mozilla weblockoverlay.xul other resources weblock.css image resources packaging weblock component installation overview archiving resources the weblock installation script the weblock trigger script distributing your component appendix a - setting up the gecko sdk downloading and setting the sdk buildin...
...this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or...
XPCOM hashtable guide
of the detailed xpcom hashtable guide. everything you need to know is probably on this page. also note that mfbt/hashtable.h now exists. it is a lot faster than the xpcom hashtables due to more inlining and templating, and the api is arguably better. what is a hashtable? a hashtable is a data construct that stores a set of items. each item has a key that identifies the item. items are found,
added, and removed from the hashtable by using the key. hashtables may seem like arrays, but there are important differences: array hashtable keys: integer: arrays are always keyed on integers, and must be contiguous. any type: almost any datatype can be used as key, including strings, integers, xpcom interface pointers, iids, and almost anything else. keys can be dis...
...u can store entries with keys 1, 5, and 3000). lookup time: o(1): lookup time is a simple constant o(1): lookup time is mostly-constant, but the constant time can be larger than an array lookup sorting: sorted: stored sorted; iterated over in a sorted fashion. unsorted: stored unsorted; cannot be iterated over in a sorted manner. inserting/removing: o(n):
adding and removing items from a large array can be time-consuming o(1):
adding and removing items from hashtables is a quick operation wasted space: none: arrays are packed structures, so there is no wasted space. some: hashtables are not packed structures; depending on the implementation, there may be significant wasted memory. in their implementation, hashtables take the k...
...n use the hash to find the location in the hashtable. good hashtable implementations will automatically resize the hashtable in memory if extra space is needed, or if too much space has been allocated. when should i use a hashtable? hashtables are useful for sets of data that need swift random access; with non-integral keys or non-contiguous integral keys; or where items will be frequently
added or removed. hashtables should not be used for sets that need to be sorted; very small datasets (less than 12-16 items); data that does not need random access. in these situations, an array, a linked-list, or various tree data structures are more efficient. which hashtable should i use? the appropriate hashtable class to use depends solely on the data type. the template specializatio...
...ringhashkey> hashtable api the hashtable classes all expose the same basic api. there are three key methods, get, put, and remove, which retrieve entries from the hashtable, write entries into the hashtable, and remove entries from the hashtable respectively. the hashtables that hold references to pointers (nsrefptrhashtable and nsinterfacehashtable) also have getweak methods that return non-
addrefed pointers. all of these hashtable classes can be iterated over via the iterator class and cleared via the clear method. ...
IAccessibleTable2
unselects all previously 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, the cells in those columns are also selected. 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. selectedcells() returns a list of accessibles currently selected. [propget] hresult selectedcells( [out, size_is(, nselectedcells,)] iunknown cells, [out] long nselectedcel...
...selects a row and unselects all previously 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 rows are also selected. 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 acc...
...ull. s_ok. unselectcolumn() unselects one column, leaving other selected columns selected (if any). the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full column of cells the behavior should be as follows: the entire column of cells for the specified column is unselected. if any of the cells in the selected column span
additional columns, the cells in those columns are also unselected. hresult unselectcolumn( [in] long column ); parameters column 0 based index of the column to be unselected. return value e_invalidarg if bad [in] passed. s_ok. unselectrow() unselects one row, leaving other selected rows selected (if any). the behavior should mimic that of the application, but for those applications which do not...
...idarg if bad [in] passed. s_ok. unselectrow() unselects one row, leaving other selected rows selected (if any). the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full row of cells the behavior should be as follows: the entire row of cells for the specified row is unselected. if any of the cells in the selected row span
additional rows, the cells in those rows are also unselected. hresult unselectrow( [in] long row ); parameters row 0 based index of the row to be unselected. return value e_invalidarg if bad [in] passed. s_ok. see also iaccessibletable iaccessibletablecell ...
IAccessibleText
pplication developer was not satisfied with how screen readers have handled the reading of sentences this boundary type could be implemented and screen readers could use the application's version of a sentence rather than the screen reader's. the rest of the boundary types must be supported. this enum is used in textbeforeoffset(), textatoffset(), and textafteroffset(). ...
...endoffset offset of first character after new selection() (0 based). return value e_invalidarg if bad [in] passed. s_ok. attributes() returns text() attributes. [propget] hresult attributes( [in] long offset, [out] long startoffset...
...endoffset offset of first character after new selection() (0 based). return value e_invalidarg if bad [in] passed. s_ok. attributes() returns text() attributes. [propget] hresult attributes( [in] long offset, [out] long startoffset, [out] long ...
...] bstr text ); [propget] hresult textatoffset([in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); [propget] hresult textbeforeoffset([in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); methods
addselection()
adds a text() selection(). hresult
addselection( [in] long startoffset, [in] long endoffset ); parameters startoffset starting offset ( 0 based). endoffset offset of first character after new selection() (0 based). return value e_invalidarg if bad [in] passed. s_ok. attributes() returns text() attributes. [propget] hresult attributes( [in] long offset, [out] long startoffset, [out] long endoffset, [out] bstr textattribu...
amIInstallTrigger
); deprecated since gecko 2.0 constants retained for backwards compatibility. constant value description skin 1 locale 2 content 4 package 7 methods enabled() tests if installation is enabled. boolean enabled(); parameters none. ...
...ption skin 1 locale 2 content 4 package 7 methods enabled() tests if installation is enabled. boolean enabled(); parameters none. return value install() starts a new installation of a set of
add-ons. boolean install( in nsivariant aargs, in amiinstallcallback acallback optional ); parameters aargs the
add-ons to install. this should be a js object, each property is the name of an
add-on to be installed. the value of the property should either be a string url, or an object with the following properties: url for the
add-on's url iconurl for an icon for the
add-on hash for a hash of the
add-on. acallback optional a callback to call as each installation succeeds or fails. return value ...
...alled. the value of the property should either be a string url, or an object with the following properties: url for the
add-on's url iconurl for an icon for the
add-on hash for a hash of the
add-on. acallback optional a callback to call as each installation succeeds or fails. return value true if the installations were successfully started. installchrome starts installing a new
add-on. this method is deprecated, please use install() in the future. boolean installchrome( in pruint32 atype, in astring aurl, in astring askin ); parameters atype unused, retained for backwards compatibility. aurl the url of the
add-on. askin unused, retained for backwards compatibility. return value true if the installation was successfully started. startsoftwareupdate star...
...deprecated, please use install() in the future. boolean installchrome( in pruint32 atype, in astring aurl, in astring askin ); parameters atype unused, retained for backwards compatibility. aurl the url of the
add-on. askin unused, retained for backwards compatibility. return value true if the installation was successfully started. startsoftwareupdate starts installing a new
add-on. boolean startsoftwareupdate( in astring aurl, in print32 aflags optional ); parameters aurl the url of the
add-on. aflags optional unused, retained for backwards compatibility. return value true if the installation was successfully started. updateenabled tests if installation is enabled. boolean updateenabled(); parameters none. return value ...
imgIContainer
ko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: ?????????????????????????????????????. ...
... clear() the frame's area, revealing bg. obsolete since gecko 2.0 kdisposerestoreprevious 3 restore the previous(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. ...
...g 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 gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this 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. void
addrestoredata( [array, size_is(acount), const] in char data, in unsigned long acount ); parameters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some ...
...meters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this 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.
adds to the end of the list of frames. void appendframe( in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength ); parameters ax missing description ay missing description awidth missing description aheight missing description ...
mozIStorageFunction
last changed in gecko 1.9.1.4 (firefox 3.5.4) inherits from: nsisupports method overview nsivariant onfunctioncall(in mozistoragevaluearray afunctionarguments); methods onfunctioncall() the implementation of the function. ...
... last changed in gecko 1.9.1.4 (firefox 3.5.4) inherits from: nsisupports method overview nsivariant onfunctioncall(in mozistoragevaluearray afunctionarguments); methods onfunctioncall() the implementation of the function. ...
...nscomptr<mozistoragefunction> func = new squarefunction(); ns_ensure_true(func, ns_error_out_of_memory); nsresult rv = dbconn->createfunction( ns_literal_cstring("square"), 1, func ); ns_ensure_success(rv, rv); // run some query that uses the function. nscomptr<mozistoragestatement>...
.... nscomptr<mozistoragefunction> func = new squarefunction(); ns_ensure_true(func, ns_error_out_of_memory); nsresult rv = dbconn->createfunction( ns_literal_cstring("square"), 1, func ); ns_ensure_success(rv, rv); // run some query that uses the function. nscomptr<mozistoragestatement> stmt; rv = dbconn->createstatement(ns_literal_cstring( "select square(value) from some_table"), getter_
addrefs(stmt) ); ns_ensure_success(rv, rv); prbool hasmore; while (ns_succeeded(stmt->executestep(&hasmore)) && hasmore) { // handle the results } see also storage introduction and how-to article mozistorageconnection database connection to a specific file or in-memory data storage mozistoragestatement create and execute sql statements on a sqlite database. mozistoragevaluearray wraps an ar...
nsIAbCard
the nsiabcard interface is used to represent and manipulate cards in the
addressbook. following a huge refactoring of the
address book code, most of the documentation below is out of date. properties aren't stored anymore on the card, except for a handful of them. complex properties are expected to be accessed through a call to getproperty. see //github.com/realityripple/uxp/blob/master//mailnews/
addrbook/public/nsiabcard.idl for more details. inherits from: nsisupports method overview astring getcardvalue(in string name) void setcardvalue(in string attrname, in astring value) void copy(in nsiabcard srccard) boolean equals(in nsiabcard card) string converttobase64encodedxml() astring converttoxmlprintdata() string conve...
... workphone astring homephone astring faxnumber astring pagernumber astring cellularnumber astring workphonetype astring homephonetype astring faxnumbertype astring pagernumbertype astring cellularnumbertype astring home
address astring home
address2 astring homecity astring homestate astring homezipcode astring homecountry astring work
address astring work
address2 astring workcity astring workstate astring workzipcode astring workcoun...
...ring workcountry astring jobtitle astring department astring company astring aimscreenname astring anniversaryyear astring anniversarymonth astring anniversaryday astring spousename astring familyname astring default
address astring category astring webpage1 astring used for the contact's work web page webpage2 astring used for the contact's home web page birthyear astring birthmonth astring birthday astring custom1 astring custom2 astring custom3 astring ...
...purposes. using the firstname, lastname and the displayname. we allow the caller to cache the pref value, so we don't have to go to prefs every time. astring generatename(in long agenerateformat,[optional] in nsistringbundle abundle) parameters agenerateformat the format to present the name in: 0 generated name is displayname 1 lastfirst, formatted following lastfirstformat property in
addressbook.properties. 2 firstlast, formatted following firstlastformat property in
addressbook.properties. abundle an optional parameter that is a pointer to a string bundle that holds:
addressbook.properties. if this bundle is not supplied, then the function will obtain the bundle itself. if cached by the caller and supplied to this function, then performance will be improved over many calls. ...
nsIAnnotationService
removed at application exit. expire_weeks 2 for...
...is not bookmarked. this means that if you create an annotation on an unvisited uri, it will get deleted when the browser shuts down. otherwise, uris can exist in history as annotations but the user has no way of knowing it, potentially 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 previous 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...
...is not bookmarked. this means that if you create an annotation on an unvisited uri, it will get deleted when the browser shuts down. otherwise, uris can exist in history as annotations but the user has no way of knowing it, potentially 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. setitemannotationstring() this method sets an annotation for given item by taking a string as input value, overwriting any previous annotation with the same url/name. it is your job to namespace your annotation names. use the form "namespace/value", so your ...
...notations will stay as-is. if you don't want them any more, use removepageannotations() on that uri. void copyitemannotations( in long long asourceitemid, in long long adestitemid, in boolean aoverwritedest ); parameters asourceitemid source item. adestitemid destination item. aoverwritedest if you want to overwrite existing annotation, set this parameter to true or else false.
addobserver() this method
adds an annotation observer. the annotation service will keep an owning reference to the observer object. void
addobserver( in nsiannotationobserver aobserver ); parameters aobserver annotation observer. removeobserver() this method removes an annotaton observer previously registered by
addobserver() method. void removeobserver( in nsiannotationobserver aobse...
nsIApplicationCache
e.opensession() method, to access the cache's entries. each entry in the cache can be marked with a set of types, specified in the constants section. all application caches with the same group id belong to a cache group. each group has one "active" cache that will service future loads. inactive caches are removed from the cache when no longer referenced. ...
...ong the disk usage of the application cache, in bytes. read only. constants constant value description item_manifest 1 this item is the application manifest. item_explicit 2 this item was explicitly listed in the application manifest. item_implicit 4 this item was navigated to in a top level browsing context, and named this cache's group as its manifest. item_dynamic 8 this item was
added to the cache using the dynamic scripting api. item_foreign 16 this item was listed in the application manifest, but named a different cache group as its manifest. item_fallback 32 this item was listed as a fallback entry. item_opportunistic 64 this item matched an opportunistic cache namespace and was cached for that reason. methods activate() makes this cache the active application ca...
...lback 32 this item was listed as a fallback entry. item_opportunistic 64 this item matched an opportunistic cache namespace and was cached for that reason. methods activate() makes this cache the active application cache for this group. future loads associated with this group will come from this cache. other caches from this cache group will be deactivated. void activate(); parameters none.
addnamespaces()
add a set of namespace entries to the application cache. void
addnamespaces( in nsiarray namespaces ); parameters namespaces an nsiarray of nsiapplicationcachenamespace objects describing the namespaces to
add to the cache. discard() discards this application cache. this removes all resources it has cached. if this is the active application cache for the group, the group is remov...
...'s types. see constants for a list of types. initashandle() init this application cache instance to just hold the group id and the client id to work just as a handle to the real cache. used on content process to simplify the application cache code. void initashandle( in acstring groupid, in acstring clientid ); parameters groupid missing description clientid missing description markentry()
adds item types to a given entry. void markentry( in acstring key, in unsigned long typebits ); parameters key the key for the cache entry to which to
add types. typebits a bit field indicating the types to
add to the entry. see constants for a list of types. unmarkentry() removes types from a given entry. if the resulting entry has no types left, the entry is removed. void unmarkentry( in a...
nsIApplicationUpdateService
ps/update/nsiupdateservice.idlscriptable this interface describes a global application service that handles performing background update checks. it also provides utilities for selecting and downloading update patches. ...
...and the platform the application is running on. read only. canupdate boolean true if the update service is able to download and install updates. this depends on whether or not the current user has the necessary access privileges for the install directory. read only. obsolete since gecko 1.9.1.7pre isdownloading boolean true if a download is in progress, otherwise false. read only. ...
...pplication is running on. read only. canupdate boolean true if the update service is able to download and install updates. this depends on whether or not the current user has the necessary access privileges for the install directory. read only. obsolete since gecko 1.9.1.7pre isdownloading boolean true if a download is in progress, otherwise false. read only. ...
...ead only. obsolete since gecko 1.9.1.7pre isdownloading boolean true if a download is in progress, otherwise false. read only. methods
adddownloadlistener()
adds a listener that receives progress and state information about the update that is currently being downloaded. this information is most commonly used to update a user interface that informs the user as to the status of an update. void
adddownloadlistener( in nsirequestobserver listener ); parameters listener an object implementing nsirequestobserver and optionally nsiprogresseventsink that will be notified of state and progress information as the update is downloaded. downloadupdate() starts downloading a software update. astring downloadupdate( in nsiupdate update, in boolean background ); parameters update an nsiu...
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 prevent a drag from starting,
adding or removing data and flavors, or preventing the drop. ...
...starting,
adding or removing data and flavors, or preventing 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
added to each window (as appropriate).
adding them to the first window does not enable them for every window. if more than one implementation is set for a window, the hooks will be called in the order they are
added. ...
...each hook can only be called once per user action/api. not all hooks are guaranteed to be called. if there are multiple hooks set for a window, any of them has an opportunity to cancel the action so no further processing will occur. if any errors occur (without setting the boolean result) the default action will occur. ...
...each hook can only be called once per user action/api. not all hooks are guaranteed to be called. if there are multiple hooks set for a window, any of them has an opportunity to cancel the action so no further processing will occur. ...
nsIContentPrefService
use the asynchronous interface nsicontentprefservice2 instead. provides a way for extensions and browser code to save preferences for specific websites. preferences are saved as key/value pairs on a per-website basis. dom/interfaces/base/nsicontentprefservice.idlscriptable please
add a summary to this article. last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports implemented by: @mozilla.org/content-pref/service;1. ...
...y to this article. last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports implemented by: @mozilla.org/content-pref/service;1. ...
... nsivariant avalue); attributes attribute type description dbconnection mozistorageconnection the database connection to the content preferences database. ...
...iple callers should generally be
added to this unfrozen interface. also useful for testing the database creation and migration code. read only. grouper nsicontenturigrouper the component that the service uses to determine the groups to which uris belong. by default, this is the "hostname grouper," which groups uris by full hostname (in otherwords, by site). read only. methods
addobserver()
adds an observer that monitors a preference for changes. void
addobserver( in astring aname, in nsicontentprefobserver aobserver ); parameters aname the name of the preference to observe. you may specify null to
add a generic observer that is notified of all preference changes. aobserver the name of an object implementing nsicontentprefobserver that will receive no...
nsIContentPrefService2
ing is true, temporary private-browsing storage is used, and otherwise permanent storage is used. a context can be obtained from the window or channel whose content pertains to the preferences being modified or retrieved. callbacks the methods of callback objects are always called asynchronously. see nsicontentprefcallback2 for more information about callbacks. ...
...oid removeobserverforname(in astring name, in nsicontentprefobserver observer); void set(in astring domain, in astring name, in nsivariant value, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void setglobal(in astring name, in nsivariant value, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); methods
addobserverforname() registers an observer that will be notified whenever a preference with the given name is set() or removed. when a set() or remove method is called, observers are notified after the set() or removal completes but before method's callback is called. the service holds a strong reference to the observer, so the observer must be removed later to avoid leaking it. void
addobserverforna...
...n the preferences' domain. name the preferences' name. context the private-browsing context, if any. callback handleresult is called once for each preference. if no such preferences exist, handleresult is not called at all. getcachedbydomainandname() synchronously retrieves from the in-memory cache the preference with the given domain and name. in
addition to caching preference values, the cache also keeps track of preferences that are known not to exist. if the preference is known not to exist, the value attribute of the returned object will be undefined (nsidatatype.vtype_void()). if the preference is neither cached nor known not to exist, then null is returned, and get() must be called to determine whether the preference exists. nsicontentp...
... the private-browsing context, if any. callback optional handlecompletion is called when the operation completes. removeobserverforname() unregisters an observer for the given name. void removeobserverforname( in astring name, in nsicontentprefobserver observer ); parameters name the name for which the observer was registered. pass null if the observer was
added with a null name. observer the observer. set() sets a preference. void set( in astring domain, in astring name, in nsivariant value, in nsiloadcontext context, in nsicontentprefcallback2 callback optional ); parameters domain the preference's domain. name the preference's name. value the preference's value. context ...
nsIDNSService
sed with low, medium takes precedence. resolve_priority_low (1 << 3) the query is given lower priority. if used with medium, medium takes precedence. resolve_speculate (1 << 4) indicates request is speculative. speculative requests return errors if prefetching is disabled by configuration. resolve_disable_ipv6 (1 << 5) if this flag is set, only ipv4
addresses will be returned by asyncresolve() and resolve(). methods asyncresolve() begins off an asynchronous host lookup. a specified nsidnslistener is invoked when the resolution process is completed. nsicancelable asyncresolve( in autf8string ahostname, in unsigned long aflags, in nsidnslistener alistener, in nsieventtarget alistenertarget ); parameters ahostname the host ...
... be returned by asyncresolve() and resolve(). methods asyncresolve() begins off an asynchronous host lookup. a specified nsidnslistener is invoked when the resolution process is completed. nsicancelable asyncresolve( in autf8string ahostname, in unsigned long aflags, in nsidnslistener alistener, in nsieventtarget alistenertarget ); parameters ahostname the host name or ip-
address-literal to resolve. aflags a bitwise or of the resolve flag constants. alistener the listener to be notified when the result is available. alistenertarget optional parameter (may be null). if not null, this parameter specifies the nsieventtarget of the thread on which the listener's onlookupcomplete should be called. if this parameter is null, then onlookupcomplete wil...
...e dns service. void init(); parameters none. resolve() called to synchronously resolve a host name. warning this method may block the calling thread for a long period of time. it is extremely unwise to call this function on the user interface thread of an application. nsidnsrecord resolve( in autf8string ahostname, in unsigned long aflags ); parameters ahostname the host name or ip-
address-literal to resolve. aflags a bitwise or of the resolve flag constants. return value dns record corresponding to the given host name. exceptions thrown ns_error_unknown_host if host could not be resolved. shutdown() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) called to shutdown the dns service. any pending asynchronous r...
...teinstance(components.interfaces.nsidnsservice); let thread = components.classes["@mozilla.org/thread-manager;1"] .getservice(components.interfaces.nsithreadmanager).currentthread; let host = "www.mozilla.org"; let listener = { onlookupcomplete: function(request, record, status) { if (!components.issuccesscode(status)) { // handle error here return; } let
address = record.getnext
addrasstring(); console.log(host + " = " +
address); } }; dnsservice.asyncresolve(host, 0, listener, thread); ...
nsIDOMOfflineResourceList
the nsidomofflineresourcelist interface provides access to the application cache that allows web content's resources to be cached locally for use while offline. it includes methods for
adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list. dom/interfaces/offline/nsidomofflineresourcelist.idlscriptable please
add a summary to this article. ...
...ne. it includes methods for
adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list. dom/interfaces/offline/nsidomofflineresourcelist.idlscriptable please
add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports method overview void moz
add(in domstring uri); boolean mozhasitem(in domstring uri); domstring mozitem(in unsigned long index); void mozremove(in domstring uri); void swapcache(); void update(); attributes attribute type description mozitems nsidomofflineresourcelist the list of dynamically-managed entries in the offline resource list. re...
...tion cache state constants constant value description uncached 0 the object isn't associated with an application cache. idle 1 the application cache is not in the process of being updated. checking 2 the application cache manifest is being fetched and checked for updates. ...
...not in the process of being updated. checking 2 the application cache manifest is being fetched and checked for updates. downloading 3 resources are being downloaded to be
added to the cache. updateready 4 there is a new version of the application cache available. obsolete 5 the application cache group is now obsolete. methods moz
add()
adds an item to the dynamically managed entries. the resource will be fetched and
added to the application cache. void moz
add( in domstring uri ); parameters uri the uri of the resource to
add to the list. mozhasitem returns a boolean value indicating whether or not the specified uri represents a resource that's in the application cache's list. note: this method has been deprec...
nsIEventListenerService
ional] out unsigned long acount, [retval, array, size_is(acount)] out nsidomeventtarget aoutarray); void getlistenerinfofor(in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsieventlistenerinfo aoutarray); boolean haslistenersfor(in nsidomeventtarget aeventtarget, in domstring atype); void
addsystemeventlistener(in nsidomeventtarget target, in domstring type, in nsidomeventlistener listener, in boolean usecapture); void removesystemeventlistener(in nsidomeventtarget target, in domstring type, in nsidomeventlistener listener, in boolean usecapture); attributes attribute type description systemeventgroup nsidomev...
... an array of nsieventlistenerinfo objects describing the listeners. haslistenersfor() returns true if a event target has any listener for the given type. boolean haslistenersfor( in nsidomeventtarget aeventtarget, in domstring atype ); parameters aeventtarget the nsidomeventtarget for which to check if this has any listener for atype. atype an event name. ...
...listenerinfo objects describing the listeners. haslistenersfor() returns true if a event target has any listener for the given type. boolean haslistenersfor( in nsidomeventtarget aeventtarget, in domstring atype ); parameters aeventtarget the nsidomeventtarget for which to check if this has any listener for atype. atype an event name. ...
... type the event name to listen. listener the nsidomeventlistener which listens the event. ...
nsIMicrosummaryService
ed in gecko 1.9 (firefox 3) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/microsummary/service;1 as a service: var microsummaryservice = components.classes["@mozilla.org/microsummary/service;1"] .getservice(components.interfaces.nsimicrosummaryservice); method overview void
addgenerator(in nsiuri generatoruri); nsimicrosummary createmicrosummary(in nsiuri pageuri, in nsiuri generatoruri); nsisimpleenumerator getbookmarks(); nsimicrosummarygenerator getgenerator(in nsiuri generatoruri); nsimicrosummaryset getmicrosummaries(in nsiuri pageuri, in long long bookmarkid); nsimicrosummary getmicrosummary(in long long bookmarkid); ...
... createmicrosummary() create a microsummary for a given page uri and generator uri. nsimicrosummary createmicrosummary( ...
...kmarkid, in nsimicrosummary microsummary); nsimicrosummary refreshmicrosummary(in long long bookmarkid); void removemicrosummary(in long long bookmarkid); void setmicrosummary(in long long bookmarkid, in nsimicrosummary microsummary); methods
addgenerator() install the microsummary generator from the resource at the supplied uri. callable by content via nsisidebar.
addmicrosummarygenerator(). void
addgenerator( in nsiuri generatoruri ); parameters generatoruri the uri of the resource providing the generator. createmicrosummary() create a microsummary for a given page uri and generator uri. nsimicrosummary createmicrosummary( in nsiuri pageuri, in nsiuri generatoruri ); parameters pageuri the uri of the page to be summarized. gener...
...ll. otherwise, it'll asynchronously download the necessary information (the generator and/or page) before refreshing the microsummary. callers should check the content property of the returned microsummary object to distinguish between sync and async refreshes. if its value is null, then it's an async refresh, and the caller should register itself as an nsimicrosummaryobserver via nsimicrosummary.
addobserver() to find out when the refresh completes. nsimicrosummary refreshmicrosummary( in long long bookmarkid ); parameters bookmarkid the bookmark whose microsummary is being refreshed. return value returns the microsummary being refreshed. removemicrosummary() remove the current microsummary for the given bookmark. void removemicrosummary( in long long bookmarkid ); parameters ...
nsIMsgMessageService
nsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, out nsiuri aurl); void search(in nsimsgsearchsession asearchsession, in nsimsgwindow amsgwindow, in nsimsgfolder amsgfolder, in string asearchuri); nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string a
additionalheader); nsiuri streamheaders(in string amessageuri, in nsistreamlistener aconsumer, in nsiurllistener aurllistener [optional] in boolean alocalonly); boolean ismsginmemcache(in nsiuri aurl, in nsimsgfolder afolder, out nsicacheentrydescriptor acacheentry); nsimsgdbhdr messageuritomsghdr(in string uri); methods copymessage() pass in the uri for the messag...
...sion, in nsimsgwindow amsgwindow, in nsimsgfolder amsgfolder, in string asearchuri); parameters asearchsession the nsimsgsearchsession to use. amsgwindow nsimsgwindow for progress and status feedback amsgfolder nsimsgfolder asearchuri url of the search. streammessage() this method streams a message to the passed in consumer. it will also tack a
additionalheader onto the url (e.g., header=filter). the good thing about this method is that you can extract a standard representation of any message, no matter if they are emails, rss, news, blogs, etc. nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, ...
...od is that you can extract a standard representation of any message, no matter if they are emails, rss, news, blogs, etc. nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string a
additionalheader); parameters amessageuri uri of message to stream aconsumer generally, a stream listener listening to the message. the consumer has to be a stream listener and in your listener's ondataavailable method, you can write out the stream data to a local file or concatenate it to a string. amsgwindow nsimsgwindow for progress and status feedback. aurllistener an nsiurllistener t...
...r has to be a stream listener and in your listener's ondataavailable method, you can write out the stream data to a local file or concatenate it to a string. amsgwindow nsimsgwindow for progress and status feedback. aurllistener an nsiurllistener that is notified when url starts and stops. aconvertdata if aconvertdata is true, it will create a stream converter from message rfc2822 to */*. a
additionalheader header
added to the uri. e.g., header=filter return the nsiuri that gets run example for example, the next piece of code shows the selected message code on a dialog: (taken from mozillazine) var content = ""; var messageuri = getfirstselectedmessage(); var msgservice = messenger.messageservicefromuri(messageuri); var msgstream = components.classes["@mozilla.org/networ...
nsINavHistoryResult
w object what to do. you can use nsinavhistoryresulttreeviewer as the viewer; this provides a prepackaged interaction with a nsitreeboxobject. if you need a different view, you'll need to create your own viewer interface. the viewer provides notifications to the controller when view events occur; this is done using the nsinavhistoryresultviewobserver interface. method overview void
addobserver(in nsinavhistoryresultobserver aobserver, in boolean aownsweak); void removeobserver(in nsinavhistoryresultobserver aobserver); attributes attribute type description root nsinavhistorycontainerresultnode the root of the results. this container gives you access to all the results in the tree. ...
...sults. this container gives you access to all the results in the tree. note: keep in mind that you need to open containers for their results to be valid. when a result goes out of scope it will continue to observe changes till it is cycle collected. while the result waits to be collected it will stay in memory, and continue to update itself, potentially causing unwanted
additional work. when you close the root node the result will stop observing changes, so it is good practice to close the root node when you are done with a result, since that will avoid unwanted performance hits. read only. sortingannotation autf8string the annotation to use in sort_by_annotation_* sorting modes; you must set this value before setting the sortingmode attr...
...otifications are suppressed. this is used to prevent 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 occur on the result. void
addobserver( in nsinavhistoryresultobserver aobserver, in boolean aownsweak ); parameters aobserver an object that implements the nsinavhistoryresultobserver interface, which will receive notifications of changes on the result. aownsweak if false, the result will keep an owning reference to the...
...resultobserver 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 previous call to
addobserver(). void removeobserver( in nsinavhistoryresultobserver aobserver ); parameters aobserver the observer to remove. see also nsinavhistoryresultobserver nsinavhistorycontainerresultnode ...
nsINavHistoryResultObserver
ltnode acontainernode); deprecated since gecko 2.0 obsolete since gecko 11.0 void containerstatechanged(in nsinavhistorycontainerresultnode acontainernode, in unsigned long aoldstate, in unsigned long anewstate); void invalidatecontainer(in nsinavhistorycontainerresultnode acontainernode); void nodeannotationchanged(in nsinavhistoryresultnode anode, in autf8string aannoname); void nodedate
addedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodehistorydetailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodeinserted(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex); void nodekeywordcha...
...de anode, in autf8string anewtitle); void nodeurichanged(in nsinavhistoryresultnode anode, in autf8string anewuri); void sortingchanged(in unsigned short sortingmode); attributes attribute type description result nsinavhistoryresult the nsinavhistoryresult this observer monitors. although this attribute is read-write, you should not alter it directly; instead, call nsinavhistoryresult.
addobserver() to
add an observer to a result. methods batching() lets the observer know when a batch operation in places is about to start or end. the observer can then pause updates or events until the batch is completed, so that it won't handle the large number of updates that are about to be notified. this is especially useful when updating user interfaces, to avoid flicker or continuous select...
...tainernode the container that should be rebuilt. nodeannotationchanged() called right after the annotation on a node has changed. this is called when the annotation is changed, set, or unset. void nodeannotationchanged( in nsinavhistoryresultnode anode, in autf8string aannoname ); parameters anode the node whose title has changed. aannoname the name of the annotation that changed. nodedate
addedchanged() called right after the date
added property property of a node has changed. void nodedate
addedchanged( in nsinavhistoryresultnode anode, in prtime anewvalue ); parameters anode the node whose date
added property has changed. anewvalue the new value of the date
added property. nodehistorydetailschanged() called right after a node's time property or accesscount property, or both, have...
...anged. anewvalue the new value for the node's last modified property. nodemoved() called when a node is moved from aoldparent at aoldindex to anewparent at anewindex. the item may be a container or a leaf. at the moment, this method is called only when an item is moved within the same container. when an item is moved between containers, a new node is created for the item, and the itemremoved/item
added methods are used. void nodemoved( in nsinavhistoryresultnode anode, in nsinavhistorycontainerresultnode aoldparent, in unsigned long aoldindex, in nsinavhistorycontainerresultnode anewparent, in unsigned long anewindex ); parameters anode the moved node. aoldparent the node's old parent. aoldindex the node's index in the old parent. anewparent the node's new parent. anewindex the no...
nsINavHistoryResultViewer
lists. ...
... acontainernode); void containeropened(in nsinavhistorycontainerresultnode acontainernode); void invalidatecontainer(in nsinavhistorycontainerresultnode acontainernode); void nodeannotationchanged(in nsinavhistoryresultnode anode, in autf8string aannoname); void nodedate
addedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodelast
addedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodehistorydetailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeyword); void nodemoved(in nsinavhi...
... the container that should be rebuilt. nodeannotationchanged() called right after the annotation on a node has changed. this is called when the annotation is changed, set, or unset. void nodeannotationchanged( in nsinavhistoryresultnode anode, in autf8string aannoname ); parameters anode the node whose title has changed. aannoname the name of the annotation that hanged. nodedate
addedchanged() called right after the date
added property of a node has changed. void nodekeywordchanged( in nsinavhistoryresultnode anode, in prtime anewvalue ); parameters anode the node whose title has changed. anewvalue the new value for the node's date
added property. nodelastmodifiedchanged() called right after the last modified date property of a node has changed. void nodeke...
...s anode the moved item. aoldparent the item's old parent. aoldindex the item's index in the old parent. anewparent the item's new parent. anewindex the item's index in the new parent. remarks at the moment, this method is called only when an item is moved within the same container. when an item is moved between containers, a new node is created for the item, and the itemremoved/item
added methods are used. nodetitlechanged() called right after the title of a node has changed. void nodetitlechanged( in nsinavhistoryresultnode anode, in autf8string anewtitle ); parameters anode the node whose title has changed. anewtitle the new title of the node. nodeurichanged() called right after the uri of a node has changed. void nodeurichanged( in nsinavhistoryresultnode...
nsIObserverService
xpcom/ds/nsiobserverservice.idlscriptable this interface provides methods to
add, remove, notify, and enumerate observers of various notifications. inherits from: nsisupports last changed in gecko 0.9.6 the xpcom nsobserverservice implements this interface to provide global notifications for a variety of subsystems. ...
...orts last changed in gecko 0.9.6 the xpcom nsobserverservice implements this interface to provide global notifications for a variety of subsystems. ...
...rfaces.nsiobserverservice); method overview void
addobserver( in nsiobserver anobserver, in string atopic, in boolean ownsweak); nsisimpleenumerator enumerateobservers( in string atopic ); void notifyobservers( in nsisupports asubject, in string atopic, in wstring somedata ); void removeobserver( in nsiobserver anobserver, in string atopic ); methods
addobserver() registers a given listener for a notifications regarding the specified topic. see nsiobserver for a javascript example. void
addobserver( in nsiobserver anobserver, in string atopic, in boolean ownsweak ); parameters anobserver the nsiobserver object which will receive notifications. atopic the notification topic or subject. ownsweak if set to false, the nsiobserverser...
...egister an observer for a particular topic. void removeobserver( in nsiobserver anobserver, in string atopic ); parameters anobserver the nsiobserver instance to remove. atopic the notification topic or subject. this string-valued key uniquely identifies the notification. this parameter must not be null. example this notifies all nsiobservers watching the "mytopicid" topic with an
additional data parameter. components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice) .notifyobservers(null, "mytopicid", "some
additionalinformationpassedas'data'parameter"); see also nsobserverservice observer notifications provides an overview of observers and a list of built-in notifications fired by mozilla. usage exampl...
nsIPasswordManager
deprecated gecko 1.9 inherits from: nsisupports last changed in gecko 1.0 see using nsipasswordmanager for examples. implemented by: @mozilla.org/passwordmanager;1. ...
...ager;1. to create an instance, use: var passwordmanager = components.classes["@mozilla.org/passwordmanager;1"] .getservice(components.interfaces.nsipasswordmanager); method overview void
adduser(in autf8string ahost, in astring auser, in astring apassword); void removeuser(in autf8string ahost, in astring auser); void
addreject(in autf8string ahost); void removereject(in autf8string ahost); attributes attribute type description enumerator nsisimpleenumerator readonly: an enumeration of the stored usernames and passwords as nsipassword objects. enumerator nsisimpleenumerator readonly: an enumeration of the re...
... attribute type description enumerator nsisimpleenumerator readonly: an enumeration of the stored usernames and passwords as nsipassword objects. enumerator nsisimpleenumerator readonly: an enumeration of the rejected sites as nsipassword objects. only the host portion of these objects is relevant. methods
adduser() stores a password. astring
adduser(in autf8string ahost, in astring auser, in astring apassword); parameters ahost the hostname of the password to store. auser the username of the password to store. apassword the password to store. removeuser() removes a stored password. void removeuser(in autf8string ahost, ...
... the hostname of the password to store. auser the username of the password to store. apassword the password to store. removeuser() removes a stored password. void removeuser(in autf8string ahost, in astring auser); parameters ahost the hostname of the password to remove. auser the username of the password to remove.
addreject() blocks a hostname from having its passwords saved. void
addreject(in autf8string ahost); parameters ahost the name of the hostname for which passwords should no longer be saved. removereject() unblocks a hostname from having its passwords saved. void removereject(in autf8string ahost); parameters ahost the name of the hostname for which passwords can be ...
nsIScriptError
nsiscripterror. infoflag 0x8 just a log message methods init() initializes the object with information describing the error which occurred. void init( in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category ); parameters message 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 prevent showing the source line in...
... gecko 12.0, this method was provided by the nsiscripterror2 interface, which has now been merged into this one. void initwithwindowid( in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category, in unsigned long long innerwindowid ); parameters message 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 prevent showing the source line in...
...ox code to find the one you want. see categories for a partial list. innerwindowid the id of the inner window associated with the error. tostring() outputs a string representing the error message described by the object. autf8string tostring(); parameters none. return value a string representing the error message described by the nsiscripterror object. examples logging a message with
additional information in this example nsiscripterror, which implements nsiconsolemessage, is used to log information to the console including information about the source file and line number of the error. function mylogtoconsole(amessage, asourcename, asourceline, alinenumber, acolumnnumber, aflags, acategory) { var consoleservice = components.classes["@mozilla.org/conso...
...ategory); consoleservice.logmessage(scripterror); } categories there are a lot of categories, and they're not all maintained in a single list anywhere in the code. this is an attempt to group them together for reference. note that these are strings. if you want to log an error at chrome level you should set a category from the first section (leaving it empty might log it as content error). as
addon author i would recommend using "chrome javascript" for logging exceptions caused by
addon code. categories the web console does not display "xpconnect javascript" "component javascript" "chrome javascript" "chrome registration" "xbl" "xbl prototype handler" "xbl content sink" "xbl javascript" "frameconstructor" categories the web console displays "hudconsole" "css parser" "cs...
nsIStyleSheetService
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports implemented by: @mozilla.org/content/style-sheet-service;1. ...
...a user sheet loaded via this api will come before usercontent.css and userchrome.css in the cascade (so the rules in it will have lower precedence than rules in those sheets). an agent sheet loaded via this api will come after ua.css in the cascade (so the rules in it will have higher precedence than rules in ua.css). the relative ordering of two use...
...aded via this api will come before usercontent.css and userchrome.css in the cascade (so the rules in it will have lower precedence than rules in those sheets). an agent sheet loaded via this api will come after ua.css in the cascade (so the rules in it will have higher precedence than rules in ua.css). the relative ordering of two user or two agent sheets loaded via this api is undefined. sheets
added via this api take effect on all documents, including already-loaded ones, immediately. void loadandregistersheet( in nsiuri sheeturi, in unsigned long type ); parameters sheeturi 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, ...
...esheet 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 previously 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 one of the t...
nsISupports
return value an integer value that is generally ignored. ...
...return value an integer value that is generally ignored. queryinterface() the queryinterface method provides runtime type discovery. ...
...return value an integer value that is generally ignored. queryinterface() the queryinterface method provides runtime type discovery. note: the interface pointer, aresult, returned by queryinterface must be released by a call to release() when it is no longer needed. queryinterface is a symmetric, transitive, and reflexive operator. ...
...uidelines release() notifies the object that an interface pointer has been destroyed and any resources the object held on behalf of the client can be released. nsrefcnt release(); parameters none. return value an integer value that is generally ignored. remarks the method descriptions above were taken from essential com by don box. the point of those descriptions is to highlight the fact that
addref() and release() do not necessarily correspond to incrementing and decrementing a counter, respectively, even though that is how they are usually implemented. on win32 systems, nsisupports is abi-compatible with microsoft com's iunknown interface. ...
nsIWebBrowserPersist
ersist_flags_ignore_iframes 8 ignore iframe content (usually adverts). persist_flags_no_conversion 16 do not run the incoming data through a content converter for example to decompress it. persist_flags_replace_existing_files 32 replace existing files on the disk (use with due diligence!) persist_flags_no_base_tag_modifications 64 don't modify or
add base tags. persist_flags_fixup_original_dom 128 make changes to original dom rather than cloning nodes. persist_flags_fixup_links_to_destination 256 fix links relative to destination location (not origin) persist_flags_dont_fixup_links 512 do not make any adjustments to links. persist_flags_serialize_output 1024 force serialization of ou...
...ts into or nsnull to use the default behavior. aencodingflags flags to pass to the encoder. awrapcolumn for text documents, indicates the desired width to wrap text at. parameter is ignored if wrapping is not specified by the encoding flags. exceptions thrown ns_error_invalid_arg one or more arguments was invalid. saveuri() as of firefox 26, this method should no longer be used from
add-on code. please use downloads.createdownload() instead. as of firefox 36, a new parameter areferrerpolicy was
added as the fourth argument, changing the number of parameters from 7 to 8 and shifting the order of the parameters in a backwards incompatible way. save the specified uri to file. void saveuri( in nsiuri auri, in nsisupports acachekey, in nsiuri areferrer, in long areferrerp...
...n object representing the uri in the cache or nsnull. this can be a necko cache key, an nsiwebpagedescriptor, or the currentdescriptor of an nsiwebpagedescriptor. areferrer the referrer uri to pass with an http request or nsnull. areferrerpolicy the referrer policy to use for the request, taken from nsihttpchannel. apostdata post data to pass with an http request or nsnull. aextraheaders
additional headers to supply with an http request or nsnull. afile target file. this may be a nsilocalfile object or an nsiuri object with a file scheme or a scheme that supports uploading (for example ftp). aprivacycontext a context derived from a relevant window or document (eg. the window containing a link being saved) via a docshell that qis to nsiloadcontext. used to ensure that privacy-sens...
... // obj_persist.saveuri(obj_uri,null,null,null,null,null,obj_targetfile,privacycontext); } catch (e) { alert(e); } } see also nsicancelable ...
Troubleshooting XPCOM components registration
ontract-id is your contract id. if the response is your contract id instead of an error, the component was successfully registered and this is the wrong page. load failure of binary components on the mozilla trunk (firefox 3, xulrunner 1.9), components that fail to load will print an error to the error console. chrome errors must be enabled. if the error appears, you can use nspr logging to see
additional information about the failure by running firefox from a command prompt: rem close all firefox windows! set nspr_log_modules=nsnativemoduleloader:5 set nspr_log_file=c:\path\to\logfile "c:\program files\mozilla firefox\firefox.exe" examining this log for warning and errors may provide valuable clues why the component failed to load. if using firefox 4 / xulrunner 2.0, make sure that you...
...nents the most common reason for components written in javascript to fail is that there are parsing errors. these parsing errors should show up in the error console if chrome errors are enabled. to learn more about enabling chrome errors, see "how can i see errors in my code" in the extension faqs. ...
... if your component requires any external libraries, you may need to read using dependent libraries in extension components make sure you are compiling against the right version. ...
...and then check them again. windows-specific hints use dependency walker to check that your dependent libraries are loaded correctly. in dependency walker, open the options menu and select configure module search order.... in the bottom right corner of the new dialog, click browse... and select the directory firefox.exe (or equivalent) is in. in the bottom left corner, click
add directory. do not
add any other directories; in particular, do not
add your extension's (or xulrunner application's) components directory. after clicking ok in the top right, check for any missing dependencies using file -> open -> firefox.exe (or equivalent). also check that the function nsgetmodule is exported. you can also use the profiling feature of dependency walker to vi...
Using nsIDirectoryService
fine() nsifile. getting a location: most developers need to find where a file or directory is located. with nsdirectoryservice, there are two steps involved. first, you must know what the string key (or property) is that refers to this locations. header files containing known keys are listed in the known locations section of this document. bear in mind that this list is not static. ...
...listed in the known locations section of this document. bear in mind that this list is not static. components can
add and remove locations at their will. second, you must acquire the implementation and call get() passing the known string key. in the example below, prop is a string that references your requested file locations. ...
...e> dir; ns_getspecialdirectory(prop, getter_
addrefs(dir)); if (!dir) return ns_error_failure; javascript: var file = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("profd", components.interfaces.nsifile); (the example is taken from the code snippets section of this site.)
adding a location: there are currently two ways to
add a file location to the directory service: directly and delayed. ...
...components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("profd", components.interfaces.nsifile); (the example is taken from the code snippets section of this site.)
adding a location: there are currently two ways to
add a file location to the directory service: directly and delayed. you can directly
add a new nsifile with any property string using the nsiproperties interface: components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .set("myfilename", file); now, if your cost is too high to set all of these properties at once, you can register to be a callback that can provide an nsifile. to do this, you...
Mozilla technologies
mozilla has several technologies used as components of its projects. these are documented here. accessibility api implementation detailsthese pages contain documentation on mozilla specific implementation details of assistive technology apis.animated png graphicsapng is an extension of the portable network graphics (png) format,
adding support for animated images. apng is a simpler alternative to mng, providing a spec suitable for the most common usage of animated images on the internet.docshelldocshell is the second iteration of what originally started out as webshell. at the moment, the transition from webshell to docshell is not fully completed, but the long-term goal is to remove webshell and switch over entirely to docshell.embedded dialog apifeed content access apifirefox ...
...ata features both to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.xpcomxpcom is a cross platform component object model, similar to microsoft com. ...
... ...
... ...
Testing Mozilla code
testing your code is important! before you can even get your code committed into the source tree, you have to test it, and larger patches have to have automated tests. these articles will help you master (and continue to excel at) testing mozilla code. asan nightly projectthe asan nightly project involves building a firefox nightly browser with the popular
addresssanitizer tool and enhancing it with remote crash reporting capabilities for any errors detected.clang static analysisthis document is split in two parts. the first part will focus on the modern and robust way of static-analysis and the second part will present the build-time static-analysis.debugging mozilla with valgrindthis page describes how to use valgrind (specifically, its memcheck tool) to find memory errors.fir...
...with remote crash reporting capabilities for any errors detected.clang static analysisthis document is split in two parts. ...
... reporting capabilities for any errors detected.clang static analysisthis document is split in two parts. ...
...ld-time static-analysis.debugging mozilla with valgrindthis page describes how to use valgrind (specifically, its memcheck tool) to find memory errors.firefox and
address sanitizer
address sanitizer (asan) is a fast memory error detector that detects use-after-free and out-of-bound bugs in c/c++ programs. it uses a compile-time instrumentation to check all reads and writes during the execution. in
addition, the runtime part replaces the malloc and free functions to check dynamically allocated memory. more information on how asan works can be found on the
address sanitizer wiki. fuzzing interfacethe fuzzing interface is glue code living in mozilla-central in order to make it easier for developers and security researchers to test c/c++ code with either libfuzzer or afl-fuzz.measuring code co...
Mail composition back end
omplete as of yet. i will try to make comments for these exceptions. sending messages the primary responsibility of the back end is for the creation and sending of rfc822 messages. the interface that accomplishes this task is the nsimsgsend interface. the feedback mechanism is provided by a nsimsgsendlistener which is implemented by the caller. the caller has the ability to
add or remove listener interfaces to the nsimsgsend object and the interface can support multiple listeners. (for detailed information on the listener interfaces, see the listener interfaces section of this document) nsimsgsend the following describes the methods of the nsimsgsend interface. all of these methods are asynchronous operations. createandsendmessage ...
... nsmsgdelivermode mode, - mode is the delivery mode. this can be set for the various modes of delivery (i.e. send later, drafts, templates or send the message now) nsimsgsendlistener **alistenerarray) = 0; - an array of listeners for the send operation. this can be nsnull if you want to do the delivery operation "blind" the
addlistener/removelistener methods let the caller
add and remove listeners to the sending interface. ns_imethod
addlistener(nsimsgsendlistener *alistener) = 0; ns_imethod removelistener(nsimsgsendlistener *alistener) = 0; sending listener interfaces the nsimsgsendlistener interface will let a caller keep track of the progress and any status of a send operation. these ar...
... sendunsentmessages(nsimsgidentity *identity, - the user identity for the person doing the send operation. this will be needed to determine the appropriate folder for copy operations. nsimsgsendlaterlistener **listenerarray) = 0; - an array of listeners for the send operation. ...
... *identity, - the user identity for the person doing the send operation. this will be needed to determine the appropriate folder for copy operations. nsimsgsendlaterlistener **listenerarray) = 0; - an array of listeners for the send operation. this can be nsnull if you want to do the delivery operations "blind" the
addlistener & removelistener methods will
add and remove listeners from the nsimsgsendlater object. ns_imethod
addlistener(nsimsgsendlaterlistener *alistener) = 0; ns_imethod removelistener(nsimsgsendlaterlistener *alistener) = 0; sending unsent messages listener the nsimsgsendlaterlistener interface will notify the implementor of the progress and completion of the send later operations. createands...
Mailnews and Mail code review requirements
ence 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. rules for all patches affecting mailnews/ and mail/ wherever possible, significant patches in a c...
...ilnews/ and mail/ wherever 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. if a reviewer feels that the patch would benefit from
additional reviews, they should request a second review from an appropriate person. super-review is required in certain situations: significant architectural refactoring, any change to any api, all changes that affect how code modules interact. see the full super-review policy for more details. unit test rules patches are required to include automated tests which are run during make check or vi...
...ste a link to the pushed commit with the rubber stamp in the bug make sure you pasted a link to any try-server pushes of the patch in the bug rs=simple-orange-fix requirements: the patch is fixing an intermittent orange test failure. the patch is a change exclusively to test logic. the patch has identified a likely problem and fixes it; no commenting out tests/changing what a test tests/
adding huge timeouts. (you could still ask a reviewer to approve such things, though.) the patch does not change public test frameworks, specifically, nothing in mailnews/test/resources/ or mail/test/mozmill/shared-modules/. for mozmill tests, the patch has passed on the try server. for xpcshell tests, it has either passed on try or has been run locally on the appropriate platform(s). specifical...
... will do on os x or linux, it must be run on windows and one of os x / linux. the author of the patch is the module owner or a peer of the module to which the test corresponds. a bug is still required, even if it is immediately marked fixed. rs=orange-debugging requirements: the patch is trying to fix an intermittent orange test failure. the patch only touches test logic. the patch only
adds/modifies logging statements, although the logs can be conditional. the patch must have been run at least once on the try server. (i have done some mozmill orange fixing where the try server would not duplicate the orange failures of the trunk and so in order to get the enhanced logging, the changes need to go into the trunk.) the patch is authored by the module owner/a peer for the affected t...
Main Windows
he message preview 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 “new message” and “new card” commands to the menus, along with their associated javascript. msghdrviewoverlay.xul shown in blue above (where?), this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul contains the contents...
...rviewoverlay.xul shown in blue above (where?), this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul contains the contents of most of the menus (i.e. file, edit, view, etc). osx only: macmenuoverlay.xul a special overlay for osx that
adds a few items to the window menu. messagewindow.xul messagewindow.xul is shown when a message is opened. its almost exactly the same as messenger.xul in terms of overlays, but just lacks the folder and threadpanes normally shown. menus, toolbar buttons, and headers are all taken from exactly the same overlays listed above though. mailwindowoverlay.xul this is the red sections shown in the ...
...t. msghdrviewoverlay.xul shown in blue above, this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul contains the contents of most of the menus (i.e. file, edit, view, etc). osx only: macmenuoverlay.xul a special overlay for osx that
adds a few items to the window menu. customizetoolbar.xul and customizetoolbarsheet.xul these are two old files from when the original customizable toolbars were ported from firefox (phoenix at the time) to thunderbird (minotaur at the time). customizetoolbar.xul looks and acts a whole lot like the toolkit's customizetoolbar.xul. items have the same id’s, and contain the same structure. a few od...
...ar.xul and customizetoolbarsheet.xul these are two old files from when the original customizable toolbars were ported from firefox (phoenix at the time) to thunderbird (minotaur at the time). customizetoolbar.xul looks and acts a whole lot like the toolkit's customizetoolbar.xul. items have the same id’s, and contain the same structure. a few odd pieces are missing though. for instance, the “
add new toolbar” buttons from toolkit aren’t in the thunderbird version. customizetoolbarsheet.xul is a similar implementation written for osx to give a more native appearance. at compile time these files are
added to the toolkit directory so that their chrome
addresses are in global, the same as firefox’s. why this is this way, i’m not sure at the moment. i assume that customizetoolbars was...
Building a Thunderbird extension 5: XUL
warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. thunderbird's user interface is written in xul and javascript. xul is an xml grammar that provides user interface widgets like buttons, menus, toolbars, trees etc. we
add widgets by inserting new xul dom elements into the application window and modify them using scripts and attaching event handlers. while xul provides the elements of the user interface, actions are written in javascript. for our first extension, we will
add some text to the thunderbird status bar. the status bar is implemented in a xul file called messenger.xul, which can be found in the chrome/messenger/content/messenger folder which is packaged inside the omni.ja ar...
...sbarpanel>s ... </statusbar> <statusbar id="status-bar"> is a "merge point" for a xul overlay. xul overlays are a way of attaching other ui widgets to a xul document at run time. a xul overlay is a .xul file that specifies xul fragments to insert at specific merge points within a "master" document. these fragments can specify widgets to be inserted, removed or modified. in this example you are
adding a line to the indented statusbar. therefore it becomes an item owned by the id called "status-bar". this shows how the thunderbird architecture allows extensions to modify the user experience without modifying the installation files. this also enables version independence between thunderbird and thunderbird extensions. example xul overlay document create a new file called myhelloworld.xul wi...
...ies the merge point within the application window that we want to attach to. when parsing our overlay file, the xul engine will take all child elements of the <statusbar> tag and merge them with the original xul document's <statusbar> tag. in the example above we have defined a new <statusbarpanel> item (that can be referred to as my-panel) which will create a new instance of this widget type and
add it at the end of the statusbar. in thunderbird it will appear as a label at the right side of thunderbird's statusbar and display "date". we have also
added a <script> 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 sect...
...d of the statusbar. in thunderbird it will appear as a label at the right side of thunderbird's statusbar and display "date". we have also
added a <script> 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. « previousnext » ...
Theme Packaging
th the following structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files global/files mozapps/files ... you must have a top-level chrome.manifest file which registers the chrome for the theme (as before) and also an install.rdf manifest that specifies metadata that is displayed in the appearance section of the
add-ons manager. preview.png is a preview image which will show when double-clicked on a theme 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. install.rdf your install.rdf manifest will look something like this: <?xml version="1.0"?> <...
...f> required install.rdf properties your install.rdf file must have the following properties. see the install.rdf reference for more information: em:id em:version em:type em:targetapplication em:name em:internalname optional install.rdf properties em:description em:creator em:contributor em:homepageurl em:updateurl note that if your theme will be made available on the https://
addons.mozilla.org website, it may not include an updateurl. sample install.rdf file <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>{18b64b56-d42f-428d-a88c-baa413bc413f}</em:id> <em:version>1.0</em:version> <em:type>4</em:type> <!-- tar...
...nternalname>newtheme1</em:internalname> </description> </rdf> the following are some common target application guids that you can use in your targetapplication properties: thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} seamonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} pale moon {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} official references for toolkit api official references. ...
...you can use in your targetapplication properties: thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} seamonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} pale moon {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} official references for toolkit api official references. do not
add to this list without contacting benjamin smedberg. note that this page is included from the pages listed below. ...
Thunderbird extensions
rbird developer. this documention series focuses on thunderbird. need personalized help? see community / communications. warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. ...
...ird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. documentation 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 », « preview 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 (...
...entities (from field, to field) which are themselves part of a contact: indeed, a contact has multiple identities. typical use cases for gloda: find all messages whose subject matches [search term], find all messages from [person], find all messages in the same thread as [a given message], find all messages involving [person], etc. etc. gloda is extremely powerful and is used heavily by
add-ons such as thunderbird conversations. learn more about gloda: an overview of gloda how to create your first message query and read the gloda examples gloda internals: gloda debugging, gloda indexing more thunderbird-specific links some links may be out of date, but they still provide valuable information on the codebase. an overview of thunderbird c...
...ecause there has been significant api rewrite over the past years making most techniques considerably easier) thunderbird api docs (mostly a collection of out-of-date pages, relevance is rather dubious) general links finding the code for a feature mozillazine articles on thunderbird community / communications thunderbird specific :
add-ons section on developer.thunderbird.net thunderbird communication channels
add-on developers forum/mailing list #maildev irc channel more general : mozillazine extension development forum general developer channels related topics xul, javascript, xpcom, themes, developing mozilla categori ...
Using popup notifications
al notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times. for example, this popup notification is displayed when a web site requests geolocation information: this lets the user decide whether or not to share their location when it's convenient to do so, instead of being compelled to do it at once. in
addition, notifications can be dismissed and recalled by clicking anywhere outside the notification, then clicking on the notification icon to bring it back again. a popup notification can include a text message, a button action, and zero or more
additional actions provided in a drop-down menu accessed through the notification's button. creating a popup notification popup notifications can be crea...
..."do something", accesskey: "d", callback: function() { alert("doing something awesome!"); } }, null /* secondary action */ ); in this case, we aren't providing any secondary actions; that is, actions provided to the user through the drop-down menu. this notification looks like this: that's not very pretty; where's the icon?
adding an icon to your notification
adding an icon to a notification is simple. you just need to provide the appropriate css. the popupnotifications.jsm code module
adds a popupid attribute to the notification object's icon element. you can use this to style the icon, like this: .popup-notification-icon[popupid="sample-popup"] { list-style-image: url("chrome://popupnotifications/skin/mozlogo.png"...
... is simple. you just need to provide the appropriate css. the popupnotifications.jsm code module
adds a popupid attribute to the notification object's icon element. ...
...otifications.jsm code module
adds a popupid attribute to the notification object's icon element. ...
ArrayType
r of entries the array type should be able to contain. only for unsized arraytype. return value a cdata representing the newly allocated array. exceptions thrown typeerror length is not provided for unsized array, or is provided for sized array. arraytype cdata properties property type description length number the length of the array. read only. in
addition, each element in the array can be referenced by index using standard bracket notation, such as myarray[index]. properties inherited from cdata property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object...
...iption constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. ...
...ject, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. ...
...pecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. arraytype cdata method_overview cdata
addressofelement(idx) methods inherited from cdata cdata
address() string tosource() string tostring() arraytype cdata methods
addressofelement() returns a new cdata object of the appropriate pointer type, whose value points to the specified array element on which the method was called. cdata
addressofelement( idx ); parameters idx a numeric value indicating the offset into the array of the element just to return a pointer. if this value isn't a valid javascript number that's also a valid index into the array, a ty...
Plug-in Basics - Plugins
or using plug-in technology seems boundless, as shown by the growing numbers of independent software vendors who are creating new and innovative plug-ins. with the plug-in api, you can create dynamically loaded plug-ins that can: register one or more mime types draw into a part of a browser window receive keyboard and mouse events obtain data from the network using urls post data to urls
add hyperlinks or hotspots that link to new urls draw into sections on an html page communicate with javascript/dom from native code you can see which plug-ins are installed on your system and have been properly associated with the browser by consulting the installed plug-ins page. go to the help menu, and click help and then about plug-ins. type "about:plugins" in the location bar. the installed...
...he function npp_destroy to inform the plug-in that the instance is being deleted. when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. gecko calls the function np_shutdown. plug-ins consume no resources (other than disk space) when not loaded. note: plug-in api calls and callbacks use the main navigator thread. in general, if you want a plug-in to generate
additional threads to handle processing at any stage in its lifespan, you should be careful to isolate these from plug-in api calls. see initialization and destruction for more information about using these methods. plug-in detection gecko looks for plug-ins in various places and in a particular order. the next section, how gecko finds plug-ins, describes these rules, and the following section, c...
...e. you can also create hidden plug-ins using the object element. though the object element has no hidden attribute, you can create css rules to override the sizing attributes of the object element object { visibility: visible; } object.hiddenobject { visibility: hidden !important; width: 0px !important; height: 0px !important; margin: 0px !important; p
adding: 0px !important; border-style: none !important; border-width: 0px !important; max-width: 0px !important; max-height: 0px !important; } in this case, the object element that picks up these special style definitions would have a class of hidden. using the class attribute and the css block above, you can simulate the behavior of the hidden plug-in in the embed el...
...the browser ignores these nonstandard attributes when parsing the html, but it passes all attributes to the plug-in, allowing the plug-in to examine the list for any private attributes that could modify its...
Plug-in Development Overview - Plugins
browser versions are compatible and possibly provide alternative processing for different versions: use the npn_version method to check for changes in major and minor version numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an
addition to current browser capabilities. to make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. use the npn_status method to display a message on the status line. for information about using this method, see version, ui, and status information. making plug-ins scriptable scriptable plug-ins...
...tly"); </script> in the past, liveconnect and later xpconnect were used to make plug-ins scriptable. 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 previous 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. ...
...aller should either package the plug-in into an extension and install it using normal extension installation practices, or install the plug-in to the system standard install locations. windows installation using the registry on windows, plug-ins should be installed to a plug-in-specific directory such as c:\program files\plugin name\nppluginname.dll. ...
...stry (the plug-in-identifier should follow the specification): hklm/software/mozillaplugins/plugin-identifier descripton: reg_sz "description of the plugin" path: reg_sz "c:\..path to the plugin.dll" productname: reg_sz "the plugin name" vendor: reg_sz "the plugin author/vendor" version: reg_sz "0.5.whatever plugin version string" hklm/software/mozillaplugins/plugin-identifier/mimetypes
add a sub-key for each mime type the plugin supports, with no values install to known locations on linux and mac on linux and mac, plug-ins are installed to well-known locations: linux: /usr/lib/mozilla/plugins or /usr/lib64/mozilla/plugins mac: /library/internet plug-ins or ~/library/internet plug-ins ...
URLs - Plugins
ng files to an ftp server, and sending mail. 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. file (host-specific filenames) locates files on a specific host computer rather than an internet resource. ftp (file transfer protocol) locates files and directories on internet hosts for file download. gopher ...
... transfer protocol) locates files and directories on internet hosts for file download. gopher (gopher protocol) locates specified items on a gopher server. obsolete since gecko 2.0 http (hypertext transfer protocol) locates resources on the internet. javascript executes javascript code that follows the url. netscape-specific. mailto (electronic mail
address) locates the internet mailing
address of an individual or service. nethelp displays a nethelp topic in a nethelp window. browser-specific. news (usenet news) locates usenet news groups or individual usenet articles. nntp (usenet news using nntp access) locates usenet news groups or individual usenet articles; alternate to news. prospero (prosper...
...target. make sure that the target matches the url type sent to it. for example, a null target does not make sense for some url types (such as mailto). for some recommendations to help you with target parameter choice, see the reference entry for npn_geturl. the npn_geturlnotify method acts like npn_geturl. both request the creation of a new stream with the contents of the specified url, and, in
addition, npn_geturlnotify notifies the plug-in of the successful or unsuccessful completion of the request. the browser notifies the plug-in by calling the plug-in's npp_urlnotify function and passing it the notifydata value, which may be used to track multiple requests. npn_geturlnotify handles the url request asynchronously. it returns immediately and only later handles the request and calls npp_...
...n to the length of the buffer. possible url types include http (similar to an html form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). for protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. if no custom headers are required, simply
add a blank line ('\n') to the beginning of the file or buffer. note: you cannot use npn_posturl to specify headers (even a blank line) in a memory buffer. to do this, use npn_posturlnotify for this purpose. § the npn_posturlnotify function has all the same capabilities and works like npn_posturl in most ways except that (1) it supports specifying headers when posting a memory buffer, and (2) it ca...
Browser Toolbox - Firefox Developer Tools
the browser toolbox enables you to debug
add-ons and the browser's own javascript code rather than just web pages like the normal toolbox. the browser toolbox's context is the whole browser rather than just single page on a single tab. note: if you want to debug a specific
add-on that is restartless or sdk-based then try the
add-on debugger. use the browser toolbox for
add-ons that are neither. enabling the browser toolbox the browser toolbox is not enabled by default. to enable it you need to check the settings "enable chrome and
addon debugging" and "enable remote debugging". to do this, open the developer tools settings, go to the section "advanced settings", and check the settings "enable browser chrome and
add-on debugging toolboxes" and "enable remote debugging". openin...
... combination ( cmd + opt +shift + i on a mac). ...
....prompt-connection property to false): click ok, and the browser toolbox will open in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser itself and by any
add-ons that are running. altogether you will have access to the following developer tools: debugger (note: if you want to debug a specific
add-on that is restartless or sdk-based then try the
add-on debugger.) console style editor performance network monitor page inspector accessibility inspector you can debug chrome: and about: pages using the normal debugger, just as if they were ordinary content pages. targeting a document in the normal toolbox, there's a button in the toolbar enabling you to target specific iframes in the ...
...use the browser hides them as soon as you click outside them. there is a way to disable this behavior. click the toolbox menu and select disable popup auto-hide. now when you open any popup, it will stay open until you press the esc key. you can use the inspector's node picker to select that panel, and examine and modify its content: you can use the same technique to debug popups created by
add-ons. note: this change is not persistent across browser restarts. when you close the browser toolbox, the setting will be cleared. ...
Set a breakpoint - Firefox Developer Tools
our code where you would like execution of the code to pause. at this point you can do useful things like studying the value of different variables at that point, allowing you to work out why a problem is occurring. the source pane context menu in the source pane, you can handle setting breakpoints by bringing up the context menu over a line number. there are a few options available here:
add breakpoint:
add a standard unconditional breakpoint at this line number (see below).
add condition:
add a condition and create a conditional breakpoint (see below).
add log:
add a log point, which logs a value to your console rather than pausing execution as a breakpoint does. continue to here: when stepping through code, this option tells the debugging to continue execution through to this po...
...where the code will always pause execution when it is reached. you can set an unconditional breakpoint using the context menu (see above), or by: clicking on the line number for the line you want to break at in the source pane. highlighting the line you want to break at in the source pane and pressing ctrl + b (windows/linux) or cmd + b (macos). the line number is highlighted in blue: in
addition, if the line contains multiple function calls, each one will be given a small blue arrow icon to the left of it. these are called column breakpoints, and allow you to set the breakpoint to happen exactly on any one of the function calls in the line (or multiple calls), by clicking on each relevant one. conditional breakpoints a conditional breakpoint is one where the code will pause execut...
... if a certain condition is met, such a variable having a certain value at the time. you can set a conditional breakpoint using the context menu (see above), or by highlighting the line you want to break at in the source pane and pressing ctrl + shift + b (windows/linux) or cmd + shift + b (macos). ...
...md + b (macos). bring up the context menu over the line highlight and choose the remove breakpoint option. other context menu options worth mentioning are: disable breakpoint: turn it 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 previously set condition. inline variable preview new in firefox 71, the source pane now gives you an inline preview of the variables on each line of code you've stepped through: this is a very useful timesa...
AesGcmParams - Web APIs
nother way: never reuse an iv with the same key. the aes-gcm specification recommends that the iv should be 96 bits long, and typically contains bits from a random number generator. section 8.2 of the specification outlines methods for constructing ivs. note that the iv does not have to be secret, just unique: so it is ok, for example, to transmit it in the clear alongside the encrypted message.
additionaldata optional a buffersource. this contains
additional data that will not be encrypted but will be authenticated along with the encrypted data. if
additionaldata is given here then the same data must be given in the corresponding call to decrypt(): if the data given to the decrypt() call does not match the original data, the decryption will throw an exception. this gives you a way to au...
... taglength optional a number. ...
... taglength optional a number. this determines the size in bits of the authentication tag generated in the encryption operation and used for authentication in the corresponding decryption. ...
...ed in the encryption operation and used for authentication in the corresponding decryption. according to the web crypto specification this must have one of the following values: 32, 64, 96, 104, 112, 120, or 128. the aes-gcm specification recommends that it should be 96, 104, 112, 120 or 128, although 32 or 64 bits may be acceptable in some applications: appendix c of the specification provides
additional guidance here. taglength is optional and defaults to 128 if it is not specified. examples see the examples for subtlecrypto.encrypt() and subtlecrypto.decrypt(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.aesgcmparams' in that specification. recommendation ...
Animation.startTime - Web APIs
time is currently set at, and you can change this value to make the animation start at a different time. examples in the running on web animations api example, the we can sync all new animated cats by giving them all the same starttime as the original running cat: var catrunning = document.getelementbyid ("withwaapi").animate(keyframes, timing); /* a function that makes new cats. ...
...ion start at a different time. examples in the running on web animations api example, the we can sync all new animated cats by giving them all the same starttime as the original running cat: var catrunning = document.getelementbyid ("withwaapi").animate(keyframes, timing); /* a function that makes new cats. ...
...eb animations api example, the we can sync all new animated cats by giving them all the same starttime as the original running cat: var catrunning = document.getelementbyid ("withwaapi").animate(keyframes, timing); /* a function that makes new cats. ...
... the original running cat: var catrunning = document.getelementbyid ("withwaapi").animate(keyframes, timing); /* a function that makes new cats. */ function
addcat(){ var newcat = document.createelement("div"); newcat.classlist.
add("cat"); return newcat; } /* this is the function that
adds a cat to the waapi column */ function animatenewcatwithwaapi() { // make a new cat var newcat =
addcat(); // animate said cat with the waapi's "animate" function var newanimationplayer = newcat.animate(keyframes, timing); // set the animation's start time to be the same as the original .cat#withwaapi newanimationplayer.starttime = catrunning.starttime; //
add the cat to the pile. waapicats.appendchild(newcat); } reduced time precision to offer protection against timing attacks...
AudioTrackList: change event - Web APIs
the change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property. ...
... the change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property. ...
...nt handler property onchange examples using
addeventlistener(): const videoelement = document.queryselector('video'); videoelement.audiotracks.
addeventlistener('change', (event) => { console.log(`'${event.type}' event fired`); }); // changing the value of `enabled` will trigger the `change` event const toggletrackbutton = document.queryselector('.toggle-track'); toggletrackbutton.
addeventlistener('click', () => { const track = videoelement.audiotracks[0]; track.enabled = !track.enabled; }); using the onchange event handler property: const videoelement = document.queryselector('video'); videoelement.audiotracks.onchange = (event) => { console.log(`'${event.type}' event fired`); }; // changing the value of `enabled` will trigger the `change` event const toggletrackb...
... living standard ...
Battery Status API - Web APIs
charging) and for changes to the battery level and timing. this is done by listening for the chargingchange, levelchange, chargingtimechange, dischargingtimechange events. ...
...tery) { function updateallbatteryinfo(){ updatechargeinfo(); updatelevelinfo(); updatecharginginfo(); updatedischarginginfo(); } updateallbatteryinfo(); battery.
addeventlistener('chargingchange', function(){ updatechargeinfo(); }); function updatechargeinfo(){ console.log("battery charging? " + (battery.charging ? ...
...ener('chargingchange', function(){ updatechargeinfo(); }); function updatechargeinfo(){ console.log("battery charging? " + (battery.charging ? ...
... specifications specification status comment battery status api candidate recommendation ...
BroadcastChannel: message event - Web APIs
button. there are two "receiver" iframes that listen to the broadcast message and write the result into a <div> element. ...
...e a message to broadcast:</label><br/> <textarea id="message" name="message" rows="1" cols="40">hello</textarea> <button id="broadcast-message" type="button">broadcast message</button> body { border: 1px solid black; p
adding: .5rem; height: 150px; font-family: "fira sans", sans-serif; } h1 { font: 1.6em "fira sans", sans-serif; margin-bottom: 1rem; } textarea { p
adding: .2rem; } label, br { margin: .5rem 0; } button { vertical-align: top; height: 1.5rem; } const channel = new broadcastchannel('example-channel'); const messagecontrol = document.queryselector('#message'); const broadcastmessagebutton = document.queryselector('#broadcast-message'); broadcastmessagebutton.
addeventlistener('click', () => { channel.postmessage(messagecontrol.v...
...t channel = new broadcastchannel('example-channel'); const messagecontrol = document.queryselector('#message'); const broadcastmessagebutton = document.queryselector('#broadcast-message'); broadcastmessagebutton.
addeventlistener('click', () => { channel.postmessage(messagecontrol.value); }) receiver 1 <h1>receiver 1</h1> <div id="received"></div> body { border: 1px solid black; p
adding: .5rem; height: 100px; font-family: "fira sans", sans-serif; } h1 { font: 1.6em "fira sans", sans-serif; margin-bottom: 1rem; } const channel = new broadcastchannel('example-channel'); channel.
addeventlistener('message', (event) => { received.textcontent = event.data; }); receiver 2 <h1>receiver 2</h1> <div id="received"></div> body { border: 1px solid black; ...
...ng: .5rem; height: 100px; font-family: "fira sans", sans-serif; } h1 { font: 1.6em "fira sans", sans-serif; margin-bottom: 1rem; } const channel = new broadcastchannel('example-channel'); channel.
addeventlistener('message', (event) => { received.textcontent = event.data; }); receiver 2 <h1>receiver 2</h1> <div id="received"></div> body { border: 1px solid black; p
adding: .5rem; height: 100px; font-family: "fira sans", sans-serif; } h1 { font: 1.6em "fira sans", sans-serif; margin-bottom: 1rem; } const channel = new broadcastchannel('example-channel'); channel.
addeventlistener('message', (event) => { received.textcontent = event.data; }); result specifications specification status html living standard livi...
Cache.put() - Web APIs
the put() method of the cache interface allows key/value pairs to be
added to the current cache object. often, you will just want to fetch() one 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 previously stored in the cache that matches the request. ...
...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 previously 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. ...
... response the response you want to match up to the request. return value a promise that resolves with undefined. note: the promise will reject with a typeerror if the url scheme is not http or https. ...
... response the response you want to match up to the request. return value a promise that resolves with undefined. note: the promise will reject with a typeerror if the url scheme is not http or https. ...
Cache - Web APIs
ng at both key and value for entries in the cache. note: the caching api doesn't honor http caching headers. methods cache.match(request, options) returns a promise that resolves to the response associated with the first matching request in the cache object. cache.matchall(request, options) returns a promise that resolves to an array of all matching requests in the cache object. ...
...cache. note: the caching api doesn't honor http caching headers. methods cache.match(request, options) returns a promise that resolves to the response associated with the first matching request in the cache object. cache.matchall(request, options) returns a promise that resolves to an array of all matching requests in the cache object. cache.
add(request) takes a url, retrieves it and
adds the resulting response object to the given cache. this is functionally equivalent to calling fetch(), then using put() to
add the results to the cache. cache.
addall(requests) takes an array of urls, retrieves them, and
adds the resulting response objects to the given cache. cache.put(request, response) takes both a request and its response and
adds it to the given cache. cache.delete(reques...
...torage interface. this is an implementation of the windoworworkerglobalscope mixin. note: in chrome, visit chrome://inspect/#service-workers and click on the "inspect" link below the registered service worker to view logging statements for the various actions the service-worker.js script is performing. var cache_version = 1; var current_caches = { font: 'font-cache-v' + cache_version }; self.
addeventlistener('activate', function(event) { // delete all caches that aren't named in current_caches. // while there is only one cache in this example, the same logic will handle the case where // there are multiple versioned caches. var expectedcachenamesset = new set(object.values(current_caches)); event.waituntil( caches.keys().then(function(cachenames) { return promise.all(...
...es) { return promise.all( cachenames.map(function(cachename) { if (!expectedcachenamesset.has(cachename)) { // if this cache name isn't present in the set of "expected" cache names, then delete it. ...
CacheStorage.open() - Web APIs
cachename the name of the cache you want to open. return value a promise that resolves to the requested cache object. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for an installevent to fire, then runs waituntil() to handle the install process for the app. ...
... the name of the cache you want to open. return value a promise that resolves to the requested cache object. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for an installevent to fire, then runs waituntil() to handle the install process for the app. ...
...pen. return value a promise that resolves to the requested cache object. examples this example is from the mdn sw-test example (see sw-test running live). here we wait for an installevent to fire, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open() to create a new cache, then using cache.
addall() to
add a series of assets to it. ...
...le (see sw-test running live). here we wait for an installevent to fire, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open() to create a new cache, then using cache.
addall() to
add a series of assets to it. ...
Compositing and clipping - Web APIs
« previousnext » in all of our previous examples, shapes were always drawn one on top of the other. 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. globalcompositeoperation = type this sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compos...
...alls outside of this path won't get drawn on the canvas. if we compare clipping paths to the globalcompositeoperation property we've seen above, we see two compositing modes that achieve more or less the same effect in source-in and source-atop. the most important differences between the two are that clipping paths are never actually drawn to the canvas and the clipping path is never affected by
adding new shapes. this makes clipping paths ideal for drawing multiple shapes in a restricted area. in the chapter about drawing shapes i only mentioned the stroke() and fill() methods, but there's a third method we can use with paths, called clip(). clip() turns the path currently being built into the current clipping path. you use clip() instead of closepath() to close a path and turn it in...
...drawing of a set of random stars to a particular region. ...
...particular region. ...
Drawing shapes with canvas - Web APIs
e path. then you use drawing commands to draw into the path. once the path has been created, you can stroke or fill the path to render it. here are the functions used to perform these steps: beginpath() creates a new path. once created, future drawing commands are directed into the path and used to build the path up. path methods methods to set different paths for objects. closepath()
adds a straight line to the path, going to the start of the current sub-path. stroke() draws the shape by stroking its outline. fill() draws a solid shape by filling the path's content area. the first step to create a path is to call the beginpath(). internally, paths are stored as a list of sub-paths (lines, arcs, etc) which together form a shape. every time this method is called, the list is ...
... rect(x, y, width, height) draws a rectangle whose top-left corner is specified by (x, y) with the specified width and height. before this method is executed, the moveto() method is automatically ...
...urveto(20, 80, 40, 102, 75, 120); ctx.beziercurveto(110, 102, 130, 80, 130, 62.5); ctx.beziercurveto(130, 62.5, 130, 25, 100, 25); ctx.beziercurveto(85, 25, 75, 37, 75, 40); ctx.fill(); } } screenshotlive sample rectangles in
addition to the three methods we saw in drawing rectangles, which draw rectangular shapes directly to the canvas, there's also the rect() method, which
adds a rectangular path to a currently open path. rect(x, y, width, height) draws a rectangle whose top-left corner is specified by (x, y) with the specified width and height. before this method is executed, the moveto() method is automatically called with the parameters (x,y). in other words, the current pen position is automatically reset to the default coordinates. making combinations so f...
...ly with another path as an argument (creates a copy), or optionally with a string consisting of svg path data. new path2d(); // empty path object new path2d(path); // copy from another path2d object new path2d(d); // path from svg path data all path methods like moveto, rect, arc or quadraticcurveto, etc., which we got to know above, are available on path2d objects. the path2d api also
adds a way to combine paths using the
addpath method. this can be useful when you want to build objects from several components, for example. path2d.
addpath(path [, transform])
adds a path to the current path with an optional transformation matrix. path2d example in this example, we are creating a rectangle and a circle. both are stored as a path2d object, so that they are available for later ...
Drawing text - Web APIs
measuretext() ...
... measuretext() returns a textmetrics object containing the width, in pixels, that the specified text wil...
... measuretext() returns a textmetrics object containing the width, in pixels, that the specified text will be when drawn in the current text style. the following code snippet ...
...('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; function drawcanvas() { ctx.clearrect(0, 0, canvas.width, canvas.height); eval(textarea.value); } reset.
addeventlistener('click', function() { textarea.value = code; drawcanvas(); }); edit.
addeventlistener('click', function() { textarea.focus(); }) textarea.
addeventlistener('input', drawcanvas); window.
addeventlistener('load', drawcanvas); advanced text measurements in the case you need to obtain more details about the text, the following method allows you to measure it. measuretext() returns a textmetrics object containing the width, in pixels, that the specified text will be when drawn in the current text style. the following code snippet shows how you can measure a text and get its w...
Pixel manipulation with canvas - Web APIs
for example, to paint the entire image represented by myima...
... we get the position of the mouse and crop an image of 5 pixels l...
... we get the position of the mouse and crop an image of 5 pixels left and above to 5 pixels right and below. then we copy that one over to another canvas and resize the image to ...
...none'; var zoomctx = document.getelementbyid('zoom').getcontext('2d'); var smoothbtn = document.getelementbyid('smoothbtn'); var togglesmoothing = function(event) { zoomctx.imagesmoothingenabled = this.checked; zoomctx.mozimagesmoothingenabled = this.checked; zoomctx.webkitimagesmoothingenabled = this.checked; zoomctx.msimagesmoothingenabled = this.checked; }; smoothbtn.
addeventlistener('change', togglesmoothing); var zoom = function(event) { var x = event.layerx; var y = event.layery; zoomctx.drawimage(canvas, math.min(math.max(0, x - 5), img.width - 10), math.min(math.max(0, y - 5), img.height - 10), 10, 10, 0, 0, 200, 200); }; canvas.a...
DataTransfer - Web APIs
th all types is removed. if data for the specified type does not exist, or the data transfer contains no data, this method will have no effect. datatransfer.getdata() retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer contains no data. datatransfer.setdata() set the data for a given type. ...
... deprecated methods datatransfer.mozcleardataat() removes the data associated with the given format for an item at the specified index. the index is in the range from zero to the number of items minus one. removed in firefox 71. ...
...oes not exist. the index should be in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozsetdataat() a data transfer may store multiple items, each at a given zero-based index. mozsetdataat() may only be called with an index argument less than mozitemcount in which case an existing item is modified, or equal to mozitemcount in which case a new item is
added, and the mozitemcount is incremented by one. removed in firefox 71. datatransfer.moztypesat() holds a list of the format types of the data that is stored for an item at the specified index. if the index is not in the range from 0 to the number of items minus one, an empty string list is returned. removed in firefox 71. examples every method and property listed in this document has its ow...
...hod and property listed in this document has its own reference page and each reference page either directly includes an example of the interface or has a link to an example. specifications specification status comment html living standardthe definition of 'datatransfer' in that specification. living standard mozcursor, mozitemcount, mozsourcenode, mozusercancelled,
addelement(), mozcleardataat(), mozgetdataat(), mozsetdataat() and moztypesat are gecko specific. html 5.1the definition of 'datatransfer' in that specification. recommendation not included in w3c html5 recommendation ...
Detecting device orientation - Web APIs
ne is the deviceorientationevent, which is sent when the accelerometer detects a change to the orientation of the device. by receiving and processing the data reported by these orientation events, it's possible to interactively respond to rotation and elevation changes caused by the user moving the device. the second event is the devicemotionevent, which is sent when a change in acceleration was
added. it is different from the deviceorientationevent because it is listening for changes in acceleration as opposed to orientation. sensors that are commonly capable of detecting devicemotionevent include sensors in laptops to protect moving storage devices. deviceorientationevent is more commonly found in mobile devices. processing orientation events all you need to do in order to begin receivin...
...ent is more commonly found in mobile devices. processing orientation events all you need to do in order to begin receiving orientation change is to listen to the deviceorientation event: note: gyronorm.js is a polyfill for normalizing the accelerometer and gyroscope data on mobile devices. this is useful for overcoming some of the differences in device support for device orientation. window.
addeventlistener("deviceorientation", handleorientation, true); after registering your event listener (in this case, a javascript function called handleorientation()), your listener function periodically gets called with updated orientation data. the orientation event contains four values: deviceorientationevent.absolute deviceorientationevent.alpha deviceorientationevent.beta deviceorientat...
... 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 e...
...e 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 properties: devicemotionevent.acceleration devicemotionevent.accelerationincludinggravity devicemotionevent.rotationrate devicemotionevent.interval motion values explain...
Document.createElement() - Web APIs
. 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". ...
...ample 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". ...
...in this case, our custom...
...e has been created dynamically.</div> </body> </html> javascript document.body.onload =
addelement; function
addelement () { // create a new div element const newdiv = document.createelement("div"); // and give it some content const newcontent = document.createtextnode("hi there and greetings!"); //
add the text node to the newly created div newdiv.appendchild(newcontent); //
add the newly created element and its content into the dom const currentdiv = document.getelementbyid("div1"); document.body.insertbefore(newdiv, currentdiv); } web component example the following example snippet is taken from our expanding-list-web-component example (see it live also). in this case, our custom element extends the htmlulistelement, which represents the <ul> element. // creat...
Document: drag event - Web APIs
raggable="true" ondragstart="event.datatransfer.setdata('text/plain',null)"> this div is draggable </div> </div> <div class="dropzone"></div> <div class="dropzone"></div> <div class="dropzone"></div> css #draggable { width: 200px; height: 20px; text-align: center; background: white; } .dropzone { width: 200px; height: 20px; background: blueviolet; margin-bottom: 10px; p
adding: 10px; } javascript var dragged; /* events fired on the draggable target */ document.
addeventlistener("drag", function(event) { }, false); document.
addeventlistener("dragstart", function(event) { // store a ref. on the dragged elem dragged = event.target; // make it half transparent event.target.style.opacity = .5; }, false); document.
addeventlistener("dragend", function(event) ...
...n(event) { }, false); document.
addeventlistener("dragstart", function(event) { // store a ref. ...
...= event.target; // make it half transparent event.target.style.opacity = .5; }, false); document.
addeventlistener("dragend", function(event) { // reset the transparency event.target.style.opacity = ""; }, false); /* events fired on the drop targets */ document.
addeventlistener("dragover", function(event) { // prevent default to allow drop event.preventdefault(); }, false); document.
addeventlistener("dragenter", function(event) { // highlight potential drop target when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.background = "purple"; } }, false); document.
addeventlistener("dragleave", function(event) { // reset background of potential drop target when the draggable element leaves it if (event.target.classname ==...
... when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.background = "purple"; } }, false); document.
addeventlistener("dragleave", function(event) { // reset background of potential drop target when the draggable element leaves it if (event.target.classname == "dropzone") { event.target.style.background = ""; } }, false); document.
addeventlistener("drop", function(event) { // prevent default action (open as link for some elements) event.preventdefault(); // 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 speci...
Document: wheel event - Web APIs
ollleft and scrolltop in the scroll event. examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel. ...
... working draft ...
... working draft ...
... working draft ...
Document - Web APIs
ed in the browser and serves as an entry point into the web page's content, which is the dom tree. the dom tree includes elements such as <body> and <table>, among many others. it provides functionality globally to the document, like how to obtain the page's url and create new elements in the document. ...
...root.elementfrompoint() returns the topmost element at the specified coordinates. documentorshadowroot.elementsfrompoint() returns an array of all elements at the specified coordinates. documentorshadowroot.caretpositionfrompoint() returns a caretposition object containing the dom node containing the caret, and caret's character offset within that node. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. scroll fired when the document view or an element has been scrolled. also available via the onscroll property. visibilitychange fired when the content of a tab has become visible or has been hidden. also available via the onvisibilitychange property. wheel fired when the user rotates a wheel ...
...a the ontransitionrun property. transitionstart fired when a css transition has actually started. also available via the ontransitionstart property. non-standard extensions firefox notes mozilla defines a set of non-standard properties made only for xul content: document.currentscript returns the <script> element that is currently executing. document.documenturiobject (mozilla
add-ons only!) returns the nsiuri object representing the uri of the document. this property only has special meaning in privileged javascript code (with universalxpconnect privileges). document.popupnode returns the node upon which a popup was invoked. document.tooltipnode returns the node which is the target of the current tooltip. mozilla also define some non-standard methods: document.ex...
...ification. candidate recommendation extend the document interface page visibility (second edition)the definition of 'document' in that specification. recommendation extend the document interface with the visibilitystate and hidden attributes and the onvisibilitychange event listener. selection apithe definition of 'document' in that specification. working draft
adds getselection(), onselectstart and onselectionchange. dom4the definition of 'document' in that specification. obsolete supersede dom 3 document object model (dom) level 3 core specificationthe definition of 'document' in that specification. obsolete supersede dom 2 document object model (dom) level 3 xpath specificationthe definition of 'xpathevaluator' in t...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
k> the 3 empty blocks we now have are not going to occupy any space in the final layout, because they don’t contain anything, so we’ll end up with only 2 blocks taking up space in the page. people viewing the web page see the words "hello" and "world!" on 2 separate lines as you’d expect 2 <div>s to be laid out. the browser engine has essentially ignored all of the whitespace that was
added in the source code. spaces in between inline and inline-block elements let's move on to look at a few issues that can arise due to whitespace, and what can be done about them. first of all, we'll look at what happens with spaces in between inline and inline-block elements. in fact, we saw this already in our very first example, when we described how whitespace is processed inside inline fo...
... are blocks, many people expect that they will behave as such, but really they don’t. if there is formatting whitespace between adjacent inline elements, this will result in space in the layout, just like the spaces between words in text. ...
...ist-style-type: none; margin: 0; p
adding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; background: #f06; border: 1px solid; } <ul class="people-list">⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ </ul> this renders as follows: hidden example 3 .people-list { list-style-type: none; margin: 0; p
adding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; background: #f06; border: 1px solid; } <ul class="people-list"> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> you probably don't want the gaps in between the blocks — depending on the use case (is this a list of avatars, or horizontal nav buttons?), you probably want the element sides flus...
... if you are wondering what is causing the problem, and are maybe thinking you've got some extra margin in there or something! there are a few ways of getting around this problem: use flexbox to create the horizontal list of items instead of trying an inline-block solution. this handles everything for you, and is definitely the preferred solution: ul { list-style-type: none; margin: 0; p
adding: 0; display: flex; } if you need to rely on inline-block, you could set the font-size of the list to 0. this only works if your blocks are not sized with ems (based on the font-size, so the block size would also end up being 0). rems would be a good choice here: ul { font-size: 0; ... } li { display: inline-block; width: 2rem; height: 2rem; ... } or you could set negative ma...
Element: blur event - Web APIs
html <form id="form"> <input...
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form>...
...ument.queryselector('input[type="password"]'); password.
addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }); password.
addeventlistener('blur', (event) => { event.target.style.background = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusout event, or by setting the usecapture parameter of
addeventlistener() to true. ...
... = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusout event, or by setting the usecapture parameter of
addeventlistener() to true. html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.
addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }, true); form.
addeventlistener('blur', (event) => { event.target.style.background = ''; }, true); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification ...
Element: focus event - Web APIs
html <form id="form"> <input ...
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> ...
...cument.queryselector('input[type="password"]'); password.
addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }); password.
addeventlistener('blur', (event) => { event.target.style.background = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusin event, or by setting the usecapture parameter of
addeventlistener() to true. ...
...d = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusin event, or by setting the usecapture parameter of
addeventlistener() to true. html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.
addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }, true); form.
addeventlistener('blur', (event) => { event.target.style.background = ''; }, true); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification ...
Element: mousedown event - Web APIs
th="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...lack; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...s let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...y gives the (x,y) offset from the edge of the canvas. ...
Element: mousemove event - Web APIs
th="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...lack; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...s let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...y gives the (x,y) offset from the edge of the canvas. ...
Element: mouseup event - Web APIs
th="560" height="360"></canvas> css canvas { border: 1px solid black; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...lack; width: 560px; height: 360px; } javascript // when true, moving the mouse draws on the canvas let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...s let isdrawing = false; let x = 0; let y = 0; const mypics = document.getelementbyid('mypics'); const context = mypics.getcontext('2d'); // event.offsetx, event.offsety gives the (x,y) offset from the edge of the canvas. ...
...y gives the (x,y) offset from the edge of the canvas. ...
EventSource - Web APIs
thods from its parent, eventtarget. eventsource.close() closes the connection, if any, and sets the readystate attribute to closed. if the connection is already closed, the method does nothing. events error fired when a connection to an event source failed to open. message fired when data is received from an event source. open fired when a connection to an event source has opened.
additionally, the event source itself may send messages with an event field, which will create ad-hoc events keyed to that value. examples in this basic example, an eventsource is created to receive unnamed events from the server; a page with the name sse.php is responsible for generating the events. var evtsource = new eventsource('sse.php'); var eventlist = document.queryselector('ul'); evtsour...
...list element already in the document. note: you can find a full example on github — see simple sse demo using php. to listen to named events, you'll require a listener for each type of event sent. ...
...a listener for each type of event sent. ...
...}) /* similarly, this will listen for events * with the field `event: update` */ sse.
addeventlistener("update", function(e) { console.log(e.data) }) /* the event "message" is a special case, as it * will capture events without an event field * as well as events that have the specific type * `event: message` it will not trigger on any * other event type. */ sse.
addeventlistener("message", function(e) { console.log(e.data) }) specifications specification status html living standardthe definition of 'eventsource' in that specification. living standard ...
EventTarget - Web APIs
cument, and window are the most common event targets, but other objects can be event targets, too. for example xmlhttprequest, audionode, audiocontext, and others. many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
...ll="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor eventtarget() creates a new eventtarget object instance. ...
... see also webidl bindings. ...
...uple of extensions for use by js-implemented event targets to implement onevent properties. see also webidl bindings. ...
ExtendableEvent - Web APIs
global scope as part of the service worker lifecycle. this ensures that any functional events (like fetchevent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. ...
...hrow an invalidstateerror; note also that multiple calls will stack up, and the resulting promises will be
added to the list of extend lifetime promises. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface. ...
...xample, the same approach can be used for multiple caches. it maps a shorthand identifier for a cache to a specific, versioned cache name. note: in chrome, logging statements are visible via the "inspect" interface for the relevant service worker accessed via chrome://serviceworker-internals. var cache_version = 1; var current_caches = { prefetch: 'prefetch-cache-v' + cache_version }; self.
addeventlistener('install', function(event) { var urlstoprefetch = [ './static/pre_fetched.txt', './static/pre_fetched.html', 'https://www.chromium.org/_/rsrc/1302286216006/config/customlogo.gif' ]; console.log('handling install event. resources to pre-fetch:', urlstoprefetch); event.waituntil( caches.open(current_caches['prefetch']).then(function(cache) { return cache...
...ventlistener('install', function(event) { var urlstoprefetch = [ './static/pre_fetched.txt', './static/pre_fetched.html', 'https://www.chromium.org/_/rsrc/1302286216006/config/customlogo.gif' ]; console.log('handling install event. ...
Fullscreen API - Web APIs
this makes it possible to present desired content—such as an online game—using the user's entire screen, removing all browser user interface elements and other applications from the screen until full-screen mode is shut off. see the article guide to the fullscreen api for details on how to use the api. note: support for this api varies somewhat across browsers, with many requiring vendor prefixes and/or not implementing the latest specification. see the browser compatibility section below for details on support for this api. ...
...oss browsers, with many requiring vendor prefixes and/or not implementing the latest specification. see the browser compatibility section below for details on support for this api. you may wish to consider using a library such as fscreen for vendor agnostic access to the fullscreen api. interfaces the fullscreen api has no interfaces of its own. instead, it augments several other interfaces to
add the methods, properties, and event handlers needed to provide full-screen functionality. these are listed in the following sections. methods the fullscreen api
adds methods to the document and element interfaces to allow turning off and on full-screen mode. methods on the document interface document.exitfullscreen() requests that the user agent switch from full-screen mode back to windowed...
...ff, as well as when errors occur during the process of changing between full-screen and windowed modes. event handlers for these events are available on the document and element interfaces. note: these event handler properties are not available as html content attributes. in other words, you cannot specify event handlers for fullscreenchange and fullscreenerror in the html content. they must be
added by javascript code. event handlers on documents document.onfullscreenchange an event handler for the fullscreenchange event that's sent to a document when that document is placed into full-screen mode, or when that document exits full-screen mode. this handler is called only when the entire document is presented in full-screen mode. document.onfullscreenerror an event handler for the fu...
...ation switcher (or alt-tab) will likewise exit full-screen mode. example in this example, a video is presented in a web page. pressing the return or enter key lets the user toggle between windowed and full-screen presentation of the video. view live examples watching for the enter key when the page is loaded, this code is run to set up an event listener to watch for the enter key. document.
addeventlistener("keypress", function(e) { if (e.keycode === 13) { togglefullscreen(); } }, false); toggling full-screen mode this code is called by the event handler above when the user hits the enter key. function togglefullscreen() { if (!document.fullscreenelement) { document.documentelement.requestfullscreen(); } else { if (document.exitfullscreen) { document.exit...
GlobalEventHandlers.onanimationiteration - Web APIs
amiliar. ...
...v class="main"> <div id="box"> <div id="text">box</div> </div> </div> <div class="button" id="play"> begin demonstration </div> css :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; p
adding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at t...
...font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll
add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; animation: 2s ease-in-out 0s infinite alternate both paused slidebox; } the animation's keyframes are defined next; they d...
... of the animation have occurred. the onanimationiteration event handler is then set up. it simply sets the box's animation-play-state to "paused", then updates the text displayed in the button to indicate that clicking the button will start playing the next iteration of theanimation. finally, we set up a handler for a click on the button that runs the animation: document.getelementbyid("play").
addeventlistener("click", function(event) { box.style.animationplaystate = "running"; iterationcounter++; }, false); this sets the box element's animation-play-state to "running" and increments the iteration counter. that's all there is to it! result assembled together, you get this: each time the box reaches the opposing corner, it stops, with the button reflecting which iteration number i...
HTMLButtonElement - Web APIs
the htmlbuttonelement interface provides properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <button> elements. ...
... html living standardthe definition of 'htmlbuttonelement' in that specification. living standard html 5.2the definition of 'htmlbuttonelement' in that specification. recommendation the menu attribute and type="menu" value have been removed. html 5.1the definition of 'htmlbuttonelement' in that specification. ...
... the type attribute is no more read-only. ...
... the type attribute is no more read-only. ...
HTMLElement: animationend event - Web APIs
e dom or the animation is removed from the element, the animationend event is not fired. ...
...e html <div class="animation-example"> <div class="container"> <p class="animation">you chose a cold night to visit our planet.</p> </div> <button class="activate" type="button">activate animation</button> <div class="event-log"></div> </div> css .container { height: 3rem; } .event-log { width: 25rem; height: 2rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { margin-left: 100%; width: 300%; } to { margin-left: 0%; width: 100%; } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); const...
...: 2; } @keyframes slidein { from { margin-left: 100%; width: 300%; } to { margin-left: 0%; width: 100%; } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); const applyanimation = document.queryselector('.animation-example>button.activate'); let iterationcount = 0; animation.
addeventlistener('animationstart', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation started' `; }); animation.
addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.
...ration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation ended'`; animation.classlist.remove('active'); applyanimation.textcontent = "activate animation"; }); animation.
addeventlistener('animationcancel', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation canceled'`; }); applyanimation.
addeventlistener('click', () => { animation.classlist.toggle('active'); animationeventlog.textcontent = ''; iterationcount = 0; let active = animation.classlist.contains('active'); if (active) { applyanimation.textcontent = "cancel ani...
HTMLElement: animationiteration event - Web APIs
ns with an animation-iteration-count of one. ...
... html <div class="animation-example"> <div class="container"> <p class="animation">you chose a cold night to visit our planet.</p> </div> <button class="activate" type="button">activate animation</button> <div class="event-log"></div> </div> css .container { height: 3rem; } .event-log { width: 25rem; height: 2rem; border: 1px solid black; margin: 0.2rem; p
adding: 0.2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { transform: translatex(100%) scalex(3); } to { transform: translatex(0) scalex(1); } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); ...
... } @keyframes slidein { from { transform: translatex(100%) scalex(3); } to { transform: translatex(0) scalex(1); } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); const applyanimation = document.queryselector('.animation-example>button.activate'); let iterationcount = 0; animation.
addeventlistener('animationstart', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation started' `; }); animation.
addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.
...ration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation ended'`; animation.classlist.remove('active'); applyanimation.textcontent = "activate animation"; }); animation.
addeventlistener('animationcancel', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation canceled'`; }); applyanimation.
addeventlistener('click', () => { animation.classlist.toggle('active'); animationeventlog.textcontent = ''; iterationcount = 0; let active = animation.classlist.contains('active'); if (active) { applyanimation.textcontent = "cancel ani...
HTMLElement: animationstart event - Web APIs
lay (and, correspondingly, the animation will begin playing at that time index into the sequence). ...
... html <div class="animation-example"> <div class="container"> <p class="animation">you chose a cold night to visit our planet.</p> </div> <button class="activate" type="button">activate animation</button> <div class="event-log"></div> </div> css .container { height: 3rem; } .event-log { width: 25rem; height: 2rem; border: 1px solid black; margin: 0.2rem; p
adding: 0.2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { transform: translatex(100%) scalex(3); } to { transform: translatex(0) scalex(1); } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); ...
... } @keyframes slidein { from { transform: translatex(100%) scalex(3); } to { transform: translatex(0) scalex(1); } } js const animation = document.queryselector('p.animation'); const animationeventlog = document.queryselector('.animation-example>.event-log'); const applyanimation = document.queryselector('.animation-example>button.activate'); let iterationcount = 0; animation.
addeventlistener('animationstart', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation started' `; }); animation.
addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.
...ration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.
addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation ended'`; animation.classlist.remove('active'); applyanimation.textcontent = "activate animation"; }); animation.
addeventlistener('animationcancel', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation canceled'`; }); applyanimation.
addeventlistener('click', () => { animation.classlist.toggle('active'); animationeventlog.textcontent = ''; iterationcount = 0; let active = animation.classlist.contains('active'); if (active) { applyanimation.textcontent = "cancel ani...
HTMLEmbedElement - Web APIs
the htmlembedelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <embed> elements. this topic describes the htmlembedelement interface as defined in the standard. it does not
address earlier, non-standardized version of the interface. ...
...provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <embed> elements. this topic describes the htmlembedelement interface as defined in the standard. it does not
address earlier, non-standardized version of the interface. ...
...to the surrounding context. the possible values are "left", "right", "center", and "justify". htmlembedelement.height is a domstring reflecting the height html attribute, containing the displayed height of the resource. htmlembedelement.name is a domstring representing the name of the embedded object. htmlembedelement.src is a domstring that reflects the src html attribute, containing the
address of the resource. htmlembedelement.type is a domstring that reflects the type html attribute, containing the type of the resource. htmlembedelement.width is a domstring that reflects the width html attribute, containing the displayed width of the resource. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comm...
...type of the resource. htmlembedelement.width is a domstring that reflects the width html attribute, containing the displayed width of the resource. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlembedelement' in that specification. living standard
adds two obsolete properties, name and align, to help with compatibility with old web sites. html5the definition of 'htmlembedelement' in that specification. recommendation initial definition. ...
HTMLIFrameElement - Web APIs
the htmliframeelement interface provides special properties and methods (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
...he linked resource. htmliframeelement.sandbox is a domsettabletokenlist that reflects the sandbox html attribute, indicating extra restrictions on the behavior of the nested content. htmliframeelement.scrolling is a domstring that indicates whether the browser should provide scrollbars for the frame. htmliframeelement.src is a domstring that reflects the src html attribute, containing the
address of the content to be embedded. note that programatically removing an <iframe>'s src attribute (e.g. via element.removeattribute()) causes about:blank to be loaded in the frame in firefox (from version 65), chromium-based browsers, and safari/ios. htmliframeelement.srcdoc is a domstring that represents the content to display in the frame. htmliframeelement.width is a domstring that reflect...
...rame. htmliframeelement.width is a domstring that reflects the width html attribute, indicating the width of the frame. methods inherits properties from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmliframeelement' in that specification. living standard the following property has been
added: allowfullscreen. html5the definition of 'htmliframeelement' in that specification. recommendation the following properties are now obsolete: scrolling, marginwidth, marginheight, longdesc, frameborder, and align. the following properties have been
added: srcdoc, sandbox, and contentwindow. document object model (dom) level 2 html specificationthe definition of 'html...
...ion. recommendation the following properties are now obsolete: scrolling, marginwidth, marginheight, longdesc, frameborder, and align. the following properties have been
added: srcdoc, sandbox, and contentwindow. document object model (dom) level 2 html specificationthe definition of 'htmliframeelement' in that specification. obsolete the contentdocument property has been
added. document object model (dom) level 1 specificationthe definition of 'htmliframeelement' in that specification. obsolete initial definition. ...
HTMLImageElement - Web APIs
the htmlimageelement interface represents an html <img> element, providing the properties and methods used to manipulate image elements. ...
...ing 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 prevents 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 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 c...
...reateelement('img'); // use dom htmlimageelement img2.src = 'image2.jpg'; img2.alt = 'alt text'; document.body.appendchild(img2); // using first image in the document alert(document.images[0].src); specifications specification status comment css object model (cssom) view modulethe definition of 'extensions to htmlimageelement' in that specification. working draft
added the x and y properties. html living standardthe definition of 'htmlimageelement' in that specification. living standard the following properties have been
added: srcset, currentsrc and sizes. html5the definition of 'htmlimageelement' in that specification. recommendation a constructor (with 2 optional parameters) has been
added. the following properties are now...
... document object model (dom) level 2 html specificationthe definition of 'htmlimgelement' in that specification. obsolete the lowsrc property has been removed. ...
HTMLInputElement - Web APIs
the htmlinputelement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. ...
...nt type value., if the element has no step value, if the value cannot be converted to a number, if the resulting value is above the max or below the min. htmlinputelement.mozgetfilenamearray() returns an array of all the file names from the input. htmlinputelement.mozsetfilenamearray() sets the filenames for the files selected on the input. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: input fires when the value of an <input>, <select>, or <textarea> element has been changed. note that this is actually fired on the htmlelement interface and also applies to contenteditable elements, but we've listed it here because it is most commonly used with form input elements. also available...
... 'htmlinputelement' in that specification. living standard html5the definition of 'htmlinputelement' in that specification. recommendation technically, the tabindex and accesskey properties, as well as the blur(), click(), and focus() methods, are now defined on htmlelement. the following properties are now obsolete: align and usemap. ...
... document object model (dom) level 2 html specificationthe definition of 'htmlinputelement' in that specification. obsolete the size property is now an unsigned long. the type property must be entirely given in lowercase characters. ...
HTMLSelectElement - Web APIs
the htmlselectelement interface represents a <select> html element. these elements also share all of the properties and methods of other html elements via the htmlelement interface. ...
...value property of the first selected option element if there is one, otherwise the empty string. htmlselectelement.willvalidateread only a boolean that indicates whether the button is a candidate for constraint validation. it is false if any conditions bar it from constraint validation. methods this interface inherits the methods of htmlelement, and of element and node. htmlselectelement.
add()
adds an element to the collection of option elements for this select element. htmlselectelement.blur() removes input focus from this element. this method is now implemented on htmlelement. htmlselectelement.checkvalidity() checks whether the element has any constraints and whether it satisfies them. if the element fails its constraints, the browser fires a cancelable invalid event at the ...
...the user. if there are problems, it fires a cancelable invalid event at the element, and returns false; if there are no problems, it returns true. htmlselectelement.setcustomvalidity() sets the custom validity message for the selection element to the specified message. use the empty string to indicate that the element does not have a custom validity error. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. example get information about the selected option /* assuming we have the following html <select id='s'> <option>first</option> <option selected>second</option> <option>third</option> <...
...on the <select>. this will tell you when the value changes, and you can then update anything you need to. see the example provided in the documentation for the change event for details. specifications specification status comment html living standardthe definition of 'htmlselectelement' in that specification. living standard since the latest snapshot, html5, it
adds the autocomplete property and the reportvalidity() method. html5the definition of 'htmlselectelement' in that specification. recommendation is a snapshot of html living standard. it
adds the autofocus, form, required, labels, selectedoptions, willvalidate, validity and validationmessage properties. the tabindex property and the blur() and focus() methods have been moved to...
HTMLTableElement.insertRow() - Web APIs
of rows, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newrow is an htmltablerowelement that references the new row. example this example uses insertrow(-1) to append a new row to a table. we then use htmltablerowelement.insertcell() to insert a new cell in the new row. ...
... new row to a table. we then use htmltablerowelement.insertcell() to insert a new cell in the new row. (to be valid html, a <tr> must have at least one <td> element.) finally, we
add some text to the cell using document.createtextnode() and node.appendchild(). ...
... living standard document object model (dom) level 2 html specificationthe definition of 'htmltableelement.insertrow()' in that specification. obsolete specifie...
... living standard document object model (dom) level 2 html specificationthe definition of 'htmltableelement.insertrow()' in that specification. obsolete specifies in more detail where the ro...
HTMLTableRowElement.insertCell() - Web APIs
of cells, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newcell is an htmltablecellelement that references the new cell. example this example uses htmltableelement.insertrow() to append a new row to a table. we then use insertcell(0) to insert a new cell in the new row. ...
...rtrow() to append a new row to a table. we then use insertcell(0) to insert a new cell in the new row. (to be valid html, a <tr> must have at least one <td> element.) finally, we
add some text to the cell using document.createtextnode() and node.appendchild(). ...
... living standard document object model (dom) level 2 html specificationthe definition of 'htmltablerowelement.insertcell()' in that specification. obsolete ...
... living standard document object model (dom) level 2 html specificationthe definition of 'htmltablerowelement.insertcell()' in that specification. obsolete initial definition ...
HTMLTrackElement: cuechange event - Web APIs
ires when a texttrack has changed the currently displaying cues. the event is fired at both the texttrack and at the htmltrackelement in which it's being presented, if any. ...
...the currently displaying cues. the event is fired at both the texttrack and at the htmltrackelement in which it's being presented, if any. ...
...ceives a cuechange event every time the currently-presented cue is changed. this happens even if the track isn't associated with a media element. if the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the htmltrackelement. ...
... the track isn't associated with a media element. if the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the htmltrackelement. let texttrackelem = document.getelementbyid("texttrack"); texttrackelem.
addeventlistener("cuechange", (event) => { let cues = event.target.track.activecues; }); in
addition, you can use the oncuechange event handler: let texttrackelem = document.getelementbyid("texttrack"); texttrackelem.oncuechange = (event) => { let cues = event.target.track.activecues; }); specifications specification status html living standardthe definition of 'cuechange' in that specification. living standard ...
HTMLTrackElement - Web APIs
the htmltrackelement interface represents an html <track> element within the dom. this element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. ...
...#0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltrackelement.kind is a domstring that reflects the kind html attribute, indicating how the text track is meant to be used. possible values are: subtitles, captions, descriptions, chapters, or metadata. htmltrackelement.src is a domstring that reflects the src html attribute, indicating the
address of the text track data. htmltrackelement.srclang is a domstring that reflects the srclang html attribute, indicating the language of the text track data. htmltrackelement.label is a domstring that reflects the label html attribute, indicating a user-readable title for the track. htmltrackelement.default a boolean reflecting the default attribute, indicating that the track is to be enab...
...mltrackelement.readystate read only returns an unsigned short that show the readiness state of the track: constant value description none 0 indicates that the text track's cues have not been obtained. loading 1 indicates that the text track is loading and there have been no fatal errors encountered so far. further cues might still be
added to the track by the parser. loaded 2 indicates that the text track has been loaded with no fatal errors. error 3 indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way. some or all of the cues are likely missing and will not be obtained. htmltrackelement.track read only returns text...
...abled, but when the user agent attempted to obtain it, this failed in some way. some or all of the cues are likely missing and will not be obtained. htmltrackelement.track read only returns texttrack is the track element's text track data. methods no specific method; inherits methods from its parent, htmlelement. events the following events may be fired on a <track> element, in
addition to any that may be fired at its parent, htmlelement. cuechange sent when the underlying texttrack has changed the currently-presented cues. this event is always sent to the texttrack but is also sent to the htmltrackelement if one is associated with the track. you may also use the oncuechange event handler to establish a handler for this event. usage notes loading of the track's text...
KeyboardEvent.code - Web APIs
ead. code values the code values for windows, linux, and macos are list on the keyboardevent: code values page. examples exercising keyboardevent html <p>press keys on the keyboard to see what the keyboardevent's key and code values are for each one.</p> <div id="output"> </div> css #output { font-family: arial, helvetica, sans-serif; border: 1px solid black; } javascript window.
addeventlistener("keydown", function(event) { let str = "keyboardevent: key='" + event.key + "' | code='" + event.code + "'"; let el = document.createelement("span"); el.innerhtml = str + "<br/>"; document.getelementbyid("output").appendchild(el); }, true); try it out to ensure that keystrokes go to the sample, click in the output box below before pressing keys. handle keybo...
...e the same four keys physically regardless of what the actual corresponding characters are, such as if the user is using an azerty keyboard. html <p>use the wasd (zqsd on azerty) keys to move and steer.</p> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="world"> <polygon id="spaceship" points="15,0 0,30 30,30"/> </svg> <script>refresh();</script> css .world { margin: 0px; p
adding: 0px; background-color: black; width: 400px; height: 400px; } #spaceship { fill: orange; stroke: red; stroke-width: 2px; } javascript the first section of the javascript code establishes some variables we'll be using. shipsize contains the size of the ship the player is moving around, for convenience. position is used to track the position of the ship within the play field. move...
...(position.y > 399) { position.y = 0; } } the refresh() function handles applying the rotation and position by using an svg transform. ...
...tion.y - (shipsize.height/2); let transform = "translate(" + x + " " + 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. ...
MediaQueryList.matches - Web APIs
when the value of matches changes by watching for the change event to be fired at the mediaquerylist. syntax var matches = <varm>mediaquerylist.matches; value a boolean which is true if the document currently matches the media query list; otherwise, it's false. ...
...tching for the change event to be fired at the mediaquerylist. syntax var matches = <varm>mediaquerylist.matches; value a boolean which is true if the document currently matches the media query list; otherwise, it's false. ...
... to be fired at the mediaquerylist. syntax var matches = <varm>mediaquerylist.matches; value a boolean which is true if the document currently matches the media query list; otherwise, it's false. ...
... = <varm>mediaquerylist.matches; value a boolean which is true if the document currently matches the media query list; otherwise, it's false. examples this example detects viewport orientation changes by creating a media query using the orientation media feature: function
addmqlistener(mq, callback) { if (mq.
addeventlistener) { mq.
addeventlistener("change", callback); } else { mq.
addlistener(callback); } }
addmqlistener(window.matchmedia("(orientation:landscape)"), event => { if (event.matches) { /* now in landscape orientation */ } else { /* now in portrait orientation */ } } ); specifications specification status comment css object model (cssom) view modulethe definition of 'matches' in that specification. wor...
MediaStream - Web APIs
e stream has been reached. this has been removed from the specification; you should instead check the value of mediastreamtrack.readystate to see if its value is ended for the track or tracks you want to ensure have finished playing. mediastream.id read only a domstring containing 36 characters denoting a universally unique identifier (uuid) for the object. ...
...tion; you should instead check the value of mediastreamtrack.readystate to see if its value is ended for the track or tracks you want to ensure have finished playing. mediastream.id read only a domstring containing 36 characters denoting a universally unique identifier (uuid) for the object. event handlers mediastream.on
addtrack an eventhandler containing the action to perform when an
addtrack event is fired when a new mediastreamtrack object is
added. mediastream.onremovetrack an eventhandler containing the action to perform when a removetrack event is fired when a mediastreamtrack object is removed from it. methods this interface inherits methods from its parent, eventtarget. mediastream.
addtrack() stores a copy of the mediastreamtrack given as argument. if the track ha...
... mediastream.clone() returns a clone of the mediastream object. the clone will, however, have a unique value for id. mediastream.getaudiotracks() returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to audio. ...
... returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to "video". the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.removetrack() removes the mediastreamtrack given as argument. if the track is not part of the mediastream object, nothing happens. events
addtrack fired when a new mediastreamtrack object is
added. also available via the on
addtrack property. removetrack fired when a mediastreamtrack object has been removed. also available via the onremovetrack property. active fired when the mediastream is activated. inactive fired when the mediastream is inactivated. specifications specification status comment ...
MediaStreamTrackEvent - Web APIs
the mediastreamtrackevent interface represents events which indicate that a mediastream has had tracks
added to or removed from the stream through calls to media stream api methods. these events are sent to the stream when these changes occur. ...
... the mediastreamtrackevent interface represents events which indicate that a mediastream has had tracks
added to or removed from the stream through calls to media stream api methods. these events are sent to the stream when these changes occur. ...
... constructor mediastreamtrackevent() constructs a new mediastreamtrackevent with the specified configuration. methods also inherits methods from its parent event. specifications specific...
... constructor mediastreamtrackevent() constructs a new mediastreamtrackevent with the specified configuration. ...
MouseEvent.relatedTarget - Web APIs
event.relatedtarget.id : "unknown"; mouseoutlog.innertext = `\nfrom ${event.target.id} into ${related} ${mouseoutlog.innertext}`; } function...
...event.relatedtarget.id : "unknown"; mouseoutlog.innertext = `\nfrom ${event.target.id} into ${related} ${mouseoutlog.innertext}`; } function overlistener(event) { let related = event.rela...
...event.relatedtarget.id : "unknown"; mouseoutlog.innertext = `\nfrom ${event.target.id} into ${related} ${mouseoutlog.innertext}`; } function overlistener(event) { let related = event.relatedtarget ? event.relatedtarget.id : "unknown"; ...
...{ flex-grow: 1; background: blue; } #log { max-height: 120px; overflow-y: scroll; } javascript const mouseoutlog = document.getelementbyid('log'), red = document.getelementbyid('red'), blue = document.getelementbyid('blue'); red.
addeventlistener('mouseover', overlistener); red.
addeventlistener('mouseout', outlistener); blue.
addeventlistener('mouseover', overlistener); blue.
addeventlistener('mouseout', outlistener); function outlistener(event) { let related = event.relatedtarget ? event.relatedtarget.id : "unknown"; mouseoutlog.innertext = `\nfrom ${event.target.id} into ${related} ${mouseoutlog.innertext}`; } function overlistener(event) { let related = event.relatedtarget ? event.relatedtarget.id : "unknown"; log.innertext = `\ninto ${event.target.id} from...
Navigator.sendBeacon() - Web APIs
ment is unloaded, where sending the data any sooner may miss some possible data collection. for example, which link the user clicked before navigating away and unloading the page. ensuring that data has been sent during the unloading of a document has traditionally been difficult, because user agents typically ignore asynchronous xmlhttprequests made in an unload handler. historically, this was
addressed with some of the following workarounds to delay the page unload long enough to send data to some url: submitting the data with a blocking synchronous xmlhttprequest call in unload or beforeunload event 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 ...
...k 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 previous 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.send(analyticsdata); }); this is what sendbeacon() replaces. with the sendbeacon() method, the data is transmitted asynchronously when the user agent has an opportunity to do so, without delaying unload or the next navigation. thi...
...d(analyticsdata); }); this is what sendbeacon() replaces. with the sendbeacon() method, the data is transmitted asynchronously when the user agent has an opportunity to do so, without delaying unload or the next navigation. ...
...next navigation. this solves all of the problems with submission of analytics data: the data is sent reliably it's sent asynchronously it doesn't impact the loading of the next page in
addition, the code is simpler to write than any of the older techniques! the following example shows a theoretical analytics code pattern that submits data to a server using the sendbeacon() method. window.
addeventlistener("unload", function logdata() { navigator.sendbeacon("/log", analyticsdata); }); the beacon sends an http request via the post method, with all relevant cookies available when called. specifications specification status comment beaconthe definition of 'sendbeacon()' in that specification. candidate recommendation initial definition ...
Notifications API - Web APIs
epts and usage on supported platforms, showing a system notification generally involves two things. first, the user needs to grant the current origin permission to display system notifications, which is generally done when the app or site initialises, using the notification.requestpermission() method. this should be done in response to a user gesture, such as clicking a button, for example: btn.
addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture. firefox is already doing this from version 72, for example. t...
...missions for notifications and push have been merged. if permission is granted for notifications, push will also be enabled. next, a new notification is created using the notification() constructor. this must be passed a title argument, and can optionally be passed an options object to specify options, such as text direction, body text, icon to display, notification sound to play, and more. ...
...rmission is granted for notifications, push will also be enabled. next, a new notification is created using the notification() constructor. this must be passed a title argument, and can optionally be passed an options object to specify options, such as text direction, body text, icon to display, notification sound to play, and more. ...
...xt, icon to display, notification sound to play, and more. in
addition, the notifications api spec specifies a number of
additions to the serviceworker api, to allow service workers to fire notifications. note: to find out more about using notifications in your own app, read using the notifications api. notifications interfaces notification defines a notification object. service worker
additions serviceworkerregistration includes the serviceworkerregistration.shownotification() and serviceworkerregistration.getnotifications() method, for controlling the display of notifications. serviceworkerglobalscope includes the serviceworkerglobalscope.onnotificationclick handler, for firing custom functions when a notification is clicked. notificationevent a specific type of event obj...
Path2D - Web APIs
erface of the canvas 2d api is used to declare a path that can then be used on a canvasrenderingcontext2d object. the path methods of the canvasrenderingcontext2d interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. constructors path2d() path2d constructor. creates a new path2d object. methods path2d.
addpath()
adds a path to the current path. path2d.closepath() causes the point of the pen to move back to the start of the current sub-path. it tries to draw a straight line from the current point to the start. if the shape has already been closed or has only one point, this function does nothing. path2d.moveto() moves the starting point of a new sub-path to the (x, y) coordinates. path2d.linet...
...f the current sub-path. it tries to draw a straight line from the current point to the start. if the shape has already been closed or has only one point, this function does nothing. path2d.moveto() moves the starting point of a new sub-path to the (x, y) coordinates. path2d.lineto() connects the last point in the subpath to the (x, y) coordinates with a straight line. ...
...e last point in the subpath to the (x, y) coordinates with a straight line. path2d.beziercurveto()
adds a cubic bézier curve to the path. it requires three points. the first two points are control points and the third one is the end point. the starting point is the last point in the current path, which can be changed using moveto() before creating the bézier curve. 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). ...
...t in the current path, which can be changed using moveto() before creating the bézier curve. 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 previous 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 f...
PaymentRequest.show() - Web APIs
x or the use of show().then().catch() to handle the response and any possible rejection. ...
...handle the response and any possible rejection. ...
...ptions); payrequest.onshipping
addresschange = ev => ev.updatewith(check
address(payrequest)); payrequest.onshippingoptionchange = ev => ev.updatewith(checkshipping(payrequest)); const repsonse = await payrequest.show(); await validateresponse(response); } catch(err) { /* handle the error; aborterror usually means a user cancellation */ } } in this code, the methods check
address() and checkshipping(), respectively, check the shipping
address and the shipping option changes and supply in response either a paymentdetailsupdate object or a promise to return one; this object contains the fields in the paymentresponse which have been or need to be changed. the validateresponse() method, below, is called once show() returns, in order to look at the returned response and e...
... the order. starting the payment process, in the end, is as simple as calling the processpayment() method. then/catch syntax you can also use the older promise-based approach to work with payments, using the then() and catch() functions on the promise returned by show(): function processspayment() { const payrequest = new paymentrequest(methoddata, details, options); payrequest.onshipping
addresschange = ev => ev.updatewith(check
address(payrequest)); payrequest.onshippingoptionchange = ev => ev.updatewith(checkshipping(payrequest)); payrequest.show() .then(response => validateresponse(response)) .catch(err => handleerror(err)); } this is functionally equivalent to the processpayment() method using the await syntax. function validateresponse(response) { checkallvalues...
Using the Permissions API - Web APIs
early stage, so support in browsers is pretty spotty: it can only be found in chrome 44 and later and firefox 43 and later. the only supported method right now is permissions.query(), which queries permission status. the only two apis currently recognized by the permissions api in chrome are geolocation and notification, with firefox also recognizing push and webmidi. more features will be
added as time progresses. a simple example for this article, we have put together a simple demo called location finder. it uses geolocation to query the user's current location and plot it out on a google map: you can run the example live, or view the source code on github. most of the code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so ch...
...uery the user's current location and plot it out on a google map: you can run the example live, or view the source code on github. most of the 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 ...
... } result.onchange = function() { report(result.state); } }); } function report(state) { console.log('permission ' + state); } handlepermission(); permission descriptors the permissions.query() method takes a permissiondescriptor dictionary as a parameter — this contains the name of the api you are interested in. some apis have more complex permissiondescriptors containing
additional information, which inherit from the default permissiondescriptor. for example, the pushpermissiondescriptor should also contain a boolean that specifies if uservisibleonly is true or false. revoking permissions starting in firefox 47, you can now revoke existing permissions, using the permissions.revoke() method. this works in exactly the same way as the permissions.query() method, exce...
...ols > page info > permissions > access your location. select always ask. chrome: hamburger menu > settings > show advanced settings. in the privacy section, click content settings. in the resulting dialog, find the location section and select ask when a site tries to... . finally, click manage exceptions and remove the permissions you granted to the sites you are interested in. however, future
additions to browser functionality should provide the request() method, which will allow us to programatically request permissions, any time we like. these should hopefully be available soon. ...
RTCDataChannel: error event - Web APIs
e error that occurred; see that article for details. ...
...", "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", "unrecognized parameters", "no user data (sctp data chunk has no data)", "cookie received while shutting down", "restart of an association with new
addresses", "user-initiated abort", "protocol violation" ]; dc.
addeventlistener("error", ev => { const err = ev.error; console.error("webrtc error: ", err.message); // handle specific error detail types switch(err.errordetail) { case "sdp-syntax-error": console.error(" sdp syntax error in line ", err.sdplinenumber); break; case "idp-load-failure": console.
...the error's name is rtcerror and the message is an error string specified by the webrtc la...
...an rtcerror object called error; rtcerror is an extension of the domexception interface. the error's name is rtcerror and the message is an error string specified by the webrtc layer. error information is output to the console using console.error(). the message string is always output, as is information about the source file's name, line number, and column number at which the error occurred. in
addition, however, depending on the value of errordetail,
additional information may be output. each error type has a different set of information output. for example, an sdp syntax error displays the line number of the error within the sdp, and an sctp error displays a message corresponding to the sctp cause code. other error types similarly output appropriate information. you can also set up an ev...
RTCIceCandidate.candidate - Web APIs
omes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56" port = 44323 type = "host" example in this example, we see a function which receives as input an sdp string containing an ice candidate received from the remote peer during the signaling process. ...
...6" port = 44323 type = "host" example in this example, we see a function which receives as input an sdp string containing an ice candidate received from the remote peer during the signaling process. ...
...cicecandidate(candidatesdp); mypeerconnection.
addicecandidate(candidateobj).catch({ /* handle the error thrown by
addicecandidate() */ }); } the handlenewicecandidate() function shown here passes the received candidate's sdp text into rtcicecandidate() to receive an rtcicecanddiate object in return, which represents the candidate. the new candidate is then passed into rtcpeerconnection.
addicecandidate() to
add the candidate to the list of candidates for webrtc to consider using for the connection being established. ...
...ate is then passed into rtcpeerconnection.
addicecandidate() to
add the candidate to the list of candidates for webrtc to consider using for the connection being established. this example could be simplified somewhat; you may more often see the code look something like this, taking advantage of more advanced ecmascript 2016 features: let handlenewicecandidate = candidatesdp => mypeerconnection.
addicecandidate(new rtcicecandidate(candidatesdp)); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.candidate' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.type - Web APIs
the rtcicecandidate interface's read-only type specifies the type of candidate the object represents. the type field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of type in the options object, but the
address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its cand-type field. syntax var type = rtcicecandidate.type; value a domstring whose value is one of those defined by the rtcicecandidatetype enumerated type. these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host the candidate is a host candidate, whose ip
address as specified in the rtcicecandidate.ip property is in fact the true
address of the remote peer. srflx ...
...tcicecandidatetype enumerated type. these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host the candidate is a host candidate, whose ip
address as specified in the rtcicecandidate.ip property is in fact the true
address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. ...
... the candidate is a host candidate, whose ip
address as specified in the rtcicecandidate.ip property is in fact the true
address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the ip is an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. relay the candidate is a relay candidate, obtained from a turn server. the relay candidate's ip
address is an
address the turn server uses to forward the media between the two peers. ...
... example in this example, the candidate's type is used to present a modified user interface for host candidates (those where the ip refers directly to the remote peer, rather than an intermediary). ...
RTCIceCandidate.usernameFragment - Web APIs
though the webrtc infrastructure will filter out obsolete candidates for you after an ice restart, you can do it yourself if you're trying to absolutely minimize the number of messages going back and forth. to do so, you can compare the value of usernamefragment to the current usernamefragment being used for the connection after receiving the candidate from the signaling server and before caling
addicecandidate() to
add it to the set of possible candidates. when the web app receives a message from the signaling server that includes a candidate to be
added to the rtcpeerconnection, you can (and generally should) simply call
addicecandidate(). there's not typically a need to manually worry about filtering the candidates. however, let's imagine that we do need to minimize traffic. the functio...
...s a candidate to be
added to the rtcpeerconnection, you can (and generally should) simply call
addicecandidate(). there's not typically a need to manually worry about filtering the candidates. however, let's imagine that we do need to minimize traffic. the function below, ssnewcandidate(), is called when a message, signalmsg, arrives from the signaling server that contains an ice candidate to be
added to the rtcpeerconnection. to avoid including candidates obsoleted by an ice restart, we can use code like this: const ssnewcandidate = signalmsg => { let candidate = new rtcicecandidate(signalmsg.candidate); let receivers = pc.getreceivers(); receivers.foreach(receiver => { let parameters = receiver.transport.getparameters(); if (parameters.usernamefragment === candidate.userna...
... specifications specification s...
...usernamefragment === candidate.usernamefragment) { return; } }); pc.
addicecandidate(candidate) .catch(reporterror); } this walks through the list of the rtcrtpreceiver objects being used to receive ice data, and looks to see if the usernamefragment indicated in the candidate matches any of them. if it does, ssnewcandidate() aborts. otherwise, after checking every receiver, it
adds the new candidate to the connection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.usernamefragment' in that specification. candidate recommendation initial definition. ...
RTCIceCandidatePairStats - Web APIs
andidatepairstats dictionary reports statistics which provide insight into the quality and performance of an rtcpeerconnection while connected and configured as described by the specified pair of ice candidates. if a rtcstats-based object's type is candidate-pair, it's an rtcicecandidatepairstats object. properties rtcicecandidatepairstats is based upon rtcstats and inherits its properties. in
addition, it
adds the following new properties: availableincomingbitrate optional provides an informative value representing the available inbound capacity of the network by reporting the total number of bits per second available for all of the candidate pair's incoming rtp streams. this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. av...
...vailable outbound capacity of the network by reporting the total number of bits per second available for all of the candidate pair's outoing rtp streams. this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. bytesreceieved optional the total number of payload bytes received (that is, the total number of bytes received minus any headers, p
adding, or other administrative overhead) on this candidate pair so far. bytessent optional the total number of payload bytes sent (that is, the total number of bytes sent minus any headers, p
adding, or other administrative overhead) so far on this candidate pair. circuitbreakertriggercount optional an integer value indicating the number of times the circuit-breaker has been triggered for this pa...
...the circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted. ...
...the circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted. consentexpiredtimestamp optional a domhighrestimestamp value indicating the time at which the most recent stun binding response expired. ...
RTCIceCandidateType - Web APIs
the webrtc api's rtcicecandidatetype enumerated type provides a set of domstring values representing the types of ice candidate that can arrive. these strings are taken directly from the candidate a-line in sdp. values these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
...of domstring values representing the types of ice candidate that can arrive. these strings are taken directly from the candidate a-line in sdp. values these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host the candidate is a host candidate, whose ip
address as specified in the rtcicecandidate.ip property is in fact the true
address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the ip is an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. relay the candidate is a relay candidate...
... usage notes the rtcicecandidatetype enumeration is used by the type property of rtcicecandidate objects, as well as when reporting statistics on candidates using rtcicecandidatestats.candidatetype. ...
... usage notes the rtcicecandidatetype enumeration is used by the type property of rtcicecandidate objects, as well as when reporting statistics on candidates using rtcicecandidatestats.candidatetype. ...
Range.extractContents() - Web APIs
html attribute events are retained or duplicated as they are for the node.clonenode() method. html id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appended to the document. partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. ...
...pendchild(documentfragment); moving items between containers this example lets you move items between two containers. select one or more item, and then click "swap" to move them to the opposite container. ...
...en containers this example lets you move items between two containers. select one or more item, and then click "swap" to move them to the opposite container. ...
...ap">swap selected item(s)</button> <p id="list2">abcdef</p> css body { pointer-events: none; } p { border: 1px solid; font-size: 2em; p
adding: .3em; } button { font-size: 1.2em; p
adding: .5em; pointer-events: auto; } javascript const list1 = document.getelementbyid('list1'); const list2 = document.getelementbyid('list2'); const button = document.getelementbyid('swap'); button.
addeventlistener('click', e => { selection = window.getselection(); for (let i = 0; i < selection.rangecount; i++) { const range = selection.getrangeat(i); if (range.commonancestorcontainer === list1 || range.commonancestorcontainer.parentnode === list1) { const documentfragment = range.extractcontents(); list2.appendchild(documentfragment); } else if (range.comm...
ResizeObserver - Web APIs
see the box model for further explanation. resizeobserver avoids infinite callback loops and cyclic dependencies that are often created when resizing via a callback function. ...
...see the box model for further explanation. resizeobserver avoids infinite callback loops and cyclic dependencies that are often created when resizing via a callback function. ...
...ll not change in response to the <div>'s width changing. ...
... editor's draft initial definition. ...
ScriptProcessorNode - Web APIs
channel interpretation "speakers" properties inherits properties from its parent, audionode. scriptprocessornode.buffersize read only returns an integer representing both the input and output buffer size. its value can be a power of 2 value in the range 256–16384. methods no specific methods; inherits methods from its parent, audionode. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: audioprocess fired when an input buffer of a scriptprocessornode is ready to be processed. also available via the onaudioprocess event handler property. examples the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process i...
...ntlistener() or by assigning an event listener to the oneventname property of this interface: audioprocess fired when an input buffer of a scriptprocessornode is ready to be processed. also available via the onaudioprocess event handler property. ...
...k loaded via audiocontext.decodeaudiodata(), process it,
adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and
add a small amount of white noise, before setting that result to be the output sample in each case. note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audio...
...(var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; //
add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scrip...
Selection.selectAllChildren() - Web APIs
the selection.selectallchildren() method
adds all the children of the specified node to the selection. previous selection is lost. syntax sel.selectallchildren(parentnode) parameters parentnode all children of parentnode will be selected. parentnode itself is not part of the selection. ...
...dds all the children of the specified node to the selection. previous selection is lost. syntax sel.selectallchildren(parentnode) parameters parentnode all children of parentnode will be selected. parentnode itself is not part of the selection. ...
...cified node to the selection. previous selection is lost. syntax sel.selectallchildren(parentnode) parameters parentnode all children of parentnode will be selected. parentnode itself is not part of the selection. ...
... will be selected. parentnode itself is not part of the selection. example html <main> <button>select footer</button> <p>welcome to my website.</p> <p>i hope you enjoy your visit.</p> </main> <footer> <
address>webmaster@example.com</
address> <p>© 2019</p> </footer> javascript const button = document.queryselector('button'); const footer = document.queryselector('footer'); button.
addeventlistener('click', (e) => { window.getselection().selectallchildren(footer); }); result specifications specification status comment selection apithe definition of 'selection.selectallchildren()' in that specification. working draft current definition ...
Selection - Web APIs
is is the number of child nodes of the focusnode preceding the focus. selection.iscollapsedread only returns a boolean indicating whether the selection's start and end points are at the same position. selection.rangecountread only returns the number of ranges in the selection. selection.typeread only returns a domstring describing the type of the current selection. methods selection.
addrange() a range object that will be
added to the selection. selection.collapse() collapses the current selection to a single point. selection.collapsetoend() collapses the selection to the end of the last range in the selection. selection.collapsetostart() collapses the selection to the start of the first range in the selection. selection.containsnode() indicates if a certain node is part...
...details. selection.extend() moves the focus of the selection to a specified point. selection.getrangeat() returns a range object representing one of the ranges currently selected. selection.modify() changes the current selection. selection.removerange() removes a range from the selection. selection.removeallranges() removes all ranges from the selection. selection.selectallchildren()
adds all the children of the specified node to the selection. selection.setbaseandextent() sets the selection to be a range including all or parts of two specified dom nodes, and any content located between them. selection.setposition() collapses the current selection to a single point. this is an alias for collapse() — see selection.collapse() for more details. selection.tostring() returns a...
...ide 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: selection.collapse() selection.collapsetostart() selection.collapsetoend() selection.extend() selection.selectallchildren() selection.
addrange() selection.setbaseandextent() and when the range is modified using the following methods: range.setstart() range.setend() range.setstartbefore() range.setstartafter() range.setendbefore() range.setendafter() range.collapse() range.selectnode() range.selectnodecontents() glossary other key terms used in this section. anchor the anchor of a selection is the beginning poin...
...guous part of a document. a range can contain entire nodes as well as portions of nodes (such as a portion of a text node). a user will normally only select a single range at a time, but it's possible for a user to select multiple ranges (e.g., by using the control key). a range can be retrieved from a selection as a range object. range objects can also be created via the dom and programmatically
added or removed from a selection. specifications specification status comment selection apithe definition of 'selection' in that specification. working draft the selection api specification is based on the html editing apis specification and focuses on the selection-related functionality. ...
ServiceWorkerRegistration - Web APIs
e server for an updated version of the service worker without consulting caches. serviceworkerregistration.unregister() unregisters the service worker registration and returns a promise. the service worker will finish any ongoing operations before it is unregistered. examples in this example, the code first checks whether the browser supports service workers and if so registers one. ...
...xt, it
adds an updatefound listener in which it uses the service worker registration to listen for further changes to the service worker's state. if the service worker hasn't changed since the last time it was registered, then the updatefound event will not be fired. if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw.js') .then(function(registration) { registration.
addeventlistener('updatefound', function() { // if updatefound is fired, it means that there's // a new service worker being installed. var installingworker = registration.installing; console.log('a new service worker is being installed:', installingworker); // you can listen for changes to the installing service worker's // state via installingworker.onst...
... ...
...e workers are not supported.'); } specifications specification status comment service workersthe definition of 'serviceworkerregistration' in that specification. working draft initial definition. push apithe definition of 'pushmanager' in that specification. working draft
adds the pushmanager property. notifications api living standard
adds the shownotification() method and the getnotifications() method. web background synchronization living standard
adds the sync property. ...
Using readable streams - Web APIs
s we will look at various examples in this article, taken from our dom-examples/streams repo. you can find the full source code there, as well as links to the examples. consuming a fetch as a stream the fetch api allows you to fetch resources across the network, providing a modern alternative to xhr. it has a number of advantages, and what is really nice about it is that browsers have recently
added the ability to consume a fetch response as a readable stream. the body mixin now includes the body property, which is a simple getter exposing the body contents as a readable stream. this mixin is implemented by both the request and response interfaces, so it is available on both, although consuming the stream of a response body is perhaps a bit more obvious. as our simple stream pump example...
...trollers you’ll notice that the start() and pull() methods passed into the readablestream() constructor are given controller 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 previously-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 construct...
...) is then used to enqueue it into the stream. when the button is pressed, the interval is cancelled, and a function called readstream() is invoked to read the data back out of the stream again. we also close the stream, as we’ve stopped enqueuing chunks to it. ...
...ueuing chunks to it. ...
SubtleCrypto.exportKey() - Web APIs
ment.queryselector(".exported-key"); exportkeyoutput.textcontent = `[${exportedkeybuffer}]`; } /* generate an encrypt/decrypt secret key, then set up an event listener on the "export" button. */ window.crypto.subtle.generatekey( { name: "aes-gcm", length: 256, }, true, ["encrypt", "decrypt"] ).then((key) => { const exportbutton = document.queryselector(".raw"); exportbutton.
addeventlistener("click", () => { exportcryptokey(key); }); }); pkcs #8 export this example exports an rsa private signing key as a pkcs #8 object. the exported key is then pem-encoded. see the complete code on github. /* convert an arraybuffer into a string from https://developers.google.com/web/updates/2012/06/how-to-convert-arraybuffer-to-and-from-string */ function ab2str(buf) { retu...
...nt listener on the "export" button. */ window.crypto.subtle.generatekey( { name: "rsa-pss", // consider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["sign", "verify"] ).then((keypair) => { const exportbutton = document.queryselector(".pkcs8"); exportbutton.
addeventlistener("click", () => { exportcryptokey(keypair.privatekey); }); }); subjectpublickeyinfo export this example exports an rsa public encryption key as a pem-encoded subjectpublickeyinfo object. see the complete code on github. /* convert an arraybuffer into a string from https://developers.google.com/web/updates/2012/06/how-to-convert-arraybuffer-to-and-from-string */ function ab2...
...istener on the "export" button. */ window.crypto.subtle.generatekey( { name: "rsa-oaep", // consider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["encrypt", "decrypt"] ).then((keypair) => { const exportbutton = document.queryselector(".spki"); exportbutton.
addeventlistener("click", () => { exportcryptokey(keypair.publickey); }); }); json web key import this code exports an ecdsa private signing key as a json web key object. see the complete code on github. /* export the given key and write it into the "exported-key" space. */ async function exportcryptokey(key) { const exported = await window.crypto.subtle.exportkey( "jwk", key );...
...selector(".exported-key"); exportkeyoutput.textcontent = json.stringify(exported, null, " "); } /* generate a sign/verify key pair, then set up an event listener on the "export" button. */ window.crypto.subtle.generatekey( { name: "ecdsa", namedcurve: "p-384" }, true, ["sign", "verify"] ).then((keypair) => { const exportbutton = document.queryselector(".jwk"); exportbutton.
addeventlistener("click", () => { exportcryptokey(keypair.privatekey); }); }); specifications specification status comment web cryptography apithe definition of 'subtlecrypto.exportkey()' in that specification. recommendation initial definition. ...
SubtleCrypto.verify() - Web APIs
se set the "invalid" class. */ async function verifymessage(publickey) { const signaturevalue = document.queryselector(".rsassa-pkcs1 .signature-value"); signaturevalue.classlist.remove("valid", "invalid"); let encoded = getmessageencoding(); let result = await window.crypto.subtle.verify( "rsassa-pkcs1-v1_5", publickey, signature, encoded ); signaturevalue.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 "message" textbox, and encode it in a form we can use for sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".rsa-pss #message"); let message = messagebox.value; let enc = new textencoder(); ...
...see the complete code on github. /* fetch the contents of the "message" textbox, and encode it in a form we can use for sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".ecdsa #message"); let message = messagebox.value; let enc = new textencoder(); retu...
...see the complete code on github. /* fetch the contents of the "message" textbox, and encode it in a form we can use for sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".hmac #message"); let message = messagebox.value; let enc = new textencoder(); re...
...he signature. * otherwise set the "invalid" class. */ async function verifymessage(key) { const signaturevalue = document.queryselector(".hmac .signature-value"); signaturevalue.classlist.remove("valid", "invalid"); let encoded = getmessageencoding(); let result = await window.crypto.subtle.verify( "hmac", key, signature, encoded ); signaturevalue.classlist.
add(result ? "valid" : "invalid"); } specifications specification status comment web cryptography apithe definition of 'subtlecrypto.verify()' in that specification. recommendation initial definition. ...
TextTrack: cuechange event - Web APIs
anged the currently displaying cues. the event is fired at both the texttrack and at the htmltrackelement in which it's being presented, if any. ...
...s. the event is fired at both the texttrack and at the htmltrackelement in which it's being presented, if any. ...
...ceives a cuechange event every time the currently-presented cue is changed. this happens even if the track isn't associated with a media element. if the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the htmltrackelement. ...
... the track isn't associated with a media element. if the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the htmltrackelement. let texttrackelem = document.getelementbyid("texttrack"); texttrackelem.
addeventlistener("cuechange", (event) => { let cues = event.target.track.activecues; }); in
addition, you can use the oncuechange event handler: let texttrackelem = document.getelementbyid("texttrack"); texttrackelem.oncuechange = (event) => { let cues = event.target.track.activecues; }); specifications specification status html living standardthe definition of 'cuechange' in that specification. living standard ...
TouchEvent - Web APIs
the touchevent interface represents an uievent which is sent when the state of contacts with a touch-sensitive surface changes. this surface can be a touch screen or trackpad, for example. the event can describe one or more points of contact with the screen and includes support for detecting movement,
addition and removal of contact points, and so forth. touches are represented by the touch object; each touch is described by a position, size and shape, amount of pressure, and target element. ...
...e screen and includes support for detecting movement,
addition and removal of contact points, and so forth. touches are represented by the touch object; each touch is described by a position, size and shape, amount of pressure, and target element. lists of touches are represented by touchlist objects. ...
... an event of some kind occurred 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 preventdefault() 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 preventdefault() 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 we...
...t. globaleventhandlers.ontouchmove a global event handler for the touchmove event. globaleventhandlers.ontouchcancel a global event handler for the touchcancel event. example see the example on the main touch events article. specifications specification status comment touch events – level 2the definition of 'touchevent' in that specification. draft
added ontouchstart, ontouchend, ontouchmove, ontouchend global attribute handlers touch eventsthe definition of 'touchevent' in that specification. recommendation initial definition. ...
Touch events - Web APIs
hod. create a canvas <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"> your browser does not support canvas element. </canvas> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below will be called. function startup() { var el = document.getelementbyid("canvas"); el.
addeventlistener("touchstart", handlestart, false); el.
addeventlistener("touchend", handleend, false); el.
addeventlistener("touchcancel", handlecancel, false); el.
addeventlistener("touchmove", handlemove, false); } document.
addeventlistener("domcontentloaded", startup); this simply sets up all the event listeners for our <canvas> element so we can handle the touch events as they occur. track...
...the result is that we stop tracking that touchpoint. handling canceled touches if the user's finger wanders into browser ui, or the touch otherwise needs to be canceled, the touchcancel event is sent, and we call the handlecancel() function below. function handlecancel(evt) { evt.preventdefault(); console.log("touchcancel."); var touches = evt.changedtouche...
...xbyid(idtofind) { for (var i = 0; i < ongoingtouches.length; i++) { var id = ongoingtouches[i].identifier; if (id == idtofind) { return i; } } return -1; // not found } showing what's going on function log(msg) { var p = document.getelementbyid('log'); p.innerhtml = msg + "\n" + p.innerhtml; } if your browser supports it, you can see it live. jsfiddle example
additional tips this section provides
additional tips on how to handle touch events in your web application. handling clicks since calling preventdefault() on a touchstart or the first touchmove event of a series prevents the corresponding mouse events from firing, it's common to call preventdefault() on touchmove rather than touchstart. that way, mouse events can still fire and things like links ...
... recommendation initial definition. ...
VideoTrackList: change event - Web APIs
the change event is fired when a video track is made active or inactive, for example by changing the track's selected property. ...
... the change event is fired when a video track is made active or inactive, for example by changing the track's selected property. ...
...t handler property onchange examples using
addeventlistener(): const videoelement = document.queryselector('video'); videoelement.videotracks.
addeventlistener('change', (event) => { console.log(`'${event.type}' event fired`); }); // changing the value of `selected` will trigger the `change` event const toggletrackbutton = document.queryselector('.toggle-track'); toggletrackbutton.
addeventlistener('click', () => { const track = videoelement.videotracks[0]; track.selected = !track.selected; }); using the onchange event handler property: const videoelement = document.queryselector('video'); videoelement.videotracks.onchange = (event) => { console.log(`'${event.type}' event fired`); }; // changing the value of `selected` will trigger the `change` event const toggletra...
... living standard ...
Compressed texture formats - Web APIs
textures are uncompressed on the fly when being accessed by a shader. ...
...textures are uncompressed on the fly when being accessed by a shader. note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as png and jpg. ...
...textures are uncompressed on the fly when being accessed by a shader. note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as png and jpg. ...
...herefore no specific formats are required by webgl; instead, a context can make different formats available, depending on hardware support. this site shows which formats are supported in the used browser. usage of compressed formats first requires activating the respective extension with webglrenderingcontext.getextension(). if supported, it will return an extension object with constants for the
added formats and the formats will also be returned by calls to gl.getparameter(gl.compressed_texture_formats). (e.g. ext.compressed_rgba_s3tc_dxt1_ext for the webgl_compressed_texture_s3tc extension.) these can then be used with compressedteximage[23]d or compressedtexsubimage[23]d instead of teximage2d calls. note that webgl makes no functionality available to compress or decompress textures: they...
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. ...
... // tell webgl how to pull out the positions from the position // buffer into the vertexposition attribute { const numcomponents = 3; ... gl.vertexattribpointer( programinfo.attriblocations.vertexposition, numcomponents, type, normalize, stride, offs...
...rray_buffer, new uint16array(indices), gl.static_draw); return { position: positionbuffer, color: colorbuffer, indices: indexbuffer, }; } the indices array defines each face like a pair of triangles, specifying each triangle's vertices as an index into the cube's vertex arrays. thus the cube is described as a collection of 12 triangles. drawing the cube next we need to
add code to our drawscene() function to draw using the cube's index buffer,
adding new gl.bindbuffer() and gl.drawelements() calls: // tell webgl which indices to use to index the vertices gl.bindbuffer(gl.element_array_buffer, buffers.indices); ... { const vertexcount = 36; const type = gl.unsigned_short; const offset = 0; gl.drawelements(gl.triangles, vertexcount, type, of...
..... { const vertexcount = 36; const type = gl.unsigned_short; const offset = 0; gl.drawelements(gl.triangles, vertexcount, type, offset); } since each face of our cube is comprised of two triangles, there are 6 vertices per side, or 36 total vertices in the cube, 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 « previousnext » ...
Using shaders to apply color in WebGL - Web APIs
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. ...
...e fixed color of white to each pixel, the entire square was rendered as solid white. let's say we want to render a gradient in which each corner of the square is a different color: red, blue, green, and white. the first thing to do is to establish these colors for the four vertices. to do this, we first need to create an array of vertex colors, then store it into a webgl buffer. we'll do that by
adding the following code to our initbuffers() function: function initbuffers(){ ... const colors = [ 1.0, 1.0, 1.0, 1.0, // white 1.0, 0.0, 0.0, 1.0, // red 0.0, 1.0, 0.0, 1.0, // green 0.0, 0.0, 1.0, 1.0, // blue ]; const colorbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, colorbuffer); gl.bufferdata(gl.array_buffer, new float32array...
...he interpolated color for each pixel, we need to change this to fetch the value from the vcolor varying: const fssource = ` varying lowp vec4 vcolor; void main(void) { gl_fragcolor = vcolor; } `; each fragment receives the interpolated color based on its position relative to the vertex positions instead of a fixed value. ...
...essary to
add code to look up the attribute location for the colors and setup that attribute for the shader program: const programinfo = { program: shaderprogram, attriblocations: { vertexposition: gl.getattriblocation(shaderprogram, 'avertexposition'), vertexcolor: gl.getattriblocation(shaderprogram, 'avertexcolor'), }, ... then, drawscene() can have the following
added to it so it actually uses these colors when drawing the square: // tell webgl how to pull out the colors from the color buffer // into the vertexcolor attribute. { const numcomponents = 4; const type = gl.float; const normalize = false; const stride = 0; const offset = 0; gl.bindbuffer(gl.array_buffer, buffers.color); gl.vertexattribpointer( programinf...
WebGL best practices - Web APIs
webgl is a complicated api, and it's often not obvious what the recommended ways to use it are. this page tackles recommendations across the spectrum of expertise, and not only highlights dos and don'ts, but also details why. you can rely on this document to guide your choice of approach, and ensure you're on the right track no matter what browser or hardware your users run. general topics
address and eliminate webgl errors your application should run without generating any webgl errors (as returned by geterror). every webgl error is reported in the web console as a javascript warning with a descriptive message. after too many errors (32 in firefox), webgl stops generating descriptive messages, which really hinders debugging. the only errors a well-formed page generates are out_of_memory...
... and then just interpolated among fragments (via varyings) is a performance boon. (the interpolation of varyings is very cheap, and is done automatically for you through the fixed functionality rasterization phase of the graphics pipeline) for example, a simple animation of a textured surface can be achieved through a time-dependent transformation of texture coordinates. (the simplest case being
adding a uniform vector to the texture coordinates attribute vector) if visually acceptable, one can transform the texture coordinates in the vertex shader rather than in the fragment shader, to get better performance. one common trade-off is to some lighting calculations per-vertex instead of per-fragment (pixel). in some cases, especially with simple models or dense vertices, this looks good enoug...
...t have been detected following any draw call or a call to glvalidateprogram a call to glvalidateprogram must report all errors associated with a program object given the current gl state. the allocation of tasks between the compiler and linker is implementation dependent. consequently there are many errors which may be detected either at compile or link time, depending on the implementation.
additionally, querying compile status is a synchronous call, which breaks pipelining. instead of: gl.compileshader(vs); if (!gl.getshaderparameter(vs, gl.compile_status)) { console.error('vs compile failed: ' + gl.getshaderinfolog(vs)); } gl.compileshader(fs); if (!gl.getshaderparameter(fs, gl.compile_status)) { console.error('fs compile failed: ' + gl.getshaderinfolog(fs)); } gl.linkprogram(...
...stc has both higher quality and/or higher compression, but is only supported on newer hardware. basis universal texture compression format/library basis universal solves several of the issues mentioned above. it offers a way to support all common compressed texture formats with a single compressed texture file, through a javascript library that efficiently converts formats at load time. it also
adds
additional compression that makes basis universal compressed texture files much smaller than regular compressed textures over-the-wire, more comparable to jpeg. https://github.com/binomialllc/basis_universal/blob/master/webgl/readme.md memory usage of depth and stencil formats depth and stencil attachments and formats are actually inseparable on many devices. you may ask for depth_component24...
A simple RTCDataChannel sample - Web APIs
nction is called. function startup() { connectbutton = document.getelementbyid('connectbutton'); disconnectbutton = document.getelementbyid('disconnectbutton'); sendbutton = document.getelementbyid('sendbutton'); messageinputbox = document.getelementbyid('message'); receivebox = document.getelementbyid('receivebox'); // set event listeners for user interface widgets connectbutton.
addeventlistener('click', connectpeers, false); disconnectbutton.
addeventlistener('click', disconnectpeers, false); sendbutton.
addeventlistener('click', sendmessage, false); } this is quite straightforward. we grab references to all the page elements we'll need to access, then set event listeners on the three buttons. establishing a connection when the user clicks the "connect" button, the con...
...up each connection with ice candidate listeners; these will be called when there's a new ice candidate to tell the other side about. ...
...; each side provides, one at a time, a suggested way to connect (for example, udp, udp with a relay, tcp, etc.) by calling rtcpeerconnection.
addicecandidate(), and they go back and forth until agreement is reached. but here, we just accept the first offer on each side, since there's no actual networking involved. localconnection.onicecandidate = e => !e.candidate || remoteconnection.
addicecandidate(e.candidate) .catch(handle
addcandidateerror); remoteconnection.onicecandidate = e => !e.candidate || localconnection.
addicecandidate(e.candidate) .catch(handle
addcandidateerror); we configure each rtcpeerconnection to have an event handler for the icecandidate event. start the connection attempt the last thing we need to do in order to begin connecting ...
...sed to exchange the description (which is in application/sdp form) between the two peers. handling successful peer connection as each side of the peer-to-peer connection is successfully linked up, the corresponding rtcpeerconnection's icecandidate event is fired. these handlers can do whatever's needed, but in this example, all we need to do is update the user interface: function handlelocal
addcandidatesuccess() { connectbutton.disabled = true; } function handleremote
addcandidatesuccess() { disconnectbutton.disabled = false; } the only thing we do here is disable the "connect" button when the local peer is connected and enable the "disconnect" button when the remote peer connects. connecting the data channel once the rtcpeerconnection is open, the datachannel event is ...
Writing a WebSocket server in C# - Web APIs
over a tcp (transmission control protocol) connection. luckily, c# has a tcplistener class which does as the name suggests. it is in the system.net.sockets namespace. it is a good idea to include the namespace with the using keyword in order to write less. it allows usage of a namespace's classes without typing the full namespace every time. tcplistener constructor: tcplistener(system.net.ip
address local
addr, int port) local
addr specifies the ip of the listener, and port specifies the port. to create an ip
address object from a string, use the parse static method of ip
address. methods: start() system.net.sockets.tcpclient accepttcpclient() waits for a tcp connection, accepts it and returns it as a tcpclient object. here's a barebones server implementation: using system.n...
...string, use the parse static method of ip
address. methods: start() system.net.sockets.tcpclient accepttcpclient() waits for a tcp connection, accepts it and returns it as a tcpclient object. ...
...ncoded.length; i++) { decoded[i] = (byte)(encoded[i] ^ mask[i % 4]); } put together wsserver.cs // // csc wsserver.cs // wsserver.exe using system; using system.net; using system.net.sockets; using system.text; using system.text.regularexpressions; class server { public static void main() { string ip = "127.0.0.1"; int port = 80; var server = new tcplistener(ip
address.parse(ip), port); server.start(); console.writeline("server has started on {0}:{1}, waiting for a connection...", ip, port); tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); networkstream stream = client.getstream(); // enter to an infinite cycle to be able to handle every change in stream while ...
...textarea> <button>send</button> <div id=output></div> <script> // http://www.websocket.org/echo.html var button = document.queryselector("button"), output = document.queryselector("#output"), textarea = document.queryselector("textarea"), // wsuri = "ws://echo.websocket.org/", wsuri = "ws://127.0.0.1/", websocket = new websocket(wsuri); button.
addeventlistener("click", onclickbutton); websocket.onopen = function (e) { writetoscreen("connected"); dosend("websocket rocks"); }; websocket.onclose = function (e) { writetoscreen("disconnected"); }; websocket.onmessage = function (e) { writetoscreen("<span>response: " + e.data + "</span>"); }; websocket.onerror = function (e) { ...
Web Audio API - Web APIs
web audio concepts and usage the web audio api involves handling audio operations inside an audio context, and has been designed to allow modular routing. basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. several sources — with different types of channel layout — are supported even within a single context. ...
...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. waveshapernode the waveshapernode interface represents a non-linear distorter. it is an audionode that use a curve to apply a waveshaping distortion to the signal. beside obvious distortion effects, it is often used to
add a warm feeling to the signal. periodicwave describes a periodic waveform that can be used to shape the output of an oscillatornode. iirfilternode implements a general infinite impulse response (iir) filter; this type of filter can be used to implement tone control devices and graphic equalizers as well. defining audio destinations once you are done processing your audio, these interfaces ...
...io channels, you'll use these interfaces. channelsplitternode the channelsplitternode interface separates the different channels of an audio source out into a set of mono outputs. channelmergernode the channelmergernode interface reunites different mono inputs into a single output. each input will be used to fill a channel of the output. audio spatialization these interfaces allow you to
add audio spatialization panning effects to your audio sources. audiolistener the audiolistener interface represents the position and orientation of the unique person listening to the audio scene used in audio spatialization. pannernode the pannernode interface represents the position and behavior of an audio source signal in 3d space, allowing you to create complex panning effects. stereopann...
...io processing in javascript using audio worklets, you can define custom audio nodes written in javascript or webassembly. audio worklets implement the worklet interface, a lightweight version of the worker interface. audio worklets are enabled by default for chrome 66 or later. audioworklet the audioworklet interface is available through the audiocontext object's audioworklet, and lets you
add modules to the audio worklet to be executed off the main thread. audioworkletnode the audioworkletnode interface represents an audionode that is embedded into an audio graph and can pass messages to the corresponding audioworkletprocessor. audioworkletprocessor the audioworkletprocessor interface represents audio processing code running in a audioworkletglobalscope that generates, process...
Using the Web Speech API - Web APIs
to our speech recognition the next thing to do is define a speech recogntion instance to control the recognition for our application. this is done using the speechrecognition() constructor. we also create a new speech grammar list to contain our grammar, using the speechgrammarlist() constructor. ...
...e a speech recogntion instance to control the recognition for our application. this is done using the speechrecognition() constructor. we also create a new speech grammar list to contain our grammar, using the speechgrammarlist() constructor. var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); we
add our grammar to the list using the speechgrammarlist.
addfromstring() method. ...
...tion. this is done using the speechrecognition() constructor. we also create a new speech grammar list to contain our grammar, using the speechgrammarlist() constructor. var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); we
add our grammar to the list using the speechgrammarlist.
addfromstring() method. ...
... var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); we
add our grammar to the list using the speechgrammarlist.
addfromstring() method. this accepts as parameters the string we want to
add, plus optionally a weight value that specifies the importance of this grammar in relation of other grammars available in the list (can be from 0 to 1 inclusive.) the
added grammar is available in the list as a speechgrammar object instance. speechrecognitionlist.
addfromstring(grammar, 1); we then
add the speechgrammarlist to the speech recognition instance by setting it to the value of the speechrecognition.grammars property. we also set a few other properties of the recognition instance before we move on: speechrecognition.continuous: controls whether conti...
Window.open() - Web APIs
or 0, or in most cases just omit them, to be off. example: status=yes, status=1, and status have identical results. menubar if this feature is on, then the new secondary window renders the menubar. if windowfeatures is non-empty, menubar detaults to off. toolbar if this feature is on, then the new secondary window renders the toolbar buttons (back, forward, reload, stop buttons). in
addition to the toolbar buttons, firefox (before 76) will render the tab bar if it is visible, present in the parent window. (if this feature is set to off, all toolbars in the window will be invisible). if windowfeatures is non-empty, toolbar detaults to off. location if this feature is on, then the new secondary window renders the location bar or the
address bar. if windowfeatures is non-em...
...owfeatures is non-empty, scrollbars detaults to off. see note on scrollbars. tip: for accessibility reasons, it is strongly encouraged to set this feature always on window functionality features noopener if this feature is set, the newly-opened window will open as normal, except that it will not have access back to the originating window (via window.opener — it returns null). in
addition, the window.open() call will also return null, so the originating window will not have access to the new one either. this is useful for preventing untrusted sites opened via window.open() from tampering with the originating window, and vice versa. note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding wheth...
...r" for more information and for browser compatibility details, including information about ancillary effects. noreferrer if this feature is set, the request to load the content located at the specified url will be loaded with the request's referrer set to noreferrer; this prevents the request from sending the url of the page that initiated the request to the server where the request is sent. in
addition, setting this feature also automatically sets noopener. see rel="noreferrer" for
additional details and compatibility information. firefox introduced support for noreferrer in firefox 68. best practices <script type="text/javascript"> var windowobjectreference = null; // global variable function openffpromotionpopup() { if(windowobjectreference == null || windowobjectreference.closed) ...
... resource. this form of code also interferes with advanced features in tab-capable browsers: eg. middle-click on links, ctrl+click on links, ctrl+enter on links, "mouse gestures" features. always identify links that will create (or will re-use) a new, secondary window identify links that will open new windows in a way that helps navigation for users by coding the title attribute of the link, by
adding an icon at the end of the link or by coding the cursor accordingly. the purpose is to warn users in advance of context changes to minimize confusion on the user's part: changing the current window or popping up new windows can be very disorienting to users (back toolbar button is disabled). "users often don't notice that a new window has opened, especially if they are using a small monitor ...
Window: popstate event - Web APIs
the popstate event of the window interface is fired when the active history entry changes while the user navigates the session history. it changes the current history entry to that of the last page the user visited or, if history.pushstate() has been used to
add a history entry to the history stack, that history entry is used instead. ...
... no interface popstateevent event handler property onpopstate the history stack if the history entry being activated was created by a call to history.pushstate() or was affected by a call to history.replacestate(), the popstate event's state property contains a copy of the history entry's state object. these methods and their corresponding events can be used to
add data to the history stack which can be used to reconstruct a dynamically generated page, or to otherwise alter the state of the content being presented while remaining on the same document. note that just calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event will be triggered by doing a browser action such as a click on the back or forward butto...
...f current-entry's title wasn't set using one of the history api methods (pushstate() or replacestate(), set the entry's title to the string returned by its document.title attribute. if the browser has state information it wishes to store with the current-entry before navigating away from it, it then does so. the entry is now said to have "persisted user state." this information the browser might
add to the history session entry may include, for instance, the document's scroll position, the values of form inputs, and other such data. if new-entry has a different document object than current-entry, the browsing context is updated so that its document property refers to the document referred to by new-entry, and the context's name is updated to match the context name of the now-current documen...
...er chooses to do so. if the original and new entry's shared the same document, but had different fragments in their urls, send the hashchange event to the window. as you can see, the popstate event is nearly the last thing done in the process of navigating pages in this way. ...
window.postMessage() - Web APIs
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 is given to the destination side and they are no longer usable on the sending side. the dispatched event otherwindow can listen for dispatched messages by executing the following javascript: window.
addeventlistener("message", receivemessage, false); function receivemessage(event) { if (event.origin !== "http://example.org:8080") return; // ... } the properties of the dispatched message are: data the object passed from the other window. origin the origin of the window that sent the message at the time postmessage was called. this string is the concatenation of the protocol and ...
...not guaranteed to be the current or future origin of that window, which might have been navigated to a different location since postmessage was called. source a reference to the window object that sent the message; you can use this to establish two-way communication between two windows with different origins. security concerns if you do not expect to receive messages from other sites, do not
add any event listeners for message events. this is a completely foolproof way to avoid security problems. if you do expect to receive messages from other sites, always verify the sender's identity using the origin and possibly source properties. any window (including, for example, http://evil.example.com) can send a message to any other window, and you have no guarantees that an unknown sender will...
... changed its location. popup.postmessage("hello there!", "http://example.com"); function receivemessage(event) { // do we trust the sender of this message? (might be // different from what we originally opened, for example). ...
...ng you've verified the origin of the received message (which // you must do in any case), a convenient idiom for replying to a // message is to call postmessage on event.source and provide // event.origin as the targetorigin. event.source.postmessage("hi there yourself! the secret response " + "is: rheeeeet!", event.origin); } window.
addeventlistener("message", receivemessage, false); notes any window may access this method on any other window, at any time, regardless of the location of the document in the window, to send it a message. consequently, any event listener used to receive messages must first check the identity of the sender of the message, using the origin and possibly source properties. this cannot be overstated: ...
Window: resize event - Web APIs
the resize event fires when the document view (window) has been resized. bubbles no cancelable no interface uievent event handler property onresize in some earlier browsers it was possible to register resize event handlers on any html element. it is still possible to set onresize attributes or use
addeventlistener() to set a handler on any element. however, resize events are only fired on the window object (i.e. returned by document.defaultview). only handlers registered on the window object will receive resize events. there is a proposal to allow all elements to be notified of resize changes. see resize observer to read the draft document, and github issues to read the on-going discussions. examples window size logger the following...
... obsolete css object model (cssom) view modulethe definition of 'resize'...
... obsolete css object model (cssom) view modulethe definition of 'resize' in that specification. working draft ...
... obsolete css object model (cssom) view modulethe definition of 'resize' in that specification. working draft ...
Window: unload event - Web APIs
ing is visible anymore to the end user ui interactions are ineffective (window.open, alert, confirm, etc.) an error won't stop the unloading workflow please note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below). ...
...r won't stop the unloading workflow please note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below). ...
... specif...
... specifications specification status comment ui eventsthe definition of 'unload' in that speci...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
is compiled and executed every delay milliseconds. this syntax is not recommended for the same reasons that make using eval() a security risk. delayoptional the time, in milliseconds (thousandths of a second), the timer should delay in between executions of the specified function or code. see delay restrictions below for details on the permitted range of delay values. arg1, ..., argn optional
additional arguments which are passed through to the function specified by func once the timer expires. note: passing
additional arguments to setinterval() in the first syntax does not work in internet explorer 9 and earlier. if you want to enable this functionality on that browser, you must use a polyfill (see the callback arguments section). return value the returned intervalid is a numeric, ...
...also change the frame rate value modifying the "rate" property; for example: */ // otwexample2.rate = 150; onload = function () { otwexample1.play(); otwexample2.play(); }; </script> <style type="text/css"> span.intlink, a, a:visited { cursor: pointer; color: #000000; text-decoration: underline; } #info { width: 180px; height: 150px; float: right; background-color: #eeeeff; p
adding: 4px; overflow: auto; font-size: 12px; margin: 4px; border-radius: 5px; /* visibility: hidden; */ } </style> </head> <body> <p id="copyleft" style="font-style: italic; font-size: 12px; text-align: center;">copyleft 2012 by <a href="https://developer.mozilla.org/" target="_blank">mozilla developer network</a></p> <p id="controls" style="text-align: center;">[ <span class="intli...
...l eu sem vehicula egestas.</p> </div> </body> </html> view this demo in action. see also: clearinterval(). callback arguments as previously 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 the |*| callback functions of javascript timers (html5 standard syntax). |*| |*| /docs/web/api/window.setinterval |*| https://developer.mozilla.org/user:fusionchess |*| |*| syntax: |*| var timeoutid = window.settimeout(func, delay[, arg1, arg2, ...]); |*| var t...
...o the callback function (see the "this" problem for details). the following code is also available on github. for a more complex but still modular version of it (daemon) see javascript daemons management. this more complex version is nothing but a big and scalable collection of methods for the daemon constructor. 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://develo...
XRInputSourcesChangeEvent - Web APIs
he inputsourceschange event sent to an xrsession when the set of available webxr input controllers changes. constructor xrinputsourceschangeevent() creates and returns a new xrinputsourceschangeevent object configured as indicated by the given xrinputsourceschangeeventinit object. the specified type must be inputsourceschange, which is the only event that uses this interface. properties
added read only an array of zero or more xrinputsource objects, each representing an input device which has been newly connected or enabled for use. removed read only an array of zero or more xrinputsource objects representing the input devices newly connected or enabled for use. session read only the xrsession to which this input source change event is being directed. methods while xrinpu...
... from its parent interface, event. event types inputsourceschange delivered to the xrsession when the set of input devices available to it changes. examples the following example shows how to set up an event handler which uses inputsourceschange events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame. ...
...available to it changes. examples the following example shows how to set up an event handler which uses inputsourceschange events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame. ...
...ange events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame. xrsession.
addeventlistener("inputsourceschange", oninputsourceschange); function oninputsourceschange(event) { for (let input of event.
added) { if (input.targetraymode == "tracked-pointer") { loadcontrollermesh(input); } } } you can also
add a handler for inputsourceschange events by setting the oninputsourceschange event handler: xrsession.oninputsourceschange = oninputsourceschange; specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeevent' in that specification. working draft initial definition. ...
XRReferenceSpace: reset event - Web APIs
e 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 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 previous frame. this way, the user's position only changes once rather...
...ontinuity 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 stability in the vicinity of the user; only large discontinuities will trigger a reset. ...
...evice 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 stability in the vicinity of the user; only large discontinuities will trigger a reset. examples to
add a handler for the reset event, you can use either of two approaches. ...
... 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 stability in the vicinity of the user; only large discontinuities will trigger a reset. examples to
add a handler for the reset event, you can use either of two approaches. first, you can use the
addeventlistener() method: viewerrefspace.
addeventlistener("reset", (event) => { /* perform reset related tasks */ }); the second option is to set the xrreferencespace object's onreset event handler property: viewerrefspace.onreset = (event) => { /* perform reset related tasks */ }; specifications specification status comment webxr device apithe definition of 'reset event' in that specification. working d...
XRReferenceSpace - Web APIs
the webxr device api's xrreferencespace interface describes the coordinate system for a specific tracked entity or object within the virtual world using a specified tracking behavior. the tracking behavior is defined by the selected reference space type. it expands upon the base class, xrspace, by
adding support for several different tracking behaviors as well as to request a new reference space which describes the offset transform between the tracked object and another location in the world. all reference spaces—with the sole exception being bounded reference spaces—are described using the xrreferencespace type. bounded spaces are implemented as xrboundedreferencespace objects. these are special spaces which let you establish a perimeter within which it's "safe" for the viewer to mov...
...those that track movement with a real-world camera, this boundary establishes the edges of the area the user is able to move around in, whether due to physical obstacles or due to limitations of the xr hardware. see the article using bounded reference spaces to protect the viewer for more on using boundaries to keep the user from colliding with obstacles both physical and virtual. properties in
addition to the properties inherited from xrspace (of which there are none at this time), xrreferencespace also inherits the properties of eventtarget. xrreferencespace defines no
additional properties. methods in
addition to the methods inherited from its parent interface, xrspace (there are none at this time), xrreferencespace inherits methods from eventtarget. xrreferencespace also provides the...
...d (so, either xrreferencespace or xrboundedreferencespace). the new reference space can be used to transform a coordinate from the reference space of the object on which the method is called into a different coordinate space. this is useful for positioning objects while rendering, and to perform the needed transforms when changing the viewer's position and/or orientation in 3d space. events in
addition to other events that may be sent to xrspace or eventtarget objects, the following also apply to xrreferencespace objects. reset the reset event is sent to an xrreferencespace object when the browser detects a discontinuity has occurred wherein the tracked object's origin relative to the user's environment or location. this can happen, for example, after the user recalibrates their xr ...
...o xrreferencespace objects. reset the reset event is sent to an xrreferencespace object when the browser detects a discontinuity has occurred wherein the tracked object's origin relative to the user's environment or location. this can happen, for example, after the user recalibrates their xr device, or if the device automatically adjusts its origin after losing and regaining tracking. in
addition to using
addeventlistener(), you can establish a reset event handler by setting the onreset event handler property. reference space types the reference space returned by xrsession.requestreferencespace() is either xrreferencespace or xrboundedreferencespace. the "interface" column in the table below indicates which of the two types is returned for each reference space type constant.. r...
XRSession: selectend event - Web APIs
tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselectend for details on how the selectstart, select, and selectend events work, and how you should react to them, see primary actions in inputs and input sources. examples the following example uses
addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select. this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around. in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received. only after c...
... object and the current target ray pose transform as inputs. this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...d and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
XRSession: selectstart event - Web APIs
acking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselectstart for details on how the selectstart, select, and selectend events work, and how you should react to them, see primary actions in inputs and input sources. examples the following example uses
addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select. this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around. in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received. only after c...
... object and the current target ray pose transform as inputs. this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...d and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the selectend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
XRSession: squeezeend event - Web APIs
tem or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueezeend for details on how the squeezestart, squeeze, and squeezeend events work, and how you should react to them, see primary squeeze actions in inputs and input sources. examples the following example uses
addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze. this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around. in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received. only aft...
...object and the current target ray pose transform as inputs. this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...ld and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
XRSession: squeezestart event - Web APIs
e simulated using triggers on hand controllers. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueezestart for details on how the squeezestart, squeeze, and squeezeend events work, and how you should react to them, see primary squeeze actions in inputs and input sources. examples the following example uses
addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze. this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around. in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received. only aft...
...object and the current target ray pose transform as inputs. this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...this places the object into its new position in the world and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
...ld and triggers any effects that may arise from doing so (like scheduling an animation of a splash if dropped in water, etc). the squeezeend event results in a mystoptracking() function being called with the object being dragged and the final target ray pose's transform. ...
XRSystem: requestSession() - Web APIs
the webxr augmented reality module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr indicates that the rendered session will be displayed using an immersive xr device in vr mode; it is not intended to be overlaid or integrated into the surrounding environment. the environmentblendmode is expected to be opaque if possible, but might be
additive if the hardware requires it. inline the output is presented inline within the context of an element in a standard html document, rather than occupying the full visual space. inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. inline sessions don't require special hardware and should be avalable on any user agent offering webxr ...
...n for a number of reasons, which are covered in more detail in permissions and security in webxr device api. examples creating an immersive vr session the following example calls requestsession() requesting an "immersive-vr" session. if the promise resolves, it sets up a session and initiates the animation loop. navigator.xr.requestsession("immersive-vr") .then((xrsession) => { xrsession.
addeventlistener('end', onxrsessionended); // do necessary session setup here. // begin the session’s animation loop. xrsession.requestanimationframe(onxranimationframe); }).catch(function(error) { // "immersive-vr" sessions are not supported console.warn("'immersive-vr' isn't supported, or an error occurred activating vr!"); }); verifying webxr support and using a button to start vr mod...
... or an error occurred activating vr!"); }); verifying webxr support and using a button to start vr mode the following example shows how to use both issessionsupported() and requestsession(). first, it checks to see if webxr is available by verifying the existence of navigator.xr. next, it calls issessionsupported(), passing it the desired session option before enabling controls for entering xr. ...
...sion option before enabling controls for entering xr.
adding controls is a necessary step because entering xr requires a user action. finally, the onbuttonclicked() method calls requestsession() using the same session option passed to issessionsupported(). ...
msthumbnailclick - Web APIs
l not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msthumbnailclick event occurs when a user clicks a button or thumbnail icon in the taskbar. this proprietary method is specific to internet explorer and microsoft edge. syntax event property object.onmsthumbnailclick = handler;
addeventlistener method object.
addeventlistener("msthumbnailclick", handler, usecapture) general info synchronous no bubbles no cancelable no note the onmsthumbnailclick event is available only to documents that are launched from a pinned site shortcut. parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event. example funct...
... general info synchronous no bubbles no cancelable no note the onmsthumbnailclick event is available only to documents that are launched from a pinned site shortcut. parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event. ...
...the onmsthumbnailclick event is available only to documents that are launched from a pinned site shortcut. parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event. ...
....buttonid); } document.
addeventlistener('msthumbnailclick', thumbnailclickhandler); example 2 //
adds an overlay icon on your app pinned to the taskbar window.external.mssitemodeseticonoverlay(iconuri, tooltip); // removes an overlay icon window.external.mssitemodecleariconoverlay(); // pinned icons on your taskbar can be instructed to trigger specific events on your site from the taskbar //
add an event handlerdocument.
addeventlistener('msthumbnailclick', onbuttonclicked, false); //
add the buttons var btnplay = window.external.mssitemode
addthumbbarbutton(iconuri, tooltip); // refresh the taskbar window.external.mssitemodeshowthumbbar(); // call a javascript function when the button is pressed function onbuttonclicked(e) { switch (e.buttonid) { case btnplay: play(); brea...
Using the aria-labelledby attribute - Accessibility
e technology, such as screen readers, use this attribute to catalog the objects in a document so that users can navigate between them. without an element id, the assistive technology cannot catalog the object. aria-labelledby is very similar to aria-describedby: a label provides essential information about an object, while a description provides extended information that the user might need. in
addition to form elements, you can use the aria-labelledby attribute to associate static text with widgets, groups of elements, panes, regions that have a heading, definitions, and other types of objects. the examples section below provides more information on how to use the attribute this way. to improve compatibility with user agents that do not support aria, you can use aria-labelledby with the <...
... aria-label attribute, the user agents give precedence to aria-labelledby. examples example 1: multiple labels in the example below, each input field is labelled by both its own individual label and by the label for the group: <div id="mybillingid">billing</div> <div> <div id="mynameid">name</div> <input type="text" aria-labelledby="mybillingid mynameid"/> </div> <div> <div id="my
addressid">
address</div> <input type="text" aria-labelledby="mybillingid my
addressid"/> </div> example 2: associating headings with regions in the example below, header elements are associated with the content they head. note that the region being referenced is the region that contains the header. <div role="main" aria-labelledby="foo"> <h1 id="foo">wild fires spread across the san diego h...
.../div> <div role="menuitem">save</div> <div role="menuitem">save as ...</div> ... </div> ... ...
...nuitem">save as ...</div> ... </div> ... ...
Using the aria-relevant attribute - Accessibility
hat types of changes have occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. aria-relevant is commonly used when a web page contains content that may be updated while viewing the page. ...
...e occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. aria-relevant is commonly used when a web page contains content that may be updated while viewing the page. ...
...g the page. values a space-delimited list of one or more of the following values:
additions element nodes
added to the accessibility tree within the live region; should be considered relevant. removals are deletion of nodes in the accessiblity tree; should be considered relevant. text are changes to the textual content of existing nodes; should be considered relevant. all is equivalent to
additions removals text. aria-relevant="
additions text" is the default value on a live region. ...
...lement nodes
added to the accessibility tree within the live region; should be considered relevant. removals are deletion of nodes in the accessiblity tree; should be considered relevant. text are changes to the textual content of existing nodes; should be considered relevant. all is equivalent to
additions removals text. aria-relevant="
additions text" is the default value on a live region. ...
Using the aria-required attribute - Accessibility
ation provided above is one of those opinions and therefore not normative. ...
...bove is one of those opinions and therefore not normative. ...
...fore not normative. ...
...true" /> <br/> <label for="street
address">street
address:</label> <input id="street
address" type="text" /> </form> working examples: tooltip example (includes the use of the aria-required attribute) notes used in aria roles combobox gridcell listbox radiogroup spinbutton textbox tree related aria techniques using the aria-invalid attribute compatibility tbd:
add support information for common ua and at product combinations
additional resources wai-aria specification for aria-required wai-aria authoring practices for forms constraint validation in html5 ...
ARIA: grid role - Accessibility
eek 40</th> <td role="gridcell" tabindex="-1"> 30 </td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> </tr> </tbody> </table> css body { margin: 2rem; font-family: "helvetica neue", sans-serif; } table { margin: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; } tbody th, tbody td { p
adding: 5px; } tbody td { border: 1px solid #000; text-align: right; color: #767676; } tbody td[role="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { background-color: #f6f6f6; outline: 3px solid blue; } } javascript var selectables = document.queryselectorall('table td[role="gridcell"]'); selectables[0].setattribute('tabindex', 0...
...data-row="' + newrow + '"][data-col="' + newcol + '"]'); if (tgt && (tgt.getattribute('role')==='gridcell') ) { array.prototype.foreach.call(document.queryselectorall('[role=gridcell]'), function(el, i){ el.setattribute('tabindex', '-1'); }); tgt.setattribute('tabindex', '0'); tgt.focus(); return true; } else { return false; } } document.queryselector('table').
addeventlistener("keydown", function(event) { switch (event.key) { case "arrowright": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) + 1); break; case "arrowleft": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) - 1); break; case "arrowdown": moveto(parseint(event.target.dataset.ro...
... <td role="gridcell" tabindex="-1"> 3 </td> <td role="gridcell" tabindex="-1"> 4 </td> <td role="gridcell" tabindex="-1"> 5 </td> <td role="gridcell" tabindex="-1"> 6 </td> <td role="gridcell" tabindex="-1"> 7 </td> <td role="gridcell" tabindex="-1"> 8 </td> </tr> <!-- …
additional rows … --> </tbody> </table> css table { margin: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; } tbody th, tbody td { p
adding: 5px; } tbody td { border: 1px solid #000; text-align: right; color: #767676; } tbody td[role="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { background-color: #f6f6f6; o...
...data-row="' + newrow + '"][data-col="' + newcol + '"]'); if (tgt && (tgt.getattribute('role')==='gridcell') ) { array.prototype.foreach.call(document.queryselectorall('[role=gridcell]'), function(el, i){ el.setattribute('tabindex', '-1'); }); tgt.setattribute('tabindex', '0'); tgt.focus(); return true; } else { return false; } } document.queryselector('table').
addeventlistener("keydown", function(event) { switch (event.key) { case "arrowright": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) + 1); break; case "arrowleft": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) - 1); break; case "arrowdown": moveto(parseint(event.target.dataset.ro...
ARIA: row role - Accessibility
<span role="cell">67 million</span> </div> </div> </div> description the element role="row" is a row within a grid, table or treegrid, and optionally within a rowgroup, that is a container for one or more cells, gridcells, columnheaders, or rowheaders within a static tabular structure. using native html <tr> elements, whenever possible, is strongly encouraged. to create an aria row,
add role="row" to the container element. that row should be nested within a grid, table or treegrid. a group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. each row contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a number of ...
...the 47th and 52nd row, respectively. if all the rows are present in the dom, this attribute is not necessary. keyboard interactions none required javascript features none. for sortable columns, see the columnheader aria role. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and
adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. examples <div role="table" aria-label="semantic elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgro...
...owgroup, has two column headers. the columns are sortable, but not currently sorted, as indicated by the aria-sort property. the table body is in a separate rowgroup, with four rows currently in the dom. because not all the rows are in the dom, we've included the aria-rowindex property on every row. best practices only use table, tbody, thead, tr, th, td, etc., for data table structure. you can
add these aria roles to ensure accessibility should the native semantics of the table be removed, such as with css. a relevant use case for the aria table role is when the native semantics of a table are overridden by css's display property, such as by display: grid. in this case, you can use the aria table roles to
add the semantics back in. <table role="table" aria-label="semantic elements" aria-d...
...<td role="cell">thead</td> </tr> <tr role="row" aria-rowindex="24"> <td role="cell">term</td> <td role="cell">dt</td> </tr> </tbody> </table> above is the semantic way of writing a table. the aria roles are only necessary if the native semantics of the table, and therefore the table rows, are obliterated, such as via setting the display property to flex or grid.
added benefits none specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria row role' in that specification. recommendation wai-aria authoring practicesthe definition of 'aria row role' in that specification. working draft ...
ARIA: rowgroup role - Accessibility
al equivalent to the thead, tfoot and tbody elements in html. there is, however, no differentiation between different types of rowgroups. their elements must be contained in, or owned by, elements with either the table or grid role. using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible, is strongly encouraged. to create an aria table header, table footer or table body,
add role="rowgroup" to the element. that rowgroup should be nested within a grid, table or treegrid, encompassing a group of one or more rows. each row, in turn, contains child cells. these cells can be of different types, depending on whether they are column or row headers, or plain or grid cells. note: using the native html table element (<table>) along with the table header (<thead>), footer (<t...
... descendant roles role="row" a row of cells within a tabular structure. a row contains one or more cells, gridcell, or column headers, and sometimes a row header. keyboard interactions none required javascript features none. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and
adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. examples <div role="table" aria-label="semantic elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgro...
...wgroup, has two column headers. the columns are sortable, but not currently sorted, as indicated by the aria-sort property. the table body is a separate rowgroup, with four rows currently in the dom. because not all the rows are in the dom, we've included the aria-rowindex property on every row. best practices only use table, tbody, thead, tr, th, td, and so on for data table structure. you can
add these aria roles to ensure accessibility should the native semantics of the table be removed, such as with css. a relevant use case for the aria table role is when the css's display property overrides the native semantics of a table, such as by display: grid. in this case, you can use the aria table roles to
add in the semantics. <table role="table" aria-label="semantic elements" aria-describedb...
... recommendation ...
ARIA: checkbox role - Accessibility
lso include the aria-checked attribute to expose the checkbox's state to assistive technology. <span role="checkbox" aria-checked="false" tabindex="0" aria-labelledby="chk1-label"> </span> <label id="chk1-label">remember my preferences</label> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and
adding aria. instead use the native html checkbox of <input type="checkbox">, which natively provides all the functionality required: <input type="checkbox" id="chk1-label"> <label for="chk1-label">remember my preferences</label> description the native html checkbox form control can only have two checked states ("checked" or "not checked"), with an indeterminate state settable via javascript. sim...
... using css and javascript to handle the checked or unchecked status of the element. ...
... when the aria-checked value changes, send an accessible state changed event. assistive technology products should do the following: screen readers should announce the element as a checkbox, and optionally provide instructions on how to activat...
...d optionally provide instructions on how to activate it. 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. best practices the first rule of aria is: if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and
adding an aria role, state or property to make it accessible. as such, it is recommended to use the native html checkbox using form control instead of recreating a checkbox's functionality with javascript and aria. ...
ARIA: heading role - Accessibility
role="heading" aria-level="1">this is a main page heading</div> this defines the text in the div to be the main heading of the page, indicated by being level 1 via the aria-level attribute. description the heading role indicates to assistive technologies that this element should be treated like a heading. screen readers would read the text and indicate that it is formatted like a heading. in
addition, the level tells assistive technologies which part of the page structure this heading represents. a level 1 heading usually indicates the main heading of a page, a level 2 heading the first subsection, a level 3 is a subsection of that, and so on. associated wai-aria roles, states, and properties aria-level the aria-level attribute specifies the heading level in the document structure. ...
...s the default. keyboard interactions this role does not require any special keyboard navigation. as with any heading, giving it an id ensures it can be referenced from anchor links, making it accessible via the keyboard. required javascript features required event handlers none. changing attribute values usually not required, unless dynamically inserting content. in that case, the newly-
added headings need aria-level attributes whose values are consistent with the rest of the document structure. instead of using a <div> or <span> with a heading role and aria-level, consider using a native <h1> through <h6> element instead to indicate that this text is a heading, and what part of the structure it represents. examples the following shows a typical page structure. <div id="conta...
...may support it, the results can be unpredictable with other browser/screen reader combinations. best practices the best way to use this role is to not use it at all, and instead use the native heading tags <h1> through <h6> as shown in the example above. the heading role and aria-level attribute should only be used to retrofit accessibility on legacy code that you cannot make major changes to. ...
...legacy code that you cannot make major changes to.
added benefits none. specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'heading' in that specification. recommendation precedence order the heading role overrides the native semantic meaning of the element it is being used for. the aria-level attribute, in
addition, determines what level of heading is being exposed. screen reader support tbd ...
ARIA: listbox role - Accessibility
be used to toggle checkboxes. for selectable list items, space toggles their selection, shift+space can be used to select contiguous items, ctrl+arrow moves without selecting, and ctrl+space can be used to select non-contiguous items. it is recommended that a checkbox, link or other method be used to select all items, and ctrl+a could be used as a shortcut key for this. when the listbox role is
added to an element, or such an element becomes visible, screen readers announce the label and role of the listbox when it gets focus. if an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader supports this. as focus moves within the list, the screen reader announces the relevant items. associated ari...
...s true. change the appearance of the option to reflect it's selected state update the aria-activedescendant value on the listbox to the id of the option the user just interacted with, even if they toggled the option to be unselected. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and
adding an aria role, state or property to make it accessible, then do so. the <select> element with descendant <option> elements handles all the needed interactions natively. examples example 1: a single select listbox that uses aria-activedescendant the snippet below shows how the listbox role is
added directly into the html source code. <p id="listbox1label" role="label">select a color:</p> <...
...scrolls to reveal more options, similar to html select with size attribute greater than one. 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, and removed. best practices to be keyboard accessible, authors should manage focus of all descendants of this role. it is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown with a lighter background colour. if the listbox is not part of another widget, it should have the aria-labelledby propert...
...sible, authors should manage focus of all descendants of this role. it is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown with a lighter background colour. if the listbox is not part of another widget, it should have the aria-labelledby property set. if one or more entries are not dom children of listbox,
additional aria-* properties will need to be set (see aria best practices). if there is a valid reason to expand the listbox, the combobox role may be more appropriate. specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria listbox role' in that specification. recommendation wai-aria authoring practicesthe d...
ARIA: textbox role - Accessibility
collection of values. both: predicted text is presented as a collection of values, with the text needed to complete one value inserted after the caret. none (default): predicted text is not offered. if list or both is set, the aria-controls and aria-haspopup attributes should also be included. the value of aria-controls is the id of the element that contains the list of suggested values.
additionally, either the textbox or a containing element with role combobox has a value for aria-haspopup that matches the role of the element that contains the list of suggested values. aria-multiline attribute if aria-multiline="true" is set, the at informs the user that the textbox supports multi-line input, with the expectation that enter or return will create a line break rather than submit...
...pport it. see the specification of aria-descendent for further information. it is a better practice to use an <input> element with type="text", or a <textarea> element instead of the aria textbox role. when using either semantic element, the aria textbox role is not necessary. see notes on using aria in html. possible effects on user agents and assistive technology when the textbox role is
added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a textbox role in the operating system's accessibility api. fire an accessible textbox event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers...
...n readers should announce its label and role when focus first lands on a textbox. if it also contains content, this should be announced as with a regular textbox. screen magnifiers may enlarge the textbox. 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:
adding the role in the html code for single line input the snippet below shows how the textbox role is
added directly into the html source code. <div role="textbox" contenteditable="true"></div> example 2:
adding the role in the html code for multi-line input the snippet below shows how the textbox role is
added directly into the html source code. <div role="textbox" contenteditable="true" aria-...
...do so even if you set aria-readonly to true; in this way, you communicate that the content would be editable if it were not read-only. ...
WAI-ARIA Roles - Accessibility
this page lists reference pages covering all the wai-aria roles discussed on mdn. for a full list of roles, see using aria: roles, states, and properties aria: alert rolethe alert role can be used to tell the user an element has been dynamically updated. screen readers will instantly start reading out the updated content when the role is
added. if the user is expected to close the alert, then the alertdialog role should be used instead.aria: application rolethe application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop application, and no traditional html interpretation techniques should be used. this role should only be used to define very dynamic and desktop-like web applications.aria: article rolethe article ...
...wspaper articles or other items grouped together on one page.aria: banner rolea banner role represents general and informative content frequently placed at the beginning of the page. this usually includes a logo, company name, search icon, photo related to the page, or slogan.aria: button rolethe button role should be used for clickable elements that trigger a response when activated by the user.
adding role="button" will make an element appear as a button control to a screen reader. this role can be used in combination with the aria-pressed attribute to create toggle buttons.aria: cell rolethe cell value of the aria role attribute identifies an element as being a cell in a tabular container that does not contain column or row header information. to be supported, the cell must be nested in an...
...a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads.aria: figure rolethe aria figure role can be used to identify a figure inside page content where appropriate semantics do not al...
...ia: tabpanel rolethe aria tabpanel role indicatesaria: textbox rolethe textbox role is used to identify an element that allows the input of free-form text. aria: timer rolethe timer role indicates to assistive technologies that an element is a numerical counter the amount of elapsed time from a starting point or the remaining time until an end point. please claim the role you want to work on by
adding your name after the role's name: (old pages are linked from https://developer.mozilla.org/docs/web/accessibility/aria/aria_techniques). ones for which the first draft is completed have been removed from the below list. alertdialog banner combobox command columnheader (estelle) complementary composite definition directory feed gridcell (eric e) group input landmark link - old ...
ARIA - Accessibility
aviour in script. here's the markup for a progress bar widget: <div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by
adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this element is actually a javascript-powered progress bar widget. the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the progress bar, and the aria-valuenow describes the current state of it and therefore must be kept updated with javascript. along with...
...gressbar" attribute informs the browser that this element is actually a javascript-powered progress bar widget. the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the progress bar, and the aria-valuenow describes the current state of it and therefore must be kept updated with javascript. along with placing them directly in the markup, aria attributes can be
added to the element and updated dynamically using javascript code like this: // find the progress bar <div> in the dom. var progressbar = document.getelementbyid("percent-loaded"); // set its aria roles and states, // so that assistive technologies know what kind of widget it is. progressbar.setattribute("role", "progressbar"); progressbar.setattribute("aria-valuemin", 0); progressbar.setattribute...
...cal invalidity. in html5, all aria attributes validate. the new landmark elements (<main>, <header>, <nav> etc) have built-in aria roles, so there is no need to duplicate them. support like any other web technology, there are varying degrees of support for aria. support is based on the operating system and browser being used, as well as the kind of assistive technology interfacing with it. in
addition, the version of the operating system, browser, and assistive technology are contributing factors. older software versions may not support certain aria roles, have only partial support, or misreport its functionality. it is also important to acknowledge that some people who rely on assistive technology are reluctant to upgrade their software, for fear of losing the ability to interact with t...
...ities. simple aria enhancements enhancing page navigation with aria landmarks a nice intro to using aria landmarks to improve web page navigation for screen reader users. see also, aria landmark implementation notes and examples on real sites (updated as of july 2011). improving form accessibility aria is not just for dynamic content! learn how to improve accessibility of html forms using
additional aria attributes. aria for scripted widgets writing keyboard-navigable javascript widgets built-in elements like <input>, <button> etc have built-in keyboard accessibility. if you 'fake' these with <div>s and aria, you must ensure your widgets are keyboard accessible. live regions live regions provide suggestions to screen readers about how to handle changes to the contents of a pag...
An overview of accessible web applications and widgets - Accessibility
ch1panel">chapter 1 content goes here</div> <div id="ch2panel">chapter 2 content goes here</div> <div id="quizpanel">quiz content goes here</div> </div> example 2: how the tabs widget might be styled visually. users might recognize it visually, but there are no machine-readable semantics for an assistive technology. aria aria enables developers to describe their widgets in more detail by
adding special attributes to the markup. designed to fill the gap between standard html tags and the desktop-style controls found in dynamic web applications, aria provides roles and states that describe the behavior of most familiar ui widgets. many of these were later
added in html5, and developers should always prefer using the correct semantic html element over using aria. the aria specificat...
...ed 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 previous generation of web applications, since assistive technology users can apply all of their knowledge of how desktop applications work when they are using web-based applications. 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="tab"> <a href="#ch1panel">chapter 1</a> </li> <li id="ch2tab" role="tab"> <a href="#ch2panel">chapter 2</a> </li> <li id="quiztab" role="tab"> <a href="#quizpanel">quiz</a> </li> </ol> <div> <!-- notice the role and ari...
...! --> <!-- we've
added role attributes to describe the tab list and each tab. --> <ol role="tablist"> <li id="ch1tab" role="tab"> <a href="#ch1panel">chapter 1</a> </li> <li id="ch2tab" role="tab"> <a href="#ch2panel">chapter 2</a> </li> <li id="quiztab" role="tab"> <a href="#quizpanel">quiz</a> </li> </ol> <div> <!-- notice the role and aria-labelledby attributes we've
added to describe these panels. --> <div id="ch1panel" role="tabpanel" aria-labelledby="ch1tab">chapter 1 content goes here</div> <div id="ch2panel" role="tabpanel" aria-labelledby="ch2tab">chapter 2 content goes here</div> <div id="quizpanel" role="tabpanel" aria-labelledby="quiztab">quiz content goes here</div> </div> aria is well supported by all major browsers, including firefox, safari, ...
... 2b. note that there is no custom classname used, only the status of the aria-hidden attribute on line 1. example 2b. attribute-based selector for indicating state div.tooltip[aria-hidden="true"] { display: none; } the javascript to update the aria-hidden property has the form shown in example 2c. note that the script only updates the aria-hidden attribute (line 2); it does not need to also
add or remove a custom classname. example 2c. javascript to update the aria-checked attribute var showtip = function(el) { el.setattribute('aria-hidden', 'false'); } role changes aria allows developers to declare a semantic role for an element that otherwise offers incorrect or no semantics. the role of an element should not change. instead, remove the original element and replace it with an e...
Accessibility Information for Web Authors - Accessibility
nd 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. ...
...
add a wave bookmarklet in firefox or even wave direct links for checking a webpage. html advanced validator (firefox extension) by marc gueury this html validator (based on w3c tidy and on opensp for sgml validation) is a powerful, versatile, extended html validator. it's free. it works off-line and that is a major advantage over other accessibility checkers. no document upload needed and no
additional application to launch; everything is accessible within the firefox browser. this html advanced validator firefox extension is very resourceful and highly customizable. it's an extension
add-on to firefox 2.x and firefox 3.x. it not only checks and reports possible markup errors and warnings (based on w3c tidy and/or based on true sgml validation) but it can also report accessibility err...
... checks and reports possible markup errors and warnings (based on w3c tidy and/or based on true sgml validation) but it can also report accessibility errors and warnings according to selectable accessibility guidelines (section 508, wcag priorities 1, 2 or 3). its accessibility report is viewable in the view source window (view > source code ctrl+u or right-click on the status bar). two panes are
added at the bottom of the view source code window: the left pane contains the errors and warnings (with their correspondent line number) and the right pane identifies the checkpoint along with an example and a clickable link to the reference/guideline. just wonderful! the html advanced validator may also be downloaded from firefox
add-ons: html validator. color contrast analyzer by juicy studi...
...from w3c. the juicy studio css analyzer will also analyze and report the color contrast and color brightness differences involved in your stylesheets. the future: accessible dhtml dhtml accessibility roadmap: a peek into how dhtml will be made accessible in the future. this document gives a plan which is being developed by ibm, mozilla and wai protocols and formats working group (pfwg) to
address the issue of accessible dhtml. dynamic web content is not accessible, because it uses vanilla <div>'s and <span>'s combined with javascript rather than declarative markup to describe the behavior of custom widgets such as menus and tree views. these widgets are usually not even keyboard focusable. furthermore, assistive technologies do not understand what these widgets are supposed to be, or...
Web accessibility for seizures and physical reactions - Accessibility
tterns of discernable light and dark stripes have the same effect as flashing lights because of the alternation of dark and bright areas." the epilepsy foundation of america working group is able to "quantify" the problem a little. "a pattern with the potential for provoking seizures contains clearly discernible stripes, numbering more than five light-dark pairs of stripes in any orientation" in
addition to stripes, checkered patterns have also been known to cause photosensitive seizures, according to cedars-sinai. although static images are possible as triggers, they are less consistent. the trigger that is well established and strong is flashing/strobe lights. dr. selim benbadis of usf's comprehensive epilepsy program notes, "the only thing that is really documented is flashing lights, wh...
...are less consistent. the trigger that is well established and strong is flashing/strobe lights. dr. selim benbadis of usf's comprehensive epilepsy program notes, "the only thing that is really documented is flashing lights, which can trigger seizures in patients with photosensitive epilepsy. only a few types of epilepsies are photosensitive though, and the vast majority of epilepsies are 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 defin...
... than to other colors, so a special test is provided for saturated red flashing”. you don't even need an image or video to cause harm. a <div> element set to change color and luminosity at high frequency, easily done via javascript, can cause real harm. and, flickering can occur everywhere. for example, "spinners" commonly used to display while pages load, can easily "flicker" while spinning.
additional concerns exist for individuals with motor-skills problems. for example, the page for trace research & development center’s photosensitive epilepsy analysis tool notes that “photosensitive seizures can be provoked by certain types of flashing in web or computer content, including mouse-overs that cause large areas of the screen to rapidly flash on and off repeatedly.” other physical ...
...mented, up to 70 hz." "these studies would seem to indicate that you should stay 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. 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-m...
::after (:after) - CSS: Cascading Style Sheets
syntax /* css3 syntax */ ::after /* css2 syntax */ :after note: css3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :after, introduced in css2. ...
...ents such as <img>, or to <br> elements. syntax /* css3 syntax */ ::after /* css2 syntax */ :after note: css3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :after, introduced in css2. examples simple usage let's create two classes: one for boring paragraphs and one for exciting ones. we can use these classes to
add pseudo-elements to the end of paragraphs. html <p class="boring-text">here is some plain old boring text.</p> <p>here is some normal text that is neither boring nor exciting.</p> <p class="exciting-text">contributing to mdn is easy and fun.</p> css .exciting-text::after { content: " <- exciting!"; color: green; } .boring-text::after { content: " <- boring"; color: red; } result d...
...nd-color: #5bc8f7; } .ribbon::after { content: "this is a fancy orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result tooltips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create tooltips. no javascript is required! we can also support keyboard users with this technique, by
adding a tabindex of 0 to make each span keyboard focusable, and using a css :focus selector. this shows how flexible ::before and ::after can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with details and summary elements) is likely to be more appropriate. html <p>here we have some <span tabindex="0" data-descr="collection of words ...
...t appear when hovering">tooltips</span>. </p> css span[data-descr] { position: relative; text-decoration: underline; color: #00f; cursor: help; } span[data-descr]:hover::after, span[data-descr]:focus::after { content: attr(data-descr); position: absolute; left: 0; top: 24px; min-width: 200px; border: 1px #aaaaaa solid; border-radius: 10px; background-color: #ffffcc; p
adding: 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. working draft no significant changes to the previous specification. css animationsthe definition of 'animations on pseudo-element properties' in that specifica...
:invalid - CSS: Cascading Style Sheets
seudo-class is useful for highlighting field errors for the user. syntax :invalid examples this example presents a simple form that colors elements green when they validate and red when they don't. ...
... colors elements green when they validate and red when they don't. ...
...nd red when they don't. ...
...lor: #ddffdd; } form:valid { border: 5px solid #ddffdd; } input:required { border-color: #800000; border-width: 3px; } input:required:invalid { border-color: #c00000; } result accessibility concerns the color red is commonly used to indicate invalid input. people who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an
additional indicator that does not rely on color to convey meaning. typically, descriptive text and/or an icon are used. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.1 | w3c understanding wcag 2.0 notes radio buttons if any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in th...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
when laying out a document, the browser's rendering engine represents each element as a rectangular box according to the standard css basic box model. css determines the size, position, and properties (color, background, border size, etc.) of these boxes. every box is composed of four parts (or areas), defined by their respective edges: the content edge, p
adding edge, border edge, and margin edge. the content area, bounded by the content edge, contains the "real" content of the element, such as text, an image, or a video player. its dimensions are the content width (or content-box width) and the content height (or content-box height). it often has a background color or background image. if the box-sizing property is set to content-box (default) and if the element is a block element, the...
...ts dimensions are the content width (or content-box width) and the content height (or content-box height). it often has a background color or background image. if the box-sizing property is set to content-box (default) and if the element is a block element, the content area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. ...
... width (or content-box width) and the content height (or content-box height). it often has a background color or background image. if the box-sizing property is set to content-box (default) and if the element is a block element, the content area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. the p
adding area, bounded by the p
adding edge, extends the content area to include the element's p
adding. its dimensions are the p
adding-box width and the p
adding-box height. the thickness of the p
adding is determined by the p
adding-top, p
adding-right, p
adding-bottom, p
adding-left, and shorthand p
adding properties. the border area, bounded by the border edge, extends the p
adding area to include the element's borders. its dimensions...
... ...
Using feature queries - CSS: Cascading Style Sheets
u want is to check that the browser supports this property, then any valid value will do. the value part of the property value pair matters more if you are testing for new values of a particular property. a good example would be the display property. all browsers support display, as display: block dates back to css1. however the values display: flex and display: grid are newer. ...
... that the browser supports this property, then any valid value will do. the value part of the property value pair matters more if you are testing for new values of a particular property. a good example would be the display property. all browsers support display, as display: block dates back to css1. however the values display: flex and display: grid are newer. ...
...cular property. a good example would be the display property. all browsers support display, as display: block dates back to css1. however the values display: flex and display: grid are newer. there are often
additional values
added to properties in css, and so the fact that you have to test for property and value means that you can detect support for these values. testing for lack of support in
addition to asking the browser if it supports a feature, you can test for the opposite by
adding in the not keyword: @supports not (property: value) { css rules to apply } the css inside the following example feature query will run if the browser does not support row-gap. testing for more than one feature you may need to test support for more than one property in your feature query. to do so,...
...endor prefixes. limitations of feature queries the @supports rule tests to see if the browser can parse one or more property/value pairs, and therefore if it claims to support the feature(s). if the property and value pair is understood by the browser it returns a positive response. therefore feature queries cannot be used to check if a browser supports a thing properly, and without bugs! in
addition, feature queries cannot test for partial implementations. a good example of this is the gap property. all browsers that support css grid support gap in css grid, however only firefox supports gap in flexbox. if you test for the gap property, because you want to use it in flexbox, you will get a positive response even though it is not implemented. how to use feature queries for progressive e...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
mn. in this guide i will explain how this works, what it is designed for and what situations really require css grid layout rather than flexbox. making things wrap the initial value of the flex-wrap property is nowrap. this means that if you have a set of flex items that are too wide for their container, they will overflow it. if you want to cause them to wrap once they become too wide you must
add the flex-wrap property with a value of wrap, or use the shorthand flex-flow with values of row wrap or column wrap. items will then wrap in the container. in the next example i have ten items all with a flex-basis of 160px and the ability to grow and shrink. once the first row gets to a point where there is not enough space to place another 160 pixel item, a new flex line is created for the item...
...ow or column. in two dimensional layout like grid we control both at the same time. if you want the space distribution row by row, use flexbox. if you don’t, use grid. how do flexbox-based grid systems work? typically flexbox-based grid systems work by taking flexbox back to the familiar world of float-based layouts. if you assign percentage widths to flex items — either as flex-basis or by
adding a width to the item itself leaving the value of flex-basis as auto — you can get the impression of a two dimensional layout. you can see this working in the example below. here i have set flex-grow and flex-shrink to 0 to make inflexible flex items and am then controlling flexibility using percentages, just like we used to do in float layouts. if you need flex items to line up in the cro...
...t the impression of a two dimensional layout. you can see this working in the example below. here i have set flex-grow and flex-shrink to 0 to make inflexible flex items and am then controlling flexibility using percentages, just like we used to do in float layouts. if you need flex items to line up in the cross axis, controlling the width in this way will achieve that. in most cases however,
adding widths to flex items in this way demonstrates that you would probably be better served by switching to grid layout for that component. creating gutters between items when wrapping flex items, the need to space them out is likely to arise. at the current time we do not have any implementations of the gap properties from the box alignment module for flexbox. in the future we will be able to si...
...that the collapsed item has left in the inline direction. this means that items might end up on a different line to the one they started on. in the case of an item being shown and hidden it could well cause the items to end up in a different row. i have created this behaviour in the next live example. you can see how the stretching changes row based on the location of the collapsed item. if you
add more content to the second item, it changes row once it gets long enough. that top row then only becomes as tall as a single line of text. if this causes a problem for your layout it may require a rethinking of the structure, for example putting each row into a separate flex container in order that they can’t shift rows. the difference between visibility: hidden and display: none when you ...
Logical properties for floating and positioning - CSS: Cascading Style Sheets
these have no mapping to physical properties, aside from the inset property. logical property purpose inset-inline sets both of the above inset values for the inline dimension simultaneously. inset-block sets bo...
...these have no mapping to physical properties, aside from the inset property. logical property purpose inset-inline sets both of the above inset values for the inline dimension simultaneously. inset-block sets both of the above inset values for the block dimensio...
...these have no mapping to physical properties, aside from the inset property. ...
...low of text in your writing mode. these are as follows: inset-block-start, inset-block-end, inset-inline-start and inset-inline-end. in the below example i have used the inset-block-start and inset-inline-end properties to position the blue box using absolute positioning inside the area with the grey dotted border, which has position: relative. change the writing-mode property to vertical-rl, or
add direction: rtl, and see how the flow relative box stays with the text direction. new two- and four-value shorthands as with other properties in the specification we have some new shorthand properties, which give the ability to set two or four values at once. inset — sets all four sides together with physical mapping. inset-inline — sets both logical inline insets. inset-block — set...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
can change the value between mandatory and proximity to see the effect this has on the scroll experience. using scroll-snap-align the scroll-snap-align property can take a value of start, end, or center — indicating the point the content should snap to in the scroll container. in the below example you can change the value of scroll-snap-align to see how this changes the scroll behavior. p
adding the scroll container if you do not want the content to snap right to the edge of the scroll container you can use the scroll-p
adding property or its equivalent longhand values to set some p
adding. in the below example i have set scroll-p
adding to 40 pixels. when we snap to the start of the second and third sections, the scrolling stops 40 pixels away from the start of the section. try changi...
...container if you do not want the content to snap right to the edge of the scroll container you can use the scroll-p
adding property or its equivalent longhand values to set some p
adding. in the below example i have set scroll-p
adding to 40 pixels. when we snap to the start of the second and third sections, the scrolling stops 40 pixels away from the start of the section. try changing the scroll-p
adding value to see how this changes the distance. this is potentially useful if you have a fixed element, for example a navigation bar, which could end up overlapping scrolled content. ...
... margins on scroll children the scroll-margin property can be set set on child elements, essentially defining an outset from the defined box. ...
...from the start of the section. try changing the scroll-p
adding value to see how this changes the distance. this is potentially useful if you have a fixed element, for example a navigation bar, which could end up overlapping scrolled content. by using scroll-p
adding you can reserve a space for it as in the example below where my <h1> remains on screen as the content scrolls beneath it. without p
adding, the heading would overlap some of the content when snapping happens. margins on scroll children the scroll-margin property can be set set on child elements, essentially defining an outset from the defined box. this allows for different amounts of space for different child elements, and can be used in conjunction with scroll-p
adding on the parent. try this in the example below. the scro...
Basic Shapes - CSS: Cascading Style Sheets
cles to complex polygons. before looking at the shapes, it is worth understanding two pieces of information that go together to make these shapes possible: the <basic-shape> type the reference box the <basic-shape> type the <basic-shape> type is used as the value for all of our basic shapes. this type uses functional notation: the type of shape is followed by brackets, inside of which are
additional values used to describe the shape. the arguments which are accepted vary depending on the shape that you are creating. we will cover these in the examples below. the reference box understanding the reference box used by css shapes is important when using basic shapes, as it defines each shape's coordinate system. you have already met the reference box in the guide on creating shapes fro...
...es each shape's coordinate system. you have already met the reference box in the guide on creating shapes from box values, which directly uses the reference box to create the shape. the firefox shapes inspector helpfully shows the reference box in use when you inspect a shape. in the screenshot below i have created a circle, using shape-outside: circle(50%). the floated element has 20 pixels of p
adding, border and margin applied, and the shapes inspector highlights these reference boxes. when using a basic shape the reference box used by default is the margin-box. you can see in the screenshot that the shape is being defined with reference to that part of the box model. you can
add the various box values after your basic shape definition. therefore the default behaviour is as if you have ...
...ttom is set to the third. if there are four values, they apply to the top, right, bottom, and left, respectively. so, the above rules could also be described as: .shape { float: left; shape-outside: inset(20px 10px round 10px); } in the example below we have an inset() shape used to pull content over the floated element. change the offset values to see how the shape changes. you can also
add the box value that you wish to use as a reference box. in the example below change the reference box from margin-box to border-box, p
adding-box or content-box to see how the reference box used as the starting point before offsets are calculated changes. circle() the circle() value for shape-outside can accept two possible arguments. the first is the shape-radius. both circle() and ellipse() ...
...the reference box of 140 pixels. i have given a value of 50% for the shape-radius value which means that our radius is 70px. i have then set the position value to 30%. in the live example you can play with increasing or decreasing the size of the circle by changing the size of the radius, moving the circle around with the position value, or setting a reference box as we did for inset(). as an
additional example, if you use the keywords top left for position, you can make a quarter circle shape in the top left corner of the page. the example below uses generated content to create a quarter circle shape for text to flow around. the shape will be clipped by the margin box when describing reference boxes i explained that the margin-box will clip the shape. you can see this by moving the c...
Inline formatting context - CSS: Cascading Style Sheets
boxes run vertically. boxes forming a line are contained by a rectangular area called a line box. this box will be large enough to contain all of the inline boxes in that line; when there is no more room in the inline direction another line will be created. therefore a paragraph is a set of inline line boxes, stacked in the block direction. when an inline box is split, margins, borders, and p
adding have no visual effect where the split occurs. in the next example there is a (<span>) element wrapping a set of words wrapping onto two lines. the border on the <span> breaks at the wrapping point. margins, borders, and p
adding in the inline direction are respected. in the example below you can see how the margin, border, and p
adding on the inline <span> element are
added. note: i am us...
...read more about these properties in logical properties and values. ...
...read more about these properties in logical properties and values. ...
...will align on the block axis in vertical writing modes (therefore not vertically at all!). in the example below the large text is making the line box of the first sentence larger, therefore the vertical-align property can be used to align the inline boxes either side of it. i have used the value top, try changing it to middle, bottom, or baseline. alignment in the inline direction if there is
additional space in the inline direction, the text-align property can be used to align the inline boxes within their line box. try changing the value of text-align below to end. effect of floats line boxes usually have the same size in the inline direction, therefore the same width if working in a horizontal writing mode, or height if working in a vertical writing mode. if there is a float within...
Shorthand properties - CSS: Cascading Style Sheets
a specific order for the values of the properties they replace. this works well when these properties use values of different types, as the order has no importance, but this does not work as easily when several properties can have identical values. handling of these cases are grouped in several categories: shorthands handling properties related to edges of a box, like border-style, margin or p
adding, always use a consistent 1-to-4-value syntax representing those edges: the 1-value syntax: border-width: 1em — the unique value represents all edges the 2-value syntax: border-width: 1em 2em — the first value represents the vertical, that is top and bottom, edges, the second the horizontal ones, that is the left and right ones. ...
...nd with the following properties ... background-color: #000; background-image: url(images/bg.gif); background-repeat: no-repeat; background-position: left top; ... can be shortened to just one declaration: background: #000 url(images/bg.gif) no-repeat left top; (the shorthand form is actually the equivalent of the longhand properties above plus background-attachment: scroll and, in css3, some
additional properties.) see background for more detailed information, including css3 properties. font properties the following declarations ... font-style: italic; font-weight: bold; font-size: .8em; line-height: 1.2; font-family: arial, sans-serif; ... can be shortened to the following: font: italic bold .8em/1.2 arial, sans-serif; this shorthand declaration is actually equivalent to the long...
...nt to the longhand declarations above plus font-variant: normal and font-size-adjust: none (css2.0 / css3), font-stretch: normal (css3). border properties with borders, the width, color, and style can be simplified into one declaration. for example, the following css ... border-width: 1px; border-style: solid; border-color: #000; ... can be simplified as: border: 1px solid #000; margin and p
adding properties shorthand versions of margin and p
adding values work similarly; the margin property allows for shorthand values to be specified using one, two, three, or four values. the following css declarations ... margin-top: 10px; margin-right: 5px; margin-bottom: 10px; margin-left: 5px; ... are the same as the following declaration using the four value shorthand. note that the values are i...
...al values. definitions of value syntax, shorthand properties and replaced elements. ...
Value definition syntax - CSS: Cascading Style Sheets
the definition syntax describes which values are allowed and the interactions between them. a component can be a keyword, some characters considered as a literal, or a value of a given css data type or of another css property. component value types keywords generic keywords a keyword with a predefined meaning appears literally, without quotation marks. ...
...ld | [ thin || <length> ]. it describes bold, thin, <length>, <length> thin, or thin <length> but not bold <length> as only one entity from each side of the | combinator can be present. component value multipliers a multiplier is a sign that indicate how many times a preceding entity can be repeated. without a multiplier, an entity must appear exactly one time. note that multipliers cannot be
added and have all precedence over combinators. asterisk (*) the asterisk multiplier indicates that the entity may appear zero, one or several times. bold smaller* this example matches the following values: bold bold smaller bold smaller smaller bold smaller smaller smaller, and so on. but not: smaller, as bold is juxtaposed, and must appear before any smaller keyword. plus (+) the ...
... css level 1the definition of 'value definition syntax' in that specification. recommendation initial definition ...
...t least 1 value [ bold? smaller? ]! specifications specification status comment css values and units module level 3the definition of 'value definition syntax' in that specification. candidate recommendation
adds the hash mark multiplier. css level 2 (revision 1)the definition of 'value definition syntax' in that specification. recommendation
adds the double ampersand combinator. css level 1the definition of 'value definition syntax' in that specification. recommendation initial definition ...
box-decoration-break - CSS: Cascading Style Sheets
lines, columns, or pages. 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 specified value will impact the appearance of the following properties: background border border-image box-shadow clip-path margin p
adding syntax /* keyword values */ box-decoration-break: slice; box-decoration-break: clone; /* global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; the box-decoration-break property is specified as one of the keyword values listed below. values slice the element is initially rendered as if its box were not fragmented, after which the ...
...ing for this hypothetical box is sliced into pieces for each line/column/page. note that the hypothetical box can be different for each fragment since it uses its own height if the break occurs in the inline direction, and its own width if the break occurs in the block direction. see the css specification for details. clone each box fragment is rendered independently with the specified border, p
adding, and margin wrapping each fragment. the border-radius, border-image, and box-shadow are applied to each fragment independently. the background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat multiple times. formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifi...
...results in: you can try the two inline examples above in your...
...results in: you can try the two inline examples above in your browser. ...
font-style - CSS: Cascading Style Sheets
of the face is available, one classified as oblique is used instead. if neither is available, the style is artificially simulated. oblique selects a font that is classified as oblique. if no oblique version of the face is available, one classified as italic is used instead. if neither is available, the style is artificially simulated. oblique <angle> selects a font classified as oblique, and
additionally specifies an angle for the slant of the text. if one or more oblique faces are available in the chosen font family, the one that most closely matches the specified angle is chosen. if no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. valid values are degree values of -90deg to 90deg inclusive. if ...
... example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-style: oblique can accept an <angle>. ...
... mdn understanding wcag, guideline 1.4 explanations w3c understanding wcag 2.1 formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first...
...ph is normal.</p> <p class="italic">this paragraph is italic.</p> <p class="oblique">this paragraph is oblique.</p> .normal { font-style: normal; } .italic { font-style: italic; } .oblique { 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 def...
image() - CSS: Cascading Style Sheets
disambiguation: image(), the htmlimageelement constructor. ...
...al parameter of the image() notation is the directionality of the image. if included, and the image is used on an element with opposite directionality, the image will be flipped horizontally in horizontal writing modes. if the directionality is omitted, the image won't be flipped if the language direction is changed. image fragments one key difference between url() and image() is the ability to
add a media fragment identifier — a starting point along the x and y axis, along with a width and height — onto the image source to display only a section of the source image. the section of the image defined in the parameter becomes a standalone image. the syntax looks like so: background-image: image('myimage.webp#xywh=0,20,40,60'); the background image of the element will be the portion of t...
...er to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 this feature can help improve accessibility by providing a fallback color when an image fails to load. while this can and should be done by including a background-color on every background image, the css image() function allows
adding allows only including background colors should an image fail to load, which means you can
add a fall back color should a transparent png/gif/webp not load. examples directionally-sensitive images <ul> <li dir="ltr">bullet is a right facing arrow on the left</li> <li dir="rtl">bullet is the same arrow, flipped to point left.</li> </ul> ul { list-style-image: image(ltr 'https://mdn.mo...
...mos.org/files/12053/firefox.png"); background-size: 25%; background-repeat: no-repeat; } <div class="quarterlogo">if supported, a quarter of this 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 prevented 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 'imag...
outline-style - CSS: Cascading Style Sheets
either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in css, e.g. a rounded edge outline with semi-translucent outer pixels that appears to glow. ...
...} /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result setting outline style to dashed and dotted html <div> <div class="dotted"> <p class="dashed">outline demo</p> </div> </div> css .dotted { outline-style: dotted; /* same result as "outline: dotted" */ } .dashed { outline-style: dashed; } /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result setting outline style to solid and double html <div> <div class="solid"> <p class="double">outline demo</p> </div> </div> css .solid { outline-style: solid; } .double { outline-style: double; } /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result setting outline style to groove and ridge html <div> <div class="groove"> ...
...solid; } .double { outline-style: double; } /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result setting outline style to groove and ridge html <div> <div class="groove"> <p class="ridge">outline demo</p> </div> </div> css .groove { outline-style: groove; } .ridge { outline-style: ridge; } /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result setting outline style to inset and outset html <div> <div class="inset"> <p class="outset">outline demo</p> </div> </div> css .inset { outline-style: inset; } .outset { outline-style: outset; } /* to make the demo clearer */ * { outline-width: 10px; p
adding: 15px; } result specifications specification status comment css basi...
... css level 2 (revision 1)the definition of 'outline-style' in that specification. recommendation initial definition. ...
<transform-function> - CSS: Cascading Style Sheets
on transformations: rotations, scaling, or skewing. (in fact, all transformations that are linear functions can be described.) composite transformations are effectively applied in order from right to left. however, one major transformation is not linear, and therefore must be special-cased when using this notation: translation. the translation vector (tx, ty) must be expressed separately, as two
additional parameters. note: though trickier than cartesian coordinates, homogeneous coordinates in projective geometry lead to 3×3 transformation matrices, and can simply express translations as linear functions. examples transform function comparison the following example provides a 3d cube created from dom elements and transforms, and a select menu allowing you to choose different transform...
...latex(100px)</option> <option>translatey(100px)</option> <option>translatez(100px)</option> <option>translate3d(50px, 50px, 50px)</option> <option>perspective(200px)</option> <option>matrix(1, 2, -1, 1, 80, 80)</option> <option>matrix3d(1,0,0,0,0,1,3,0,0,0,1,0,50,100,0,1.1)</option> </select> </div> </main> css main { width: 400px; height: 200px; p
adding: 50px; background-image: linear-gradient(135deg, white, cyan, white); } #example-element { width: 100px; height: 100px; transform-style: preserve-3d; transition: transform 1.5s; transform: rotate3d(1, 1, 1, 30deg); } .face { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; backface-visibility: inherit; fon...
...rm: rotatey(-90deg) translatez(50px); } .top { background: rgba(210,210,0,.7); transform: rotatex(90deg) translatez(50px); } .bottom { background: rgba(210,0,210,.7); transform: rotatex(-90deg) translatez(50px); } .select-form { margin-top: 50px; } javascript const selectelem = document.queryselector('select'); const example = document.queryselector('#example-element'); selectelem.
addeventlistener('change', () => { if(selectelem.value === 'choose a function') { return; } else { example.style.transform = `rotate3d(1, 1, 1, 30deg) ${selectelem.value}`; settimeout(function() { example.style.transform = 'rotate3d(1, 1, 1, 30deg)'; }, 2000) } }) result specifications specification status comment css transforms level 2the ...
... css transforms level 1the definition of '<transform-function>' in that specification. working draft initial definition ...
vertical-align - CSS: Cascading Style Sheets
:<img style="vertical-align:-1em" src="https://udn.realityripple.com/samples/16/ed9c61c3b6.png"/> 20%:<img style="vertical-align:20%" src="https://udn.realityripple.com/samples/16/ed9c61c3b6.png"/> -100%:<img style="vertical-align:-100%" src="https://udn.realityripple.com/samples/16/ed9c61c3b6.png"/> </p> #* { box-sizing: border-box; } img { margin-right: 0.5em; } p { height: 3em; p
adding: 0 .5em; font-family: monospace; text-decoration: underline overline; margin-left: auto; margin-right: auto; width: 80%; } to vertically align the content of a cell in a table: <table> <tr> <td style="vertical-align: baseline">baseline</td> <td style="vertical-align: top">top</td> <td style="vertical-align: middle">middle</td> <td style="vertical-align: bo...
... syntax /* keyword values */ vertical-align: baseline; vertical-align: sub; vertical-align: super; vertical-align: text-top; vertical-align: text-bottom; vertical-align: middle; vertical-align: top; vertical-...
...the bottom of the element and its descendants with the bottom of the entire line. for elements that do not have a baseline, the bottom margin edge is used instead. values for table cells baseline (and sub, super, text-top, text-bottom, <length>, and <percentage>) aligns the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned. top aligns the top p
adding edge of the cell with the top of the row. middle centers the p
adding box of the cell within the row. bottom aligns the bottom p
adding edge of the cell with the bottom of the row. negative values are allowed. formal definition initial valuebaselineapplies toinline-level and table-cell elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the line-he...
... css level 1the definition of 'vertical-align' in that specification. recommendation initial definition. ...
will-change - CSS: Cascading Style Sheets
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 perform premature optimizati...
...plies 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 perform premature optimization. if your page is performing well, don't
add the will-change property to elements just to wring out a little more speed. will-change is intended to be used as something of a last resort, in order to try to deal with existing performance problems. it should not be used to anticipate performance problems. excessive use of will-change will result in excessive memory use and will cause more complex rendering to occur as the browser attempts to ...
...ation typediscrete formal syntax auto | <animateable-feature>#where <animateable-feature> = scroll-position | contents | <custom-ident> examples via script this is an example showing how to apply the will-change property through scripting, which is probably what you should be doing in most cases. ...
...teable-feature>#where <animateable-feature> = scroll-position | contents | <custom-ident> examples via script this is an example showing how to apply the will-change property through scripting, which is probably what you should be doing in most cases. ...
Getting Started - Developer guides
cument, test.html, which contains the text "i'm a test." then we'll alert() the contents of the response. note that this example uses vanilla javascript — no jquery is involved. also, the html, xml and php files should be placed in the same directory. ...
...file, you must set response headers to work in internet explorer. if you do not set header content-type: application/xml, ie will throw a javascript "object expected" error after the line where you tried to access an xml element. note 2: if you do not set header cache-control: no-cache the browser will cache the response and never re-submit the request, making debugging challenging. you can also
add an always-different get parameter, like a timestamp or random number (see bypassing the cache) note 3: if the httprequest variable is used globally, competing functions calling makerequest() can overwrite each other, causing a race condition. declaring the httprequest variable local to a closure containing the ajax functions avoids this. in the event of a communication error (such as the server...
... some of the data contained in the xml document. you can see the test.xml here and the updated test script here. step 5 – working with data finally, let's send some data to the server and receive a response. our javascript will request a dynamic page this time, test.php, which will take the data we send and return a "computed" string - "hello, [user data]!" - which we'll alert(). ...
...dynamic page this time, test.php, which will take the data we send and return a "computed" string - "hello, [user data]!" - which we'll alert(). ...
DOM onevent handlers - Developer guides
the web platform provides several ways to be notified of dom events. two common approaches are
addeventlistener() and the specific onevent handlers. this page focuses on how the latter work. registering onevent handlers the onevent handlers are properties on certain dom elements to manage how that element reacts to events. elements can be interactive (links, buttons, images, forms, and so forth) or non-interactive (such as the base <body> element). events are actions like: being clicked detecting pressed keys getting focus the onevent handler is usually named with the event it reacts to, like onclick, onkeypress, onfocus, etc. ...
...tons, images, forms, and so forth) or non-interactive (such as the base <body> element). events are actions like: being clicked detecting pressed keys getting focus the onevent handler is usually named with the event it reacts to, like onclick, onkeypress, onfocus, etc. you can specify an on<…> event handler for a particular event (such as click) for a given object in different ways:
adding an html attribute named on<eventtype>: <button onclick="handleclick()">, or by setting the corresponding property from javascript: document.queryselector("button").onclick = function(event) { … }. an onevent event handler property serves as a placeholder of sorts, to which a single event handler can be assigned. in order to allow multiple handlers to be installed for the same event on...
...nttype>: <button onclick="handleclick()">, or by setting the corresponding property from javascript: document.queryselector("button").onclick = function(event) { … }. an onevent event handler property serves as a placeholder of sorts, to which a single event handler can be assigned. in order to allow multiple handlers to be installed for the same event on a given object, you can call its
addeventlistener() method, which manages a list of handlers for the given event on the object. a handler can then be removed from the object by calling its removeeventlistener() function. when an event occurs that applies to an element, each of its event handlers is called to allow them to handle the event, one after another. you don't need to call them yourself, although you can do so in many cases...
...on or object that is registered to be notified of events or more specifically, to the mechanism of registering event listeners via on… attributes in html or properties in web apis, such as <button onclick="alert(this)"> or window.onload = function() { … }. when discussing the various methods of listening to events: event listener refers to a function or object registered via eventtarget.
addeventlistener() event handler refers to a function registered via on… attributes or properties specifications specification status comment html living standardthe definition of 'event handlers' in that specification. living standard html5the definition of 'event handlers' in that specification. recommendation browser compatibility de...
Rich-Text Editing in Mozilla - Developer guides
able to "true" allows you to make individual elements of a document editable. executing commands when an html document has been switched to designmode, the document object exposes the document.execcommand method which allows one to run commands to manipulate the contents of the editable region. most commands affect the document's selection (bold, italics, etc), while others insert new elements (
adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand will affect the currently active editable element. internet explorer differences one major difference between mozilla and internet explorer that affects designmode is the generated code in the editable document: while internet explorer uses html tags (em, i, etc), mozilla 1.3 will generate by defaul...
...ignmode. for it to work in internet explorer, the contenteditable attribute of the body tag needs to be set to "true". figure 2 : first example html: <body contenteditable="true" onload="load()"> javascript: function load(){ window.document.designmode = "on"; } example 2 the second example is a simple rich text editing page, where text can be bolded/italicized/underlined, new links can be
added and the color of text changed. the example page consists of an iframe, which will be the rich editing area, as well as elements for basic editing commands such as bold/italics/text color. figure 3 : setting up rich-text editing html: <body onload="load()"> javascript: function load(){ getiframedocument("editorwindow").designmode = "on"; } function getiframedocument(aid){ // if contentdo...
...ument.open(); oprntwin.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; p
adding: 12px; overflow: scroll; } #textbox #sourcetext { p
adding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="too...
...le="quote" onclick="formatdoc('formatblock','blockquote');" src="data:image/gif;base64,r0lgodlhfgawaiqxac1nqjfrjkbgmt9nqujnsk9xrfj7u2r9qmkbt1igzhmorm6sz4oxw3odz4cl2zsnw6kxyqo306k63bg70btb0rdi3bvi4p///////////////////////////////////yh5baekab8alaaaaaawabyaaavp4ceozgmeakqubes2cekkervei1zzuogyflakecezfi0ggtgkebatfmjavxwevookeqgabb9iqdcmrlpjetrqqlhhjinrtq/b7/i8fp8paqa7" /> <img class="intlink" title="
add indentation" onclick="formatdoc('outdent');" src="data:image/gif;base64,r0lgodlhfgawamihaaaaadljwlie35gjuaezxtdv3nha7p///yh5baeaaacalaaaaaawabyaaam2elrc/jdkcqg9f2i7u8agqgyk1z2eibil+twqemxhmczsyvj3e4ahk+sfnagtxsqdqww6n5ceads=" /> <img class="intlink" title="delete indentation" onclick="formatdoc('indent');" src="data:image/gif;base64,r0lgodlhfgawaomiaaaaadljwl9vj1ie35gjuaezxtdv3nha7p//////////////...
Using HTML sections and outlines - Developer guides
eaning about its content to a browser; only a human reading the html source can divine the meaning of a class like navigation. by contrast, the <nav> sectioning element more clearly describes to browsers and other devices the content contained: links or other navigational structures to help users move through and understand where they are in a site's or page's content. new semantic elements were
added to html5 to improve and clarify the sectioning of websites into meaningful areas of content. it is important for developers to use these semantic elements in line with their intended purposes. many accessibility tools as well as reader views provided by some browsers rely on semantic sectioning elements. so don't simply swap out an existing tangle of <div> elements for a bunch of <section> elem...
... you removed all the other html except the <article> element, the content would still make sense to a reader. <article> <h1>how to become an mdn contributor</h1> <p> do you want to help protect the web?.... </p> </article> nesting elements inside an article the <article> element can have other semantic elements such as headers, asides, and footers. this is often useful if you want to
add css selectors to the class property of the element to style the document. <article> <header> <h1>how to become an mdn contributor</h1> </header> <p> do you want to help protect the web?.... </p> <aside> <blockquote> amazing quote from article </blockquote> </aside> <footer> <p> author info, publication date </p> </footer> </article> nesting ar...
...hat in a non-html5 browser, the default styling is different from what is expected for such elements. also note that the <time> element has not been included, because the default styling for it in a non-html5 browser is the same as the one in an html5-compatible one. next up, older ie versions do not allow styling of unsupported elements, unless you create an instance of them in the dom. ...
...ecific script to allow this, as seen below: <!--[if lt ie 9]> <script> document.createelement("article"); document.createelement("aside"); document.createelement("footer"); document.createelement("header"); document.createelement("nav"); document.createelement("section"); document.createelement("time"); </script> <![endif]--> as a last precaution, you could also
add an explicit <noscript> element inside the <head> element to warn any users that have javascript disabled that your page relies on javascript: <noscript> <p><strong>this web page requires javascript to be enabled.</strong></p> <p>javascript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.</p> <p><a href="https://goo.gl/...
<input type="date"> - HTML: Hypertext Markup Language
ntrol = document.queryselector('input[type="date"]'); datecontrol.value = '2017-06-01'; console.log(datecontrol.value); // prints "2017-06-01" console.log(datecontrol.valueasnumber); // prints 1496275200000, a unix timestamp this code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (june 1st, 2017). it then reads that value back in string and number formats.
additional attributes along with the attributes common to all <input> elements, date inputs have the following attributes: attribute description max the latest acceptable date min the earliest acceptable date step the stepping interval, when clicking up and down spinner buttons and validating the date max the latest date to accept. if the ...
...label> <p> <button>submit</button> </p> </form> if you try to submit the form with an incomplete date (or with a date outside the set bounds), the browser displays an error. try playing with the example now: here's a screenshot for those of you who aren't using a supporting browser: here's the css used in the above example. ...
...it's easy for someone to modify the html, or bypass your html entirely and submit the data directly to your server. ...
... we create a new <input> element, try setting its type to date, then immediately check what its type is — unsupporting bro...
<input type="password"> - HTML: Hypertext Markup Language
. if the pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see validation for more information. note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value. when setting the value of a password control, line feed and carriage return characters are stripped out of the value. ...
...e is specified, the content of a password control is only considered valid if the value passes validation; see validation for more information. note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value. when setting the value of a password control, line feed and carriage return characters are stripped out of the value. ...
...nly values consisting of at least four and no more than eight hexadecimal digits are valid. <label for="hexid">hex id: </label> <input id="hexid" type="password" pattern="[0-9a-fa-f]{4,8}" title="enter an id consisting of 4-8 hexadecimal digits" autocomplete="new-password"> disabled this boolean attribute indicates that the password field is not available for interaction.
additionally, disabled field values aren't submitted with the form. examples requesting a social security number this example only accepts input which matches the format for a valid united states social security number. these numbers, used for tax and identification purposes in the us, are in the form "123-45-6789". assorted rules for what values are permitted in each group exist as well. html...
...> <br> <label for="ssn">value:</label> <span id="current"></span> this uses a pattern which limits the entered value to strings representing legal socal security numbers. obviously, this regexp doesn't guarantee a valid ssn (since we don't have access to the social security administration's database), but it does ensure the number could be one; it generally avoids values that cannot be valid. in
addition, it allows the three groups of digits to be separated by a space, a dash ("-"), or nothing. the inputmode is set to numeric to encourage devices with virtual keyboards to switch to a numeric keypad layout for easier entry. the minlength and maxlength attributes are set to 9 and 12, respectively, to require that the value be at least nine and no more than 12 characters (the former without se...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
choose the most appropriate icon available. you can also provide a media type or query inside a media attribute; this resource will then only be loaded if the media condition is true. for example: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)"> some interesting new performance and security features have been
added to the <link> element too. take this example: <link rel="preload" href="myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous"> a rel value of preload indicates that the browser should preload this resource (see preloading content with rel="preload" for more details), with the as attribute indicating the specific class of content being fetched. the crossorigin attribute indic...
... 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), preventing 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 will not be loaded during page load. instead, the stylesheet will be loaded on-demand, if and when the disabled attribute is changed to false...
... html 4.01 specificationthe definition of '<link>' in that specification. recommendation ...
...face htmllinkelement specifications specification status comment html living standardthe definition of '<link>' in that specification. living standard no changes from latest snapshot html5the definition of '<link>' in that specification. recommendation
added crossorigin and sizes attributes; extended values of media to any media queries;
added numerous new values for rel. html 4.01 specificationthe definition of '<link>' in that specification. recommendation ...
itemscope - HTML: Hypertext Markup Language
ple.com/samples/60/d063c361c1.jpg" width="50" height="50" /> <p> by <span itemprop="author" itemscope itemtype="http://schema.org/person"> <span itemprop="name">carol smith</span> </span> </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. ...
...</span><br> fat per serving: <span itemprop="fatcontent">12 g</span><br> </span> <p> ingredients:<br> <span itemprop="recipeingredient">thinly-sliced apples: 6 cups<br></span> <span itemprop="recipeingredient">white sugar: 3/4 cup<br></span> ... </p> directions: <br> <div itemprop="recipeinstructions"> 1. cut and peel apples<br> 2. mix sugar and cinnamon. use
additional sugar for tart apples. <br> ... </div> </div> results html the following is an example rendering of the preceding code example. structured data itemscope itemtype recipe itemprop name grandma's holiday apple pie itemprop image https://c1.staticflickr.com/1/30/42759561_8631e2f905_n.jpg itemprop datepublished 2009-11-05...
...is an example rendering of the preceding code example. structured data itemscope itemtype recipe itemprop name grandma's holiday apple pie itemprop image https://c1.staticflickr.com/1/30/42759561_8631e2f905_n.jpg itemprop datepublished 2009-11-05 itemprop description this is my grandmother's apple pie recipe. i like to
add a dash of nutmeg. itemprop preptime pt30m itemprop cooktime pt1h itemprop totaltime pt1h30m itemprop recipeyield 1 9" pie (8 servings) itemprop recipeingredient thinly-sliced apples: 6 cups itemprop recipeingredient white sugar: 3/4 cup itemprop recipeinstructions 1. cut and peel apples 2. mix...
... itemprop preptime pt30m itemprop cooktime pt1h itemprop totaltime pt1h30m itemprop recipeyield 1 9" pie (8 servings) itemprop recipeingredient thinly-sliced apples: 6 cups itemprop 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 ...
Choosing between www and non-www URLs - HTTP
d with an adequate http 301 response to any request to the non-canonical domain. this will redirect the browser trying to access the non-canonical urls to their canonical equivalent. for example, if you've chosen to use non-www urls as the canonical type, you should redirect all www urls to their equivalent url without the www. ...
... non-canonical urls to their canonical equivalent. for example, if you've chosen to use non-www urls as the canonical type, you should redirect all www urls to their equivalent url without the www. example: a server receives a request for http://www.example.org/wh
addup (when the canonical domain is example.org) the server answers with a code 301 with the header location: http://example.org/wh
addup. the client issues a request to the canonical domain: http://example.org/whatddup the html5 boilerplate project has an example on how to configure an apache server to redirect one domain to the other. using <link rel="canonical"> it is possible to
add a special html <link> element to a page to indicate what the canonical
address of a page is. this has no impact on the human reader of the p...
...o a page to indicate what the canonical
address of a page is. this has no impact on the human reader of the page, but tells 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. ...
... 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 previous example, http://www.example.org/wh
addup would serve the same content as http://example.org/wh
addup, but with an
additional <link> element in the head: <link href="http://example.org/wh
addup" rel="canonical"> unlike the previous 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 to respond correctly for both, the www-pre...
MIME types (IANA media types) - HTTP
the subtype identifies the exact kind of data of the specified type the mime type represents. for example, for the mime type text, the subtype might be plain (plain text), html (html source code), or calendar (for icalendar/.ics) files. each type has its own set of possible subtypes, and a mime type always has both a type and a subtype, never just one or the other. an optional parameter can be
added to provide
additional details: type/subtype;parameter=value for example, for any mime type whose main type is text, the optional charset parameter can be used to specify the character set used for the characters in the data. if no charset is specified, the default is ascii (us-ascii) unless overridden by the user agent's settings. to specify a utf-8 text file, the mime type text/plain;charset...
... audio and video types as is the...
...and what bit rates and so forth they're useful at. the codecs used by webrtc guide expands upon this by specifically covering the codecs supported by the major web browsers, so you can choose the codecs that best cover the range of browsers you wish to support. as for mime types of audio or video files, they typically specify the container format (file type). the optional codecs parameter can be
added to the mime type to further specify which codecs to use and what options were used to encode the media, such as codec profile, level, or other such information. the most commonly used mime types used for web content are listed below. this isn't a complete list of all the types that may be available, however. see the media container formats guide for that. mime type audio or video ...
...for security reasons, most browsers do not allow setting a custom default action for such resources, forcing the user to save it to disk to use it. some common incorrect server configurations: ...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
reason reason: cors header 'access-control-allow-origin' missing what went wrong? the response to the cors request is missing the required access-control-allow-origin header, which is used to determine whether or not the resource can be accessed by content operating within the current origin. if the server is under your control,
add the origin of the requesting site to the set of domains permitted access by
adding it to the access-control-allow-origin header's value. for example, to allow a site at https://amazing.site to access the resource using cors, the header 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 *, an...
...eader's value. for example, to allow a site at https://amazing.site to access the resource using cors, the header 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 prevents 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...
...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, and must also set a vary: origin header to indicate that some headers are being set dynamically depending on the origin. the exact directive for setting headers depends on your web server. ...
... in apache,
add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, <files>, or <virtualhost> section). the configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. ...
Content Security Policy (CSP) - HTTP
these attacks are used for everything from data theft to site defacement to distribution of malware. csp is designed to be fully backward compatible (except csp version 2 where there are some explicitly-mentioned inconsistencies in backward compatibility; more details here section 1.1). browsers that don't support it still work with servers that implement it, and vice-versa: browsers that don't support csp simply ignore it, functioning as usual, defaulting to the standard same-origin policy for web content. ...
...able scripts. a csp compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling html attributes). as an ultimate form of protection, sites that want to never allow scripts to be executed can opt to globally disallow script execution. mitigating packet sniffing attacks in
addition to restricting the domains from which content can be loaded, the server can specify which protocols are allowed to be used; for example (and ideally, from a security standpoint), a server can specify that all content must be loaded using https. a complete data transmission security strategy includes not only enforcing https for data transfer, but also marking all cookies with the secure attr...
...sion security strategy includes not only enforcing https for data transfer, but also marking all cookies with the secure attribute and providing automatic redirects from http pages to their https counterparts. sites may also use the strict-transport-security http header to ensure that browsers connect to them only over an encrypted channel. using csp configuring content security policy involves
adding the content-security-policy http header to a web page and giving it values to control what resources the user agent is allowed to load for that page. for example, a page that uploads and displays images could allow images from anywhere, but restrict a form action to a specific endpoint. a properly designed content security policy helps protect a page against a cross site scripting attack. this...
...ilsite.com; img-src * note that this example doesn't specify a 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 ar...
Content-Security-Policy - HTTP
report-uri instructs the user agent to report attempts to violate the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. though the report-to directive is intended to replace the deprecated report-uri directive, report-to is not supported in most browsers yet. so for compatibility with current browsers while also
adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.example.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored. report-to fires a securitypolicyviolationevent. other directives block-all-mixed-content prevents loadin...
...eing specified for a resource, including via the content-security-policy header, the content-security-policy-report-only header and a <meta> element. you can use the content-security-policy header more than once, as in the example below. pay special attention to the connect-src directive here. even though the second policy would allow the connection, the first policy contains connect-src 'none'.
adding
additional policies can only further restrict the capabilities of the protected resource, which means that there will be no connection allowed and, as the strictest policy, connect-src 'none' is enforced. content-security-policy: default-src 'self' http://example.com; connect-src 'none'; content-security-policy: connect-src http://example.com/; ...
...src 'none' example: do not implement the above policy yet; instead just report violations that would have occurred: content-security-policy-report-only: default-src https:; report-uri /csp-violation-report-endpoint/ see mozilla web security guidelines for more examples. specifications specification status comment content security policy level 3 working draft
adds manifest-src, navigate-to, report-to, strict-dynamic, worker-src. undeprecates frame-src. deprecates report-uri in favor if report-to. mixed content candidate recommendation
adds block-all-mixed-content. subresource integrity recommendation
adds require-sri-for. upgrade insecure requests candidate recommendation
adds upgrade-insecure-requests. ...
...deprecates frame-src. ...
Protocol upgrade mechanism - HTTP
reference order. because upgrade is a hop-by-hop header, it also needs to be listed in the connection header field. this means that a typical request that includes upgrade would look something like: get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 other headers may be required depending on the requested protocol; for example, websocket upgrades allow
additional headers to configure details about the websocket connection as well as to offer a degree of security in opening the connection. see upgrading to a websocket connection for more details. if the server decides to upgrade the connection, it sends back a 101 switching protocols response status with an upgrade header that specifies the protocol(s) being switched to. if it does not (or cannot) ...
...o upgrade the connection, it sends back a 101 switching protocols response status with an upgrade header that specifies the protocol(s) being switched to. if it does not (or cannot) upgrade the connection, it ignores the upgrade header and sends back a regular response (for example, a 200 ok). right after sending the 101 status code, the server can begin speaking the new protocol, performing any
additional protocol-specific handshakes as necessary. effectively, the connection becomes a two-way pipe as soon as the upgraded response is complete, and the request that initiated the upgrade can be completed over the new protocol. common uses for this mechanism here we look at the most common use cases for the upgrade header. upgrading to a websocket connection by far, the most common use case...
... does all the work of creating an initial http/1.1 connection then handling the handshaking and upgrade process for you. you can also use the "wss://" url scheme to open a secure websocket connection. if you need to create a websocket connection from scratch, you'll have to handle the handshaking process yourself. after creating the initial http/1.1 session, you need to request the upgrade by
adding to a standard request the upgrade and connection headers, as follows: connection: upgrade upgrade: websocket websocket-specific headers the following headers are involved in the websocket upgrade process. other than the upgrade and connection headers, the rest are generally optional or handled for you by the browser and server when they're talking to each other. sec-websocket-extensions s...
...n 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 prevent 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 to upgrade. the client
adds this if it wishes to do so, and the server will include in the response a key of its own, which the client will validate before delivering the upgrade response to you. the server's response's sec-websocket...
Proxy servers and tunneling - HTTP
d 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 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. reverse proxies as the name implies, a reverse proxy does the opposite of what a forward proxy does: a forward proxy acts in behalf of clients (or requesting hosts), a reverse proxy acts in behalf of servers. forward proxies can hide the identities...
...rvers. reverse proxies have several use cases, a few are: load balancing: distribute the load to several web servers, cache static content: offload the web servers by caching static content like pictures, compression: compress and optimize content to speed up load time. forwarding client information through proxies proxies can make requests appear as if they originated from the proxy's ip
address. this can be useful if a proxy is used to provide client anonymity, but in other cases information from the original request is lost. the ip
address of the original client is often used for debugging, statistics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains informati...
...cs, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. or the de-facto standard versions: x-forwarded-for identifies the originating ip
addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x-forwarded-proto identifies the protocol (http or https) that a client used to connect to your proxy or load balancer. to provide information about the proxy itself (not about the cli...
...tp proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x-forwarded-proto identifies the protocol (http or https) that a client used to connect to your proxy or load balancer. to provide information about the proxy itself (not about the client connecting to it), the via header can be used. via
added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers. http tunneling tunneling transmits private network data and protocol information through public network by encapsulating the data. http tunneling is using a protocol of higher level (http) to transport a lower level protocol (tcp). the http protocol specifies a request method called...
HTTP Public Key Pinning (HPKP) - HTTP
rete steps necessary to deliver the hpkp header depend on the web server you use. note: these examples use a max-age of two months and include all subdomains. it is advised to verify that this setup will work for your server. hpkp has the potential to lock out users for a long time if used incorrectly! the use of backup certificates and/or pinning the ca certificate is recommended. apache
adding a line similar to the following to your webserver's config will enable hpkp on your apache. this requires mod_headers enabled. header always set public-key-pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includesubdomains" nginx
adding the following line and inserting the appropriate pin-sha256="..." values will enable hpkp on your nginx. this require...
...ing to your webserver's config will enable hpkp on your apache. this requires mod_headers enabled. header always set public-key-pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includesubdomains" nginx
adding the following line and inserting the appropriate pin-sha256="..." values will enable hpkp on your nginx. this requires the ngx_http_headers_module. ...
...ng line and inserting the appropriate pin-sha256="..." values will enable hpkp on your nginx. this requires the ngx_http_headers_module.
add_header public-key-pins 'pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includesubdomains' always; lighttpd the following line with your relevant key information (pin-sha256="..." fields) will enable hpkp on lighttpd. ...
... relevant key information (pin-sha256="..." fields) will enable hpkp on lighttpd. setenv.
add-response-header = ( "public-key-pins" => "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includesubdomains") note: this requires the mod_setenv server.module loaded which can be included by the following if not already loaded. server.modules += ( "mod_setenv" ) iis
add the following line to the web.config file to send the public-key-pins header: <system.webserver> ... <httpprotocol> <customheaders> <
add name="public-key-pins" value="pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includesubdomains" /> </customheaders> </httpprotocol> ... </system.webserver> specifications spe...
Introduction - JavaScript
entals, you can use the javascript reference to get more details on individual objects and statements. what is javascript? javascript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). there are also more advanced server side versions of javascript such as node.js, which allow you to
add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers). inside a host environment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them. javascript contains a standard library of objects, such as array, date, and math, and a core set of language eleme...
...ronment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them. javascript contains a standard library of objects, such as array, date, and math, and a core set of language elements such as operators, control structures, and statements. core javascript can be extended for a variety of purposes by supplementing it with
additional objects; for example: client-side javascript extends the core language by supplying objects to control a browser and its document object model (dom). for example, client-side extensions allow an application to place elements on an html form and respond to user events such as mouse clicks, form input, and page navigation. server-side javascript extends the core language by supplying obj...
...these scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation. javascript compared to java javascript java object-oriented. no distinction between types of objects. inheritance is through the prototype mechanism, and properties and methods can be
added to any object dynamically. class-based. objects are divided into classes and instances with all inheritance through the class hierarchy. classes and instances cannot have properties or methods
added dynamically. variable data types are not declared (dynamic typing, loosely typed). variable data types must be declared (static typing, strongly typed). cannot automatically ...
...} greetme('world'); /* end of your code */ })(); press cmd+enter or ctrl+enter (or click the run button) to watch it unfold in your browser! in the following 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. you will learn what these mean, but for now they can be thought of as doing the following: massively improve performance. prevent stupid semantics in javascript that trip up beginners. prevent code snippets executed in the console from interacting with one-another (e.g., having something created in one console execution being used for a different console execut...
Loops and iteration - JavaScript
a do...while statement looks as follows: do statement while (condition); statement is always executed once before the condition is checked. (to execute mul...
...ion is tested again. if the condition returns false, execution stops, and control is passed to the statement following while. to execute multiple statements, use a block statement ({ ... }) to group those statements. example 1 the following while loop iterates as long as n is less than 3: let n = 0; let x = 0; while (n < 3) { n++; x += n; } with each iteration, the loop increments n and
adds that value to x. therefore, x and n take on the following values: after 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...
... for...of statement the for...of statement creates a loop iterating over iterable o...
... car.model = mustang arrays although it may be tempting to use this as a way to iterate over array elements, the for...in statement will return the name of your user-defined properties in
addition to the numeric indexes. therefore, it is better to use a traditional for loop with a numeric index when iterating over arrays, because the for...in statement iterates over user-defined properties in
addition to the array elements, if you modify the array object (such as
adding custom properties or methods). for...of statement the for...of statement creates a loop iterating over iterable objects (including array, map, set, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property. for (variable of object) statement ...
Public class fields - JavaScript
hod { publicmethod() { return 'hello world' } } examples public static fields public static fields are useful when you want a field to exist only once per class, not on every class instance you create. this is useful for caches, fixed-configuration, or any other data you don't need to be replicated across instances. public static fields are declared using the static keyword. they are
added to the class constructor at the time of class evaluation using object.defineproperty(). they are accessed again from the class constructor. class classwithstaticfield { static staticfield = 'static field' } console.log(classwithstaticfield.staticfield) // expected output: "static field" fields without initializers are initialized to undefined. class classwithstaticfield { static sta...
...estaticfield) // expected output: "base static field" console.log(subclasswithstaticfield.substaticfield) // expected output: "base static method output" public instance fields public instance fields exist on every created instance of a class. by declaring a public field, you can ensure the field is always present, and the class definition is more self-documenting. public instance fields are
added with object.defineproperty() either at construction time in the base class (before the constructor body runs), or just after super() returns in a subclass. class classwithinstancefield { instancefield = 'instance field' } const instance = new classwithinstancefield() console.log(instance.instancefield) // expected output: "instance field" fields without initializers are initialized to unde...
...'t called on instances of the class. instead, they're called on the class itself. these are often utility functions, such as functions to create or clone objects. class classwithstaticmethod { static staticmethod() { return 'static method has been called.'; } } console.log(classwithstaticmethod.staticmethod()); // expected output: "static method has been called." the static methods are
added to the class constructor with object.defineproperty() at class evaluation time. these methods are writable, non-enumerable, and configurable. public instance methods as the name implies, public instance methods are methods available on class instances. class classwithpublicinstancemethod { publicmethod() { return 'hello world' } } const instance = new classwithpublicinstancemethod()...
...table, non-enumerable, and configurable. public instance methods as the name implies, public instance methods are methods available on class instances. class classwithpublicinstancemethod { publicmethod() { return 'hello world' } } const instance = new classwithpublicinstancemethod() console.log(instance.publicmethod()) // expected output: "hello world" public instance methods are
added to the class prototype at the time of class evaluation using object.defineproperty(). they are writable, non-enumerable, and configurable. you may make use of generator, async, and async generator functions. class classwithfancymethods { *generatormethod() { } async asyncmethod() { } async *asyncgeneratormethod() { } } inside instance methods, this refers to the instance itself. in sub...
Array.prototype.flatMap() - JavaScript
for reference, please check: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 examples map() and flatmap() let arr1 = [1, 2, 3, 4]; arr1.map(x => [x * 2]); // [[2], [4], [6], [8]] arr1.flatmap(x => [x * 2]); // [2, 4, 6, 8] // only one level is fl...
...arr.reduce((acc, x) => acc.concat([x, x * 2]), []); // [1, 2, 2, 4, 3, 6, 4, 8] note, however, that this is inefficient and should be avoided for large arrays: in each iteration, it creates a new temporary array that must be garbage-collected, and it copies elements from the current accumulator array into a new array instead of just
adding the new elements to the existing array. please do not
add polyfills on this article. for reference, please check: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 examples map() and flatmap() let arr1 = [1, 2, 3, 4]; arr1.map(x => [x * 2]); // [[2], [4], [6], [8]] arr1.flatmap(x => [x * 2]); // [2, 4, 6, 8] // only one level is flattened arr1.flatmap(x => [[x * 2]]); // [[2], [4], [6], [8]] ...
... is an example that better showcases the use of flatmap. let's generate a list of words from a list of sentences. let arr1 = ["it's sunny in", "", "california"]; arr1.map(x => x.split(" ")); // [["it's","sunny","in"],[""],["california"]] arr1.flatmap(x => x.split(" ")); // ["it's","sunny","in", "", "california"] notice, the output list length can be different from the input list length. for
adding and removing items during a map() flatmap can be used as a way to
add and remove items (modify the number of items) during a map. in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a multiple-element array to...
...ng and removing items during a map() flatmap can be used as a way to
add and remove items (modify the number of items) during a map. in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a multiple-element array to
add items, or a 0-element array to remove the item. // let's say we want to remove all the negative numbers // and split the odd numbers into an even number and a 1 let a = [5, 4, -3, 20, 17, -33, -4, 18] // |\ \ x | | \ x x | // [4,1, 4, 20, 16, 1, 18] a.flatmap( (n) => (n < 0) ? [] : (n % 2 == 0) ? [n] : [n-1, 1] ) // expected output: [4, 1...
Intl.Locale.prototype.calendar - JavaScript
i arabia sighting iso8601 iso calendar (gregorian calendar using the iso 8601 calendar week rules) japanese japanese imperial calendar persian persian calendar roc republic of china calendar the islamicc calendar key has been deprecated. please use islamic-civil. ...
...apanese japanese imperial calendar persian persian calendar roc republic of china calendar the islamicc calendar key has been deprecated. please use islamic-civil. islamicc civil (algorithmic) arabic calendar examples
adding a calendar in the locale string calendar eras fall under the category of locale key "extension keys". these keys
add additional data about the locale, and are
added to locale identifiers by using the -u extension. ...
...islamicc calendar key has been deprecated. please use islamic-civil. islamicc civil (algorithmic) arabic calendar examples
adding a calendar in the locale string calendar eras fall under the category of locale key "extension keys". these keys
add additional data about the locale, and are
added to locale identifiers by using the -u extension. thus, the calendar era type can be
added to the inital locale identifier string that is passed into the intl.locale constructor. to
add the calendar type, first
add the -u extension to the string. next,
add the -ca extension to indicate that you are
adding a calendar type. ...
...ys". these keys
add additional data about the locale, and are
added to locale identifiers by using the -u extension. thus, the calendar era type can be
added to the inital locale identifier string that is passed into the intl.locale constructor. to
add the calendar type, first
add the -u extension to the string. next,
add the -ca extension to indicate that you are
adding a calendar type. finally,
add the calendar era to the string. let frbuddhist = new intl.locale("fr-fr-u-ca-buddhist"); console.log(frbuddhist.calendar); // prints "buddhist"
adding a calendar with a configuration object the intl.locale constructor has an optional configuration object argument, which can contain any of several extension types, including calendars. set the calendar property of the configuration object to you...
Intl.Locale.prototype.caseFirst - JavaScript
the intl.locale.prototype.casefirst property is an accessor property that returns whether case is taken into account for the locale's collation rules. description a locale's collation rules are used to determine how strings are ordered in that locale. certain locales use a character's case (uppercase or lowercase) in the collation process. this
additional rule can be expressed in a locale's casefirst property. there are 3 values that the casefirst property can have, outlined in the table below. casefirst values value description upper upper case to be sorted before lower case. lower lower case to be sorted before upper case. false no special case ordering. examples setting the casefirst value via the locale string in the unico...
... upper upper case to be sorted before lower case. lower lower case to be sorted before upper case. false no special case ordering. examples setting the casefirst value via the locale string in the unicode locale string spec, the values that casefirst represents correspond to the key kf. kf is treated as a locale string "extension subtag". ...
... upper upper case to be sorted before lower case. lower lower case to be sorted before upper case. false no special case ordering. examples setting the casefirst value via the locale string in the unicode locale string spec, the values that casefirst represents correspond to the key kf. kf is treated as a locale string "extension subtag". ...
...ore lower case. lower lower case to be sorted before upper case. false no special case ordering. examples setting the casefirst value via the locale string in the unicode locale string spec, the values that casefirst represents correspond to the key kf. kf is treated as a locale string "extension subtag". these subtags
add additional data about the locale, and are
added to locale identifiers by using the -u extension key. thus, the casefirst value can be
added to the inital locale identifier string that is passed into the locale constructor. to
add the casefirst value, first
add the -u extension key to the string. next,
add the -kf extension key to indicate that you are
adding a value for casefirst. finally,
add the casefirst value to the string. let casefirs...
Intl.Locale.prototype.numeric - JavaScript
strings. this special numeric handling means that sequences of decimal digits will be compared as numbers. for example, the string "a-21" will be considered less than "a-123". examples setting the numeric value via the locale string in the unicode locale string spec, the values that numeric represents correspond to the key kn. kn is considered a locale string "extension subtag". ...
...ings. this special numeric handling means that sequences of decimal digits will be compared as numbers. for example, the string "a-21" will be considered less than "a-123". examples setting the numeric value via the locale string in the unicode locale string spec, the values that numeric represents correspond to the key kn. kn is considered a locale string "extension subtag". ...
...that sequences of decimal digits will be compared as numbers. for example, the string "a-21" will be considered less than "a-123". examples setting the numeric value via the locale string in the unicode locale string spec, the values that numeric represents correspond to the key kn. kn is considered a locale string "extension subtag". these subtags
add additional data about the locale, and are
added to locale identifiers by using the -u extension key. thus, the numeric value can be
added to the inital locale identifier string that is passed into the locale constructor. to set the numeric value, first
add the -u extension key to the string. next,
add the -kn extension key to indicate that you are
adding a value for numeric. finally,
add the numeric value to the string. if you want to set nu...
...rs by using the -u extension key. thus, the numeric value can be
added to the inital locale identifier string that is passed into the locale constructor. to set the numeric value, first
add the -u extension key to the string. next,
add the -kn extension key to indicate that you are
adding a value for numeric. finally,
add the numeric value to the string. if you want to set numeric to true, simply
adding the kn key will suffice. to set the value to false, you must specify in by
adding "false" after the kn key. let numericviastr = new intl.locale("fr-latn-fr-u-kn-false"); console.log(numericstr.numeric); // prints "false" setting the numeric value via the configuration object argument the intl.locale constructor has an optional configuration object argument, which can be used to pass extensi...
Object.seal() - JavaScript
the object.seal() method seals an object, preventing 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 prevents new properties from being
added and marks all existing properties as non-configurable. this has the effect of ...
... the prototype chain remains untouched. however, the __proto__ property is sealed as well. ...
... mode code). the prototype chain remains untouched. however, the __proto__ property is sealed as well. comparison to object.freeze() existing properties in objects frozen with object.freeze() are made immutable. objects sealed with object.seal() can have their existing properties changed. examples using object.seal var obj = { prop: function() {}, foo: 'bar' }; // new properties may be
added, existing properties // may be changed or removed. obj.foo = 'baz'; obj.lumpy = 'woof'; delete obj.prop; var o = object.seal(obj); o === obj; // true object.issealed(obj); // === true // changing property values on a sealed object // still works. obj.foo = 'quux'; // but you can't convert data properties to accessors, // or vice versa. object.defineproperty(obj, 'foo', { get: function() {...
...issealed(obj); // === true // changing property values on a sealed object // still works. obj.foo = 'quux'; // but you can't convert data properties to accessors, // or vice versa. object.defineproperty(obj, 'foo', { get: function() { return 'g'; } }); // throws a typeerror // now any changes, other than to property values, // will fail. obj.quaxxor = 'the friendly duck'; // silently doesn't
add the property delete obj.foo; // silently doesn't delete the property // ...and in strict mode such attempts // will throw typeerrors. function fail() { 'use strict'; delete obj.foo; // throws a typeerror obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted
additions through // object.defineproperty will also throw. object.defineproperty(obj, 'ohai', { value: 17 }); // throws...
Set.prototype[@@iterator]() - JavaScript
ource 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 myset[symbol.iterator] return value the set iterator function, which is the values() function by default. ...
...nteractive 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 myset[symbol.iterator] return value the set iterator function, which is the values() function by default. ...
...mple 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 myset[symbol.iterator] return value the set iterator function, which is the values() function by default. ...
...ator function, which is the values() function by default. examples using [@@iterator]() const myset = new set(); myset.
add('0'); myset.
add(1); myset.
add({}); const setiter = myset[symbol.iterator](); console.log(setiter.next().value); // "0" console.log(setiter.next().value); // 1 console.log(setiter.next().value); // object using [@@iterator]() with for..of const myset = new set(); myset.
add('0'); myset.
add(1); myset.
add({}); for (const v of myset) { console.log(v); } specifications specification ecmascript (ecma-262)the definition of 'set.prototype[@@iterator]' in that specification. ...
eval() - JavaScript
's machine with the permissions of your webpage / extension. more importantly, a third-party code can see the scope in which eval() was invoked, which can lead to possible attacks in ways to which the similar function is not susceptible. eval() is also slower than the alternatives, since it has to invoke the javascript interpreter, while many other constructs are optimized by modern js engines. ...
... fortunately, there's a very good alternative to eval(): simply using window.function(). ...
...g function() as shown above, you can minify the code string passed to runcodewithdatefunction() far more efficiently because the function arguments names can be minified too as seen in the minified code below. console.log(function('"use strict";return(function(a){return a(5)})')()(function(a){ return"monday tuesday wednesday thursday friday saturday sunday".split(" ")[a%7||0]})); there are also
additional safer (and faster!) alternatives to eval() or function() for common use-cases. accessing member properties you should not use eval() to convert property names into properties. consider the following example where the property of the object to be accessed is not known until the code is executed. this can be done with eval(): var obj = { a: 20, b: 30 }; var propname = getpropname(); // r...
... snippets of code javascript has first-class functions, which means you can pass functions as arguments to other apis, store them in variables and objects' properties, and so on. many dom apis are designed with this in mind, so you can (and should) write: // instead of settimeout(" ... ", 1000) use: settimeout(function() { ... }, 1000); // instead of elt.setattribute("onclick", "...") use: elt.
addeventlistener('click', function() { ... } , false); closures are also helpful as a way to create parameterized functions without concatenating strings. parsing json (converting strings to javascript objects) if the string you're calling eval() on contains data (for example, an array: "[1, 2, 3]"), as opposed to code, you should consider switching to json, which allows the string to use a subse...
Trailing commas - JavaScript
json, however, disallows trailing commas. ...
... json, however, disallows trailing commas. ...
... json, however, disallows trailing commas. ...
... json, however, disallows trailing commas. syntax , examples trailing commas in literals arrays javascript ignores trailing commas in arrays: var arr = [ 1, 2, 3, ]; arr; // [1, 2, 3] arr.length; // 3 if more than one trailing comma is used, an elision (or hole) is produced. ...
MathML documentation index - MathML
this is an alphabetical list of mathml presentation elements. 10 <maction> mathml, mathml reference, mathml:element, mathml:enlivening expressions the following example uses the "toggle" actiontype: 11 <math> mathml, mathml reference, mathml:element the top-level element in mathml is <math>. every valid mathml instance must be wrapped in <math> tags. in
addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it. 12 <menclose> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <menclose> element renders its content inside an enclosing notation specified by the notation attribute. 13 <merror> mathml, mathml refere...
...t this error is not thrown when your mathml markup is wrong or not well-formed xml. you will still get an xml parsing error (in case of the xhtml notation of mathml), which has nothing to do with <merror>. 14 <mfenced> deprecated, mathml, mathml reference, mathml:element, mathml:general layout schemata the deprecated mathml <mfenced> element used to provide the possibility to
add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. it has been removed from the latest mathml standard and modern browsers no longer support it. 15 <mfrac> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mfrac> element is used to display fractions. 16 <mglyph...
...l meaning, this element also includes "operators" like parentheses, separators like comma and semicolon, or "absolute value" bars. 22 <mover> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <mover> element is used to attach an accent or a limit over an expression. use the following syntax: <mover> base overscript </mover> 23 <mp
added> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mp
added> element is used to
add extra p
adding and to set the general adjustment of position and size of enclosed contents. 24 <mphantom> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mphantom> element is rendered invisibly, but dimensions (s...
...re roots (no index is displayed). the square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. 30 <mstyle> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mstyle> element is used change the style of its children. it accepts all attributes of all mathml presentation elements with some exceptions and
additional attributes listed below. 31 <msub> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <msub> element is used to attach a subscript to an expression. 32 <msubsup> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <msubsup> element is used to attach both a subscript and a superscr...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
n them. this change means that the aspect ratio of the image is calculated by the browser early on and can then be used to correct the size needed to display the image before it has loaded, if css has been applied that causes problems with its display size. read on to find out more. jank problems when loading images in the olden days of web development, it was always seen as a good practice to
add width and height attributes to your html <img> elements, so that when browsers first loaded the page, they could put a correctly-sized placeholder box in the layout for each image to appear in when it finally loads. without the width and height attributes, no placeholder space would be created, and when the image finally loaded you would get a noticeable jank in the page layout. this wasn't an...
...r box in the layout for each image to appear in when it finally loads. without the width and height attributes, no placeholder space would be created, and when the image finally loaded you would get a noticeable jank in the page layout. this wasn't an attractive thing for your users to see, and could also result in performance issues due to the repainting required after each image loads, hence
adding the attributes being a good idea. let’s move forward a few years to the era of responsive design. to keep images from breaking out of their containers when the container becomes narrower than the image, developers started using css like the following: img { max-width: 100%; height: auto; } this is really useful for responsive layouts, but unfortunately it causes the jank problem to re...
...property and propose the idea of using the width and height attributes to compute layout. fantasai & jen simmons collaborated with emilio, who worked on an experimental implementation to prove it would work. mozilla then brought the idea up in the wicg community group and discussed it further until representatives from chrome were onboard with the idea. due to this work, browsers are working on
adding a new mechanism for sizing images before the actual image is loaded. firefox has
added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements, and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, ta...
... accept width and height attributes. this appears in the browser's internal ua stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } this actually affects any element that acts as a container for complex or mixed visual media — <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in
addition to actual images (<img> and <input type="image">). when such an element has width and height attributes set on it, its aspect ratio will be calculated before load time, and be available to the browser. note: currently this effect is being limited to actual <img> elements, as applying to other such elements may have undesirable results. see (bug 1583980). when the width/height of an <img...
OpenSearch description format
the opensearch description format lets a website describe a search engine for itself, so that a browser or other client application can use that search engine. opensearch is supported by (at least) firefox, edge, internet explorer, safari, and chrome. (see reference material for links to other browsers' documentation.) firefox also supports
additional features not in the opensearch standard, such as search suggestions and the <searchform> element. this article focuses on creating opensearch-compatible search plugins that support these
additional firefox features. opensearch description files can be advertised as described in autodiscovery of search plugins, and can be installed programmatically as described in
adding search engines from web pages. opensearch description file the xml file...
... note: since this element is firefox-specific, and not part of the opensearch specification, we use the moz: xml namespace prefix in the example above to ensure that other user agents that don't support this element can safely ignore it. autodiscovery of search plugins web sites with search plugins can advertise them so firefox users can easily install the plugins. to support autodiscovery,
add a <link> element for each plugin to the <head> of your web page: <link rel="search" type="application/opensearchdescription+xml" title="searchtitle" href="pluginurl"> replace the bolded items as explained below: searchtitle the name of the search to perform, such as "search mdc" or "yahoo! search". this must match your plugin file's <shortname>. pluginurl the url to the...
...can automatically update. to support this, include an extra url element with type="application/opensearchdescription+xml" and rel="self". the template attribute should be the url of the opensearch document to automatically update to. for example: <url type="application/opensearchdescription+xml" rel="self" template="https://example.com/mysearchdescription.xml" /> note: at this time,
addons.mozilla.org (amo) doesn't support automatic updating of opensearch plugins. if you want to put your search plugin on amo, remove the auto-updating feature before submitting it. troubleshooting tips if there is a mistake in your search plugin xml, you could run into errors when
adding a discovered plugin. if the error message isn't be helpful, the following tips could help you find the proble...
...tribute is important — without it you could get the error message "firefox could not download the search plugin". you must include a text/html url — search plugins including only atom or rss url types (which is valid, but firefox doesn't support) will also generate the "could not download the search plugin" error. remotely fetched favicons must not be larger than 10kb (see bug 361923). in
addition, the search plugin service provides a logging mechanism that may be useful to plugin developers. use about:config to set the pref 'browser.search.log' to true. then, logging information will appear in firefox's error console (tools 〉 error console) when search plugins are
added. reference material opensearch documentation safari 8.0 release notes: quick website search microsoft edge ...
Web Performance
splay, and do they animate smoothly as they do so? web performance includes both objective measurements like time to load, frames per second, and time to become interactive, and subjective experiences of how long it felt like it took the content to load. the longer it takes for a site to respond, the more users will abandon the site. it is important to minimize the loading and response times and
add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. there are tools, apis, and best practices that help us measure and improve web performance. we cover them in this section: key performance guides animation performance and frame rateanimation...
... your users perceive your site to be. these perceptions are impacted by actual page load time, idling, responsiveness to user interaction, and the smoothness of scrolling and other animations. in this article, we discuss the various loading metrics, animation, and responsiveness metrics, along with best practices to improve user perception, if not the actual timings. web performance basics in
addition to the front end components of html, css, javascript, and media files, there are features that can make applications slower and features that can make applications subjectively and objectively faster. there are many apis, developer tools, best practices, and bad practices relating to web performance. here we'll introduce many of these features ad the basic level and provide links to deeper d...
...such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. multimedia: images and video the lowest hanging fruit of web performance is often media optimization. serving different media files based on each user agent's capability, size, and pixel density is possible.
additional tips like removing audio tracks from background videos can improve performance even further. in this article we discuss the impact video, audio, and image content has on performance, and the methods to ensure that impact is as minimal as possible. css performance features css may be a less important optimization focus for improved performance, but there are some css features that impact ...
...to read waterfall charts, call trees, traces, flame charts , and allocations in your browser developer tools will help you understand waterfall and flame charts in other performance tools. alternative media formats when it comes to images and videos, there are more formats than you're likely aware of. some of these formats can take your highly optimized media-rich pages even further by offering
additional reductions in file size. in this guide we'll discuss some alternative media formats, how to use them responsibly so that non-supporting browsers don't get left out in the cold, and some advanced guidance on transcoding your existing assets to them. analyzing javascript bundles no doubt, javascript is a big part of modern web development. while you should always strive to reduce the amoun...
How to make PWAs installable - Progressive web apps (PWAs)
e 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. this makes the web app easier to access;
additionally, you can specify that the app be launched in fullscreen or standalone mode, thus removing the default browser user interface that would otherwise be present, creating an even more seamless and native-like feel. requirements to make the web site installable, it needs the following things in place: a web manifest, with the correct fields filled in the web site to be served from a sec...
...l web manifest must have at least a name and an icons field with at least one icon defined; that icon must have at least the src, sizes, and type sub-fields as well. beyond that, everything is optional, though the description, short_name, and start_url fields are recommended. there are even more fields you can use than listed above — be sure to check the web app manifest reference for details.
add to home screen "
add to home screen" (or a2hs for short) is a feature implemented by mobile browsers that takes the information found in an app's web manifest and uses them to represent the app on the device's home screen with an icon and name. this only works if the app meets all the necessary requirements, as described above. when the user visits the pwa with a supporting mobile browser, it sh...
...er the user indicates they wish to proceed with installation, the install banner is shown. that banner is automatically created by the browser, based on the information from the manifest file. for instance, the prompt includes the app's name and icon. if the user clicks the button, there is a final step showing what the app will look like, and letting the user choose if they definitely want to
add the app. when confirmed, the app will be installed on the home screen. now the user can launch and use the web app just like any other application on their device. depending on the device and operating system, the web app's icon may be badged with a small icon that indicates that it's a web app. in the screen shot above, for example, the app has a tiny firefox icon, indicating that it's a w...
...splash screen is also generated from the information in the manifest, which is shown when the pwa is launched and while it's being loaded started up. the icon and the theme and background colors are used to create this screen. summary in this article, we learned about how we can make pwas installable with a properly-configured web manifest, and how the user can then install the pwa with the "
add to home screen" feature of their browser. for more information on a2hs, be sure to read our
add to home screen guide. browser support is currently limited to firefox for android 58+, mobile chrome and android webview 31+, and opera for android 32+, but this should improve in the near future. now let's move to the last piece of the pwa puzzle: using push notifications to share announcements with...
Content type - SVG: Scalable Vector Graphics
of the definitions of attributes fill, stroke, stop-color, flood-color, and lighting-color, which also offer optional icc-based color specifications. svg supports all of the syntax alternatives for <color> defined in css2 syntax and basic data types, and (depend on the implementation) in the future css color module level 3. a <color> is either a keyword or a numerical rgb specification. in
addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. the normative definition of these keywords is found in user preferences for colors (css2, section 18.2). the format of an rgb value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. the three-digit rgb notation (#rgb...
...o the colors used by objects in the user's environment. the normative definition of these keywords is found in user preferences for colors (css2, section 18.2). the format of an rgb value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. the three-digit rgb notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by
adding zeros. for example, #fb0 expands to #ffbb00. this ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display. the format of an rgb value in the functional notation is an rgb start-function, followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followe...
...e svg dom, an <integer> is represented as a number or an svganimatedinteger. iri <iri> an internationalized resource identifier. on the internet, resources are identified using iris (internationalized resource identifiers). for example, an svg file called somedrawing.svg located at http://example.com might have the following iri: http://example.com/somedrawing.svg an iri can also
address a particular element within an xml document by including an iri fragment identifier as part of the iri. an iri which includes an iri fragment identifier consists of an optional base iri, followed by a "#" character, followed by the iri fragment identifier. for example, the following iri can be used to specify the element whose id is "lamppost" within file somedrawing.svg: http://example.com...
...to specify a list of coordinate system transformations. a detailed description of the possible values for a <transform-list> is given in the transform attribute definition. within the svg dom, a <transform-list> value is represented using an svgtransformlist or svganimatedtransformlist object. url url a uniform resource locator. a url is a sequence of unicode characters, building an
address to an internal or external resource. before svg 2, the more limited iri content type was used instead, because the url specification was not standardized before. ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
implemented coordinate systems, transformations and units change notes exception for bad values on svgmatrix.skewx() and svgmatrix.skewy() implementation status unknown bounding box for element with no position at (0, 0) implementation status unknown defer keyword removed from preserveaspectratio attribute removed (bug 1280425)
added non-scaling-size, non-rotation and fixed-position keywords for vector-effect property not implemented 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 comm...
...-effect property not implemented 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 previous 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 cha...
...glyphitem> and <glyphref> removed <altglyph>, <altglyphdef> and <altglyphitem> removed (bug 1260032), <glyphref> never really implemented (bug 1302693) svgtextcontentelement.selectsubstring() deprecated implementation status unknown getcomputedtextlength() not including dx and dy values implementation status unknown text in non-rendered elements not included in
addressable characters implementation status unknown unknown elements in text render as unpositioned spans implementation status unknown offset distances of text positioned along a transformed path measured in text elements coordinate system implementation status unknown embedded content change notes <video> implementation status unknown ...
...plementation status unknown unspecified svg view fragment parameters don't cause corresponding attributes to be reset to initial values implementation status unknown viewtarget attribute of <view> and corresponding svg view fragment parameter removed implementation status unknown fragment-only urls are always same-document implementation status unknown
additional attributes on <a> implemented (bug 1451823) scripting change notes contentscripttype removed implementation status unknown animationevents.onload removed implementation status unknown fonts change notes <font>, <glyph>, <missing-glyph>, <hkern>, <vkern>, <font-face>, <font-face-src>, <font-face-uri>, <font-...
Scripting - SVG: Scalable Vector Graphics
one can override default browser behaviors with the evt.preventdefault( ) 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. preventing default behavior in event code when writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. or if you want to use the backspace key in your code, you want to override the browser's default behavior when the backspace key is pressed, which is to go back to the previous page. ...
... when writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. or if you want to use the backspace key in your code, you want to override the browser's default behavior when the backspace key is pressed, which is to go back to the previous page. the evt.preventdefault() method lets you do this. using eventlisteners with objects the methods
addeventlistener() and removeeventlistener() are very useful when writing interactive svg. you can pass an object that implements the handleevent interface as the second parameter to these methods. function myrect(x,y,w,h,message){ this.message=message this.rect=document.createelementns("http://www.w3.org/2000/svg","rect") this.rect.setattributens(null,"x",x) this.rect.setattributens(null,"y",y...
...ace as the second parameter to these methods. function myrect(x,y,w,h,message){ this.message=message this.rect=document.createelementns("http://www.w3.org/2000/svg","rect") this.rect.setattributens(null,"x",x) this.rect.setattributens(null,"y",y) this.rect.setattributens(null,"width",w) this.rect.setattributens(null,"height",h) document.documentelement.appendchild(this.rect) this.rect.
addeventlistener("click",this,false) this.handleevent= function(evt){ switch (evt.type){ case "click": alert(this.message) break; } } } inter-document scripting: referencing embedded svg when using svg within html, adobe's svg viewer 3.0 automatically includes a window property called svgdocument that points to the svg document. this is not the case for mozilla's nativ...
...get a reference to an embedded svg document instead. the best way to get access to the document representing an svg document is to look at htmliframeelement.contentdocument (if the document is presented in an <iframe>) or htmlobjectelement.contentdocument (if the document is presented in an <object> element), like this: var svgdoc = document.getelementbyid("iframe_element").contentdocument; in
addition, the <iframe>, <embed>, and <object> elements offer a method, getsvgdocument(), which returns the xmldocument representing the element's embedded svg or null if the element doesn't represent an svg document. you can also use document.getelementbyid("svg_elem_name").getsvgdocument(), which gives the same result. you may find documentation referring to an svgdocument interface. prior to svg...
Fills and Strokes - SVG: Scalable Vector Graphics
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. <rect x="10" y="10" width="100" height="100" stroke="blue" fill="purple" fill-opacity="0.5" stroke-opacity="0.8"/> in
addition, you can specify the opacity of either the fill or stroke separately in svg. these are controlled by the fill-opacity and stroke-opacity attributes. note: in firefox 3+, rgba values are also allowed, and will give the same effect. but for compatibility with other viewers, it's often best to specify the fill/stroke opacity separately. if you specify both an rgba value and a fill/stroke opaci...
... the fill or stroke separately in svg. these are controlled by the fill-opacity and stroke-opacity attributes. note: in firefox 3+, rgba values are also allowed, and will give the same effect. but for compatibility with other viewers, it's often best to specify the fill/stroke opacity separately. if you specify both an rgba value and a fill/stroke opacity value, both will be applied. stroke in
addition to its color properties, there are a few other attributes available to control the way a stroke is drawn on a line. <?xml version="1.0" standalone="no"?> <svg width="160" height="140" xmlns="http://www.w3.org/2000/svg" version="1.1"> <line x1="40" x2="120" y1="20" y2="20" stroke="black" stroke-width="20" stroke-linecap="butt"/> <line x1="40" x2="120" y1="60" y2="60" stroke="black" str...
... 5 blank units until the next dash of 5 units. you can specify more numbers if you would like a more complicated dash pattern. the first example specifies three numbers, in which case the renderer loops the numbers twice to create an even pattern. so the first path renders 5 filled, 10 empty, 5 filled, and then loops back to create 5 empty, 10 filled, 5 empty. the pattern then repeats. there are
additional stroke and fill properties available, including fill-rule, which specifies how to color in shapes that overlap themselves; stroke-miterlimit, which determines if a stroke should draw miters; and stroke-dashoffset, which specifies where to start a dasharray on a line. using css in
addition to setting attributes on objects, you can also use css to style fills and strokes. not all attribute...
...attributes like width, height, or <path> commands cannot be set through css. it's easiest just to test and find out what is available and what isn't. ...
Reddit Example - Archive of obsolete content
this example uses the action button api, which is only available from firefox 29 onwards. this example
add-on creates a panel containing the mobile version of reddit. when the user clicks on the title of a story in the panel, the
add-on opens the linked story in a new tab in the main browser window. to accomplish this the
add-on needs to run a content script in the context of the reddit page which intercepts mouse clicks on each title link and fetches the link's target url. the content script then needs to send the url to the
add-on script. ...
...n the user clicks on the title of a story in the panel, the
add-on opens the linked story in a new tab in the main browser window. to accomplish this the
add-on needs to run a content script in the context of the reddit page which intercepts mouse clicks on each title link and fetches the link's target url. the content script then needs to send the url to the
add-on script. ...
...r 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/previous footer, since those links should load in the panel itself. if ($(t).parents('#header').length || $(t).parents('.nextprev').length) return; // intercept the click, passing it to the
addon, which will load it in a tab. event.stoppropagation(); event.preventdefault(); 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 named "icon-16.png" saved in your
add-on's "data" directory. you could down...
SDK API Lifecycle - Archive of obsolete content
eplacement. the stability index for each module is written into that module’s metadata structure, and is displayed at the top of each module's documentation page. deprecation process deprecation in the chosen release, the sdk team will communicate the module's deprecation: update the module's stability index to be "deprecated" include a deprecation notice in the release notes, the
add-ons blog, and the jetpack google group. the deprecation notice should point developers at a migration guide. migration the deprecation period defaults to 18 weeks (that is, three releases) although in some cases, generally those out of our control, it might be shorter than this. during this time, the module will be in the deprecated state. the sdk team will track usage of deprecated modules o...
...ns blog, and the jetpack google group. the deprecation notice should point developers at a migration guide. migration the deprecation period defaults to 18 weeks (that is, three releases) although in some cases, generally those out of our control, it might be shorter than this. during this time, the module will be in the deprecated state. the sdk team will track usage of 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 sh...
... if it's not ok to remove it, the team will continue to support migration and aim to remove the module in the next release. ...
Guides - Archive of obsolete content
simplify this. private properties learn how private properties can be implemented in javascript using prefixes, closures, and weakmaps, and how the sdk supports private properties by using namespaces (which are a generalization of weakmaps). content processes the sdk was designed to work in an environment where the code to manipulate web content runs in a different process from the main
add-on code. this article highlights the main features of that design. testing the
add-on sdk learn how to run the
add-on sdk test suites. sdk infrastructure module structure of the sdk the sdk, and
add-ons built using it, are of composed from reusable javascript modules. this explains what these modules are, how to load modules, and how the sdk's module tree is structured. sdk api life...
...this guide explains how it's created, what it's used for and how to define your own. firefox compatibility working out which firefox releases a given sdk release is compatible with, and dealing with compatibility problems. sdk idioms working with events write event-driven code using the the sdk's event emitting framework. ...
...ling with compatibility problems. sdk idioms working with events write event-driven code using the the sdk's event emitting framework. content scripts guide an overview of content scripts, including: what they are, what they can do, how to load them, how to communicate with them. two types of scripts this article explains the differences between the apis available to your main
add-on code and those available to content scripts. xul migration xul migration guide techniques to help port a xul
add-on to the sdk. xul versus the sdk a comparison of the strengths and weaknesses of the sdk, compared to traditional xul-based
add-ons. porting example a walkthrough of porting a relatively simple xul-based
add-on to the sdk. ...
core/heritage - Archive of obsolete content
tance in javascript is both verbose and painful. reading or writing such code requires sharp eye and lot's of discipline, mainly due to code fragmentation and lots of machinery being exposed: // defining a simple class function dog(name) { // classes are for creating instances, calling them without `new` changes // behavior, which in majority cases you need to handle, so you end up // with
additional boilerplate. if (!(this instanceof dog)) return new dog(name); this.name = name; }; // to define methods you need to make a dance with a special 'prototype' // property of the constructor function. this is too much machinery exposed. dog.prototype.type = 'dog'; dog.prototype.bark = function bark() { return 'ruff! ruff!' }; // subclassing a `dog` function pet(name, breed) { // onc...
...ing with untrusted code an extra security measures are required to guarantee that documented behavior can't be changed at runtime. to do that we need to freeze constructor's prototype chain to make sure functions are frozen: object.freeze(dog.prototype); object.freeze(pet.prototype); note: also, this is not quite enough as object.prototype stays mutable & in fact we do little bit more in sdk to
address that, but it's not in the scope of this documentation. doing all of this manually is both tedious and error prone task. that is why sdk provides utility functions to make it more declarative and less verbose. class module exports class utility function for making constructor functions with a proper prototype chain setup in declarative manner: var { class } = require('sdk/core/heritage'); ...
... bark: function bark() { return 'ruff! ruff!' } }); note: we use term class to refer an exemplar constructs in a form of constructor functions with a proper prototype chain setup. constructors created using class function don't require new keyword (even though it can be used) for instantiation. also, idiomatic sdk code does not uses optional new keywords, but you're free to use it in your
add-on code: var fluffy = dog('fluffy'); // instatiation fluffy instanceof dog // => true fluffy instanceof class // => true as you could notice from example above classes created via class function by default inherits from a class itself. also you could specify which class you want to inherit from by passing special extends property: var pet = class({ extends: dog, ...
preferences/event-target - Archive of obsolete content
globals constructor prefstarget(options) parameters options : object required options: name type branchname string by default this is "", the root. ...
... globals constructor prefstarget(options) parameters options : object required options: name type branchname string by default this is "", the root. ...
... globals constructor prefstarget(options) parameters options : object required options: name type branchname string by default this is "", the root. ...
preferences/service - Archive of obsolete content
globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,number,boolean preference value. ...
... globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,number,boolean preference value. ...
... globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,number,boolean preference value. ...
remote/parent - Archive of obsolete content
in the sdk, content scripts run in the child process, and, of course, can access web content. but content scripts don't have many more capabilities than untrusted web content. ...
...in the sdk, content scripts run in the child process, and, of course, can access web content. but content scripts don't have many more capabilities than untrusted web content. ...
...{ frame.content.location += "#" + ref; }); // main.js const { frames, remoterequire } = require("sdk/remote/parent"); remoterequire("./remote.js", module); frames.port.emit("changelocation", "foo"); tab information this shows sending a message when a tab loads; this is similar to how the sdk/tabs module currently works. ...
util/match-pattern - Archive of obsolete content
matches any url with an http, https, or ftp scheme. for other schemes like file, resource, or data, use a scheme followed by an asterisk, as below. example pattern example matching urls example non-matching urls "*" http://example.com/ https://example.com/ ftp://example.com/ http://bar.com/foo.js http://foo.com/ file://example.js resource://me/my-
addon/data/file.html data:text/html,hi there a domain name prefixed with an asterisk and dot matches any url of that domain or a subdomain, using any of http, https, ftp. example pattern example matching urls example non-matching urls "*.example.com" http://example.com/ http://foo.example.com/ https://example.com/ http://example.com/foo ftp://foo...
... any url prefixed with the pattern. example pattern example matching urls example non-matching urls "https://foo.com/*" https://foo.com/ https://foo.com/bar http://foo.com/ https://foo.com https://bar.foo.com/ a scheme followed by an asterisk matches all urls with that scheme. ...
...com/ https://foo.com https://bar.foo.com/ a scheme followed by an asterisk matches all urls with that scheme. to match local files, use file://*, and to match files loaded from your
add-on's data directory, use resource://. example pattern example matching urls "file://*" file://c:/file.html file:///home/file.png "resource://*" resource://my-
addon-at-me-dot-org/my-
addon/data/file.html "data:*" data:text/html,hi there regular expressions you can specify patterns using a regular expression: var { matchpattern } = require("sdk/util/match-pattern"); var pattern = new matchpattern(/.*example.*/); the regular expression is subject to restrictions based on those applied to the html5 pattern attribute. in particular: ...
Overview - Archive of obsolete content
user interface the annotator's main user interface consists of a widget and three panels. the widget is used to switch the annotator on and off, and to display a list of all the stored annotations. the annotation-editor panel enables the user to enter a new annotation. the annotation-list panel shows a list of all stored annotations. the annotation panel displays a single annotation. ...
...et and three panels. the widget is used to switch the annotator on and off, and to display a list of all the stored annotations. the annotation-editor panel enables the user to enter a new annotation. the annotation-list panel shows a list of all stored annotations. the annotation panel displays a single annotation.
additionally, we use the notifications module to notify the user when the
add-on's storage quota is full. working with the dom we'll use two page-mods to interact with the doms of pages that the user has opened. the selector enables the user to choose an element to annotate. it identifies page elements which are eligible for annotation, highlights them on mouseover, and tells the main
add-on code when the user clicks a highlighted element. the matcher is resp...
...mouseover, and tells the main
add-on code when the user clicks a highlighted element. the matcher is responsible for finding annotated elements: it is initialized with the list of annotations and searches 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 prevent 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 ad...
List Open Tabs - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to list the open tabs, you can iterate over the tabs object itself. the following
add-on
adds an action button that logs the urls of open tabs when the user clicks it: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); } note: to get this working, you will need to save an icon for the button to your
add-on's "data" directory as "icon-16.png". you can download the icon here: . run the
add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: htt...
...-16.png". you can download the icon here: . run the
add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ you don't get direct access to any content hosted in the tab. to access tab content, you need to attach a script to the tab using tab.attach(). this
add-on attaches a script to all open tabs. ...
...
add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ you don't get direct access to any content hosted in the tab. to access tab content, you need to attach a script to the tab using tab.attach(). this
add-on attaches a script to all open tabs. ...
Boxes - Archive of obsolete content
wrapping contents in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout. this does not happen with xul box (or hbox and vbox) by default. however, you can easily
add this capability with a style change. make the box style="display: block" and the wrapping behavior will occur when the box is resized: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <hbox style="display: block"> <label value="aaa"/> <label value="bbb"/> <label value="ccc"/> <label value="ddd"/> <label value="eee"/> <label value="fff"/> <label value="ggg"/> <label value="hhh"/> <label value="iii"/> <label value="jj...
...bel value="mmm"/> <label value="nnn"/> <label value="ooo"/> <label value="ppp"/> <label value="qqq"/> <label value="rrr"/> <label value="sss"/> <label value="ttt"/> <label value="uuu"/> <label value="vvv"/> <label value="www"/> <label value="xxx"/> <label value="yyy"/> <label value="zzz"/> </hbox> </window> images if you put image in the contents, you should probably
add align="start" attribute to the box. this keeps the image from stretching inside the box: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box align="start" style="display:block"> <image src="chrome://global/skin/icons/error.png" style="p
adding:5px"/> <textbox /> <image src=...
... the image from stretching inside the box: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box align="start" style="display:block"> <image src="chrome://global/skin/icons/error.png" style="p
adding:5px"/> <textbox /> <image src="chrome://global/skin/icons/error.png" style="p
adding:5px"/> <button label="hello"/> <image src="chrome://global/skin/icons/error.png" style="p
adding:5px"/> </box> </window> ...
HTML to DOM - Archive of obsolete content
d(frame); // or // document.documentelement.appendchild(frame); // set restrictions as needed frame.webnavigation.allowauth = false; frame.webnavigation.allowimages = false; frame.webnavigation.allowjavascript = false; frame.webnavigation.allowmetaredirects = true; frame.webnavigation.allowplugins = false; frame.webnavigation.allowsubframes = false; // listen for load frame.
addeventlistener("load", function (event) { // the document of the html in the dom var doc = event.originaltarget; // skip blank page or frame if (doc.location.href == "about:blank" || doc.defaultview.frameelement) return; // do something with the dom of doc alert(doc.location.href); // when done remove frame or set location "about:blank" settimeout(function (){ ...
...er element. using a hidden xul iframe (alternate example) sometimes, a browser element is overkill, or does not meet your needs, or you can't fulfill its requirements. while working on donkeyfire, i discovered the iframe xul element, and it is very easy to implement it. as an example, i will show a browser overlay .xul file, and some javascript code to access it. here is some xul code you can
add to your browser overlay .xul file. don't forget to modify the id and name! <vbox hidden="false" height="0"> <iframe type="content" src="" name="donkey-browser" hidden="false" id="donkey-browser" height="0"/> </vbox> then, in your extension's "load" event handler: onload: function() { donkeybrowser = document.getelementbyid("donkey-browser"); if (donkeybrowser) { donkeybrowser.style.heig...
...the most interesting piece of code here is the domcontentloaded event listener we define for the element. let's take a look at the donkeyfire.donkeybrowser_onpageload() handler: donkeybrowser_onpageload: ...
JavaScript Debugger Service - Archive of obsolete content
acquiring the service we acquire the service by calling the xpcom object. var jsd = components.classes["@mozilla.org/js/jsd/debugger-service;1"] .getservice(components.interfaces.jsdidebuggerservice); jsd.on(); // enables the service till firefox 3.6, for 4.x use asyncon if (jsd.ison) jsd.off(); // disables the service hooks jsd operates using the events hook mechanism. next, we
add code to the various hooks. jsd.scripthook = { onscriptcreated: function(script) { // your function here }, onscriptdestroyed: function(script) { // your function here } }; jsd.errorhook = { onerror: function(message, filename, lineno, colno, flags, errnum, exc) { // your function here } }; // triggered when jsd.errorhook[onerror] returns false jsd.debughook = { onexecute: functio...
...k is called. we create a generic createfilter function that acts as a jsdifilter factory. function createfilter(pattern, pass) { var jsdifilter = components.interfaces.jsdifilter; var filter = { globalobject: null, flags: pass ? (jsdifilter.flag_enabled | jsdifilter.flag_pass) : jsdifilter.flag_enabled, urlpattern: pattern, startline: 0, endline: 0 }; return filter; }, we then
add the filters we want. jsd.clearfilters(); // clear the list of filters // we exclude the scripts with the following filenames from being tracked jsd.appendfilter(createfilter("*/firefox/components/*")); jsd.appendfilter(createfilter("*/firefox/modules/*")); jsd.appendfilter(createfilter("xstringbundle")); jsd.appendfilter(createfilter("chrome://*")); jsd.appendfilter(createfilter("x-jsd:ppbuffer...
...you can use insertfilter (jsdifilter filter, jsdifilter after) to insert the filter after a particular filter; you can pass null for jsdifilter after to insert at the head of the list. you can also use swapfilters (jsdifilter filter_a, jsdifilter filter_b) to swap filters, and removefilter(jsdifilter filter) to remove a filter. learning more a quick and dir...
Label and description - Archive of obsolete content
space: pre; all whitespace, including newlines, is rendered literally. text cannot wrap automatically but can still be achieved with <html:br/> if desired. <description style="white-space: pre-wrap;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> with white-space: pre-wrap; all whitespace is rendered literally, but text is
additionally permitted to wrap at spaces. note: prior to firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap. you may wish to use both for backward compatibility. <description style="white-space: pre;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> text can also be made to wrap by inserting an <html:br/> ...
... ...
... act like an html <a> tag: <label class="text-link" href="http://whatever.com" value="click here to go to whatever"/> "text-link" is a built-in, predefined class. note: if running in a xulrunner application
add the following preferences to your default preferences file: pref("network.protocol-handler.expose.http", false); pref("network.protocol-handler.warn-external.http", false); change or
add additional protocols (https or ftp) as needed. ...
LookupNamespaceURI - Archive of obsolete content
o reflect on static documents. however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
.... however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
...oes not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
Toolbar - Archive of obsolete content
adding a toolbar button there are two tutorials available: an elaborate step by step tutorial for beginners: custom toolbar button a tutorial describing the steps needed to
add a toolbar button assuming you already have a working extension and know the basics of extension development: creating toolbar buttons
adding button by default when you create and deploy your extension and include a toolbar button for it by overlaying the customize toolbarpalette, it is not available by default. the user has to drag it onto the toolbar. the following code will place your button on the toolbar by default. this should only be done on the first run of your
add-on after installation so that if the user decides to remove your button, it doesn't show up again every time they start the application. n...
...ult. the user has to drag it onto the toolbar. the following code will place your button on the toolbar by default. this should only be done on the first run of your
add-on after installation so that if the user decides to remove your button, it doesn't show up again every time they start the application. notes insert your button by default only once, at first run, or when an extension update
adds a new button. please only
add your button by default if it
adds real value to the user and will be a frequent entry point to your extension. you must not insert your toolbar button between any of the following elements: the combined back/forward button, the location bar, the stop botton, or the reload button. these elements have special behaviors when placed next to eachother, and will break i...
... var before = null; if (afterid) { let elem = document.getelementbyid(afterid); if (elem && elem.parentnode == toolbar) before = elem.nextelementsibling; } toolbar.insertitem(id, before); toolbar.setattribute("currentset", toolbar.currentset); document.persist(toolbar.id, "currentset"); if (toolbarid == "
addon-bar") toolbar.collapsed = false; } } if (firstrun) { installbutton("nav-bar", "my-extension-navbar-button"); // the "
addon-bar" is available since firefox 4 installbutton("
addon-bar", "my-extension-
addon-bar-button"); } ...
Windows - Archive of obsolete content
d only setting the startpos if the element matches some criteria. example var startpos = null; function mousedown(event) { startpos = [event.clientx, event.clienty]; } function mousemove(event) { if (startpos) { var newx = event.screenx - startpos[0]; var newy = event.screeny - startpos[1]; window.moveto(newx, newy); } } function mouseup(event) { startpos = null; } window.
addeventlistener("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.open...
...ar 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 prevent 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/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher) .getwindowenumerator(); var i...
... var hr = document.createelementns("http://www.w3.org/1999/xhtml", "html:hr"); document.getelementbyid("id1").appendchild(hr); ...
Communication between HTML and your extension - Archive of obsolete content
em all in many different ways. some of the events only apply to certain types of elements so i included trying to modify the result of the ajax request to be of the appropriate element type (img, which supports "onload," rather than span, which doesn't, for example). the problem with the events is the timing. i wasn't sure about the difference between the capture or bubbling flag that you pass to
addeventlistener but every time i would catch the event in the extension, the element from the ajax request wasn't fully updated into the html page. what that meant is that everytime the extension went looking for the element, it wasn't there yet. as a last ditch effort i tried setting a timeout using settimeout when i got the event in the extension to wait a few milliseconds before looking for the d...
...atechanged function that was handling the receipt of the ajax request. ...
...ument.body.dispatchevent(event); in the code of the extension that catches the loading of a new page i
added this code: var doc = aevent.originaltarget; // doc is document that triggered "onload" event // do something with the loaded page. // doc.location is a location object (see below for a link). // you can use it to make your code executed on certain pages only. if (doc && doc.
addeventlistener) doc.
addeventlistener("my-custom-event", myextension.customreceived, false); since the event is dispatched after the element in the html is updated by the statuschanged function, the element that extension is looking for is there to find. ...
Extension Packaging - Archive of obsolete content
manager window. the xpi file must contain only uncompressed files, or files compressed using the deflate algorithm. the mime type recognized by firefox for xpi files is application/x-xpinstall. since most http servers are not configured to return this mime type for the .xpi extension by default, you will probably need to configure your http server. in the apache http server, this can be done by
adding the following directive to the configuration file or .htaccess:
addtype application/x-xpinstall .xpi install extension files directly if you know the location of the application (if you are installing an extension as part of the application installer, for example), you can install the extension files directly to <appdir>/extensions/<extensionid>. the extension will be found automatically b...
...tensionid>. the extension will be found automatically by the extension manager the next time the application is launched. when using this method you must verify that the file system permissions for the directories, and files for the extension, are set properly. otherwise, the extension manager may not function properly with the extension, or the extension itself may not work properly. ...
...ager the next time the application is launched. when using this method you must verify that the file system permissions for the directories, and files for the extension, are set properly. otherwise, the extension manager may not function properly with the extension, or the extension itself may not work properly. including
add-ons in a customized application a customized application can include
add-ons, including extensions and themes, by placing the unpacked (that is, not the xpi files, but the packages' contents) in the <appdir>/distribution/extensions directory. this directory containing the
add-on must be named the same as the id of the
add-on or theme.
add-ons packaged in this way will not be visible to the user. register an extension location using the windows registry external inst...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
change required by frozen linkage is using the frozen string api. - #include "nsastring.h"- #include "nsstring.h"- #include "nsreadableutils.h"- #include "nsescape.h" + #include "nsstringapi.h" on windows, if you see the following error, you are including a header you shouldn't be: nsstringfwd.h(60) : fatal error c1001: internal compiler error to debug this error, make in the failing directory,
adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showincludes the frozen string api is similar but not identical to the nonfrozen string api. the frozen string api does not have (or need) nsxpidlstring: - nsxpidlstring value; + nsstring value; ptr->gettermethod(getter_copies(value)); - const prunichar *strvalue = value;...
... errors about undeclared ns_getspecialdirectory: #include "nsdirectoryserviceutils.h" utility classes some utility classes could previously 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. ...
...ed 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_newbyteinputstream(getter_
addrefs(rawstream),- (const char*)data, length); + nscomptr<nsistringinputstream> rawstream =+ do_createinstance(ns_stringinputstream_contractid, &rv);+ ns_ensure_success(rv, rv);++ rv = rawstream->setdata((const char*)data, length); ns_ensure_success(rv, rv); nsistringinputstream is not frozen (and thus, not available in the gecko sdk as currently published). in orde...
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. ...
...files don't have privileges, it's impossible to actually try out the sample code in this chapter. in order to set universalxpconnect privileges, you need to run the code in listing 2. listing 2: setting privileges netscape.security.privilegemanager.enableprivilege('universalxpconnect'); note: this is unneeded when the code is part of an extension, and will result in rejection if submitted to
addons.mozilla.org. permit by dialog try
adding the contents of listing 2 to test.xul, before the line var ioservice = …, and re-open it in firefox. you should now see the confirmation dialog shown in figure 1. pressing the "permit" button grants universalxpconnect permission in this execution context, making it possible to run xpconnect temporarily. an xpconnect-wrapped nsiioservice message shou...
...iioservice message should appear. if you check “apply these privileges in the future”, all local files will be able to run xpconnect without confirmation in the future. this is extremely dangerous, and you should never check this option. editing prefs.js opening test.xul will produce the dialog shown in figure 1. this can get annoying. to run the file's scripts without manual confirmation,
add the contents of listing 3 to the prefs.js file in the user profile folder. opening test.xul will show the local file url in the location bar. copy and paste this into the appropriate spot in listing 3. note: the location of the user profile will vary depending on your system. on windows vista, it will be located at c:\users\username\appdata\roaming\mozilla\firefox\profiles\random number.default\...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
with floats, either the left column or the right column always had to be drawn first. for sites that rely on a left or right column for primary navigation, this content order requirement of float usage may produce desired and advantageous behavior. i also found a lot of trouble ensuring a consistent vertical start position of columns using floats. two column layouts using floats seemed easy. but
adding a third column to the mix created too many width variables for some browsers to dynamically calculate a total. resizing the browser window often resulted in one column getting pushed to the bottom of another. using absolute positioning for left and right columns allowed the markup for each column to fall in any order. there are some technicalities in the order of our markup and some ad units ...
... a picture of our user base. from looking at our data, we predict there could be as much as 14% of our users who will get the un-styled version of our content. that's a significant percentage when we're used to our pages looking the same in every browser. ...
... wired news is also dramatically more accessible, without much concentrated effort at making it so. sure, we now pay more attention to our image alt attributes, and try to use heading tags appropriately. ...
Creating reusable content with CSS and XBL - Archive of obsolete content
you apply this technique in a simple demonstration. ...
...if (event.originaltarget == this.button) this.dodemo() ]]></handler> </handlers> </binding> </bindings> make a new css file, bind6.css. this separate stylesheet contains style for the binding. copy and paste the content from here: /*** xbl demonstration ***/ [anonid="square"] { width: 20em; height: 20em; border: 2px inset gray; } [anonid="button"] { margin-top: 1em; p
adding: .5em 2em; } open the document in your browser and press the button. this wiki does not support javascript in pages, so it is not possible to show the demonstration here. it looks something like this, before and after you press the button: notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascript code...
...cript in pages, so it is not possible to show the demonstration here. it looks something like this, before and after you press the button: notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascript code. the document does not contain any buttons. it only contains the text of the button's label. the button is
added by the binding. the document stylesheet links the binding. the binding links its own stylesheet, and it supplies its own content and javascript code. so the binding is self-contained. challenges change the xbl file so that the square doubles in width when it changes color, instead of jumping to the right. use the dom inspector tool to inspect the document, revealing the ad...
Creating a dynamic status bar extension - Archive of obsolete content
on. see install manifests for details. update the chrome manifest the chrome manifest needs only a minor update from the previous 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. ...
...ite the javascript code the work of fetching the stock quote and updating the status bar panel's display is handled by the javascript code in the file stockwatcher.js. unlike our previous sample, this one is implemented as an object. we do this because in future samples in this series, we're going to be doing things that are easier to do if our extension is implemented that way. we use the window.
addeventlistener() dom function to tell firefox to call the stockwatcher.startup() function when a new browser window is opened: window.
addeventlistener("load", function(e) { stockwatcher.startup(); }, false); our new extension has two primary functions: startup() and refreshinformation(). the refreshinformation() function contains another function, called inforeceived(). the following sections will...
...al routine on the browser window by calling window.setinterval(). this configures our refreshinformation() routine to be called every 10 minutes (the time interval is specified in milliseconds). refreshinformation() the refreshinformation() function is called whenever we want to update the stock information. it's called whenever the user clicks on the status bar panel, when our extension is first
added to a browser window, and by the interval handler to periodically update the display. refreshinformation: function() { var httprequest = null; var fullurl = 'http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=goog'; // ... httprequest = new xmlhttprequest(); httprequest.open('get', fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } the httpre...
Notes on HTML Reflow - Archive of obsolete content
the frame hierarchy. each container frame constructs a new reflow state object (based on its container's reflow state object) in which the container will reflow its children. most of the constraints in the new reflow state are computed when the state is created; for example, the available space in the new reflow state is computed by subtracting the container frame's border and p
adding from the parent reflow state's available space. reflow reason all reflows have a reason , which is maintained in the reflow state object (and may mutate, as described below). the reflow reason controls how a frame reacts during a reflow, and is one of the following: initial, for the very first time that the frame hierarchy is flowed. in this case, a frame knows that there is no res...
...hierarchy. incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asynchronously serviced. a resize reflow is performed when the presentation shell's dimensions change; e.g., because the user resized the shell's window. a style change reflow is performed when the presentation shell's global stylistic information is changed; e.g.,
addition or removal of a style sheet, a change to the shell's default font. a dirty reflow is never performed directly from the presentation shell. instead, a dirty reflow is detected when an incremental reflow reaches its target frame , described below. reflow metrics the reflow metrics object, nshtmlreflowmetrics, is used to propagate information from child frames back to the par...
...shell does not process the command immediately. instead, it queues the command, and processes it asynchronously along with other queued reflow commands en masse . coalescing. as described below, the reflow command has a type and a target frame . multiple reflow commands with the same type and target frame are coalesced : the presentation shell simply refuses to
add subsequent commands of the same type for the same frame to the queue. a caller may also cancel a reflow command that is in the queue; e.g., if the target frame is destroyed. dispatch. the presentation shell processes the reflow queue by removing a single reflow command from the queue and dispatching it to its target frame. (but cf. the reflow tree work, which will remove several...
Automated testing tips and tricks - Archive of obsolete content
uit.js and quit.xul install manifest file in appdir/chrome to map chrome://tests/content to directory containing quit.js and quit.xul example: content tests file:///users/davel/work/tests/ start app with command line flag -chrome chrome://tests/content/quit.xul how to create a new profile from the command line first, use the -createprofile command line flag to
add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file firefox-bin -createprofile "testprofile ${profile_dir}/testprofile" next, start firefox to populate the new profile directory with the rest of the default settings firefox-bin -p testprofile -chrome chrome://tests/content/quit.xul<code> the above process may exit befor...
...tory with the rest of the default settings firefox-bin -p testprofile -chrome chrome://tests/content/quit.xul<code> the above process may exit before the profile is completely created. ...
...ith chrome privileges using a chrome doc - see sbtests.xul in http://people.mozilla.com/~davel/scripts/ for an example firefox-bin -p sbtestprofile -chrome chrome://sbtests/content/ above code calls the quit function in quit.js to exit after test is finished how to detect content onload event from chrome use the domcontentloaded event chromewindow.
addeventlistener('domcontentloaded',callbackfunction,false); ...
Download Manager preferences - Archive of obsolete content
several preferences used by the download manager. this article provides a list of them. preference description browser.download.antivirus.dontclean note: in gecko 1.9.1. a boolean value that indicates whether the anti virus software should try to clean a downloaded file when a virus is detected. default value is false. browser.download.manager.
addtorecentdocs a boolean value that indicates whether or not new downloads should be
added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. default value i...
...ot to show the downloads window when a download begins. the default value is true. browser.download.manager.usewindow note: in gecko 1.9.1 in bug 439495 a boolean value indicating whether or not to use the downloads window (true) or display download status in the status bar (false) in the browser window. default value is true. browser.download.usedownlo
addir a boolean value that indicates whether or not the user's preference is to automatically save files into the download directory. if this value is false, the user is asked what to do. in thunderbird and seamonkey the default is false. in other applications the default is true. browser.helperapps.deletetempfileonexit a boolean value that indicates whether or not to delete th...
...r.helperapps.deletetempfileonexit a boolean value that indicates whether or not to delete the temporary file used by the download manager after the download is complete. on mac the default value is false. on other oses the default value is true if a preference is not set when the download manager looks it up, the download manager assumes the default value but doesn't necessarily
add the missing preference. the following table however, includes preferences which must be included in any product for the download manager to function. preference description browser.download.dir a local folder the user may have selected for downloaded files to be saved. migration of other browser settings may also set this path. this folder is enabled when browser.download...
Enabling - Archive of obsolete content
methods import(stringmountpath string)imports the requested experimental feature into the script. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. ...
...methods import(stringmountpath string)imports the requested experimental feature into the script. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. ...
...here, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the clipboard) from the future. jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without
additionally changing the script (barring any other changes made during integration). list()returns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an example of how to get this array. a quick way of displaying the list is to write it to the console.log. var list = jetpack.future.list(); console.log(list); open the firebug console to view. ...
Simple Storage - Archive of obsolete content
ls menu. you can install this example from the jetpack gallery. jetpack.future.import("menu");jetpack.future.import("selection");jetpack.future.import("storage.simple");// create the persistent notes array if it doesn't already exist.jetpack.storage.simple.notes = jetpack.storage.simple.notes || [];var notes = jetpack.storage.simple.notes;// updates the jetpack menu with the current notes. we'll
add a notes menu with// a submenu, which lists all the notes. if there are no notes, we'll show a// disabled "(empty)" menuitem.function updatejetpackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) });}// modify the page's context menu by sneaking in befor...
...ts all the notes. if there are no notes, we'll show a// disabled "(empty)" menuitem.function updatejetpackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) });}// modify the page's context menu by sneaking in before it's shown. ...
..."(empty)", disabled: true }]) });}// modify the page's context menu by sneaking in before it's shown. if there's// a selection,
add a note menuitem that makes a new note. otherwise, don't// modify the menu at all. we'll limit the number of notes to 20. old notes// will be forgotten. ...
Enabling Experimental Jetpack Features - Archive of obsolete content
methods import(stringmountpath string)imports the requested experimental feature into the script. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. ...
...methods import(stringmountpath string)imports the requested experimental feature into the script. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. ...
...here, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the clipboard) from the future. jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without
additionally changing the script (barring any other changes made during integration). list() arrayreturns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an example of how to get this array. a quick way of displaying the list is to write it to the console.log. var list = jetpack.future.list(); console.log(list); open the firebug console to view. ...
Simple Storage - Archive of obsolete content
you can install this example from the jetpack gallery. jetpack.future.import("menu"); jetpack.future.import("selection"); jetpack.future.import("storage.simple"); // create the persistent notes array if it doesn't already exist. jetpack.storage.simple.notes = jetpack.storage.simple.notes || []; var notes = jetpack.storage.simple.notes; // updates the jetpack menu with the current notes. we'll
add a notes menu with // a submenu, which lists all the notes. if there are no notes, we'll show a // disabled "(empty)" menuitem. function updatejetpackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) }); } // modify the page's context menu by sneak...
...otes. if there are no notes, we'll show a // disabled "(empty)" menuitem. function updatejetpackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) }); } // modify the page's context menu by sneaking in before it's shown. ...
...disabled: true }]) }); } // modify the page's context menu by sneaking in before it's shown. if there's // a selection,
add a note menuitem that makes a new note. otherwise, don't // modify the menu at all. we'll limit the number of notes to 20. old notes // will be forgotten. :( jetpack.menu.context.page.beforeshow = function (menu) { menu.reset(); if (jetpack.selection.text) menu.
add({ label: "note", command: function () { notes.unshift(jetpack.selection.text); if (notes.length > 20) notes.pop(); updatejetpackmenu(); } }); }; // initialize the jetpack menu with the current notes. updatejetpackmenu(); see also settings jep 11 ...
Jetpack - Archive of obsolete content
jetpack jetpack is a project to make it easy to build firefox
add-ons using common web technologies. ...
... jetpack jetpack is a project to make it easy to build firefox
add-ons using common web technologies. ...
... jetpack jetpack is a project to make it easy to build firefox
add-ons using common web technologies. ...
Metro browser chrome tests - Archive of obsolete content
o run a specific test the command would be: ./mach mochitest-metro browser/metro/base/tests/mochitest/(testfile) writing browser chrome tests metro browser chrome tests make use of a common framework for defining and running tests. a simple test looks like this: gtests.push({ desc: "test loading about:blank", setup: function () { }, teardown: function () { }, run: function () { yield
addtab("about:blank"); is(tab.browser.currenturi.spec, "about:blank", "about:blank is loaded"); } }); function test() { runtests(); } gtests contains individual tests that make up the library of tests your test file will contain. each test can have start up and tear down logic, plus the body of the test contained in run(). the test file can contain other functions which will be ignored unle...
...nless invoked by test(). gtests make use of promises and tasks for managing execution. test comparison functions used in metro browser chrome tests are identical to those supported by mochitests, see how the comparison functions work in the mochitest documentation for more details. helper functions the eventutils helper functions are available on the eventutils object defined in the global scope.
additional metro specific test helpers can be found in /browser/metro/base/tests/mochitest/head.js. you may
add additional common utils and helpers to head.js. be careful about changing existing helpers as changes may impact tests in other 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 d...
...ting 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 prevent 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 metro browser chrome test
add the test file to the browser_tests variable in /browser/metro/base/tests/mochitest/makefile.in. your t...
Microsummary topics - Archive of obsolete content
r); var generatordoc = domparser.parsefromstring(generatortext, "text/xml"); var microsummaryservice = components.classes["@mozilla.org/microsummary/service;1"]. getservice(components.interfaces.nsimicrosummaryservice); var generator = microsummaryservice.installgenerator(generatordoc); the service installs the generator by serializing its xml to a file in the user's profile directory and
adding the generator to the service's in-memory generator cache. when programmatically installing generators, you should specify a unique identifier for the generator in the uri attribute of the <generator> element. the value of the attribute must be a valid uri, but you can specify an arbitrary identifier using a urn, for example: urn:{835daeb3-6760-47fa-8f4f-8e4fdea1fb16} to guarantee uniqueness, ...
...alid uri, but you can specify an arbitrary identifier using a urn, for example: urn:{835daeb3-6760-47fa-8f4f-8e4fdea1fb16} to guarantee uniqueness, use urns containing uuids generated by the nsuuidgenerator component. see generating a uuid in the nsiuuidgenerator documentation. you may also use another form appropriate to your extension. note: when web sites install generators via window.sidebar.
addmicrosummarygenerator(), firefox sets their uri attribute to urn:source:sourceurl, where sourceurl is the url from which the generator was downloaded. in the future, firefox may access source urls to download updated versions of generators, so unless you are installing generators which are available from urls, you should not use this form for your programmatically-installed generators. differentia...
...as downloaded. in the future, firefox may access source urls to download updated versions of generators, so unless you are installing generators which are available from urls, you should not use this form for your programmatically-installed generators. differentiating between user-initiated and microsummary-related requests when firefox updates a microsummary generated by a microsummary generator
add-on, it automatically downloads the html content of the page being summarized. it does not generally download related content like embedded images and javascript scripts referenced by the page. however, because of a technical limitation (bug 340746), it does download css stylesheets referenced by the page. firefox includes the x-moz request header with these requests. it sets the value of the head...
New Security Model for Web Services - Archive of obsolete content
ich domains are to be accessible or permitted from which other domains, but this requires extensive management which at best is quite error-prone for the end user and easily opens holes in a firewall that do not directly hurt the user who reconfigured his browser to try to access some external service but hurts the owners of other services behind the firewall. signed scripts a certain degree of
additional trust may be lent to a script by having the author digitally sign it. but signed scripts have not really caught on as they require certificates do not change the basic problem that some completely-unknown party has written a script that might now have access to internal resources. asking the user where the sandbox cannot otherwise determine whether the executing script should be permitte...
...ing resource access on the server access by untrusted scripts really needs to be under the control of the stake holder, which is the resource and server owner -- not the user -- to determine whether a resource should be insulated from web applications loaded from outside of the firewall. ...
... it may also be inconvenient to modify a soap service to ignore the specific verification header. ...
Plug-n-Hack Phase1 - Archive of obsolete content
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 previously un...
...his 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 previously 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://localhost:8080/other/core/other/rootcert/" }, ...
...nd a root ca certificate. it also optionally links to another manifest which describes the commands the browser can invoke. serving manifests from outside of your tool you may want to serve manifests from a separate webserver (e.g. for testing); plug-n-hack requires tool and service manifests to be served from the same origin as the api endpoints but, for testing purposes, ringleader (the firefox
addon implementation of the browser component) allows you to set a preference to relax or disable origin checks. the preference is ringleader.check.origin this can be set to 'off' to disble origin checks completely, or 'noport' to disable only port checks. security tool commands manifest an example commands manifest (for owasp zap) is: https://code.google.com/p/zap-extensions/source/browse/branches/b...
Prism - Archive of obsolete content
nt for end users. this includes the ability to create desktop shortcuts, to place the application icon in the tray or dock and to display pop-up notifications. customization: apps can be run using a shared browser runtime and customized using client-side script (similar to greasemonkey). custom stylesheets can be used to tweak the ui. architectural overview prism is a xulrunner application. in
addition to the browser engine included in xulrunner, it consists of: web app bundle management: code for creating new web app bundles and loading existing bundles. shortcut creation ui: a dialog box lets the user specify attributes of the web app (name, uri, icon, shortcut locations). javascript api: an api that can be used by scripts inside the bundle to customize the application. we are ref...
... such as adobe air and google gears. operating-system integration: binary components provided access to os-specific features like shortcut creation and dock/tray icons. we intend to propose these extensions for inclusion in future versions of xulrunner. firefox extension: a firefox extension, code-named "refractor", can be used to spin out new prism apps from inside the web browser. refractor
adds a new menu item to call up the shortcut creation dialog for inside firefox. web apps can also point to a complete web app bundle or some elements of a web app (like higher resolution icons). refractor automatically takes this information into account. documentation frequently asked questions ...
...on file. the configuration file is a simple, ini-style text file that specifies some parameters about a web application. styling one of prism's goals is to make web applications feel more like desktop applications. one way to make the illusion seem more real is to use styling (or theming). prism supports a simple styling system that allows the user to
add css files to the webapp bundle. scripting prism allows for some client-side web application customization. some simple objects and utilities are exposed to webapp scripts. host window prism provides a simple, scaled down browser window for running web applications. using configuration files and webapp scri...
Frequently Asked Questions - Archive of obsolete content
e's svg viewer in mozilla? the svg project is about mozilla's native implementation of svg, not adobe/corel/whoever's plug-in. however, we might as well answer this question to save you searching for this information elsewhere. see these install instructions on mozdev.org. it's also useful to know that you can check whether mozilla has recognised your plug-ins by typing 'about:plugins' into your
address bar (linking to that doesn't work for security reasons). does mozilla work with corel's svg plug-in? there are reports that it does, but that it's slower than the adobe plug-in. see this document for information on how to install it. can you have both native svg support and an svg plug-in installed? yes. if the plug-in works with the equivalent non-svg version of mozilla, then it should a...
... svg enabled version. to be able to use it, you must make sure the svg.enabled pref is set to false. this will disable the native svg support. does the <embed> tag support svg documents? yes. as of 2004-11-11, builds with native svg support will use the native support to render svg documents that are embeded by reference into an html document using the <embed> tag. note that this capability was
added to support legacy content. the <object> tag should be used in preference to the <embed> tag in new content whenever possible. the first milestone builds that will have this support will be svg enabled builds of firefox 1.5. what can i do to help the svg project? okay so maybe this isn't such a frequently asked question, but if it was, just think how much further on with our svg implementatio...
... don't have an irc client then install chatzilla into mozilla/mozilla firefox (note it may already be built in). clicking on the link above should then take you straight there. if you'd prefer to contact us by email you can send an email to our newsgroup mozilla.dev.tech.svg which is archived here. alternatively you can email any of us directly of course (see the preceeding question for our email
addresses). original document information author(s): jonathan watt last updated date: november 6, 2006 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Supporting per-window private browsing - Archive of obsolete content
} catch(e) { components.utils.reporterror(e); return; } } obtaining an nsiloadcontext for privacy-sensitive apis some apis (such as nsitransferable and nsiwebbrowserpersist) take nsiloadcontext arguments that are used to determine whether they should be classed as private or not (for example, whether the uri being persisted by saveuri should be
added to the permanent download history). to do this, import resource://gre/modules/privatebrowsingutils.jsm and use privatebrowsingutils.getprivacycontextfromwindow(win), passing a window object that is related to the content in question. as an example, if an
add-on
adds a context menu item that accesses an api that requires an nsiloadcontext, the most relevant window is the one that owns the elemen...
... in non-persistent ways for the duration of a private browsing 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); preventing 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 prevent the session from ending (prompting the user is recommended). to do this, observe the last-pb-context-exiting notification and set the d...
...inated by the ending of a private session, an
add-on can vote to prevent 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. ...
Tamarin Build System Documentation - Archive of obsolete content
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 the submitter of a sandbo...
...m of the page click on the [next page] link to display more previous builds what are the goals of the build system (qos)? to provide quick and accurate results of building and testing tamarin on supported platforms and configurations to represent the build results in a clear and concise manor please give use feedback if you have any comments or suggestions to improve the build system how to
add tests to the smokes? the list of smoke tests are located in the tamarin-repository, test/run-smokes.txt, assume the start directory is test format is cd testdir; command to run test above the test should be a # comment describing why the test in the smokes, when test failed, possibly a bugzilla bug the tests can be run by following the above instructions for running buildbot scripts locally and ...
... the test/acceptance/testconfig.txt file contains a list of tests marked as expected failures or skipped with the configuration see the testconfig.txt for current instructions generally the format is comma separated list with regular expressions for test and confi...
Using gdb on wimpy computers - Archive of obsolete content
ly no warranty for gdb. type "show warranty" for details. this gdb was configured as "i386-redhat-linux"... (gdb) b main breakpoint 1 at 0x804ec45: file nsapprunner.cpp, line 811. ...
...r.cpp, line 811. (gdb) r starting program: /home/blizzard/src/mozilla/mozilla/dist/bin/./mozilla-bin breakpoint 1, main (argc=1, argv=0xbffff894) at nsapprunner.cpp:811 811 installunixsignalhandlers(argv[0]); (gdb) set auto-solib-
add 0 (gdb) c continuing. nsnativecomponentloader: autoregistering begins. [...] it's easy to define a function for gdb to do this for you automatically. you can
add this function to the .gdbinit file in your home directory: def prun tbreak main run set auto-solib-
add 0 end how do i load shared libraries? if you have turned off automatic shared library loading, you will have to load them when you need them. gdb has a command to load libraries while the program is running. this is the sharedlibrary command. it can be shortened to shar ...
...this has been fixed in version 5 of gdb. there isn't a fix for older versions. ...
Venkman Introduction - Archive of obsolete content
utomatically pre-installed in mozilla 1.x but must be installed separately in firefox and other gecko-based products, such as thunderbird and netscape 7.x. fortunately, the xpinstall technology makes it possible to install new application modules in firefox by just clicking a hyperlink. if you don't already have venkman or would like to upgrade, you can easily get the latest version from firefox
add-ons. the installation process is two steps. first, from within the browser you want to host the debugger application, visit the firefox
add-ons page and click on the "install" link for the most recent version. when the download is complete, restart your browser (some windows users may also need to restart their computer as well). you can then access the debugger via a new, dynamically created men...
...e is loaded. the interactive session view another basic view in venkman is the actual interactive session view, which allows you to interact with the debugger from a command line. commands are entered in the text box, and responses are appended to the end of the output. type /commands in the 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 previous commands. tab completion allows the user to type the first portion of a command, and...
...g with the file name, line number, and snippet source code from where it stopped. figure 13. (from step 5) stopped at a breakpoint. in the interactive session's input field, enter this.fpaused venkman evaluates the expression, giving you [boolean] false back. press step into to follow the steps until you have finished debugging the function, and the fishes have paused. in
addition to step in, which will execute a single line of javascript and stop, step over can be used to step over a impending function call, and return control to the debugger when the call returns. step out executes until the current function call exits. click the "pause" link again on the fishcam page to resume the demo. this starts the dhtml down the other codepath in start() and makes the...
Example Sticky Notes - Archive of obsolete content
="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- in above only xbl namespace declaration is mandatory. the others are only needed if you plan to handle xul (xml user interface language) or/and svg (scalable vector graphics) in your bindings; xlink in xml also may come useful sometimes. all namespaces above are supported by default and they do not require any
additional downloads or initializations. --> <binding id="default"> <!-- a separate binding. you
add a binding file using -moz-binding style rule and you
address a particular binding by its id: -moz-binding: url(notes.xml#default) this id is local within the binding file (not visible in the target document dom tree). --> <resources> <!-- obtaining the stylesheet we'll use to (re)style ...
... the position of the original content is indicated by <children/> tag. ...
... = this.style.backgroundcolor || '#ffff00'; this.style.backgroundcolor = '#ffcc00'; ]]></handler> <handler event="mouseout"><![cdata[ this.style.backgroundcolor = this.$bg; ]]></handler> </handlers> </binding> </bindings> notes.css .sticker { position: relative; left: 0px; right: 0px; float: left; clear: none; width: 10em; height: 10em; overflow: visible; margin: 1em 1em; p
adding: 0.5em 0.5em; border: 2px solid blue; background-color: yellow; font: 1em normal "times new roman",serif; font-style: italic; cursor: default; } view this example ...
XML in Mozilla - Archive of obsolete content
ting xml linking support includes xml base and simple xlinks. you can make any xml element into an xlink by using the xlink namespace http://www.w3.org/1999/xlink. you can also use the linking elements from the xhtml namespace. see the testing and qa section for samples. for pointing into resources in xml documents mozilla also supports fixptr, a simplified, non-compatible version of xpointer. in
addition to using fixptr in links, it is possible to use it from scripts. see the proprietary dom/interfaces/core/nsidomxmldocument.idl interface. there is test case for fixptr links and a scripting example. since 1.4alpha, mozilla also supports xpointer framework, xpointer element() scheme, xpointer xmlns() scheme, xpointer fixptr() scheme and xpointer xpath1() scheme. the xpointer processor is exte...
...nted using this extensible mechanism. there is also a proprietary api from scripts to the xpointer processor. there is a testcase for xpointers that you can also study. lastly, there is a pref you might want to try (especially useful with fixptr) that will select the link target when you traverse it. there is no ui for setting this pref yet, so you will need to manually edit the preferences file.
add this line: pref("layout.selectanchor", true); dom load and save methods document.load() is a part of an old version of the w3c dom level 3 load & save module. mozilla currently implements only the load() method and the document.async property. outside supported xml w3c recommendations specification or technology documentation mozilla project xslt ...
...sync property. ...
Methods - 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. methods
adddirectory unpacks an entire subdirectory.
addfile unpacks a single file. alert displays an alert dialog box with a message and an ok button. cancelinstall aborts the installation of the software. confirm displays a confirm dialog box with the specified message and ok and cancel buttons. also allows custom button labels and a checkbox. ...
...execute extracts a file from the xpi file to a temporary location and schedules it for later execution. gestalt retrieves information about the operating environment. (mac os only) getcomponentfolder returns an object representing the directory in which a component is installed. getfolder returns an object representing a directory, for use with the
addfile method. getlasterror returns the most recent non-zero error code. getwinprofile constructs an object for working with a windows .ini file. getwinregistry constructs an object for working with the windows registry. initinstall initializes installation for the given software and version. loadresources returns an object whose ...
...rofile constructs an object for working with a windows .ini file. getwinregistry constructs an object for working with the windows registry. initinstall initializes installation for the given software and version. loadresources returns an object whose properties are localized strings loaded from the specified property file. logcomment
add a comment line to the install log. patch applies a set of differences between two versions. performinstall finalizes the installation of the software. refreshplugins refreshes the list of plug-ins registered for the browser. registerchrome registers chrome with the chrome registry. reseterror resets a saved error code to zero. ...
XPInstall API reference - Archive of obsolete content
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. ...
...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. ...
...tvalue getvaluenumber getvaluestring iskeywritable keyexists setrootkey setvalue setvaluenumber setvaluestring valueexists winregvalue constructor other information return codes see complete list examples trigger scripts and install scripts code samples file.macalias file.windowsshortcut install.
adddirectory install.
addfile installtrigger.installchrome installtrigger.startsoftwareupdate windows install ...
Dynamically modifying XUL-based user interface - Archive of obsolete content
e interfaces that are used in any interaction of a script and a document. if you have ever written a script that interacts with a xul (or html) document, you have already used dom calls. the most well known dom method is probably document.getelementbyid(), which returns an element, given its id. you may also have used other calls, such as element.setattribute(), or, if you wrote an extension, the
addeventlistener() method. all of these are defined in dom. there are also dom methods that create, move, or delete elements from a document. they will be demonstrated in a later section. right now, let's learn what a document is. what is a document? a document is a data structure which is manipulated through dom apis. a logical structure of every document is a tree, with nodes being elements, attr...
...ith id=someelement from the current document, by calling removechild() method to remove the first child, until there are no children remaining. note, that haschildnodes() and firstchild are also part of the dom api. var element = document.getelementbyid("someelement"); while(element.haschildnodes()){ element.removechild(element.firstchild); } inserting menu items to a menu this example
adds two new menu items to a <menupopup>: to the start and to the end of it. it uses document.createelementns() method to create the items, and insertbefore() with appendchild() to insert the created xml elements within the document. note: document.createelementns() creates an element, but does not put it anywhere in the document. you need to use other dom methods, such as appendchild() to insert ...
... return item; } var popup = document.getelementbyid("mypopup"); // a <menupopup> element var first = createmenuitem("first item"); var last = createmenuitem("last item"); popup.insertbefore(first, popup.firstchild); popup.appendchild(last); you can also use appendchild() and insertbefore() to move existing elements. for example you could move the item labeled "first item" to the end of popup by
adding this statement as a last line to the snippet above: popup.appendchild(first); this statement would remove the node from its current position in the document and re-insert it at the end of the popup. anonymous content (xbl) xbl is the language used in mozilla to define new widgets. widgets defined in xbl may choose to define some content which is inserted to the bound element, when the binding...
Introduction to XUL - Archive of obsolete content
ogrammed. "programming" can be as simple as some javascript to tie the widgets together and perhaps to give them extra functionality, or as complex as application (c++) code which is free to do ... anything. this paper will concentrate on javascript, deeming application programming to be beyond its scope. javascript xul can contain html content, including javascript. javascript functions may be
added in a fashion similar to html. there is no <head> section of a xul file, so script is just mixed in with the other content, delimited by a script element in the html namespace. <html:script type="application/javascript"> // dialog initialization code function initwindow() { var checkbox = document.getelementbyid("remember"); if (checkbox) checkbox.checked = true; } </html:sc...
...tensions are described in individual documents dedicated to the features requiring the extensions. dom extensions since xul is not the same thing as html, while xul documents will support the dom level 1 core api, they will not support the dom level 1 html api. however, mozilla supports extended dom functionality for the xul content model, patterned after the html extensions. at this time these
additional dom methods are available, though the code is of course the most accurate place to look for this information. these interfaces can be found in the directory mozilla/rdf/content/public/idl. xuldocument xuldocument extends document in a fashion similar to htmldocument's extension interface xuldocument : document { element getelementbyid(in domstring id); nodelist getelementsbyattribut...
...lement also supports other methods for hooking up broadcasters; a function performed automatically by the xul document loader and therefore not normally used in javascript. xul elements as mentioned above, a xul file is mostly an html file with xml syntax. a xul file may contain nothing but html elements and be completely functional. but xul defines several element types unique to itself, which
add functionality to the window. widgets widgets are generally objects like form controls: buttons, text boxes, tree controls and the like. a window can just as easily contain html form elements (using the html namespace) like any html content (though there is no need to put them within a form element). in fact, xul largely uses extant widgets from html, with a few extensions and
additions. each wi...
PopupEvents - Archive of obsolete content
equest is made to open a context menu, whether by the keyboard or mouse. this event will be fired even for elements that don't have a context menu associated with them. for more information about how to use this event, see context menu events. popupshowing this event is fired on a menupopup, panel or tooltip just before it is made visible. this event is most commonly used to
add or adjust items on the popup based on the context. popupshown this event is fired on a menupopup, panel or tooltip once it is visible on screen. popuphiding this event is fired on a menupopup, panel or tooltip once it is about to be hidden. this may happen because the user selected an item from the menu, or it may be because the popup wa...
...pdated and the popup is visible. one possible use of the popupshown event is to open another menu. this technique, as shown in the following example, is needed if you wish to open a submenu programmatically. this is because you cannot open a submenu directly without first opening the parent menu. ...
...enupopup"> <menu id="open-menu" label="open"> <menupopup> <menuitem label="file..."/> <menuitem label="page"/> </menupopup> </menu> </menupopup> </menu> <button label="open" oncommand="openfilemenu();"/> when the button is pressed, the openfilemenu function is called. within this function, a popupshown event listener is attached to the 'file' menu using the
addeventlistener method. this will cause the filemenuopened function to be called when the popupshown event is fired on the 'file' menu. the filemenuopened function first checks that the target of the event is the right popup and returns early if not. next, the popupshown event listener is removed again. we need to make sure to do this to ensure that the event listener isn't
added multiple times. fin...
PopupKeys - Archive of obsolete content
ent does not propagate to the main window. this is because the key listener is a capturing listener attached to the document. for a panel, the only key that is handled by default is the escape key to close the panel. the other keys do not apply. focus in popups a menu does not take the keyboard focus. the menu key listener described above captures key events on the document. ...
...r is a capturing listener attached to the document. for a panel, the only key that is handled by default is the escape key to close the panel. the other keys do not apply. focus in popups a menu does not take the keyboard focus. the menu key listener described above captures key events on the document. thus, a key listener
added to a <menupopup> will not receive any key events. ...
...while a menu is open, the focus remains where it was before the menu was open. ...
Tooltips - Archive of obsolete content
tooltips a tooltip is used to provide descriptive help to the user about the control that the mouse is over. for instance, moving the mouse over top of a toolbar button and waiting for a second can display a small popup label containing text describing the button's function. when the mouse is moved again, the tooltip disappears. this is a useful means of providing
additional details about a user interface without cluttering up the main interface. note that tooltips can only be activated using the mouse, so they should never contain important information that isn't available elsewhere. the tooltiptext attribute in most cases, the tooltip will display only a single label. for this, the tooltiptext attribute may be used, which is valid for all xul elements. the value of this attribut...
...on that isn't available elsewhere. the tooltiptext attribute in most cases, the tooltip will display only a single label. for this, the tooltiptext attribute may be used, which is valid for all xul elements. the value of this attribute should be the text to appear in the tooltip. <toolbarbutton label="back" tooltiptext="go back one page"/> in this example, a back button on a toolbar is given
additional text to appear on a tooltip. this could also be useful if the toolbar is configured such that labels do not appear. if an element does not have a tooltiptext attribute, yet a parent element does, the parent tooltip will apply. for example, in the following, a toolbar has a tooltip set for it. <toolbar tooltiptext="file buttons"> <toolbarbutton label="open" tooltiptext="open a file"/> ...
...attribute so will have a tooltip of its own. however, the close button does not have a tooltip associated with it, yet the parent toolbar does. the result is that the toolbar's tooltip will apply when the mouse is moved over the close button, as well as when the mouse is over an empty part of the toolbar. note that the tooltip text 'file buttons' isn't a good tooltip to use either. it conveys no
additional information to the user, so it shouldn't be used as in this example. the tooltip element tooltips are displayed using a tooltip element, which is a type of popup, but is styled to look different. elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text inside it. this default t...
Multiple Queries - Archive of obsolete content
would be a better idea as it only requires one query, is simpler and more efficient, however you could imagine a more complex query where this wasn't possible. how multiple queries are processed we already know that a query generates a set of results. there's no magic to the way in which the template builder processes multiple queries. ...
...ires one query, is simpler and more efficient, however you could imagine a more complex query where this wasn't possible. how multiple queries are processed we already know that a query generates a set of results. there's no magic to the way in which the template builder processes multiple queries. ...
...multiple queries. it just takes the results generated from the first query,
adds the results for the second query,
adds the results for the third query, and so on. ...
Multiple Rule Example - Archive of obsolete content
ents/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/date" object="?date"/> </conditions> <action> <hbox uri="?photo" class="box-p
added"> <vbox> <label value="?title"/> <image src="?photo"/> </vbox> <groupbox> <caption label="photo details"/> <label value="?description"/> <label value="date: ?date"/> </groupbox> </hbox> </action> </rule> <rule> <conditions> <content uri="?start"/> <memb...
...the second rule matches those photos with a title. if a photo did not have a title, it would not match any rule. in the example data, only the first phot...
...since the second rule doesn't refer to these variables, they will not be filled in. although the canal photo has a date, the second rule doesn't use it, so you cannot refer to the ?date variable in this rule. but, you could use a <binding> to get the date without requiring it to match the conditions. of course, the variable doesn't have to b...
Multiple Rules - Archive of obsolete content
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. ...
...n't have any content at all generated for it. this is an effective way to filter out results that you don't want. in this simple example with one rule though, it would 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 previous 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...
...s those that do not. <where subject="?title" rel="equals" value="canal"/> <where subject="?title" rel="equals" value="canal" negate="true"/> you can use the negate attribute with all of the relational operators. for example, although there is no 'greater or equal' operator, you can acheive this effect with a negated 'less' operator. <where subject="?age" rel="less" value="10" negate="true"/>
additional where clause attributes by default, the case of values must match in a condition. you can disable this for a where clause by setting the ignorecase attribute to true. the following example matches names that contain either the letter 'a' or 'a'. without the ignorecase attribute, names with only uppercase letter a's will not match the rule. <where subject="?name" rel="contains" value="a" ...
RDF Query Syntax - Archive of obsolete content
iption isn't quite correct. the seed is actually an internal variable set to the container, in this case, the vbox, and the ?start variable is set to the ref later, but that is a minor detail that doesn't make templates more understandable. for this discussion, assume that so far we have a single potential result as above. the content tag doesn't do anything else at this point, meaning it doesn't
add anything else to the network of potential results, so processing continues on to the next statement, the triple, which looks like this: <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the triple statement is used to follow arcs or arrows in the rdf graph. the predicate attribute specifies the labels of the arrows to follow. in...
...values. in a triple statement, the subject is always the start of an arc, while the object is what it points to. for this triple, the builder will follow the arrows in the forward direction. here is the rdf graph again: starting at node a and following the relateditem arcs, we can see that there are three possible values for the ?relateditem variable, b, c and d. this is new data, so the builder
adds it to the graph. since three values have been found, the network will now have three potential results: (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/b) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/c) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/d) you may note that the ?sta...
...ulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/b) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/c) (?start = http://www.xulplanet.com/rdf/a, ?relateditem = http://www.xulplanet.com/rdf/d) you may note that the ?start variable is repeated for each result. this is because the builder copies the existing data for each new potential result and
adds the new data. internally, this isn't quite true; the builder actually maintains 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 genera...
Sorting Results - Archive of obsolete content
t 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 the user changes the sort. the sortdirection attribute may be used to specify the initial sort direction for a column. only one column should have this attribute set, as a tree may only be sorted by one column at a time. the value should be either 'ascending', 'descend...
... <template> <query expr="*/*"/> <action> <listitem uri="?" label="?name"/> </action> </template> </listbox> it will often be the case that multiple items have the same value, especially for larger amounts of data. you can specify multiple sort keys to further define how a sort should be handled in the case where the values for the first sort key are the same. to do this, just
add another key after the first separated by a space, as in the following: sort="?name ?gender" in this example, results will be sorted by name, followed by gender for those with identical names. you may
add as many sort keys as desired. sorting occurs when output is first generated as well as when a result is
added as a result of a datasource change. when the rdf datasource changes, and a new resul...
...ce changes, and a new result is available, the new content is inserted at the right location. for rdf datasources, you can also use an rdf predicate for sorting instead of a variable: <hbox datasources="template-guide-photos5.rdf" sort="http://purl.org/dc/elements/1.1/title" sortdirection="ascending" ref="http://www.xulplanet.com/rdf/myphotos"> <template> <vbox class="box-p
added" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </template> </hbox> in this example, the generated items will be sorted by title. when sorting, the predicate specified in the sort attribute for the result is used to determine where in the content the generated output should be inserted. the is similar to using a variable b...
Using Recursive Templates - Archive of obsolete content
box> </action> </template> </groupbox> in this simplified example, the xpath expression just gets the list of child elements of the reference node. for the outermost iteration, a vbox is created with a child label. since 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 previous 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, bu...
... <vbox id="row3" container="true" empty="false" class="indent"> <label value="female"/> <vbox id="row7" class="indent"><label value="cleopatra"/></vbox> <vbox id="row8" class="indent"><label value="laura secord"/></vbox> </vbox> </groupbox> note how similar content corresponding to the action body is created for both the groups as well as the people. the template builder has also
added container and empty attributes to the groups. this is done with all nodes that have children to indicate that the node contains generated children as well as whether the node is empty. these hints are used for trees, but they can also be used in a stylesheet to provide a different appearance for containers with children, empty containers, as well as non-containers. in this example, both the par...
... expand this process for other levels. disabling recursion the recursion on a template occurs automatically. in fact, it has occured with all of the examples so far. however, in most cases, there either aren't any children 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. « previousnext » ...
Toolbars - Archive of obsolete content
toolbars, implemented using the xul toolbar element, are containers for toolbar buttons and other user interface objects. the following articles provide details about implementing and working with toolbars. documentation xul school:
adding toolbars and toolbar buttons a helpful tutorial to creating toolbars and toolbar buttons. toolbar customization events a look at the events that are sent during toolbar customization; you can use these to be kept aware of changes to toolbars. creating toolbar buttons how to use overlays to
add toolbar buttons to mozilla applications. custom toolbar button another example of how to create a toolbar button, complete with a sample extension ...
...utton, complete with a sample extension you can download and try. code snippets: toolbar code snippets that are helpful when working with toolbars. community view mozilla extension development forums... ...
...opment forums... mailing list newsgroup rss feed #extdev irc channel mozillazine forum about:
addons newsletter mozilla's web-tech blog mozdev project owners planet mozilla other community links... tools dom inspector edit the live dom (firefox and thunderbird) mozilla labs
add-on builder extension developer's extension a suite of development tools chrome list view files in chrome:// (firefox, thunderbird) extension wizard a web-based extension skeleton generator (firefox and thunderbird) ... more tools ... related topics xul, themes, developing mozilla ...
Tree Widget Changes - Archive of obsolete content
in displayed order column.id - the id attribute of the column column.element - the treecol element column.x - the x position in the tree of the left edge of the column column.width - the width of the column in c++ code, you can also get the atom attribute of nsitreecolumn which returns an nsiatom for the column, making it fast to do comparisons. nscomptr<nsiatom> atom; acol->getatom(getter_
addrefs(atom)); if (atom = kmycol) ... one feature that has been
added is restorenaturalorder which may be used to restore the original order of the columns before the user moved them around. tree.columns.restorenaturalorder() there is also a command on the end of the tree's column picker which the user may use to restore the original column order. this will be hidden if the column redordering i...
...tribute you use, not the label attribute. <treecell/> <treecell value="true"/> you need to specify the checkbox image with css for the checkbox to display. (do not set id of the column to be 'checked' it will cause problems with the css) treechildren::-moz-tree-checkbox(checked) { /* css for checked cells */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } in
addition, checkmark columns support editing: <tree editable="true"> <treecols> <treecol type="checkbox" editable="true"> ... </treecol> </treecols> </tree> if the column is editable, the user can click the cell to change the state of the checkbox. when the user clicks the cell, the view's setcellvalue method will be called with either the value true or false. note that the tree ...
... banana. however, this paves the way in the future for more general tree editing features. style improvements you can now specify the cursor to use for a cell using the css cursor property. treechildren::-moz-tree-cell-text { cursor: pointer; } this allows you to create separate cursors for cells. the :-moz-tree-separator pseudo has been improved to make it a proper box type and now has
additional styling capabilities. example: treechildren::-moz-tree-separator { margin-top: 1px; border-top: 1px solid threedshadow; border-left: 1px solid threedshadow; border-right: 1px solid threedhighlight; border-bottom: 1px solid threedhighlight; height: 2px; } original document information author: neil deakin source: here ...
Box Model Details - Archive of obsolete content
« previousnext » we've seen a lot of features of the box model. 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. the buttons will never be smaller than this size but they may grow la...
...e example above, all three elements will resize themselves as they are all flexible. the two buttons indicate a minimum width of 100 pixels. the buttons will never be smaller than this size but they may grow larger. here the window 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 prevent 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...
...trained 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"/> <button label="right" style="min-width: 100px;" flex="1"/> </hbox> summary of the box model to achieve complicated layouts, you will generally need to
add nested boxes, specify minimum and maximum sizes on some elements, and make certain elements flexible. the best interface is one that can be displayed at various sizes without problems. the box model may be difficult to understand without trying various various things out for yourself. the following is an outline of both types of boxes: horizontal boxes lay out their elements next to each other...
Box Objects - Archive of obsolete content
use the box layout object or one of its subtypes. recall that all xul elements are types of boxes, that is the box is the base of all displayed xul elements. however, there are a number of subtypes, about 25 or so, for specific xul elements. some of these subtypes, such as the stack or listbox are needed for more complex layouts than the basic box, while others such as the button are used only to
add extra mouse and key event handling. the layout object associated with an element can be removed and a completely different type of object created just by changing the css display property, among others. for example changing the display property of a button element to block will cause the button layout object to be deleted and a block object to be created instead. naturally, this will change the a...
...x read only properties, x, y, screenx, screeny, width and height, for determining the currently displayed position and size of an element. all values returned are in pixels. x, y the x and y coordinates are referenced from the top left corner of the document in the window (that portion which excludes the window border and title bar) and refer to the top left corner of the element, including css p
adding. css margins and borders* are excluded. the top left corner of the document is that which is obtained from screen.mozinnerscreenx, screen.mozinnerscreeny screenx, screeny the screenx and screeny coordinates are referenced from the absolute top left corner of the screen (screen.top,screen.left) and refer to the top left corner of the element, including css p
adding and borders. css margins ar...
... css margins are excluded. ...
Content Panels - Archive of obsolete content
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). ...
...="back" /> <toolbarbutton label="forward" /> <textbox id="urlfield" /> </toolbar> </toolbox> <iframe id="content-body" src="http://www.mozilla.org/index.html" flex="1" /> the example here has created a very simple interface for a web browser. a box has been created containing two elements: a toolbox and an iframe. a back button, a forward button and a field for typing is urls has been
added to the only toolbar (we'll learn about toolbar in a later section). the web pages would appear inside the iframe. in this case, the file index.html would appear by default. this example isn't functionally complete. next, we would want to
add script which changes the src attribute at the desired time, for example when the user presses the enter key. browsers there is a second type of conten...
...for example, the browser maintains a page history for use with back and forward buttons. the browser can also load pages with referers and other flags. essentially, the browser tag should be used when you want to create a browser-like interface, but the iframe may be used when you just need a simple panel. ...
Creating a Wizard - Archive of obsolete content
the type of dog that is best for you." </description> <label value="why do you want a dog?"/> <menulist> <menupopup> <menuitem label="to scare people away"/> <menuitem label="to get rid of a cat"/> <menuitem label="i need a best friend"/> </menupopup> </menulist> </wizardpage> <wizardpage description="dog details"> <label value="provide
additional details about the dog you would like:"/> <radiogroup> <caption label="size"/> <radio value="small" label="small"/> <radio value="large" label="large"/> </radiogroup> <radiogroup> <caption label="gender"/> <radio value="male" label="male"/> <radio value="female" label="female"/> </radiogroup> </wizardpage> </wizard> this wizard has ...
...rdpage> </wizard> this wizard has two pages, one that has a drop-down menu and the other with a set of radio buttons. the wizard will be formatted automatically, with a title across the top and a set of buttons along the bottom. the user can navigate between the pages of the wizard with the back and next buttons. these buttons will enable and disable themselves at the appropriate moments. in
addition, on the last page, the finish button will appear. all of this is automatic, so you don't have to do anything to manipulate the pages. the description attribute may optionally be placed on a wizardpage element to provide a sub-caption for that page. in the example above, it has been placed on the second page, but not the first page. handling page changes you will generally want to do somet...
...eshow wizardpage called on the page that the user is entering. a similar process occurs for the back button. when trying to use a function in the event above, such as pageadvanced, you should use return funcname() instead of just calling funcname() or it will not work as expected e.g. <wizardpage pageadvanced='return funcname()'></wizardpage> in the next section, we'll see some
additional features of wizards. « previousnext » ...
Open and Save Dialogs - Archive of obsolete content
d. the second is a filter that indicates the list of file types that are displayed in the dialog. this would be used, for example, to hide all but .html files. you can set the default directory by setting the displaydirectory property of the file picker object to a directory. the directory should be an nsilocalfile object. if you do not set this, a suitable default will be selected for you. to
add filters, call the appendfilters() function to set the file types that you wish to have displayed. fp.appendfilters(nsifilepicker.filterhtml | nsifilepicker.filterimages); fp.appendfilters(nsifilepicker.filtertext | nsifilepicker.filterall); the first example will
add filters for html and for image files. the user will only be able to select those types of files. the manner in which this is d...
...the user therefore has the option to display text files only or all files. you can also use filterxml and filterxul to filter for xml and xul files respectively. ...
...s and for all files. the user therefore has the option to display text files only or all files. you can also use filterxml and filterxul to filter for xml and xul files respectively. if you would like to filter for custom files, you can use the appendfilter() function to do this: fp.appendfilter("all files" ,"*.*"); fp.appendfilter("audio files (*.wav, *.mp3)","*.wav; *.mp3"); this line will
add a filter for wave and mp3 audio files. the first argument is the title of the file type and the second is a semicolon-seperated list of file masks. you can
add more masks or fewer masks as needed. you can call appendfilter as many times as necessary to
add additional filters. the order you
add them determines their priority. typically, the first one
added is selected by default. getting the sele...
Property Files - Archive of obsolete content
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. ...
...le first gets a reference to the bundle using its id then, it looks up the string 'notfoundalert' in the property file. the function getstring() returns the value of the string or null if the string does not exist. finally, the string is displayed in an alert box. text formatting the next method is getformattedstring(). this method also gets a string with the given key name from the bundle. in
addition, each occurrence of formatting code (e.g. %s) is replaced by each successive element in the supplied array. var dir = "/usr/local/document"; var count = 10; var strbundle = document.getelementbyid("strings"); var result = strbundle.getformattedstring("resultmessage", [ dir, count ]); alert(result); this example will display following message in an alert box. 10 files found in the /usr/loc...
...xxx , where xxxx is a unicode character code. ...
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. ...
...is to farthest to have the element that is the farthest away from the splitter to the right resize. (the last element in the box). this attribute can also be set to grow, in which case the elements to the right of the splitter do not change size when the splitter is dragged, but instead the entire box changes size. the default value is closest. if you set the collapse attribute, you should also
add a grippy element inside the splitter which the user can use to collapse the element. the width and height attributes of the elements next the splitter are adjusted when the splitter is dragged. the exact element depends on the resizebefore and resizeafter attributes. splitter example an example would be helpful here: example 1 : source view <hbox flex="1"> <iframe id="content-1" width="60"...
...starts at 60 pixels wide). you can still collapse the splitter however. you can also place more than one splitter in a box if you want, in which case you could collapse different parts of it. similarly, you do not have to collapse just iframes. any element can be collapsed. our find files example let's see what the find file dialog looks like with a splitter in it. one possibility would be to
add the results of the search in the dialog. we'll
add an area in-between the search criteria and the buttons along the bottom. a splitter will allow you to collapse, or hide, the search results. </tabbox> <iframe src="results.html"/> <splitter collapse="before" resizeafter="grow"> <grippy/> </splitter> <hbox> here, a splitter and an iframe have been
added to the dialog. we don't need th...
Tree Box Objects - Archive of obsolete content
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 previous 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 will redraw a specific row in the tree. the tree will call the view to ...
...ls the scrolltorow() function with an argument set to the value of the textbox. you might notice that the tree box object can be retrieved in the same way as other box objects using the boxobject (fixme: deallink)property, however we need to call queryinterface() to cast the box object to the more specific tree box object. the functions of the more general box object are also available to trees.
additional scroll methods include the scrollbylines(), scrollbypages() and ensurerowisvisible() functions. the scrollbylines() scrolls up or down by a certain number of rows. use a positive number to go down and a negative number to go up. the scrollbypages() function scrolls by a number of pages and is called automatically when the user presses the page up or page down keys while the tree is focuse...
...e returned from the getcellat() function. again, the column should be either a string or a column object depending on which version you are using. the cell part type may be used to get the coordinates of either the text, the entire cell, the twisty or the image in the cell. the same values as the getcellat() function are used. the getcoordsforcellitem() function returns the x and y coordinates in
addition to the width and height, all as out parameters. next, we'll look at rdf which can be used to automatically populate trees and other elements. « previousnext » ...
XBL Attribute Inheritance - Archive of obsolete content
« previousnext » in this section we'll see how attributes can be inherited. 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. in this case, it would be preferable if the attribute could be specified on the searchbo...
...arated list of attribute names that are to be inherited. <xul:textbox xbl:inherits="flex"/> <xul:button xbl:inherits="label"/> when the content is generated, the textbox grabs the flex attribute from the searchbox and the button grabs the label attribute from the searchbox. this allows both the flexibility of the textbox and the label of the button to be different for each use of the binding. in
addition, changing the value of the attributes on the searchbox with a script will update the textbox and button also. you can
add the inherits attribute to as many elements as you wish, to inherit any number of attributes. note how the inherits attribute has been placed in the xbl namespace, by prefixing it with 'xbl:'. the namespace should be declared somewhere earlier, usually on the bindings elem...
...nt. changing the attributes on the box with the okcancel class 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. « previousnext » ...
Urlbar-icons - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the location of ui elements like the bookmarks, feed and go buttons. create new image or button child elements to
add your own items. ...
... « xul reference home [ examples | attributes | properties | methods | related ] the location of ui elements like the bookmarks, feed and go buttons. create new image or button child elements to
add your own items. ...
...ult contents of browser.xul: <hbox id="urlbar-icons"> <button be="" chromedir="ltr" class="urlbar-icon" click="" for="" id="safebrowsing-urlbar-icon" img="" level="safe" might="" onclick="godocommand('safebrowsing-show-warning');" page="" style="-moz-user-focus:" tooltiptext="this" type="menu"> <img class="urlbar-icon" id="star-button" onclick="placesstarbutton.onclick(event);" /> <img
address="" chromedir="ltr" class="urlbar-icon" id="go-button" in="" location="" onclick="handleurlbarcommand(event);" p="" the="" to="" tooltiptext="go" /> </button> </hbox> ...
Using nsIXULAppInfo - Archive of obsolete content
nterface to distinguish between different mozilla-based applications, use the frozen nsixulappinfo interface. the following sections provide a few examples of using nsixulappinfo from javascript. note that while firefox 1.5, thunderbird 1.5, and xulrunner 1.8-based applications support nsixulappinfo, older applications, such as firefox and thunderbird 1.0, do not support it. you'll need to have
additional code for those older versions. getting nsixulappinfo to get a component implementing nsixulappinfo use this code: var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); (for explanation see this creating xpcom article.) getting application information after you obtained the app info component, you can...
...th xulrunner-based applications. ...
...ng module was
added that provides access to app info during the execution of xpcshell tests. see bug 809920, and in summary: // work around the fact that xpcshell doesn't have a proper app-info xpcom object. cu.import("resource://testing-common/appinfo.jsm"); updateappinfo(); older versions as stated above, older mozilla 1.7-based applications do not support nsixulappinfo. you'll have to write
additional code if you choose to support those versions. for example, firefox and thunderbird 1.0 stored their id in the app.id preference (and their version in app.version), so you could use code like this to find out what application you're running under: function getappid() { var id; if("@mozilla.org/xre/app-info;1" in components.classes) { // running under mozilla 1.8 or later id = ...
Using the standard theme - Archive of obsolete content
be unstyled. meaning, some internal default will be applied, which does by no means correspond to the standard theme (the theme currently chosen by the user in the theme selector), or even the default theme delivered with your the base application. applying the standard theme in order to use the theme currently chosen by the user of the base application (the so called "global skin"), you have to
add the following line to your xul file: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> this imports the styles found in the <tt>global/skin</tt> chrome directory and will make the standard xul widgets of your application use the selected chosen theme. you do not have to specify a specific file; mozilla will determine by its own which files in the directory it needs to use. if you ...
...rd xul widgets of your application use the selected chosen theme. you do not have to specify a specific file; mozilla will determine by its own which files in the directory it needs to use. if you are only going to use these global style sheets, you of course do not need a <tt>skin</tt> directory in your extension package, and also do not have to register a style in the <tt>chrome.manifest</tt>.
adding custom styles in order to provide custom styling for some of your widgets (apart from the standard global skin) you can take two different routes. you can either
add multiple <tt>xml-stylesheet</tt> processing instructions to your xul file, or create an <tt>@import</tt> chain. no matter which approach you choose, do not forget to register your custom skin in the <tt>chrome.manifest</tt>. note ...
...>xml-stylesheet</tt> processing instructions to your xul file, or create an <tt>@import</tt> chain. no matter which approach you choose, do not forget to register your custom skin in the <tt>chrome.manifest</tt>. note that you can also mix these two approaches, although it makes your code more readable when sticking to only one way. ...
XUL accessibility tool - Archive of obsolete content
ensive test suite (meaning that passing all included tests does not guarantee that an application is free of accessibility bugs or issues), many of the most common accessibility mistakes will be found and reported. availability the xul accessibility tool can currently be obtained from [http://www.xulplanet.com/aaron/files...bilitytool.xpi]. future versions of the extension will be available from
addons.mozilla.org. the version currently on xulplanet is compatible with the following xul applications: firefox 1.5+ thunderbird 3.0a+ recent sunbird builds recent songbird builds. it probably also works on seamonkey, but i haven't verified this. use to launch the tool after installation, look for an entry in the tools menu of the host application, or hit ctrl+alt+shift+f12. once the tool wi...
...ck a text file, and output the results somewhere. known bugs: test for lowercase i or l as accesskey (sometimes?) flags upppercase i and l too. possible false positives in some of the other tests processing is slower than we would like. ideas for further work on xul a11y some general ideas for using the tool and guidelines to further the accessibility cause within the mozilla project.
add usability, i18n, security and other considerations to xul a11y guidelines -- make them more general sprinkle the a11y techniques throughout the turorial and reference. 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 -...
...techniques throughout the turorial and reference. 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. ...
command - Archive of obsolete content
| attributes | properties | methods | related ] a command element can be used to invoke an operation that can come from multiple sources. for example, a clipboard paste operation can be invoked from the edit menu, a context menu and by pressing a keyboard shortcut. you attach the code to the command using the oncommand attribute. it will be called no matter how it is invoked by the user. in
addition, disabling the command will automatically disable the menu items and keyboard shortcuts. commands are identified by their id. if you include the script chrome://global/content/globaloverlay.js in your window, you can use the function godocommand function to invoke the command. using this function has the advantage that the command will be sent to the part of the ui which will respond to it.
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
description - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it ...
...e of the disabled attribute. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
iframe - Archive of obsolete content
ml <iframe> element. the src attribute can be used to specify the content of the frame. this content is a separate document. the children of the iframe are ignored. currently, xul iframes running in remote processes are not supported. if you want to run content in a remote process, use a xul browser element. warning: when used in chrome-privileged documents (either html or xul) such as firefox
addons, the contents of the frame may have the same permissions as firefox itself. this can be a serious security vulnerability, for example if you use src="http://...". when used in this case, please see displaying web content in an extension without security issues. more information is available in the xul tutorial. attributes showcaret, src, type, transparent properties accessibletype, con...
...ome type. subdocuments of chrome documents 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 preventing 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 insi...
... contains the nsidocshell object for the document. webnavigation type: nsiwebnavigation this read-only property contains the nsiwebnavigation object for the document. most of its methods are callable directly on the element itself, such as goback and goforward. it also contains the load constants used by reloadwithflags and loaduriwithflags. ...
key - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. key type: character the character that must be pressed. this should be set to a displayable character. keycode type: string key code for keys that do not have displayable characters, such as the enter key or function keys, use this attribute instead of the key attribute. valid keys are listed at keyboard shortcuts. keytext type: string a label for the ke...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
...o an empty string, the element doesn't handle any key events. for example: <!-- this element handles all key events --> <key/> <!-- these elements don't handle any key events --> <key key="" modifiers="control"/> <key keycode="" modifiers="control"/> modifying attributes in case you want to change one of the <key>'s attributes, such as the modifiers attribute, the keyset element has to be re-
added to its parent node; otherwise the new attributes won't be applied. for example: // modify some attributes let key = document.getelementbyid(key_id); key.setattribute("modifiers", "alt shift"); // apply the changes let keyset = document.getelementbyid(keyset_id); keyset.parentnode.appendchild(keyset); ...
listitem - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current type: boolean this attribute will be set to true if the listitem is the current item. this is typically used by a theme to customize the focus ring. to change the currently selected item in a listbox, use the listbox property selecteditem. disabl...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is cop...
...eparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
menuseparator - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is c...
...arator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
notificationbox - Archive of obsolete content
allnotifications type: nodelist nodelist of all notifications. this property is read-only. notificationshidden type: boolean indicating whether the notification area should be hidden. events alertactive type: event fired when a notification element is shown. alertclose type: event fired when a notification element is closed. ...
...butens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata appendnotification( label , value , image , priority , buttons, eventcallback ) return type: element create a new notification and display it. if another notification is already present with a higher priority, the new notification will be
added behind it. label - label to appear on the notification. this should be either a string, or, from gecko 37 onwards, you can pass a documentfragment with rich content as well. keep in mind that this is all xul so using html elements for styling might still need
additional css in order to work as you might expect. value - value used to identify the notification image - url of image to appear...
...here can be only one default button. if no button has this set, the first button in the array is the default. type - a string. valid values are "menu-button" and "menu" which must be set if the button is to provide a popup via the popup property. getnotificationwithvalue( value ) return type: notification element retrieve the notification with a particular value. the value is specified when
adding the notification with appendnotification. if no matching value is found, returns null. removeallnotifications( immediate ) return type: no return value remove all notifications. if immediate is true, the messages are removed immediately. if immediate is false, the notifications are removed using a slide transition. removecurrentnotification() return type: no return value remove the c...
radiogroup - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. focused type: boolean this attribute is true if the element is focused. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. tabindex type: integer the tab order of the element. the tab order is the order i...
...erty, or changed by the user. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
...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 previous radio button is selecte...
<statusbarpanel> - Archive of obsolete content
an 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. ...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
tab - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. fadein type: boolean this attribute is set to true if the tab is fading in or out. this typically means that the tab is in the process of appearing or disappearing. first-tab type: boolean this attribute will be set to true for the first tab. this attribute should not be set manually, but is useful in a theme if the first tab should be styled differently. im...
...arator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
timepicker - Archive of obsolete content
use. a fourth textbox appears for 12 hour clocks which allows selection of am or pm. to specify the initial, use the value attribute set to a value of either the form hh:mm:ss or hh:mm. the value may be retrieved and changed using the value property or the datevalue property. the former specifies the time as a string of the form hh:mm:ss whereas the latter specifies the time as a date object. in
addition, the hour, minute and second properties may be used to retrieve and modify each component of the time separately. the change event is fired whenever the time is changed. however, as described in mozilla bug #799219, a change event handler may encounter erratic behavior when the time is changed using the keyboard instead of the mouse. to avoid this, you can use the workaround described here,...
... the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. hideseconds type: boolean indicates whether to show the seconds field. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. increment type: integer indicates the number of minutes to skip each time the arrows are pressed. this s...
... type: boolean a read only value indicating whether a leading zero should be displayed before the second when it is less than 10. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string the currently entered time of the form hh:mm:ss. set this property to change the time. ...
tooltip - Archive of obsolete content
more information is available in the xul tutorial. ...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default type: boolean if true, the tooltip is used as the default popup for displaying tooltips in the window. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the valu...
... possible: closed: the popup is closed and not visible. open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. this state will occur during the popupshowing event. hiding: the popup is about to be hidden. this state will occur during the popuphiding event. ...
tree - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. disablekeynavigation type: boolean if this attribute is not used, the user can navigate to specific items within the element by pressing keys corresponding to letters in the item's label. this is done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. editable type: boolean indicate...
...f the tree, which the user may use to show and hide columns. when set to true, the column picker will be hidden. the default value is false. onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select multiple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item
added to or removed from the selection. rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate ...
...played. you can assign an object which implements nsitreeview to this property. trees built from rdf or those which use treeitems directly will already have a view. functions available in the view allow one to retrieve the data within the cells, and determine which rows are nested within others. for a complete list of view functions, see the nsitreeview interface. ...
treecol - Archive of obsolete content
on firefox 2.x and 3.x, all operating systems other than mac os x already use these styles by default. if targeting firefox for mac os x, be sure to use these styles but include your own checkbox image. however, chrome://global/skin/checkbox/cbox-check.gif is available in seamonkey on mac os x.. treechildren::-moz-tree-checkbox { /* unchecked checkbox tr...
...s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } cycler type: boolean if true, then the column is a cycler column. in the case, clicking on a cell in the column will alternate its state between on and off. this is used, for example, in a mail window, for a column that indicates that the message is read or un...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
Building XULRunner - Archive of obsolete content
on the system; see the instructions on building javaxpcom for more details. if you do not want to build javaxpcom support, specify --disable-javaxpcom in your configuration. on mac, xulrunner requires mac os x 10.3 or higher and xcode 1.5 or higher to build properly. the runtime requirement is mac os x 10.2. ...
...uilding javaxpcom for more details. if you do not want to build javaxpcom support, specify --disable-javaxpcom in your configuration. on mac, xulrunner requires mac os x 10.3 or higher and xcode 1.5 or higher to build properly. the runtime requirement is mac os x 10.2. ...
...t to build javaxpcom support, specify --disable-javaxpcom in your configuration. on mac, xulrunner requires mac os x 10.3 or higher and xcode 1.5 or higher to build properly. the runtime requirement is mac os x 10.2. a basic minimal mozconfig which will build a release configuration of xulrunner is: mk_
add_options moz_co_project=xulrunner mk_
add_options moz_objdir=@topsrcdir@/obj-xulrunner ac_
add_options --enable-application=xulrunner #uncomment the following line if you don't want to build javaxpcom: #ac_
add_options --disable-javaxpcom cvs tags and xulrunner versions older xulrunner releases where tagged in cvs with (for instance xulrunner_1_8_0_5_release ) up to version 1.8.0.5 the cvs repository does not have specific tags for xulrunner anymore. instead a xulrunner build is a just ...
XULRunner Hall of Fame - Archive of obsolete content
a pre-production software. source chatzilla a standalone version of the chatzilla irc client. conkeror a highly programmable web browser with a leopard-oriented design inspired by emacs. source evergreen - staff client evergreen is an open source library system. source ieditweb a client/server based content manager and internet application suite. ieditweb users can
add pages, images, forms, ecommerce many special effects and much more using the xulrunner based client. it will comunicate dyamically with the ieditweb server to maintain a fully configured web site with embedded web applications. it also contains a built in email marketing system that is tightly integrated with the associated web site. one example of this tight integration is that the form in a web...
...er process. songbird songbird™ is a desktop web player, a digital jukebox and web browser mashup. build instructions spicebird a collaboration suite - e-mail, calendaring and instant messaging. latest release: june 2010 - build instructions utilities / prototypes ajax toolkit framework (atf) a part of the eclipse web tools platform (wtp) aliwal geocoder geocode
addresses onto a map benjamin's xulrunner examples "mybrowser is a very simple example browser", xulmine. an updated version of "mybrowser" that works with firefox 25.0.1+ is available in matthew kastor's xulrunner examples at https://github.com/matthewkastor/xulrunner-examples/ exch a currency conversion tool using updated data from http://finance.yahoo.com/currency. you can use the ...
...unner examples at https://github.com/matthewkastor/xulrunner-examples/ exch a currency conversion tool using updated data from http://finance.yahoo.com/currency. you can use the firefox extension or the stand-alone xul application. opendocument viewer cross-platform viewer for opendocument files. taskpool taskpool is a little application to help keep track of time. you can
add tasks to a pool, turn them on and off, and it will tick off seconds. svgclock an svg-based clock. crowbar a web scraping environment based on the use of a server-side headless mozilla-based browser. 30b a xulrunner-based wrapper for 30boxes.com xul explorer "a lightweight xul ide... an easy way to experiment with xul" xulexplorer a patched version of xul ex...
MacFAQ - Archive of obsolete content
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. ...
...the mac "about" menu make sure that you use "aboutname" as the id for your menu item to enable the mac "preferences" menu make sure that you use "menu_preferences" as the id for your options/preferences menu item toolbars mac windows have a small "jelly bean" button in the top right corner. this button is used to show/hide the toolbar. the toolkit will automatically enable this behavior if you
add class="chromeclass-toolbar" to your <toolbar> element. commandline support commandline handlers work great on the mac if it's a cold start. here's how to implement command-line trapping when the app is already running, without getting into appleevents or c++ code. this is implemented in a pseudo "hidden window" technique and parsing the window arguments instead of command-line handlers and som...
...uments[0] .queryinterface(components.interfaces.nsicommandline); for (var i = 0; i < cmdline.length; ++i) { debug(cmdline.getargument(i)) } } catch(ex) { debug(window.arguments[0]) // do something with window.arguments[0] //nspreferences.setunicharpref("myxul.cmdlinevalue", window.arguments[0]) } window.
addeventlistener("load", checkotherwindows , false); } ]]></script> </window> ...
Windows and menus in XULRunner - Archive of obsolete content
the xul file may also contain other top-level declarations for css and dtd, which i will discuss in a moment. ...
...();"/> </toolbar> </toolbox> ... </window> notice that i used entity-references for the menu and toolbar labels. the oncommand event is hooked up to javascript, just like an onclick in html. the javascript is contained in the main.js file. xul has a way to centralize commands and event handlers for menus and toolbars that do the same thing, like open and save in the above example. you can
add a <commandset> and <command> elements like this: <commandset> <command id="cmd_open" label="&file.open;" oncommand="dofileopen();"/> <command id="cmd_save" label="&file.save;" oncommand="dofilesave();"/> </commandset> ... <menuitem command="cmd_open"/> <menuitem command="cmd_save"/> ... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ... we can ...
... a <commandset> and <command> elements like this: <commandset> <command id="cmd_open" label="&file.open;" oncommand="dofileopen();"/> <command id="cmd_save" label="&file.save;" oncommand="dofilesave();"/> </commandset> ... <menuitem command="cmd_open"/> <menuitem command="cmd_save"/> ... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ... we can
add images to the toolbar buttons through the css file. we could hard-code the images in the xul file itself, but css is a better practice. here’s the css file: /* global skin --------------------------------------------------- */ @import url(chrome://global/skin/); /* toolbar ------------------------------------------------------- */ #open { list-style-image: url(chrome://basicapp/skin/open.pn...
calICalendarView - Archive of obsolete content
s, and sometimes show only the single date passed in. this allows lack of required predictability allows calicalendarview implementations to be re-used in a variety of sitatuations. it also fueled the development, however, of the more predictable, but less flexible calidecoratedview, which usually contains an embedded calicalendarview. calendar/base/public/calicalendarview.idlscriptable please
add a summary to this article. last changed in gecko ? interface code [scriptable, uuid(3e567ccb-2ecf-4f59-b7ca-bf42b0fbf24a)] interface calicalendarview : nsisupports { attribute calicalendar displaycalender; attribute calicalendarviewcontroller controller; void showdate(in calidatetime adate); void setdaterange(in calidatetime astartdate, in calidatetime aenddate); readonly at...
...lecteditem; attribute calidatetime selectedday; attributes displaycalendar the displaycalendar is an implementation of the calicalendar interface. as implemented here, it corresponds to the calendar containing all of the calievents and calitodos that shoud be shown in the view. in the vast majority of cases, this is calicompositecalendar. notice that a calicalendarview does not contain any
additem or refresh methods. therefore, it makes sense for an implementation of calicalendarview to
add a caliobserver to the its displaycalendar in order to be notified of
additions, modifications, and deletions of items it may be displaying. note that in most cases, this attribute will be set by the consumers of calicalendarview very early in an application/extension's loading process. controller ...
...licalendarview very early in an application/extension's loading process. startdate returns a calidatetime corresponding to the first date shown by the view enddate returns a calidatetime corresponding to the last date shown by the view. note that this date is typically not immediately useful for querying for the events and tasks shown in the calicalendarview. typically, one more day must be
added to it, in order to make it exclusive. supportsdisjointdates consumers of calicalendarview should check this attribute to determine whether or not the implementation allows for calls to setdatelist. if an implementation returns true for this attribute, it must allow for any arbitrary set of dates to be displayed. hasdisjointdates returns false if the dates being displayed represent a conti...
nsIContentPolicy - Archive of obsolete content
. shouldload() will never get this, because it does not represent content to be loaded (the actual load triggered by the refresh will go through shouldload() as expected). shouldprocess() will get this for, for example <meta> refresh elements and http refresh headers. type_xbl 9 indicates an xbl binding request, triggered either by -moz-binding css property or the document.
addbinding() method. type_ping 10 indicates a ping triggered by a click on an <a> element using the ping attribute. type_xmlhttprequest 11 indicates an xmlhttprequest. also used for document.load() type_object_subrequest 12 indicates a request by a plugin. type_dtd 13 indicates a dtd loaded by an xml document. type_font 14 ind...
... the current request on this server, not to future requests of the same type. reject_other -4 returned from shouldload() or shouldprocess() if the load/process is rejected based on some other criteria. mozilla callers will handle this like reject_request; third-party implementors may, for example, use this to direct their own callers to consult the extra parameter for
additional details. note: this rejection only applies to the current request on this server, not to future requests of the same type. accept 1 returned from shouldload() or shouldprocess() if the load or process request is not rejected. other 0 obsolete since gecko 1.8 script 1 obsolete since gecko 1.8 image 2 obsolete sin...
.... } // 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* previous = 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, &previous); javascript developers can also implement an xpcom component that extends nsicontentpolicy. ...
2006-11-10 - Archive of obsolete content
publication for the first issue is expected in fall 2007. ...
...and tuesday 08th may 2007 notable keynotes representatives from w3c, ibm, university of manchester, uk and oxford brookes university, uk. read more... discussions 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 previous 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 nume...
...skeys 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 gijs kruitbosch and aaron leventhal have proposed an accessibility project involving chatzilla. ideas include:
adding standardized shortcuts clc-4-tts and/or other screenreader integration screenreader integration via an accessibility api discussion on the use of the <tab> key. meetings none ...
2006-10-27 - Archive of obsolete content
ling since october 22 at around 5:45 pm pdt. gavin responded to tony's posting saying that the log file shows a "no space left on device" error when trying to link the final executable. on the same day tony replied to gavin's posting stating the possible choices to solve the problem. ...
... he also mentioned that the tinderbox is just a virtual machine, so you can easily allocate more space to it as need, assuming the host has some available. ...
...ng. october 27: alex responded to peter weilbacher posting stating that he is going to look for a solaris newsgroup because he is not sure how to check if the library is installed or where to get the packages. october 26: masaki responded to alex's posting by providing a link to a similar bug that provides a work around to the problem he was having. the solution that masaki suggested was to
add "-l/usr/sfw/lib" into moz_cairo_libs of config/autoconf.mk. moz_cairo_libs = -l$(libxul_dist)/lib -lmozcairo -lmozlibpixman \ -l/usr/sfw/lib -lxrender -lfreetype -lfontconfig october 27: alex replied to masaki posting, stating that he was going to use the work around that he provided and would provide feedback if it was successful or not. later that day alex able to successful complete hi...
Monitoring plugins - Archive of obsolete content
the topic contains the notification's topic - experimental-notify-plugin-call in this case, the data is the runtime in milliseconds and the subject is always...
...rver services for the "experimental-notify-plugin-call" topic register: function() { if (this.registered == false) { //this check prevents double registration -- something you want to avoid!! ...
... from the observer services unregister: function() { if (this.registered == true) { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "experimental-notify-plugin-call"); this.registered = false; } } }
additional resources more information on the observer service: nsiobserverservice nsiobserver ...
Adobe Flash - Archive of obsolete content
ecting the right flash plugin (and browser) adobe flash has exposed the scriptability feature in netscape gecko browsers since flash 6r49 and later. versions of flash prior to flash 6r49 (such as flash 5) are not scriptable in netscape gecko browsers. thus client-side detection for the right version of flash is an important aspect of creating a scripted flash experience. on mac os x, there is an
additional caveat: netscape gecko browsers such as camino (formerly chimera), the latest mozilla browsers, and future versions of netscape which are built using the mach-o binary format won't be able to use flash's scriptability features. until macromedia changes this from within the flash plugin, scriptability can not be used on mac os x browsers based on gecko. the example below shows a detection h...
...lso 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 this down the road. when information about when this problem on mac os x will be
addressed becomes available, the constant can be updated to reflect something less arbitrary. a complete code listing which expands on the above approach can be found in the flashversion.js file used in the samples. performance and flash as is the case with any plug-in content, flash content has the potential to slow down or even completely stall not just the tab it's running in, but the entire bro...
...h content has the potential to slow down or even completely stall not just the tab it's running in, but the entire browser and even the entire computer it's being used on. avoiding poorly-written or unnecessary flash content is crucial to ensuring the user has a positive experience on not just your site, but the entire web. as part of mozilla's effort to improve the user experience, a feature was
added in firefox 49 that automatically blocks certain flash modules that have little or no user-noticeable impact from being used. these block-listed modules include various fingerprinting and http_cookie#supercookie modules. in the future, other modules may be blocked as well. and, of course, eventually flash support will be removed from firefox entirely. most of its functions can be reproduced usin...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
the downside to this method is that once the plugin is installed, it might be difficult for users to upgrade, uninstall, or disable the plugin. as of firefox 3 (and any gecko 1.9 based application) the use of install.js scripts is no longer supported and plugins must either be shipped as an executable installer or in a bundle as described here. bundle structure toolkit bundles can be used for all
add-ons including extensions, themes and plugins. plugin packages should only need to package a small set of files in the following structure in the xpi file: install.rdf plugins/ pluginlib.dll plugintypes.xpt the install.rdf file contains an install manifest that describes the plugin to the user. the library and scripting interfaces are held in the plugins directory. platform-specific files...
...m:name> <em:version>1.0</em:version> <em:targetapplication> <description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minversion>1.5</em:minversion> <em:maxversion>4.0.*</em:maxversion> </description> </em:targetapplication> <em:unpack>true</em:unpack> </description> </rdf> this contains 5 required pieces of information. every
add-on must have a unique id. this can be in a guid form but the simpler email form is preferred now. you should aim to use a domain-name that you own and then your own unique short-name for the plugin before the @. the plugin must have a name to identify the plugin to the user in the list of
add-ons. the version is fairly self-descriptive, it must be a toolkit version format. the target applicati...
... the application id and the minimum and maximum version of the application that the plugin works with. there can be multiple targetapplication blocks listed. the unpack property is necessary to tell applications using newer versions of gecko to unpack the plugin because dlls can't be loaded from xpi files. providing updates when plugins are packaged in this way they can make use of the built in
add-on update system. this allows a remote update file to be read periodically and an updated version of the plugin offered to the user or to mark the plugin as compatible with a wider range of applications. this is performed by including an updateurl in the install manifest. this should point to an update.rdf file on the internet which will include the updated versions and version information for th...
Tamarin Tracing Build Documentation - Archive of obsolete content
and to create a copy of the tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-tracing tamarin-tracing building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable, avmshell, for executing files in the abc file format. running avmshell without any arguments will list the available options. note that
additional command-line arguments are only available in the debug configuration. the tamarin codebase contains a cross-platform build system for mozilla developers. the cross-platform build system is used for daily automated build testing so it is the most reliable system. the tamarin codebase has the ability to build
additional code which supports debugging hooks. in the xcode project, this is the d...
...(gnu make 3.80 does not work. nor does any other brand of make.) with the right prerequisites, use these commands to build tamarin tracing: $ hg clone http://hg.mozilla.org/tamarin-tracing $ cd tamarin-tracing $ mkdir objdir-debug $ cd objdir-debug $ python ../configure.py --enable-shell $ make ... ...
...directed to brent baker how to setup a user repository with the source and patches that will be compiled. documentation on how to setup a user repository http://developer.mozilla.org/en/publishing_mercurial_clones. push any changes that you want to test into this repository. request a 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 ...
Scratchpad - Archive of obsolete content
, as shown below: the icon next to each suggestion indicates the type, and the currently highlighted suggestion gets a popup with more information. ↑ and ↓ cycle through the suggestions and enter or tab select the highlighted choice. inline documentation to show the inline documentation popup, press ctrl + shift + space when the cursor is on an identifier. for example, if you type document.
addeventlistener, then press ctrl + shift + space, you'll see a popup that shows a summary of the function's syntax and a short description: the "[docs]" link takes you to the mdn documentation for the symbol. executing once you've written your code, select the code you want to run. if you don't select anything, all the code in the window will be run. then choose the way you want the code to run u...
...ol. executing once you've written your code, select the code you want to run. if you don't select anything, all the code in the window will be run. then choose the way you want the code to run using the buttons along the top, using the execute menu, or using the context menu. the code is executed in the scope of the currently selected tab. any variables you declare outside of a function will be
added to the global object for that tab. there are four execution options available. run when you choose the run option, the selected code is executed. this is what you'd use to execute a function or other code that manipulates the content of your page without needing to see the result. inspect the inspect option executes the code just like the run option; however, after the code returns, an ob...
...tion is only available in the execute menu. it first reloads the page, then executes the code when the page's "load" event fires. this is useful for running the code in a pristine environment. running scratchpad in the browser context you can run scratchpad in the context of the browser as a whole rather than a specific web page. this is useful if you are working on firefox itself or developing
add-ons. to do this check "enable chrome and
add-on debugging" in the developer tool settings. once you've done this, the environment menu has a browser option; once that's selected, your scope is the entire browser rather than just the page content, as you will see from examining some globals: window /* [object chromewindow] */ gbrowser /* [object xulelement] */ the scratchpad execution context i...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
« previousnext » 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 (previous 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 previous 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...
... 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. ...
...y. update the chrome manifest remember way back in the first article in this series when we created our chrome manifest, which we haven't touched since? it's time to touch it. as you may (or may not) recall, that file tells the application what xul code your extension's interface needs to overlay onto. for firefox, we overlaid onto browser.xul, which describes a firefox browser window. ...
Using SSH to connect to CVS - Archive of obsolete content
on which the http tunnel is running. the usual cvs commands should now work. avoiding passphrase requests you can avoid repeated passphrase requests by using ssh-agent. if you don't already run ssh-agent on your computer, it's probably easiest to start it up whenever you set up your environment to checkout and build mozilla. assuming you use a shell script or batch file to set things up, just
add the commands below to the end of your file. posix shell eval `ssh-agent -s` ssh-
add ~/.ssh/id_dsa $shell ssh-agent -k exit x windows in "~/.xinitrc"
add "ssh-
add". this will bring up a graphic box just after login, and before the desktop loads, asking for your passphrase. the passphrase will be held for the length of the x session, and be passed on to all child shells. ms-dos command prompt...
...sh-
add". this will bring up a graphic box just after login, and before the desktop loads, asking for your passphrase. the passphrase will be held for the length of the x session, and be passed on to all child shells. ms-dos command prompt cygwin for /f "tokens=1,2,3* delims=; " %%a in ('ssh-agent -c') do if "%%a"=="setenv" set %%b=%%c set home=/cygdrive/c/path/to/your/cygwin/home/directory ssh-
add ~/.ssh/id_dsa start /b /wait cmd.exe ssh-agent -k exit essentially both sets of commands do the same thing. first ssh-agent is called and its output is evaluated in the current environment. this sets environment variables that let cvs know how to find and use the agent. your private key is then
added to ssh-agent using ssh-
add at which point you will be prompted for the key's passphrase. since ...
...he commands for the ms-dos command prompt. first of all they will only work in versions of windows based on nt (nt/2000/xp). if you're building on win9x/winme you'll need to find an alternative solution. if you're typing the commands directly (as opposed to storing them in a batch file that you call), you'll need to replace the occurances of "%%" in the first line with "%". finally, note that ssh-
add needs the environment variable home to be set with the cygwin path to your cygwin home directory. mozillabuild if you're using mozillabuild, ssh-agent should be started when you run the start-msvc???.bat file. you should be prompted to enter your passphrase. mozillabuild 1.2 contains a bug that will stop ssh-agent from automatically starting with msys. to fix this, apply this diff to c:\mozill...
Using workers in extensions - Archive of obsolete content
« previous 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 previous 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 previous 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 ba...
... start up and configure the worker. let's take a look: startup: function() { // register to receive notifications of preference changes this.prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice) .getbranch("stockwatcher2."); this.prefs.queryinterface(components.interfaces.nsiprefbranch2); this.prefs.
addobserver("", this, false); this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.worker = new worker("chrome://stockwatcher2/content/ticker_worker.js"); // small little dance to get 'this' to refer to stockwatcher, not the // worker, when a message is received. var self = this; this.worker.onmessage = function(event) { self.onworkermessage.call(s...
... 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 previous 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, which standard workers do not have. ...
Array.observe() - Archive of obsolete content
however, this api has been deprecated and removed from browsers. you can use the more general proxy object instead. syntax array.observe(arr, callback) parameters arr the array to be observed. ...
...e array to be observed. callback the function called each time changes are made, with the following argument: changes an array of objects each representing a change. the properties of these change objects are: name: the name of the property which was changed. object: the changed array after the change was made. type: a string indicating the type of change taking place. one of "
add", "update", "delete", or "splice". oldvalue: only for "update" and "delete" types. the value before the change. index: only for the "splice" type. the index at which the change occurred. removed: only for the "splice" type. an array of the removed elements.
addedcount: only for the "splice" type. the number of elements
added. description the callback function is called ea...
...s. index assignment changes which do not change the length of the array may be reported as "update" changes. examples logging different change types var arr = ['a', 'b', 'c']; array.observe(arr, function(changes) { console.log(changes); }); arr[1] = 'b'; // [{type: 'update', object: <arr>, name: '1', oldvalue: 'b'}] arr[3] = 'd'; // [{type: 'splice', object: <arr>, index: 3, removed: [],
addedcount: 1}] arr.splice(1, 2, 'beta', 'gamma', 'delta'); // [{type: 'splice', object: <arr>, index: 1, removed: ['b', 'c'],
addedcount: 3}] specifications strawman proposal specification. ...
Expression closures - Archive of obsolete content
unction [name]([param1[, param2[, ..., paramn]]]) expression parameters name the function name. can be omitted, in which case the function is anonymous. the name is only local to the function body. paramn the name of an argument to be passed to the function. a function can have up to 255 arguments. expression the expression which comprise the body of the function. ...
...ich comprise the body of the function. description this
addition is nothing more than a shorthand for writing simple functions, giving the language something similar to a typical lambda notation. javascript 1.7 and older: function(x) { return x * x; } javascript 1.8: function(x) x * x this syntax allows you to leave off the braces and 'return' statement - making them implicit. there is no
added benefit to writing code in this manner, other than having it be syntactically shorter. ...
...hing similar to a typical lambda notation. javascript 1.7 and older: function(x) { return x * x; } javascript 1.8: function(x) x * x this syntax allows you to leave off the braces and 'return' statement - making them implicit. ...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
y discover that they need more processes to give them greater control, which allows them to more easily plan and predict. with processes, organizations can make release schedules, implement marketing plans, analyze resource allocations, and make adjustments when needed. adherence to standards and processes can actually provide a level of flexibility because development does become predictable. in
addition to predictability, standard processes improve understanding and streamline costs. common development process as an organization matures, managers and engineers develop a fundamental understanding of the importance of requiring adherence to these processes. when projects are proposed, they are evaluated to ensure compatibility with the overall business strategy. product marketing must then ...
...rox eventually had to shut down the production of their workstation development because of escalating manufacturing and developing costs and slowed sales. xerox’s biggest asset in the beginning became its weapon of destruction. they settled on a proprietary environment, and missed the opportunity to make their environment the benchmark – and set the standard. following open standards has an
added benefit. when it is necessary for an organization to interact with other applications through alliances, merger, or acquisition, the integration and interoperability is much less costly if all parties involved follow the standards from the outset. consistent standards significantly reduce development re-work, and ensure consistent and predictable behavior from one application to the next. user...
... standards significantly reduce development re-work, and ensure consistent and predictable behavior from one application to the next. user experience & goodwill customer retention and market expansion is critical. when customers choose to use a particular product, they must have a positive experience with consistent, reliable, and predictable behavior. as users become more sophisticated, and as
additional devices become more affordable, they will be accessing the same information across a variety of devices – and expect them to look and act the same – regardless of whether they are accessing a web site from their desktop, phone, or handheld. consequently, if an organization offers a suite of products they must ensure that the user experience is consistent and predictable across the prod...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
. the codebase attribute used above points to a location that houses the cab file containing the activex control. in this context, the codebase attribute is used as an obtainment mechanism -- that is to say, a way to obtain a control if it isn't present. if the flash activex control is not installed, ie will then go to the url referenced by the codebase attribute and retrieve the activex control.
additional param elements (which are "children" of the above object element) specify configuration parameters for the flash plugin. for instance, the param name="movie" tells the flash plugin the location of the swf file to start playing. with the release of netscape 7.1, this kind of activex use of the object element is supported for use with the microsoft® windows media player. only the windows m...
...voke the netscape-specific flash architecture in mozilla-based browsers. the data attribute points to the swf file to play, and the configuration parameters (the param elements) are used in a consistent manner both for ie and for mozilla-based browsers such as netscape 7. in fact, the above usage will also work for ie, which understands mime type invocations for certain mime types such as flashin
addition to activex-style classid invocations. since the use of mime type for flash will work for both ie and netscape 7, you can use the above markup to invoke the flash plugin for both ie and netscape 7. however, there are a few caveats that developers ought to bear in mind when using the object element with mozilla-based browsers such as netscape 7 and in ie: caveats if you use one single obj...
...rnate innermost text. it won't attempt to retrieve a missing plugin using the netscape plugin finder service. this behavior is not incorrect according to the html 4.01 specification, but it obliges web authors to diligently specifyobtainment mechanisms. at a minimum, web authors will have to nest some alternate text inside their object elements telling users where to obtain the missing component.
adding an
additional layer of convenience in the form of automatic retrieval is the subject of a bug 180411 in the mozilla open source code. some plugins don't understand all the param elements that their documentation suggests should configure them in mozilla-based browsers. an example is versions of the macromedia flash player plugin upto flash player 6 r. 47, which don't understand the <param ...
Bounding volume collision detection with THREE.js - Game development
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 spheres instantiating sphere objects is similar. we need to provide the sphere's center and radius, which can be
added to the boundingsphere property available in geometry. var knot = new three.mesh( new three.torusknotgeometry(0.5, 0.1), new meshnormalmaterial({})); var knotbsphere = new sphere( knot.position, knot.geometry.boundingsphere.radius); unfortunately, there is no equivalent of box3.setfromobject for sphere instances. so if we apply transformations or change the position of the mesh, we n...
...erial material (a three.js material for drawing wireframe-style geometries). the main disadvantage is that it only creates box bounding volumes, so if you need spheres vs aabb tests you need to create your own sphere objects. to use it, we need to create a new boxhelper instance and supply the geometry and — optionally — a color that will be used for the wireframe material. ...
... var box3 = new three.box3(); box3.setfromobject(knotboxhelper); if we change the mesh position, rotation, scale, etc. ...
Implementing controls using the Gamepad API - Game development
g a gamepad connected — click the gamepad icon in the top right corner of the screen. it will launch the game in the super turbo mode and you'll be able to control the fridge with the keyboard: a and d for turning the turret left and right, w for shooting and arrow keys for movement. implementation there are two important events to use along with the gamepad api — gamepadconnected and gamep
addisconnected. the first one is fired when the browser detects the connection of a new gamepad while the second one is fired when a gamepad is disconnected (either physically by the user or due to inactivity.) in the demo, the gamepadapi object is used to store everything related to the api: var gamepadapi = { controller: {}, turbo: false, connect: function() {}, disconnect: function() {}, ...
...-down','dpad-left','dpad-right', 'start','back','axis-left','axis-right', 'lb','rb','power','a','b','x','y', ], this can be different for other types of gamepads like the ps3 controller (or a no-name, generic one), so you have to be careful and not just assume the button you're expecting will be the same button you'll actually get. next, we set up two event listeners to get the data: window.
addeventlistener("gamepadconnected", gamepadapi.connect); window.
addeventlistener("gamep
addisconnected", gamepadapi.disconnect); due to security policy, you have to interact with the controller first while the page is visible for the event to fire. if the api worked without any interaction from the user it could be used to fingerprint them without their knowledge. both functions are fairly simple: ...
...is now an enumerable object instead of a string: enum gamepadmappingtype { "", "standard" }; this enum defines the set of known mappings for a gamepad. for now, there's only the standard layout available, but new ones may appear in the future. if the layout is unknown, it is set to an empty string. events there were more events available in the spec than just gamepadconnected and gamep
addisconnected available, but they were removed from the specification as they were thought to not be very useful. the discussion is still ongoing as to whether they should be put back, and in what form. summary the gamepad api is very easy to develop with. now it's easier than ever to deliver a console-like experience to the browser without the need for any plugins. you can play the full version o...
Bounce off the walls - Game development
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. ...
...as> element as walls and not let the 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 previous 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 no...
... « previousnext » ...
Initialize the framework - Game development
tructure 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. ...
...e simple, as the game will be rendered entirely on the <canvas> element generated by the framework. ...
...e source code smaller, and you are unlikely need to go through the source code anyway. save the phaser code inside a /js directory in the same location as your index.html file. update the src value of the first <script> element as shown above. walking through what we have so far at this point we have a charset defined, <title> and some basic css in the header to reset the default margin and p
adding. we also have a <script> element to apply the phaser source code to the page. the body contains a second <script> element, where we will write the javascript code to render the game and control it. the <canvas> element is generated automatically by the framework. we are initializing it by creating a new phaser.game object and assigning it to the game variable. the parameters are: the width...
Load the assets and print them on screen - Game development
« previousnext » this is the 3rd step out of 16 in the gamedev phaser tutorial. 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 p
addle, 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 purpose of the tutorial is to teach phaser-specific approaches to game development rath...
...e will use global variables. the purpose of the tutorial is to teach phaser-specific approaches to game development rather than dwelling on subjective best approaches. loading the ball sprite loading images and printing them on our canvas is a lot easier using phaser than using pure javascript. to load the asset, we will use the game object created by phaser, executing its load.image() method.
add the following new line just inside the preload() function, at the bottom: function preload() { // ... game.load.image('ball', 'img/ball.png'); } the first parameter we want to give the asset is the name that will be used across our game code — for example, in our ball variable name — so we need to make sure it is the same. the second parameter is the relative path to the graphic as...
... for our ball. (note that the file name does not also have to be the same, but we'd recommend it, as it makes everything easier to follow.) of course, to load the image, it must be available in our code directory. grab the ball image from github, and save it inside an /img directory in the same place as your index.html file. now, to show it on the screen we will use another phaser method called
add.sprite();
add the following new code line inside the create() function as shown: function create() { ball = game.
add.sprite(50, 50, 'ball'); } this will
add the ball to the game and render it on the screen. the first two parameters are the x and y coordinates of the canvas where you want it
added, and the third one is the name of the asset we defined earlier. that's it — if you load you...
Scaling - Game development
ide 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, this is more of an advanced mode the other two lines of code in the preload() function are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size. ...
... mode. user_scale — allows you to have custom dynamic scaling, calculating the size, scale and ratio on your own; again, this is more of an advanced mode the other two lines of code in the preload() function are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size. ...
...in the preload() function are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size.
adding a custom canvas background colour we can also
add a custom background color to our canvas, so it won't stay black. the stage object has a backgroundcolor property for this purpose, which we can set using css color definition syntax.
add the following 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. ...
Gecko FAQ - Gecko Redirect 1
ompanies release their own software and hardware products that use gecko. see xulrunner hall of fame for a partial list of application that use gecko via xulrunner. third parties such as isvs and hardware vendors will pick and choose the components they want to use in their applications or hardware devices. certain browser components are not provided as part of gecko, such as bookmarks, history,
address book, etc. however, the source for all those components is available for free download from mozilla.org. why was gecko built? the original mozilla browser, first released as navigator 1.0, was developed rapidly by a small team that was passionate about creating the next killer app, and they succeeded. now that the web has evolved, a new generation layout engine was needed upon which future ...
..., abbr, axis, headers, scope-row, scope-col, scope-rowgroup, scope-colgroup, charoff, datasrc, datafld, dataformat, datapagesize, summary, event, dir, align on table columns, label attribute of option, alternate text of area elements, longdesc various metadata attributes: cite, datetime, lang, hreflang bidirectional text layout, which is only used in hebrew and arabic (ibm has begun work to
add bidi support in a future release) style sheets css 1 - full support, except for: the application of styles to html column elements the ability to turn off author styles the names of certain mozilla extension pseudo-classes lack the moz- prefix css 2 - partial support is expected and has already been built into gecko, including support for css2 positioni...
...support for these standards makes gecko the platform of choice for web content and web application developers worldwide. are gecko's apis based on activex? com? javabeans? gecko is reusable on all platforms thanks to xpcom, a subset of com that works across platforms. com, developed by digital and later adopted by microsoft, is the de facto standard for modular interfaces on windows platforms.
additionally, on the windows platform, gecko's xpcom interfaces are wrapped in an activex control that vb developers can utilize (activex wrappers are not available on other platforms because activex is a windows-only technology). a javabean wrapper is not currently under development, but there is nothing in gecko's architecture that precludes such development in the future. source code and document...
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
a call stack is a mechanism for an interpreter (like the javascript interpreter in a web browser) to keep track of its place in a script that calls multiple functions — what function is currently being run and what functions are called from within that function, etc. when a script calls a function, the interpreter
adds it to the call stack and then starts carrying out the function. any functions that are called by that function are
added to the call stack further up, and run where their calls are reached. when the current function is finished, the interpreter takes it off the stack and resumes execution where it left off in the last code listing. if the stack takes up more space than it had assigned to it, it results in a "stack overflow" error. example function greeting() ...
...han it had assigned to it, it results in a "stack overflow" error. example function greeting() { // [1] some codes here sayhi(); // [2] some codes here } function sayhi() { return "hi!"; } // invoke the `greeting` function greeting(); // [3] some codes here the code above would be executed like this: ignore all functions, until it reaches the greeting() function invocation.
add the greeting() function to the call stack list. call stack list: - greeting execute all lines of code inside the greeting() function. get to the sayhi() function invocation.
add the sayhi() function to the call stack list. call stack list: - sayhi - greeting execute all lines of code inside the sayhi() function, until reaches its end. return execution to the line...
...call stack list. call stack list: - greeting when everything inside the greeting() function has been executed, return to its invoking line to continue executing the rest of the js code. delete the greeting() function from the call stack list. call stack list: empty in summary, then, we start with an empty call stack. whenever we invoke a function, it is automatically
added to the call stack. once the function has executed all of its code, it is automatically removed from the call stack. ultimately, the stack is empty again. learn more general knowledge call stack on wikipedia ...
Vendor Prefix - MDN Web Docs Glossary: Definitions of Web-related terms
browser vendors sometimes
add prefixes to experimental or nonstandard css properties and javascript apis, so developers can experiment with new ideas while—in theory—preventing their experiments from being relied upon and then breaking web developers' code during the standardization process. developers should wait to include the unprefixed property until browser behavior is standardized. browser vendors are working to stop using vendor prefixes for experimental features. web developers have been using them on production web sites, despite their experimental nature. ...
...operty until browser behavior is standardized. browser vendors are working to stop using vendor prefixes for experimental features. web developers have been using them on production web sites, despite their experimental nature. this has made it more difficult for browser vendors to ensure compatibility and to work on new features; it's also been harmful to smaller browsers who wind up forced to
add other browsers' prefixes in order to load popular web sites. lately, the trend is to
add experimental features behind user-controlled flags or preferences, and to create smaller specifications which can reach a stable state much more quickly. css prefixes the major browsers use the following prefixes: -webkit- (chrome, safari, newer versions of opera, almost all ios browsers including fire...
...sage: -webkit-transition: all 4s ease; -moz-transition: all 4s ease; -ms-transition: all 4s ease; -o-transition: all 4s ease; transition: all 4s ease; api prefixes historically, vendors have also used prefixes for experimental apis. if an entire interface is experimental, then the interface's name is prefixed (but not the properties or methods within). if an experimental property or method is
added to a standardized interface, then the individual method or property is prefixed. interface prefixes prefixes for interface names are upper-cased: webkit (chrome, safari, newer versions of opera, almost all ios browsers (including firefox for ios); basically, any webkit based browser) moz (firefox) o (older, pre-webkit, versions of opera) ms (internet explorer and microsoft edge) prope...
Creating fancy letterheaded paper - Learn web development
l free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been 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. ...
...ion at the bottom of this page. project brief you have been 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 previous 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 previous declaration. ...
...s a semi-transparent gradient over the top of both of the previous 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 previous declaration.
add a white background color to the letter.
add a 1mm top and bottom solid border to the letter, in a color that is inkeeping with the rest of the color scheme. the logo to the <h1>,
add the logo as a background image.
add a filter to the logo to give it a subtle drop shadow. now comment out the filter and implement the drop shadow in a different (slightly more cross-browser compatible) way, ...
Test your skills: Selectors - Learn web development
make the background red. if the element with a class of alert also has a class of go, make the background green. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors three in this example, try making the following changes without
adding to the html. style links, making the link-state orange, visited links green, and remove the underline on hover. make the first element inside the container font-size: 150% and the first line of that element red. stripe every other row in the table by selecting these rows and giving them a background color of #333 and foreground of white. try updating the live code below to recreate th...
...m a background color of #333 and foreground of white. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors four in this task try the following: make any paragraph that directly follows an h2 element red. ...
... target the <a> element with an href attribute that contains the word contact somewhere in its value and make the border orange (border-color: orange). ...
Test your skills: backgrounds and borders - Learn web development
rned in the previous lesson. 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.
add a background image (use the url balloons.jpg) and size it so that it covers the box. give the <h2> a semi-transparent black background color, and make the text white. the finished example should look like the image below. try updating the live code bel...
... size it so that it covers the box. give the <h2> a semi-transparent black background color, and make the text white. 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. backgrounds and borders 2 in this task we want you to
add background images, a border, and some other styling to a decorative 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 i...
...an 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 yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum.
add the "learning" tag to your post so we are able to more easily find it. your post should include: a descriptive title such as "assessment wanted for flexbox layout 1 skill test". details of what you would like us 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. this is a g...
CSS first steps - Learn web development
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. ...
... 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. ...
...you find any later concepts confusing. how css works we have learned the basics of css, what it is for and how to write simple stylesheets. in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. using your new knowledge with the things you have learned in the last few lessons you should find that you can format simple text documents using css, to
add your own style to them. this article gives you a chance to do that. ...
Web fonts - Learn web development
ica, "trebuchet ms", verdana, sans-serif; } this system works well, but traditionally web developers' font choices were limited. there are only a handful of fonts that you can guarantee to be available across all common systems — the so-called web-safe fonts. you can use the font stack to specify preferable fonts, followed by web-safe alternatives, followed by the default system font, but this
adds overhead in terms of testing to make sure that your designs look ok with each font, etc. web fonts but there is an alternative, which works very well, right back to ie version 6. web fonts are a css feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that supports web fonts can have exactly the fonts you specify ava...
...ugh: active learning: a web font example with this in mind, let's build up a basic web font example from first principles. it is difficult to demonstrate this using an embedded live example, so instead, we would like you to follow the steps detailed in the below sections, to get an idea of the process. you should use the web-font-start.html and web-font-start.css files as a starting point to
add your code to (see the live example). make a copy of these files in a new directory on your computer now. in the web-font-start.css file, you'll find some minimal css to deal with the basic layout and typesetting of the example. finding fonts for this example, we'll use two web fonts, one for the headings, and one for the body text. to start with, we need to find the font files that contain the ...
... the stylesheet.css file and copy both the @font-face blocks contained inside into your web-font-start.css file — you need to put them at the very top, before any of your css, as the fonts need to be imported before you can use them on your site. each of the url() functions points to a font file that we want to import into our css — we need to make sure the paths to the files are correct, so
add fonts/ to the start of each path (adjust as necessary). now you can use these fonts in your font stacks, just like any web safe or default system font. for example: font-family: 'zantrokeregular', serif; you should end up with a demo page with some nice fonts implemented on them. because different fonts are created at different sizes, you may have to adjust the size, spacing, etc., to sort...
What text editors are available? - Learn web development
computer science). ideally, you'd try as many editors as you can and get a feel for what suits your workflow. but we'll give you some pointers for getting started. here are the primary questions you should consider: which os (operating system) do i want to work with? what kind of technologies do i want to manipulate? what kind of basic features do i expect from my text editor? do i want to
add extra features to my text editor? do i need support/help while using my text editor? does my text editor's look-and-feel matter to me? notice we didn't mention price. obviously, that matters too, but a product's cost has little connection with its quality or capability. there's a big chance you'll find a suitable text editor for free. here are some popular editors: editor licenc...
... if you aren't sure which features you want, or your favorite editor lacks those features out of the box, look for an extensible editor. the best editors provide many plugins, and ideally a way to look for and install new plugins automatically. if you like lots of ...
...if you want hefty customizing you may be better off with an ide. install and set up installing a text editor is usually quite straightforward. the method varies based on your platform but it shouldn't be too hard: windows. the developers will give you an .exe or .msi file. sometimes the software comes in a compressed archive like .zip, .7z, or .rar, and in that case you'll need to install an
additional program to extract the content from the archive. windows supports .zip by default. mac. on the editor's website you can download a .dmg file. some text editors you can find directly in the apple store to make installation even simpler. linux. in the most popular distros you can start with your graphical package manager (ubuntu software center, mintinstall, gnome software, &c.). you can o...
How do you make sure your website works properly? - Learn web development
/ and for unicorn_pic.png means that we succeeded in reloading the page and the image. 304 for basic.css means that this file has not changed since the last request, so the browser can use the file in its cache rather than receiving a fresh copy. so we fixed the error and learned a few http statuses along the way! frequent errors the most frequent errors that we find are these: typos in the
address we wanted to type http://demozilla.examplehostingprovider.net/ but typed too fast and forgot an “l”: the
address cannot be found. indeed. 404 errors many times the error just results just from 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 fil...
... indeed. 404 errors many times the error just results just from 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 prevent 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 simp...
...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 the most common errors you may run across and how to fix them. you can also test if your page meets these criteria: how's the performance? does the page load fast enough? resources like webpagetest.org or browser
add-ons like yslow can tell you a few interesting things: grades go from a to f. our page is just small and meets most criteria. but we can already note it would have been better to use a cdn. that doesn't matter very much when we're only serving one image, but it would be critical for a high-bandwidth website serving many thousands of images. is the server responsive enough? ping is a useful sh...
How much does it cost to do something on the Web? - Learn web development
ess. 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, preview 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. if at some point you need to exchange projects with other designers, you should find out what to...
...o be a registrar (1&1, gandi for instance are at the same time registrars and hosting providers). the domain name usually costs $5-15 per year. this cost varies depending on: local obligations: some country top-level domain names are more costly, as different countries set different prices. services associated with the domain name: some registrars provide spam protection by hiding your postal
address and email
address behind their own
addresses: the postal
address can be provided in care of the registrar, and your email
address can be obscured via your registrar's alias. do-it-yourself hosting vs. “packaged” hosting when you want to publish a website, you could do everything by yourself: set up a database (if needed), content management system, or cms (like wordpress, dotclear, spi...
...blogger). for the latter, you won't have to pay anything, but you may have less control over templating and other options. free hosting vs. paid hosting you might ask, why should i pay for my hosting when there are so many free services? you have more freedom when you pay. your website is yours, and you can migrate seamlessly from one hosting provider to the next. free hosting providers may
add advertising to your content, beyond your control. it is better to go for paid hosting rather than relying on free hosting, as it is possible to move your files easily and uptime is guaranteed by most paid sites. most hosting providers give you a huge discount to start with. some people opt for a mixed approach. for example, their main blog on a paid host with a full domain name, and spontaneou...
How do I use GitHub Pages? - Learn web development
ry; this should bring you to the following page: uploading your files to github on the current page, you are interested in the section …or push an existing repository from the command line. you should see two lines of code listed in this section. copy the whole of the first line, paste it into the command line, and press enter. ...
...of code listed in this section. copy the whole of the first line, paste it into the command line, and press enter. the command should look something like this: git remote
add origin https://github.com/chrisdavidmills/my-repository.git next, type the following two commands, pressing enter after each one. these prepare the code for uploading to github, and ask git to manage these files. git
add --all git commit -m '
adding my files to my repository' finally, push the code up to github by going to the github web page you're on and entering into the terminal the second of the two commands we saw the …or push an existing repository from the command line section: git push -u origin master now you need to turn github pages on for your repository. to do this, from the homepage of you...
... is called something else, for example mypage.html, you'll need to go to https://xxxxxx/mypage.html. further github knowledge if you want to make more changes to your test site and upload those to github, you simply need to make the change to your files just like you did before. then, you need to enter the following commands (pressing enter after each one) to push those changes to github: git
add --all git commit -m 'another commit' git push you can replace another commit with a more suitable message to describe what change you just made. we have barely scratched the surface of git. to learn more, check out our git and github page. ...
Example 2 - Learn web development
: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; p
adding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);...
... #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; p
adding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em...
...t { z-index : 2; list-style: none; margin : 0; p
adding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { p
adding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content window.
addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.
add("widget"); }); result for js no js html content <form class="no-widget"> <select name="myfruit"> <option>cherry</option> <option>lemon<...
Sending form data - Learn web development
in this case we are passing two pieces of data to the server: say, which has a value of hi to, which has a value of mom the http request looks like thi...
... <label for="to">who do you want to say it to?</label> <input name="to" id="to" value="mom"> </div> <div> <button>send my greetings</button> </div> </form> since the get method has been used, you'll see the url www.foo.com/?say=hi&to=mom appear in the browser
address bar when you submit the form. the data is appended to the url as a series of name/value pairs. after the url web
address has ended, we include a question mark (?) followed by the name/value pairs, each one separated by an ampersand (&). in this case we are passing two pieces of data to the server: say, which has a value of hi to, which has a value of mom the http request looks like this: get /?say=hi&to=mom http/2.0 host: foo.com note: you can find this example on github — see get-method.html (see it...
...e data in their url bar, but with a post request they won't. this can be very important for two reasons: if you need to send a password (or any other sensitive piece of data), never use the get method or you risk displaying it in the url bar, which would be very insecure. if you need to send a large amount of data, the post method is preferred because some browsers limit the sizes of urls. in
addition, many servers limit the length of urls they accept. on the server side: retrieving the data whichever http method you choose, the server receives a string that will be parsed in order to get the data as a list of key/value pairs. the way you access this list depends on the development platform you use and on any specific frameworks you may be using with it. example: raw php php offers s...
What will your website look like? - Learn web development
e to be van gogh! note: even on real, complex websites, the design teams usually start out with rough sketches on paper and later on build digital mockups using a graphics editor or web technologies. web teams often include both a graphic designer and a user experience (ux) designer. graphic designers put together the visuals of the website. ux designers have a somewhat more abstract role in
addressing how users will experience and interact with the website. choosing your assets at this point, it's good to start putting together the content that will eventually appear on your webpage. text you should still have your paragraphs and title from earlier. keep these close by. theme color to choose a color, go to the color picker and find a color you like. when you click on a color, you...
...l), and represents your color. copy the code down somewhere safe for now. images to choose an image, go to google images and search for something suitable. when you find the image you want, click on the image to get an enlarged view of it. right-click the image (ctrl + click on a mac), choose save image as..., and choose a safe place to save your image. alternatively, copy the image's web
address from your browser's
address bar for later use. note that most images on the web, including in google images, are copyrighted. to reduce your likelihood of violating copyright, you can use google's license filter. click on the tools button, then on the resulting usage rights option that appears below. you should choose an option such as labeled for reuse. font to choose a font: go t...
...f violating copyright, you can use google's license filter. click on the tools button, then on the resulting usage rights option that appears below. you should choose an option such as labeled for reuse. font to choose a font: go to google fonts and scroll down the list until you find 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. click the "* family selected" button in the panel at the bottom of the page ("*" depends on how many fonts you selected). in the popup box, you can see and copy the lines of code google gives you into your text editor to save for later. previous overview: getting started with the web next in this module installing basic software what will y...
Test your skills: HTML images - Learn web development
ns 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. html images 1 in this task we want you to embed a simple image of some blueberries into the page. you need to:
add the path to the image to an appropriate attribute to embed it on the page. the image is called blueberries.jpg, and it is in a folder inside the current folder called images.
add some alternative text to an appropriate attribute to describe the image, for people that cannot see it. give the <img> element an appropriate width and height so that it displays at the correct aspect ratio, and enough...
...t it displays at the correct aspect ratio, and enough space is left on the page to display it. the image's intrinsic size is 615 x 419 pixels. 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. html images 2 in this task you already have a full-featured image, but we'd like you to
add a tooltip that appears when the image is moused over. you should put some appropriate information into the tooltip. 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. html images 3 in this final task you are provided with both a full-featured image and some caption text. what you n...
...pears when the image is moused over. you should put some appropriate information into the tooltip. 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. html images 3 in this final task you are provided with both a full-featured image and some caption text. what you need to do here is
add elements that will associate the image with the caption. 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 stuck and want to ask for help: ...
Responsive images - Learn web development
at work well on devices with widely differing screen sizes, resolutions, and other such features — and look at what tools html provides to help implement them. 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. a typical website may contain a header image and some content images below the header. the header image will likely span the whole of the width of the header, and th...
...ice. and at this size, it is difficult to see the people within the first content image. an improvement would be to display a cropped version of the image which displays the important details of the image when the site is viewed on a narrow screen. a second cropped image could be displayed for a medium width screen device, like a tablet. this is commonly known as the art direction problem. in
addition, there is no need to embed such large images on the page if it is being viewed on a mobile screen. and conversely, a small raster image starts to look grainy when displayed larger than its original size (a raster image is a set number of pixels wide and a set number of pixels tall, as we saw when we looked at vector graphics). this is called the resolution switching problem. conversely, it ...
...lay identical image content, just larger or smaller depending on the device — this is the situation we have with the second content image in our example. the standard <img> element traditionally only lets you point the browser to a single source file: <img src="elva-fairy-800w.jpg" alt="elva dressed as a fairy"> we can however use two new attributes — srcset and sizes — to provide several
additional source images along with hints to help the browser pick the right one. you can see an example of this in our responsive.html example on github (see also the source code): <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="elva-fairy-800w.jpg" alt="elva dressed as a fairy"> the srcset and si...
Multimedia and Embedding - Learn web development
in a webpage. in this article we'll look at how to use it in more depth, including basics, annotating it with captions using <figure>, and how it relates to css background images. video and audio content next, we'll look at how to use the html5 <video> and <audio> elements to embed video and audio on our pages, including basics, providing access to different file formats to different browsers,
adding captions and subtitles, and how to
add fallbacks for older browsers. from <object> to <iframe> — other embedding technologies at this point we'd like to take somewhat of a sideways step, looking at a couple of elements that 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...
...at this point we'd like to take somewhat of a sideways step, looking at a couple of 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 on its way out, but which you may still see semi-regularly.
adding vector graphics to the web vector graphics can be very useful in certain situations. unlike regular formats like png/jpg, they don't distort/pixelate when zoomed in — they can remain smooth when scaled. this article introduces you to what vector graphics are and how to include the popular svg format in web pages. responsive images in this article, we'll learn about the concept of responsi...
... performance across different devices. ...
Structuring the web with HTML - Learn web development
ted with the web before attempting this topic, however, it isn't absolutely necessary; much of what is covered in the html basics article is also covered in our introduction to html module, albeit in a lot more detail. ...
...utely necessary; much of what is covered in the html basics article is also covered in our introduction to html module, albeit in a lot more detail. after learning html, you can then move on to learning about more advanced topics such as: css, and how to use it to style html (for example alter your text size and fonts used,
add borders and drop shadows, layout your page with multiple columns,
add animations and other visual effects.) javascript, and how to use it to
add dynamic functionality to web pages (for example find your location and plot it on a map, make ui elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.) modules this topic contains the following modules, in a suggested order for working through them. you sho...
... data on a webpage in an understandable, accessible way can be a challenge. this module covers basic table markup, along with more complex features such as implementing captions and summaries. solving common html problems use html to solve common problems provides links to sections of content explaining how to use html to solve very common problems when creating a webpage: dealing with titles,
adding images or videos, emphasizing content, creating a basic form, etc. ...
Function return values - Learn web development
all, make a local copy of the function-library.html file from github. this is a simple html page containing a text <input> field and a paragraph. there's also a <script> element, in which we have stored a reference to both html elements in two variables. this little page will allow you to enter a number into the text box, and display different numbers related to it in the paragraph below. ...
...e containing a text <input> field and a paragraph. there's also a <script> element, in which we have stored a reference to both html elements in two variables. this little page will allow you to enter a number into the text box, and display different numbers related to it in the paragraph below. let's
add some useful functions to this <script> element. ...
...rial() functions to calculate the required values. save your code, load it in a browser, and try it out. note: if you have trouble getting the example to work, feel free to check your code against the finished version on github (see it running live also), or ask us for help. now it's your turn! at this point, we'd like you to have a go at writing out a couple of functions of your own and
adding them to the library. how about the square or cube root of the number? or the circumference of a circle with a given radius? some extra function related tips: look at another example of writing error handling into functions. it is generally a good idea to check that any necessary parameters are validated, and that any optional parameters have some kind of default value provided. this way, y...
Handling text — strings in JavaScript - Learn web development
outh = 'i\'ve got no right to take my place...'; bigmouth; this works fine. you can escape other characters in the same way, e.g. \", and there are some special codes besides. see escape notation for more details. concatenating strings concatenate is a fancy programming word that means "join together". joining together strings in javascript uses the plus (+) operator, the same one we use to
add numbers together, but in this context it does something different. let's try an example in our console. let one = 'hello, '; let two = 'how are you?'; let joined = one + two; joined; the result of this is a variable called joined, which contains the value "hello, how are you?". in the last instance, we joined only two strings, but you can join as many as you like, as long as you include a + ...
...mpt() function in line 4, which asks the user to answer a question via a popup dialog box then stores the text they enter inside a given variable — in this case name. we then use a window.alert() function in line 5 to display another popup containing a string we've assembled from two string literals and the name variable, via concatenation. numbers vs. strings so what happens when we try to
add (or concatenate) a string and a number? let's try it in our console: 'front ' + 242; you might expect this to return an error, but it works just fine. trying to represent a string as a number doesn't really make sense, but representing a number as a string does, so the browser rather cleverly converts the number to a string and concatenates the two strings. you can even do this with two nu...
...t mynum = number(mystring); typeof mynum; conversely, every number has a method called tostring() that converts it to the equivalent string. try this: let mynum = 123; let mystring = mynum.tostring(); typeof mystring; these constructs can be really useful in some situations. for example, if a user enters a number into a form's text field, it's a string. however, if you want to
add this number to something, you'll need it to be a number, so you could pass it through number() to handle this. we did exactly this in our number guessing game, in line 54. template literals another type of string syntax that you may come across is template literals (sometimes referred to as template strings). this is a newer syntax that provides more flexible, easier to read strings. note: t...
Test your skills: Strings - Learn web development
in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). strings 1 in our first strings task, we start off small. you already have half of a famous quote inside a variable called quotestart; we would like you to: look up the other half of the quote, and
add it to the example inside a variable called quoteend. concatenate the two strings together to make a single string containing the complete quote. save the result inside a variable called finalquote. you'll find that you get an error at this point. can you fix the problem with quotestart, so that the full quote displays correctly? try updating the live code below to recreate the finished exampl...
...te that you ended up with in the previous task, but it is somewhat broken! we want you to fix and update it, like so: change the casing to correct sentence case (all lowercase, except for upper case first letter). store the new quote in a variable called fixedquote. in fixedquote, replace "green eggs and ham" with another food that you really don't like. there is one more small fix to do —
add a full stop onto the end of the quote, and save the final version in a variable called finalquote. 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. strings 4 in the final string task, we have given you the name of a theorem, two numeric values, and an incomplete string (the bits...
...p onto the end of the quote, and save the final version in a variable called finalquote. 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. strings 4 in the final string task, we have given you the name of a theorem, two numeric values, and an incomplete string (the bits that need
adding are marked with asterisks (*)). we want you to change the value of the string as follows: change it from a regular string literal into a template literal. replace the four asterisks with four template literal placeholders. these should be: the name of the theorem. the two number values we have. the length of the hypotenuse of a right-angled triangle, given that the two other si...
CSS performance optimization - Learn web development
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. optimizing for render blocking css 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 stylesh...
...he 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 prevent 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 blocking --> <link rel="stylesheet" href="mobile.css" media="screen and (max-width: 480px)"> <!-- not blocking on large screens --> by default the browser assumes that each s...
... <link rel="stylesheet" href="styles.css"> <!-- blocking --> <link rel="stylesheet" href="print.css" media="print"> <!-- not blocking --> <link rel="stylesheet" href="mobile.css" media="screen and (max-width: 480px)"> <!-- not blocking on large screens --> by default the browser assumes that each specified style sheet is render blocking. tell the browser when the style sheet should be applied by
adding a media attribute with the media query. when the browser sees a style sheet it knows that it only needs to apply it for a specific scenario, it still downloads the stylesheet, but doesn't render block. by separating out the css into multiple files, the main render-blocking file, in this case styles.css, is much smaller, reducing the time that rendering is blocked. animating on the gpu browse...
Perceived performance - Learn web development
tips and tricks to help improve performance: minimize initial load to improve perceived performance, minimize the original page load. in other words, first download everything you're going to actually show, but only the stuff you are actually using, then download the rest. if you're downloading all the assets in the end, the weight of all your assets hasn't improved -- in fact, you may need to
add some code -- but because the download of non-immediately necessary assets are delayed in a manner that is not perceptible the the user, the user will feel like the download was faster. to minimize the assets required for initial load, separate interactive functionality from content so that required content -- the text, styles, and images visible at initial load -- can be loaded first. delay, o...
...te interactive functionality from content so that required content -- the text, styles, and images visible at initial load -- can be loaded first. delay, or lazy load, the rest of the assets. don't load images or scripts that aren’t used or visible on the initial page load. either delay their load, loading them when the page becomes usable, or, loading them when they become necessary. loading
additional 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. ...
...nsive. if input elements are visible, the user should be able to interact with them without a lag. users feel that something is laggy when they take more than 50ms to react. they feel that a page is janky when content repaints slower than 16.67ms (or 60 frames per second) or repaints at uneven intervals. make things like type-ahead a progressive enhancement: use css to display input modal, js to
add typeahead/autocomplete as it is available make task initiators appear more interactive making a content request on keydown rather than waiting for keyup can shave 200ms off the perceived load of the content.
adding an interesting but unobtrusive 200ms animation to that keyup even can reduce another 200ms of the perceived load. you're not saving 400ms of time, but the user doesn't feel like they...
What is web performance? - Learn web development
(measurable indicators that can indicate success or failure) and tools to meaure those metrics, which we will discuss throughout this module. to summarize, many features impact performance including latency, application size, the number of dom nodes, the number of resource requests made, javascript performance, cpu load, and more. it is important to minimize the loading and response times, and
add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. note: web performance includes both objective measurements like time to load, frames per second, and time to interactive, and subjective experiences of how long it felt like it took the content to ...
...rk. this includes: how the browser works. when you request a url and hit enter / return, the browser finds out where the server is that holds that website's files, establishes a connection to it, and requests the files. see populating the page: how the browser works for a detailed overview. source order. your html index file's source order can significantly affect performance. the download of
additional assets linked to from the index file is generally sequential, based on source order, but this can be manipulated and should definitely be optimized, realizing that some resources block
additional downloads until their content is parsed and executed. the critical path. this is the process that the browser uses to construct the web document once the files have been downloaded from the serve...
... significant improvements in content rendering time. see critical rendering path for more information. the document object model. the document object model, or dom, is a tree structure that represents the content and elements of your html as a tree of nodes. this includes all the html attributes and the relationships between the nodes. extensive dom manipulation after the pages has loaded (e.g.,
adding, deleting, or moving of nodes) can affect performance, so it is worth understanding how to dom works, and how such issues can be mitigated. find out more at document object model. latency. we mention this briefly earlier on, but in brief, latency is the time it takes for your website assets to travel from the server to a user's computer. there is overhead involved in establishing tcp and http...
JavaScript performance - Learn web development
performance. we'll cover tips and tricks to minimize that impact on download. but javascript can also consume the main thread, the cpu, and the battery. it can make the ui feel unresponsive or janky. we'll introduce concepts for handling that as well. download impact web applications include a lot of javascript. many applications are built with a javascrpit framework, or multiple, with several
additional dependencies. often times third party scripts and apis are
added, including a/b testing, tracking pixels, and features like maps and support features. all of this javascript must be downloaded. eventually. performance optimizatins should include: reducing the amount of javascript that is needed. some features requiring complex javascript can be done with a few lines of javascript. req...
... performance optimizatins should include: reducing the amount of javascript that is needed. some features requiring complex javascript can be done with a few lines of javascript. requiring a library for other features may improve developer experience, but is all that javascript required? is there a lighter weight or home spun solutions? some features may not be necessary, and though they may
add some bling, is the cost of the feature in terms of performance worth it? remove unused code split the javascript into smaller files code-split javascript into critical and non-critical parts. module bundlers like webpack support code-splitting. optimize these smaller files minification reduces the number of characters in your file, thereby reducing the number of bytes or weight of your jav...
... characters in your file, thereby reducing the number of bytes or weight of your javascript. gzipping compresses the file further, and should be used even if you don't minify. brotli is similar to gzip, generally outperforming gzip's compression. render impact web applications include a lot of javascript. many applications are built with a javascrpit framework, or multiple, with several
additional dependencies. often times third party scripts and apis are
added, including a/b testing, tracking pixels, and features 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 s...
Learning area release notes - Learn web development
this page details significant changes made to the learning area. check back here if you want to know what new content is available, and what existing content has been improved. if you want to give feedback on any of these new
additions, please leave comments in our discourse forum. june 2020 our front-end web developer learning pathway is officially launched! check it out for an opinionated pathway to follow for learning front-end development! also see our hacks post — introducing the mdn web docs front-end developer learning pathway — for more information about the rationale behind it. may 2020 our understanding client-side javascript frameworks module is now available. learn why frameworks exist, when you should use one (and when you shouldn't), what kinds of features are common t...
... forms, and moved out of the html topic area to recognise that it covers more than just html form elements — it also covers styling, validation, the basics of how to send data and process it on the server, and more besides. it has new examples available and techniques covered. it has a new structure to make for a more effective learning experience. ...
...lso covers styling, validation, the basics of how to send data and process it on the server, and more besides. it has new examples available and techniques covered. it has a new structure to make for a more effective learning experience. more "test your skills" sections have been
added. you can see these on: css layout: flexbox css layout: grids css layout: floats december 2019 we are
adding a new type of assessment article to the learning area — "test your skills" — which will offer several short questions aimed at rapidly testing whether you understood what is going on. this is in
addition to the longer assessment articles that you'll find in some of the learning modules already. you will find these new articles linked in "test your skills" sections at the bottom of relevant...
Ember resources and troubleshooting - Learn web development
ver — a forum/chat server where you can meet the ember community, ask for help, and help others! general troubleshooting, gotchas, and misconceptions this is nowhere near an extensive list, but it is a list of things that came up around the time of writing (latest update, may 2020). how do i debug what's going on in the framework? for framework-specific things, there is the ember-inspector
add-on, which allows inspection of: routes & controllers components services promises data (i.e: from a remote api — from ember-data, by default) deprecation information render performance for general javascript debugging, check out our guides on javascript debugging as well as interacting with the browser's other debugging tools. in any default ember project, there will be two ...
... { this.somedata = newvalue; } } which would then be called in the template like so: <checkbox @data={{this.somedata}} @onchange={{this.setdata}} /> due to the conciseness of using mut, it may be desireable to reach for it. however, mut has unnatural semantics and has caused much confusion over the term of its existence. there have been a coupleof new ideas put together into the form of
addons that use the public apis, ember-set-helper and ember-box. both of these try to solve the problems of mut by introducing more obvious / "less magic" concepts, avoiding build-time transforms and implicit glimmer vm behavior. with ember-set-helper: <checkbox @value={{this.somedata}} @ontoggle={{set this "somedata" (not this.somedata)}} /> with ember-box: {{#let (box this.somedata) as |s...
...react resources ember getting started with ember ember app structure and componentization ember interactivity: events, classes and state ember interactivity: footer functionality, conditional rendering routing in ember ember resources and troubleshooting vue getting started with vue creating our first vue component rendering a list of vue components
adding a new todo form: vue events, methods, and models styling vue components with css using vue computed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelt...
React resources - Learn web development
evtools we used console.log() to check on the state and props of our application in this tutorial, and you'll also have seen some of the useful warnings and error message that react gives you both in the cli and your browser's javascript console. but there's more we can do here. the react devtools utility allows you to inspect the internals of your react application directly in the browser. it
adds a new panel to your browser's developer tools, and with it you can inspect the state and props of various components, and even edit state and props to make immediate changes to your application. this screenshot shows our finished application as it appears in react devtools: on the left, we see all of the components that make up our application, including some unique keys for the things that ...
... in client-side routing — without it, keyboard users can 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). previous overview: client-side javascript frameworks next in this module introduction to client-side frameworks framework main features react getting started with react beginning our react todo list componentizing our react app react interactivity: events and state react interactivity: editing, filtering, conditiona...
...react resources ember getting started with ember ember app structure and componentization ember interactivity: events, classes and state ember interactivity: footer functionality, conditional rendering routing in ember ember resources and troubleshooting vue getting started with vue creating our first vue component rendering a list of vue components
adding a new todo form: vue events, methods, and models styling vue components with css using vue computed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelt...
Lightweight themes
it will be anchored to the top-right corner of the browser window. view a sample theme header here. ...
...it will be anchored to the top-right corner of the browser window. view a sample theme header here. ...
......
Debugging JavaScript
ing the web console option in the web developer menu. this shows any javascript errors in your app, as well as any logging calls from the console api. browser console the browser console lets you see all javascript errors and logging in the browser, including from firefox code. to enable it, go to about:config in the url bar and set devtools.chrome.enabled to true, or set the "enable chrome and
add-on debugging" option in the developer tool settings. activate it through with the menu tools > web developer > browser console. you can also start the browser console when you launch firefox, by launching firefox from the command line and passing --jsconsole as a flag: /path/to/firefox --jsconsole log to the browser console using the standard console api after importing console.jsm: let conso...
...n tools. strict code checking if you set the pref javascript.options.strict to true, the javascript engine gives you more types of warnings on the error console, most of which hint at code bugs that are easy to oversee or even bad syntax. (the pref also warns on common javascript idioms that are not errors). console.log in browser console you can dump variables in the browser console from
addon code, by
adding this line to import the console utility: const { console } = components.utils.import("resource://gre/modules/devtools/console.jsm", {}); this has an advantage over dump in that you can list out properties of an object logged with console.log. dump() the dump() function allows you to print text on the native console. use \n to output a newline at the end. to see anything, yo...
...nents.utils.import("resource://gre/modules/devtools/console.jsm", {}); this has an advantage over dump in that you can list out properties of an object logged with console.log. dump() the dump() function allows you to print text on the native console. use \n to output a newline at the end. to see anything, you need to set the pref browser.dom.window.dump.enabled to true, e.g. in about:config (
add new pref, it doesn't exist per default). under microsoft windows you
additionally need to start firefox via the following command to have a native console : firefox.exe -console using normal javascript object inspection, you can write a function that dumps a whole object, similar to this ddumpobject(). log.jsm (formerly log4moz) this is a partial implementation of the log4* interfaces (for ...
Debugging Table Reflow
debug_table_strategy editor's note: the following examples are not shown correctly due to the wiki's technical constraint. the table layout strategy can be visualized by defining in the makefiles the constant debug_table_strategy.if one takes for instance the following table code: <table border width="300"> <colgroup> ...
... // 1*, 2*, etc. ...
...= 4 // 0*, means to force to min width after this follows the width information for each column: widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 the table code knows ten different width's: #define num_widths 10 #define num_major_widths 3 // min, des, fix #define min_con 0 // minimum width required of the content + p
adding #define des_con 1 // desired width of the content + p
adding #define fix 2 // fixed width either from the content or cell, col, etc. + p
adding #define min_adj 3 // minimum width + p
adding due to col spans #define des_adj 4 // desired width + p
adding due to col spans #define fix_adj 5 // fixed width + p
adding due to col spans #define pct 6 // percent width of cell or col #define pct_adj 7 // p...
HTTP logging
explorer location bar to get there quickly. advanced techniques you can adjust some of the settings listed above to change what http information get logged. limiting the size of the logged data by default there is no limit to the size of log file(s), and they capture the logging throughout the time firefox runs, from start to finish. these files can get quite large (gigabytes)! so we have
added a 'rotate:size_in_mb' option to moz_log (we use it in the examples above). if you are using firefox >= 51, setting this option saves only the last n megabytes of logging data, which helps keep them manageable in size. (unknown modules are ignored, so it's ok to use 'rotate' in your environment even if you're running firefox <= 50: it will do nothing). this is accomplished by splitting the lo...
...up to 4 separate files (their filenames have a numbered extension, .0, .1, .2, .3) the logging back end cycles the files it writes to, while ensuring that the sum of these files’ sizes will never go over the specified 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 previous 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 ...
... 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 (or hang) you should
add ",sync" to the list of logging modules in your moz_log environment variable. this will cause each log message to be immediately written (and fflush()'d), which is likely to give us more information about your crash. logging only http request and response headers there are two ways to do this: replace moz_log=nshttp:5 with moz_log=nshttp:3 in the commands above. there's a handy extension fo...
Makefile - variables
note: non-functional links can be fixed by inserting en/. variable name description
add_to_def_file cpp_sources cpp_unit_tests a list of source files to compile as unit tests. csrcs a list of c source files to compile. defines
additional preprocessor defines for c++ expand_mozlibname exports a list of exported header files and sources to install for external use. exports_namespaces exported package include directory: dist/include/${namespace} exports_${namespace} a list of exports/headers that should be copied into the exported namespace directory. ...
...on scripts to check exit status for make check xpc_shell_tests no_xpcshell_manifest_check inhibit validating manifest files when running xpcshell tests. compiler variable description gnu_cc defined if the gnu gcc compiler is available. module_optimize_flags
additional flags for enabling or overriding compiler optimizations(-o2). solaris_sunpro_cc sun studio compiler export variables description autocfg_js_exports exports a list of exported headers and source files for external use. has_extra_exports pref_js_expo...
...t of locale names to process moz_chrome_file_format both, file, jar, omni, symlink packager_no_libs hack to allow one makefile to include another without pulling in libs:: target definitions. stagedist local staging directory for localization and packaging. todo: xpcom/xpinstall variables: https://developer.mozilla.org/en/
adding_xpcom_components_to_mozilla_build_system ...
Inner and outer windows
in order to represent these levels of complexity, two "types" of window need to be considered. ...
...nment in which a document is presented to the user. this may be a window or a tab, or it might be an <iframe> contained within another document. html5 refers to the outer window as the windowproxy. an inner window represents the actual content being displayed; it's the current view of what the user sees. consider this view of a window and the browser history: as the user navigates, documents are
added to the backward-forward cache (often referred to as the bfcache). these are, in essence, inner windows. they get displayed in the outer window, which is contained in the "physical" browser window. here's the trick, though: the inner window in essence pretends to be the outer window. if the document currently being displayed asks "what window am i in?", it gets the outer window as the answer. th...
...ugh, just like in the previous 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. ...
Contributing to the Mozilla code base
cts to contribute to, along with the skills needs and links to their documentation. ...
...inks to their documentation. ...
...t the module owner as the reviewer, asking them in the comments to pick someone more suitable please select only one reviewer. step 4b: follow it up once you've asked for a review, a reviewer will often respond within a day or two, reviewing the patch, or saying when they will be able to review it, perhaps due to a backlog. if you don't hear back within this time, naturally reach out to them:
add a comment to the bug saying 'review ping?', check the "need more information from" box, and
add the reviewer's name. if they don't respond within a day or two, you can ask for help on matrix in the #introduction:mozilla.org or #developers:mozilla.org channels, or contact mike hoye directly. don't hesitate to contact your mentor as well if this isn't moving. step 4: repeat thank you! you've fix...
Reviewer Checklist
posed 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. 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 exer...
...eness (works with "never keep activities"). also test with oom-fennec (https://hg.mozilla.org/users/blassey_mozilla.com/oom-fennec/)]. compatibility version files, databases, messages tag messages with ids to disambiguate callers. idl uuids are updated when the interface is updated. android permissions should be 'grouped' into a common release to avoid breaking auto-updates. android apis
added since froyo should be guarded by a version check. preffability if the feature being worked on is covered by prefs, make sure they are hooked up. if working on a new feature, consider
adding prefs to control the behavior. consider
adding prefs to disable the feature entirely in case bugs are found later in the release cycle. [fennec: "prefs" can be gecko prefs, sharedpreferences values, ...
...e 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 present, properly wrapped, in later lines. adequately document any potentially confusing pieces of code. flag a bug with dev-doc-needed if any
addon or web apis are affected. use javadocs extensively, especially on any new non-private methods. when moving files, ensure blame/annotate is preserved. accessibility for html pages, images should have t...
mozbrowserloadend
ng the main background color of the browser <iframe> content, expressed as an rgb value. can be used to make the theme of the surrounding ui complement the theme of the currently loaded content, for example. example in this example the mozbrowserloadstart and mozbrowserloadend events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. ...
...top (x) and reload (r), as appropriate. in
addition, the background of the controls ui bar is changed to the background color of the site that has just loaded, to provide a more integrated experience. when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundcolor value reported is rgb(0, 83, 159). ...
...rience. when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundcolor value reported is rgb(0, 83, 159). ...
Script security
d run it on the user's computer. the security model for web content is based on the same-origin policy, in which code gets full access to objects from its origin but highly restricted access to objects from a different origin. the rules for determining whether an object is same-origin with another, and what access is allowed cross-origin, are now mostly standardized across browsers. gecko has an
additional problem, though: while its core is written in c++, the front-end code is written in javascript. this javascript code, which is commonly referred to as chrome code, runs with system privileges. if the code is compromised, the attacker can take over the user's computer. legacy sdk extensions also run with chrome privileges. having the browser front end in javascript has benefits: it can be ...
...in, the caller gets a cross-origin wrapper. this denies access to all the object's properties, except for a few properties of window and location objects, as defined by the same-origin policy. privileged to unprivileged code the most obvious example of this kind of security relation is between system-privileged chrome code and untrusted web content, but 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 prevent untrusted code from confusing truste...
...reat compartments that have expanded principals more like part of the browser than like web content. this means, for example, that it can run when javascript is disabled for web content. expanded principals are useful when you want to give code extra privileges, including cross-origin access, but don't want to give the code full system privileges. for example, expanded principals are used in the
add-on sdk to give content scripts cross-domain privileges for a predefined set of domains, and to protect content scripts from access by untrusted web content, without having to give content scripts system privileges. null principal the null principal fails almost all security checks. it has no privileges and can't be accessed by anything but itself and chrome. it subsumes no other principals, eve...
Creating a New Protocol
see dom/ipc/moz.build for an example. the protocol hierarchy unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. the toplevel protocol for plugins is ppluginmodule. ...
...see dom/ipc/moz.build for an example. the protocol hierarchy unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. the toplevel protocol for plugins is ppluginmodule. the toplevel protocol for tabs is pcontent. ...
... pnewprotocolparent.h and pnewprotocolchild.h headers. writing the tests protocols which are managed by pbrowser must be tested using the mochitest-chrome test framework with a <browser remote="true">. it is acceptable to use synchronous calls on jpw wrappers for testing purposes. it may be possible to test protocols unrelated to a particular window using the xpcshell testing framework, which has
additional primitives in electrolysis for launching and running js commands in a content process. ...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
omain/host name which uses non-ascii characters. until recently domain names allowed only a subset of 7-bit ascii characters. as the internet has spread to non-english speaking people around the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the latin alphabet is not ideal. many of the european languages use the basic latin alphabet with
additional accented characters for writing but they were not able to use them in domain names. there are many languages whose writing scripts are not based on latin alphabet at all. speakers of these languages were not able to use familiar names in their native languages as part of internet domain/host names. for the past few years, there have been a flurry of ietf activities to standardize the prot...
... servers to register non-ascii domain names and application/client vendors to implement standardized support for handling non-ascii characters in domain names. how idn works when a browser sees a host name such as http://developer.mozilla.org, it passes a request to the dns resolver service (usually built into an os), which in turn sends a request to a nearest domain name server to return an ip
address that corresponds to the host name. this ip
address is then used to connect to the web server in question. idn allows host/domain names with non-ascii characters for user input into a browser's location bar or url's embedded in web pages. at the network protocol level, there is no change in the restriction that only a subset of ascii characters be used in url/uri. if end users input non-ascii...
...me registrars are expected to move forward on implementing the new rfc's for existing and future idn registrations quickly. jprs (japan registry service) decided to move to the new rfc implementation on july 10, 2003, only a few weeks after the icann's guideline was published. this makes it possible for netscape 7.1/mozilla 1.4 users to access japanese host names under .jp top domain without any
additional setup using just the built-in idn functionality. real world examples punycode there are real world examples of idn that you can test with netscape 7.1, which uses punycode as the default idn encoding. for example, most sample links on the following test pages can be used without any further setting: http://www.nunames.nu/eu-lang-test.htm (domain names with latin 1 accented characters...
TypeListener
typelisteners can be registered with
addtypelistener() and will then receive notification as
addontype are registered and unregistered. method overview void ontype
added(in
addontype type) void ontyperemoved(in
addontype type) methods ontype
added() called when an
add-on type has been
added. void ontype
added( in
addontype type ) parameters type the
addontype that is being
added needsrestart true if an application restart is necessary for the change to take effect ontyperemoved() called when an
add-on type has been removed. ...
...pe) void ontyperemoved(in
addontype type) methods ontype
added() called when an
add-on type has been
added. void ontype
added( in
addontype type ) parameters type the
addontype that is being
added needsrestart true if an application restart is necessary for the change to take effect ontyperemoved() called when an
add-on type has been removed. ...
...e type) methods ontype
added() called when an
add-on type has been
added. void ontype
added( in
addontype type ) parameters type the
addontype that is being
added needsrestart true if an application restart is necessary for the change to take effect ontyperemoved() called when an
add-on type has been removed. ...
API-provided widgets
g to use for the tooltip of the widget label string to use for the label of the widget removable whether the widget is removable (optional, default: true). nb: if you specify false here, you must provide a defaultarea, too. ...
...optional, default: true) defaultarea default area to
add the widget to (optional, default: none; required if non-removable) shortcutid id of an element that has a shortcut for this widget (optional, default: null). this is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings inside customizablewidgets.properties). if you're in an
add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass in yourself. showinprivatebrowsing whether to show the widget in private browsing mode (optional, default: true) event handlers you can also define several event handlers which will be called at various stages in a widget's lifetime: event handler name ...
...roperty described above, so that customizableui can find the node again later. onbeforecreated(adoc) attached to all non-custom widgets; a function that will be invoked before the widget gets a dom node constructed, passing the document in which that will happen. this is useful especially for 'view' type widgets that need to construct their views on the fly (e.g. from bootstrapped
add-ons). oncreated(anode) attached to all widgets; a function that will be invoked whenever the widget has a dom node constructed, passing the constructed node as an argument. ondestroyed(adoc) attached to all non-custom widgets; a function that will be invoked after the widget has a dom node destroyed, passing the document from which it was removed. this is useful especiall...
Following the Android Toasts Tutorial from a JNI Perspective
it will use the jni.jsm module that is available in firefox for android since version 17. this article teaches developers how to port java code to jni by reading the java and android documentation. toast description a toast provides simple feedback about an operation in a small popup. it only fills the amount of space required for the message, and the current activity remains visible and interactive. ...
...ntation page shows this: there are two columns, the first column is the return, and the second column is the method name and arguments. we see that maketext returns static toast. this means it is a static method. we see that the return column of the show method does not contain the word static. therefore, it is a plain method. let's declare these methods in the third argument of loadclass we
add a key-value pair, with the key being static_methods and methods and the value being an array. var toast = jni.loadclass(my_jenv, sig.toast.substr(1, sig.toast.length - 2), { static_methods: [ { name: 'maketext', sig: '()' } ], methods: [ { name: 'show', sig: '()' } ] }); the sig of methods is always in the format of "method format" from our types table above. th...
...toasts example, we need the context. our application is firefox for android, so we need to tap into the firefox classes to get its context. we search dxr, and we find a getcontext static method belonging to the geckoappshell class. to figure out the sig for firefox classes, we have to search on dxr. we find an xml file showing the sig for geckoappshell is org.mozilla.gecko.geckoappshell. we will
add this to our sig object in slash notation: geckoappshell: 'lorg/mozilla/gecko/geckoappshell;' we then instantiate the geckoappshell class in jni and declare the getcontext method; dxr showed that this method accepted no arguments and returns a context, and we already had the sig for context in our sig object. var geckoappshell = jni.loadclass(my_jenv, sig.geckoappshell.substr(1, sig.geckoappshe...
Log.jsm
sic usage components.utils.import("resource://gre/modules/log.jsm"); // get a logger, give it a name unique to this chunk of code. // use dots to create a hierarchy, this way you can later change // the log level of sets of loggers under some common root let log = log.repository.getlogger("myextension.myclass"); log.level = log.level.debug; // a console appender logs to the browser console. ...
...unique to this chunk of code. // use dots to create a hierarchy, this way you can later change // the log level of sets of loggers under some common root let log = log.repository.getlogger("myextension.myclass"); log.level = log.level.debug; // a console appender logs to the browser console. log.
addappender(new log.consoleappender(new log.basicformatter())); // a dump appender logs to stdout. log.
addappender(new log.dumpappender(new log.basicformatter())); // log some messages log.error("oh noes!! something bad happened!"); log.debug("details about bad thing only useful during debugging", {someinfo: "nothing"}); log.warn("here is an error", new error("ouch")); logger levels fatal severe errors that cause premature termination. expect these to be immediately visible on a stat...
... doappend(); reset(); formatter(); length: 0 keys of prototype: format(); logmessage(); length: 4 keys of prototype: leveldesc logger(); length: 2 keys of prototype:
addappender(); level logstructured(); name parent removeappender(); updateappenders(); and the methods mentioned below: logger methods loggerrepository(); length: 0 keys of prototype: getlogger(); ...
PopupNotifications.jsm
cations should be searched. if null, the currently selected <xul:browser>'s notifications will be searched. return value the corresponding notification object, or null if no such notification exists. remove() removes the specified notification. void remove( notification notification ); parameters notification the notification object representing the notification to remove. show()
adds a new popup notification, displaying it to the user. notification show( browser, id, message, anchorid, mainaction, secondaryactions, options ); parameters browser the xul <xul:browser> element with which the notification is associated. this must not be null; you can, however, simply specify gbrowser.selectedbrowser to associate it with the current tab. id a unique id stri...
...tification panel. see notification actions below for details. secondaryactions an array of notification action objects; these are used to populate the drop-down menu on the notification panel's button. options a javascript object containing optional properties for the notification. see notification options below for details. return value returns the notification object corresponding to the
added notification. notification actions notification action objects describe the user interface for actions associated with the notification. the main action is used to describe the button presented in the notification panel, while secondary actions are displayed in the drop-down menu associated with the button. a notification action object must contain the following properties: label a text ...
...t of time the notification should be kept open (for example, date.now() + 30000 for 30 seconds). persistwhilevisible a boolean value indicating whether or not the notification should persist across location changes. if true, the notification will remain visible even if the browser navigates to a different location. dismissed a boolean value indicating whether or not the notification should be
added as a dismissed notification. dismissed notifications can be activated by clicking on their anchor. this lets you create a notification that will appear when the user clicks the anchor. eventcallback a javascript function to be invoked when the notification changes state. the callback's first parameter is a string identifying the state change that occurred. see notification events below. neve...
Extras
="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext> <img width="16" height="16" src="https://udn.realityripple.com/samples/3f/9341cbddc0.png" alt="mozilla-16" /> </mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input value="type" size="4"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <math display="block"> <msqrt> <mp
added width="30px" height="15px" depth="15px" voffset="-15px"> <mtext> <svg width="30px" height="30px"> <defs> <radialgradient id="radgrad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:rgb(255,255,255); stop-opacity:1;"/> <stop offset="100%" style="stop-color:rgb(255,0,0); stop-opacity:.8;"/> </ra...
... attributetype="xml" type="rotate" from="360" to="0" dur="15s" repeatcount="indefinite"/> <g transform="translate(-15, -15)"> <path fill="url(#radgrad1)" d="m 15 0 l 20 10 l 30 15 l 20 20 l 15 30 l 10 20 l 0 15 l 10 10"/> </g> </g> </g> </svg> </mtext> </mp
added> </msqrt> <mo>=</mo> <msubsup> <mo>∫</mo> <mn>0</mn> <mfrac> <mi>π</mi> <mn>2</mn> </mfrac> </msubsup> <msup> <mi>θ</mi> <mtext> <svg width="15px" height="15px"> <defs> <radialgradient id="radgrad2" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:rgb(255,255,255); stop-opacity:1;"/> <stop offset="100%" ...
...> </mrow> </mfrac> </mrow> </math> </foreignobject> <text>exp(α)</text> </switch> </g> </g> </svg> </div> inline javascript html content <math display="block"> <mfrac> <mtext id="num">mouse</mtext> <mtext id="denum">over</mtext> </mfrac> </math> javascript content function whoistherealert(evt) { alert("who is there?"); } function attachlistener(id) { document.getelementbyid(id).
addeventlistener("mouseover", whoistherealert); } function init() { attachlistener("num"); attachlistener("denum"); } window.
addeventlistener("load", init); ...
Mozilla Development Strategies
bugs first everyone likes to check in. but keep in mind that your checkin rate isn't everything. it's better to fix one data loss bug, crasher, or performance bug that really affects the user than edge case bugs that are rarely seen or minor bugs. make sure documentation gets updated if the bug you're fixing is likely to require an update to developer documentation once it's fixed, be sure to
add the dev-doc-needed keyword to the bug (or ask someone to do it, if you don't have editbugs privileges on bugzilla). this puts the bug on the radar of our documentation team to ensure that once the bug is resolved, the documentation will be updated appropriately. if you don't mark the bug, your work might go unnoticed by the docs team! of course, our documentation is a wiki; you can really help b...
...ece of code than a bunch of quick fixes. you (or someone else) will be back in that code someday. it's easier to do it right once, when your mind is in the problem, than to do it once quickly and then have to come back and do it again the right way. the only thing worse than not understanding someone else's code is not understanding your own. test your code qa's job is to assure quality, not to
add quality. that's your job. it's your responsibility to find and fix the problems in your code before checking in. when you land your bug-free code, it's qa's job to assure others that it's really bug free. make sure you appreciate anyone who finds a bug in your code. appreciate it even more if they find it before you ship. they're giving you a second chance to get it right before it becomes a bug...
...you can't land it because something else is blocking you. you can still land (assuming you get reviews) if the code isn't on by default. this also makes it easier to get help on the problem. it's easier to tell someone set a pref, or apply a small patch, or set a #define than to apply a monster patch. for c++, use #define, #ifdef, #else and #endif for xul / js, and you're doing something major,
add your new files to the tree and then have it be a simple jar.mn patch to enable it. you can also have code that checked in, but controlled with a pref and off by default. make sure you have the right fix when you go for reviews when tempted to do a first pass fix and fix the fallout later, do it right the first time; don't assume you'll be able to file a "fix it" bug and fix stuff you know abou...
Mozilla Quirks Mode Behavior
obsolete since gecko 50 list bullets do not inherit the font size of the list (bug 97351). removed in firefox 50 (bug 648331). ...
... obsolete since gecko 50 list bullets do not inherit the font size of the list (bug 97351). removed in firefox 50 (bug 648331). ...
...ther browsers. (firefox 16 / thunderbird 16 / seamonkey 2.13) since this version bug 338554 is fixed and (-moz-)box-sizing applies to table cells in standards mode, but quirks mode keeps the old behavior. obsolete since gecko 1.9 (firefox 3) in quirks mode table cells with a border have a minimum width of one pixel. obsolete since gecko 1.9 (firefox 3) the basic table layout strategy ignores p
adding (on what) in quirks mode. obsolete since gecko 1.9 (firefox 3) the basic table layout strategy handles widths differently in some way. obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in quirks mode absmiddle (handled incorrectly?) and middle (perhaps incorrectly as well?) are accepted as values of align on table cells, and absmiddle, abscenter, and middle are supported...
Memory Profiler
select the memoryprofiler tab. to take a profile you can use the buttons in the profiler panel. ...
...select the memoryprofiler tab. to take a profile you can use the buttons in the profiler panel. ...
...select the memoryprofiler tab. to take a profile you can use the buttons in the profiler panel. ...
TraceMalloc
om the codebase. this documentation is only relevant to older versions of the codebase that still contain it. tracemalloc captures stack traces of all malloc, calloc , realloc, and free calls (this currently covers all operator new and delete calls in mozilla, too). to enable tracemalloc in your build, configure with --enable-trace-malloc. the built mozilla application will support the following
additional command-line options: --trace-malloc filename the application will log allocation and deallocation events with stack traces in a binary format to the given file. if filename is -, nothing is written to a file, but tracemalloc will be active and will track live allocations and their stack traces. --shutdown-leaks=filename on shutdown, the application will save live allocations (with st...
... python leaktest.py -- --trace-malloc malloc.log --shutdown-leaks=sdleak.log # note 2: it appears that the shutdown log is not recorded if --trace-malloc is given the - argument. build/dist/minefield.app/contents/macos/firefox --trace-malloc /dev/null --shutdown-leaks=sdleak.log # convert raw log to text representation of call trees perl source/tools/trace-malloc/diffbloatdump.pl --depth=15 --use-
address /dev/null sdleak.log > sdleak.tree.raw # frobulate trees to remove extraneous junk perl source/tools/rb/fix-macosx-stack.pl sdleak.tree.raw > sdleak.tree you can also use the leakstats program to analyze a log for shutdown leaks. it will produce a report like the following. leaks: 382739 bytes, 3465 allocations maximum heap size: 7751799 bytes 62095212 bytes were allocated in 391091 allocatio...
...oatdump.pl to compare trace-malloc dumps before and after doing an action that might leak. if there are significant differences, it might be worth examining the call stacks for the destructors of the objects in question to see what is extending their lifetime. (this can be done by examining the unprocessed output of an xpcom_mem_refcnt_log, one of the nstracerefcnt logs.) you should use the --use-
address argument to diffbloatdump.pl, and then the diff tree can be run through fix_linux_stack.py or fix_macosx_stack.py as needed. leaksoup leaksoup is a trace-malloc tool that analyzes the shutdown log. because this log includes the contents of heap blocks, leaksoup can analyze the graph of live objects and determine which allocations are roots (within that graph, of course -- stack allocations an...
A brief guide to Mozilla preferences
preferable to another). preference changes via user interface usually take 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 preventing 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 ...
...via the advanced preferences editor, by typing about:config in the location bar. this ui is not recommended for most users. programmatic changes to preferences can be made using the preferences.jsm module from js code, or the mozilla::preferences static class methods from c++ code. changing defaults a systems administrator can modify the default preferences in two ways: the administrator may
add an all-companyname.js preference file (install_directory/browser/defaults/preferences/all-companyname.js). this will be parsed last during the preference loading process. the administrator may alternatively put a user.js file in app_dir/defaults/profile/ ; this will put a copy of the user.js in all new profiles. this method has the advantage of resetting preferences back to administrator def...
... every start-up. note that, because a user typically has access privilege to his or her profile directory, he or she can change the default values if he or she knows how. another disadvantage is that existing profiles will not be affected. this method is considered user-hostile. any use of this technique by software such as firefox extension to override normal user preference will result in being
added to the firefox blocklist or the preferences being forcibly removed. note: because of abuse of user.js preferences, support for user.js may be removed in a future version of firefox. see bug 1543752. sticky preferences sticky preferences were introduced in firefox 40 via bug 1098343. sticky preferences are created when they are defined using sticky_pref(). these preferences act as defa...
Patches and pushes
create xml files for each search plugin preference following the above example. for references on how each tag functions, visit the opensearch wiki page and the mozsearch wiki page. the pages are old (i mean, firefox 2???), but still accurate. each plugin has an icon image which is linked within the xml file as an uri id. upload your plugins icon image to data kitchen to obtain its uri id and
add to the xml file within the image tag. in list.txt,
add the search plugin's xml filename (without extensions) on a new line and save. note that if your team selects a local version of an already default plugin (e.g., wikipedia), the xml filename should include the locale code (e.g., wikipedia-es). create a patch of the searchplugins directory by entering the following command in your command-lin...
...ugin's xml filename (without extensions) on a new line and save. note that if your team selects a local version of an already default plugin (e.g., wikipedia), the xml filename should include the locale code (e.g., wikipedia-es). create a patch of the searchplugins directory by entering the following command in 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...
... 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. ...
L20n HTML Bindings
elements localizable use the data-l10n-id attribute on an html element to mark it as localizable. <p data-l10n-id="about"></p> notice that you don't have to put the text content in the html anymore (you still can if you want to). all content lives in the localization resources. a safe subset of html elements (e.g. em, sup), attributes (e.g. title) and entities can be used in translations. in
addition to the pre-defined whitelists, any element found in the original source html is allowed in the translation as well. consider the following source html: <p data-l10n-id="save"> <input type="submit"> <a href="/main" class="btn-cancel"></a> </p> assume the following malicious translation: <save """ <input value="save" type="text"> or <a href="http://myevilwebsite.com" onclick="...
...erted in the final dom. however, the title attribute is safe. it is important to note that applying translations doesn't replace dom elements, but only modifies their text nodes and their attributes. this makes it possible to use l20n in conjunction with mvc frameworks. when all dom nodes are localized, the document element will fire a documentlocalized event, which you can listen to: document.
addeventlistener('documentlocalized', function() { // the dom has been localized and the user sees it in their language yourapp.init(); }); exposing context data you can expose important bits of data to the localization context in form of context data. <script type="application/l10n-data+json"> { "newnotifications": 3, "user": { "name": "jane", "gender": "feminine" } } </script...
...ormation about the available and the default locales, l20n will switch to the monolingual mode. you can then embed localization resources right in your html. <script type="application/l20n"> <brandname "firefox"> <about "about {{ brandname }}"> </script> an alternative is to include localization resources in script elements. note that this still only works for a single language. we plan to
add support for a language pack service in the future that can tap into this scenario on the client side. <script type="application/l20n" src="../locales/strings.l20n"></script> note that you currently cannot use the manifest file and manually
add resources via script tags at the same time (bug 923670). ...
Optimizing Applications For NSPR
shadow stack to preserve context across a thread switch. at thread switch time, the stack of the current running thread is copied to other storage associated with that thread and the about-to-be-dispatched thread's stack data is copied back onto the windows stack just before the thread is given control. this has disastrous implications on the generally accepted programming practice of taking the
address of a stack variable and giving that
address to another thread. consider that the windows stack is swapped in and out with each thread switch. the thread that created a stack variable sees his own stack variables correctly across thread switches. however, another thread does not see the data as intended because the stack has been swapped out to the shadow stack and the current thread's stack ...
...ith each thread switch. the thread that created a stack variable sees his own stack variables correctly across thread switches. however, another thread does not see the data as intended because the stack has been swapped out to the shadow stack and the current thread's stack now occupies the windows stack. this can be difficult to diagnose. for complete cross platform portability, do not take the
address of a stack variable and make that
address available to another thread. for more details, see the memo on automatic
addresses. windows 3.1 does not support 64 bit file offsets. the nspr 64 bit file offset apis map to windows 3.1 32 bit file offset apis. you may use nspr's 64bit file offset apis in your windows 3.1 applications for cross platform consistency, but do not expect to see real 64 ...
...havior. on windows 3.1, when nspr detects a value in a 64 bit file offset greater than 32bit significance, it terminates with an assert. the general rules of 16 bit large model memory restrictions apply to applications using nspr on windows 3.1. the nspr process creation api functions return an error when invoked on windows 3.1. functions called in an application by a shared library require an
additional function prolog. the prolog is presented in the macro <tt>pr_callback</tt>. for any function made available to any shared library (most likely passed in as a function pointer), that function must have the <tt>pr_callback</tt> qualifier. nspr functions are normally declared <tt>__cdecl</tt>. these declarations are hidden in the <tt>pr_extern()</tt> declarations in nspr's header files. nspr...
Cached Monitors
the system automatically enlarges the hash table as needed. important cached monitors are slower to use than their uncached counterparts. see monitors for information about uncached monitors. ...
...the system automatically enlarges the hash table as needed. important cached monitors are slower to use than their uncached counterparts. see monitors for information about uncached monitors. ...
...lower to use than their uncached counterparts. see monitors for information about uncached monitors. cached monitors functions cached monitors allow the client to associate monitoring protection and state change synchronization in a lazy fashion. the monitoring capability is associated with the protected object only during the time it is required, allowing the monitor object to be reused. this
additional flexibility comes at the cost of a small loss in performance. pr_centermonitor enters the lock associated with a cached monitor. pr_cexitmonitor decrements the entry count associated with a cached monitor. pr_cwait waits for a notification that a monitor's state has changed. pr_cnotify notifies a thread waiting for a change in the state of monitored data. pr_cnotifyall notifies all ...
PRHostEnt
a structure that defines a list of network
addresses. this structure is output from pr_gethostbyname and pr_gethostby
addr and passed to pr_enumeratehostent. clients should avoid directly accessing any of the structure's fields. syntax #include <prnetdb.h> typedef struct prhostent { char *h_name; char **h_aliases; #if defined(_win32) print16 h_
addrtype; print16 h_length; #else print32 h_
addrtype; print32 h_length; #endif char **h_
addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host. h_aliases pointer to a pointer to list of aliases. the list is terminated with a null entry. h_
addrtype host
address type. for valid nspr usage, this field must have a value indicating either an ipv4 or an ipv6
address. h_le...
..._
addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host. h_aliases pointer to a pointer to list of aliases. the list is terminated with a null entry. h_
addrtype host
address type. for valid nspr usage, this field must have a value indicating either an ipv4 or an ipv6
address. h_length length of internal representation of the
address in bytes. all of the
addresses in the list are of the same type and therefore of the same length. h_
addr_list pointer to a pointer to a list of
addresses from name server (in network byte order). the list is terminated with a null entry. description this structure is used by many of the network
address functions. ...
...n ipv6
address. h_length length of internal representation of the
address in bytes. all of the
addresses in the list are of the same type and therefore of the same length. h_
addr_list pointer to a pointer to a list of
addresses from name server (in network byte order). the list is terminated with a null entry. description this structure is used by many of the network
address functions. all
addresses are passed in host order and returned in network order (suitable for use in system calls). use the network
address functions to manipulate the prhostent structure. to make the transition to ip version 6 easier, it's best to treat prhostent as an opaque structure. note winsock.h defines h_
addrtype and h_length as a 16-bit field, whereas other platforms treat it as a 32-bit field. the #ifd...
PRSockOption
enumeration type used in the option field of prsocketoptiondata to form the name portion of a name-value pair. syntax #include <prio.h> typedef enum prsockoption { pr_sockopt_nonblocking, pr_sockopt_linger, pr_sockopt_reuse
addr, pr_sockopt_keepalive, pr_sockopt_recvbuffersize, pr_sockopt_sendbuffersize, pr_sockopt_iptimetolive, pr_sockopt_iptypeofservice, pr_sockopt_
addmember, pr_sockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. pr_sockopt_linger time to linger on close if data is present in the socket send buffer. pr_sockopt_...
...ockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. pr_sockopt_linger time to linger on close if data is present in the socket send buffer. pr_sockopt_reuse
addr allow local
address reuse. pr_sockopt_keepalive periodically test whether connection is still alive. pr_sockopt_recvbuffersize receive buffer size. pr_sockopt_sendbuffersize send buffer size. pr_sockopt_iptimetolive ip time-to-live. pr_sockopt_iptypeofservice ip type-of-service and precedence. pr_sockopt_
addmember join an ip multicast group. pr_sockopt_dropmember leave an ip multi...
... pr_sockopt_mcasttimetolive ip multicast time-to-live. pr_sockopt_mcastloopback ip multicast loopback. ...
PR_CWait
timeout the amount of time (in printervaltime units) that the thread is willing to wait for an explicit notification before being rescheduled. if you specify pr_interval_no_timeout, the function returns if and only if the object is notified. ...
... timeout the amount of time (in printervaltime units) that the thread is willing to wait for an explicit notification before being rescheduled. if you specify pr_interval_no_timeout, the function returns if and only if the object is notified. ...
...ollowing values: pr_success indicates either that the monitored object has been notified or that the interval specified in the timeout parameter has been exceeded. pr_failure indicates either that the monitor could not be located in the cache or that the monitor was located and the calling thread was not the thread that held the monitor's mutex. description using the value specified in the
address parameter to find a monitor in the monitor cache, pr_cwait waits for a notification that the monitor's state has changed. while the thread is waiting, it exits the monitor (just as if it had called pr_cexitmonitor as many times as it had called pr_centermonitor). when the wait has finished, the thread regains control of the monitor's lock with the same entry count as before the wait began. t...
PR_GetPeerName
returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
... returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
... returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
PR_GetSockName
returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
... returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
... returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
NSS_3.11.10_release_notes.html
bugs fixed the following bugs have been fixed in nss 3.11.10. bug 291384: certutil -k behavior doesn't match usage bug 374247: modutil -disable command not disabling modules' slots bug 384459: certification path validation fails when authority key identifier extension contains key identifier bug 385946: can't import certificate into cert database in fips mode (certutil). bug 387892:
add entrust root ca certificate(s) to nss bug 396999: pk11_authenticate bug 397478: lock from ssl_initsymwrapkeyslock not freed on selfserv shutdown. bug 397486: session cache locks not freed on strsclnt shutdown. bug 398680: assertion botch in ssl3_registerserverhelloextensionsender doing second handshake with ssl_forcehandshake bug 403240: threads hanging in nss_initlock bug 403888: mem...
...tion botch in ssl3_registerserverhelloextensionsender doing second handshake with ssl_forcehandshake bug 403240: threads hanging in nss_initlock bug 403888: memory leak in trustdomain.c bug 416067: certutil -l -h token doesn't report token authentication failure bug 417637: tstclnt crashes if -p option is not specified bug 421634: don't send an sni client hello extension bearing an ipv6
address bug 422918:
add verisign class 3 public primary ca - g5 to nss bug 424152:
add thawte primary root ca to nss bug 424169:
add geotrust primary certification authority root to nss bug 425469:
add multiple new roots: geotrust bug 426568:
add comodo certification authority certificate to nss bug 431381:
add network solutions certificate authority root to nss bug 431621:
add diginota...
...s 3 public primary ca - g5 to nss bug 424152:
add thawte primary root ca to nss bug 424169:
add geotrust primary certification authority root to nss bug 425469:
add multiple new roots: geotrust bug 426568:
add comodo certification authority certificate to nss bug 431381:
add network solutions certificate authority root to nss bug 431621:
add diginotar root ca root to nss bug 431772:
add network solutions and diginotar root 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...
NSS 3.12.4 release notes
r 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 nssutil functions (see portreq.h): port_regexpvalid port_regexpsearch port_regexpcasesearch these functions will match a string wit...
...in16 has been removed. support for openvms has been removed. bugs fixed the following bugs have been fixed in nss 3.12.4. ...
...bug 495717: unable to compile nss/cmd/certutil/keystuff.c on wince bug 496961: provide truncated hmac support for testing tool fipstest bug 497002: lab required nspr-free freebl changes. bug 497217: the first random value ...
NSS 3.14.2 release notes
.org/security/nss/releases/nss_3_14_2_rtm/src/ for the primary nss documentation pages please visit /docs/nss new in nss 3.14.2 nss will now make use of the intel aes-ni and 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_useonlytrustan...
...l follow in a future nss release. (https://bugzilla.mozilla.org/show_bug.cgi?id=540986) sqlite has been updated to 3.7.15. note: please apply the patch in https://bugzilla.mozilla.org/show_bug.cgi?id=837799 if you build nss with the system sqlite library and your system sqlite library is older than 3.7.15. bug 816853 - when using libpkix for certificate validation, applications may now supply
additional application-defined trust anchors to be used in
addition to those from loaded security tokens, rather than as an alternative to. (https://bugzilla.mozilla.org/show_bug.cgi?id=816853) bug 772144 - basic support for running nss test suites on android devices.this is currently limited to running tests from a linux host machine using an ssh connection. only the sshdroid app has been tested. ...
...ection. only the sshdroid app has been tested. bug 373108 - fixed a bug where, under certain circumstances, when applications supplied invalid/out-of-bounds parameters for aes encryption, a double free may occur. bug 813857 - modification of certificate trust flags from multiple threads is now a thread-safe operation. bug 618418 - c_decrypt/c_decryptfinal now correctly validate the pkcs #7 p
adding when present. bug 807890 -
added support for microsoft trust list signing eku. bug 822433 - fixed a crash in dtls_freehandshakemessages. bug 823336 - reject invalid ldap aia uris sooner. bugs fixed in nss 3.14.2 https://bugzilla.mozilla.org/buglist.cgi?list_id=5502456;resolution=fixed;classification=components;query_format=advanced;target_milestone=3.14.2;product=nss compatibility n...
NSS 3.15 release notes
e. distribution information the hg tag is nss_3_15_rtm. nss 3.15 requires nspr 4.10 or newer. nss 3.15 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_15_rtm/src/ new in nss 3.15 new functionality support for ocsp stapling (rfc 6066, certificate status request) has been
added for both client and server sockets. tls client applications may enable this via a call to ssl_optionsetdefault(ssl_enable_ocsp_stapling, pr_true);
added function secitem_reallocitemv2. it replaces function secitem_reallocitem, which is now declared as obsolete. support for single-operation (eg: not multi-part) symmetric key encryption and decryption, via pk11_encrypt and pk11_decrypt. cer...
...rt_postocsprequest - primarily intended for testing, permits the sending and receiving of raw ocsp request/responses. in secpkcs7.h sec_pkcs7verifydetachedsignatureattime - verifies a pkcs#7 signature at a specific time other than the present time. in xconst.h cert_encodenameconstraintsextension - matching function for cert_decodenameconstraintsextension,
added in nss 3.10. in secitem.h secitem_allocarray secitem_duparray secitem_freearray secitem_zfreearray - utility functions to handle the allocation and deallocation of secitemarrays secitem_reallocitemv2 - replaces secitem_reallocitem, which is now obsolete. secitem_reallocitemv2 better matches caller expectations, in that it updates item->len on allocat...
.... nss has migrated from cvs to the mercurial source control management system. updated build instructions are available at migration to hg as part of this migration, the source code directory layout has been re-organized. the list of root ca certificates in the nssckbi module has been updated. the default implementation of ssl_authcertificate has been updated to
add certificate status responses stapled by the tls server to the ocsp cache. applications that use ssl_authcertificatehook to override the default handler should
add appropriate calls to ssl_peerstapledocspresponse and cert_cacheocspresponsefromsidechannel. bug 554369: fixed correctness of cert_cacheocspresponsefromsidechannel and other ocsp caching behaviour. bug 853285: fixed bugs in ae...
NSS 3.20 release notes
s, the server side implementation of the tls library keeps all dhe ciphersuites disabled by default. they can be enabled with the new socket option ssl_enable_server_dhe and the ssl_optionset or the ssl_optionsetdefault api. the server side implementation of the tls does not support session tickets while using a dhe ciphersuite (see bug 1174677). support for the following ciphersuites has been
added: tls_dhe_dss_with_aes_128_gcm_sha256 tls_dhe_dss_with_aes_128_cbc_sha256 tls_dhe_dss_with_aes_256_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe ciphersuites. nss embeds fixed dhe parameters sized 2048, 3072, 4096, 6144 and 8192 bits, which were copied from version 08 of the internet-draft "negotiated ...
...6_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe ciphersuites. nss embeds fixed dhe parameters sized 2048, 3072, 4096, 6144 and 8192 bits, which were copied from version 08 of the internet-draft "negotiated finite field diffie-hellman ephemeral parameters for tls", appendix a. a new api ssl_dhegroupprefset has been
added to nss, which allows a server application to select one or multiple of the embedded dhe parameters as the preferred parameters. the current implementation of nss will always use the first entry in the array that is passed as a parameter to the ssl_dhegroupprefset api. in future versions of the tls implementation, a tls client might show a preference for certain dhe parameters, and the nss tls s...
... with dhe ciphersuites in order to support legacy clients. to enable this support, the new api ssl_enableweakdheprimegroup must be used. each time this api is called for the first time in a process, a fresh set of weak dhe parameters will be randomly created, which may take a long amount of time. please refer to the comments in the header file that declares the ssl_enableweakdheprimegroup api for
additional details. the size of the default pqg parameters used by certutil when creating dsa keys has been increased to use 2048 bit parameters. the selfserv utility has been enhanced to support the new dhe features. nss no longer supports c compilers that predate the ansi c standard (c89). bugs fixed in nss 3.20 this bugzilla query returns all the bugs fixed in nss 3.20: https://bugzilla.moz...
NSS 3.32 release notes
zilla.org, for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_32_rtm/src/ notable changes in nss 3.32 various minor improvements and correctness fixes. the code signing trust bit was turned off for all, included root certificates. the websites (tls/ssl) trust bit was turned off for the following root certificates. ...
...es. ...
... cn = swisscom root ca 2 sha-256 fingerprint: f0:9b:12:2c:71:14:f4:a0:9b:d4:ea:4f:4a:99:d5:58:b4:6e:4c:25:cd:81:14:0d:29:c0:56:13:91:4c:38:41 the following ca certificates were removed: cn =
addtrust public ca root sha-256 fingerprint: 07:91:ca:07:49:b2:07:82:aa:d3:c7:d7:bd:0c:df:c9:48:58:35:84:3e:b2:d7:99:60:09:ce:43:ab:6c:69:27 cn =
addtrust qualified ca root sha-256 fingerprint: 80:95:21:08:05:db:4b:bc:35:5e:44:28:d8:fd:6e:c2:cd:e3:ab:5f:b9:7a:99:42:98:8e:b8:f4:dc:d0:60:16 cn = china internet network information center ev certificates root sha-256 fingerprint: 1c:01:c6:f4:db:b2:fe:fc:22:55:8b:2b:ca:32:56:3f:49:84:4a:cf:c3:2b:7b:e4:b0:ff:59:9f:9e:8c:7a:f7 cn = cnnic root sha-...
NSS 3.43 release notes
ag in sslexp.h ssl_sendcertificaterequest - allow server to request post-handshake client authentication. to use this both peers need to enable the ssl_enable_post_handshake_auth option. ...
... this bugz...
... this bugzilla query returns all the bugs fixed in nss 3.43: https://bugzilla.mozilla.
NSS 3.52 release notes
lternatively, defining nss_pkcs11_2_0_compat will yield the old definition. see the bug for more information. bug 1623374 - support new pkcs #11 v3.0 message interface for aes-gcm and chachapoly. bug 1612493 - integrate avx2 chacha20, poly1305, and chacha20poly1305 from hacl*. bugs fixed in nss 3.52 bug 1633498 - fix unused variable 'getauxval' error on ios compilation. bug 1630721 -
add softoken functions for fips. bug 1630458 - fix problem of gyp msvc builds not producing debug symbol files. bug 1629663 -
add ikev1 quick mode kdf. bug 1629661 - mpconfig calls in ssl initialize policy before nss is initialized. bug 1629655 - support temporary session objects in ckfw. bug 1629105 -
add pkcs11 v3.0 functions to module debug logger. bug 1626751 - fix error in generation of fu...
...ist structs to be packed. bug 1624377 - fix clang warning for unknown argument '-msse4'. bug 1623374 - support new pkcs #11 v3.0 message interface for aes-gcm and chachapoly. bug 1623184 - fix freebl_cpuid for querying extended features. bug 1622555 - fix argument parsing in lowhashtest. bug 1620799 - introduce nss_disable_gcm_arm32_neon to build on arm32 without neon support. bug 1619102 -
add workaround option to include both dtls and tls versions in dtls supported_versions. bug 1619056 - update readme: tls 1.3 is not experimental anymore. bug 1618915 - fix ubsan issue in ssl_parsesessionticket. bug 1618739 - don't assert fuzzer behavior in ssl_parsesessionticket. bug 1617968 - update delegated credentials implementation to draft-07. bug 1617533 - update hacl* dependencies for li...
...e both dtls and tls versions in dtls supported_versions. bug 1619056 - update readme: tls 1.3 is not experimental anymore. bug 1618915 - fix ubsan issue in ssl_parsesessionticket. bug 1618739 - don't assert fuzzer behavior in ssl_parsesessionticket. bug 1617968 - update delegated credentials implementation to draft-07. bug 1617533 - update hacl* dependencies for libintvector.h bug 1613238 -
add vector accelerated sha2 for power 8+. bug 1612493 - integrate avx2 chacha20, poly1305, and chacha20poly1305 from hacl*. bug 1612281 - maintain pkcs11 c_getattributevalue semantics on attributes that lack nss database columns. bug 1612260 -
add wycheproof rsa test vectors. bug 1608250 - broken fipstest handling of ki_len. bug 1608245 - consistently handle null slot/session. bug 1603801 - avo...
Utilities for nss samples
2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. */ #include "util.h" /* * these utility functions are adapted f...
...2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. */ #include "util.h" /* * these utility functions are adapted from those found in * the sectool lib...
...pen noise file."); return secfailure; } do { count = pr_read(fd,buf,sizeof(buf)); if (count > 0) { pk11_randomupdate(buf,count); } } while (count > 0); pr_close(fd); return secsuccess; } /* * filesize */ long filesize(const char* filename) { struct stat stbuf; stat(filename, &stbuf); return stbuf.st_size; } /* * re
adderfromfile */ secstatus re
adderfromfile(secitem *der, const char *infilename, prbool ascii) { secstatus rv = secsuccess; prfiledesc *infile = null; infile = pr_open(infilename, pr_rdonly, 0); if (!infile) { pr_fprintf(pr_stderr, "failed to open file \"%s\" (%ld, %ld).\n", infilename, pr_geterror(), pr_getoserror()); rv = secfailure; ...
nss tech note1
r component within the input data. it is made of two parts : the lower byte, which can contain asn.1 tags, and the upper 3 bytes, which can contain decoder modifiers. if only an asn.1 tag is specified without a modifier, then the decoder will enforce the presence of a component of that type, and fail if it does not match. ...
...rs. if only an asn.1 tag is specified without a modifier, then the decoder will enforce the presence of a component of that type, and fail if it does not match. if kind is an asn.1 sequence tag (sec_asn1_sequence), then you must specify
additional templates in a null-terminated array to define the content of the of the asn.1 sequence. if kind is the sec_asn1_choice modifier, you must also specify
additional templates in a null terminated array to list the various possible types that this component can have. in all other cases, only the first template structure passed to the decoder will be considered, even if
additonal templates are passed in an array. when only one template is needed, you do not need a null template to terminate the array. offset† . this field does not apply to all temp...
...should allocate the input data out of the same arena that you are passing to the decoder. this will allow you to free both the input data and the decoded data at once when freeing the arena. sec_asn1decodeitem can decode both ber and der data, while sec_quickderdecodeitem can only decode der data. sec_quickderdecodeitem does not support streaming data. this feature will most likely never be
added, as this decoder gets most of its extra speed from not making a copy of the input data, which would be required when streaming. sec_quickderdecodeitem supports sec_asn1_optional together with sec_asn1_skip sec_asn1_debug_break is not supported by sec_asn1decodeitem </tt> ...
PKCS11 FAQ
is call softokn3 (softokn3.dll on windows, libsoftokn3.so on most unix platforms). the nss softokn3 is not a complete pkcs #11 module, it was implemented only to support nss, though other products have managed to get it to work in their environment. there are a number of bugs against softoken's non-compliance, but these bugs have lower priority than fixing nss's non-complient uses of pkcs #11 or
adding new features to nss. if multiple pkcs #11 modules are loaded, how does nss determine which ones to use for the mechanisms required by ssl? nss uses the first slot it finds that can perform all the required operations. on servers, it's almost always the slot that contains the server's private key. does nss support the use of pkcs #11 callbacks specified in the pnotify and papplication parame...
...urrently use any of the callbacks. nss applications detect card insertion and deletion by means of polling to determine whether the card is still in the slot and whether the open session associated with that card is still valid, or by waiting on the c_waitforslotevent call. what must an x.509 certificate include to allow it to be recognized as an email certificate for use with s/mime? an email
address must be included in the attribute of the subject dn or the mail attribute of the subject dn. if the subject dn does not include an email
address, the certificate extension subjectaltname must include an email
address. the subjectaltname extension is part of the x.509 v3 and pkix specifications. if i have a multipurpose token that supports all required pkcs #11 functions and provides rsa_pkcs...
...te keys, nss uses the token (through pkcs #11) to generate the key and loads the user's certificate into the token. if the token is marked read/write and does not advertise that it can generate keys, nss generates the keys and loads them into the token. how is private key handled when an external pkcs #11 module is loaded? is it picked up from the token when securing, or does nss expect it to be
added in its private key database to use it? while certificates may be read into the temporary database, private keys are never extracted from the pkcs #11 module unless the user is trying to back up the key. nss represents each private key and a pointer to its pkcs #11 slot as a ck_object_handle. when nss needs to do anything with a private key, it calls the pcks #11 module that holds the key. if ...
PKCS #11 Module Specs
a pkcs #11 module 'on-the-fly'. recognized names all applications/libraries must be able recognize the following name values: library this specifies the path to the pkcs #11 library. name this specifies the name of the pkcs #11 library. parameter this specifies a pkcs #11 library parameter with the application must pass to the pkcs #11 library at c_initialize() time (see below). in
additions applications/libraries should be able to ignore
additional name value pairs which are used to specify configuration for other applications. of course these application/libraries should be able to parse their own name/value pairs. each of these name/value pairs are optional. if the library is not specified, the line represents some application specific meta configuration data. other applic...
...s inside nss_params are: flags - comma separated list of flag values, parsed case-insensitive. valid flag values are: internal - this library is actually the netscape internal library fips - this library is the netscape internal fips library. critical - if this library cannot be loaded, completely fail initialization. moduledb - this library includes nss specific functions to supply
additional module specs for loading. moduledbonly - this library has no pkcs #11 functions and is only used for loading
additional modules. trustorder - integer value specifying the order in which the trust information for certificates specified by tokens on this pkcs #11 library should be rolled up. '0' means that tokens on this library should not supply trust information (default). the relative ...
...e is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent 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. if tokens is not specified, then softoken would default to the following specs: in non-fips mode: tokens=<0x01=[configdir=configdir tokendescription=cryptotokendescription slotdescription=cryptoslotdescription flags=nocertdb,nokeydb,optimizespace]...
PKCS11 Implement
signing and decryption tokens can be used for s/mime and for encrypted transactions over unsecured networks such as the internet. multipurpose tokens provide the full range of cryptographic services. they can be thought of as cryptographic accelerator cards. future releases of nss will also support multipurpose tokens that are fips-140 compliant. table 1.2 summarizes the pkcs #11 functions (in
addition to the other functions described in this document) that nss expects each type of token to support. pkcs #11 functions required for different kinds of tokens external key distribution tokens signing tokens signing and decryption tokens multipurpose tokens c_encrypt c_decrypt ckm_rsa_pkcs ckm_rsa_x_509 (ssl 2.0 server only) c_decrypt ckm_rsa_pkcs ckm_rsa_x_509 (ssl 2.0 se...
...pkcs c_generaterandom c_save (when token runs out of sessions) c_restore (when token runs out of sessions) external key tokens need to support c_decrypt and c_sign. if they have a read/write value and can't generate a key pair, nss uses its own c_generatekeypair and loads the key with c_createobject. signing tokens just need to support c_sign and possibly c_generatekeypair. in
addition to c_sign and c_generatekeypair, signing and decryption tokens should also support c_decrypt and, optionally, c_unwrapkey. multipurpose tokens should support all the functions listed in table 1.2, except that c_wrapkey and c_unwrapkey are optional. the nss always attempts to use these two functions but uses c_encrypt and c_decrypt instead if c_wrapkey and c_unwrapkey aren't implemented. in...
...venient location on the user's hard disk, but you must tell the user to type the module name and location in the cryptographic modules portion of the communicator security info window. to do so, the user should follow these steps: click the security icon near the top of any communicator window. in the security info window, click cryptographic modules. in the cryptographic modules frame, click
add. in the create a new security module dialog box,
add the security module name for your module and the full pathname for the security module file. to avoid requiring the user to type long pathnames, make sure your module is not buried too deeply. semantics unique to nss these sections describe semantics required by nss but not specified by pkcs #11. supporting multiple sessions if you supp...
NSS tools : ssltab
f 6e 73 20 43 6f 72 70 6f | unications corpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...u... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .hardcore1'0%..u d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....hardcore cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | ii0...9805160103 <
additional data lines> ] <
additional records in same format> server socket closed. example 4 in this example, the -s option turns on ssl parsing, and the -h option turns on hex/ascii format. both formats are shown for each record. the output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt output connected to interzone.mcom.com:443 --> [ 0: 80 3d 01 03 00 00 24 00 00 00 1...
...usage tips when ssl restarts a previous 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 nam...
...ser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must allow for this possibility. see also the nss security tools are also documented at [1]http://www.mozilla.org/projects/security/pki/nss/.
additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [2]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [3]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code ch...
NSS tools : ssltap
f 6e 73 20 43 6f 72 70 6f | unications corpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...u... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .hardcore1'0%..u d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....hardcore cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | ii0...9805160103 <
additional data lines> ] <
additional records in same format> server socket closed. example 4 in this example, the -s option turns on ssl parsing, and the -h option turns on hex/ascii format. both formats are shown for each record. the output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt output connected to interzone.mcom.com:443 --> [ 0: 80 3d 01 03 00 00 24 00 00 00 1...
...usage tips when ssl restarts a previous 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 nam...
...ser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must allow for this possibility. see also the nss security tools are also documented at [1]http://www.mozilla.org/projects/security/pki/nss/.
additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [2]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [3]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code ch...
NSS Tools
sutil 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/plans pk12util 1.0 import and export keys and certificates between the cert/key databases and files in pkcs12 format. source, documentation, tasks/plans signtool 1.3 create digitally-signed jar archives contai...
...hanged between the client and server. the ssltap tool does not decrypt data, but it shows things like the type of ssl message (clienthello, serverhello, etc) and connection data (protocol version, cipher suite, etc). ...
...serverhello, etc) and connection data (protocol version, cipher suite, etc). this tool is very useful for debugging. ...
NSS tools : pk12util
r o 18 - pkcs12 decoder validate bags error o 19 - pkcs12 decoder import bags error o 20 - key db conversion version 3 to version 2 error o 21 - cert db conversion version 7 to version 5 error o 22 - cert and key dbs patch error o 23 - get default cert db error o 24 - find cert by nickname error o 25 - create export context error o 26 - pkcs12
add password itegrity error o 27 - cert and key safes creation error o 28 - pkcs12
add cert and key error o 29 - pkcs12 encode error examples importing keys and certificates the most basic usage of pk12util for importing a certificate or key is the pkcs#12 input file (-i) and some way to specify the security database being accessed (either -d for a directory or -h for...
...type. using the sqlite databases must be manually specified by using the sql: prefix with the given security directory. for example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb to set the shared database type as the default type for the tools, set the nss_default_db_type environment variable to sql: export nss_default_db_type="sql" this line can be set
added to the ~/.bashrc file to make the change permanent. most applications do not use the shared database by default, but they can be configured to use them. for example, this how-to article covers how to configure firefox and thunderbird to use the new shared nss databases: o https://wiki.mozilla.org/nss_shared_db_howto for an engineering draft on the changes in the shared ns...
... for an engineering draft on the changes in the shared nss databases, see the nss project wiki: o https://wiki.mozilla.org/nss_shared_db see also certutil (1) modutil (1) the nss wiki has information on the new database design and how to configure applications to use it. o https://wiki.mozilla.org/nss_shared_db_howto o https://wiki.mozilla.org/nss_shared_db
additional resources for information about nss and other tools related to nss (like jss), check out the nss project wiki at [1]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto irc: freenode at #dogtag-pki authors the nss tools were written and m...
NSS tools : ssltap
rpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...u... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .hardcore1'0%..u d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....hardcore cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | ii0...9805160103 <
additional data lines> ] <
additional records in same format> server socket closed. example 4 in this example, the -s option turns on ssl parsing, and the -h option turns on hex/ascii format. both formats are shown for each record. the output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt output connected to interzone.mcom.com:443 --> [ 0: 8...
... usage tips when ssl restarts a previous 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 complai...
...t the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must allow for this possibility. see also the nss security tools are also documented at [1]http://www.mozilla.org/projects/security/pki/nss/.
additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [2]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [3]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates dir...
GC Rooting Guide
ld write: jsobject * somefunction(jscontext *cx, js::handleobject obj) { // ... } js::mutablehandle<t> all gc thing pointers that are used as out-parameters must be wrapped in a js::mutablehandle<t>. a js::mutablehandle<t> is a reference to a js::rooted<t> that, unlike a normal handle, may modify the underlying js::rooted<t>. all js::mutablehandle<t>s are created through an explicit "&" -
address of operator - on a js::rooted<t> instance. js::mutablehandle<t> is exactly like a js::handle<t> except that it
adds a .set(t &t) method and must be created from a js::rooted<t> explicitly. there are typedefs for js::mutablehandle<t>, the same as for the other templates: template class typedef js::mutablehandle<js::value> js::mutablehandlevalue js::mutabl...
...your case is not covered by one of these, it is possible to write your own by deriving from js::customautorooter and overriding the virtual trace() method. the implementation should trace all the gc things contained in the object by calling js::traceedge. gc things on the heap js::heap<t> gc thing pointers on the heap must be wrapped in a js::heap<t>. the only exception to this is if they are
added as roots with the js::persistentrooted class, but don't do this unless it's really necessary. js::heap<t> pointers must also continue to be traced in the normal way, which is covered below. js::heap<t> doesn't require a jscontext*, and can be constructed with or without an initial value parameter. like the other template classes, it functions as if it were the gc thing pointer itself. one c...
...obal alive, so if your class/struct is reachable in any way from that global, then nothing will ever be cleaned up by the gc. summary use js::rooted<t> typedefs for local variables on the stack. use js::handle<t> typedefs for function parameters. use js::mutablehandle<t> typedefs for function out-parameters. use an implicit cast from js::rooted<t> to get a js::handle<t>. use an explicit
address-of-operator on js::rooted<t> to get a js::mutablehandle<t>. return raw pointers from functions. use js::rooted<t> fields when possible for aggregates, otherwise use an autorooter. use js::heap<t> members for heap data. note: heap<t> are not "rooted": they must be traced! do not use js::rooted<t>, js::handle<t> or js::mutablehandle<t> on the heap. do not use js::rooted<t> for function par...
Statistics API
with multi-process firefox (e10s) it is necessary to set security.sandbox.content.level = 0, otherwise the content process will crash. the browser preference javascript.options.mem.log controls dumping of human-readable gc stats messages to the developer console. the browser preference javascript.options.mem.notify controls emission of json encoded gc stats to an observer interface. json api
addons can obtain the complete data in json format via an observer. the following
adds an observer using the jetpack framework. var prefs = require("api-utils/preferences-service"); components.utils.import('resource://gre/modules/services.jsm'); function observer(subject, topic, json) { var data = json.parse(json); // process the data } prefs.set("javascript.options.mem.notify", true); ser...
... total_time: number (milliseconds) - the amount of wall time that this gc consumed. ...
...st two fields require a bit of elaboration. gc work can be divided into phases, such as marking or sweeping. the division into phases is hierarchical, so a phase can be split into subphases. for example, the sweep phase includes the time for the sweep_atoms, sweep_tables, sweep_compartments phases and so on. the times object gives how much time was spent in each phase of the gc, in milliseconds.
additionally, an incremental gc is divided into a series of slices (the division into slices is completely separate from the division into phases; neither one is a refinment of the other). a little bit of gc work is done in each slice. in between slices, other browser code is allowed to run. the slices array describes how long each slice took and what work was done during the slice. each element of t...
JSAPI Cookbook
js::callargs args = js::callargsfromvp(argc, vp); jsobject *global = js_getglobalforobject(cx, &args.callee()); ... } defining a function // javascript function justforfun() { return null; } /* jsapi */ bool justforfun(jscontext *cx, unsigned argc, js::value *vp) { js::callargs args = js::callargsfromvp(argc, vp); args.rval().setnull(); return true; } ... /* *
add this to your jscontext setup code. * this makes your c function visible as a global function in javascript. */ if (!js_definefunction(cx, global, "justforfun", &justforfun, 0, 0)) return false; to define many jsapi functions at once, use js_definefunctions. creating an array // javascript var x = []; // or "x = array()", or "x = new array" /* jsapi */ js::rootedobject x(cx, js_newarr...
... /* jsapi */ js_setpendingexception(cx, exc); return false; when js_reporterror creates a new error object, it sets the filename and linenumber properties to the line of javascript code currently at the top of the stack. this is usually the line of code that called your native function, so it's usually what you want. ...
...(val)) return throwerror(cx, global, "string is not an object", __file__, __line__); string = jsval_to_object(val); // get string.prototype. if (!js_getproperty(cx, string, "prototype", &val)) return false; if (jsval_is_primitive(val)) return throwerror(cx, global, "string.prototype is not an object", __file__, __line__); string_prototype = jsval_to_object(val); // ...and now we can
add some new functionality to all strings. if (!js_defineproperty(cx, string_prototype, "md5sum", js::undefinedvalue(), getmd5func, null, jsprop_shared | jsprop_native_accessors | jsprop_enumerate)) return false; wanted simulating for and for each. actually outputting errors. how to write your own jsclass with reserved slots. create global variable __dirname to retr...
JS::AutoVectorRooter
returns the range of the array. const t &back() const returns the last element. description js::autovectorrooter<t> holds a variable-size rooted array of type t. ...
...nt. description js::autovectorrooter<t> holds a variable-size rooted array of type t. ...
...ter<jsscript *> see also mxr id search for js::autovectorrooter mxr id search for js::autovaluevector mxr id search for js::autoidvector mxr id search for js::autoobjectvector mxr id search for js::autofunctionvector mxr id search for js::autoscriptvector js::autovaluearray<n> - fixed-size array of js::value bug 677079 bug 868580 - expose js::autoobjectvector bug 848592 -
added js::autofunctionvector bug 676281 -
added js::autoscriptvector ...
JS::MutableHandle
the underlying storage can be changed. this is useful for outparams. syntax bool somefunction(jscontext *cx, js::mutablehandle<t> outparam) { ... } methods here, ptr represents the private member of js::mutablehandle<t>, typed with t *. method description const t &get() const returns *ptr. operator const t&() const t operator->() const t *
address() returns ptr. void set(t v) sets the value of *ptr to v. description js::mutablehandle<t> is a non-const reference to js::rooted<t>. it is used in the same way as js::handle<t> and includes a |set(const t &v)| method to allow updating the value of the referenced js::rooted<t>. a js::mutablehandle<t> can be created from a js::rooted<t> by using |...
... sets the value of *ptr to v. description js::mutablehandle<t> is a non-const reference to js::rooted<t>. it is used in the same way as js::handle<t> and includes a |set(const t &v)| method to allow updating the value of the referenced js::rooted<t>. a js::mutablehandle<t> can be created from a js::rooted<t> by using |js::rooted<t>::operator&()|. if you want to
add additional methods to js::mutablehandle for a specific specialization, define a js::mutablehandlebase<t> specialization containing them. there are typedefs available for the main types: namespace js { typedef mutablehandle<jsfunction*> mutablehandlefunction; typedef mutablehandle<jsid> mutablehandleid; typedef mutablehandle<jsobject*> mutablehandleobject; typedef mutablehandle<jsscript...
...r id search for js::mutablehandle mxr id search for js::mutablehandlefunction mxr id search for js::mutablehandleid mxr id search for js::mutablehandleobject mxr id search for js::mutablehandlescript mxr id search for js::mutablehandlestring mxr id search for js::mutablehandlesymbol mxr id search for js::mutablehandlevalue js::rooted js::handle gc rooting guide bug 770759 bug 761391 -
added js::mutablehandlescript bug 645416 -
added js::mutablehandlesymbol ...
JS::SetLargeAllocationFailureCallback
eallocationfailurecallback afc, void *data); name type description rt jsruntime * the jsruntime for which to set the gc callback. cb js::largeallocationfailurecallback pointer to the new callback function to use. data void * data parameter which will be passed to js::largeallocationfailurecallback. ...
...lback pointer to the new callback function to use. data void * data parameter which will be passed to js::largeallocationfailurecallback.
added in spidermonkey 38 callback syntax typedef void (* js::largeallocationfailurecallback)(void *data); name type description data void * data parameter passed to js::setlargeallocationfailurecallback.
added in spidermonkey 38 description if a large allocation fails when calling pod_{calloc,realloc}cangc, the js engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc. to make some room. the allocation will then be retried (and may still fail.) js::setlargeallocationfailurecallback sets a callback function f...
...ailure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc. to make some room. the allocation will then be retried (and may still fail.) js::setlargeallocationfailurecallback sets a callback function for it. see also mxr id search for js::setlargeallocationfailurecallback mxr id search for js::largeallocationfailurecallback bug 936236 bug 987995 -
added data parameter ...
JS::SetOutOfMemoryCallback
error. syntax void js::setoutofmemorycallback(jsruntime *rt, js::outofmemorycallback cb, void *data); name type description rt jsruntime * the jsruntime for which to set the gc callback. cb js::outofmemorycallback pointer to the new callback function to use. data void * data parameter which will be passed to js::outofmemorycallback. ...
... js::outofmemorycallback pointer to the new callback function to use. data void * data parameter which will be passed to js::outofmemorycallback.
added in spidermonkey 38 callback syntax typedef void (* outofmemorycallback)(jscontext *cx, void *data); name type description data void * data parameter passed to js::setoutofmemorycallback.
added in spidermonkey 38 description unlike the error reporter, which is only called if the exception for an oom bubbles up and is not caught, the js::outofmemorycallback is called immediately at the oom site to allow the embedding to capture the current state of heap allocation before anything is freed. if the large-allocation-failure callback is called at all (not all allocation sites call ...
...ion-failure callback on failure), it is called before the out-of-memory callback; the out-of-memory callback is only called if the allocation still fails after the large-allocation-failure callback has returned. js::setoutofmemorycallback sets a callback function for it. see also mxr id search for js::setoutofmemorycallback mxr id search for js::outofmemorycallback bug 969415 bug 987995 -
added data parameter ...
JSExtendedClass
obsolete since javascript 1.8.5this 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. jsextendedclass is an extended version of jsclass with
additional hooks. a c/c++ program can use a jsextendedclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++. syntax struct jsextendedclass { jsclass base; jsequalityop equality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;//
added in spidermonkey 1.8 jsobjectop wrappedobject; //
added in spidermonkey 1.8 ...and
additional reserved fields. }; name t...
...me required fields. equality jsequalityop optional. overrides the javascript == and != operators. outerobject jsobjectop optional. return the current outer object. this is used to implement split objects. innerobject jsobjectop optional. return the current inner object. this is used to implement split objects. iteratorobject jsiteratorop
added in spidermonkey 1.8 optional. creates and returns a new iterator. wrappedobject jsobjectop
added in spidermonkey 1.8 optional. if non-null, an object of this class may serve as a wrapper for another object. wrappers sometimes transparently behave like the object they wrap. for example, an object and its wrappers are all equal under ===. description to implement a custom cla...
...ll, an object of this class may serve as a wrapper for another object. wrappers sometimes transparently behave like the object they wrap. for example, an object and its wrappers are all equal under ===. description to implement a custom class that uses any of the jsextendedclass callbacks: create a jsextendedclass and populate both the base fields and the extended fields. ensure that the
additional reserved fields at the end of the jsextendedclass are null. jsclass and jsextendedclass structs should usually be global, and in this case the compiler automatically initializes these fields to null. (this is a feature of the c and c++ languages.) otherwise, use memset. set the jsclass_is_extended flag in myextendedclass.base.flags. pass &myextendedclass.base to functions like js_initcla...
JS_DefineFunction
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> object for which to define a function as a property (method). name const char * or const char16_t * name to ...
...e the function. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> object for which to define a function as a property (method). name const char * or const char16_t * name to assign to the function. id js::handle<jsid> a pointer to jsid for name to assign to the function.
added in spidermonkey 17 call jsnative the native c/c++ function to be wrapped by the new function. nargs unsigned number of arguments that are passed to the function when it is called. flags unsigned the logical or of zero or more property attributes. description js_definefunction exposes a c/c++ function to scripts by defining a new method on an ex...
...n return a pointer to the new function. ...
JS_DefineFunctions
syntax bool js_definefunctions(jscontext *cx, js::handle<jsobject*> obj, const jsfunctionspec *fs, propertydefinitionbehavior behavior = defineallproperties); in spidermonkey versions prior to spidermonkey 24, fs was not const. name type description cx jscontext * the context in which to define functions. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the object on which functions are to be defined. fs const jsfunctionspec * a null-terminated array of function specifications. each element of the array defines an individual function. ...
...ires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the object on which functions are to be defined. fs const jsfunctionspec * a null-terminated array of function specifications. each element of the array defines an individual function. behavior propertydefinitionbehavior see below.
added in spidermonkey 38 enum propertydefinitionbehavior { defineallproperties, onlydefinelateproperties, dontdefinelateproperties }; name description defineallproperties define all properties regardless of their flags. onlydefinelateproperties define only properties which have a jsprop_define_late flag. dontdefinelateproperties def...
... flag should be defined on the object. ...
JS_DeleteProperty
removes a specified property from an object. ...
... removes a specified property from an object. ...
...permanent property caused an error. ...
JS_FS
macros for describing functions, for use with js_defineproperties and js_initclass. syntax #define js_fs(name,call,nargs,flags) ... #define js_fn(name,call,nargs,flags) ... #define js_sym_fn(symbol,call,nargs,flags) ... //
added in spidermonkey 38 #define js_fninfo(name,call,info,nargs,flags) ... //
added in spidermonkey 17 #define js_self_hosted_fn(name,selfhostedname,nargs,flags) ... //
added in spidermonkey 31 #define js_self_hosted_sym_fn(symbol, selfhostedname, nargs, flags) ... //
added in spidermonkey 38 #define js_sym_fnspec(symbol, call, info, nargs, flags, selfhostedname) ... //
added in spidermonkey 38 #define js_fnspec(name,call,info,nargs,flags,selfhostedname) ... //
added in spidermonkey 31 #define js_fs_end ... name type description name ...
...arguments the function expects. flags uint16 the bitwise or of any number of function flags. selfhostedname const char * the function's name in self-hosted javascript code. description use these macros to define an array of jsfunctionspecs to pass to js_definefunctions or js_initclass. js_fn (whose name pays homage to the old jsnative/jsfastnative split) simply
adds the flag jsfun_stub_gsops. js_fninfo allows the simple
adding of jsjitinfos. js_self_hosted_fn declares a self-hosted function. finally js_fnspec has slots for all the fields. the _sym variants allow defining a function with a symbol key rather than a string key. for example, use js_sym_fn(iterator, ...) to define an @@iterator method. (in builds without es6 symbols, it defines a method with the...
...ator".) see an example in the jsapi user guide. see also mxr id search for js_fs mxr id search for js_fn mxr id search for js_sym_fn mxr id search for js_fninfo mxr id search for js_self_hosted_fn mxr id search for js_self_hosted_sym_fn mxr id search for js_sym_fnspec mxr id search for js_fnspec mxr id search for js_fs_end jsfunctionspec js_defineproperties js_initclass bug 775788 -
added js_fninfo. bug 920433 -
added js_self_hosted_fn and js_fnspec. bug 1082672 -
added js_sym_fn js_self_hosted_sym_fn js_sym_fnspec. ...
JS_GC
obsolete since jsapi 50 description js_gc performs garbage collection of js objects, strings and other internal data structures that are no longer reachable in the specified context or runtime. ...
...obsolete since jsapi 50 description js_gc performs garbage collection of js objects, strings and other internal data structures that are no longer reachable in the specified context or runtime. ...
...hat are no longer reachable in the specified context or runtime. garbage collection frees memory so that it can be reused by the system. when your scripts create many objects, you may want to call js_gc directly in your code, particularly when a script terminates or when the application has idle time. to perform garbage collection only if needed, call js_maybegc instead. use js_setgccallback to
add hooks that are called during garbage collection. see also mxr id search for js_gc js_maybegc bug 737364 -- changed to jsruntime bug 1283855 -- changed to jscontext ...
JS_GetInstancePrivate
retrieve the private data associated with an object, if that object is an instance of a specified class. syntax void * js_getinstanceprivate(jscontext *cx, js::handle<jsobject*> obj, const jsclass *clasp, js::callargs *args); //
added in jsapi 32 void * js_getinstanceprivate(jscontext *cx, js::handle<jsobject*> obj, const jsclass *clasp, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * a context. ...
... const jsclass *clasp, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * a context. obj js::handle<jsobject*> the object for which to retrieve private data. clasp jsclass * class against which to test the object. args js::callargs * optional argument, used for error reporting.
added in spidermonkey 32 argv jsval * optional argument vector, used for error reporting. obsolete since jsapi 32 this must be one of the following: an argv pointer created by the javascript engine and passed to a jsnative callback; js_argv(cx, vp) where vp is a pointer created by the engine and passed to a jsfastnative callback; or null. descri...
...fore returning null. ...
JS_New
this article covers features introduced in spidermonkey 1.8 create an object as though by using the new keyword and a javascript function. syntax jsobject * js_new(jscontext *cx, js::handleobject ctor, const js::handlevaluearray& args); //
added in jsapi 32 jsobject * js_new(jscontext *cx, jsobject *ctor, unsigned argc, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * the context in which to create the new object. requires request. ...
... since jsapi 32 name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ctor js::handleobject the constructor function object. args js::handlevaluearray & an array of argument values to pass to the constructor.
added in spidermonkey 38 argc unsigned the number of arguments to pass to the constructor. obsolete since jsapi 32 argv jsval * pointer to the element 0 of an array of argument values to pass to the constructor. if argc is 0, this may be null. obsolete since jsapi 32 description js_new creates a new object as though by using the new operator, as described in ecma...
...equivalent to the javascript expression new ctor(...args), and js_new(cx, ctor, argc, argv) is equivalent to the javascript expression new ctor(argv[0], argv[1], ... argv[argc-1]). if ctor is not an object that can be used as a constructor, a typeerror is raised. on success, js_new returns a pointer to the new object. on error, it returns null. see also mxr id search for js_new bug 480850 -
added bug 959787 -
added args parameter ...
JS_NewExternalString
he string will be garbage collected, and the javascript engine will call the string finalizer callback, allowing the application to free the array.) the array does not need to be zero-terminated. length size_t the number 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. this must be an id number previously returned by a successful call to js_
addexternalstringfinalizer. obsolete since jsapi 13 closure void * (js_newexternalstringwithclosure only) arbit...
...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. ...
...nalstring 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. since the program allocated the memory, it will need to free it; this happens in an external string finalizer indicated by the type parameter. js_newexternalstringwithclosure works similarly, except it accepts an
additional parameter, closure, which is saved in the string's internal data structure. it can be retrieved later by calling js_getexternalstringclosure. this is application-defined data you can associate with the string. to determine if a string was created as an external string, you can call js_isexternalstring. see also mxr id search for js_newexternalstring js_getexternalstringclosure js_is...
JS_PreventExtensions
attempts to forbid the
addition of any new properties to an object. syntax //
added in spidermonkey 45 bool js_preventextensions(jscontext *cx, js::handleobject obj, js::objectopresult &result); // obsolete since jsapi 39 bool js_preventextensions(jscontext *cx, js::handleobject obj, bool *succeeded); name type description cx jscontext * the context. 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.
added in spidermonkey 45 succeeded bool * outparam indicating, on jsapi success, whether the object is now non-extensible. obsole...
... in some situations, it may be convenient to prohibit new properties. in javascript this may be accomplished using the object.preventextensions method. the similar jsapi method is js_preventextensions. ...
...s_preventextensions(cx, obj, &succeeded); // // rv == true, succeeded == false note that as with most jsapi methods, *succeeded is only set if js_preventextensions returns true (that is, does not fail). thus you should always check the return value of js_preventextensions, and only if that is true check the value of *succeeded. see also mxr id search for js_preventextensions bug 1113369 --
added result parameter ...
JS_PropertyStub
default implementations of the required callbacks in jsclass. ...
... *cx, jsobject *obj); // obsolete since jsapi 14 description the stub functions are not designed to be called directly by a jsapi application. rather, they are convenient stand-ins anywhere the jsapi requires callbacks of certain types. examples at jsclass illustrate how stub functions can be used. js_propertystub is of type jspropertyop, the type of getter callback. it can be used in jsclass.
addproperty, and jsclass.getproperty. it behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true. js_strictpropertystub is of type jsstrictpropertyop, the type of setter callback. it can be used in jsclass.setproperty. it behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true.
...e with the default defaultvalue algorithm in es5 §8.12.8. js_finalizestub is a stub for jsclass.finalize. it does nothing. see also mxr id search for js_propertystub mxr id search for js_strictpropertystub jspropertyop jsstrictpropertyop bug 1103152 - removed js_deletepropertystub, js_enumeratestub, js_resolvestub, and js_convertstub bug 736978 - removed js_finalizestub bug 1113369 --
added result parameter ...
Signing Mozilla apps for Mac OS X
the keychain access application on your mac. if the "developer id" radio button is greyed out you probably have a group account. these types of accounts only allow for the "agent" role to create developer ids. contact the person who created your group apple developer account if you get stuck here. the codesign tool apple provides a tool called codesign; this command-line application is used to
add a signature to an application bundle. the man page for codesign is available online, or you can simply type "man codesign" in a terminal window. the main options of note are: -s your-signing-identity lets you specify the signing certificate you want to sign the application with your-signing-identity is the name of your certificate. --keychain /path/to/keychain lets you specify which keychai...
...sign to overwrite an existing signature on the application. -v increases the verbosity of the codesign tool's output. --deep for v2 signing, sign all nested executables with the same settings. note that you cannot specify an identifier requirement if you do this, or otherwise you need to sign the outer application again with the identifier requirement. --requirement 'designated requirement'
adds
additional requirements for verifying the signature and application metadata. at a minimum you'll need to provide: identifier: this must be the same as the value of the cfbundleidentifier specified in your application's info.plist file. leaf[subject.ou]: this needs to be the subject ou of your developer id. you can find it by running this command in the terminal: openssl x509 -text -noout...
...has been signed, the signature of an application bundle can be validated by calling: codesign -vvvv application.app where application.app is the application bundle you wish to validate. the folder will fail to validate if any of these cases occur (there may be other cases not listed here): if any files that were included in the signature have been removed or modified if any files have been
added to a folder that should have all files signed the coderesources file this file is located in your application's bundle at contents/_codesignature/coderesources. if you don't provide one, codesign will automatically generate it. however, to modify apple's automatic signing process (for example, to exclude a file or folder), you'll need to provide this file.. once the application bundle is sig...
AT APIs Support
f these products on windows, linux/unix and os x platforms. accessible gecko gecko is a rendering engine that firefox, seamonkey, netscape and yelp use. gecko can render a variety of content, not just html and supports key web standards such as cascading style sheets, javascript and the w3c dom. gecko also handles the users keystrokes and mouse clicks. gecko is the core architecture that we are
adding accessibility to, in order to support basic accessibility in all applications that are based on it. gecko based applications gecko can be used in two ways to create application: embedded clients embedded clients use gecko only in the content window, at the moment for html and generic xml only. they typically use standard windows controls for their user interface -- the area outside of the ...
...ery simple package, great for testing basic html accessibility with your products and the gecko rendering engine (please contact us for a copy). k-meleon - light, ultra-fast and more advanced (fully configurable) gecko-based web browser available on the windows platform on linux/unix platform yelp help viewer - the help viewer in gnome evolution email - provides integrated mail,
addressbook and calendaring functionality to users of the gnome desktop. on mac platform camino - web browser for os x xul applications xul applications make full use of the gecko architecture, not only for html content, but also for the entire user interface. widgets such as menus, tab panels, tree views and dialogs are provided via an xml language called xul (extensible user-int...
...anels, tree views and dialogs are provided via an xml language called xul (extensible user-interface language). none of the user interface contains standard os controls. this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances). developing a xul window is not that different from developing a web page, but the elements available to
add widgets are more powerful and designed to be similar to desktop widgets. examples of xul applications: firefox - web-browser thunderbird - email client seamonkey - web-browser, advanced e-mail and newsgroup client, irc chat client, and html editing made simple sunbird - cross-platform calendar application kompozer - a complete web authoring system for linux desktop, microsoft windows and ...
Generating GUIDs
guids are used in mozilla programming for identifying several types of entities, including xpcom interfaces (this type of guids is callled iid), components (cid), and legacy
add-ons—like extensions and themes—that were created prior to firefox 1.5.
add-ons can (and should) be identified with ids of the form extensionname@organization.tld since firefox 1.5. warning: if you just want an id for your
add-on, generating a guid is almost definitely not what you want to do. using the extensionname@organization.tld form is approximately one thousand times easier for everyone involved. don't have a domain name? do you have a blog on a subdomain? use that. if all else fails, using extensionname@yourusername.
addons.mozilla.org should be fine; no one will care. remember, these are ident...
...on, generating a guid is almost definitely not what you want to do. using the extensionname@organization.tld form is approximately one thousand times easier for everyone involved. don't have a domain name? do you have a blog on a subdomain? use that. if all else fails, using extensionname@yourusername.
addons.mozilla.org should be fine; no one will care. remember, these are identifiers, not e-mail
addresses, and they're never resolved. ...
...la.org should be fine; no one will care. remember, these are identifiers, not e-mail
addresses, and they're never resolved. canonical form the common form of a guid is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x stands for a hexadecimal digit. there are a number of tools that can be used to generate a guid in the canonical form. note: if you do choose to use an email-style id for your
add-on, you probably don't want it to be a real email
address, since it might attract spam. online tools generate guid online uuid (guid) generator on the web uuid generator for mozilla code (both idl and c++.h forms) you can get a guid from one of the bots (such as botbot, firebot) on #firefox irc channel by /msging "uuid" to them. windows windows users can use the guidgen tool from micro...
Component Internals
brary, it must export a single method named nsgetmodule. this nsgetmodule function is the entry point for accessing the library. it gets called during registration and unregistration of the component, and when xpcom wants to discover what interfaces or classes the module/library implements. in this chapter we will outline this entire process. as a component in the xpcom framework illustrates, in
addition to the nsgetmodule entry point, there are nsimodule and nsifactory interfaces that control the actual creation of the component, and also the string and xpcom glue parts, which we'll discuss in some detail in the next section (see xpcom glue). these latter supply ease-of-development utilities like smart pointers, generic modules support, and simple string implementations. the largest and pos...
...component architecture of xpcom. type library manifests type library manifests contain the following information: location of all type library files mapping of all known interfaces to type libraries where these structures are defined using the data in these two manifests, xpcom knows exactly which component libraries have been installed and what implementations go with which interfaces.
additionally, it relates the components to the type libraries in which the binary representations of the interfaces they support are defined. the next section describes how to hook into the xpcom startup and registration process and make the data about your component available in these manifests, so that your component will be found and registered at startup. registration methods in xpcom what is...
...ation in more detail. autoregistration the term autoregistration is sometimes used synonymously with registration in xpcom. in the what is xpcom registration? note, we describe the three ways you can register components with xpcom. sometimes, applications use the nsicomponentregistrar interface and create their own code for watching a particular directory and registering new components that are
added there, which is what's often referred to as autoregistration. you should always know what the installation and registration requirements are for the applications that will be using your component. the shutdown process when the application is ready to shutdown xpcom, it calls ns_shutdownxpcom. when that method is called, the following sequence of events occurs: xpcom fires a shutdown notifi...
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. ...
...script 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 then check out platform/xpcom module first.inheriting from implementation classesgiven that idl interfaces map to abstract classes in c++, a common problem when dealing with idl is when you have an idl inheritance hierarchy, and a corresponding c++ implementation hierarchy, you run into multiple inheritance. that's not inherently multiple inheritanc...
...for multiple objects with a numeric, zero-based index.xpcom changes in gecko 2.0several changes that affect xpcom component compatibility are taking place in gecko 2. this article details those changes, and provides suggestions for how to update your code.xpcom hashtable guidea hashtable is a data construct that stores a set of items. each item has a key that identifies the item. items are found,
added, and removed from the hashtable by using the key. hashtables may seem like arrays, but there are important differences:xpcom stream guidein mozilla code, a stream is an object which represents access to a sequence of characters. it is not that sequence of characters, though: the characters may not all be available when you read from the stream. ...
Language bindings
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 original context will see that through an xraywrapper already), so it's guaranteed to behave predictably. this is useful for privileged code, such as
add-on code, to access variables and apis defined in web content.components.utils.exportfunctionthis function provides a safe way to expose a function from a privileged scope to a less-privileged scope.components.utils.forcegccomponents.utils.forcegc lets scripts force a garbage collection cycle. the mozilla javascript engine will perform garbage collection automatically when the javascript heap grow...
...arbage collection. you can get details on what this method 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. ...
...e it.pyxpcompyxpcom allows for communication between python and xpcom, such that a python application can access xpcom objects, and xpcom can access any python class that implements an xpcom interface. pyxpcom is actively used in activestate komodo products, for example.rbxpcomrbxpcom (ruby cross-platform com) provides bindings between the popular ruby programming language and xpcom. you can find
additional information using the resource links below.xpconnectxpconnect is a bridge between javascript and xpcom. with xpconnect, you can use xpcom components from javascript code, and interact with javascript objects from within xpcom components. xpconnect is part of firefox and is actively used in xul applications. ...
nsAutoString
it is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64 characters. ...
...urce buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const prunichar**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
nsCAutoString
it is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64 characters. ...
...arameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const char**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
RefPtr
refptr (formerly known as nsrefptr, see bug 1207245) is a general class to implement reference counting pointers for objects. it is similar to nscomptr, but does not require that the type be an xpcom interface. like with nscomptr, it is the responsibility of the object itself to implement reference counting. this is done using the functions
addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper around a count of the number of references refering to the class. when should i use nscomptr versus refptr? the rules are simple: use nscomptr to hold pointers to xpcom interfaces, and use refptr to hold pointers to concrete class, even if the concrete class implements one or more xpcom interfaces. so for xpcom interfaces: nscomptr<n...
...r to hold pointers to concrete class, even if the concrete class implements one or more xpcom interfaces. so for xpcom interfaces: nscomptr<nsisupports> a; nscomptr<nsifoo> foo; and for concrete classes: refptr<nsfoo> foo; // class that implements nsifoo; refptr<bar> bar; // some random class that i want ref-counted but has nothing to do with xpcom: // just implement
addref() and release() and it will work with refptr it is important that nscomptr is not used to hold a pointer to a concrete class since this can cause compile time errors or runtime errors. bug 756640 is on file to enforce this rule but hasn't yet been fixed. while refptr should not generally be used to hold a pointer to an xpcom interface, this is flexible. there are no technical problems with ...
...} see this post for more details. ...
IAccessible2
other-licenses/ia2/accessible2.idlnot scriptable please
add a summary to this article. 1.0 66 introduced gecko 1.9 inherits from: iaccessible last changed in gecko 1.9 (firefox 3) method overview [propget] hresult attributes([out] bstr attributes ); [propget] hresult extendedrole([out] bstr extendedrole ); [propget] hresult extendedstates([in] long maxextendedstates, [out, size_is(,maxextendedstates), length_is(, nextendedstates)] bstr extendedstates, [out] long nextendedstates ); [propget] hresult groupposition([out] long grouplevel, [out] long similaritemsingroup, [out] long positioningroup ); [propget] hresult indexinparent([out] long indexinparent ); [propget] hresult locale([out] ia2locale locale ); [propget] hresult localizedextendedrole(...
...nt( [in] enum ia2coordinatetype coordinatetype, [in] long x, [in] long y ); parameters coordinatetype specifies whether the coordinates are relative to the screen or the parent object. x defines the x coordinate. y defines the y coordinate. return value e_invalidarg if bad [in] passed. s_ok. states() returns the bit strip containing any iaccessible2 states. the iaccessible2 states are in
addition to the msaa states and are defined in the ia2states enum. [propget] hresult states( [out] accessiblestates states ); parameters states return value s_ok. uniqueid() returns the unique id. the uniqueid is an identifier for this object, is unique within the current window, and remains the same for the lifetime of the accessible object. the uniqueid is not related to: the msaa objectid w...
...r to disambiguate between iaccessibles per hwnd or the msaa childid which is used to disambiguate between children being managed by an iaccessible. this value is provided so the at can have access to a unique runtime persistent identifier even when not handling an event for the object. an example of when this value is useful is if the at wants to build a cache. the at could cache the uniqueids in
addition to other data being cached. when an event is fired the at could map the uniqueid to its internal model. thus, if there's a reorder/show/hide event the at knows which part of the internal structure has been invalidated and can refetch just that part. this value can also be used by an at to determine when the current control has changed. if the role is the same for two controls that are adjace...
mozIAsyncHistory
toolkit/components/places/moziasynchistory.idlscriptable this interface allows you to
add multiple visits to a single url in a batch. 1.0 66 introduced gecko 24.0 inherits from: nsisupports last changed in gecko 24.0 (firefox 24.0 / thunderbird 24.0 / seamonkey 2.21) implemented by: @mozilla.org/browser/history;1 as a service: var asynchistory = components.classes["@mozilla.org/browser/history;1"] .getservice(components.interfaces.moziasynchistory); method overview void getplacesinfo(in jsval aplaceidentifiers, in mozivisitinfocallback acallback); void isurivisited(in nsiuri auri, in mozivisitedstatuscallback acallback); void updateplaces(in moziplaceinfo, [optional] in mozivisitinfocallback acallback); m...
...ri, in mozivisitedstatuscallback acallback ); parameters auri the places for which to retrieve information, identified by either a single place guid, a single uri, or a js array of uris and/or guids. acallback an object implementing the mozivisitedstatuscallback.isvisited() method; this method will be called with the results once the request has been completed. updateplaces()
adds a set of visits for one or more moziplaceinfo objects, and updates each moziplaceinfo's title or guid. note that this lets you
add to history even in private browsing mode; if that's not desired you can first check whether the window is in private browsing mode. void updateplaces( in moziplaceinfo aplaceinfo, in mozivisitinfocallback acallback optional ); parameters aplaceinfo the...
...heck whether the window is in private browsing mode. void updateplaces( in moziplaceinfo aplaceinfo, in mozivisitinfocallback acallback optional ); parameters aplaceinfo the moziplaceinfo object[s] containing the information to store or update. this can be a single object, or an array of objects. acallback optional a mozivisitinfocallback object to be notified for each visit
addition, title change, guid change, or error. if more than one operation is performed for a given visit, only one callback will be given (i.e. title change and
add visit). exceptions thrown ns_error_invalid_arg passing in null for aplaceinfo. not providing at least one valid guid or uri for all moziplaceinfo object[s]. not providing an array or nothing for the visits property of ...
mozIRegistry
ing i can pawn off the chore of implementing it to somebody else). there's another component that turns out to also be real important when you go to hook up your code with other mozilla components. that's the service manager. i'm just starting to understand the role it plays in this and it isn't really under my jurisdiction, so there's nothing about it here right now. in the future, i'll either
add the information about it or at least put in a link to it's documentation. higher-level application components this box represents all the potential user's of the core registry/repository interfaces. your code (most likely) falls in this box. these components will, to various degrees, need to use other components to do their thing. those other components presumably implement particular xpcom i...
...: identifying the implementers of a given interface. figuring out an appropriate implementation given some arbitrary desired properties. nsrepository this is basically the same as is provided today (see mozilla/xpcom/public/nsrepository.h). the primary change to this component is that we will modify it to utilize the new moziregistry interface versus the nsreg.h functions it calls today. in
addition, it likely will have a couple of minor extensions: support for specifying the .reg file name on initialize(). i think this might make it a little more flexible, thereby making xpcom more general-purpose.
adding support so that the underlying moziregistry implementation can be tailored by the initializer (client application). this is so that one can choose the basic libreg-based registr...
...e mozilla/xpcom/public/nsiservicemanager.h). mozregistry this is the simplistic implementation of the moziregistry interface. it is built as a simple c wrapper for the functions in nsreg.h. it is intended to provide a (slightly) lighter-weight implementation that is entirely compatible with current libreg usage. mozrdfregistry this is an rdf-based moziregistry implementation that will provide
additional capabilities. note that these
additional capabilities will not be utilized by nsrepository. it is envisioned that there will be multiple flavors of underlying rdf data sources corresponding to the libreg .reg file(s), the shared libraries installed,
additional components accessible via the 'net, etc. the contents of this rdf data base will be stored in a plain-text rdf/xml file so that it...
mozISpellCheckingEngine
extensions/spellcheck/idl/mozispellcheckingengine.idlscriptable this interface represents a spelling checker. implement this interface to
add support for a new spell checking engine. inherits from: nsisupports last changed in gecko 1.7 this interface represents a spell checking engine. the built in hunspell engine has contract id "@mozilla.org/spellchecker/engine;1". extensions can use this interface to check spelling or provide its own spell checker to editors. ...
.... implement this interface to
add support for a new spell checking engine. inherits from: nsisupports last changed in gecko 1.7 this interface represents a spell checking engine. the built in hunspell engine has contract id "@mozilla.org/spellchecker/engine;1". extensions can use this interface to check spelling or provide its own spell checker to editors. ...
...e of the engine. not currently used. read only. personaldictionary mozipersonaldictionary the personal dictionary. providespersonaldictionary boolean does the engine provide its own personaldictionary? read only. provideswordutils boolean does the engine provide its own word utilities? read only. methods
adddirectory()
adds all the dictionaries in the specified directory to the spell checker. void
adddirectory( nsifile dir ); parameters dir an nsifile object indicating the directory from which to
add dictionaries. check() checks a word to determine if it's spelled correctly. when this changes, the spell checker sends a "spellcheck-dictionary-update" notification. boolean check( i...
mozIStorageAggregateFunction
this is an interface that must be implemented by consumers. it allows consumers to
add aggregate functions that are available to sql queries and triggers. an aggregate function is a function that returns one value from a series of values. there are a number of already defined aggregate functions provided by sqlite. objects implementing this interface can be registered with mozistorageconnection.createaggregatefunction(). storage/public/mozistorageaggregatefunction.idlscriptable please
add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void onstep(in mozistoragevaluearray afunctionarguments); nsivariant onfinal(); methods onstep() this is called for each row of results returned by...
...nscomptr<mozistoragefunction> func = new standarddeviationfunc(); ns_ensure_true(func, ns_error_out_of_memory); nsresult rv = dbconn->createfunction( ns_literal_cstring("stddev"), 1, func ); ns_ensure_success(rv, rv); // run some query that use...
...ptr<mozistoragefunction> func = new standarddeviationfunc(); ns_ensure_true(func, ns_error_out_of_memory); nsresult rv = dbconn->createfunction( ns_literal_cstring("stddev"), 1, func ); ns_ensure_success(rv, rv); // run some query that uses the function. nscomptr<mozistoragestatement> stmt; rv = dbconn->createstatement(ns_literal_cstring( "select stddev(value) from some_table"), getter_
addrefs(stmt) ); ns_ensure_success(rv, rv); prbool hasmore; while (ns_succeeded(stmt->executestep(&hasmore)) && hasmore) { // handle the results } ...
mozIStorageBindingParamsArray
the mozistoragebindingparamsarray interface is a container for mozistoragebindingparams objects, and is used to store sets of bound parameters that will be used by the mozistoragestatement.executeasync(). storage/public/mozistoragebindingparamsarray.idlscriptable please
add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create these objects by calling the mozistoragestatement.newbindingparamsarray(). ...
...s that will be used by the mozistoragestatement.executeasync(). storage/public/mozistoragebindingparamsarray.idlscriptable please
add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create these objects by calling the mozistoragestatement.newbindingparamsarray(). method overview void
addparams(in mozistoragebindingparams aparameters); mozistoragebindingparams newbindingparams(); attributes attribute type description length unsigned long the number of mozistoragebindingparams objects in the array. methods
addparams()
adds the specified set of parameters to the end of the array. the appended parameters will be used when mozi...
... mozistoragebindingparams newbindingparams(); attributes attribute type description length unsigned long the number of mozistoragebindingparams objects in the array. methods
addparams()
adds the specified set of parameters to the end of the array. the appended parameters will be used when mozistoragestatement.executeasync() is called. void
addparams( in mozistoragebindingparams aparameters ); parameters aparameters the mozistoragebindingparams object containing the parameters to append to the array. newbindingparams() creates and returns a new, empty, mozistoragebindingparams object to which you can
add parameters and their values for binding. mozistoragebindingparams newbindingparams(); parameters none. ...
mozITXTToHTMLConv
the mozitxttohtmlconv interface is used to convert text into html format. its primary use is in converting user-entered text into properly-formatted html. netwerk/streamconv/public/mozitxttohtmlconv.idlscriptable please
add a summary to this article. last changed in gecko 1.8.1 (firefox 2 / thunderbird 2 / seamonkey 1.1) inherits from nsistreamconverter implemented by @mozilla.org/txttohtmlconv;1 as a service: var ios = components.classes["@mozilla.org/txttohtmlconv;1"] .getservice(components.interfaces.mozitxttohtmlconv); method overview unsigned long citeleveltxt(in wstring line, out unsigned long loglinestart) void findurlinplaintext(in wstring text, in long alength, in long apos, out long astartpos, out long aendpos) ...
...e converted to <, &, and >, respectively). kglyphsubstitution unsigned long enables conversion of smilies and non-ascii special characters. kstructphrase unsigned long enables conversion of text attributes, such as converting "*some text*" to boldfaced "some text" by wrapping in the html <strong> element. kurls unsigned long enables automatic
addition of hyperlinks for urls in the text. methods scantxt() scans the specified text, applying the requested conversions and outputting html. wstring scantxt( in wstring text, in unsigned long whattodo ); parameters text the original, plain text to scan and convert into html. whattodo a bit field composed of the conversion control attributes indicating what conversions to app...
...sted conversions and outputting html. wstring scantxt( in wstring text, in unsigned long whattodo ); parameters text the original, plain text to scan and convert into html. whattodo a bit field composed of the conversion control attributes indicating what conversions to apply. return value the html version of the specified string. scanhtml() scans the specified user-edited html,
adding
additional formatting that the user may not have known to do. this should correct html that isn't entirely standards-compliant. warning: don't use the kglyphsubstitution conversion type with this method, as doing so generates html that is non-standard. wstring scanhtml( in wstring text, in unsigned long whattodo ); parameters text the original, user-edited html. whattodo a bit fi...
nsIAccessible
lients to get information about objects in the accessible tree. the accessible tree is a subset of nodes in the dom tree -- such as documents, focusable elements and text. mozilla creates the implementations of nsiaccessible on demand. [scriptable, uuid=(c7520419-87ec-42bc-98cc-04c0bf173530)] interface nsiaccessible : nsisupports { ... }; accessible/public/nsiaccessible.idlscriptable please
add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) overview this section provides short overview of methods and attributes of this interface. all methods and attributes are grouped by categories. role, states and name these includes main properties used to describe the accessible. nsiaccessible.role to get the role of the accessible nsia...
...d(), nsiaccessible.takeselection() and nsiaccessible.extendselection(). actions you can prepare actions on some accessibles (for example on button accessible). the following methods are intended for this nsiaccessible.actioncount, nsiaccessible.getactionname(), nsiaccessible.getactiondescription() and nsiaccessible.doaction(). descriptions nsiaccessible.description and nsiaccessible.help provides
additional text information about accessible. attributes many accessibles exposes attributes to provide more details that cannot be fit into existing api methods, please refer to attributes documentation for more information. you can use nsiaccessible.attributes to get a map of attributes. keyboard shortcuts some actions on accessibles can be performed by keyboard shortcuts. following methods are use...
...his one by the given relation type. getrelation this method returns one accessible relation for this object. getrelations this method returns multiple accessible relations for this object. getbounds this method returns accessible's (x and y) coordinates relative to the screen and accessible's width and height. setselected this method
adds or remove this accessible to the current selection. extendselection this method extends the current selection from its current accessible anchor node to this accessible. takeselection this method selects this accessible node only. takefocus this method focuses this accessible node. getactionname this method retrieves the name of th...
nsIAccessibleText
accessible/public/nsiaccessibletext.idlscriptable please
add a summary to this article. ...
... accessible/public/nsiaccessibletext.idlscriptable please
add a summary to this article. ...
...ode. boundary_line_start 5 boundary_line_end 6 boundary_attribute_range 7 coordinate type constants obsolete since gecko 1.9 (firefox 3)this 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. constant value description coord_type_screen 0 coord_type_window 1 methods
addselection() void
addselection( in long startoffset, in long endoffset ); parameters startoffset endoffset getattributerange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) get the accessible and start/end offsets around the given offset. this accessible get return the dom node and layout frame with the uniform attributes for this rang...
nsIAppShell
obsolete since gecko 1.9 (firefox 3) an event queue has been created or destroyed. hook or unhook it from your system, as necessary. void listentoeventqueue( in nsieventqueue aqueue, in prbool alisten ); parameters aqueue the queue in question. alisten pr_true for a new queue wanting hooking up. pr_false for a queue wanting to be unhooked. resumenative() resumes the use of
additional platform-specific methods to run() gecko events on the main application thread. calls to suspendnative() and resumenative may be nested. on some platforms this will be a no-op. void resumenative(); parameters none. run() enter an event loop. do not leave until exit() is called. void run(); parameters none. runinstablestate() allows running of a "synchronous section", in the form of an ns...
...ablestate( in nsirunnable arunnable ); parameters arunnable an nsirunnable to run. spindown() obsolete since gecko 1.9 (firefox 3) prepare to stop processing events. void spindown(); parameters none. spinup() obsolete since gecko 1.9 (firefox 3) prepare to process events. void spinup(); parameters none. ...
...pare to stop processing events. void spindown(); parameters none. spinup() obsolete since gecko 1.9 (firefox 3) prepare to process events. void spinup(); parameters none. suspendnative() suspends the use of
additional platform-specific methods (besides the nsiappshell->run() event loop) to run gecko events on the main application thread. under some circumstances these "
additional methods" can cause gecko event handlers to be re-entered, sometimes leading to hangs and crashes. calls to suspendnative and resumenative() may be nested. on some platforms (those that do not use any "
additional methods") this will be a no-op. does not (in itself) stop gecko events from being processed on the main application thread. but if the nsiappshell->run() event loop is blocked when...
nsIAppShellService
parameters awindowwidth the width to make the initial window(s) opened. awindowheight the height to make the initial window(s) opened. return value true if a window was opened. createtoplevelwindow() this method creates a window, which will be initially invisible. ...
... achromemask chrome flags affecting the kind of os border given to the window. (see nsibrowserwindow for bit/flag definitions). ainitialwidth width, in pixels, of the window. ...
...these windows are generally shown in the windows taskbar, and the application knows it can not quit until it is out of registered windows. note: when this method is successful, it fires the global notification "xul-window-registered" void registertoplevelwindow( in nsixulwindow awindow ); parameters awindow the window to register. ...
nsIAutoCompleteInput
mplete popup will open. popup nsiautocompletepopup the view in which results will be displayed.read only. popupopen boolean indicates whether or not the popup view is already open. searchcount unsigned long the number of autocomplete sessions to search. read only. ...
... textvalue astring the value of the text in the autocomplete text field. ...
...ndex of the current selection in the text field. read only. selectionstart long the starting index of the current selection in the text field. read only. showcommentcolumn boolean if true, a column is
added to the popup, showing the comment for each autocomplete result. showimagecolumn boolean if true, a column is
added to the popup, showing an
additional image for each autocomplete result. textvalue astring the value of the text in the autocomplete text field. timeout unsigned long the number of milliseconds after a keystroke before a search begins. methods getsearchat() returns the name of one of the autocomplete search session objects. acstri...
nsIClipboardDragDropHookList
widget/public/nsiclipboarddragdrophooklist.idlscriptable this interface is an internal gecko component. it provides basic operations such as
adding, removing and enumerating clipboard hooks for the nsiclipboarddragdrophooks interface. inherits from: nsisupports last changed in gecko 1.7 note: this interface is not intended for direct use by embedders; it is an implementation detail. you should access these capabilities indirectly by sending commands using the nsiclipboarddragdrophooks interface. within gecko, this interface is used by calling get_interface on a docshell. ...
...rophooks interface. inherits from: nsisupports last changed in gecko 1.7 note: this interface is not intended for direct use by embedders; it is an implementation detail. you should access these capabilities indirectly by sending commands using the nsiclipboarddragdrophooks interface. within gecko, this interface is used by calling get_interface on a docshell. method overview void
addclipboarddragdrophooks(in nsiclipboarddragdrophooks ahooks); nsisimpleenumerator gethookenumerator(); void removeclipboarddragdrophooks(in nsiclipboarddragdrophooks ahooks); methods
addclipboarddragdrophooks() this method
adds a hook to the list. void
addclipboarddragdrophooks( in nsiclipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. ge...
...nsisimpleenumerator gethookenumerator(); parameters none. return value returns nsisimpleenumerator for nsiclipboarddragdrophooks. removeclipboarddragdrophooks() this method removes a hook from the list. ...
nsICookiePermission
the nsicookiepermission interface is used to test for cookie permissions netwerk/cookie/nsicookiepermission.idlscriptable please
add a summary to this article. ...
...these may be relocated somewhere else if we ever consider freezing this interface. methods canaccess() tests whether or not the given uri/channel may access the cookie database, either to set or get cookies. nscookieaccess canaccess( in nsiuri auri, ...
...he lifetime of the cookie. this is useful, for instance, to downgrade a cookie to session-only if it fails to meet certain criteria. boolean cansetcookie( in nsiuri auri, in nsichannel achannel, in nsicookie2 acookie, inout boolean aissession, inout print64 aexpiry ); parameters auri the uri trying to set the cookie. achannel the channel corresponding to auri. acookie the cookie being
added to the cookie database. aissession when cansetcookie is invoked, this is the current issession attribute of the cookie. cansetcookie may leave this value unchanged to preserve this attribute of the cookie. aexpiry when cansetcookie is invoked, this is the current expiry time of the cookie. cansetcookie may leave this value unchanged to preserve this attribute of the cookie. return value true i...
nsIDownloadHistory
docshell/base/nsidownloadhistory.idlscriptable this interface can be used to
add a download to history. there is a separate interface specifically for downloads in case embedders choose to track downloads differently from other types of history. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void
adddownload(in nsiuri asource, [optional] in nsiuri areferrer, [optional] in prtime astarttime); methods
adddownload()
adds a download to history. this will also notify observers that the uri asource is visited with the topic ns_link_visited_event_topic if asource has not yet been visited. ...
...this cannot be null. areferrer optional the referrer of source uri. ...
...this cannot be null. areferrer optional the referrer of source uri. astarttime optional the time the download was started. ...
nsIEventListenerInfo
content/events/public/nsieventlistenerservice.idlscriptable an instance of this interface describes how an event listener was
added to an event target; these are returned by nsieventlistenerservice.getlistenerinfofor, which provides a list of all the listeners to a given event target. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview nsisupports getdebugobject(); astring tosource(); attributes attribute type description allowsuntrusted boolean indicates whether or not the event listener allows untrusted events. read only. capturing boolean indicates whether or not the event listener is in capture ...
...lean indicates whether or not the event listener allows untrusted events. read only. capturing boolean indicates whether or not the event listener is in capture mode. read only. insystemeventgroup boolean indicates whether or not the event listener is in the system event group. read only. type astring the type of the event for which the listener was
added. read only. methods getdebugobject() returns the debugger object if the debug service is active. nsisupports getdebugobject(); parameters none. return value if jsdidebuggerservice is active and the listener is implemented in js, this returns the listener as a jsdivalue. otherwise null. this is the method you should use if you want to get access to the actual listener, but the debugger se...
...ive and the listener is implemented in js, this returns the listener as a jsdivalue. otherwise null. this is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down script execution. accordingly, this should probably only be used by real debuggers. this approach is necessary because event listeners
added with
addeventlistener won't necessarily be nsieventlisteners; the dom code will fix up ordinary javascript functions to act as listeners. tosource() tries to serialize the event listener to a string. astring tosource(); parameters none. return value returns a string describing the event listener, or null if serialization isn't possible (for example, if the listener was written in c++). remarks...
nsIFrameMessageManager
es to receive messages from remote frames. 1.0 66 introduced gecko 2.0 obsolete gecko 17.0 inherits from: nsisupports last changed in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) this interface is obsolete and was removed in firefox 17. you should use nsimessagelistenermanager or nsimessagesender instead. method overview void
addmessagelistener(in astring amessage, in nsiframemessagelistener alistener, [optional] in boolean listenwhenclosed); void removemessagelistener(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods
addmessagelistener()
adds a message listener to the local frame. this listener will receive messages ...
...e, in nsiframemessagelistener alistener, [optional] in boolean listenwhenclosed); void removemessagelistener(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods
addmessagelistener()
adds a message listener to the local frame. this listener will receive messages sent from the remote frame. void
addmessagelistener( in astring amessage, in nsiframemessagelistener alistener [optional in boolean listenwhenclosed ); parameters amessage the name of the message for which to
add a listener. alistener an object implementing nsiframemessagelistener whose receivemessage method will be called when the message is received. listenwhenclosed default is false. set to oo if you want to recei...
... 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 previously
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 sendasyncmessage( in a...
nsIGlobalHistory2
docshell/base/nsiglobalhistory2.idlscriptable this interface provides information about global history to gecko. it was split off from nsiglobalhistory during the transition to toolkit interfaces. inherits from: nsisupports last changed in gecko 1.7 this interface replaces and deprecates nsiglobalhistory method overview void
adduri(in nsiuri auri, in boolean aredirect, in boolean atoplevel, in nsiuri areferrer); boolean isvisited(in nsiuri auri); void setpagetitle(in nsiuri auri, in astring atitle); methods
adduri()
add a uri to global history. note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. embedders should consider filtering out these schemes and others, for example mailbox:,...
... boolean isvisited(in nsiuri auri); void setpagetitle(in nsiuri auri, in astring atitle); methods
adduri()
add a uri to global history. note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. embedders should consider filtering out these schemes and others, for example mailbox:, for the main nsiuri and the referrer. void
adduri( in nsiuri auri, in boolean aredirect, in boolean atoplevel, in nsiuri areferrer ); parameters auri the nsiuri of the page being
added. aredirect whether the uri was redirected to another location; this is true for the original uri which is redirected. atoplevel whether the uri is loaded in a top-level window. areferrer the uri...
...loaded in a top-level window. areferrer the uri of the referring page. isvisited() checks to see whether the given uri is in history. boolean isvisited( in nsiuri auri ); parameters auri the nsiuri of the page. return value true if a uri has been visited. setpagetitle() set the page title for the given uri. uris that are not already in global history will not be
added. void setpagetitle( in nsiuri auri, in astring atitle ); parameters auri the nsiuri for which to set to the title. atitle the page title. see also nsiglobalhistory3 ...
nsILoginManager
rts last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) replaces nsipasswordmanager which was used in older versions of gecko. implemented by: @mozilla.org/login-manager;1. ...
... exceptions thrown an exception is thrown if the login information is already stored in the login manager. to change a login, you...
...chlogins(out unsigned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); methods
addlogin() stores a new login in the login manager. note: default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them. void
addlogin( in nsilogininfo alogin ); parameters alogin the login to store. exceptions thrown an exception is thrown if the login information is already 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 ca...
nsIMicrosummary
erface defines attributes and methods for dealing with microsummaries generated by an nsimicrosummarygenerator. 1.0 66 introduced gecko 1.8 obsolete gecko 6.0 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void
addobserver(in nsimicrosummaryobserver observer); boolean equals(in nsimicrosummary aother); void removeobserver(in nsimicrosummaryobserver observer); void update(); attributes attribute type description content astring the content of the microsummary. since generators and pages can be remote resources, and we need them to generate the c...
...needsremoval boolean used when a site author has indicated that a microsummary (or an associated generator) will no longer be available. read only. pageuri nsiuri the uri of the page being summarized. read only. updateinterval long the minimum interval after which this microsummary would like to be refreshed or null if it doesn't care. read only. methods
addobserver()
add a microsummary observer to this microsummary. void
addobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to
add. equals() microsummary equivalence test. microsummaries equal if they summarize the same page with the same microsummary-generator (see also nsimicrosummarygenerator.equals()). boolean equals( in nsimicrosummary ao...
...s false if either objects don't have a generator removeobserver() remove a microsummary observer from this microsummary. void removeobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to remove. update() update the microsummary, first loading its generator and page content as necessary. if you want know when a microsummary finishes updating,
add an observer before calling this method. void update(); see also microsummary topics creating a microsummary ...
nsIMsgAccountManagerExtension
an account manager extension is a xpcom compontent implementing this interface. the interface is basically a manifest and defines the properties of the new panel. a panel consists of a xul file with a page element as root element and the property file containing the localized name. note: the account manager relies on a very strong naming scheme to load and unload a panel. ...
...gename" attribute set to "extension@example.org" means, that the account manager expects to find a xul file in "chrome://extension@example.org/content/am-devmo.xul" and a property file in "chrome://extension@example.org/locale/am-devmo.properties" containing a property named "prefpanel-devmo". you have to register any new account manager extensions via the the category manager at start up. simply
add a new entry with the contact id of the component to the "mailnews-accountmanager-extensions" category. //github.com/realityripple/uxp/blob/master/mailnews/base/public/nsimsgaccountmanager.idlscriptable please
add a summary to this article. last changed in gecko ??? inherits from: nsisupports method overview boolean showpanel(in nsimsgincomingserver server); attributes attribut...
...attribute type description name acstring name of the account manager extension. it has to be unique and defines the file name of the property file and the xul page as well as the name of the localized string contained in the property file. this attribute is readonly! chromepackagename acstring chrome package, where the files for the new panel are located. this is usually guid of the id of the
addons 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 fals...
nsIMsgDBView
constants are defined in nsmsgviewtype. viewflags nsmsgvie...
...ex of the message. nsmsgviewindex is defined as a unsigned long in mailnewstypes2.idl. expandandselectthreadbyindex() void expandandselectthreadbyindex(in nsmsgviewindex aindex, in boolean aaugment); parameters aindex the index of the thread to expand and select. nsmsgviewindex is defined as a unsigned long in mailnewstypes2.idl. aaugment if true then
add to current selection. if false then replace current selection.
addcolumnhandler() attaches a nsimsgcustomcolumnhandler to a specific column (can be a new column or a built in).+ void
addcolumnhandler(in astring acolumn, in nsimsgcustomcolumnhandler ahandler); parameters acolumn the name of the column to
add the handler for. ahandler the nsimsgcustomcolumnhandle...
... removecolumnhandler() removes a nsimsgcustomcolumnhandler leaving the column to be handled by the system void removecolumnhandler(in astring acolumn); parameters acolumn the name of the column to remove the handler from. getcolumnhandler() returns the nsimsgcustomcolumnhandler attached to a specific column, if any. ...
nsIMsgIncomingServer
nsimsgincomingserver mailnews/base/public/nsimsgincomingserver.idlscriptable ???
add brief description of interface ??? inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void clearallvalues(); void cleartemporaryreturnreceiptsfilter(); void closecachedconnections(); void configuretemporaryfilters(in nsimsgfilterlist filterlist); void configuretemporaryreturnreceiptsfilter(in nsimsgfilterlist filterlist); obsolete since gecko 1.8 void displayofflinemsg(in nsimsgwindow awindow); boolean equals(in nsimsgincomingserver server); void forgetpassword(); void forgetsessionpassword(); astring generateprettynameformigration(); boolean getboolattribute(in string name); boolean getboolvalue(in st...
... missing description closecachedconnections() void closecachedconnections(); parameters none. exceptions thrown missing exception missing description configuretemporaryfilters() for mail, this configures both the mdn filter, and the server-side spam filter filters, if needed. if we have set up to filter return receipts into our sent folder, this utility method creates a filter to do that, and
adds it to our filterlist if it doesn't exist. if it does, it will enable it. this is not used by news filters (yet). void configuretemporaryfilters( in nsimsgfilterlist filterlist ); parameters filterlist missing description exceptions thrown missing exception missing description configuretemporaryreturnreceiptsfilter() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 ...
...if it does, it will enable it. if the user changes their prefs, to leave the return receipt in the inbox, this will disable the existing return receipts filter, if it exists. void configuretemporaryreturnreceiptsfilter( in nsimsgfilterlist filterlist ); parameters filterlist missing description exceptions thrown missing exception missing descriptio...
nsIMsgThread
the nsimsgfolder interface is used to interact with threads in thunderbird. ...
... long key designating this thread. flags unsigned long flags attached to the thread. subject acstring subject of the thread newestmsgdate unsigned long numchildren unsigned long readonly: number of messages in the thread. numunreadchildren unsigned long readonly: number of unread messages in the thread. ...
...signating this thread. flags unsigned long flags attached to the thread. subject acstring subject of the thread newestmsgdate unsigned long numchildren unsigned long readonly: number of messages in the thread. numunreadchildren unsigned long readonly: number of unread messages in the thread. methods
addchild()
add a message to the thread. void
addchild(in nsimsgdbhdr child, in nsimsgdbhdr inreplyto, in boolean threadinthread, in nsidbchangeannouncer announcer); parameters child the message to
add inreplyto the message this should be in reply to threadinthread announcer an nsidbchangeannouncer to receive notification when the change is made. get...
nsINavHistoryResultNode
9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) attributes attribute type description accesscount unsigned long total number of times the uri has been accessed. for hosts, this is the total number of the children under it, rather than the total number of times the host has been accessed (getting that information would require an
additional query, so for performance reasons that information isn't given by default). read only. bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides. these indices start at 0 and increase in the order at which the nodes appear in the bookmark folder. for items that are not in a bookmark folder, this...
...ce reasons that information isn't given by default). read only. bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides. these indices start at 0 and increase in the order at which the nodes appear in the bookmark folder. for items that are not in a bookmark folder, this value is -1. read only. date
added prtime if the node is an item (bookmark, folder, or separator), this value is the time at which the item was created. for other nodes, this value is 0. read only. icon autf8string this uri can be used as an image source uri and will give you the favicon for the page. it is not the actual uri of the favicon, but, rather, is something that will resolve to the actual image. in most cases, this i...
... -1. read only. itemid long long if the node is an item (bookmark, folder, or separator), this value is the row id of that bookmark in the database. for other nodes, this value is set to -1. read only. lastmodified prtime if the node is an item (bookmark, folder, or separator), this value is the time at which the item was last modified. for other nodes, this value is 0. note: when an item is
added lastmodified is set to the same value as date
added. read only. parent nsinavhistorycontainerresultnode identifies the parent result node in the result set. the value is null for top level nodes. read only. parentresult nsinavhistoryresult the history-result to which this node belongs. read only. propertybag nsiwritablepropertybag you can use this to associate temporary information with th...
nsIObserver
rom: nsisupports last changed in gecko 0.9.6 method overview void observe(in nsisupports asubject, in string atopic, in wstring adata); methods observe() this method will be called when there is a notification for the topic that the observer has been registered for. if you expect multiple topics/subjects, the implementor is responsible for filtering. you should not modify,
add, remove, or enumerate notifications in the implementation of this method. void observe( in nsisupports asubject, in string atopic, in wstring adata ); parameters asubject in general reflects the object whose change or action is being observed. atopic indicates the specific change or action. adata an optional parameter or other auxiliary data further describing the change or actio...
... the primary criterion for such dispatch; nsiobserver implementations should take care that they can handle being called with unknown values for atopic. the most common implementation of nsiobserverservice is the xpcom observer service. with this implementation, it's safe (and common practice) for an implementation of nsiobserver to remove itself as an observer during the observe callback, or to
add or remove other observers. be careful, though, because other uses of nsiobserver may not support these operations correctly within observe. example the following code is an implementation of nsiobserver that is registered to receive notifications for the "mytopicid" topic. see observer notifications for a list of built-in topics possible. observing preferences works slightly differently. see ...
... - using preference observers for an example. function myobserver() { this.register(); } myobserver.prototype = { observe: function(subject, topic, data) { // do your stuff here. ...
nsIProtocolHandler
encoding is assumed and no character transformation is not performed. abaseuri if null, aspec must specify an absolute uri. ...
...pecify an absolute uri. otherwise, aspec may be resolved relative to abaseuri, depending on the protocol. if the protocol has no concept of relative uris, this parameter is ignored. ...
...otherwise, aspec may be resolved relative to abaseuri, depending on the protocol. if the protocol has no concept of relative uris, this parameter is ignored. ...
nsIProtocolProxyService
owever, if the nsiproxyinfo type is "http", then it means that the given uri should be loaded using the http protocol handler, which also supports nsiproxiedprotocolhandler. nsiproxyinfo resolve( in nsiuri auri, in unsigned long aflags ); parameters auri the uri to test. aflags a bit-wise combination of the resolve_ flags defined above. pass 0 to specify the default behavior. any
additional bits that do not correspond to a resolve_ flag are reserved for future use. return value an nsiproxyinfo object or null for a direct connection. note: if pac is configured, and the pac file has not yet been loaded, then this method will return a nsiproxyinfo instance with a type of "unknown" to indicate to the consumer that asyncresolve should be used to wait for the pac file to finish...
...g for dns queries to complete. this method is intended as a substitute for resolve when the result is not needed immediately. nsicancelable asyncresolve( in nsiuri auri, in unsigned long aflags, in nsiprotocolproxycallback acallback ); parameters auri the uri to test. aflags a bit-wise combination of the resolve_ flags defined above. pass 0 to specify the default behavior. any
additional bits that do not correspond to a resolve_ flag are reserved for future use. acallback the object to be notified when the result is available. return value an nsicancelableobject that can be used to cancel the asynchronous operation. if canceled, the cancellation status (areason) will be forwarded to the callback's nsiprotocolproxycallback.onproxyavailable() method via the astatus para...
...ttp" - specifies a http proxy "https" - specifies a https proxy "socks" - specifies a socks version 5 proxy "socks4" - specifies a socks version 4 proxy "direct" - specifies a direct connection (useful for failover) the type name is case-insensitive. other string values may be possible, and new types may be defined by a future version of this interface. ahost the proxy hostname or ip
address. aport the proxy port. aflags flags associated with this connection. see nsiproxyinfo for currently defined flags. afailovertimeout specifies the length of time (in seconds) to ignore this proxy if this proxy fails. pass pr_uint32_max to specify the default timeout value, causing nsiproxyinfo::failovertimeout to be assigned the default value. afailoverproxy specifies the next proxy to...
nsIPushService
dom/interfaces/push/nsipushservice.idlscriptable a service for components to subscribe and receive push messages from remote servers. inherits from: nsisupports last changed in gecko 46.0 (firefox 46.0 / thunderbird 46.0 / seamonkey 2.43) push lets a remote server send payloads to a web site,
add-on, or component running in the browser. nsipushservice supports the push api implementation in firefox, and can be used directly from privileged code to create system subscriptions. implemented by @mozilla.org/push/service;1 as a service: const pushservice = components.classes["@mozilla.org/push/service;1"] .getservice(components.interfaces.nsipushservice); method overview void subscribe(in domstring scope, in nsiprincipal principal, in nsi...
...ns the message contents as a utf-8 string. message.json(); // parses the message as json. message.binary(); // returns a byte array. ...
...; // parses the message as json. message.binary(); // returns a byte array. }, onpushsubscriptionchange() { // re-subscribe if the subscription was dropped. ...
nsISHistory
navigation. in a non-embedded situation, the owner of the session history component must create a instance of it and set it in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
...tain handle the nsisimpleenumerator object. use nsisimpleenumerator.getnext() on the object returned by step #1 to obtain handle to the next object in the list. the object returned by this step is of type nsisupports. perform a queryinterface on the object returned by step #2 to nsishentry. use nsishentry to access properties of each history entry. read only. ...
...ace on the object returned by step #2 to nsishentry. use nsishentry to access properties of each history entry. read only. methods
addshistorylistener() called to register a listener for the session history component. listeners are notified when pages are loaded or purged from history. note: a listener object must implement nsishistorylistener and nssupportsweakreference. void
addshistorylistener( in nsishistorylistener alistener ); parameters alistener listener object to be notified for all page loads that initiate in session history. getentryatindex() called to obtain handle to the history entry at a given index. nsishentry getentryatindex( in long index, in boolean modifyindex ); parameters index the index value whose entry is requested. m...
nsISelection
nsiselection content/base/public/nsiselection.idlscriptable ???
add brief description of interface ??? inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) interface for manipulating and querying the current selected range of nodes within the document. implemented by: ?????????????????????????????????????. to create an instance, use: implemented by: ????????????????????????????????????? as a service: var selection = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsiselection); method overview void
addrange(in nsidomrange range); void collapse(in nsidomnode parentnode, in long offset); [noscript,notxpcom,nostdcall] boolean collaps...
...nly. focusnode nsidomnode returns the node in which the selection ends. read only. focusoffset long the offset within the (text) node where the selection ends. read only. iscollapsed boolean indicates if the selection is collapsed() or not. read only. rangecount long returns the number of ranges in the selection. read only. methods
addrange()
adds a nsidomrange to the current selection. void
addrange( in nsidomrange range ); parameters range the nsidomrange to
add collapse() collapses the selection to a single point, at the specified offset in the given nsidomnode. when the selection is collapsed(), and the content is focused and editable, the caret will blink there. void collapse( in nsidomnode parentnode, in ...
... can be one of { "forward", "backward", "left", "right" } granularity can be one of { "character", "word", "line", "lineboundary" } removeallranges() removes all nsidomranges from the current selection. void removeallranges(); parameters none removerange() removes a range from the current selection. void removerange( in nsidomrange range ); parameters range selectallchildren()
adds all children of the specified node to the selection. void selectallchildren( in nsidomnode parentnode ); parameters parentnode the parent of the children to be
added to the selection. selectionlanguagechange() modifies the cursor bidi level after a change in keyboard direction. void selectionlanguagechange( in boolean langrtl ); parameters langrtl is pr_true if the new l...
nsIThreadObserver
the nsithreadobserver interface may be implemented to let an observer implement a layered event queue. the implementation of this interface must be thread safe. xpcom/threads/nsithreadinternal.idlscriptable please
add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void afterprocessnextevent(in nsithreadinternal thread, in unsigned long recursiondepth); void ondispatchedevent(in nsithreadinternal thread); void onprocessnextevent(in nsithreadinternal thread, in boolean maywait, in unsigned long recursiondepth); methods afterprocessnextevent() called by the nsithread method nsithread.processnextevent() after an event is processed. this method is only called on the target thread. note:...
...processed. this method is only called on the target thread. note: it is valid to change the thread's observer during a call to this method. void afterprocessnextevent( in nsithreadinternal thread, in unsigned long recursiondepth ); parameters thread the nsithread on which the event was processed. recursiondepth the number of calls to nsithread.processnextevent() on the call stack in
addition to the current call. ondispatchedevent() called after an event has been dispatched to the thread. this method may be called from any thread. note: it is valid to change the thread's observer during a call to this method. void ondispatchedevent( in nsithreadinternal thread ); parameters thread the nsithread on which the event was dispatched. onprocessnextevent() called by the ...
...cessnextevent( in nsithreadinternal thread, in boolean maywait, in unsigned long recursiondepth ); parameters thread the nsithread on which the event is going to be processed. maywait true if the method is allowed to block the calling thread. this parameter will be false during thread shutdown. recursiondepth the number of calls to nsithread.processnextevent() on the call stack in
addition to the current call. example it is possible to overlay processing events for a gui toolkit on top of the events for a thread: var nativequeue; observer = { ondispatchedevent(thread) { nativequeue.signal(); } onprocessnextevent(thread, maywait, recursiondepth) { if (nativequeue.hasnextevent()) { nativequeue.processnextevent(); } while (maywait && !thread.haspen...
nsITransferable
ance, use: var transferable = components.classes["@mozilla.org/widget/transferable;1"] .createinstance(components.interfaces.nsitransferable); it's important to note that a flavor, which specifies a type of data the transferable supports, is represented by a null-terminated string indicating the mime type of the format supported by the flavor. ...
...rce url for a file promise. kfilepromisedestfilename application/x-moz-file-promise-dest-filename the destination url for a file promise. kfilepromisemime application/x-moz-file-promise a dataless flavor used to interact with the operating system during file drags. kfilepromisedirectorymime application/x-moz-file-promise-dir a synthetic flavor which is
added to the transferable once the destination directory for a file drag is known. methods
adddataflavor()
adds a new data flavor, indicating that this transferable can receive the type of data represented by the specified flavor string. void
adddataflavor( in string adataflavor ); parameters adataflavor a string defining a new data flavor that the transferable supports. flavorstr...
...n flavorstransferablecanimport() computes a list of flavors (mime types as nsisupportscstring) that the transferable can accept into it, either through intrinsic knowledge or input data converters. nsisupportsarray flavorstransferablecanimport(); parameters none. return value missing description getanytransferdata() returns the best flavor in the transferable, given those that have been
added to it with
adddataflavor(). void getanytransferdata( out string aflavor, out nsisupports adata, out unsigned long adatalen ); parameters aflavor on return, contains the flavor of data that was retrieved. adata on return, this is the data itself, which is an instance of a class based upon nsisupportsprimitives. adatalen on return, this value contains the size of the returned dat...
nsITreeBoxObject
the nsitreeboxobject interface contains information about the size and layout of a tree. further information about trees is given in the xul tutorial. /layout/xul/base/src/tree/public/nsitreeboxobject.idlscriptable please
add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports to get the treeboxobject for a tree: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); or simply: let boxobject = tree.treeboxobject; method overview long getfirstvisiblerow(); long getlastvisiblerow(); long getpagelength(); void ensurerowisvisible(in long index); void ensurecellisvisible(in long row, in nsitreecolumn col); void scrolltorow(in long index); ...
...lement height the height of the element iscellcropped() determine if the text of a cell is being cropped or not. boolean iscellcropped(in long row, in nsitreecolumn col); parameters row the index of the row col the nsitreecolumn rowcountchanged() notify the tree that the number of rows changed. the view is responsible for calling this notification method when rows are
added or removed. for non-contiguous
additions/removals, this method should be called multiple times. void rowcountchanged(in long index, in long count); parameters index the position at which the new rows were
added or at which rows were removed. count the number of rows
added or removed. use negative values for removed rows. example you deleted the row with index rowindex. infor...
...this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync. void beginupdatebatch(); endupdatebatch() notify the tree that the view has completed a batch update. ...
nsITreeView
, always return false when the orientation is not drop_on. note: drop_on will only be passed to candrop() if the item is a container; see iscontainer(). boolean candrop( in long index, in long orientation, in nsidomdatatransfer datatransfer ); parameters index the index of the row. orientation the position around the given row. defined in constants. datatransfer this parameter,
added in gecko 1.9.2, provides the data being dragged, so that it can be examined to determine if a drop is possible. return value true if a drop is allowed at the current location; otherwise false. candropbeforeafter() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method used by the drag feedback code to determine if a drag is allowable at th...
...meters col the column to cycle. drop() called when the user drops something on this view. the orientation paramater specifies before/on/after the given row. void drop( in long row, in long orientation, in nsidomdatatransfer datatransfer ); parameters row the index of the row. orientation the position around the given row. defined in constants. datatransfer this parameter,
added in gecko 1.9.2, provides the data that has been dropped. getcellproperties() an atomized list of properties for a given cell. each property, x, that the view gives back will cause the css ::moz-tree-cell-*(x) pseudoelement to be matched on the treechildren element. see getrowproperties() for an example. astring getcellproperties( in long row, in nsitreecolumn col, in nsisupportsarray...
...of detecting the version at run-time). simply return a string of space-separated property names. for example: getrowproperties: function(index) { return "dummy"; } obsolete since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this 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. ...
nsIWindowWatcher
for currently open windows in the order they were opened, guaranteeing that each will be visited exactly once. nsisimpleenumerator getwindowenumerator(); parameters none. return value an nsisimpleenumerator which will itself return nsisupports objects which can be nsisupports.queryinterface() (queryinterfaced) to an nsidomwindow. openwindow() creates a new window. it will automatically be
added to our list. note: this method may examine the javascript context stack for purposes of determining the security context to use for the search for a given window named aname. note: this method will try to set the default charset for the new window to the default charset of aparent. this is not guaranteed, however. note: this method may dispatch a "toplevel-window-ready" notificatio...
... "aboutmyextension", "chrome,centerscreen", null); note: versions of gecko before gecko 2.0 would ignore some of the chrome flags when opening a chrome window without an opener window, instead behaving as if the "all" flag was present. this was fixed in bug 509124. registernotification() clients of this service can register themselves to be notified when a window is opened or closed (
added to or removed from this service). this method
adds an nsiobserver to the list of objects to be notified. void registernotification( in nsiobserver aobserver ); parameters note: be careful about generating open/close window events inside nsiobserver.observe(). for example the following code will block the system because it will open windows continuously: function mywindowobserver() { t...
...ust be filled in by the app. openwindow() will use it to create new windows. void setwindowcreator( in nsiwindowcreator creator ); parameters creator the nsiwindowcreator callback. if this is null the callback will be cleared and window creation capabilities lost. unregisternotification() clients of this service can register themselves to be notified when a window is opened or closed (
added to or removed from this service). this method removes an nsiobserver from the list of objects to be notified. void unregisternotification( in nsiobserver aobserver ); parameters aobserver the nsiobserver to be removed. ...
nsIXULWindow
xpfe/appshell/nsixulwindow.idlscriptable please
add a summary to this article. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an nsixulwindow is created as part of the creation of a top-level chrome window. when the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service. this signals the application in case it needs to quit. ...
... article. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an nsixulwindow is created as part of the creation of a top-level chrome window. when the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service. this signals the application in case it needs to quit. ...
... constant value description lowestz 0 loweredz 4 the z level of an independent window opened with the "alwayslowered" chrome flag. normalz 5 the default z level of an independent window. raisedz 6 the z level of an independent window opened with the "alwaysraised" chrome flag. highestz 9 methods
addchildwindow() tell this window that it has picked up a child xul window.note that xul windows do not currently track child xul windows. void
addchildwindow( in nsixulwindow achild ); parameters achild the child window being
added. native code only!applychromeflags back-door method to force application of chrome flags at a particular time. do not call this unless you know what you ar...
nsIAbCard/Thunderbird3
note: this interface has been overhauled completely for thunderbird 3. documentation for the old nsiabcard interface is currently at nsiabcard. the nsiabcard interface is used to represent and manipulate cards in the
address book. in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible. properties currently supported on the card: names: firstname, lastname phoneticfirstname, phoneticlastname displayname, nickname spousename, familyname primaryemail, secondemail home contact: home
address, home
address2, homecity, homestate, homezipcode, homecountry homephone, homephonetype work contact. same as home, but with `work' instead of `home' othe...
...8string(in string name); [noscript] pruint32 getpropertyasuint32(in string name); [noscript] boolean getpropertyasbool(in string name); setproperty() setpropertyasastring() setpropertyasautf8string() setpropertyasuint32() setpropertyasbool() assigns the given to value to the property of the given name. should the property exist, its value will be overwritten. an implementation may impose
additional semantic constraints for certain properties. however, such constraints might not be checked by this method. these functions convert values in the same manner as the default implementation of nsivariant. a value must be convertible to a string; if this convention is not followed, consumers of cards may fail unpredictably or return incorrect results. the non-variant functions are marked [...
...ard. the default implementation defines equal as this card pointing to the same object as acard. another implementation defines it as equality of properties and values. the exact nature of equality is still undefined, and actual results may not match theoretical results. most notably, the code a.equals(b) == b.equals(a) might not return true. in particular, calling equals on cards from different
address books may return inaccurate results. boolean equals(in nsiabcard card) parameters card the card you are comparing with. return value true if the cards are the same. generatephoneticname() generate a phonetic name from the card, using the firstname and lastname values. astring generatephoneticname(in boolean alastnamefirst) parameters alastnamefirst set to true to put the...
XPCOM reference
the contents herein are oriented primarily toward extension developers and people embedding xpcom in other projects. if you're working on a module in the mozilla codebase that's compiled with the mozilla_internal_api flag set, some of these apis -- the string functions and classes in particular -- are not the ones you should be using. see the xpcom internal string guide for documentation of the internal string api used within the mozilla codebase. ...
...erfaces.foldersthe folder classes all implement the nsimsgfolder interface. there are currently three folder classes - nslocalmailfolder, nsimapmailfolder, and nsnewsfolder. they all inherit from nsmsgdbfolder, which implements a lot of the core functionality. ...
...er.ns ensure successmacrons ensure truemacrons_abort_if_falsethis was removed in bug 1127201ns_
addrefmacrons_assertionmacrons_ensure_arg_pointermacrons_errorthrows a assertion (ns_assertion) with the text "error: (error text)", so writes this text to console (stderr) and to debug logs (nspr logging). this macro is meant for critical errors; like assertions, ns_errors should not be reachable.ns_if_
addrefmacrons_if_releasemacrons_releasemacrons_warningmacronsgetmoduleprocthis function prototype provides the xpcom entry-point into a module.nsiabcard/thunderbird3the nsiabcard interface is used to represent and manipulate cards in the
address book. in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be mor...
Status, Recent Changes, and Plans
in the way for first-time readers. you may want to skip directly to the getting started guide, the reference manual, or the faq. i put this section at the top so that checking for recent changes will be easy. recent changes to nscomptr most recent first made == and != between an nscomptr and a raw pointer (or a literal 0 or nsnull) work correctly on all compilers. see bug 65664. made getter_
addrefs( nscomptr& ) apply the same type-safety check that the simple assignment forms do.
added do_createinstance.
added do_getservice. eliminated the need 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 59414: making operator& private may help prevent some leaks caused by casting move the factored nscomptr routines into their own library, to reduce nscomptr clients' dependency on the xpcom library. ...
... result. bug 59414: making operator& private may help prevent 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 nscomptrs in function signatures
added references to recent bugs influencing the use of nscomptr machinery: bug 59212, and bug 59414 fixed comparisons 1 and 3, as per comments by morten welinder updated examples to prefer direct initialization over copy initialization. ...
Filelink Providers
filelink is a thunderbird feature that makes it easy for users to upload large attachments to web-based storage services such as hightail. this document explains how to extend thunderbird to support
additional web-based storage services. nsimsgcloudfileprovider note: cloudfiles and bigfiles were the two temporary feature names that were used while filelink was under construction. both refer to the filelink feature. filelink storage providers must implement the nsimsgcloudfileprovider interface. the hightail implementation is a great place to look for examples and inspiration. ...
... while filelink was under construction. both refer to the filelink feature. filelink storage providers must implement the nsimsgcloudfileprovider interface. the hightail implementation is a great place to look for examples and inspiration. the nsimsgcloudfileprovider implementation must be registered as a component. if the provider is being merged into the comm-central code repository (and thus
added to the official thunderbird build), you must also
add the components to the cloudfile/cloudfilecomponents.manifest, cloudfile/jar.mn, and installer/package-manifest.in. if the nsimsgcloudfileprovider is being created as part of an
add-on, the
add-on must register the component in chrome.manifest. also, you must
add the component's contract id to the "cloud-file" category. see cloudfile/cloudfi...
...oudfile/cloudfilecomponents.manifest for an example, as well as this document on chrome.manifest files. the account setup dialog the account setup dialog allows the user to select what account type they would like to create from a menulist. some providers require thunderbird to do very little in order to connect a user to their account. other providers however may require the user to fill in
additional details in order to connect to the service. hightail, for example, requires a username and password. other services may require the user to fill in a server string or port number. a provider implementation can choose what information it gets from the user from the setup dialog by pointing the settingsurl attribute of their nsimsgcloudfileprovider implementation to a chrome url for an xhtm...
Thunderbird Configuration Files
built-in config editor. to access the config editor, go to tools > options or do thunderbird > preferences. if you are on mac os x, and on linux do edit > preferences on, select the advanced options panel, click on the general tab, and click on config editor. this will display a list of used preferences, as well as a search bar at the top. double-click on a preference to change its value. to do
add a new preference, open the context menu (right-click) on any existing preference, go to the new menu, and select the type of preference. some preferences may require that you restart thunderbird in order to take effect. configuration files some tips and tricks require that you edit configuration files manually. there are three files you should know about: userchrome.css used to change the ...
...s automatically created when you start thunderbird for the first time. you can manage any number of profiles by using the profile manager. userchrome.css this file sets the display rules for various elements in the thunderbird user interface and is located in the sub-folder called chrome in your profile folder. this folder does not exist by default, so you need to create it before you can start
adding your preferences. usercontent.css this file sets the display rules for web content and is located in the sub-folder called chrome in your profile folder. as with userchrome.css, this folder does not exist by default, so you need to create it before you can start
adding your preferences. user.js this is the
additional preferences file for thunderbird and is located in your profile folder. t...
...in almost all cases, edits made using the user.js can be done via the config editor, which is the recommended method. windows users: if you know how to create a file, just skip this section. ...
Finding the code for a feature
frequently you are trying to figure out the code that implements a specific feature of the user interface. how do you find that out? as an example, i received the following inquiry, and i decided to follow my usual path and document what i do: hello i would like to
add colours and tags to specific emails...by using nsimsgtagservice, can this be done? here is my (edited) response: nsimsgtagservice is used to store the list of valid tags, so it is not the correct way to tag messages. tags are applied using the message database property "keyword". i know the underlying code, but i don't remember the user interface level function to do it. but here is how i find out. there are two key tools that you need. the first is the dom inspector extension which i have routinely installed in all of my ...
...gs are applied using the message database property "keyword". i know the underlying code, but i don't remember the user interface level function to do it. but here is how i find out. there are two key tools that you need. the first is the dom inspector extension which i have routinely installed in all of my thunderbird installations. (for debug builds, you can make it appear by default using "ac_
add_options --enable-extensions=default,venkman,inspector" which is part of my standard configuration). the second is mozilla's source code search tool mxr. i keep two prominent links to this on my firefox toolbar, one to comm-central string search, and one to comm-central file search. so, how did i use those to figure out how to do this? i know there is a menu command "tag" to tag the message - how...
... 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 prevhdrfolder[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!). if you want examples, scan mxr for
addkeywordstomessages. you'll find that the only decent examples are in unit tests, my test_bug428427.js ...
Tips and Tricks from the newsgroups
you can also help by creating how-tos from any of these topics. ...
...you can also help by creating how-tos from any of these topics. ...
...you can also help by creating how-tos from any of these topics. ...
Using the Mozilla symbol server
ptimized, debugging is not always easy. the debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations. the only workaround is to build an unoptimized local build. the official symbol server url for firefox is https://symbols.mozilla.org/. you cannot visit this url directly: you must
add it to the symbol path of your debugging tool. in the examples below, a local cache directory is used to avoid repeatedly fetching the pdb from the server. replace c:\users\bsmedberg\symbols with an appropriate cache directory on your machine. using the symbol server in microsoft visual c++ using the symbol server in windbg the windbg symbol path is configured with a string value delimited w...
...elow, a local cache directory is used to avoid repeatedly fetching the pdb from the server. replace c:\users\bsmedberg\symbols with an appropriate cache directory on your machine. using the symbol server in microsoft visual c++ using the symbol server in windbg the windbg symbol path is configured with a string value delimited with asterisk characters. to use only the mozilla symbol server,
add the following entry to your symbol path (note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://symbols.mozilla.org/ set this string as _nt_symbol_path in the environment, using the windbg menus, or by typing the .sympath command. if you would like to get symbols from microsoft's sy...
... under the [app] heading: for example, the thunderbird 3.1b2 release with name=thunderbird, version=3.1b2, buildid=20100430125415 would have a filename of "thunderbird-3.1b2-linux-20100430125415-symbols.txt" under the thunderbird directory at symbols.mozilla.org. its contents are a list of paths to files, all relative to the directory the blah-symbols.txt file is found in. the source server in
addition to symbols, mozilla also has a source server, letting you do source-level debugging and inspection on demand. troubleshooting: symbols will not download if symbols will not download no matter what you do, the problem may be that internet explorer has been set to the work offline mode. you will not receive any warnings of this in windbg, visual c++ or visual studio. even using the command l...
Using Objective-C from js-ctypes
send(synth, release); // [text release]; objc_msgsend(text, release); return 0; } to run this code, save it as test.c, and run the following command in the same directory. $ clang -lobjc -framework appkit test.c && ./a.out converting c code to js-ctypes code now we have working c code, it can be converted into js-ctypes in a relatively straightforward manner. types and functions in
addition to the above code, we need to declare function and types. types types can be readily declared. bool is defined in /usr/include/objc/objc.h. let id = ctypes.structtype("objc_object").ptr; let sel = ctypes.structtype("objc_selector").ptr; let bool = ctypes.signed_char; functions all functions in our example are exported by /usr/lib/libobjc.dylib. let lib = ctypes.open(ctypes.libraryname...
...ing, ctypes.char.array()("hello, firefox!"), ctypes.unsigned_long(nsutf8stringencoding)); converted js-ctypes code finally, we have our converted code. this can run with a copy-and-paste into a javascript shell. this example uses a busy loop, and thus, firefox won't respond until the speaking is done. if this code were to be used in a production
add-on, then to avoid firefox locking up, run this code from a chromeworker. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let id = ctypes.structtype("objc_object").ptr; let sel = ctypes.structtype("objc_selector").ptr; let bool = ctypes.signed_char; let lib = ctypes.open(ctypes.libraryname("objc")); let objc_getclass = lib.declare("objc_getclass", ctypes.defa...
...bridge/core.js#l370-l394 var bl = block_literal_1(); // set the class of the instance bl.isa = _nsconcreteglobalblock; // 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_monitorevents - shows how to monitor and block mouse and key events on mac os x ...
Debugging Tips
ctype currently console.log doesn't show type information of cdata. running the following code shows only partial value information. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p); let pp = p.
address(); console.log(pp); the result will be as following: cdata { value: 10 } cdata { x: 10, y: 20 } cdata { contents: cdata } to see more descriptive information, you can use .tosource(). let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.tosource()); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: c...
... cdata { x: 10, y: 20 } cdata { contents: cdata } to see more descriptive information, you can use .tosource(). let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.tosource()); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p.tosource()); let pp = p.
address(); console.log(pp.tosource()); the result will be : ctypes.int32_t(10) point(10, 20) point.ptr(ctypes.uint64("0x15fdafb08")) to see the complete type information, you can use .constructor.tosource(), to print the source of ctype. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.constructor.tosource()); let point ...
...ete type information, you can use .constructor.tosource(), to print the source of ctype. ...
Declaring types
hose types that represent a single value in memory, as opposed to arrays, structures, or functions. you can define values of these types without declaring new types. for example, to define a new 32-bit integer variable with the value 5: var i = ctypes.int32_t(5); you can then pass a pointer to this value to a c function that requires a pointer to a 32-bit integer, like this: some_c_function(i.
address()); declaring new primitive types there are times when you want to create new types that are simply new names for existing primitive types. for example, on windows, you may wish to be able to use the windows-standard dword type name for unsigned 32-bit integers. to declare this type, you can simply do: const dword = ctypes.uint32_t; after doing this, dword is a ctype that can then be us...
... primitive types. you can then declare and use a function that uses this structure, like this: // declare the libc asctime() function, which returns a char * and accepts a pointer to a tm structure. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); var thetime = new struct_tm; thetime.tm_hour = 3; thetime.tm_min = 15; ... var timestr = asctime(thetime.
address()); // pass a pointer to the tm struct var jsstring = timestr.readstring(); // convert the c string to javascript the last line converts the c string returned by the libc asctime() function into a javascript string by calling the cdata readstring() method. for another example see here: getcursorpos opaque structures an opaque structure is one whose content fields are not know...
....arraytype(file); // create a filearray type in this example, file is an opaque pointer we can use to refer to c file records, as defined in stdio.h. filearray is a new type representing an array of unspecified length, in which each entry is a pointer to a file record. declaring an array type with a specific length declaring an array type that specifies the array length is as simple as
adding a length when calling ctypes.arraytype(), like this: const filearray = new ctypes.arraytype(file, 20); this declares filearray as an array type that can hold 20 elements. pointers declaring a pointer type as a pointer to a specific type is done by passing as a parameter to the ctypes.pointertype() method a ctype object indicating the type to which the pointer should refer: const intptr =...
CData
a cdata object represents a c value or function located in memory. method overview methods available on all cdata objects cdata
address() string tosource() string tostring() properties properties of all cdata objects property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. ...
... description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. methods available on all cdata objects
address() returns a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose value points to the c object referred to by the object. this provides a way to get a pointer to the actual data of the c value represented by the cdata object. cdata
address() parameters none. return value a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose valu...
...ar fromcharcode = [] for (var i=0; i<ptrasarr.length; i++) { //if known_len is correct, then will not hit null terminator so like in example of "_scratchpad/entehandle.js at master · noitidart/_scratchpad mdnfirefox" if you pass length of 77, then null term will not get hit by this loop as null term is at pos 77 and we go till `< known_len` var thisunsignedcharcode = ptrasarr.
addressofelement(i).contents; if (thisunsignedcharcode == 0) { // reached null terminator, break console.log('reached null terminator, at pos: ', i); break; } charcode.push(thisunsignedcharcode); fromcharcode.push(string.fromcharcode(thisunsignedcharcode)); } console.info('charcode:', charc...
StructType
ption constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. structtype cdata method_overview cdata
addressoffield(name) methods inherited from cdata cdata
address() string tosource() string tostring() structtype cdata methods
addressoffield() returns a new cdata object of the appropriate pointer type, whose value points to the specified field of the structure on which the method was called. see working with strings for more information on how to convert ...
... return value a new cdata object of the appropriate pointer type, whose value points to the contents of the specified field. exceptions thrown typeerror name is not a javascript string, or doesn't name a member field of the structure. ...
... return value a new cdata object of the appropriate pointer type, whose value points to the contents of the specified field. ...
Drawing and Event Handling - Plugins
on mac os, window is a pointer to an np_port. the x and y fields specify the top-left corner of the plug-in relative to the page. the width and ...
...ser calls the npp_setwindow function to set the window in which a plug-in draws or returns an error code. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. subsequent calls to npp_setwindow for a given instance usually mean that the window has been resized. if either window or window->window is null, the plug-in must not perform any
additional graphics operations on the window and should free any associated resources. nperror npp_setwindow(npp instance, npwindow *window); the instance parameter represents the current plug-in. the window parameter is a pointer to the drawing target for the plug-in. for windowless plug-ins, the platform-specific window information specified in window->window is a platform-specific handle to a ...
...ance of that class for the plug-in instance. the plug-in can then subclass the window to receive any events it needs. if the plug-in needs to receive periodic time messages (for example, for animation), it should use a timer or a separate thread. unix on unix, the browser creates a motif drawing area widget for the instance and passes the window id of the widget in the window field of npwindow.
additionally, the browser creates an npsetwindowcallbackstruct object and passes it in the ws_info field of npwindow. as on windows, the plug-in can receive all events for the instance, in this case through the widget. if the plug-in needs to receive periodic time messages, it should install a timer or fork a thread. event handling for windowed plug-ins all imaging and user interface events for a w...
Scripting plugins - Plugins
flexible api.) the information in this section applies to firefox 1.0 and mozilla 1.7.5 and newer versions. how the dom handles scripting the mozilla dom code now checks if a plugin supports this new scriptability api and if it exposes a scriptable object through this new mechanism. mozilla does this by calling the old plugin api call npp_getvalue with the new enumeration value that has been
added to the nppvariable enumeration. the new nppvariable enumeration is defined in npapi.h as: nppvpluginscriptablenpobject = 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 likewis...
...ls 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 access methods and properties on the plugin. the same thing applies the other way too; the plugin can reach only javascript objects in the same origin as the page that loaded the plugin. in
addition to this, a further extension to this api is being discussed that would give a plugin greater flexibility by letting the plugin control the origin of the calling code, so that the plugin can specify the origin of calls that come from internally loaded code from other origins. this way such code can be executed with only the privileges of the origin of the code, and not the privileges of the p...
...rowser requests it by calling: npp_getvalue(npp, nppvpluginscriptablenpobject, ...); accessing browser objects from a plugin a plugin that wishes to access objects in the browser window that loaded the plugin can do this by getting the npobject for the browser's window object, or the dom element that loaded the plugin. this is done by using an extension to npn_getvalue. the extensions are two
additions to the npnvariables enumeration; the new enumerations are npnvwindownpobject and npnvpluginelementnpobject. calling npn_getvalue() with either of those new enumerations will return an npobject representing the browser object, and from there, the functions in this api can be used to get and set properties, and to call methods on those browser objects. and as always when working with referen...
DOM Inspector internals - Firefox Developer Tools
here. even most of the elements that aren't visible, such as key- and commandsets, are not defined in inspector.xul. these are pulled in from a series of overlays, so that the xul defining dom inspector's ui can be organized into discrete units. inspector.xul itself is only a skeleton describing the basic structure and layout of the primary dom inspector window, leaving most of its contents to be
added by the overlays. using modular overlays also allows for common xul to be shared across the various documents that make up the dom inspector's ui, although not all overlays are shared by multiple consumers. single-consumer overlays exist solely for organization. in some cases overlays are overlaid by other overlays. if we imagine a tree structure obtained by connecting overlays as children to ...
...ay.xul (note that the overlays from the viewer subdirectories—viewers/dom and viewers/stylerules—are loaded as a result of overlay directives in dom inspector's chrome manifest, rather than being explicitly imported using a xul-overlay processing instruction in the overlaid file.) inspectoroverlay.xul this imports the scripts the top-level inspector needs, including dependencies.
additionally, it defines the content in the main body of the dom inspector window, namely, the panelset, document and object viewer panels, and the document browser pane. (the browser pane is not a viewer panel in the sense that document and object panels are, i.e., the sorts of panels as defined above in relation to the panelset; "pane" is used here with regard to the browser pane in a loose sense t...
.... for obvious reasons, the contents of dynamic menus are not defined here. the dynamic menus include the inspect menus' ("inspect content document" and "inspect chrome document") popups from the file menu, and the "document viewer" and "object viewer" menus from the view menu. the preference menuitems in the view menu that affect only the dom nodes viewer ("blink selected element", et cetera) are
added by that viewer's popup overlay (resources/content/viewers/dom/popupoverlay.xul). the same is true for the find menuitems and the "select element by click" menuitem in the edit menu, since no other viewers besides the dom nodes viewer support these features. the other edit menu items are also used in several viewers' context menus. for that reason, only those menuitems' ids are referenced here...
Break on DOM mutation - Firefox Developer Tools
ou set a dom mutation breakpoint in the page inspector. navigate to the dom node in which you are interested and use the context menu to set the breakpoint. there are three choices: subtree modification execution pauses if any of the elementʼs descendant nodes are modified. that means, the script execution is stopped whenever a child node or descendant node deeper in the dom structure is
added to or removed from the element the option is set on. examples for when this breakpoint is triggered are calling node.appendchild() and node.removechild(), calling childnode.remove() or setting element.innerhtml on one of the subnodes. attribute modification execution pauses when any of the elementsʼ attributes are modified. that means, the script execution is stopped whenever an attribut...
... or removed from the element the option is set on. examples for when this breakpoint is triggered are calling node.appendchild() and node.removechild(), calling childnode.remove() or setting element.innerhtml on one of the subnodes. attribute modification execution pauses when any of the elementsʼ attributes are modified. that means, the script execution is stopped whenever an attribute is
added to or removed from the element the option is set on or the value of one of its attributes is changed. examples for when this breakpoint is triggered are calling element.setattribute(), element.removeattribute(), and element.classlist.
add(), or setting element.id. node removal execution pauses if the element the option is set on is removed. examples for when this breakpoint is triggered ...
...the breakpoint, go to the debugger. you can see the breakpoint listed in the right-most panel under dom mutation breakpoints. click on the icon following the node name to go back to the page inspector with the node selected. when you 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 preview new in firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. see set a breakpoint > inline...
Debugger.Object - Firefox Developer Tools
ject. defineproperty(name,attributes) define a property on the referent namedname, as described by the property descriptordescriptor. any value, get, and set properties ofattributes must be debuggee values. (this function behaves like object.defineproperty, except that the target object is implicit, and in a different compartment from the function and descriptor.) defineproperties(properties)
add the properties given byproperties to 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 ...
...nction 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() prevent 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() prevent properties from being
added to or deleted from the referent, and mark each property as non-writable. return this debugger.object instance. (this fu...
...mpartment from the caller.) freeze() prevent 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.) preventextensions() prevent properties from being
added to the referent. (this function behaves like the standard object.preventextensions 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. (this function behaves like the standard object.issealed f...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
ment" menu. (this menu will not be present unless you have changed the preference as explained above.) selecting the 'browser' context in the scratchpad enter the following code in the scratchpad: // this simply defines the 'debugger' constructor in this // scratchpad; it doesn't actually start debugging anything. components.utils.import('resource://gre/modules/jsdebugger.jsm');
adddebuggertoglobal(window); (function () { // the debugger we'll use to observe a tab's allocation. var dbg; // start measuring the selected tab's main window's memory // consumption. this function is available in the browser // console. window.demotrackallocations = function() { dbg = new debugger; // this makes hacking on the demo *much* more // pleasant. dbg.uncaugh...
... dbg = new debugger; // this makes hacking on the demo *much* more // pleasant. dbg.uncaughtexceptionhook = handleuncaughtexception; // find the current tab's main content window. var w = gbrowser.selectedbrowser.contentwindow; console.log("tracking allocations in page: " + w.location.href); // make that window a debuggee of our debugger. dbg.
adddebuggee(w.wrappedjsobject); // enable allocation tracking in dbg's debuggees. dbg.memory.trackingallocationsites = true; } window.demoplotallocations = function() { // grab the allocation log. var log = dbg.memory.drainallocationslog(); // neutralize the debugger, and drop it on the floor // for the gc to collect. console.log("stopping allocation tracking."); ...
....appendchild(div); } } function dodivsandspans() { divsandspans(); } </script> open the browser console (menu button > developer > browser console), and then evaluate the expression demotrackallocations() in the browser console. this begins logging allocations in the current browser tab. in the browser tab, click on the text that says "click here…". the event handler should
add some text to the end of the page. back in the browser console, evaluate the expression demoplotallocations(). this stops logging allocations, and displays a tree of allocations: an allocation plot, displayed in the console the numbers at the left edge of each line show the total number of objects allocated at that site or at sites called from there. after the count, we see the f...
Tutorial: Set a breakpoint - Firefox Developer Tools
t. this tutorial was tested against firefox 58 beta and nightly. it does not work in firefox 57. since the debugger api is only available to privileged javascript code, you’ll need to use the browser content toolbox to try it out. to do this, open the firefox developer tools, click on the options gear at the upper right of the toolbox, and make sure that both “enable browser chrome and
add-on debugging toolboxes” and “enable remote debugging” are checked. these are located at the bottom right of the options panel; you may need to scroll to see them. once they’re checked, you can close the developer tools. save the following text to an html file: <div onclick="report('the best div');">click me!</div> <div onclick="report('another great div');">or me!</div> <script> ...
...panel should appear at the top of the toolbox alongside the console, debugger, and memory panels. click on the scratchpad panel and enter the following code: components.utils.import("resource://gre/modules/jsdebugger.jsm"); components.utils.import("resource://gre/modules/console.jsm"); // this simply defines 'debugger' in this scratchpad; // it doesn't actually start debugging anything.
adddebuggertoglobal(this); // create a 'debugger' instance. var dbg = new debugger; // make the tab's top window a debuggee, and get a // debugger.object referring to the window. var windowdo = dbg.
adddebuggee(tabs[0].content); // get a debugger.object referring to the window's `report` // function. var reportdo = windowdo.getownpropertydescriptor('report').value; // set a breakpoint at the entry...
... share a single content process, so you may need to use a different element of the array as the debuggee. press “run” in the scratchpad again. now, clicking on “click me!” causes the breakpoint hit to be logged twice—one for each debugger instance. multiple debugger instances can observe the same debuggee. re-running the code in the scratchpad creates a fresh debugger instance,
adds the same web page as its debuggee, and then sets a new breakpoint. when you click on the div element, both debuggers’ breakpoints are hit, and both handlers run. this shows how any number of debugger-based tools can observe a single web page simultaneously. in fact, you can use the browser content toolbox’s debugger panel to set its own breakpoint in report, and it will trigger along with...
Deprecated tools - Firefox Developer Tools
not all of these have had wide adoption, and due to the cost of maintenance, seldom used panels are eventually removed. we have created this list of deprecated or removed panels. this page documents the deprecated panels and the bugs that track their removal. although these panels have been removed, you still have access to the old code, and there are alternative webextensions that you can try to get similar functionality. when we deprecate a panel, we begin by getting feedback from the community to determine the impact of removing that panel. ...
...ry to get similar functionality. when we deprecate a panel, we begin by getting feedback from the community to determine the impact of removing that panel. once we have decided to remove the panel, we will provide a warning message, and finally, we will remove the panel from the codebase. you may see a warning message, as in the following image, when trying to activate a deprecated panel: in
addition, if you open the panel for one of these tools, you will also see a warning message about its removal. scratchpad scratchpad is deprecated as of firefox 70 (bug 1565380), and will be removed as of firefox 72 (bug 1519103). description scratchpad provided an environment for experimenting with javascript code. you can write, run, and examine the result of code that interacts with the web ...
...ript code. you can write, run, and examine the result of code that interacts with the web page. alternatives in firefox 71+, you can write multi-line javascript code in the web console editor mode, making it similar to the scratchpad. the editor mode can be triggered clicking on the icon on the right of the console input, or with ctrl + b (cmd + b on macos) when in editor mode, the enter key
adds a new line in the input, and you can evaluate the expression using ctrl + enter (cmd + enter on macos). when evaluating, the input isn't cleared, which makes it possible to quickly iterrate over a snippet of code. the results are displayed in the console output, to the right of the input, providing immediate feedback. unlike in scratchpad, errors are properly displayed in the output with an ...
Network request details - Firefox Developer Tools
he request. referrer policy: the value of the referrer-policy header. http response headers http request headers each section has a disclosure triangle to expand the section to show more information. headers toolbar using the headers toolbar, you can: filter the headers in the response headers and request headers sections. block the domain involved in this request. the domain is
added to the blocking sidebar. resend the request. the resend button opens a menu with two items: resend: simply resends the request. edit and resend: enables an editing mode, where you can modify the method, url, request headers, or request body of the request. click send to send the modified request, or cancel to cancel editing. request information the following information is sho...
...an editing mode, where you can modify the method, url, request headers, or request body of the request. click send to send the modified request, or cancel to cancel editing. request information the following information is shown only when the section is expanded: scheme: the scheme used in the url host: the server involved in the request filename: the full path to the file requested
address: the ip
address of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request. version: the http version used transferred: the amount of data transferred with the request the referrer policy, which governs which referrer information, sent in the referer header, should be included with requests. (see referre...
... button in the section heading controls whether the headers are shown with formatting, or as plain, unformatted text. note that the keys in the response header are all in lowercase, while the request headers keys are not. http/2 requires that all headers be lowercase; response headers are shown as they are received from the server. (there may be some exceptions, such as x-firefox-spdy, which is
added by firefox.) you can copy some or all of the response header in json format by using the context menu: if you select copy, a single key word, value pair is copied. if you select copy all, the entire header is copied in json format, giving you something like this (after running the results through a json validator): { "response headers (1.113 kb)": { "headers": [ { "nam...
Edit CSS filters - Firefox Developer Tools
css filter properties in the rules view have a circular gray and white swatch next to them: clicking the swatch opens a filter editor: the filter editor lists each of the effects performed by that filter on a separate line. you can edit these lines, remove them individually, or drag the effects to change the order in which they are applied. ...
...cking the swatch opens a filter editor: the filter editor lists each of the effects performed by that filter on a separate line. you can edit these lines, remove them individually, or drag the effects to change the order in which they are applied. you can also
add new effects by selecting an effect from the dropdown list at the bottom of the dialog. once you have selected the effect you want to
add, click the plus sign (+) to the right of the dropdown list. once you have
added an effect, enter the settings you want and then press enter to update the effect. the change will be apparent as soon as youpress enter. saving filter presets from firefox 42 onwards, you can also
add filters to a list of presets. the list of presets will be preserved between browser sessions, making it easy to a...
... you can then apply saved filters to new elements. ...
Responsive Design Mode - Firefox Developer Tools
on is toggled: when this option is enabled, the page is reloaded whenever you toggle touch support. reload when user agent is changed: when this option is enabled, the page isreloaded whenever the user agent is changed. reloading on these changes can be helpful because certain page behaviors would otherwise not be applied. for example, many pages check for touch support on load and only
add event handlers if it is supported, or only enable certain features on certain browsers. however, if you are not interested in examining such features (maybe you are just checking the overall layout at different sizes), these reloads can waste time and possibly result in the loss of productive work, so it is useful to be able to control these reloads. now when you change such settings for the fi...
...normally would in the resized content area. device selection just above the viewport there is a label "no device selected"; click this to see a list of device names. select a device, and responsive design mode sets the following properties to match the selected device: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch event simulation
additionally, firefox sets the user-agent http request header to identify itself as the default browser on the selected device. for example, if you've selected an iphone, then firefox identifies itself as safari. the navigator.useragent property is set to the same value. the devices listed in the drop-down are just a subset of the devices that can be selected. at the end of the drop-down, there is...
...e a panel containing all the choices, which enables you to check the devices you want to see in the drop-down. the set of devices, and the 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 preview 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...
Settings - Firefox Developer Tools
he elipsis) on the right of the tab. the menu includes settings to control the location of the developer tools. you can choose between the default setting at the bottom of the windows, or move the tools to the left or right side of the screen. these settings are particularly useful if you have a widescreen monitor. you can also choose to open the tools in a separate window. show split console
adds a section at the bottom of the tools showing the console. it makes visible the command line and one or two lines of the console output. the rest of the settings are on the developer tools settings pane. to see the settings, open any of the developer tools, and then: click the "settings" command in the menu: or press f1 to toggle between the active tool and the settings pane the settings...
... dark theme: common preferences settings that apply to more than one tool. there's just one of these: enable persistent logs a setting to control whether or not the web console and network monitor clear their output when you navigate to a new page. if common preferences is not included in the settings, web console logs can be persisted by using the 'about:config' url in browser
address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true inspector 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, ...
... option. note that this option was called "disable cache" in firefox versions previous 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 browser itself, and not only web content. enable remote debugging enable the developer tools to debug remote firefox instances. enable worker debugging enable a panel within the debugger to debug workers. note: this option got removed from the ui in firefox 56, because this version ships with a new debugger ui, b...
Ambient Light Events - Web APIs
by changing the exposure necessary to take a picture. light events when the light sensor of a device detects a change in the light level, it notifies the browser of that change. when the browser gets such a notification, it fires a devicelightevent event that provides information about the exact light intensity (in lux units). ...
...ty (in lux units). this event can be captured at the window object level by using the
addeventlistener method (using the devicelight event name) or by attaching an event handler to the window.ondevicelight property. once captured, the event object gives access to the light intensity expressed in lux through the devicelightevent.value property. ...
...or by attaching an event handler to the window.ondevicelight property. once captured, the event object gives access to the light intensity expressed in lux through the devicelightevent.value property. example if ('ondevicelight' in window) { window.
addeventlistener('devicelight', function(event) { var body = document.queryselector('body'); if (event.value < 50) { body.classlist.
add('darklight'); body.classlist.remove('brightlight'); } else { body.classlist.
add('brightlight'); body.classlist.remove('darklight'); } }); } else { console.log('devicelight event not supported'); } specifications specification status comment ambient light sensorthe definition of 'ambient light events' in that specification. candidate ...
AudioNode - Web APIs
face for representing an audio processing module. examples include: an audio source (e.g. an html <audio> or <video> element, an oscillatornode, etc.), the audio destination, intermediate processing module (e.g. ...
...ld a processing graph. this graph is contained in an audiocontext, and each audio node can only belong to one audio context. a source node has zero inputs but one or multiple outputs, and can be used to generate sound. on the other hand, a destination node has no outputs; instead, all its inputs are directly played back on the speakers (or whatever audio output device the audio context uses). in
addition, there are processing nodes which have inputs and outputs. the exact processing done varies from one audionode to another but, in general, a node reads its inputs, does some audio-related processing, and generates new values for its outputs, or simply lets the audio pass through (for example in the analysernode, where the result of the processing is accessed separately). the more nodes in a...
... 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 the node is participating in. audionode.
AudioProcessingEvent - Web APIs
ould be written. the number of channels is defined as a parameter, numberofoutputchannels, of the factory method audiocontext.createscriptprocessor(). note the the returned audiobuffer is only valid in the scope of the onaudioprocess function. ...
...k loaded via audiocontext.decodeaudiodata(), process it,
adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and
add a small amount of white noise, before setting that result to be the output sample in each case. note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var...
...(var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; //
add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scrip...
BaseAudioContext.createScriptProcessor() - Web APIs
re supported. important: webkit currently (version 31) requires that a valid buffersize be passed when calling this method. note: it is invalid for both numberofinputchannels and numberofoutputchannels to be zero. returns a scriptprocessornode. ...
...k loaded via audiocontext.decodeaudiodata(), process it,
adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and
add a small amount of white noise, before setting that result to be the output sample in each case. note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var...
...(var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; //
add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scrip...
BasicCardRequest - Web APIs
the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. var supportedinstruments = [{ supportedmethods: 'basic-card', data: { supportednetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'] } }]; var de...
... // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. }) .catch(function(err) { // do something with the error from request.show(). }); } catch (e) { // catch any other errors. } once the payment flow has been triggered using paymentrequest.show() and the pr...
... promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "cardnumber' : '9999999999999999", "cardholdername' : 'mr dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billing
address" : { "country" : "gb", // etc. billing
address is a payment
address object } } specifications specification status comment basic card paymentthe definition of 'basiccardrequest' in that specification. working draft initial definition. ...
BiquadFilterNode() - Web APIs
filter allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range. it implements a second-order bandpass filter. q: controls the width of the band. the width becomes narrower as the q value increases. frequency: the center of the frequency band. gain: not used. lowshelf: the lowshelf filter allows all frequencies through, but
adds a boost (or attenuation) to the lower frequencies. it implements a second-order lowshelf filter. q: not used. frequency: the upper limit of the frequences where the boost, or attenuation, is applied. gain: the boost, in db, to be applied. if the value is negative, the frequencies are attenuated. highshelf: the highshelf filter is the opposite of the lowshelf filter and allows all...
... to the lower frequencies. it implements a second-order lowshelf filter. q: not used. frequency: the upper limit of the frequences where the boost, or attenuation, is applied. gain: the boost, in db, to be applied. if the value is negative, the frequencies are attenuated. ...
... q: the width of the band of frequencies that are boosted. a large value implies a narrow width. frequency: the center frequency of the boost range. gain: the boost, in db, to be applied. if the value is negative, the frequencies are attenuated. ...
BroadcastChannel: messageerror event - Web APIs
the messageerror event is fired on a broadcastchannel object when a message arrives on the channel that can't be deserialized. ...
...ror event is fired on a broadcastchannel object when a message arrives on the channel that can't be deserialized. ...
...can't be deserialized. ...
CSSStyleDeclaration.setProperty() - Web APIs
working draft document object model (dom) level 2 ...
... working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclarati...
... working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleSheet.insertRule() - Web APIs
t an @import at-rule after a style rule, the method aborts with a hierarchyrequesterror. if rule is @namespace and the rule-list has more than just @import at-rules and/or @namespace at-rules, the method aborts with an invalidstateerror. examples inserting a new rule this snippet pushes a new rule onto the top of my stylesheet. mystyle.insertrule('#blanc { color: white }', 0); function to
add a stylesheet rule /** *
add a stylesheet rule to the document (it may be better practice * to dynamically change classes, so style information can be kept in * genuine stylesheets and avoid
adding extra elements to the dom). * note that an array is needed for declarations and rules since ecmascript does * not guarantee a predictable object iteration order, and since css is * order-dependen...
...actice * to dynamically change classes, so style information can be kept in * genuine stylesheets and avoid
adding extra elements to the dom). * note that an array is needed for declarations and rules since ecmascript does * not guarantee a predictable object iteration order, and since css is * order-dependent. ...
...t iteration order, and since css is * order-dependent. ...
Managing screen orientation - Web APIs
t interdum tristique dapibus. ...
...tation media query to handle specific styles based on the screen orientation /* first let's define some common styles */ html, body { width : 100%; height: 100%; } body { border: 1px solid black; -moz-box-sizing: border-box; box-sizing: border-box; } p { font : 1em sans-serif; margin : 0; p
adding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; p
adding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; background: black; } li { display: inline-block; margin : 0; p
adding: 0.5em; background: white; } once we have some common styles we can start defining a special case for the orientation /* for portrait, we want the tool bar on top */ @media screen and (orientation: portrait) { #toolbar { width: 100%; } } ...
...or example, games based on the orientation of the device could be messed up by such a change of the orientation. the screen orientation api is made to prevent or handle such a change. listening orientation change the orientationchange event is triggered each time the device change the orientation of the screen and the orientation itself can be read with the screen.orientation property. screen.
addeventlistener("orientationchange", function () { console.log("the orientation of the screen is: " + screen.orientation); }); preventing orientation change any web application can lock the screen to suits its own needs. the screen is locked using the screen.lockorientation() method and unlocked using the screen.unlockorientation(). the screen.lockorientation() accepts a string (or series of s...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
ocusifneeded() method is used to draw a focus ring when appropriate. ...
... when appropriate. ...
... <button id="button1">continue</button> <button id="button2">quit</button> </canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const button1 = document.getelementbyid('button1'); const button2 = document.getelementbyid('button2'); document.
addeventlistener('focus', redraw, true); document.
addeventlistener('blur', redraw, true); canvas.
addeventlistener('click', handleclick, false); redraw(); function redraw() { ctx.clearrect(0, 0, canvas.width, canvas.height); drawbutton(button1, 20, 20); drawbutton(button2, 20, 80); } function handleclick(e) { // calculate click coordinates const x = e.clientx - canvas.offsetleft; const y = e.clienty - canvas.offsettop; // focus button1, if appropriate drawbutton(button1, 20, 20...
CanvasRenderingContext2D.lineCap - Web APIs
y of the canvas 2d api determines the shape used to draw the end points of lines. note: lines can be drawn with the stroke(), strokerect(), and stroketext() methods. syntax ctx.linecap = "butt" || "round" || "square"; options "butt" the ends of lines are squared off at the endpoints. default value. "round" the ends of lines are rounded. "square" the ends of lines are squared off by
adding a box with an equal width and half the height of the line's thickness. examples changing the shape of line caps this example rounds the end caps of a straight line. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 20); ctx.linewidth = 15; ctx.linecap = 'round'; ctx.line...
...pt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 20); ctx.linewidth = 15; ctx.linecap = 'round'; ctx.lineto(100, 100); ctx.stroke(); result comparison of line caps in this example three lines are drawn, each with a different value for the linecap property. ...
... comparison of line caps in this example three lines are drawn, each with a different value for the linecap property. two guides to see the exact differences between the three are
added. each of these lines starts and ends exactly on these guides. the line on the left uses the default "butt" option. it's drawn completely flush with the guides. the second is set to use the "round" option. this
adds a semicircle to the end that has a radius half the width of the line. the line on the right uses the "square" option. this
adds a box with an equal width and half the height of the line thickness. <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const linecap = ['butt', 'round', 'square']; // draw g...
CanvasRenderingContext2D.lineJoin - Web APIs
the canvasrenderingcontext2d.linejoin property of the canvas 2d api determines the shape used to join two line segments where they meet. this property has no effect wherever two connected segments have the same direction, because no joining area will be
added in this case. 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. ...
...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. syntax ctx.linejoin = "bevel" || "round" || "miter"; options there are three possible values for this property: "round", "bevel", and "miter". the default is "miter". "round" rounds off the corners of a shape by filling an
additional sector of disc centered at the common endpoint of connected segments. the radius for these rounded corners is equal to the line width. "bevel" fills an
additional triangular area between the common endpoint of connected segments, and the separate outside rectangular corners of each segment. "miter" connected segments are joined by extending their outside edges to connect at a single po...
...this setting is affected by the miterlimit property. default value. examples changing the joins in a path this example applies rounded line joins to a path. ...
Manipulating video using canvas - Web APIs
vascript code. the document content the html document used to render this content is shown below. ...
... up an event listener so we can detect when the user starts playing the video. var processor; processor.doload = function doload() { this.video = document.getelementbyid('video'); this.c1 = document.getelementbyid('c1'); this.ctx1 = this.c1.getcontext('2d'); this.c2 = document.getelementbyid('c2'); this.ctx2 = this.c2.getcontext('2d'); let self = this; this.video.
addeventlistener('play', function() { self.width = self.video.videowidth / 2; self.height = self.video.videoheight / 2; self.timercallback(); }, false); }, this code grabs references to the elements in the xhtml document that are of particular interest, namely the video element and the two canvas elements. it also fetches references to the graphics contexts for each...
...ht = self.video.videoheight / 2; self.timercallback(); }, false); }, this code grabs references to the elements in the xhtml document that are of particular interest, namely the video element and the two canvas elements. it also fetches references to the graphics contexts for each of the two canvases. these will be used when we're actually doing the chroma-keying effect. then
addeventlistener() is called to begin watching the video element so that we obtain notification when the user presses the play button on the video. in response to the user beginning playback, this code fetches the width and height of the video, halving each (we will be halving the size of the video when we perform the chroma-keying effect), then calls the timercallback() method to start watching the...
Hit regions and accessibility - Web APIs
on api allows you to define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools. it allows you to make hit detection easier and lets you route events to dom elements. the api has the following three methods (which are still experimental in current web browsers; check the browser compatibility tables). canvasrenderingcontext2d.
addhitregion()
adds a hit region to the canvas. canvasrenderingcontext2d.removehitregion() removes the hit region with the specified id from the canvas. canvasrenderingcontext2d.clearhitregions() removes all hit regions from the canvas. you can
add a hit region to your path and check for the mouseevent.region property to test if your mouse is hitting your region, for example. <canvas id...
...tregions() removes all hit regions from the canvas. you can
add a hit region to your path and check for the mouseevent.region property to test if your mouse is hitting your region, for example. <canvas id="canvas"></canvas> <script> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.arc(70, 80, 10, 0, 2 * math.pi, false); ctx.fill(); ctx.
addhitregion({id: 'circle'}); canvas.
addeventlistener('mousemove', function(event) { if (event.region) { alert('hit region: ' + event.region); } }); </script> the
addhitregion() method also takes a control option to route events to an element (that is a descendant of the canvas): ctx.
addhitregion({control: element}); this can be useful for routing to <input> elements, for example. see als...
...ng to <input> elements, for example. see also this codepen demo. focus rings when working with the keyboard, focus rings are a handy indicator to help navigating on a page. to draw focus rings on a canvas drawing, the drawfocusifneeded property can be used. canvasrenderingcontext2d.drawfocusifneeded() if a given element is focused, this method draws a focus ring around the current path.
additionally, the scrollpathintoview() method can be used to make an element visible on the screen if focused, for example. canvasrenderingcontext2d.scrollpathintoview() scrolls the current path or a given path into the view. ...
DOMTokenList.replace() - Web APIs
syntax tokenlist.replace(oldtoken, newtoken); parameters oldtoken a domstring representing the token you want to replace. newtoken a domstring representing the token you want to replace oldtoken with. return value a boolean value, which is true if oldtoken was successfully replaced, or false if not. note: in older browsers, replace() returns void. ...
....textcontent. ...
...extcontent = 'token not replaced successfully'; } the output looks like this: polyfill the following polyfill will
add the replace method to the domtokenlist class. the following code will only work with ie10-11. to use with earlier versions of ie, refer to the polyfill at element.classlist#polyfill domtokenlist.prototype.replace = function (a, b) { if (this.contains(a)) { this.
add(b); this.remove(a); return true; } return false; } specifications specification status comment domthe definition of 'replace()' in that specification. living standard initial definition ...
DataTransfer.clearData() - Web APIs
html <span class="tweaked" id="source" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element. ...
...on to move the element. ...
...rget { border: 1px solid black; } javascript window.
addeventlistener('domcontentloaded', function () { // select html elements var draggable = document.getelementbyid('source'); var dropable = document.getelementbyid('target'); var status = document.getelementbyid('status'); var data = document.getelementbyid('data'); var dropped = false; // register event handlers draggable.
addeventlistener('dragstart', dragstarthandler); draggable.
addeventlistener('dragend', dragendhandler); dropable.
addeventlistener('dragover', dragoverhandler); dropable.
addeventlistener('dragleave', dragleavehandler); dropable.
addeventlistener('drop', drophandler); function dragstarthandler (event) { status.innerhtml = 'drag in process'; // change target element's border to signif...
DataTransfer.dropEffect - Web APIs
of the dropeffect and effectallowed properties. html content <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element. ...
...vent);" ondragover="dragover_handler(event);">drop zone</div> css content div { margin: 0em; p
adding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } javascript content function dragstart_handler(ev) { console.log("dragstart: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + 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.preventdefault(); // get the id of the t...
...ent'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.preventdefault(); // get the id of the target and
add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } ...
DataTransfer.effectAllowed - Web APIs
old value is retained. internet explorer will change the value to be lowercased; thus, linkmove will become linkmove, and so on. example this example shows the use of the effectallowed and dropeffect properties. ...
... properties</title> <meta content="width=device-width"> <style> div { margin: 0em; p
adding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + 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.preventdefault(); // get the id of the target a...
...is 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.preventdefault(); // get the id of the target and
add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </script...
DataTransfer.items - Web APIs
representing the items being dragged in a drag operation, one list item for each object being dragged. if the drag operation had no data, the list is empty. example this example shows the use of the items and types properties. ...
...xample shows the use of the items and types properties. ...
...e>examples of datatransfer.{types,items} properties</title> <meta content="width=device-width"> <style> div { margin: 0em; p
adding: 2em; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart: target.id = " + ev.target.id); //
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/plain", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: target.id = " + ev.target.id); ev.preventdefault(); // get the id of the target and
add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print eac...
DataTransfer.types - Web APIs
drag operation included no data, this list will be empty. if any files are included in the drag operation, then one of the types will be the string files. example this example shows the use of the types and items properties. ...
...xample shows the use of the types and items properties. ...
...e>examples of datatransfer.{types,items} properties</title> <meta content="width=device-width"> <style> div { margin: 0em; p
adding: 2em; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart: target.id = " + ev.target.id); //
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/plain", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: target.id = " + ev.target.id); ev.preventdefault(); // get the id of the target and
add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print eac...
Using light sensors - Web APIs
a change in light intensity, the browser is notified of the change and fires a devicelightevent event. the event gives information about the light intensity of the device's environment. the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below. ...
...f the change and fires a devicelightevent event. the event gives information about the light intensity of the device's environment. the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the
addeventlistener method of the window object. ...
...nt provides a value attribute with light intensity in lux which is generally treated as shown below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the
addeventlistener method of the window object. window.
addeventlistener("devicelight", function (event) { // read out the lux value var luminosity = event.value; alert(luminosity); }); example: window.
addeventlistener('devicelight', function(event) { var bodybg= document.body.style; //event.value is the lux value returned by the sensor on the device if (event.value < 100) { alert('hey, you! you are working in a dark environment'); bodybg.backgroundcolor="lightgrey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild. if your app c...
Document: gotpointercapture event - Web APIs
. bubbles no cancelable no interface pointerevent event handler property ongotpointercapture examples this example gets a <p> element and listens for the gotpointercapture event. it then calls setpointercapture() on the element on a pointerdown event, which will trigger gotpointercapture. ...
... event handler property ongotpointercapture examples this example gets a <p> element and listens for the gotpointercapture event. it then calls setpointercapture() on the element on a pointerdown event, which will trigger gotpointercapture. ...
... document.
addeventlistener('gotpointercapture', () => { console.log('i\'ve been captured!') }); para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); the same example, using the ongotpointercapture event handler property: const para = document.queryselector('p'); document.ongotpointercapture = () => { console.log('i\'ve been captured!') }; para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); specifications specification status pointer events obsolete ...
Document: keydown event - Web APIs
nts are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). ...
...s are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.
addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples
addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key. <p>focus the iframe first (e.g. ...
...rocessed by an ime): eventtarget.
addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples
addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key. <p>focus the iframe first (e.g. ...
Document: lostpointercapture event - Web APIs
es no cancelable no interface pointerevent event handler property onlostpointercapture examples this example listens for the lostpointercapture event, and captures the pointer for an element on pointerdown. when the user subsequently releases the pointer, the lostpointercapture event will be fired. ...
...operty onlostpointercapture examples this example listens for the lostpointercapture event, and captures the pointer for an element on pointerdown. when the user subsequently releases the pointer, the lostpointercapture event will be fired. ...
...nt.
addeventlistener('lostpointercapture', () => { console.log('i\'ve been released!') }); para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); the same example, but using the onlostpointercapture event handler property: const para = document.queryselector('p'); document.onlostpointercapture = () => { console.log('i\'ve been released!') }; para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); specifications specification status pointer events obsolete ...
DocumentType - Web APIs
the documenttype interface represents a node containing a doctype. ...
... a domstring, eg "http://www.w3.org/tr/html4/strict.dtd", empty string for html5. methods inherits methods from its parent, node, and implements the childnode interface. childnode.remove() removes the object from its parent children list. specifications specification status comment domthe definition of 'documenttype' in that specification. living standard
added implemention of the childnode interface. removed the internalsubset, entities, and notation properties. document object model (dom) level 3 core specificationthe definition of 'documenttype' in that specification. obsolete no change from document object model (dom) level 2 core specification. document object model (dom) level 2 core specificationthe definition of 'doc...
...moved the internalsubset, entities, and notation properties. document object model (dom) level 3 core specificationthe definition of 'documenttype' in that specification. obsolete no change from document object model (dom) level 2 core specification. document object model (dom) level 2 core specificationthe definition of 'documenttype' in that specification. obsolete
added the publicid, systemid, and internalsubset properties. document object model (dom) level 1 specificationthe definition of 'documenttype' in that specification. obsolete initial definition ...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
next, we cre...
... list using [0]. next, we get all the p elements that are descendants of the body: mybodyelements = mybody.getelementsbytagname("p"); finally, we get the second item from the list of p elements via myp = mybodyelements[1]; once you have gotten the dom object for an html element, you can set its properties. for example, if you want to set the style background color property, you just
add: myp.style.background = "rgb(255,0,0)"; // setting inline style attribute creating textnodes with document.createtextnode("..") use the document object to invoke the createtextnode method and create your text node. you just need to pass the text content. the return value is an object that represents the text node. mytextnode = document.createtextnode("world"); this means that you have crea...
...pe text_node, and it is the second child of the second <p> tag. the following figure shows the recently created text node object inside the document tree. createtextnode() and appendchild() is a simple way to include white space between the words hello and world. another important note is that the appendchild method will append the child after the last child, just like the word world has been
added after the word hello. so if 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, yo...
Element.clientLeft - Web APIs
clientleft is read-only. ...
... to rtl, then the vertical scrollbar is positioned on the left and this impacts the way clientleft is computed. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). note: when an element has display: inline, clientleft returns 0 regardless of the element's border. syntax var left = element.clientleft; example p
adding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt i...
...g elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. p
adding-bottom left top right bottom margin-top margin-bottom border-top border-bottom specifications specification status comment css object model (cssom) view modulethe definition of 'clientleft' in that specification. working draft ...
Element.clientTop - Web APIs
the width of the top border of an element in pixels. it is a read-only, integer property of element. as it happens, all that lies between the two locations (offsettop and client area top) is the element's border. this is because the offsettop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, (client area includes p
adding.) therefore, the clienttop value will always equal the integer portion of the .getcomputedstyle() value for "border-top-width". (actually might be math.round(parsefloat()).) for example, if the computed "border-top-width" is zero, then clienttop is also zero. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). gecko-based app...
... gecko 1.9 (firefox 3, implemented in bug 111207). this property is not supported in firefox 2 and earlier. syntax var top = element.clienttop; example in the following illustration, the client area is show in white. (the segments labeled "top", "right", etc. have no significance regarding the client area.) the clienttop value is the distance from where the margin (yellow) area ends and the p
adding and content areas (white) begin. p
adding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur ...
...g elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. p
adding-bottom left top right bottom margin-top margin-bottom border-top border-bottom notes clienttop was first introduced in the ms ie dhtml object model. specifications specification status comment css object model (cssom) view modulethe definition of 'clienttop' in that specification. working draft ...
Element: compositionend event - Web APIs
ditor completes or cancels the current composition session. for example, this event could be fired after a user finishes entering a chinese character using a pinyin ime. ...
..."control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { p
adding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[t...
... .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[type="text"]'); const log = document.queryselector('.event-log-contents'); const clearlog = document.queryselector('.clear-log'); clearlog.
addeventlistener('click', () => { log.textcontent = ''; }); function handleevent(event) { log.textcontent = log.textcontent + `${event.type}: ${event.data}\n`; } inputelement.
addeventlistener('compositionstart', handleevent); inputelement.
addeventlistener('compositionupdate', handleevent); inputelement.
addeventlistener('compositionend', handleevent); result specifications spe...
Element: compositionstart event - Web APIs
h as an input method editor starts a new composition session. for example, this event could be fired after a user starts entering a chinese character using a pinyin ime. ...
..."control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { p
adding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[t...
... .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[type="text"]'); const log = document.queryselector('.event-log-contents'); const clearlog = document.queryselector('.clear-log'); clearlog.
addeventlistener('click', () => { log.textcontent = ''; }); function handleevent(event) { log.textcontent = log.textcontent + `${event.type}: ${event.data}\n`; } inputelement.
addeventlistener('compositionstart', handleevent); inputelement.
addeventlistener('compositionupdate', handleevent); inputelement.
addeventlistener('compositionend', handleevent); result specifications spe...
Element: compositionupdate event - Web APIs
ontrolled by a text composition system such as an input method editor. for example, this event could be fired while a user enters a chinese character using a pinyin ime. ...
..."control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { p
adding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[t...
... .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; p
adding: 1px 2px 0; border: 1px solid black; } js const inputelement = document.queryselector('input[type="text"]'); const log = document.queryselector('.event-log-contents'); const clearlog = document.queryselector('.clear-log'); clearlog.
addeventlistener('click', () => { log.textcontent = ''; }); function handleevent(event) { log.textcontent = log.textcontent + `${event.type}: ${event.data}\n`; } inputelement.
addeventlistener('compositionstart', handleevent); inputelement.
addeventlistener('compositionupdate', handleevent); inputelement.
addeventlistener('compositionend', handleevent); result specifications spe...
Element: focusin event - Web APIs
document object model (dom) level 3 events specification obs...
... document object model (dom) level 3 events specification obsolete initial definition ...
...="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.
addeventlistener('focusin', (event) => { event.target.style.background = 'pink'; }); form.
addeventlistener('focusout', (event) => { event.target.style.background = ''; }); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Element: focusout event - Web APIs
document object model (dom) level 3 events specification obs...
... document object model (dom) level 3 events specification obsolete initial definition ...
...="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.
addeventlistener('focusin', (event) => { event.target.style.background = 'pink'; }); form.
addeventlistener('focusout', (event) => { event.target.style.background = ''; }); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Element: fullscreenchange event - Web APIs
creenchange event is fired immediately after an element switches into or out of full-screen mode. bubbles yes cancelable no interface event event handler property onfullscreenchange this event is sent to the element which is transitioning into or out of full-screen mode. examples in this example, a handler for the fullscreenchange event is
added to the element whose id is fullscreen-div. if the user clicks on the "toggle fullscreen mode" button, the click handler will toggle full-screen mode for the div. if document.fullscreenelement has a value it will exit full-screen mode. if not, the div will be placed into full-screen mode. remember that by the time the fullscreenchange event is handled, the status of the element has already cha...
...e, the fullscreenchange handler logs the id of the full-screen element to the console. if document.fullscreenelement is null, the code logs a message that the change is to leave full-screen mode. html <h1>fullscreenchange event example</h1> <div id="fullscreen-div"> <button id="toggle-fullscreen">toggle fullscreen mode</button> </div> javascript document.getelementbyid('fullscreen-div').
addeventlistener('fullscreenchange', (event) => { // document.fullscreenelement will point to the element that // is in fullscreen mode if there is one. if not, the value // of the property is null. if (document.fullscreenelement) { console.log(`element: ${document.fullscreenelement.id} entered fullscreen mode.`); } else { console.log('leaving full-screen mode.'); } }); document.
...vent) => { // document.fullscreenelement will point to the element that // is in fullscreen mode if there is one. if not, the value // of the property is null. if (document.fullscreenelement) { console.log(`element: ${document.fullscreenelement.id} entered fullscreen mode.`); } else { console.log('leaving full-screen mode.'); } }); document.getelementbyid('toggle-fullscreen').
addeventlistener('click', (event) => { if (document.fullscreenelement) { // exitfullscreen is only available on the document object. document.exitfullscreen(); } else { document.getelementbyid('fullscreen-div').requestfullscreen(); } }); specifications specification status fullscreen api living standard ...
Element: mouseout event - Web APIs
ild element obscures the visible area of the element. bubbles yes cancelable yes interface mouseevent event handler property onmouseout examples the following examples show the use of the mouseout event. mouseout and mouseleave the following example illustrates the difference between mouseout and mouseleave events. the mouseleave event is
added to the <ul> to color the list purple whenever the mouse exits the <ul>. mouseout is
added to the list to color the targeted element orange when the mouse exits it. when you try this out, you'll find that mouseout is delivered to the individual list items, while mouseleave goes to the overall list, courtesy of the hierarchy of the items and the fact that list items obscure the underlying <ul>. ...
...ivered to the individual list items, while mouseleave goes to the overall list, courtesy of the hierarchy of the items and the fact that list items obscure the underlying <ul>. ...
... working draft ...
Element.scrollWidth - Web APIs
lement.scrollwidth read-only property is a measurement of the width of an element's content, including content not visible on the screen due to overflow. the scrollwidth value is equal to the minimum width the element would require in order to fit all the content in the viewport without using a horizontal scrollbar. the width is measured in the same way as clientwidth: it includes the element's p
adding, but not its border, margin or vertical scrollbar (if present). it can also include the width of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for horizontal scrollbar, its scrollwidth is equal to clientwidth this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var xscro...
... working draft initi...
... working draft initial definition ...
Element.setCapture() - Web APIs
vents are targeted directly to this element; if false, events can also fire at descendants of this element. example in this example, the current mouse coordinates are drawn while you mouse around after clicking and holding down on an element. ...
... and holding down on an element. ...
...e capture example</title> <style type="text/css"> #mybutton { border: solid black 1px; color: black; p
adding: 2px; box-shadow: black 2px 2px; } </style> <script type="text/javascript"> function init() { var btn = document.getelementbyid("mybutton"); if (btn.setcapture) { btn.
addeventlistener("mousedown", mousedown, false); btn.
addeventlistener("mouseup", mouseup, false); } else { document.getelementbyid("output").innerhtml = "sorry, there appears to be no setcapture support on this browser"; } } function mousedown(e) { e.target.setcapture(); e.target.
addeventlistener("mousemove", mousemoved, false); } function mouseup(e) { e.target.removeeventlistener("mouse...
Element.toggleAttribute() - Web APIs
return value true if attribute name is eventually present, and false otherwise. ...
...g it if it is not present) on the given element. syntax element.toggleattribute(name [, force]); parameters name a domstring specifying the name of the attribute to be toggled. the attribute name is automatically converted to all lower-case when toggleattribute() is called on an html element in an html document. force optional a boolean value to determine whether the attribute should be
added or removed, no matter whether the attribute is present or not at the moment. return value true if attribute name is eventually present, and false otherwise. exceptions invalidcharactererror the specified attribute name contains one or more characters which are not valid in attribute names. example in the following example, toggleattribute() is used to toggle the readonly attribute of...
...r the specified attribute name contains one or more characters which are not valid in attribute names. example in the following example, toggleattribute() is used to toggle the readonly attribute of a <input>. ...
Element: wheel event - Web APIs
rolltop of the target in the scroll event. examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel. ...
... working draft ...
...f; p
adding: 5px; } function zoom(event) { event.preventdefault(); scale += event.deltay * -0.01; // restrict scale scale = math.min(math.max(.125, scale), 4); // apply scale transform el.style.transform = `scale(${scale})`; } let scale = 1; const el = document.queryselector('div'); el.onwheel = zoom;
addeventlistener equivalent the event handler can also be set up using the
addeventlistener() method: el.
addeventlistener('wheel', zoom); specifications specification status comment ui eventsthe definition of 'wheel' in that specification. working draft ...
Comparison of Event Targets - Web APIs
rs? ...
...for the mouseout event, it holds the node that the mouse moved to. event type event.target event.relatedtarge...
...for the mouseout event, it holds the node that the mouse moved to. event type event.target event.relatedtarget mouseover the eventtarget which the pointing de...
Event.preventDefault() - Web APIs
t() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect. syntax event.preventdefault(); examples blocking default click handling toggling a checkbox is the default action of clicking on a checkbox. ...
...ould usually use native html form validation instead. ...
...ttle bit of css for the warning box we'll draw when the user presses an invalid key: .warning { border: 2px solid #f39389; border-radius: 2px; p
adding: 10px; position: absolute; background-color: #fbd8d4; color: #3b3c40; } javascript and here's the javascript code that does the job. ...
Event.type - Web APIs
string containing the type of event. example this example logs the event type whenever you press a keyboard key or click a mouse button. ...
...event type whenever you press a keyboard key or click a mouse button. ...
... html <p>press any key or click the mouse to get the event type.</p> <p id="log"></p> javascript function geteventtype(event) { const log = document.getelementbyid('log'); log.innertext = event.type + '\n' + log.innertext; } // keyboard events document.
addeventlistener('keydown', geteventtype, false); // first document.
addeventlistener('keypress', geteventtype, false); // second document.
addeventlistener('keyup', geteventtype, false); // third // mouse events document.
addeventlistener('mousedown', geteventtype, false); // first document.
addeventlistener('mouseup', geteventtype, false); // second document.
addeventlistener('click', geteventtype, false); // third result specifications specification status comment domthe definition of 'event.typ...
Using Fetch - Web APIs
// the calling script is on the origin 'https://example.com' fetch('https://example.com', { credentials: 'same-origin' }); ...
...ta, or text/plain sending a request with credentials included to cause browsers to send a request with credentials included, even for a cross-origin call,
add credentials: 'include' to the init object you pass to the fetch() method. fetch('https://example.com', { credentials: 'include' }); if you only want to send credentials if the request url is on the same origin as the calling script,
add credentials: 'same-origin'. // the calling script is on the origin 'https://example.com' fetch('https://example.com', { credentials: 'same-origin' }); to instead ensure browsers don’t include credentials in the request, use credentials: 'omit'. fetch('https://example.com', { credentials: 'omit' }) uploading json data use fetch() to post json-encoded data. const data = { username: 'e...
...e http status code message. response.ok — seen in use above, this is a shorthand for checking that status is in the range 200-299 inclusive. this returns a boolean. ...
FileReader: abort event - Web APIs
="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const preview =...
...('input[type="file"]'); const preview = document.queryselector('img.preview'); 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") { preview.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 handleselected(e) { eventlog.textcontent = ''; ...
... reader.
addeventlistener('load', handleevent); reader.
addeventlistener('loadend', handleevent); reader.
addeventlistener('progress', handleevent); reader.
addeventlistener('error', handleevent); reader.
addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) {
addlisteners(reader); reader.readasdataurl(selectedfile); } reader.abort(); } fileinput.
addeventlistener('change', handleselected); result specifications specification status file api working draft ...
FileReader: load event - Web APIs
="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const preview =...
...('input[type="file"]'); const preview = document.queryselector('img.preview'); 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") { preview.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 handleselected(e) { eventlog.textcontent = ''; ...
... reader.
addeventlistener('load', handleevent); reader.
addeventlistener('loadend', handleevent); reader.
addeventlistener('progress', handleevent); reader.
addeventlistener('error', handleevent); reader.
addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) {
addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.
addeventlistener('change', handleselected); result specifications specification status file api working draft ...
FileReader: loadend event - Web APIs
="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const preview =...
...('input[type="file"]'); const preview = document.queryselector('img.preview'); 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") { preview.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 handleselected(e) { eventlog.textcontent = ''; ...
... reader.
addeventlistener('load', handleevent); reader.
addeventlistener('loadend', handleevent); reader.
addeventlistener('progress', handleevent); reader.
addeventlistener('error', handleevent); reader.
addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) {
addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.
addeventlistener('change', handleselected); result specifications specification status file api working draft ...
FileReader: loadstart event - Web APIs
="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const preview =...
...('input[type="file"]'); const preview = document.queryselector('img.preview'); 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") { preview.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 handleselected(e) { eventlog.textcontent = ''; ...
... reader.
addeventlistener('load', handleevent); reader.
addeventlistener('loadend', handleevent); reader.
addeventlistener('progress', handleevent); reader.
addeventlistener('error', handleevent); reader.
addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) {
addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.
addeventlistener('change', handleselected); result specifications specification status file api working draft ...
FileReader: progress event - Web APIs
="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const preview =...
...('input[type="file"]'); const preview = document.queryselector('img.preview'); 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") { preview.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 handleselected(e) { eventlog.textcontent = ''; ...
... reader.
addeventlistener('load', handleevent); reader.
addeventlistener('loadend', handleevent); reader.
addeventlistener('progress', handleevent); reader.
addeventlistener('error', handleevent); reader.
addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) {
addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.
addeventlistener('change', handleselected); result specifications specification status file api working draft ...
FileSystemDirectoryEntry.createReader() - Web APIs
the filesystemdirectoryentry interface's method createreader() returns a filesystemdirectoryreader object which can be used to read the entries in the directory. syntax directoryreader = filesystemdirectoryentry.createreader(); parameters none. return value a filesystemdirectoryreader object which can be used to read the directory's entries. ...
... the entries in the directory. syntax directoryreader = filesystemdirectoryentry.createreader(); parameters none. return value a filesystemdirectoryreader object which can be used to read the directory's entries. example this example creates a method called re
addirectory(), which fetches all of the entries in the specified filesystemdirectoryentry and returns them in an array. ...
... getentries(); return entries; } this works by creating an internal function, getentries(), which calls itself recursively to get all the entries in the directory, concatenating each batch to the array. each iteration, readentries() is called to get more entries. when it returns an empty array, the end of the directory has beenr reached, and the recursion ends. once control is returned to re
addirectory(), the array is returned to the caller. specifications specification status comment file and directory entries apithe definition of 'createreader()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please chec...
FormData.append() - Web APIs
the difference between formdata.set and append() is that if the specified key already exists, formdata.set will overwrite all existing values with the new one, whereas append() will append the new value onto the end of the existing set of values. note: this method is available in web workers. ...
...e default filename for file objects is the file's filename. note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. returns void. ...
...g line creates an empty formdata object: var formdata = new formdata(); // currently empty you can
add key/value pairs to this using formdata.append: formdata.append('username', 'chris'); formdata.append('userpic', myfileinput.files[0], 'chris.jpg'); as with regular form data, you can append multiple values with the same name. for example (and being compatible with php's naming conventions by
adding [] to the name): formdata.append('userpic[]', myfileinput.files[0], 'chris1.jpg'); formdata.append('userpic[]', myfileinput.files[1], 'chris2.jpg'); this technique makes it simpler to process multi-file uploads because the resultant data structure is more conducive to looping. if the sent value is different than string or blob it will be automatically converted to string: formdata.append('...
Using the Frame Timing API - Web APIs
elp identify areas that take too long to provide a good user experience. this document describes how to use the performanceframetiming interfaces including example code. for an overview of these interfaces see frame timing api. frame observers the performance observer interfaces allow an application to register an observer for specific performance event types. when one of those event types is
added to the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created. creating an observer to observe "frame" performance entry types, the application first creates a performanceobserver object with a specific frame observer callback. in the following example, two observers for the "frame" perform...
... registering for notifications after an observer is created, the next step is to use the performanceobserver.observe() method to specify the set of performance events to observe. in the following example, the observer only registers for "frame" performance entry notifications. var observe_frame = ...
...serve. in the following example, the observer only registers for "frame" performance entry notifications. var observe_frame = new performanceobserver(function(list) { // process the frame ... }); // only observe 'frame' events observe_frame.observe({entrytypes: ['frame']}); in the following example, the observer registers to be notified when several different performance entry types are
added to the performance timeline. var observe_all = new performanceobserver(function(list) { var perfentries = list.getentries(); for (var i=0; i < perfentries.length; i++) { switch (perfentries[i].entrytype) { case "frame": process_frame(perfentries[i]); break; case "mark": process_mark(perfentries[i]); break; case "measure": process_measure(perfentries[i]); break;...
Frame Timing API - Web APIs
resizing, scrolling, rendering, css animations, etc. a frame rate of 60 fps (frames per second) for a 60 hz refresh rate is a common target for a good responsive user experience. this means the browser should process a frame in about 16.7 ms. an application can register a performanceobserver for "frame" performance entry types. the observer (callback) will be notified when new "frame" events are
added to the browser's performance timeline and the frame's duration (length of time) will be available. this data can be used to help identify areas that take too long to provide a good user experience. example code of the interfaces described in this document is included in using the frame timing api. performance frames the performanceframetiming interface extends the following performanceentry ...
... example code of the interfaces described in this document is included in using the frame timing api. performance frames the performanceframetiming interface extends the following performanceentry properties (for "frame" performance entry types) by qualifying and constrainting the properties as follows: performanceentry.entrytype set to "frame". performanceentry.name set to the document's
address. performanceentry.starttime set to the domhighrestimestamp when the frame was started. performanceentry.duration set to a timestamp indicating the difference between the starttimes of two successive frames. this data, particularly the duration timestamp, can be used to help identify performance problems. frame observers the performance observer interfaces allow an application to regi...
...ia the observer's callback function that was specified when the observer was created. to observe "frame" performance entry types, the application first creates a performanceobserver object with a specific frame observer callback (function). next, performanceobserver.observe() is used to specify the set of performance events to observe - in this case, just the "frame" event type. when the browser
adds a new frame to the performance timeline, the specified observer callback will be invoked. accessing frame data when a frame observer is invoked, frame performance entries can be retrieved by calling performanceobserverentrylist.getentriesbytype() with an argument of "frame". this method returns a list of "frame" performanceentry objects. each frame object's duration property returns the timest...
Geolocation API - Web APIs
the user's operating system will prompt the user to allow location access the first time it is requested. ...
...ionaries positionoptions represents an object containing options to pass in as a parameter of geolocation.getcurrentposition() and geolocation.watchposition(). examples in the following example the geolocation api is used to retrieve the user's latitude and longitude. if sucessful, the available hyperlink is populated with an openstreetmap.org url that will show their location. ...
...e: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve your location'; } if(!navigator.geolocation) { status.textcontent = 'geolocation is not supported by your browser'; } else { status.textcontent = 'locating…'; navigator.geolocation.getcurrentposition(success, error); } } document.queryselector('#find-me').
addeventlistener('click', geofindme); result specifications specification status comment geolocation api recommendation ...
GlobalEventHandlers.onanimationcancel - Web APIs
el="handlecancelevent(event);"> <div id="text">box</div> </div> </div> <div class="button" id="togglebox"> hide the box </div> <pre id="log"></pre> css :root { --boxwidth: 50px; } .main { width: 300px; height: 300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; p
adding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, le...
...; }; then we set up the handlecancelevent() function, which is called in response to the animationcancel event, as set up in the html above. all we do here is log information to the console, but you might find other use cases, such as starting a new animation or effect, or terminating some dependent operation. ...
...sole, but you might find other use cases, such as starting a new animation or effect, or terminating some dependent operation. function handlecancelevent(event) { log("animation canceled", event); }; then we
add a method to handle toggle display between "flex" and "none" and establish it as the handler for a click event on the "hide/show" the box button: document.getelementbyid('togglebox').
addeventlistener('click', function() { if (box.style.display == "none") { box.style.display = "flex"; document.getelementbyid("togglebox").innerhtml = "hide the box"; } else { box.style.display = "none"; document.getelementbyid("togglebox").innerhtml = "show the box"; } }); toggling the box to display: none has the effect of aborting its animation. in browsers that support ani...
GlobalEventHandlers.onanimationend - Web APIs
ss="main"> <div id="box"> <div id="text">box</div> </div> </div> <div class="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; p
adding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, ...
...nt: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll
add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next. first, the "slideanimation" class, which establishes the animation that will c...
...for information about why, and how to support running an an...
GlobalEventHandlers.onanimationstart - Web APIs
ss="main"> <div id="box"> <div id="text">box</div> </div> </div> <div class="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; p
adding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, ...
...nt: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll
add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next. first, the "slideanimation" class, which establishes the animation that will c...
...for information about why, and how to support running an an...
GlobalEventHandlers.onerror - Web APIs
erty 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 errorevent is fired at window and window.onerror() is invoked (as well as handlers attached by window.
addeventlistener (not only capturing)). when a resource (such as an <img> or <script>) fails to load, an error event using interface event is fired at the element that initiated the load, and the onerror() handler on the element is invoked. these error events do not bubble up to window, but (at least in firefox) can be handled with a window.
addeventlistener configured with usecapture set to true. ...
... window.onerror window.onerror = function(message, source, lineno, colno, error) { ... }; function parameters: message: error message (string). available as event (sic!) in html onerror="" handler. ...
...essage: 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 prevents the firing of the default event handler. window.
addeventlistener('error') window.
addeventlistener('error', function(event) { ... }) event of type errorevent 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 are using an image tag, and need to specify a backup image ...
GlobalEventHandlers.onpointerdown - Web APIs
ly 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 preventdefault(), 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 pointerevent describing the pointerdown event. example this example demonstrates how to watch for and act upon pointerdown events us...
...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 pointerevent 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) { var action; switch(evt.pointertype) { case "mouse": action = "clicking"; break; case "pen": action = "tapping"; break; cas...
... pointerup events: targetbox.onpointerup = handleup; function handleup(evt) { targetbox.innerhtml = "tap me, click me, or touch me!"; evt.preventdefault(); } this code's job is to just restore the original text into the target box after the user's interaction with the element ends (for example, when they release the mouse button, or when they lift the stylus or finger from the screen). in
addition, the event's preventdefault() method is called to ensure that the mouseup event isn't triggered unnecessarily. html the html is extremely simple: <div id="target"> tap me, click me, or touch me! </div> css the css simply sets up the appearance of the target, and doesn't affect its functionality at all. #target { width: 400px; height: 30px; text-align: center; font: 16px ...
GlobalEventHandlers - Web APIs
note: globaleventhandlers is a mixin and not an interface; you can't actually create an object of type globaleventhandlers. properties this interface doesn't include any properties except for the event handlers listed below. ...
... that a css transition has started transitioning. globaleventhandlers.onwaiting is an eventhandler representing the code to be called when the waiting event is raised. methods this interface defines no methods. specifications specification status comment selection apithe definition of 'extension to globaleventhandlers' in that specification. working draft
adds onselectionchange. pointer lockthe definition of 'extension of document' in that specification. candidate recommendation
adds onpointerlockchange and onpointerlockerror on document. it is experimentally implemented on globaleventhandlers. html living standardthe definition of 'globaleventhandlers' in that specification. living standard no change since the latest sna...
...lockchange and onpointerlockerror on document. it is experimentally implemented on globaleventhandlers. html living standardthe definition of 'globaleventhandlers' in that specification. living standard no change since the latest snapshot, html 5.1. html 5.1the definition of 'globaleventhandlers' in that specification. recommendation snapshot of html living standard.
added onsort since the html5 snapshot. html5the definition of 'globaleventhandlers' in that specification. recommendation snapshot of html living standard. creation of globaleventhandlers (properties where on the target before it). ...
HTMLAnchorElement - Web APIs
nd provides special properties and methods (beyond those of the regular htmlelement object interface that they inherit from) for manipulating the layout and presentation of such elements. ...
... be used to modify the value. the blur() and focus() methods are inherited from htmlelement from html5 on, but were defined on htmlanchorelement in dom level 2 html and earlier specifications. specifications specification status comment html living standardthe definition of 'htmlanchorelement' in that specification. living standard the following property has been
added: download. technically, the url-related properties, media, host, hostname, pathname, port, protocol, 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 access...
...elementutils 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 specificationthe definition of 'htmlanchorelement' in that speci...
HTMLAreaElement - Web APIs
the htmlareaelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. ...
...erlinkelementutils. htmlhyperlinkelementutils.tostring() returns a usvstring containing the whole url of the script executed in the worker. it is a synonym for htmlhyperlinkelementutils.href. specifications specification status comment html living standardthe definition of 'htmlareaelement' in that specification. living standard the following property has been
added: download. technically, the url-related properties, media, host, hostname, pathname, port, protocol, search, and hash, have been moving to the htmlhyperlinkelementutils mixin, and htmlareaelement implements this mixin. html5the definition of 'htmlareaelement' in that specification. recommendation technically, the properties tabindex and accesskey are now defined on htmlelemen...
...rt, protocol, search, and hash, have been moving to the htmlhyperlinkelementutils mixin, and htmlareaelement implements this mixin. html5the definition of 'htmlareaelement' in that specification. recommendation technically, the properties tabindex and accesskey are now defined on htmlelement. the following property is now obsolete: nohref. the following properties have been
added: rel, rellist, media, hreflang, type, host, hostname, pathname, port, protocol, search, and hash. document object model (dom) level 2 html specificationthe definition of 'htmlareaelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmlareaelement' in...
HTMLCanvasElement.toBlob() - Web APIs
for example, to get the image in jpeg format: canvas.toblob(function(blob){...}, 'image/jpeg', 0.95); // jpeg at 95% quality a way to convert a canvas to an ico (mozilla only) this uses -moz-parse to convert the canvas to ico. windows xp doesn't support converting from png to ico, so it uses bmp instead. a download link...
... var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); functi...
... a.style.display = 'block'; a.download = iconname + '.ico'; a.href = window.url.createobjecturl(b); } } canvas.toblob(blobcallback('passthisstring'), 'image/vnd.microsoft.icon', '-moz-parse-options:format=bmp;bpp=32'); save toblob to disk with os.file (chrome/
add-on context only) this technique saves it to the desktop and is only useful in firefox chrome context or
add-on code as os apis are not present on web sites. var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); function blobcallback(iconname) { return function(b) { var r = new filereader(); r.onloadend = function ()...
HTMLCanvasElement - Web APIs
the htmlcanvaselement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. the htmlcanvaselement interface also inherits the properties and methods of the htmlelement interface. ...
...fercontroltooffscreen() transfers control to an offscreencanvas object, either on the main thread or on a worker. obsolete methods htmlcanvaselement.mozgetasfile() returns a file object representing the image contained in the canvas; this file is a memory-based file, with the specified name. if type is not specified, the image type is image/png. events listen to these events using
addeventlistener(). webglcontextcreationerror fired if the user agent is unable to create a webglrenderingcontext or webgl2renderingcontext context. webglcontextlost fired if the user agent detects that the drawing buffer associated with a webglrenderingcontext or webgl2renderingcontext object has been lost. webglcontextrestored fired if the user agent restores the drawing buffer for a webglr...
... ...
HTMLElement: gotpointercapture event - Web APIs
e(). bubbles yes cancelable no interface pointerevent event handler property ongotpointercapture examples this example gets a <p> element and listens for the gotpointercapture event. it then calls setpointercapture() on the element on a pointerdown event, which will trigger gotpointercapture. ...
... event handler property ongotpointercapture examples this example gets a <p> element and listens for the gotpointercapture event. it then calls setpointercapture() on the element on a pointerdown event, which will trigger gotpointercapture. ...
...r('p'); para.
addeventlistener('gotpointercapture', () => { console.log('i\'ve been captured!') }); para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); the same example, using the ongotpointercapture event handler property: const para = document.queryselector('p'); para.ongotpointercapture = () => { console.log('i\'ve been captured!') }; para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); specifications specification status pointer events obsolete ...
HTMLElement: lostpointercapture event - Web APIs
cancelable no interface pointerevent event handler property onlostpointercapture examples this example listens for the lostpointercapture event for an element, and captures the pointer for the element on pointerdown. when the user subsequently releases the pointer, the lostpointercapture event will be fired. ...
...lostpointercapture examples this example listens for the lostpointercapture event for an element, and captures the pointer for the element on pointerdown. when the user subsequently releases the pointer, the lostpointercapture event will be fired. ...
... para.
addeventlistener('lostpointercapture', () => { console.log('i\'ve been released!') }); para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); the same example, but using the onlostpointercapture event handler property: const para = document.queryselector('p'); para.onlostpointercapture = () => { console.log('i\'ve been released!') }; para.
addeventlistener('pointerdown', (event) => { para.setpointercapture(event.pointerid); }); specifications specification status pointer events obsolete ...
HTMLElement: pointermove event - Web APIs
touch-action. bubbles yes cancelable yes interface pointerevent event handler property onpointermove usage notes the event, which is of type pointerevent, 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. ...
... cancelable yes interface pointerevent event handler property onpointermove usage notes the event, which is of type pointerevent, 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. ...
...ent handler property onpointermove usage notes the event, which is of type pointerevent, 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. ...
HTMLFormElement: reset event - Web APIs
the reset event fires when a <form> is reset. bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface event event handler property globaleventhandlers.onreset examples this example uses eventtarget.
addeventlistener() to listen for form resets, and logs the current event.timestamp whenever that occurs. ...
...rrent event.timestamp whenever that occurs. html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="reset">reset form</button> </form> <p id="log"></p> javascript function logreset(event) { log.textcontent = `form reset! time stamp: ${event.timestamp}`; } const form = document.getelementbyid('form'); const log = document.getelementbyid('log'); form.
addeventlistener('reset', logreset); result specifications specification status comment html living standardthe definition of 'reset' in that specification. working draft no change html 5.2the definition of 'reset' in that specification. recommendation no change html 5.1the definition of 'reset' in that specification. recommendation ...
... html5the definition of 'reset' in that specification. recommendation initial definition ...
HTMLImageElement.crossOrigin - Web APIs
ched from the same origin from which the document was loaded. use-credentials requests by the htmlimageelement will use the cors mode and the include credentials mode; all image requests by the element will use cors, regardless of what domain the fetch is from. if crossorigin is an empty string (""), the anonymous mode is selected. example in this example, a new <img> element is created and
added to the document, loading the image with the anonymous state; the image will be loaded using cors and credentials will be used for all cross-origin loads. javascript the code below demonstrates setting the crossorigin property on an <img> element to configure cors access for the fetch of a newly-created image. const imageurl = "https://mdn.mozillademos.org/files/16797/clock-demo-400px.png"; c...
...d for all cross-origin loads. javascript the code below demonstrates setting the crossorigin property on an <img> element to configure cors access for the fetch of a newly-created image. const imageurl = "https://mdn.mozillademos.org/files/16797/clock-demo-400px.png"; const container = document.queryselector(".container"); function loadimage(url) { const image = new image(200, 200); image.
addeventlistener("load", () => container.prepend(image) ); image.
addeventlistener("error", () => { const errmsg = document.createelement("output"); errmsg.value = `error loading image at ${url}`; container.append(errmsg); }); image.crossorigin = "anonymous"; image.alt = ""; image.src = url; } loadimage(imageurl); html <div class="container"> <p>here's a paragraph. i...
...ass="container"> <p>here's a paragraph. it's a very interesting paragraph. you are captivated by this paragraph. keep reading this paragraph. okay, now you can stop reading this paragraph. thanks for reading me.</p> </div> css body { font: 1.125rem/1.5, helvetica, sans-serif; } .container { display: flow-root; width: 37.5em; border: 1px solid #d2d2d2; } img { float: left; p
adding-right: 1.5em; } output { background: rgba(100, 100, 100, 0.1); font-family: courier, monospace; width: 95%; } result specifications specification status comment html living standardthe definition of 'htmlimageelement.crossorigin' in that specification. unknown browser compatibility the compatibility table on this page is generated from str...
HTMLImageElement.loading - Web APIs
e size of the image's presentation using the image element's width and height attributes. by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows. ...
...ng the image element's width and height attributes. by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows. ...
...g 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 actually needed. ...
HTMLImageElement.srcset - Web APIs
of an image to be used at the standard pixel density (1x) as well as double that pixel density (2x). also available is a version of the image for use at a width of 2048 pixels (2048w). "header640.png 640w, header960.png 960w, header1024.png 1024w, header.png" this string provides versions of a header image to use when the user agent's renderer needs an image of width 640px, 960px, or 1024px. an
additional, fallback image candidate is provided without any condition at all, to be used for any other width. "icon32px.png 32w, icon64px.png 64w, icon-retina.png 2x icon-ultra.png 3x icon.svg" here, options are provided for an icon at widths of 32px and 64px, as well as at pixel densities of 2x and 3x. a fallback image is provided as an svg file that should be used in all other cases. notice that...
... the css simply specifies that the image and its surrounding box should be 200 pixels square and should have a simple border around it. also provided is the word-break attribute, using the break-all value to tell the browser to wrap the string within the width available regardless of where in the string the wrap must occur. .box { width: 200px; border: 2px solid rgba(150, 150, 150, 255); p
adding: 0.5em; word-break: break-all; } .box img { width: 200px; } javascript the following code is run within a handler for the window's load event. it uses the image's currentsrc property to fetch and display the url selected by the browser from the srcset. let box = document.queryselector(".box"); let image = box.queryselector("img"); let newelem = document.createelement("p"); newelem.i...
...em.innerhtml = `image: <code>${image.currentsrc}</code>`; box.appendchild(newelem); result in the displayed output below, the selected url will correspond with whether your display results in selecting the 1x or the 2x version of the image. if you happen to have both standard and high density displays, try moving this window between them and reloading the page to see the results change. for
additional examples, see our guide to responsive images. specifications specification status comment html living standardthe definition of 'htmlimageelement.srcset' in that specification. living standard 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 ht...
HTMLInputElement: search event - Web APIs
handler property onsearch there are several ways a search can be initiated, such as by pressing enter while the <input> is focused, or, if the incremental attribute is present, after a ua-defined timeout elapses since the most recent keystroke (with new keystrokes resetting the timeout so the firing of the event is debounced). ...
...e is present, after a ua-defined timeout elapses since the most recent keystroke (with new keystrokes resetting the timeout so the firing of the event is debounced). current ua implementations of <input type="search"> have an
additional control to clear the field. using this control also fires the search event. in that case the value of the <input> element will be the empty string. ...
...strokes resetting the timeout so the firing of the event is debounced). current ua implementations of <input type="search"> have an
additional control to clear the field. using this control also fires the search event. in that case the value of the <input> element will be the empty string. examples //
addeventlistener version const input = document.queryselector('input[type="search"]'); input.
addeventlistener('search', () => { console.log("the term searched for was " + input.value); }) // onsearch version const input = document.queryselector('input[type="search"]'); input.onsearch = () => { console.log("the term searched for was " + input.value); }) specifications this event is not part of any specification. ...
HTMLLinkElement - Web APIs
reference information for external resources and the relationship of those resources to a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by htmlanchorelement). this object inherits all of the properties and methods of the htmlelement interface. ...
...methods from its parent, htmlelement, and linkstyle. specifications specification status comment preload candidate recommendation defines <link rel="preload">, and the as property. note that currently firefox only supports preloading of cacheable resources. html living standardthe 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. ...
...ecification. 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 initial definition. ...
HTMLMediaElement: canplay event - Web APIs
s that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.oncanplay specification html5 media examples these examples
add an event listener for the htmlmediaelement's canplay event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.oncanplay specification html5 media examples these examples
add an event listener for the htmlmediaelement's canplay event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: canplaythrough event - Web APIs
hat enough data has been loaded to play the media up to its end without having to stop for further buffering of content. ...
...ancelable no interface event target element default action none event handler property globaleventhandlers.oncanplaythrough specification html5 media examples these examples
add an event listener for the htmlmediaelement's canplaythrough event, then post a message when that event handler has reacted to the event firing. ...
... default action none event handler property globaleventhandlers.oncanplaythrough specification html5 media examples these examples
add an event listener for the htmlmediaelement's canplaythrough event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: durationchange event - Web APIs
the durationchange event is fired when the duration attribute has been updated. ...
...ancelable no interface event target element default action none event handler property globaleventhandlers.ondurationchange specification html5 media examples these examples
add an event listener for the htmlmediaelement's durationchange event, then post a message when that event handler has reacted to the event firing. ...
... default action none event handler property globaleventhandlers.ondurationchange specification html5 media examples these examples
add an event listener for the htmlmediaelement's durationchange event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: ended event - Web APIs
ayback of the media reaches the end of the media. ...
... element default action none event handler property globaleventhandlers.onended specification html5 media this event is also defined in media capture and streams and web audio api examples these examples
add an event listener for the htmlmediaelement's ended event, then post a message when that event handler has reacted to the event firing. ...
... globaleventhandlers.onended specification html5 media this event is also defined in media capture and streams and web audio api examples these examples
add an event listener for the htmlmediaelement's ended event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: loadeddata event - Web APIs
en the first frame. bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onloadeddata specification html5 media note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. ...
... none event handler property globaleventhandlers.onloadeddata specification html5 media note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. examples these examples
add an event listener for the htmlmediaelement's loadeddata event, then post a message when that event handler has reacted to the event firing. ...
... specification html5 media note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. examples these examples
add an event listener for the htmlmediaelement's loadeddata event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: playing event - Web APIs
the playing event is fired when playback is ready to start after having been paused or delayed due to lack of data. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onplaying specification html5 media examples these examples
add an event listener for the htmlmediaelement's playing event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onplaying specification html5 media examples these examples
add an event listener for the htmlmediaelement's playing event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: ratechange event - Web APIs
the ratechange event is fired when the playback rate has changed. ...
... cancelable no interface event target element default action none event handler property globaleventhandlers.onratechange specification html5 media examples these examples
add an event listener for the htmlmediaelement's ratechange event, then post a message when that event handler has reacted to the event firing. ...
...ent default action none event handler property globaleventhandlers.onratechange specification html5 media examples these examples
add an event listener for the htmlmediaelement's ratechange event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: seeked event - Web APIs
en a seek operation completed, the current playback position has changed, and the boolean seeking attribute is changed to false. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onseeked specification html5 media examples these examples
add an event listener for the htmlmediaelement's seeked event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onseeked specification html5 media examples these examples
add an event listener for the htmlmediaelement's seeked event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: seeking event - Web APIs
hen a seek operation starts, meaning the boolean seeking attribute has changed to true and the media is seeking a new position. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onseeking specification html5 media examples these examples
add an event listener for the htmlmediaelement's seeking event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onseeking specification html5 media examples these examples
add an event listener for the htmlmediaelement's seeking event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: stalled event - Web APIs
the stalled event is fired when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onstalled specification html5 media examples these examples
add an event listener for the htmlmediaelement's stalled event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onstalled specification html5 media examples these examples
add an event listener for the htmlmediaelement's stalled event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: suspend event - Web APIs
the suspend event is fired when media data loading has been suspended. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onsuspend specification html5 media examples these examples
add an event listener for the htmlmediaelement's suspend event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onsuspend specification html5 media examples these examples
add an event listener for the htmlmediaelement's suspend event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: volumechange event - Web APIs
the volumechange event is fired when the volume has changed. ...
... cancelable no interface event target element default action none event handler property globaleventhandlers.onvolumechange specification html5 media examples these examples
add an event listener for the htmlmediaelement's volumechange event, then post a message when that event handler has reacted to the event firing. ...
... default action none event handler property globaleventhandlers.onvolumechange specification html5 media examples these examples
add an event listener for the htmlmediaelement's volumechange event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: waiting event - Web APIs
the waiting event is fired when playback has stopped because of a temporary lack of data. ...
... no cancelable no interface event target element default action none event handler property globaleventhandlers.onwaiting specification html5 media examples these examples
add an event listener for the htmlmediaelement's waiting event, then post a message when that event handler has reacted to the event firing. ...
... element default action none event handler property globaleventhandlers.onwaiting specification html5 media examples these examples
add an event listener for the htmlmediaelement's waiting event, then post a message when that event handler has reacted to the event firing. ...
HTMLObjectElement - Web APIs
the htmlobjectelement interface provides special properties and methods (beyond those on the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. ...
...nly returns a document representing the active document of the object element's nested browsing context, if any; otherwise null. htmlobjectelement.contentwindow read only returns a windowproxy representing the window proxy of the object element's nested browsing context, if any; otherwise null. htmlobjectelement.data returns a domstring that reflects the data html attribute, specifying the
address of a resource's data. htmlobjectelement.declare is a boolean that reflects the declare html attribute, indicating that this is a declaration, not an instantiation, of the object. htmlobjectelement.form read only retuns a htmlformelement representing the object element's form owner, or null if there isn't one. htmlobjectelement.height returns a domstring that reflects the height html ...
...finition of 'htmlobjectelement' in that specification. recommendation the w3c specification is a latest of a previous 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
added: checkvalidity() and setcustomvalidity(). document object model (dom) level 2 html specificationthe definition of 'htmlobjectelement' in that specification. obsolete the contentdocument property has been
added. document object model (dom) level 1 specif...
HTMLTableElement - Web APIs
the htmltableelement interface provides special properties and methods (beyond the regular htmlelement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an html document. ...
...s with respect to the surrounding context. the possible values are "left", "right", and "center". htmltableelement.bgcolor is a domstring containing the background color of the cells. it reflects the obsolete bgcolor attribute. htmltableelement.border is a domstring containing the width in pixels of the border of the table. it reflects the obsolete border attribute. htmltableelement.cellp
adding is a domstring containing the width in pixels of the horizontal and vertical sapce between cell content and cell borders. it reflects the obsolete cellp
adding attribute. htmltableelement.cellspacing is a domstring containing the width in pixels of the horizontal and vertical separation between cells. it reflects the obsolete cellspacing attribute. htmltableelement.frame is a domstri...
...ponding to the index given in parameter. if the index value is -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in the collection, a domexception with the value indexsizeerror is raised. specifications specification status comment html living standardthe definition of 'htmltableelement' in that specification. living standard
added the sortable property and the stopsorting() method. html5the definition of 'htmltableelement' in that specification. recommendation
added the createtbody() method. document object model (dom) level 2 html specificationthe definition of 'htmltableelement' in that specification. obsolete defined when caption, thead, tfoot, insertrow(), and deleterow() raise exception...
HTMLTextAreaElement - Web APIs
the htmltextareaelement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. ...
...domstring) sets a custom validity message for the element. if this message is not the empty string, then the element is suffering from a custom validity error, and does not validate. the two methods blur() and focus() are inherited from htmlelement from html5 on, but were defined on htmltextareaelement in dom level 2 html and earlier specifications. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. examples autogrowing textarea example make a textarea autogrow while typing: javascript function autogrow (ofield) { if (ofield.scrollheight > ofield.clientheight) { ofield.style.height = o...
...ification status comment html living standardthe definition of 'htmltextareaelement' in that specification. living standard html5the definition of 'htmltextareaelement' in that specification. recommendation the attributes tabindex and accesskey, as well as the methods blur() and focus() are now defined on htmlelement. the following attributes have been
added: autofocus, placeholder, dirname, wrap, maxlength, required, textlength, labels, selectionstart, selectionend, selectiondirection, validity, validationmessage, and willvalidate. the following methods have been
added: checkvalidity(), setcustomvalidity(), and setselectionrange(). document object model (dom) level 2 html specificationthe definition of 'htmltextareaelement' in that sp...
Headers() - Web APIs
nal an object containing any http headers that you want to pre-populate your headers object with. this can be a simple object literal with bytestring values; or an existing headers object. in the last case, the new headers object inherits its data from the existing headers object. ...
...r an existing headers object. in the last case, the new headers object inherits its data from the existing headers object. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could
add a header to this using headers.append: myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns 'image/jpeg' or you can
add the headers you want as the headers object is created. ...
...bject. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could
add a header to this using headers.append: myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns 'image/jpeg' or you can
add the headers you want as the headers object is created. ...
Headers.get() - Web APIs
s object. if the given name is not the name of an http header, this method throws a typeerror. the name is case-insensitive. returns a bytestring sequence representing the values of the retrieved header or null if this header is not set. ...
...the latest spec has removed getall(), and updated get() to return all values. specif...
...the latest spec has removed getall(), and updated get() to return all values. ...
Headers.getAll() - Web APIs
name the name of the http header whose values you want to retrieve from the headers object. if the given name is not the name of an http header, this method throws a typeerror. returns an array containing a bytestring sequence representing the values of the retrieved header. ...
... ...
... ...
IDBCursor - Web APIs
the idbcursor interface of the indexeddb api represents a cursor for traversing or iterating over multiple records in a database. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursor object representing a given cursor. ...
...n application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursor object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. properties note: idbcursorwithvalue is an idbcursor interface with an
additional value property. idbcursor.source read only returns the idbobjectstore or idbindex that the cursor is iterating. this function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. idbcursor.direction read only returns the direction of traversal of the cursor. see constants for possibl...
... ...
IDBDatabase: abort event - Web APIs
the abort event is fired on idbdatabase when a transaction is aborted and bubbles up to the connection object. bubbles yes cancelable no interface event event handler property onabort examples this example opens a database (creating the database if it does not exist), then opens a transaction,
adds a listener to the abort event, then aborts the transaction to trigger the event. // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.cr...
...objectstore.createindex('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) => { const db = dbopenrequest.result; db.
addeventlistener('abort', () => { console.log('transaction aborted'); }); // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); // abort the transaction transaction.abort(); }; the same example, but assigning the event handler to the onabort property: // open the database const dbopenrequest = window.indexeddb.
...nique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.onabort = () => { console.log('transaction aborted'); }; // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); // abort the transaction transaction.abort(); }; ...
IDBTransaction: abort event - Web APIs
the abort event is fired when an indexeddb transaction is aborted. bubbles yes cancelable no interface event event handler property onabort this can happen for any of the following reasons: bad requests, (for example, trying to
add the same key twice, or put the same index key when the key has a uniqueness constraint), an explicit abort() call an uncaught exception in the request's success/error handler, an i/o error (an actual failure to write to disk, for example disk detached, or other os/hardware failure) quota exceeded. examples this example opens a database (creating the database if it does not exist), then opens a transaction,
adds a listener to the abort event, then aborts the transaction to trigger the event. // open...
...{ 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 => { const db = dbopenrequest.result; // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); //
add a listener for `abort` transaction.
addeventlistener('abort', () => { console.log('transaction was aborted'); }); // abort the transaction transaction.abort(); }; the same example, but assigning the event handler to the onabort property: // open the database const dbopenrequest = window.indexeddb...
...{ 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 => { const db = dbopenrequest.result; // open a read/write db transaction, ready for
adding the data const transaction = db.transaction(['todolist'], 'readwrite'); //
add a listener for `abort` transaction.onabort = (event) => { console.log('transaction was aborted'); }; // abort the transaction transaction.abort(); }; ...
IDBTransaction.commit() - Web APIs
if it is called on a transaction that is not active, it throws an invalidstateerror domexception. note: this feature is available in web workers. syntax transaction.commit(); parameters none. return value void. exceptions exception description invalidstateerror the transaction state is not active. examples // open a read/write db transaction, ready for
adding the data var transaction = db.transaction(["mydb"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. duplicate items not allowed.</li>'; }; /...
...g the transaction transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. ...
... '<li>transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. ...
KeyboardEvent - Web APIs
y on the keyboard at a low level, providing no contextual meaning to that interaction. when you need to handle text input, use the input event instead. keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. ...
...t 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 prevents 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., 'a' is pressed), // event.ctrlkey may be true if ctrl key is pressed at the same time. alert(`combination of ctrlkey + ${keyname}`); } else { ...
...t.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., 'a' is pressed), // event.ctrlkey may be true if ctrl key is pressed at the same time. alert(`combination of ctrlkey + ${keyname}`); } else { alert(`key pressed ${keyname}`); } }, false); document.
addeventlistener('keyup', (event) => { const keyname = event.key; // as the user releases the ctrl key, the key is no longer active, // so event.ctrlkey is false. if (keyname === 'control') { alert('control key was released'); } }, false); </script> </head> <body> </body> </html> specifications specification status comment ui eventsthe definition of 'ke...
MediaQueryList - Web APIs
atus. properties the mediaquerylist interface inherits properties from its parent interface, eventtarget. matchesread only a boolean that returns true if the document currently matches the media query list, or false if not. mediaread only a domstring representing a serialized media query. methods the mediaquerylist interface inherits methods from its parent interface, eventtarget.
addlistener()
adds to the mediaquerylist a callback which is invoked whenever the media query status—whether or not the document matches the media queries in the list—changes. this method exists primarily for backward compatibility; if possible, you should instead use
addeventlistener() to watch for the change event. removelistener() removes the specified listener callback from the callbacks t...
...rom 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 previously 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 400px boundary ...
... you can find other examples on the individual property and method pages. specifications specification status comment css object model (cssom) view modulethe definition of 'mediaquerylist' in that specification. working draft ini...
MediaRecorder: dataavailable event - Web APIs
dataavailable event is fired when the mediarecorder delivers media data to your application for its use. bubbles no cancelable no interface blobevent event handler property ondataavailable for details of the all the possible reasons this event may raise, see the documentation for the event handler property: ondataavailable. ...
...n for its use. bubbles no cancelable no interface blobevent event handler property ondataavailable for details of the all the possible reasons this event may raise, see the documentation for the event handler property: ondataavailable. examples using
addeventlistener to listen for dataavailable events: ... ...
... the same, but using the ondataavailable event handler property: ... ...
MediaSource - Web APIs
the mediasource interface of the media source extensions api represents a source of media data for an htmlmediaelement object. a mediasource object can be attached to a htmlmediaelement to be played in the user agent. ...
...ource.duration gets and sets the duration of the current media being presented. event handlers mediasource.onsourceclose the event handler for the sourceclose event. mediasource.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 previously 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. ...
... = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.
addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.
addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.
addeventlistener('updateend', function (_) { mediasource.endofstream...
MediaStreamEvent - Web APIs
the mediastreamevent interface represents events that occurs in relation to a mediastream. two events of this type can be thrown:
addstream and removestream. properties a mediastreamevent being an event, this event also implements these properties. mediastreamevent.stream read only contains the mediastream containing the stream associated with the event. constructors mediastreamevent() returns a new mediastreamevent. it takes two parameters, the first being a domstring representing the type of the event; the second a dictionary containing the mediastream it refers to. ...
...iated with the event. constructors mediastreamevent() returns a new mediastreamevent. ...
...event. ...
MediaStreamTrack - Web APIs
see capabilities, constraints, and settings to learn how to correctly work with constrainable properties. not doing so correctly will result in your code being unreliable. ...
...nstraints last set using applyconstraints(). mediastreamtrack.getsettings() returns a mediatracksettings object containing the current values of each of the mediastreamtrack's constrainable properties. mediastreamtrack.stop() stops playing the source associated to the track, both the source and the track are deassociated. the track state is set to ended. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: ended sent when playback of the track ends (when the value readystate changes to ended). also available using the onended event handler property. mute sent to the mediastreamtrack when the value of the muted property is changed to true, indicating that the track is unable to provide data tempora...
...also available through the onoverconstrained event handler property. unmute sent to the track when data becomes available again, ending the muted state. also available through the onunmute event handler property. specifications specification status comment identity for webrtcthe definition of 'isolated tracks' in that specification. candidate recommendation
additional properties for isolated track support media capture and streamsthe definition of 'mediastreamtrack' in that specification. candidate recommendation initial definition ...
Using the MediaStream Recording API - Web APIs
hink "wow, why didn't we have this before? why was css2 layout so awkward?" it allows you do a calculation to determine the computed value of a css unit, mixing different units in the process. for example, in web dictaphone we have three main ui areas, stacked vertically. we wanted to give the first two (the header and the controls) fixed heights: header { height: 70px; } .main-controls { p
adding-bottom: 0.7rem; height: 170px; } however, we wanted to make the third area (which contains the recorded samples you can play back) take up whatever space is left, regardless of the device height. flexbox could be the answer here, but it's a bit overkill for such a simple layout. instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus ...
...m; height: 170px; } however, we wanted to make the third area (which contains the recorded samples you can play back) take up whatever space is left, regardless of the device height. flexbox could be the answer here, but it's a bit overkill for such a simple layout. instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and p
adding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; } note: calc() has good support across modern browsers too, even going back to internet explorer 9. checkbox hack for showing/hiding this is fairly well documented already, but we thought we'd give a mention to the...
...ks we have received: mediarecorder.onstop = function(e) { console.log("recorder stopped"); const clipname = prompt('enter a name for your sound clip'); const clipcontainer = document.createelement('article'); const cliplabel = document.createelement('p'); const audio = document.createelement('audio'); const deletebutton = document.createelement('button'); clipcontainer.classlist.
add('clip'); audio.setattribute('controls', ''); deletebutton.innerhtml = "delete"; cliplabel.innerhtml = clipname; clipcontainer.appendchild(audio); clipcontainer.appendchild(cliplabel); clipcontainer.appendchild(deletebutton); soundclips.appendchild(clipcontainer); const blob = new blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); chunks = []; const audiourl = window.url.cr...
Transcoding assets for Media Source Extensions - Web APIs
ownload. [0] (c) copyright 2008, blender foundation / www.bigbuckbunny.org / https://peach.blender.org/about/ tools required when working with mse, the following tools are a must have: ffmpeg — a command-line utility for transcoding your media into the required formats. you can download a version for your system at the download ffmpeg page. extract the executable from the archive file and
add it's location to your path statement. osx users can also use homebrew to install ffmpeg. bento4 — a set of command-line utilities for getting asset metadata and creating content for dash. to install, you'll need to build/compile the application yourself from the provided project files/source files, depending on your os and preferences. see the building instructions for more details. the prebui...
...f the bin directory in the same place as ffmpeg. python2 — bento4 uses it. get these installed successfully before moving to the next step. sample media should be placed in the bento4 utils directory and worked here. note: the prebuilt ffmpeg does not include libfdk_aac due to licensing reasons. bento4 uses this by default, so you need to compile ffmpeg if necessary. if you don't need it,
add --audio-codec=aac to the mp4-dash-encode.py command line. container and codec support as specified in section 1.1 of the mse spec: goals, mse is designed not to require support for any particular media format or codec. while this is true on paper, browser support varies for specific container/codec combinations. to check if the browser supports a particular container, you can pass a string o...
...et to be an iso bmf format mp4. without proper fragmentation, any given mp4 file is not guaranteed to work with mse. this means that metadata within the container is spread out and not lumped together. to check whether an mp4 file is a proper mp4 stream, you can again use the mp4info utility to list the atoms of an mp4. note: the fragmented version is slightly larger than the original, due to
additional metadata spread throughout the file. this is usually a file size increase of 1 percent or less. fragmenting if you have an asset that is not already an mp4, ffmpeg can handle emitting a properly fragmented mp4 during the transcode process, with the -movflags frag_keyframe+empty_moov command line flag: $ ffmpeg -i trailer_1080p.mov -c:v copy -c:a copy -movflags frag_keyframe+empty_moov ...
MessageEvent - Web APIs
nd broadcastchannel.onmessage). webrtc data channels (see rtcdatachannel.onmessage). the action triggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). note: this feature is available in web workers. ...
...ess it, even if their pages are running inside different windows. the following code snippet shows creation of a sharedworker object using the sharedworker() constructor. both scripts contain this: var myworker = new sharedworker('worker.js'); both scripts then access the worker through a messageport object created using the sharedworker.port property. ...
...e the worker we use the sharedworkerglobalscope.onconnect handler to connect to the same port discussed above. the ports associated with that worker are accessible in the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.
addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using
addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'messageevent' in that specification. ...
MessagePort: message event - Web APIs
he ports to a different browsing context, such as another <iframe>, using code like this: const channel = new messagechannel(); const myport = channel.port1; const targetframe = window.top.frames[1]; const targetorigin = 'https://example.org'; const messagecontrol = document.queryselector('#message'); const channelmessagebutton = document.queryselector('#channel-message'); channelmessagebutton.
addeventlistener('click', () => { myport.postmessage(messagecontrol.value); }) targetframe.postmessage('init', targetorigin, [channel.port2]); the target can receive the port and start listening for messages on it using code like this: window.
addeventlistener('message', (event) => { const myport = event.ports[0]; myport.
addeventlistener('message', (event) => { received.textcon...
...ning for messages on it using code like this: window.
addeventlistener('message', (event) => { const myport = event.ports[0]; myport.
addeventlistener('message', (event) => { received.textcontent = event.data; }); myport.start(); }); note that the listener must call messageport.start() before any messages will be delivered to this port. ...
...myport = event.ports[0]; myport.
addeventlistener('message', (event) => { received.textcontent = event.data; }); myport.start(); }); note that the listener must call messageport.start() before any messages will be delivered to this port. ...
MessagePort.start() - Web APIs
the start() method of the messageport interface starts the sending of messages queued on the port. this method is only needed when using eventtarget.
addeventlistener; it is implied when using messagechannel.onmessage. note: this feature is available in web workers. syntax port.start() returns void. parameters none. ...
...eature is available in web workers. syntax port.start() returns void. parameters none. ...
... living standard ...
Microdata DOM API - Web APIs
be used to obtain a list of all the top-level microdata items of a particular type given in the document: var cats = document.getitems("http://example.com/feline"); once an element representing an item has been obtained, its properties can be extracted using the properties idl attribute. this attribute returns an htmlpropertiescollection, which can be enumerated to go through each element that
adds one or more properties to the item. it can also be indexed by name, which will return an object with a list of the elements that
add properties with that name. each element that
adds a property also has an itemvalue idl attribute that returns its value. code example this sample gets the first item of type "http://example.net/user" and then pops up an alert using the "name" property from that ...
... interface description language interface htmlpropertiescollection : htmlcollection { // inherits length and item() getter propertynodelist? nameditem(domstring name); // shadows inherited nameditem() readonly attribute domstring[] names; }; typedef sequence<any> propertyvaluearray; interface propertynodelist : nodelist { pr...
...ertynodelist : nodelist { propertyvaluearray getvalues(); }; collection . length returns the number of elements in the collection. element = collection . item(index) collection[index] returns the element with index index from the collection. the items are sorted in tree order. propertynodelist = collection . nameditem(name) returns a propertynodelist object containing any elements that
add a property named name. collection[name] returns a propertynodelist object containing any elements that
add a property named name. the name index has to be one of the values listed in the names list. collection . names returns an array with the property names of the elements in the collection. propertynodelist . getvalues() returns an array of the various values that the relevant elements...
MouseEvent.pageX - Web APIs
such that 200 pixels of the left side of the document are scrolled out of view, and the mouse is clicked 100 pixels inward from the left edge of the view, the value returned by pagex will be 300. originally, this property was defined as a long integer. the cssom view module redefined it as a double float. see the browser compatibility section for details. see page in coordinate systems for some
additional information about coordinates specified in this fashion. syntax var pagex = mouseevent.pagex; value a floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined i...
...ve 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 window. javascript var box = document.queryselector(".box"); var pagex = document.getelementbyid("x"); var pagey = document.getelementbyid("y"); function updatedisplay(event) { pagex.innertext = event.pagex; pagey.innertext = event.pagey; } box.
addeventlistener("mousemove", updatedisplay, false); box.
addeventlistener("mouseenter", updatedisplay, false); box.
addeventlistener("mouseleave", updatedisplay, false); the javascript code uses
addeventlistener() to register the function updatedisplay() as the event handler for the mousemove, mouseenter, and mouseleave events. updatedisplay() simply replaces the contents of the <span> elements mean...
... ...
MouseEvent.region - Web APIs
the mouseevent.region read-only property returns the id of the canvas hit region affected by the event. if no hit region is affected, null is returned. syntax var hitregion = instanceofmouseevent.region return value a domstring representing the id of the hit region. example example of using the event.region combined with canvasrenderingcontext2d.
addhitregion() method. ...
...tanceofmouseevent.region return value a domstring representing the id of the hit region. example example of using the event.region combined with canvasrenderingcontext2d.
addhitregion() method. ...
...e a domstring representing the id of the hit region. example example of using the event.region combined with canvasrenderingcontext2d.
addhitregion() method. ...
MutationObserver.MutationObserver() - Web APIs
utationrecord objects, describing each change that occurred; and the mutationobserver which invoked the callback. see the example below for more details. return value a new mutationobserver object, configured to call the specified callback when dom mutations occur. ...
... new mutationobserver configured to watch a node and all of its children for
additions and removals of elements to the tree, as well as any changes to attributes on any of the elements in the tree. the callback function function callback(mutationlist, observer) { mutationlist.foreach( (mutation) => { switch(mutation.type) { case 'childlist': /* one or more children have been
added to and/or removed from the tree. (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 previous value is in mutation.oldvalue. */ break; } }); } the callb...
...s record. in it, we specify values of true for both childlist and attributes, so we get the information we want. then the observer is instantiated, specifying the callback() function. we begin observing the dom nodes of interest by calling observe(), specifying the target node and the options object. from this point until disconnect() is called, callback() will be called each time an element is
added to or removed from the dom tree rooted at targetnode, or any of those elements' attributes are changed. specifications specification status comment domthe definition of 'mutationobserver()' in that specification. living standard ...
NamedNodeMap - Web APIs
h were originally a specialized class of node, and still are in some implementations. properties this interface doesn't inherit any property. namednodemap.length read only returns the amount of objects in the map. methods this interface doesn't inherit any method. namednodemap.getnameditem() returns a attr, corresponding to the given name. ...
... namednodemap.removenameditemns() removes the attr identified by the given namespace and related local name. specifications specification status comment domthe definition of 'namednodemap' in that specification. ...
...cation. living standard deals with attr instead of node document object model (dom) level 3 core specificationthe definition of 'namednodemap' in that specification. obsolete no change from document object model (dom) level 2 core specification document object model (dom) level 2 core specificationthe definition of 'namednodemap' in that specification. obsolete
added getnameditemns(), setnameditemns() and removenameditemns() document object model (dom) level 1 specificationthe definition of 'namednodemap' in that specification. obsolete initial definition ...
Using Navigation Timing - Web APIs
e advantage of being able to provide timing information as perceived by the user rather than data that has no correlation to what the user experiences. collecting timing information using the api is as simple as obtaining the performance object using window.performance and looking up what you need within the object returned. ...
...oad operation occurred. in particular, you need to know: was this a load or a reload? was this a navigation or a move forward or backward through history? how many (if any) redirects were required in order to complete the navigation? this information is provided by the performance.navigation property, which returns a performancenavigation object that includes the needed information. ...
...reload? ...
Navigator.onLine - Web APIs
e when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. you could be getting false positives, such as in cases where the computer is running a virtualization software that has virtual ethernet adapters that are always "connected." therefore, if you really want to determine the online status of the browser, you should develop
additional means for checking. to learn more, see the html5 rocks article, working off the grid. in firefox and internet explorer, switching the browser to offline mode sends a false value. until firefox 41, all other conditions return a true value; testing actual behavior on nightly 68 on windows shows that it only looks for lan connection like chrome and safari giving false positives. you can se...
...value online is a boolean true or false. example view a live example. to check if you are online, query window.navigator.online, as in the following example: if (navigator.online) { console.log('online'); } else { console.log('offline'); } if the browser doesn't support navigator.online the above example will always come out as false/undefined. ...
...navigator.online, as in the following example: if (navigator.online) { console.log('online'); } else { console.log('offline'); } if the browser doesn't support navigator.online the above example will always come out as false/undefined. to see changes in the network state, use
addeventlistener to listen for the events on window.online and window.offline, as in the following example: window.
addeventlistener('offline', function(e) { console.log('offline'); }); window.
addeventlistener('online', function(e) { console.log('online'); }); specifications specification status comment html living standardthe definition of 'navigator.online' in that specification. living standard initial definition ...
PaymentRequest: paymentmethodchange event - Web APIs
le, if the user switches from one credit card to another on their apple pay account, a paymentmethodchange event is fired to let you know about the change. bubbles no cancelable no interface paymentmethodchangeevent event handler property onpaymentmethodchange examples let's take a look at an example. this code creates a new paymentrequest,
adds a handler for the paymentmethodchange event by calling the request's
addeventlistener(), then calls show() to present the payment interface to the user. the code assumes the existence of a method detailsforshipping(), which returns a paymentdetailsupdate object containing the shipping options for the ground shipping method, in the form found in the paymentshippingoption dictionary. by doing so,...
...h returns a paymentdetailsupdate object containing the shipping options for the ground shipping method, in the form found in the paymentshippingoption dictionary. by doing so, the payment form defaults to the ground shipping method. ...
...t indicates that the user is trying to use apple pay, we pass the methoddetails into a function called calculateservicefee(), which we might create to take the information about the transaction, such as the underlying credit card being used to service the apple pay request, and compute and return an paymentdetailsupdate object that specifies changes to be applied to the paymentrequest in order to
add any service fees that the payment method might require. before the event handler returns, it calls the event's paymentmethodchangeevent.updatewith.updatewith() method to integrate the changes into the request. related events merchantvalidation, shipping
addresschange, shippingoptionchange, and payerdetailchange specifications specification status comment payment req...
PaymentRequest - Web APIs
accept payments from the end user on behalf of the operator of the site or the publisher of the app. constructor paymentrequest() secure context creates a new paymentrequest object. properties paymentrequest.id read only secure context an unique identifier for a particular paymentrequest, which can be set via details.id. when none is set, it defaults to a uuid. ...
...of the app. constructor paymentrequest() secure context creates a new paymentrequest object. properties paymentrequest.id read only secure context an unique identifier for a particular paymentrequest, which can be set via details.id. when none is set, it defaults to a uuid. paymentrequest.shipping
address read only secure context if requested via payment options, returns the shipping
address chosen by the user for the purposes of calculating shipping. this property is only populated if the constructor is called with the requestshipping flag set to true.
additionally, in some browsers, the parts of the
address will be redacted for privacy until the user indicates they are ready to complete the transaction (i.e., they hit "pay"). paymentrequest.shippingoption read only secure con...
...the merchant or vendor requesting payment is legitimate. also available using the onmerchantvalidation event handler property. paymentmethodchange secure context with some payment handlers (e.g., apple pay), dispatched whenever the user changes payment instrument, like switching from a credit card to a debit card. also available using the onpaymentmethodchange event handler property. shipping
addresschange secure context dispatched whenever the user changes their shipping
address. also available using the onshipping
addresschange event handler property. shippingoptionchange secure context dispatched whenever the user changes a shipping option. also available using the onshippingoptionchange event handler property. specifications specification status comment ...
PaymentResponse - Web APIs
or example, if the basic card payment method is used, this object must conform to the structure defined in the basiccardresponse dictionary. paymentresponse.methodname read only secure context returns the payment method identifier for the payment method that the user selected, for example, visa, mastercard, paypal, etc.. paymentresponse.payeremail read only secure context returns the email
address supplied by the user. this option is only present when the requestpayeremail option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.payername read only secure context returns the name supplied by the user. this option is only present when the requestpayername option is set to true in the options parameter of the paymentrequest() constructor. pa...
...lied by the user. this option is only present when the requestpayerphone option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.requestid read only secure context returns the identifier of the paymentrequest that produced the current response. this is the same value supplied in the paymentrequest() constructor by details.id. paymentresponse.shipping
address read only secure context returns the shipping
address supplied by the user. this option is only present when the requestshipping option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.shippingoption read only secure context returns the id attribute of the shipping option selected by the user. this option is only present when the requestshippin...
...ignal to the user exactly what is wrong with the payment response so they can try to correct any issues. paymentresponse.complete() secure context notifies the user agent that the user interaction is over. this causes any remaining user interface to be closed. this method should 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 o...
Payment processing concepts - Web APIs
tified by payment method identifiers, which are strings uniquely identifying the payment handler. these may be either one of the standardized payment handler identifiers, or a url used by the payment processing service to both identify itself and to handle payments. standardized payment method identifiers there is currently only one registered standardized payment method identifier (more may be
added in the future): basic-card payments are handled by the basic card payment specification. see basiccardrequest for details. should have an article about this specification and how to use it. url-based payment method identifiers these may vary substantially depending on the specifics of the service, and a given processing service may have multiple urls used, depending on the version of the...
...hnology, and so forth. https://apple.com/apple-pay payments are handled using the apple pay service. currently, apple pay is only supported by safari. https://google.com/pay payments are processed by google pay. this is currently supported only by chrome and chromium-based browsers. functions of a payment handler a user agent may provide built-in support for certain types of payments. in
addition, the payment handler api can be used to establish support for
additional payment method providers, in browsers that support it. in either case, the payment handler is responsible for: making sure a payment can be made. the conditions that make payment possible vary depending on the payment method and the user's payment request; for example, if the user chooses to pay using a credit card t...
...the only thing that the web site or app is responsible for is fetching the merchant's validation key and passing it into the event's complete() method. paymentrequest.onmerchantvalidation = function(event) { event.complete(fetchvalidationdata(event.validationurl)); } in this example, fetchvalidationdata() is a function which loads the payment handler specific identifying information from the
address given by validationurl. note this function must go through the merchant server, because a client typically does not access the validation url itself. by then delivering this data (or a promise which resolves to the loaded data) to the payment handler by passing it into complete(), the payment handler can use the retrieved data and whatever algorithm and other data to support in order to veri...
PerformanceEntry - Web APIs
operties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... ...
... specification status comment resource timing level 3 editor's draft resource timing level 2 working draft resource timing level 1 candidate recommendation
adds the performanceresourcetiming interface and the resource value for entrytype. navigation timing level 2 working draft navigation timing recommendation
adds the performancenavigationtiming interface and the navigation value for entrytype. ...
... candidate recommendation
adds the performanceresourcetiming interface and the resource value for entrytype. navigation timing level 2 working draft navigation timing recommendation
adds the performancenavigationtiming interface and the navigation value for entrytype. user timing level 2 working draft user timing recommendation
adds the performancemark and performancemeasure interfaces as well as the mark and measure values for entrytype. frame timing draft
adds the performanceframetiming interface and the frame value for entrytype. performance timeline level 2the definition of 'performanceentry' in that specification. candidate recommendation
added tojson() serializer method. performa...
Performance Timeline - Web APIs
rmance timeline api defines extensions to the performance interface to support client-side latency measurements within applications. the extensions provide interfaces to retrieve performance entry metrics based on specific filter criteria. the standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are
added to the browser's performance timeline. this document provides an overview of the standard's interfaces. for more details about the interfaces, see the reference pages and using performance timeline. performance extensions the performance timeline api extends the performance interface with three methods that provide different mechanisms to get a set of performance records (metrics), depending...
... optionally the performance type. getentriesbytype() returns the recorded performance entries based on the specified performance type. performanceentry interface the performanceentry interface encapsulates a single performance entry — that is, a single data point or metric in the performance timeline. this interface has the following four properties, and these properties are extended (with
additional constraints) by other interfaces (such as performancemark): name the name of the performance entry when the metric was created. entrytype the type of performance metric (for example, "mark"). starttime a high resolution timestamp representing the starting time for the performance entry. duration a high resolution timestamp representing the time value of the duration of the perfor...
...ethods; the performance observer entry list versions are used to retrieve observed performance entries within the observer callback. besides the performanceobserver's interface's observe() method (which is used to register the entry types to observe), the performanceobserver interface also has a disconnect() method that stops an observer from receiving further events. performance observers were
added to the level 2 version of the standard and were not widely implemented. implementation status a summary of the interfaces' implementation status is provided below, including a link to more detailed information. performance interface extensions: as shown in the performance interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have ...
PushEvent - Web APIs
the pushevent interface of the push api represents a push message that has been received. this event is sent to the global scope of a serviceworker. it contains the information sent from an application server to a pushsubscription. constructor pushevent.pushevent() creates a new pushevent object. properties inherits properties from its parent, extendableevent. ...
... properties inherits properties from its parent, extendableevent.
additional properties: pushevent.data read only returns a reference to a pushmessagedata object containing data sent to the pushsubscription. methods inherits methods from its parent, extendableevent. examples the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
... working draft initial definition. browser compatibility the compatibility table on this...
RTCDtlsTransport - Web APIs
terface provides access to information about the datagram transport layer security (dtls) transport over which a rtcpeerconnection's rtp and rtcp packets are sent and received by its rtcrtpsender and rtcrtpreceiver objects. a dtls transport is also used to provide information about sctp packets transmitted and received by an connection's data channels. ...
...and received by its rtcrtpsender and rtcrtpreceiver objects. a dtls transport is also used to provide information about sctp packets transmitted and received by an connection's data channels. features of the dtls transport include the
addition of security to the underlying transport; the rtcdtlstransport interface can be used to obtain information about the underlying transport and the security
added to it by the dtls layer. ...
...ackets transmitted and received by an connection's data channels. features of the dtls transport include the
addition of security to the underlying transport; the rtcdtlstransport interface can be used to obtain information about the underlying transport and the security
added to it by the dtls layer. ...
RTCError - Web APIs
ce describes an error which has occurred while handling webrtc operations. it's based upon the standard domexception interface that describes general dom errors. constructor rtcerror() creates and returns a new rtcerror object initialized with the properties of the provided rtcerrorinit dictionary and, optionally, a string to use as the value of the error's message property. properties in
addition to the properties defined by the parent interface, domexception, rtcerror includes the following properties: 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 s...
...r isn't an sdp syntax error. sentalert read only if errordetail is dtls-failure, this property is an unsigned long integer indicating the fatal dtls error that was sent out by this device. if null, no dtls error was transmitted. all rtcerror objects have their name set to operationerror. examples in this example, a handler is established for an rtcdatachannel's error event. ...
...rror—, a message string is constructed to present the error message and the line number within the sdp at which the error occurred. this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use. any other error is treated as terminal, causing a terminatemyconnection() function to be called. the above 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 'rtcerror' in that specifi...
RTCErrorEvent.error - Web APIs
the read-only rtcerrorevent property error contains an rtcerror object describing the details of the error which the event is announcing. syntax let errorinfo = rtcerrorevent.error; value an rtcerror object whose properties provide details about the error which has occurred in the context of a webrtc operation. 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. sctpcausecode read o...
...or isn't an sdp syntax error. sentalert read only if errordetail is dtls-failure, this property is an unsigned long integer indicating the fatal dtls error that was sent out by this device. if null, no dtls error was transmitted. all rtcerror objects have their name set to operationerror. examples in this example, a handler is established for an rtcdatachannel's error event. ...
...rror—, a message string is constructed to present the error message and the line number within the sdp at which the error occurred. this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use. any other error is treated as terminal, causing a terminatemyconnection() function to be called. the above 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 'rtcerrorevent.error' in t...
RTCIceCandidate.port - Web APIs
the rtcicecandidate interface's read-only port property contains the port number on the device at the
address given by ip at which the candidate's peer can be reached. as is the case with most of rtcicecandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from a-line string passed into the constructor upon using new rtcicecandidate(). syntax var port = rtcicecandidate.port; value a 16-bit number indicating the port number on the device at the
address indicated by ip at which the candidate's peer can be reached. port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed ...
...this applies only if the candidate implements port. ...
...wing an operationerror exception. this applies only if the candidate implements port. usage notes 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 port number is found in the sixth field, which is "44323". in this case, the value of port will be 44323. example this code snippet fetches the ip
address and port number of the candidate, storing them into an object for future use. var candidateloc = {
address: candidate.ip, port: candidate.port } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.port' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.protocol - Web APIs
the protocol property's value is set when the rtcicecandidate() constructor is used. ...
...omatically extracted from the candidate a-line, if it's formatted properly. syntax var protocol = rtcicecandidate.protocol; value a domstring which indicates what network protocol the candidate uses, udp or tcp. these values are defined by the enumerated type rtciceprotocol: tcp the candidate, if selected, would use tcp as the transport protocol for its data. ...
... usage notes here's an example candidate a-line from an ice transaction: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the third field, "udp", is the protocol type, indicating that the candidate would use the udp transport protocol. ...
RTCIceCandidateStats.candidateType - Web APIs
the rtcicecandidatestats interface's candidatetype property is a string which indicates the type of ice candidate the object represents. syntax candidatetype = rtcicecandidatestats.candidatetype; value a domstring whose value is one of the strings found in the rtcicecandidatetype enumerated type:host the candidate is a host candidate, whose ip
address as specified in the rtcicecandidate.ip property is in fact the true
address of the remote peer. srflx the candidate is a server reflexive candidate; the ip indicates an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the ip is an intermediary
address assigned by the stun server to represent the candidate's peer anonymously. relay the c...
... specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.candidatetype' in that specification. ...
... specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.candidatetype' in that specification. ...
RTCIceTransport: gatheringstatechange event - Web APIs
overall state of the connection including every rtcicetransport used by every rtcrtpsender and every rtcrtpreceiver on the entire connection. in contrast, gatheringstatechange represents changes to the candidate gathering state for a single transport. examples this example creates a handler for gatheringstatechange events on each rtcrtpsender associated with a given rtcpeerconnection. ...
...ng every rtcicetransport used by every rtcrtpsender and every rtcrtpreceiver on the entire connection. in contrast, gatheringstatechange represents changes to the candidate gathering state for a single transport. examples this example creates a handler for gatheringstatechange events on each rtcrtpsender associated with a given rtcpeerconnection. ...
...atheringstatechange represents changes to the candidate gathering state for a single transport. examples this example creates a handler for gatheringstatechange events on each rtcrtpsender associated with a given rtcpeerconnection. ...
RTCIceTransportState - Web APIs
tate 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 candidates will be sent. in
addition, all candidate pairs have been considered and a pair has been selected for use. if consent checks fail on all successful candidate pairs, the transport state will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has o...
...te will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action. see the disconnected state for
additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking pairs of candidates, without successfully finding a pair that is both valid and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" ...
...disconnected" state, the state transitions to "checking" the disconnected state "disconnected" is a transient state that occurs when the connection between the two peers fails in a manner that the webrtc infrastructure can automatically correct once the connection is available again. it is not a failure state. instead, you can think of "disconnected" as being similar to "checking" but with the
added information that the connection had been working but at the moment is not. every user agent and platform may have its own scenarios that can trigger the "disconnected" state. possible causes include: the network interface being used by the connection has gone offline. stun requests being sent to the remote device have gone unanswered repeatedly. the "disconnected" state can also occur wh...
RTCPeerConnection: connectionstatechange event - Web APIs
the new connection state can be found in connectionstate, and is one of the strings in the rtcpeerconnectionstate enumerated type. bubbles no cancelable no interface event event handler onconnectionstatechange examples for an rtcpeerconnection, pc, this example sets up a handler for connectionstatechange messages to handle changes to the connectivity of the webrtc session. ...
...*/ } }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'connectionstatechange' in that specification. candidate recommendation initial specification. ...
...*/ } }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'connectionstatechange' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: negotiationneeded event - Web APIs
both during the initial setup of the connection as well as any time a change to the communication environment requires reconfiguring the connection. ...
...t dispatched to the rtcpeerconnection when media is first
added to the connection. this starts the process of ice negotiation by instructing your code to begin exchanging ice candidates through the signaling server. see signaling transaction flow in signaling and video calling for a description of the signaling process that begins with a negotiationneeded event. examples in this example, we use
addeventlistener() to create an event handler for negotiationneeded. its role is to create an sdp offer and send it through the signaling channel to the remote peer. ...
... ice candidates through the signaling server. see signaling transaction flow in signaling and video calling for a description of the signaling process that begins with a negotiationneeded event. examples in this example, we use
addeventlistener() to create an event handler for negotiationneeded. its role is to create an sdp offer and send it through the signaling channel to the remote peer. ...
RTCPeerConnection.onsignalingstatechange - Web APIs
nalingstatechange = errorhandler; value set this to a function which you provide that receives an event object as input; this contains the signalingstatechange event. this event object doesn't provide details about what changed, but you can examine the signalingstate property to determine what the new state is. ...
... set this to a function which you provide that receives an event object as input; this contains the signalingstatechange event. this event object doesn't provide details about what changed, but you can examine the signalingstate property to determine what the new state is. ...
...nt object doesn't provide details about what changed, but you can examine the signalingstate property to determine what the new state is. you may also, as always, set up a handler for the signalingstatechange event using
addeventlistener(): myrtcpeerconnection.
addeventlistener("signalingstatechange", mysignalingstatechangehandler); or, using an anonymous (inline) handler: myrtcpeerconnection.
addeventlistener("signalingstatechange", event => { /* handle the event here */ }); example this snippet shows a handler for signalingstatechange that looks for the "have-local-pranswer" signaling state—indicating that a remote offer has been received and a local description of type "pranswer" has been applied in response. pc.onsignalingstatechange = function(event) { if (pc.signalingstate =...
RTCRtpSender.setStreams() - Web APIs
ers mediastream or [mediastream...] optional an mediastream object—or an array of multiple mediastream objects—identifying the streams to which the rtcrtpsender's track belongs. if this parameter isn't specified, no new streams will be associated with the track. return value none. exceptions invalidstateerror the sender's connection is closed. description setstreams() is purely
additive. it doesn't remove the track from any streams; it simply
adds it to new ones. if you specify streams to which the track already belongs, that stream is unaffected. once the track has been
added to all of the streams, renegotiation of the connection will be triggered by the negotiationneeded event being dispatched to the rtcpeerconnection to which the sender belongs. example this example a...
...w ones. if you specify streams to which the track already belongs, that stream is unaffected. once the track has been
added to all of the streams, renegotiation of the connection will be triggered by the negotiationneeded event being dispatched to the rtcpeerconnection to which the sender belongs. example this example
adds all of an rtcpeerconnection's tracks to the specified stream. function
addtrackstostream(stream) { let senders = pc.getsenders(); senders.foreach((sender) => { if (sender.track && (sender.transport.state === connected)) { sender.setstreams(stream); } }); } after calling the rtcpeerconnection method getsenders() to get the list of the connection's senders, the
addtrackstostream() function iterates over the list. for each sender, if the sender's tra...
...ender) => { if (sender.track && (sender.transport.state === connected)) { sender.setstreams(stream); } }); } after calling the rtcpeerconnection method getsenders() to get the list of the connection's senders, the
addtrackstostream() function iterates over the list. for each sender, if the sender's track is non-null and its transport's state is connected, we call setstreams() to
add the track to the stream specified. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender.setstreams()' in that specification. candidate recommendation ...
Range() - Web APIs
the range() constructor returns a newly created range object whose start and end is the global document object. syntax range = new range() example in this example we create a new range with the range() constructor, and set its beginning and end positions using the range.setstartbefore() and range.setendafter() methods. we then select the range using window.getselection() and selection.
addrange(). html <p>first paragraph.</p> <p>second paragraph.</p> <p>third paragraph.</p> <p>fourth paragraph.</p> javascript const paragraphs = document.queryselectorall('p'); // create new range const range = new range(); // start range at second paragraph range.setstartbefore(paragraphs[1]); // end range at third paragraph range.setendafter(paragraphs[2]); // get window selection const sel...
... living standard initial definition. ...
... living standard initial definition. ...
Range.commonAncestorContainer - Web APIs
> </ul> </li> </ul> </li> <li>woodwinds <ul> <li>clarinet</li> <li>oboe</li> </ul> </li> </ul> css the .highlight class created below uses a set of css @keyframes to animate a fading outline. ...
... </li> <li>woodwinds <ul> <li>clarinet</li> <li>oboe</li> </ul> </li> </ul> css the .highlight class created below uses a set of css @keyframes to animate a fading outline. ...
... living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.commonancestorcontainer' in that specification. obsolete initial specificati...
SVGAnimationElement - Web APIs
the svganimationelement interface is the base interface for all of the animation element interfaces: svganimateelement, svgsetelement, svganimatecolorelement, svganimatemotionelement and svganimatetransformelement. ...
...time container. svganimationelement.getsimpleduration() returns a float representing the number of seconds for the simple duration for this animation. if the simple duration is undefined (e.g., the end time is indefinite), then a domexception with code not_supported_err is raised. svganimationelement.beginelement() creates a begin instance time for the current time. the new instance time is
added to the begin instance times list. the behavior of this method is equivalent to beginelementat(0). svganimationelement.beginelementat() creates a begin instance time for the current time plus the specified offset. the new instance time is
added to the begin instance times list. svganimationelement.endelement() creates an end instance time for the current time. the new instance time...
...o the begin instance times list. the behavior of this method is equivalent to beginelementat(0). svganimationelement.beginelementat() creates a begin instance time for the current time plus the specified offset. the new instance time is
added to the begin instance times list. svganimationelement.endelement() creates an end instance time for the current time. the new instance time is
added to the end instance times list. the behavior of this method is equivalent to endelementat(0). svganimationelement.endelementat() creates a end instance time for the current time plus the specified offset. the new instance time is
added to the end instance times list. events listen to these events using
addeventlistener() or by assigning an event listener to the on... handler property o...
SVGElement - Web APIs
all of the svg dom interfaces that correspond directly to elements in the svg language derive from the svgelement interface. ...
...d only the svgelement, which established the current viewport. often, the nearest ancestor <svg> element. null if the given element is the outermost <svg> element. methods this interface has no methods, but inherits methods from: documentandelementeventhandlers, element, elementcssinlinestyle, globaleventhandlers, htmlorforeignelement, svgelementinstance events listen to these events using
addeventlistener() or by assigning an event listener to the equivalent on... handler property defined on globaleventhandlers or windoweventhandlers. abort fired when page loading is stopped before an svg element has been allowed to load completely. also available via the onabort property. error fired when an svg element does not load properly or when an error occurs during script execution. a...
...shifted along the x and/or y axes. also available via the onscroll property. unload fired when the dom implementation removes an svg document from a window or frame. also available via the onunload property. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgelement' in that specification. candidate recommendation
adds the dataset property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgelement' in that specification. recommendation initial definition ...
Using the Screen Capture API - Web APIs
the current contents are not available. options and constraints the constraints object passed into getdisplaymedia() is a displaymediastreamconstraints object which is used to configuring the resulting stream. note: unlike most uses of constraints in media apis, here it's solely used to define the stream configuration, and not to filter the available choices. there are three new constraints
added to mediatrackconstraints (as well as to mediatracksupportedconstraints and mediatracksettings) for configuring a screen capture stream: cursor indicates whether or not to capture the mouse cursor, and if so, whether to do so all the time or only while the mouse is in motion. the possible values are: always the mouse cursor should always be captured in the generated stream. motion...
...ility with have support for audio in captured screen streams. to request that the screen be shared with included audio, the options passed into getdisplaymedia() might look like this: const gdmoptions = { video: true, audio: true } this allows the user total freedom to select whatever they want, within the limits of what the user agent supports. ...
...stop buttons. const videoelem = document.getelementbyid("video"); const logelem = document.getelementbyid("log"); const startelem = document.getelementbyid("start"); const stopelem = document.getelementbyid("stop"); // options for getdisplaymedia() var displaymediaoptions = { video: { cursor: "always" }, audio: false }; // set event listeners for the start and stop buttons startelem.
addeventlistener("click", function(evt) { startcapture(); }, false); stopelem.
addeventlistener("click", function(evt) { stopcapture(); }, false); logging content to make logging of errors and other issues easy, this example overrides certain console methods to output their messages to the <pre> block whose id is log. console.log = msg => logelem.innerhtml += `${msg}<br>`; console.error = msg ...
Screen Capture API - Web APIs
this stream can then be recorded or shared with others over the network. screen capture api concepts and usage the screen capture api is relatively simple to use. its sole method is mediadevices.getdisplaymedia(), whose job is to ask the user to select a screen or portion of a screen to capture in the form of a mediastream. ...
...n, you call getdisplaymedia() on the instance of media navigator.mediadevices: capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); the promise returned by getdisplaymedia() resolves to a mediastream which streams the captured media. see the article using the screen capture api for a more in-depth look at how to use the api to capture screen contents as a stream.
additions to existing interfaces the screen capture api doesn't have any interfaces of its own; instead, it
adds one method to the existing mediadevices interface. mediadevices interface mediadevices.getdisplaymedia() the getdisplaymedia() method is
added to the mediadevices interface. similar to getusermedia(), this method creates a promise that resolves with a mediastream containing the displ...
...s of its own; instead, it
adds one method to the existing mediadevices interface. mediadevices interface mediadevices.getdisplaymedia() the getdisplaymedia() method is
added to the mediadevices interface. similar to getusermedia(), this method creates a promise that resolves with a mediastream containing the display area selected by the user, in a format that matches the specified options.
additions to existing dictionaries the screen capture api
adds properties to the following dictionaries defined by other specifications. mediatrackconstraints mediatrackconstraints.cursor a constraindomstring indicating whether or not the cursor should be included in the captured display surface's stream, and if it should always be visible or if it should only be visible while the mouse is in m...
ScriptProcessorNode.bufferSize - Web APIs
uffer size, in sample-frames. its value can be a power of 2 value in the range 256–16384. syntax var audioctx = new audiocontext(); var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); value an integer. ...
...k loaded via audiocontext.decodeaudiodata(), process it,
adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and
add a small amount of white noise, before setting that result to be the output sample in each case. note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audio...
...(var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; //
add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scrip...
ScriptProcessorNode.onaudioprocess - Web APIs
essornode node types. an event of type audioprocessingevent will be dispatched to the event handler. syntax var audioctx = new audiocontext(); var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); scriptnode.onaudioprocess = function() { ... ...
...k loaded via audiocontext.decodeaudiodata(), process it,
adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and
add a small amount of white noise, before setting that result to be the output sample in each case. note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var...
...(var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; //
add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scrip...
Using server-sent events - Web APIs
lement = document.createelement("li"); const eventlist = document.getelementbyid("list"); newelement.innerhtml = "message: " + event.data; eventlist.appendchild(newelement); } this code listens for incoming messages (that is, notices from the server that do not have an event field on them) and appends the message text to a list in the document's html. ...
...("li"); const eventlist = document.getelementbyid("list"); newelement.innerhtml = "message: " + event.data; eventlist.appendchild(newelement); } this code listens for incoming messages (that is, notices from the server that do not have an event field on them) and appends the message text to a list in the document's html. ...
... 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: event a string identifying the type of event described. if this is specified, an event will be dispatched on the browser to the listener for the specified event name; the website source code should use
addeventlistener() to listen for named events. the onmessage handler is called if no event name is specified for a message. data the data field for the message. when the eventsource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline character between each one. trailing newlines are removed. id the event id to set the eventsource object's last even...
ServiceWorkerGlobalScope.onpush - Web APIs
the serviceworkerglobalscope.onpush event of the serviceworkerglobalscope interface is fired whenever a push message is received by a service worker via a push server. syntax serviceworkerglobalscope.onpush = function(pushevent) { ... } self.
addeventlistener('push', function(pushevent) { ... }) example the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
.... syntax serviceworkerglobalscope.onpush = function(pushevent) { ... } self.
addeventlistener('push', function(pushevent) { ... }) example the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
... working draft initial definition. this event is specified in the push api, but accessed through serv...
ServiceWorkerGlobalScope - Web APIs
he termination/restart cycle, so each event handler should assume it's being invoked with a bare, default global state. once successfully registered, a service worker can and will be terminated when idle to conserve memory and processor power. an active service worker is automatically restarted to respond to events, such as serviceworkerglobalscope.onfetch or serviceworkerglobalscope.onmessage.
additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used. this interface inherits from the workerglobalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. <div id="interfacediagram" style="display: ...
...from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used. this interface inherits from the workerglobalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. ...
... fired, the code returns a promise that resolves to the first matching request in the cache object. if no match is found, the code fetches a response from the network. the code also handles exceptions thrown from the fetch() operation. note that an http error response (e.g., 404) will not trigger an exception. it will return a normal response object that has the appropriate error code set. self.
addeventlistener('fetch', function(event) { console.log('handling fetch event for', event.request.url); event.respondwith( caches.match(event.request).then(function(response) { if (response) { console.log('found response in cache:', response); return response; } console.log('no response found in cache. about to fetch from network...'); return fetch(e...
SpeechGrammarList - Web APIs
tor speechgrammarlist.speechgrammarlist() creates a new speechgrammarlist object. properties speechgrammarlist.length read only returns the number of speechgrammar objects contained in the speechgrammarlist. methods speechgrammarlist.item() standard getter — allows individual speechgrammar objects to be retrieved from the speechgrammarlist using array syntax. speechgrammarlist.
addfromuri() takes a grammar present at a specific uri and
adds it to the speechgrammarlist as a new speechgrammar object. speechgrammarlist.
addfromstring() takes a grammar present in a specific domstring within the code base (e.g. stored in a variable) and
adds it to the speechgrammarlist as a new speechgrammar object. examples in our simple speech color changer example, we create a new speech...
...chgrammar object. speechgrammarlist.
addfromstring() takes a grammar present in a specific domstring within the code base (e.g. stored in a variable) and
adds it to the speechgrammarlist as a new speechgrammar object. examples in our simple speech color changer example, we create a new speechrecognition object instance using the speechrecognition() constructor, create a new speechgrammarlist,
add our grammar string to it using the speechgrammarlist.
addfromstring method, and set it to be the grammar that will be recognised by the speechrecognition instance using the speechrecognition.grammars property. var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenr...
... draft ...
StylePropertyMapReadOnly - Web APIs
lepropertymapreadonly object. stylepropertymapreadonly.keys() returns a new array iterator containing the keys for each item in stylepropertymapreadonly. stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. examples we have to have an element to observe: <p> this is a paragraph with some text. ...
...lepropertymapreadonly. stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. examples we have to have an element to observe: <p> this is a paragraph with some text. we can
add some css, or not. the style map will include all the default and inherted css property values. </p> <dl id="output"></dl> we
add a touch of css with a custom property to better demonstrate the output: p { --somevariable: 1.6em; --someothervariable: translatex(33vw); --anothervariable: 42; line-height: var(--somevariable); } we
add javascript to grab our paragraph and return back a definition list of all the default css property values using computedstylemap(). // get the element const myelement = document.qu...
... list of all the default css property values using computedstylemap(). ...
SubtleCrypto.deriveBits() - Web APIs
async function derivesharedsecret(privatekey, publickey) { const sharedsecret = await window.crypto.subtle.derivebits( { name: "ecdh", namedcurve: "p-384", public: publickey }, privatekey, 128 ); const buffer = new uint8array(sharedsecret, 0, 5); const sharedsecretvalue = document.queryselector(".ecdh .derived-bits-value"); sharedsecretvalue.classlist.
add("fade-in"); sharedsecretvalue.
addeventlistener("animationend", () => { sharedsecretvalue.classlist.remove("fade-in"); }); sharedsecretvalue.textcontent = `${buffer}...[${sharedsecret.bytelength} bytes total]`; } // generate 2 ecdh key pairs: one for alice and one for bob // in more normal usage, they would generate their key pairs // separately and exchange public keys securely const g...
... // bob could generate the same secret using his private key and alice's public key. derivesharedsecret(aliceskeypair.privatekey, bobskeypair.publickey); }); }); pbkdf2 in this example we ask the user for a password, then use it to derive some bits using pbkdf2. see the comple...
....getrandomvalues(new uint8array(16)); const derivedbits = await window.crypto.subtle.derivebits( { "name": "pbkdf2", salt: salt, "iterations": 100000, "hash": "sha-256" }, keymaterial, 256 ); const buffer = new uint8array(derivedbits, 0, 5); const derivedbitsvalue = document.queryselector(".pbkdf2 .derived-bits-value"); derivedbitsvalue.classlist.
add("fade-in"); derivedbitsvalue.
addeventlistener("animationend", () => { derivedbitsvalue.classlist.remove("fade-in"); }); derivedbitsvalue.textcontent = `${buffer}...[${derivedbits.bytelength} bytes total]`; } const derivebitsbutton = document.queryselector(".pbkdf2 .derive-bits-button"); derivebitsbutton.
addeventlistener("click", () => { getderivedbits(); }); specifications ...
VisualViewport - Web APIs
tive to the initial containing block origin of the top edge in css pixels. visualviewport.width read only returns the width of the visual viewport in css pixels. visualviewport.height read only returns the height of the visual viewport in css pixels. visualviewport.scale read only returns the pinch-zoom scaling factor applied to the visual viewport. events listen to these events using
addeventlistener() or by assigning an event listener to the relevant oneventname property of this interface. resize fired when the visual viewport is resized. also available via the visualviewport.onresize property. scroll fired when the visual viewport is scrolled. also available via the visualviewport.onscroll property. examples hiding an overlaid box on zoom this example, taken from th...
...ay) when the user zooms in. this is a nice way to improve the user experience when zooming in on pages. a live sample is also available. var bottombar = document.getelementbyid('bottombar'); var viewport = window.visualviewport; function resizehandler() { if (viewport.scale > 1.3) bottombar.style.display = "none"; else bottombar.style.display = "block"; } window.visualviewport.
addeventlistener('resize', resizehandler); simulating position: device-fixed this example, also taken from the visual viewport readme, shows how to use this api to simulate position: device-fixed, which fixes elements to the visual viewport. a live sample is also available. var bottombar = document.getelementbyid('bottombar'); var viewport = window.visualviewport; function viewporthandler() { va...
...oundingclientrect().height + viewport.offsettop; // you could also do this by setting style.left and style.top if you // use width: 100% instead. bottombar.style.transform = 'translate(' + offsetleft + 'px,' + offsettop + 'px) ' + 'scale(' + 1/viewport.scale + ')' } window.visualviewport.
addeventlistener('scroll', viewporthandler); window.visualviewport.
addeventlistener('resize', viewporthandler); note: this technique should be used with care; emulating position: device-fixed in this way can result in the fixed element flickering during scrolling. specifications specification status comment visual viewport apithe definition of 'visualviewport' in that spe...
Visual Viewport API - Web APIs
egardless of the pinch zoom level of the device? current browsers vary in how they handle this. the visual viewport lets web developers solve this by positioning elements relative to what's shown on screen. to access a window's visual viewport, you can obtain a visualviewport object from the window.visualviewport property. the object includes a set of properties describing the viewport. it also
adds two events, onresize and onscroll, that fire whenever the visual viewport changes. these events allow you to position elements relative to the visual viewport that would normally be anchored to the layout viewport. accessing the api window.visualviewport read only a read-only reference to the window's visualviewport object. if this property doesn't exist, the api is unsupported. interfa...
... unsupported. interfaces visualviewport represents the visual viewport for a given window. a window's visualviewport object provides information about the viewport's position and size, and receives the resize and event:visualviewport:scroll events you can onitor to know when chances occur to the window's viewport. example the code below is based on the sample the specification, though it
adds a few things that 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 pendingupd...
...ight + viewport.offsettop; // you could also do this by setting style.left and style.top if you // use width: 100% instead. bottombar.style.transform = 'translate(' + offsetleft + 'px,' + offsettop + 'px) ' + 'scale(' + 1/viewport.scale + ')' }) } window.visualviewport.
addeventlistener('scroll', viewporthandler); window.visualviewport.
addeventlistener('resize', viewporthandler); specifications specification status comment visual viewport apithe definition of 'visualviewport' in that specification. draft initial definition. ...
WakeLockSentinel - Web APIs
se event which can be used to give appropriate ui feedback. the sentinel can be acquired or released via appropriate interactions. ...
... unknown initial definiti...
... unknown initial definition. ...
WebGLContextEvent - Web APIs
the webcontextevent interface is part of the webgl api and is an interface for an event that is generated in response to a status change to the webgl rendering context. inheritance this interface inherits properties and methods from its parent interface, event. ...
...x="201" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">webglcontextevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface inherits properties from its parent interface, event. ...
... specifications specification status comment webgl 1.0the definition of 'webglcontextevent' in that specification. ...
WebGLRenderingContext.bufferData() - Web APIs
rraybufferview srcdata, usage, srcoffset, length); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available
additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpack_buffe...
...ents are intended to be respecified repeatedly by the application, and used many times as the source for webgl drawing and image specification commands. gl.stream_draw: the contents are intended to be specified once by the application, and used at most a few times as the source for webgl drawing and image specification commands. when using a webgl 2 context, the following values are available
additionally: gl.static_read: the contents are intended to be specified once by reading data from webgl, and queried many times by the application. gl.dynamic_read: the contents are intended to be respecified repeatedly by reading data from webgl, and queried many times by the application. gl.stream_read: the contents are intended to be specified once by reading data from webgl, and queri...
...n status comment webgl 1.0the definition of 'bufferdata' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glbufferdata' in that specification. standard man page of the opengl api. opengl es 3.0the definition of 'glbufferdata' in that specification. standard man page of the (similar) opengl es 3 api.
adds new target buffers: gl.copy_read_buffer, gl.copy_write_buffer, gl.transform_feedback_buffer, gl.uniform_buffer, gl.pixel_pack_buffer, gl.pixel_unpack_buffer
adds new usage hints: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy. ...
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
webgl api returns the completeness status of the webglframebuffer object. syntax glenum gl.checkframebufferstatus(target); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available
additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. return value a glenum indicating the completeness status of the framebuffer or 0 if an error occurs. possible enum return values: gl.framebuffer_complete: the framebuf...
...uffer attachment complete. gl.framebuffer_incomplete_missing_attachment: there is no attachment. gl.framebuffer_incomplete_dimensions: height and width of the attachment are not the same. gl.framebuffer_unsupported: the format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer. ...
... not the same renderbuffer. when using a webgl 2 context, the following values can be returned
additionally: gl.framebuffer_incomplete_multisample: the values of gl.renderbuffer_samples are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures. when using the ovr_multiview2 extension, the following value can be returned
additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var framebuffer = gl.createframebuffer(); // ... gl.ch...
WebGLRenderingContext.getBufferParameter() - Web APIs
. syntax any gl.getbufferparameter(target, pname); parameters target a glenum specifying the target buffer object. possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available
additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpac...
...operations. pname a glenum specifying information to query. possible values: gl.buffer_size: returns a glint indicating the size of the buffer in bytes. gl.buffer_usage: returns a glenum indicating the usage pattern of the buffer. this is either: gl.static_draw, gl.dynamic_draw, gl.stream_draw. when using a webgl 2 context, the following values are available
additionally: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy. return value depends on the requested information (as specified with pname). either a glint or a glenum. examples gl.getbufferparameter(gl.array_buffer, gl.buffer_size); specifications specification status ...
...nition of 'glgetbufferparameteriv' in that specification. standard man page of the (similar) opengl es 2 api. webgl 2.0the definition of 'getbufferparameter' in that specification. editor's draft updated definition for webgl. opengl es 3.0the definition of 'glgetbufferparameter' in that specification. standard man page of the (similar) opengl es 3 api.
adds new target buffers: gl.copy_read_buffer, gl.copy_write_buffer, gl.transform_feedback_buffer, gl.uniform_buffer, gl.pixel_pack_buffer, gl.pixel_unpack_buffer
adds new usage hints: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy. ...
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
information about a framebuffer's attachment. syntax any gl.getframebufferattachmentparameter(target, attachment, pname); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available
additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the texture. possible values: gl.color_attachment0: texture attachment for the framebuffer's color buffer. gl...
...: gl.color_attachment0: texture attachment for the framebuffer's color buffer. gl.depth_attachment: texture attachment for the framebuffer's depth buffer. gl.stencil_attachment: texture attachment for the framebuffer's stencil buffer. gl.depth_stencil_attachment: texture attachment for both, the depth and stencil buffer. ...
...bglrenderbuffer or webgltexture). gl.framebuffer_attachment_texture_level: mipmap level. default value: 0. gl.framebuffer_attachment_texture_cube_map_face: the name of cube-map face of the texture. when using the ext_srgb extension: ext.framebuffer_attachment_color_encoding_ext: the framebuffer color encoding. ...
WebGLRenderingContext - Web APIs
turns the location of an attribute variable. webglrenderingcontext.getuniform() returns the value of a uniform variable at a given location. webglrenderingcontext.getuniformlocation() returns the location of a uniform variable. webglrenderingcontext.getvertexattrib() returns information about a vertex attribute at a given position. webglrenderingcontext.getvertexattriboffset() returns the
address of a given vertex attribute. webglrenderingcontext.uniform[1234][fi][v]() specifies a value for a uniform variable. webglrenderingcontext.uniformmatrix[234]fv() specifies a matrix value for a uniform variable. webglrenderingcontext.vertexattrib[1234]f[v]() specifies a value for a generic vertex attribute. webglrenderingcontext.vertexattribpointer() specifies the data formats and locat...
...s, we get the desired result. in the second, the square has the wrong shape, size, and position. ...
...g shape, size, and position. ...
Boilerplate 1 - Web APIs
ted 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. any
additional non-trivial css and html will be displayed on the pages of specific examples. in following examples, we will use a javascript helper function, getrenderingcontext(), to initialize the webgl rendering context. by now, you should be able to understand what the function does. basically, it gets the webgl rendering context from the canvas element, initializes the drawing buffer, clears it bla...
...javascript technique (see function). the function declaration and invocation will also be hidden. html <p>[ some descriptive text about the example. ]</p> <button>[ optional button element. ...
...ext about the example. ]</p> <button>[ optional button element. ...
Clearing by clicking - Web APIs
the event handler removes // itself, because it only needs to run once. window.removeeventlistener(evt.type, setupwebgl, false); // ...
...id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="color-switcher">press here to switch color</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; p
adding : 0; border : none; background-color : black; } button { display : inline-block; font-size : inherit; margin : auto; p
adding : 0.6em; } window.
addeventlistener("load", function setupwebgl (evt) { "use strict" // cleaning after ourselves. the event handler removes // itself, because it only needs to run once. window.removeeventlistener(evt.type, setupwebgl, false); //
adding the same click event handler to both canvas and // button. var canvas = document.queryselector("#canvas-view"); var button =...
...tion setupwebgl (evt) { "use strict" // cleaning after ourselves. the event handler removes // itself, because it only needs to run once. window.removeeventlistener(evt.type, setupwebgl, false); //
adding the same click event handler to both canvas and // button. var canvas = document.queryselector("#canvas-view"); var button = document.queryselector("#color-switcher"); canvas.
addeventlistener("click", switchcolor, false); button.
addeventlistener("click", switchcolor, false); // a variable to hold the webglrenderingcontext. var gl; // the click event handler. function switchcolor () { // referring to the externally defined gl variable. // if undefined, try to obtain the webglrenderingcontext. // if failed, alert user of failure. // otherwise, in...
Clearing with colors - Web APIs
« previousnext » an example showing how to clear a webgl rendering context to a solid color. 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. there is only a handful of methods fo...
...pha (opacity). therefore, clearcolor() takes four arguments. <p>a very simple webgl program that shows some color.</p> <!-- text within a canvas element is displayed only if canvas is not supported. ...
...the event handler removes // itself, because it only needs to run once. window.removeeventlistener(evt.type, setupwebgl, false); // references to the document elements. ...
Color masking - Web APIs
clear color, tinted by the color mask. ...
...</button> <button id="green-toggle">on</button> <button id="blue-toggle">on</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; p
adding : 0; border : none; background-color : black; } button { display : inline-block; font-family : serif; font-size : inherit; font-weight : 900; color : white; margin : auto; p
adding : 0.6em 1.2em; } #red-toggle { background-color : red; } #green-toggle { background-color : green; } #blue-toggle { background-color : blue; } window.
addeventlistener("load", function setupanimation (evt) { "use strict" window.removeeventlistener(evt.type, setupanimation, false); var canvas = document.queryselector("canvas"); var gl = canvas.getcontext("webgl") || canvas...
... browser or device may not support webgl."; return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); var timer = setinterval(drawanimation, 1000); var mask = [true, true, true]; var redtoggle = document.queryselector("#red-toggle"), greentoggle = document.queryselector("#green-toggle"), bluetoggle = document.queryselector("#blue-toggle"); redtoggle.
addeventlistener("click", setcolormask, false); greentoggle.
addeventlistener("click", setcolormask, false); bluetoggle.
addeventlistener("click", setcolormask, false); function setcolormask(evt) { var index = evt.target === greentoggle && 1 || evt.target === bluetoggle && 2 || 0; mask[index] = !mask[index]; if (mask[index] === true) evt.target.innerhtml="on";...
Detect WebGL - Web APIs
o 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. ...
... each api. <p>[ here would go the result of webgl feature detection ]</p> <button>press here to detect webglrenderingcontext</button> body { text-align : center; } button { display : block; font-size : inherit; margin : auto; p
adding : 0.6em; } // run everything inside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it. ...
... body { text-align : center; } button { display : block; font-size : inherit; margin : auto; p
adding : 0.6em; } // run everything inside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it. window.
addeventlistener("load", function() { var paragraph = document.queryselector("p"), button = document.queryselector("button"); //
adding click event handler to button. button.
addeventlistener("click", detectwebglcontext, false); function detectwebglcontext () { // create canvas element. the canvas is not
added to the // document itself, so it is never displayed in the // browser window. var canvas = document.createelement("canvas"); // get webglrenderingcontext from canvas element. var gl = canvas.ge...
Hello GLSL - Web APIs
actly 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. ...
...o world program in glsl a very simple first shader program. ...
...t-size : inherit; margin : auto; p
adding : 0.6em; } <script type="x-shader/x-vertex" id="vertex-shader"> #version 100 void main() { gl_position = vec4(0.0, 0.0, 0.0, 1.0); gl_pointsize = 64.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 void main() { gl_fragcolor = vec4(0.18, 0.54, 0.34, 1.0); } </script> ;(function(){ "use strict" window.
addeventlistener("load", setupwebgl, false); var gl, program; function setupwebgl (evt) { window.removeeventlistener(evt.type, setupwebgl, false); if (!(gl = getrenderingcontext())) return; var source = document.queryselector("#vertex-shader").innerhtml; var vertexshader = gl.createshader(gl.vertex_shader); gl.shadersource(vertexshader,source); gl.compileshader(vertexshader); sou...
Textures from code - Web APIs
or 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. ...
... fragment shader. <p>texture from code. ...
...; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 precision mediump float; void main() { vec2 fragmentposition = 2.0*gl_pointcoord - 1.0; float distance = length(fragmentposition); float distancesqrd = distance * distance; gl_fragcolor = vec4( 0.2/distancesqrd, 0.1/distancesqrd, 0.0, 1.0 ); } </script> ;(function(){ "use strict" window.
addeventlistener("load", setupwebgl, false); var gl, program; function setupwebgl (evt) { window.removeeventlistener(evt.type, setupwebgl, false); if (!(gl = getrenderingcontext())) return; var source = document.queryselector("#vertex-shader").innerhtml; var vertexshader = gl.createshader(gl.vertex_shader); gl.shadersource(vertexshader,source); gl.compileshader(vertexshader); sou...
WebGL constants - Web APIs
t_alpha 0x8004 passed to blendfunc or blendfuncseparate to specify one minus a constant alpha blend function. blending equations constants passed to webglrenderingcontext.blendequation() or webglrenderingcontext.blendequationseparate() to control how 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...
... max_renderbuffer_size 0x84e8 invalid_framebuffer_operation 0x0506 pixel storage modes constants passed to webglrenderingcontext.pixelstorei(). constant name value description unpack_flip_y_webgl 0x9240 unpack_premultiply_alpha_webgl 0x9241 unpack_colorspace_conversion_webgl 0x9243
additional constants defined webgl 2 these constants are defined on the webgl2renderingcontext interface. all webgl 1 constants are also available in a webgl 2 context. getting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. constant name value description read_buffer 0x0c02 unpac...
... ...
Data in WebGL - Web APIs
hare a vertex's normal vector after it has been computed by the vertex shader. ...
...tor after it has been computed by the vertex shader. ...
...by the vertex shader. ...
Animating objects with WebGL - Web APIs
the square, we apply the rotation like this: mat4.rotate(modelviewmatrix, // destination matrix modelviewmatrix, // matrix to rotate squarerotation, // amount to rotate in radians [0, 0, 1]); // axis to rotate around this rotates the modelviewmatrix by the current value of squarerotation, around the z axis. ...
...otation, // amount to rotate in radians [0, 0, 1]); // axis to rotate around this rotates the modelviewmatrix by the current value of squarerotation, around the z axis. to actually animate, we need to
add code that changes the value of squarerotation over time. ...
... } requestanimationframe(render); this code uses requestanimationframe to ask the browser to call the function "render" on each frame. requestanimationframe passes us the time in milliseconds since the page loaded. we convert that to seconds and then subtract from it the last time to 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 « previousnext » ...
Writing WebSocket servers - Web APIs
uld send back a special response that indicates that the protocol will be changing from http to websocket. that header looks something like the following (remember each header line ends with \r\n and put an extra \r\n after the last one to indicate the end of the header): http/1.1 101 switching protocols upgrade: websocket connection: upgrade sec-websocket-accept: s3pplmbitxaq9kygzzhzrbk+xoo=
additionally, the server can decide on extension/subprotocol requests here; see miscellaneous for details. the sec-websocket-accept header is important in that the server must derive it from the sec-websocket-key that the client sent to it. to get it, concatenate the client's sec-websocket-key and the string "258eafa5-e914-47da-95ca-c5ab0dc85b11" together (it's a "magic string"), take the sha-1 hash ...
...r headers like set-cookie, or ask for authentication or redirects via other status codes, before sending the reply handshake. keeping track of clients this doesn't directly relate to the websocket protocol, but it's worth mentioning here: your server must keep track of clients' sockets so you don't keep handshaking again with clients who have already completed the handshake. the same client ip
address can try to connect multiple times. however, the server can deny them if they attempt too many connections in order to save itself from denial-of-service attacks. for example, you might keep a table of usernames or id numbers along with the corresponding websocket and other data that you need to associate with that connection. exchanging data frames either the client or the server can choos...
...what an extension does. websockets defines a protocol and a simple way to send data, but an extension such as compression could allow sending the same data but in a shorter format. extensions are explained in sections 5.8, 9, 11.3.2, and 11.4 of the spec. todo subprotocols think of a subprotocol as a custom xml schema or doctype declaration. you're still using xml and its syntax, but you're
additionally restricted by a structure you agreed on. websocket subprotocols are just like that. they do not introduce anything fancy, they just establish structure. like a doctype or schema, both parties must agree on the subprotocol; unlike a doctype or schema, the subprotocol is implemented on the server and cannot be externally refered to by the client. subprotocols are explained in sections 1.
Fundamentals of WebXR - Web APIs
ce with mixed reality hardware such as vr headsets and glasses with integrated augmented reality features. this includes both managing the process of rendering the views needed to simulate the 3d experience and the ability to sense the movement of the headset or other motion sensing apparatus to provide the needed data to let you update the imagery shown to the user based on that movement. webxr
additionally provides support for accepting inputs from control devices such as handheld vr controllers or specialized mixed reality gamepads. webxr is not a rendering technology, and provides no features for actually managing 3d data or rendering it to the display. this is an important fact to keep in mind; while webxr manages the timing, scheduling, and the various points of view relevant when dra...
...devices often work by snapping your phone into the headset so that its screen and onboard graphics processor can be used to render and display the xr scene. more advanced headsets have integrated displays and are strapped to the head using an elastic or strap or a strap with velcro closure. these headsets may include integrated speakers and microphone, and/or connectors to attach external ones.
additionally, these headsets may have various sensors for detecting when the headset moves through space. the types and number of sensors included will determine how many degrees of freedom the user has. goggles and glasses xr goggles are similar to headsets in that they involve the placing of graphics display surfaces in front of the eyes in order to render the views of a scene needed to simulate ...
...nt from being seen through the obscured portion of the lens. caves a cave automated virtual environment (cave) is an immersive vr environment in which the scene is projected or otherwise displayed on the walls (as well as possibly the ceiling and/or floor), thus completely surrounding the user with the simulation and allowing them to be immersed in the scene. the user wears 3d glasses that both
add the 3d effect to the projected image, but provide a means for the system to render foreground objects into the world. the user's activity may be monitored using motion sensors that are worn or held by the user, or, increasingly commonly, using infrared cameras that detect the user's movements. speakers placed around the chamber provide immersive sound as well. these are not common among everyda...
WebXR Device API - Web APIs
the webxr device api implements the core of the webxr feature set, managing the selection of output devices, render the 3d scene to the chosen device at the appropriate frame rate, and manage motion vectors created using input controllers. ...
...he resulting framebuffer is delivered to the webxr device to be presented to the user through their headset or other appropriate display device. webxr device api concepts and usage example webxr hardware setup while the older webvr api was designed solely to support virtual reality (vr), webxr provides support for both vr and augmented reality (ar) on the web. support for ar functionality is
added by the webxr augmented reality module. a typical xr device can have either 3 or 6 degrees of freedom and might or might not have an external positional sensor. the equipment may also include an accelerometer, barometer, or other sensors which are used to sense when the user moves through space, rotates their head, or the like. accessing the webxr api to gain access to the webxr api within t...
...an accelerometer, barometer, or other sensors which are used to sense when the user moves through space, rotates their head, or the like. accessing the webxr api to gain access to the webxr api within the context of a given window, use the navigator.xr property, which returns an xrsystem object through which the entire webxr device api is then exposed. navigator.xr read only this property,
added to the navigator interface, returns the xrsystem object through which the webxr api is exposed. if this property is missing or null, webxr is not available. webxr interfaces xr the navigator.xr property returns the window's instance of xrsystem, which is the mechanism by which your code accesses the webxr api. using the xrsystem interface, you can create xrsessions to represent actual ar ...
Controlling multiple parameters with ConstantSourceNode - Web APIs
the tones. now let's look at the setup() function, which is our handler for the window's load event; it handles all the initialization tasks that require the dom to be in place. ...
... our handler for the window's load event; it handles all the initialization tasks that require the dom to be in place. ...
...then we get references to the control widgets, setting playbutton to reference the play button and volumecontrol to reference the slider control that the user will use to adjust the gain on the linked pair of oscillators. then we assign a handler for the play button's click...
Web Workers API - Web APIs
and the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data property). the data is copied rather than shared. workers may in turn spawn new workers, as long as those workers are hosted within the same origin as the parent page. in
addition, workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. in
addition to dedicated workers, there are other types of worker: shared workers are workers that can be utilized by multiple scripts running in different windows, iframes, etc., as long as they are in the same domain as the worker. they a...
...hey are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. they will also allow access to push notifications and background sync apis. chrome workers are a firefox-only type of worker that you can use if you are developing
add-ons and want to use workers in extensions and have access to js-ctypes in your worker. see chromeworker for more details. audio workers provide the ability for direct scripted audio processing to be done inside a web worker context. note: as per the web workers spec, worker error events should not bubble (see bug 1188141. this has been implemented in firefox 42. web worker interfaces ab...
...ion of the script executed by the worker. sharedworker represents a specific kind of worker that can be accessed from several browsing contexts, being several windows, iframes or even workers. workerglobalscope represents the generic scope of any worker (doing the same job as window does for normal web content). different types of worker have scope objects that inherit from this interface and
add more specific features. dedicatedworkerglobalscope represents the scope of a dedicated worker, inheriting from workerglobalscope and
adding some dedicated features. sharedworkerglobalscope represents the scope of a shared worker, inheriting from workerglobalscope and
adding some dedicated features. workernavigator represents the identity and state of the user agent (the client): examples ...
Window.getComputedStyle() - Web APIs
tted(). note: valid pseudo-element selector refers to syntactic validity, e.g. ::unsupported is considered valid, even though the pseudo-element itself is not supported. examples in this example we style a <p> element, then retrieve those styles using getcomputedstyle(), and print them into the text content of the <p>. ...
...tyledeclaration type as the object returned from the element's style property. however, the two objects have different purposes: the object from getcomputedstyle is read-only, and should be used to inspect the element's style — including those set by a <style> element or an external stylesheet. the element.style object should be used to set styles on that element, or inspect styles directly
added to it from javascript manipulation or the global style attribute. the first argument must be an element. non-elements, like a text node, will throw an error. defaultview in many code samples, getcomputedstyle is used from the document.defaultview object. in nearly all cases, this is needless, as getcomputedstyle exists on the window object as well. it's likely the defaultview pattern was a ...
...nt-size. shorthand names like font will not work with most browsers. css property values may be accessed using the getpropertyvalue(propname) api or by indexing directly into the object such as obj['z-index'] or obj.zindex. the values returned by getcomputedstyle are resolved values. these are usually the same as css 2.1’s computed values, but for some older properties like width, height, or p
adding, they are instead the same as used values. originally, css 2.0 defined the computed values as the "ready to be used" final values of properties after cascading and inheritance, but css 2.1 redefined them as pre-layout, and used values as post-layout. for css 2.0 properties, getcomputedstyle returns the old meaning of computed values, now called used values. an example difference between pre- a...
Window.onbeforeinstallprompt - Web APIs
the window.onbeforeinstallprompt property is an event handler for processing a beforeinstallprompt, which is dispatched on devices when a user is about to be prompted to "install" a web application. its associated event may be saved for later and used to prompt the user at a more suitable time. syntax window.
addeventlistener("beforeinstallprompt", function(event) { ... ...
...plication. its associated event may be saved for later and used to prompt the user at a more suitable time. 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. ...
...nt) { ...}; example the following example uses the beforeinstallprompt event to make an install button operable, by using the event inside a click handler. ...
Window: unhandledrejection event - Web APIs
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 that would have been passed into the rejection handler if one had existed. see catch() for details. basic error logging this example simply logs information about the unhandled promise rejection to the console. ...
...: ${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}`); }; preventing default handling many environments (such as node.js) report unhandled promise rejections to the console by default. ...
...edrejection event handler property to set up the event listener: window.onunhandledrejection = event => { console.warn(`unhandled promise rejection: ${event.reason}`); }; preventing default handling many environments (such as node.js) report unhandled promise rejections to the console by default. you can prevent that from happening by
adding a handler for unhandledrejection events that—in
addition to any other tasks you wish to perform—calls preventdefault() to cancel the event, preventing 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... // prevent the default handling (such as outputting...
WindowEventHandlers.onbeforeunload - Web APIs
ndler for processing beforeunload events. these events fire when a window is about to unload its resources. at this point, the document is still visible and the event is still cancelable. note: to combat unwanted pop-ups, some browsers don't display prompts created in beforeunload event handlers unless the page has been interacted with. moreover, 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. the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue ...
..., 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. the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue to prompt the user. ...
...thod instead of using event.returnvalue to prompt the user. window.
addeventlistener('beforeunload', function (e) { // cancel the event e.preventdefault(); // if you prevent default behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.
addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascript to render content, the javascript may stop when leaving and then navigating back to the page. you can bind to window.onbeforeunload to prevent the browser from fully caching the page. if ...
WindowEventHandlers.onhashchange - Web APIs
weventhandlers.onhashchange property of the windoweventhandlers mixin is the eventhandler for processing hashchange events. the hashchange event fires when a window's hash changes (see window.location and htmlhyperlinkelementutils.hash). syntax using an event handler: window.onhashchange = funcref; using an html event handler: <body onhashchange="funcref();"> using an event listener: to
add an event listener, use
addeventlistener(): window.
addeventlistener("hashchange", funcref, false); parameters funcref a reference to a function. examples using an event handler this example uses an event handler (window.onhashchange) to check the new hash value whenever it changes. if it equals #cool-feature, the script logs a message to the console. function locationhashchanged() { ...
...gs a message to the console. function locationhashchanged() { if (location.hash === '#cool-feature') { console.log("you're visiting a cool feature!"); } } window.onhashchange = locationhashchanged; using an event listener this example uses an event listener to log a notification whenever the hash has changed. function hashhandler() { console.log('the hash has changed!'); } window.
addeventlistener('hashchange', hashhandler, false); overriding the hash this function sets a new 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 dom...
... field type description newurl domstring the new url to which the window is navigating. oldurl domstring the previous url from which the window was navigated. ...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
e time, in milliseconds (thousandths of a second), the timer should wait before the specified function or code is executed. if this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, the next event cycle. note that in either case, the actual delay may be longer than intended; see reasons for delays longer than specified below. arg1, ..., argn optional
additional arguments which are passed through to the function specified by function. note: passing
additional parameters to the function in the first syntax does not work in internet explorer 9 and below. if you want to enable this functionality on that browser, you must use a polyfill (see the polyfill section). return value the returned timeoutid is a positive integer value which identifies t...
...appens</button> javascript var timeoutid; function delayedalert() { timeoutid = window.settimeout(window.alert, 2*1000, 'that was really slow!'); } function clearalert() { window.cleartimeout(timeoutid); } result see also cleartimeout() example. polyfill if you need to pass one or more arguments to your callback function, but need it to work in browsers which don't support sending
additional arguments using either settimeout() or setinterval() (e.g., internet explorer 9 and below), you can include this polyfill to enable the html5 standard arguments-passing functionality. just
add this code to the top of your script: /*\ |*| |*| polyfill which enables the passage of arbitrary arguments to the |*| callback functions of javascript timers (html5 standard syntax). |*| |*| http...
...d, the throttling minimum delay is still 4ms. in background tabs, however, the throttling minimum delay is 10,000 ms, or 10 seconds, which comes into effect 30 seconds after a document has first loaded. the prefs that control this behaviour are: dom.min_tracking_timeout_value: 4 dom.min_tracking_background_timeout_value: 10000 dom.timeout.tracking_throttling_delay: 30000 late timeouts in
addition to "clamping", the timeout can also fire later when the page (or the os/browser itself) is busy with other tasks. one important case to note is that the function or code snippet cannot be executed until the thread that called settimeout() has terminated. for example: function foo() { console.log('foo has been called'); } settimeout(foo, 0); console.log('after settimeout'); will write to ...
Worker: messageerror event - Web APIs
the messageerror event is fired on a worker object when it receives a message that can't be deserialized. ...
... on a worker object when it receives a message that can't be deserialized. ...
...able no interface messageevent event handler property onmessageerror examples create a worker, and listen for message and messageerror events using
addeventlistener(): // inside main.js const worker = new worker("static/scripts/worker.js"); worker.
addeventlistener("message", (event) => { console.error(`received message from worker: ${event}`); }); worker.
addeventlistener("messageerror", (event) => { console.error(`error receiving message from worker: ${event}`); }); the same, but using the onmessageerror event handler property: // inside main.js const worker = new worker("static/scripts/worker.js"); worker.onmessage = (event) => { console.error(`received message from worker: ${event}`); }; worker.onmessageerror = (event) => { console...
Worker.prototype.postMessage() - Web APIs
} second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see ourbasic dedicated worker example (run dedicated worker). note: postmessage() can only send a single object at once. as seen above, if you want to pass multiple values you can send an array. transfer example this example shows a firefox
add-on that transfers an arraybuffer from the main thread to the chromeworker, and then the chromeworker transfers it back to the main thread. main thread code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', msg); switch (msg.data.atopic) { case 'do_sendmainarrbuff': s...
...d code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', msg); switch (msg.data.atopic) { case 'do_sendmainarrbuff': sendmainarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } myworker.
addeventlistener('message', handlemessagefromworker); // ok lets create the buffer and send it var arrbuf = new arraybuffer(8); console.info('arrbuf.bytelength pre transfer:', arrbuf.bytelength); myworker.postmessage( { atopic: 'do_sendworkerarrbuff', abuf: arrbuf // the array buffer that we passed to the transferrable section 3 lines below }, [ arrbuf // the arr...
...pre send back abuf.bytelength: 8 myworker.js:5:2 incoming message from worker, msg: message { ... } bootstrap.js:20 got back buf in main thread, abuf.bytelength: 8 bootstrap.js:12 from worker, post send back abuf.bytelength: 0 myworker.js:7:2 bytelength goes to 0 as it is transferred. to see a full working example of this firefox demo
add-on see here: github :: chromeworker - demo-transfer-arraybuffer specifications specification status comment html living standardthe definition of 'worker.postmessage()' in that specification. living standard ...
XMLHttpRequest: abort event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XMLHttpRequest: error event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XMLHttpRequest: load event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XMLHttpRequest: loadend event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XMLHttpRequest: loadstart event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XMLHttpRequest: progress event - Web APIs
ame="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; p
adding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} byt...
...h: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabort = document.queryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function
addlisteners(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest...
...s(xhr) { xhr.
addeventlistener('loadstart', handleevent); xhr.
addeventlistener('load', handleevent); xhr.
addeventlistener('loadend', handleevent); xhr.
addeventlistener('progress', handleevent); xhr.
addeventlistener('error', handleevent); xhr.
addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest();
addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.
addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.
addeventlistener('click', () => { runxhr('https://mdn.mozillademos.o...
XRInputSourcesChangeEvent.removed - Web APIs
of zero or more xrinputsource objects representing the input sources which have been removed from the xrsession. syntax removedinputs = xrinputsourceschangeevent.removed; value an array of zero or more xrinputsource objects, each representing one input device removed from the xr system. ...
...of zero or more xrinputsource objects, each representing one input device removed from the xr system. examples the example below creates a handler for the inputsourceschange event that processes the lists of
added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
...device removed from the xr system. examples the example below creates a handler for the inputsourceschange event that processes the lists of
added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. xrsession.oninputsourcescchange = event => { for (let input of event.
added) { if (input.targetraymode == "tracked-pointer") {
addedpointerdevice(input); } } for (let input of event.removed) { if (input.targetraymode == "tracked-pointer") { removedpointerdevice(input); } } }; specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeevent.removed' in that specification. working draft initial definition. ...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
trated in the example implementing rotation based on non-xr inputs, which demonstrates a way to use this method to let the user use their mouse to pitch and yaw their viewing angle. syntax offsetreferencespace = xrreferencespace.getoffsetreferencespace(originoffset); parameters originoffset an xrrigidtransform specifying the offset to the origin of the new reference space. these values are
added to the position and orientation of the current reference space and then the result is used as the position and orientation of the newly created xrreferencespace. return value a new xrreferencespace object describing a reference space with the same native origin as the reference space on which the method was called, but with an origin offset indicating the distance from the object to the poin...
...evices to move or otherwise transform objects in the 3d space—or to allow the user to move through the space—you'll need to write some code to read the inputs and move perform the movements. 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. ...
...the pitch is restricted so that you can't look beyond straight up and straight down. ...
XRSession: end event - Web APIs
end event is fired at an xrsession object when the webxr session has ended, either because the web application has chosen to stop the session, or because the user agent terminated the session. ...
... the webxr session has ended, either because the web application has chosen to stop the session, or because the user agent terminated the session. ...
...se the web application has chosen to stop the session, or because the user agent terminated the session. ...
XRView.transform - Web APIs
g the same matrix for each object rendered. then we iterate over each xrview found in the xrviewerpose's list of views. there will usually be two: one for the left eye and one for the right, but there may be only one if in monoscopic mode. currently, webxr doesn't support more than two views per pose, although room has been left to extend the specification to support that in the future with some
additions to the api. for each view, we obtain its viewport and pass that to webgl using gl.viewport(). for the left eye, this will be the left half of the canvas, while the right eye will use the right half. then we iterate over each object that makes up the scene. each object's model view matrix is computed by multiplying its own matrix which describes the object's own position and orientation by...
...s to the api. for each view, we obtain its viewport and pass that to webgl using gl.viewport(). for the left eye, this will be the left half of the canvas, while the right eye will use the right half. then we iterate over each object that makes up the scene. each object's model view matrix is computed by multiplying its own matrix which describes the object's own position and orientation by the
additional position and orientation adjustments needed to match the camera's movement. to convert the "camera focused" transform matrix into an "object focused" transform, we use the transform's inverse, thus taking the matrix returned by view.transform.inverse.matrix. the resulting model view matrix will apply all the transforms needed to move and rotate the object based on the relative positions of...
...e the movement of the camera even though we're actually moving the object. we then compute the normals for the model view matrix by inverting it, then transposing it. finally, we call the object's render() routine, passing along the modelviewmatrix and normalmatrix so the renderer can place and light the object properly. note: this example is derived from a larger example... <<<--- finish and
add link --->>> specifications specification status comment webxr device apithe definition of 'xrview.transform' in that specification. working draft initial definition. ...
XSL Transformations in Mozilla FAQ - Web APIs
e extensions like livehttpheaders or a download manager like wget. mozilla won't load xslt stylesheets from a different domain for security reasons. note: starting in gecko 7.0, both text/xsl and application/xslt+xml are supported mime types for xslt media stylesheets. note that firefox will override your xslt stylesheet if your xml is detected as an rss or atom feed. a known workaround is to
add a sufficiently long xml comment to the beginning of your xml file in order to "push" the <feed> or <rss> tag out of the first 512 bytes, which is analyzed by firefox to determine if it's a feed or not. see the discussion on bug #338621 for more information. it works in ie, but not in mozilla? there are even more differences. most come from what we suspect ie to do after the transformation. it (...
...here are even more differences. most come from what we suspect ie to do after the transformation. it (afaict) serializes and parses the output to generate what it actually renders. mozilla in contrast renders exactly the result of your transformation. can i do disable-output-escaping? this is actually pretty close to the question above. and in short, no. disabling output escaping requires us to
add a parsing step to our output generation, which we don't. in most cases, there are pretty easy workarounds. the only use cases we have seen are bad xml or bad xslt. and rss feeds. the latter is pretty much the only issue to us, and we're sorry that we can't support it. but mixing parsing with xslt is brittle and we rather not support d-o-e than either crash or be even slower. what about document.
...it, though. if you need platform dependent code or stylesheets, just do <xsl:if test="system-property('xsl:vendor')='transformiix'"> <!-- mozilla specific markup --> </xsl:if> <xsl:if test="system-property('xsl:vendor')='microsoft'"> <!-- ie specific markup --> </xsl:if> check system-properties.xml for the properties of your favorite system. msxml has an
additional property. <xsl:if xmlns:msxsl="urn:schemas-microsoft-com:xslt" test="system-property('msxsl:version')=3"> <!-- msxml3 specific markup --> </xsl:if> what about media="print"? when printing a document, mozilla tries to render the page on paper as closely to what you see as possible. this includes stuff like text entered into textfields and other dynamic ...
ARIA Screen Reader Implementors Guide - Accessibility
gions as an area for screen readers to innovate and compete. interpreting wai-aria live region markup live changes are hints: in general live region markup is provided by the author as hints, and the assistive technology may allow for global, site or even region-specific settings, as well as heuristics to help with live changes on pages that have no wai-aria hints. optionally, create a second,
additional queue if the user configures a second hardware channel: if there are two channels for presentation (e.g. text to speech and a braille display), then two queues can be maintained to allow for parallel presentation. the channels could be user configured for presenting live regions based on role or politeness. busy regions: any changes in a region marked with aria-busy="true" should not be a...
...nd a braille display), then two queues can be maintained to allow for parallel presentation. the channels could be user configured for presenting live regions based on role or politeness. busy regions: any changes in a region marked with aria-busy="true" should not be
added to the queue until that attribute is cleared. politeness (aria-live or from role) takes first precedence,: items should be
added to the queue based on their politeness level from the aria-live property or inherited from the role (e.g. role="log" is polite by default). assertive items are first then politeness level. alternatively, implementations may choose to have a policy of clearing more polite items, e.g. assertive items clear any polite items from the queue. time takes second precedence: prioritize items with the s...
...ite items from the queue. time takes second precedence: prioritize items with the same politeness level according to when the event occurs (earlier events come first). present items of the same politeness level in the order of what occurred first. atomic (aria-atomic="true") regions with multiple changes should not be presented twice with the same content. as a new event for an atomic region is
added to the queue remove an earlier event for the same region. it is probably desirable to have at least a tiny timeout before presenting atomic region changes, in order to avoid presenting the region twice for two changes that occur quickly one after the other. include labels when presenting changes: if the change occurs in something with a semantic label of some kind, speak the label. this is par...
ARIA: application role - Accessibility
nt. this is often referred to as virtual document, browse mode, or similar terms. the document is streamlined to a single-column view. a keyboard interaction model is generated that is very similar to a word processor where users can read line by line, sentence by sentence, or paragraph by paragraph. the at will read any semantics like links, headings, form controls, tables, lists, or images. in
addition, a set of so-called quick navigation keys has been established over the years that allows blind users to skim through a page via a certain element type. such elements usually include headings, form fields, lists, tables, links, graphics, or landmark regions. for all of this to work, ats intercept almost all keyboard input and consume it themselves, letting nothing through to the browser or ...
...ted wai-aria roles, states, and properties document, article used to indicate parts of the application that should be treated as normal web content aria-activedescendant used to manage focus inside the application. aria-label used to provide the name of the application or purpose of the widget that is being exposed. aria-describedby used to indicate the idref of an element that contains
additional instructions for navigating or operating this element. aria-roledescription used to give the application a more descriptive role text for screen readers to speak. this should be localized. keyboard interactions keyboard interaction is completely under the web author's control and can be anything associated with the particular widget being implemented. in a slides application, for exam...
...ors, like the one used on the mozilla developer network some parts of gmail accessibility concerns improperly using the application role can unintentionally take away access from information on a web page, so be very mindful of using it. think hard on if you actually need it and cannot just use a set of other, known, widgets to accomplish the same task. if used, the application role should be
added to the lowest common container possible, not on the <body> element, for example. specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'application' in that specification. recommendation precedence order applying the application role will cause this and all of the descendant elements of this element to be trea...
ARIA: cell role - Accessibility
, indicating the position, or index, of the cell. for example, a cell in the first row of the first header would likely have aria-rowindex="1" set, and cells in row 47 would have aria-rowindex="47", if aria-rowindex were needed due to not all rows being in the dom. if the rows that are visible are contiguous, and there are no cells with a colspan or rowspan greater than one, this property can be
added to the parent rows instead of all the rows' cells. keyboard interactions none required javascript features the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and
adding an aria role, state or property to make it accessible, then do so. employ the html <td> element instead of th...
...ne within a table header and four rows within the table body. because not all the rows are in the dom, we've included the aria-rowindex property on every cell. if no cells spanned more than one row or column, the aria-rowindex could have been placed on the row rather than the row's individual cells. best practices only use table, tbody, thead, tr, th, td, etc., for data table structure. you can
add aria roles to ensure accessibility should the native semantics of the table be removed, such as with css. a relevant use case for the aria table role is when the native semantics of a table are overridden by css's display property, such as by display: grid. in this case, you can use the aria table roles to
add the semantics back in. <table role="table" aria-label="semantic elements" aria-describ...
...windex="18">thead</td> </tr> <tr role="row"> <td role="cell" aria-rowindex="24">term</td> <td role="cell" aria-rowindex="24">dt</td> </tr> </tbody> </table> above is the semantic way of writing a table. the aria roles are not necessary if the native semantics of the table, and therefore the table rows, have not been altered, such as through the display property.
added benefits none specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria cell role' in that specification. recommendation wai-aria authoring practicesthe definition of 'aria cell role' in that specification. working draft ...
ARIA: feed role - Accessibility
a feed is a dynamic scrollable list of articles in which articles are
added to or removed from either end of the list as the user scrolls. a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads. <section role="feed" aria-busy="false"> ... <article aria-posinset="427" aria-setsize="-1">...</article> <article aria-posinset="428" aria-setsize="-1">...</article> <article aria-posinset="429" aria-setsize="-1">...</article> ... </section> description a feed is a page structure for a scrollable list of articles where scrolling may cause articles to be
added to the top or end of the list. the list establishes an interoperability contract...
...ser scrolls. implementing the feed pattern allows a screen reader to reliably read and trigger the loading of feed content while in reading mode. a feed is a container element whose children are <article>s or have role article. each article within a feed should be focusable, with tabindex of 0 or -1. an article should be scrolled into view when it, or a descendant element, receives focus. if the
addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not see the updates. to ensure good user experience, avoid inserting or removing articles in the middle of a feed, load new articles before the user has reached the end of the feed, and provide keyboard commands for m...
..., moving focus from the inner feed to the next article in the outer feed. wai-aria roles, states, and properties aria-labelled if the feed has no visible title, the feed element has a label specified with aria-label. if it does, see aria-labelledby. aria-labelledby if the feed has a visible title, the feed element has aria-labelledby referring to the element containing the title. if not,
add an aria-label. aria-busy when busy, such as when articles are being
added or removed from the feed, set aria-busy="true" during the update operation. make sure it's reset to false when the operation is complete or the changes may not become visible. article each section of content in a feed should be contained in an <article> or element with role article. each article should have an aria-labe...
ARIA: form role - Accessibility
no role specific keyboard interactions required javascript features onsubmit the onsubmit event handler handles the event raised when the form is submitted. anything that is not a <form> cannot be submitted, therefore you would have to use javascript to build an alternative data submission mechanism, for example with xmlhttprequest. ...
..."off" type="text"> <label for="email">email</label> <input id="email" name="email" autocomplete="email" autocapitalize="off" autocorrect="off" spellcheck="false" type="text"> <label for="comment">comment</label> <textarea id="comment" name="comment"></textarea> <input value="comment" type="submit"> </div> it is recommended to use <form> instead. <form id="send-comment" aria-label="
add a comment"> .... </form> accessibility concerns use sparingly landmark roles are intended to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. inputs are not forms you do not need to declare role="form" on every form element (inputs, text areas, selects, et...
...of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="form" with an of aria-label="contact form" may be announced redundantly as, "contact form form". best practices prefer html using the <form> element will automatically communicate a section has a role of form. if at all possible, prefer using it instead.
added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of '...
ARIA: gridcell role - Accessibility
lements that have role="gridcell" applied to them must be the child of an element with a role of row. ...
...ole="gridcell">496-619-5098</div> … </div> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and
adding aria. instead use the native html td element in conjunction with the and contenteditable attribute: <td>potato</td> <td>cabbage</td> <td>onion</td> description gridcells with dynamically
added, hidden, or removed rows and columns any element with a role="gridcell" applied to it should use aria to describe its order in the table-style grouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically
added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order...
...v> </div> accessibility concerns support for gridcell and certain gridcell-related aria roles and properties have poor support with assistive technologies. if at all possible, utilize native html table markup in their place. best practices the first rule of aria is: if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and
adding an aria role, state or property to make it accessible. as such, it is recommended to use the utilize native html table markup instead of recreating a table's form and functionality with aria and javascript. ...
ARIA: dialog role - Accessibility
<h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> description marking up a dialog element with the dialog role helps assistive technology identify the dialog's content as being grouped and separated from the rest of the page content. however,
adding role="dialog" alone is not sufficient to make a dialog accessible.
additionally, the following needs to be done: the dialog must be properly labeled keyboard focus must be managed correctly the sections below describe how these two requirements can be met. labeling even though it is not required for the dialog itself to be able to receive focus, it still needs to be labeled. the label...
...words, the dialog's label acts like a grouping label for the controls inside it (similar to how a <legend> element provides a grouping label for the controls inside a <fieldset> element). if a dialog already has a visible title bar, the text inside that bar can be used to label the dialog itself. the best way to achieve this is by using the aria-labelledby attribute to the role="dialog" element.
additionally, if the dialog contains
additional descriptive text besides the dialog title, this text can be associated with the dialog using the aria-describedby attribute. this approach is shown in the code snippet below: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc...
...ria dialog role and labeling techniques should make the screen reader announce the dialog's information when focus is moved into it. required javascript features focus management a dialog has particular requirements for how keyboard focus should be managed: dialogs should always have at least one focusable control. for many dialogs, there will be a button like "close", "ok" or "cancel". in
addition to the needed control, dialogs can contain any number of focusable elements, even entire forms or other container widgets like tabs. when the dialog appears on the screen, keyboard focus (whose control depends upon the dialogs purpose) should be moved to the default focusable control inside the dialog. for dialogs that only provide a basic message, it could be an "ok" button. for dialogs co...
Basic form hints - Accessibility
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="descriptionrevert">revert</button> <div id="descriptionrevert">rever...
... 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="descriptionrevert">revert</button> <div id="descriptionrevert">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 both required and aria-required. web developers typically use presentational strategies to indicate required or invalid fields. assistive technologies (ats) cannot necessarily infer this information from the presentation. aria p...
...rty can be applied to a form element, to indicate to an at that it is required to complete the form. the aria-invalid state can be programmatically applied, to indicate to an at which data fields have incorrect data, so that the user knows they have entered invalid data. the example below shows a simple form with three fields. on lines 4 and 12, the aria-required attributes are set to true (in
addition to the asterisks next to the labels), indicating that the name and email fields are required. the second part of the example, a snippet of javascript validates the email format, and sets the aria-invalid attribute of the email field (line 12 of the html) according to the result (in
addition to changing the presentation of the element). <form> <div> <label for="name">* name:</label> ...
Keyboard - Accessibility
note: one important exception to this rule is if the element has role="document" applied to it, inside an interactive context (such as role="application"). in such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). most interactive elements are focusable by default; you can make an element focusable by
adding a tabindex=0 attribute value to it. however, you should only
add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an ele...
...on't use tabindex greater than 0 clickable elements must be focusable and should have interactive semantics if an element can be clicked with a pointing device, such as a mouse, then it should also be focusable using the keyboard, and the user should be able to do something by interacting with it. an element is clickable if it has an onclick event handler defined. you can make it focusable by
adding a tabindex=0 attribute value to it. you can make it operable with the keyboard by defining an onkeydown event handler; in most cases, the action taken by event handler should be the same for both types of events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup interactive elements must be able to be activated using a keyboard if ...
.... the keyboard event handlers should enable the effectively the same interaction as the touch or click handlers. see also global event handlers: onkeydown global event handlers: onkeyup interactive elements must be focusable if the user can interact with an element (for example, using touch or a pointing device), then it should be focusable using the keyboard. you can make it focusable by
adding a tabindex=0 attribute value to it. that will
add the element to the list of elements that can be focused by pressing the tab key, in the sequence of such elements as defined in the html document. see also tabindex global html attribute focusable element must have focus styling any element that can receive keyboard focus should have visible styling that indicates when the element is foc...
Color contrast - Accessibility
/ } .good { background-color: #fae6fa; } .bad { background-color: #400064; } both pieces of text have their default black color. ...
...make the color contrast as good as it can be within your design constraints — ideally go for the aaa rating (see 1.4.6 below), but at least meet the aa rating (s...
...least 4.5:1. heading (or just larger) text should have a ratio of at least 3:1. larger text is defined as at least 18pt, or 14pt bold. 1.4.6 enhanced contrast (aaa) this follows, and builds on, criterion 1.4.3. text and its background should have a contrast ratio of at least 7:1. heading (or just larger) text should have a ratio of at least 4.5:1. 1.4.11 non-text contrast (aa) (
added in 2.1) there should be a minimum color contrast ratio of 3 to 1 for user interface components and graphical objects. ...
Text labels and names - Accessibility
<embed> and <object> elements. these elements are often used for graphical content, much like the <img> element. a descriptive title helps users of assistive technology understand what the element is showing. figures with optional captions should be labeled for best accessibility, include a <figcaption> within a <figure> element, even though doing so is technically optional. the caption is in
addition to any alternative text on images within the figure. the caption describes the purpose of the figure in the document, which may be different from a simple description of a visual item, as provided by the alternative text. example the following example shows code for a figure with a caption. the alt attribute of the <img> describes the appearance of the image; the <figcaption> describes it ...
...iation between a <label> and a form element by specifying the form element's id value as the value of the label's for attribute. example <label>i agree to the terms and conditions. <input type="checkbox" id="terms"> </label> <input type="checkbox" id="emailoptin"> <label for="emailoptin">yes, please send me news about this product.</label> form elements should have a visible text label in
addition to having a <label> for every form element, those labels should be visible, not hidden. visible labels help all users understand the purpose of a form element. do not rely on placeholder text, because it disappears as soon as the user starts typing. frame elements must be labeled frame elements, both <iframe> and the older, obsolete <frame>, must have a title to describe the contents of th...
...ave a title to describe the contents of the frame. use the title attribute to label a frame element. without a title, users of assistive technologies have to navigate into the frame in order to understand what it contains, which can be difficult and confusing. the <frame> element is no longer part of the html specification as of html5. support for it may be dropped by browsers in the future. in
addition, it is difficult for screen readers to navigate pages with <frame> elements. for best accessibility and future maintenance, redesign any pages that use frames to use css to achieve a similar layout. as a best practice, also provide a <title> for the document that is enclosed in the frame, with content identical to the frame's title attribute. (this assumes that the enclosed document is unde...
-moz-float-edge - CSS: Cascading Style Sheets
the non-standard -moz-float-edge css property specifies whether the height and width properties of the element include the margin, border, or p
adding thickness. /* keyword values */ -moz-float-edge: border-box; -moz-float-edge: content-box; -moz-float-edge: margin-box; -moz-float-edge: p
adding-box; /* global values */ -moz-float-edge: inherit; -moz-float-edge: initial; -moz-float-edge: unset; syntax values border-box the height and width properties include the content, p
adding and border but not the margin. content-box the height and width properties include the content, but not the p
adding, border or margin. ...
...-box; /* global values */ -moz-float-edge: inherit; -moz-float-edge: initial; -moz-float-edge: unset; syntax values border-box the height and width properties include the content, p
adding and border but not the margin. content-box the height and width properties include the content, but not the p
adding, border or margin. margin-box the height and width properties include the content, p
adding, border and margin. p
adding-box the height and width properties include the content and p
adding but not the border or margin. ...
...er or margin. margin-box the height and width properties include the content, p
adding, border and margin. p
adding-box the height and width properties include the content and p
adding but not the border or margin. formal definition initial valuecontent-boxapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax border-box | content-box | margin-box | p
adding-box examples html <div class="box"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> css .box { display: block; height: 5px; margin: 0.5em auto 0.5em auto; color: gray; -moz-float-edge: margin-box; box-sizing: border-box; } result specifications not part of any standard. ...
:valid - CSS: Cascading Style Sheets
nput:invalid + span::before { content: '✖'; color: red; } input:valid + span::before { content: '✓'; color: green; } we set the <span>s to position: relative so that we can position the generated content relative to them. we then absolutely position different generated content depending on whether the form's data is valid or invalid — a green check or a red cross, respectively. to
add a bit of extra urgency to the invalid data, we've also given the inputs a thick red border when invalid. note: we've used ::before to
add these labels, as we were already using ::after for the "required" labels. you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in. the email input on the other hand is valid when empt...
...typically, descriptive text and/or an icon are used. ...
...typically, descriptive text and/or an icon are used. ...
prefers-reduced-motion - CSS: Cascading Style Sheets
dicates that user has notified the system that they prefer an interface that removes or replaces the types of motion-based animation that trigger discomfort for those with vestibular motion disorders. user preferences for firefox, the reduce request is honoured if: in gtk/gnome: gnome tweaks > general tab (or appearance, depending on version) > animations is turned off. alternatively,
add gtk-enable-animations = false to the [settings] block of the gtk 3 configuration file. in windows 10: settings > ease of access > display > show animations in windows. in windows 7: control panel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible). in macos: system preferences > accessibility > display > reduce motion. in ios: settings...
...ss > display > show animations in windows. in windows 7: control panel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible). in macos: system preferences > accessibility > display > reduce motion. in ios: settings > general > accessibility > reduce motion. in android 9+: settings > accessibility > remove animations. in firefox about:config:
add a number preference called ui.prefersreducedmotion and set its value to 1. changes to this preference take effect immediately. examples this example has a scaling animation by default. if reduce motion is enabled in your accessibility preferences, the animation is toned down to a simple dissolve without vestibular motion triggers. html <div class="animation">animated box</div> css .animat...
...<div class="animation">animated box</div> css .animation { animation: pulse 1s linear infinite both; } /* tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. ...
Attribute selectors - CSS: Cascading Style Sheets
[attr=value] represents elements with an attribute name of attr whose value is exactly value. [attr~=value] represents elements with an attribute name of attr whose value is a whitespace-separated list of words, one of which is exactly value. [attr|=value] represents elements with an attribute name of attr wh...
... matches. [attr^=value] represents elements with an attribute name of attr whose value is prefixed (preceded) by value. [attr$=value] represents elements with an attribute name of attr whose value is suffixed (followed) by value. [attr*=value] represents elements with an attribute name of attr whose value contains at least one occurrence of value within the string. [attr operator value i]
adding an i (or i) before the closing bracket causes the value to be compared case-insensitively (for characters within the ascii range). [attr operator value s]
adding an s (or s) before the closing bracket causes the value to be compared case-sensitively (for characters within the ascii range). examples links css a { color: blue; } /* internal links, beginning with "#" */ a[href^="#"] {...
... selectors level 3the definition of 'attribute selectors' in that specification. recommendation css level 2 (revision 1)the definition of 'attribute selectors' in that specification. recommendation initial definition ...
Detecting CSS animation support - CSS: Cascading Style Sheets
eyframes; document.getelementsbytagname( 'head' )[ 0 ].appendchild( s ); } } this code looks at the value of animation; if it's false, we know we need to use our javascript fallback code to perform our animation. otherwise, we can use javascript to create the desired css animation effects. setting the animation property is easy; simply update its value in the style collection. however,
adding keyframes is trickier, since they're not defined using traditional css syntax (which makes them more flexible, but harder to define from script). to define our keyframes using javascript, we need to write them out as a css string. all we do is set up a keyframes variable, prefixing each attribute as it's constructed. this variable, once constructed, contains the complete description of all th...
...yntax (which makes them more flexible, but harder to define from script). to define our keyframes using javascript, we need to write them out as a css string. all we do is set up a keyframes variable, prefixing each attribute as it's constructed. this variable, once constructed, contains the complete description of all the keyframes needed by our animation sequence. the next task is to actually
add the keyframes to the page's css. the first thing to do is look to see if there's already a style sheet on the document; if so, we simply insert the keyframe description into that stylesheet; this is done in lines 13-15. if there isn't already a style sheet, a new <style> element is created, and its content is set to the value of keyframes. then the new <style> element is inserted into the docume...
... page's css. the first thing to do is look to see if there's already a style sheet on the document; if so, we simply insert the keyframe description into that stylesheet; this is done in lines 13-15. if there isn't already a style sheet, a new <style> element is created, and its content is set to the value of keyframes. then the new <style> element is inserted into the document's <head>, thereby
adding the new style sheet to the document. view on jsfiddle ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
this allows specifying arbitrary images as mouse cursors — any image format supported by gecko can be used. syntax the basic (css 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> this means that zero or more urls may be specified (comma-separated), which must be followed by one of the keywords defined in the css specification, such as auto or pointer. for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur. ...
...ed in the css specification, such as auto or pointer. for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur. if that file does not exist or is not valid for some other reason, bar.gif is tried, and if that can't be used either, auto will be used. support for the css 3 syntax for cursor values got
added in gecko 1.8 (firefox 1.5): cursor: [ <uri> [ <x> <y> ]? , ]* <keyword> it allows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image. if none are specified, the coordinates of the hotspot are read from the file itself (for cur and xbm files) or are set to the top left corner of the image. an example of the css3 syntax is: .foo { ...
... ...
CSS Basic Box Model - CSS: Cascading Style Sheets
css basic box model is a module of css that defines the rectangular boxes—including their p
adding and margin—that are generated for elements and laid out according to the visual formatting model. ...
...al formatting model. reference properties properties controlling the flow of content in a box overflow overflow-x overflow-y properties controlling the size of a box height width max-height max-width min-height min-width properties controlling the margins of a box margin margin-bottom margin-left margin-right margin-top margin-trim properties controlling the p
addings of a box p
adding p
adding-bottom p
adding-left p
adding-right p
adding-top other properties visibility guides introduction to the css box model explains one of the fundamental concept of css: the box model. this model defines how css lays out elements, including their content, p
adding, border, and margin areas. mastering margin collapsing sometimes, two adjacent margins ar...
...ent, p
adding, border, and margin areas. mastering margin collapsing sometimes, two adjacent margins are collapsed into one. this article describes the rules that govern when and why this happens, and how to control it. visual formatting model explains the visual formatting model. specifications specification status comment css basic box model working draft
added margin-trim css level 2 (revision 1) recommendation css level 1 recommendation initial definition. ...
CSS Containment - CSS: Cascading Style Sheets
entire document, which means that if you move one element the entire document needs to be treated as if things could have moved anywhere. by using contain: layout you can tell the browser it only needs to check this element — everything inside the element is scoped to that element and does not affect the rest of the page, and the containing box establishes an independent formatting context. ...
...there can be no visible overflow. the same things are true for paint containment as layout containment (see above). another advantage is that if the containing box is offscreen, the browser does not need to paint its contained elements — these must also be offscreen as they are contained completely by that box. ...
...out and paint containment. the specification describes this value as being "reasonably safe to apply widely". ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
level 3. it is expected that this spec will ultimately supersede the properties as defined in flexbox level one. the cross axis the align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column. we are making use of cross-axis alignment in the most simple flex example. if we
add display: flex to a container, the child items all become flex items arranged in a row. they will all stretch to be as tall as the tallest item, as that item is defining the height of the items on the cross axis. if your flex container has a height set, then the items will stretch to that height, regardless of how much content is in the item. the reason the items become the same height is tha...
... out the other values to see how the align-content property works. once again we can switch our flex-direction to column in order to see how this property behaves when we are working by column. as before, we need enough space in the cross axis to have some free space after displaying all of the items. note: the value space-evenly is not defined in the flexbox specification and is a later
addition to the box alignment specification. browser support for this value is not as good as that of the values defined in the flexbox spec. see the documentation for justify-content on mdn for more details on all of these values and browser support. aligning content on the main axis now that we have seen how alignment works on the cross axis, we can take a look at the main axis. here we only ha...
...o margins will take up all of the space that they can in their axis — it is how centering a block with margin auto left and right works. each side tries to take as much space as it can, and so the block is pushed into the middle. in this live example, i have flex items arranged simply into a row with the basic flex values, and the class push has margin-left: auto. you can try removing this, or
adding the class to another item to see how it works. future alignment features for flexbox at the beginning of this article i explained that the alignment properties currently contained in the level 1 flexbox specification are also included in box alignment level 3, which may well extend these properties and values in the future. we have already seen one place where this has happened, with the ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
this is that your items will all line up in a row, using the size of the content as their size in the main axis. if there are more items than can fit in the container, they will not wrap but will instead overflow. if some items are taller than others, all 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. setting flex-direction: row-reverse will keep the items displaying along the row, however the start and end lines are switched. if we change flex-direction to column the main a...
...n-reverse — to see what happens to the content. multi-line flex containers with flex-wrap while flexbox is a one dimensional model, it is possible to cause our flex items to wrap onto multiple lines. in doing so, you should consider each line as a new flex container. any space distribution will happen across that line, without reference to the lines either side. to cause wrapping behaviour
add the property flex-wrap with a value of wrap. now, should your items be too large to all display in one line, they will wrap onto another line. the live sample below contains items that have been given a width, the total width of the items being too wide for the flex container. as flex-wrap is set to wrap, the items wrap. set it to nowrap, which is also the initial value, and they will instead shr...
...ner on the main axis. the flex-grow property can be used to distribute space in proportion. if we give our first item a flex-grow value of 2 and the other items a value of 1, 2 parts will be given to the first item (100px out of 200px in the case of the example above), 1 part each the other two (50px each out of the 200px total). the flex-shrink property where the flex-grow property deals with
adding space in the main axis, the flex-shrink property controls how it is taken away. if we do not have enough space in the container to lay out our items and flex-shrink is set to a positive integer the item can become smaller than the flex-basis. as with flex-grow different values can be assigned in order to cause one item to shrink faster than others — an item with a higher value set for flex-s...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
collapse. in a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch).” - 9.4.1 for elements with an inline formatting context: “in an inline formatting context, boxes are laid out horizontally, one after the other, beginning at the top of a containing block. horizontal margins, borders, and p
adding are respected between these boxes. the boxes may be aligned vertically in different ways: their bottoms or tops may be aligned, or the baselines of text within them may be aligned. the rectangular area that contains the boxes that form a line is called a line box.” - 9.4.2 note that the css 2.1 specification describes documents as being in a horizontal, top to bottom writing mode. for exam...
...rizontally. in this guide, we will be working in english and therefore a horizontal writing mode. however, everything described should work in the same way if your document is in a vertical writing mode. as defined in the specification, the margins between two block boxes are what creates separation between the elements. we see this with a very simple layout of two paragraphs, to which i have
added a border. the default browser stylesheet
adds spacing between the paragraphs by way of
adding a margin to the top and bottom. if we set margins on the paragraph element to 0 then the borders will touch. by default block elements will consume all of the space in the inline direction, so our paragraphs spread out and get as big as they can inside their containing block. if we give them a wi...
...ectly. the line box size in the block direction (so the height when working in english) is defined by the tallest box inside it. in the next example, i have made the <strong> element 300%; that content now defines the height of the line box on that line. find out more about how block and inline boxes behave in our guide to the visual formatting model. the display property and flow layout in
addition to the rules existing in css2.1, new levels of css further describe the behaviour of block and inline boxes. the display property defines how a box and any boxes inside it behave. in the css display model level 3, we can learn more about how the display property changes the behaviour of boxes and the boxes they generate. the display type of an element defines the outer display type; this di...
Introduction to formatting contexts - CSS: Cascading Style Sheets
termost element in a document that uses block layout rules establishes the first, or initial block formatting context. this means that every element inside the <html> element's block is laid out according to normal flow following the rules for block and inline layout. elements participating in a bfc use the rules outlined by the css box model, which defines how an element's margins, borders, and p
adding interact with other blocks in the same context. creating a new block formatting context the <html> element is not the only element capable of creating a block formatting context. any block-level element can be made to create a bfc by the application of certain css properties. a new bfc is created in the following situations: elements made to float using float absolutely positioned eleme...
...becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you wish to deal with overflowing content. there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc. in
addition, it is potentially not very readable for a future developer, as it may not be obvious why you used overflow for this purpose. if you do this, it would be a good idea to comment the code to explain. explicitly creating a bfc using display: flow-root using display: flow-root (or display: flow-root list-item) on the containing block will create a new bfc without any other potentially problema...
... contexts inline formatting contexts exist inside other formatting contexts and can be thought of as the context of a paragraph. the paragraph creates an inline formatting context inside which such things as <strong>, <a>, or <span> elements are used on text. the box model does not fully apply to items participating in an inline formatting context. in a horizontal writing mode line, horizontal p
adding, borders and margin will be applied to the element and push the text away left and right. however, margins above and below the element will not be applied. vertical p
adding and borders will be applied but may overlap content above and below as, in the inline formatting context, the line boxes will not be pushed apart by p
adding and borders. other formatting contexts this guide covers flow ...
Subgrid - CSS: Cascading Style Sheets
level 2 of the css grid layout specification includes a subgrid value for grid-template-columns and grid-template-rows. this guide details what subgrid does, and gives some use cases and design patterns that are solved by the feature. important: this feature is shipped in firefox 71, which is currently the only browser to implement subgrid. introduction to subgrid when you
add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. the children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. these grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. this makes it difficul...
...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 prevent
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 specification...
... grid you can name lines on your grid and then position items based on those names rather than the line number. the line names on the parent grid are passed into the subgrid, and you can place items using them. in the below example i have named lines on the parent col-start and col-end and then used those to place the subitem. you can also specify line names on the subgrid. this is achieved by
adding a list of line names enclosed in square brackets after the subgrid keyword. if you have four lines in your subgrid, to name them all you could use the syntax grid-template-columns: subgrid [line1] [line2] [line3] [line4] lines specified on the subgrid are
added to any lines specified on the parent so you can use either or both. to demonstrate this, i have positioned one item in the example be...
CSS Logical Properties and Values - CSS: Cascading Style Sheets
the dimension parallel to the flow of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes. for standard english text, it is the horizontal dimension. ...
...border-inline-start-style border-inline-start-width border-inline-style border-inline-width border-start-start-radius border-start-end-radius border-end-start-radius border-end-end-radius border-style (logical keyword) border-width (logical keyword) margin (logical keyword) margin-block margin-block-end margin-block-start margin-inline margin-inline-end margin-inline-start p
adding (logical keyword) p
adding-block p
adding-block-end p
adding-block-start p
adding-inline p
adding-inline-end p
adding-inline-start properties for floating and positioning clear (inline-end and inline-start keywords) float (inline-end and inline-start keywords) inset inset-block inset-block-end inset-block-start inset-inline inset-inline-end inset-inline-start other properti...
... ...
Stacking context example 1 - CSS: Cascading Style Sheets
erms of stacking contexts, div #1 and div #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context div #2 (z-index 1) div #4 (z-index 2) note: div #1 and div #3 are not translucent. it is important to remember that assigning an opacity less than 1 to a positioned element implicitly creates a stacking context, just like
adding a z-index value. and this example shows what happens when a parent element does not create a stacking context. example html <div id="div1"> <br /><span class="bold">div #1</span> <br />position: relative; <div id="div2"> <br /><span class="bold">div #2</span> <br />position: absolute; <br />z-index: 1; </div> </div> <br /> <div id="div3"> <br /><span class="bold">div #3</sp...
...3"> <br /><span class="bold">div #3</span> <br />position: relative; <div id="div4"> <br /><span class="bold">div #4</span> <br />position: absolute; <br />z-index: 2; </div> </div> </body></html> css .bold { font-weight: bold; font: 12px arial; } #div1, #div3 { height: 80px; position: relative; border: 1px dashed #669966; background-color: #ccffcc; p
adding-left: 5px; } #div2 { opacity: 0.8; z-index: 1; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; z-index: 2; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #00...
...osition: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; z-index: 2; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #000099; background-color: #ddddff; text-align: left; p
adding-left: 10px; } result ...
Overview of CSS Shapes - CSS: Cascading Style Sheets
ee content flowing around the sides of a rectangular box as before. if they do have shapes support then the visual display is enhanced. basic shapes the value circle(50%) is an example of a basic shape. the specification defines four <basic-shape> values, which are: inset() circle() ellipse() polygon() using the value inset() wraps text around a rectangular shape however you are able to
add offset values, thus pulling the line boxes of any wrapping content closer to the object than would otherwise happen. we have already seen how circle() creates a circular shape. an ellipse() is essentially a squashed circle. if none of these simple shapes do the trick you can create a polygon() and make the shape as complex as you want. in our guide to basic shapes we explore each of the possibl...
... an ellipse() is essentially a squashed circle. if none of these simple shapes do the trick you can create a polygon() and make the shape as complex as you want. in our guide to basic shapes we explore each of the possible basic shapes and how to create them. shapes from the box value shapes can also be created around the box value, therefore you could create your shape on the: border-box p
adding-box content-box margin-box in the example below you can change the value border-box to any of the other allowed values to see how the shape moves closer or further away from the box. to explore the box values in more detail see our guide covering shapes from box values. shapes from images an interesting way to generate your path is to use an image with an alpha channel — the text wi...
...area of the shape. you can see the threshold in action if we use a gradient as the image on which to define our shape. in the example below, if you change the threshold the path that the shape takes changes based on the level of opacity you have selected. we take a deeper look at creating shapes from images in the shapes from images guide. the shape-margin property the shape-margin property
adds a margin to shape-outside. this will further shorten the line boxes of any content wrapping the shape, pushing it away from the shape itself. in the example below we have
added a shape-margin to a basic shape. change the margin to push the text further away from the path the shape would take by default. using generated content as the floated item in the examples above we have used images or...
Card - CSS: Cascading Style Sheets
this pattern is a list of "card" components with optional footers. requirements the card component can contain a variety of content, including a heading, image, content and a footer. each card should be the same height, and footers should stick to the bottom of the card. when
added to a collection of cards, the cards should line up in two dimensions. recipe download this example choices made the card is laid out using css grid layout despite being a single dimensional layout, as it enables the use of content sizing for the grid tracks. when setting up the single column grid i use the following: .card { display: grid; grid-template-rows: max-content 200px 1fr; } the heading track is set to max-content, which prevents it from stretching. i have decided that i want my image ...
...when setting up the single column grid i use the following: .card { display: grid; grid-template-rows: max-content 200px 1fr; } the heading track is set to max-content, which prevents it from stretching. i have decided that i want my image to live within a track that is 200 pixels tall. i then set the next track — which is where the content lives — to 1fr. this means it will take up any
additional space. if the track does have a footer it will be auto-sized, as rows created in the implicit grid are auto-sized by default. therefore this will fit the content
added to it. note: the various elements in separate cards do not align with each other, as each card is an independent grid. the proposed subgrid feature of grid level 2 would give a solution to this issue. useful fallbacks ...
...ubgrid feature of grid level 2 would give a solution to this issue. useful fallbacks or alternative methods flexbox could be used to lay out the card, in which case you should make the content area grow, and other items not grow. this would be a reasonable way to lay out the card, although i have a slight preference for being able to control the tracks from the container rather than needing to
add rules to the items. for the overall layout you could use flexbox, however this will result in cards stretching over the final flex row where there are fewer than can fit in the rows above. alternatively you could use css multi-col — this would cause the cards to lay out down the columns, which may or may not be a problem. see the columns recipe for demonstrations of each of these layout metho...
CSS reference - CSS: Cascading Style Sheets
ntirely (ascii) text-based, whereas dom-css / cssom (the rule management system) is object-based. at-rule syntax as the structure of at-rules varies widely, please see at-rule to find the syntax of the specific one you want. keyword index note: the property names in this index do not include the javascript names where they differ from the css standard names. ...
...ate:only-child:only-of-typeopacityopacity():optionalorderorientation (@viewport)@ornamentsornaments()orphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-yppad (@counter-style)p
addingp
adding-blockp
adding-block-endp
adding-block-startp
adding-bottomp
adding-inlinep
adding-inline-endp
adding-inline-startp
adding-leftp
adding-rightp
adding-top@pagepage-break-afterpage-break-beforepage-break-insidepaint()paint-orderpath()pc<percentage>perspectiveperspective()perspective-originplace-contentplace-itemsplace-self::placeholderpointer-eventspolygon()<position>positionprefix (@counter-style)...
...a():rightright@right-bottom:rootrotaterotate()rotate3d()rotatex()rotatey()rotatez()row-gapsssaturate()scalescale()scale3d()scalex()scaley()scalez():scopescroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margin-rightscroll-margin-topscroll-p
addingscroll-p
adding-blockscroll-p
adding-block-endscroll-p
adding-block-startscroll-p
adding-bottomscroll-p
adding-inlinescroll-p
adding-inline-endscroll-p
adding-inline-startscroll-p
adding-leftscroll-p
adding-rightscroll-p
adding-topscroll-snap-alignscroll-snap-stopscroll-snap-typescrollbar-colorscrollbar-width::selectionselector()sepia()<shape>shape-image-thresholdshape-marginshape-outsidesize (@page)skew...
Viewport concepts - CSS: Cascading Style Sheets
this is the viewport width. the window.innerwidth is the width, in css pixels, of the browser window viewport including, if rendered, the vertical scrollbar. the window.outerwidth is the width of the outside of the browser window including all the window chrome. in an experiment with these, the innerwidth and outerwidth was se...
...ding, if rendered, the vertical scrollbar. the window.outerwidth is the width of the outside of the browser window including all the window chrome. in an experiment with these, the innerwidth and outerwidth was seen to be the same, but the outerheight was 100px taller than the innerheight. this is because the outerheight includes the browser chrome: measurements were taken on a browser with an
address bar and bookmarks bar totalling 100px in height, but no chrome on the left or right of the window. the area within the innerheight and innerwidth is generally considered the layout viewport. the browser chrome is not considered part of the viewport. when zoomed in, both firefox and chrome report the new css pixel size for innerwidth and clientwidth. the values returned for the outerwidth an...
... and bottom of the window. but what if we had pinched-zoomed on a tablet? what if a dynamic keyboard pops open on a phone? the web contains two viewports, the layout viewport and the visual viewport. the visual viewport is the part of the web page that is currently visible in the browser and can change. when the user pinch-zooms the page, pops open a dynamic keyboard, or when a previously hidden
address bar becomes visible, the visual viewport shrinks but the layout viewport is unchanged. sticky headers or footers, as discussed above, stick to the top and bottom of the layout viewport, and therefore remain in view when we zoom in with the keyboard. if you pinch-zoom, the layout viewport may not be fully visible. if you magnify from the middle of the layout viewport, the content would expand...
background-repeat - CSS: Cascading Style Sheets
the background-position property is ignored unless only one image can be displayed without clipping. the only case where clipping happens using space is when there isn't enough room to display one image. round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room (space left >= half of the image width) for another one to be
added. when the next image is
added, all of the current ones compress to allow room. example: an image with an original width of 260px, repeated three times, might stretch until each repetition is 300px wide, and then another image will be
added. they will then compress to 225px. no-repeat the image is not repeated (and hence the background image painting area will not necessarily be ...
...repeat <div class="two"></div> </li> <li>repeat-x <div class="three"></div> </li> <li>repeat-y <div class="four"></div> </li> <li>space <div class="five"></div> </li> <li>round <div class="six"></div> </li> <li>repeat-x, repeat-y (multiple images) <div class="seven"></div> </li> </ol> css /* shared for all divs in example */ ol, li { margin: 0; p
adding: 0; } li { margin-bottom: 12px; } div { background-image: url(https://mdn.mozillademos.org/files/12005/starsolid.gif); width: 160px; height: 70px; } /* background repeats */ .one { background-repeat: no-repeat; } .two { background-repeat: repeat; } .three { background-repeat: repeat-x; } .four { background-repeat: repeat-y; } .five { background-repeat: space; } .six { ...
...con32.png); background-repeat: repeat-x, repeat-y; height: 144px; } result in this example, each list item is matched with a different value of background-repeat. specifications specification status comment css backgrounds and borders module level 3the definition of 'background-repeat' in that specification. candidate recommendation
adds support for multiple background images, the two-value syntax allowing distinct repetition behavior for the horizontal and vertical directions, the space and round keywords, and for backgrounds on inline-level elements by precisely defining the background painting area. css level 2 (revision 1)the definition of 'background-repeat' in that specification. recommendation no significan...
border-spacing - CSS: Cascading Style Sheets
e interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the border-spacing value is also used along the outside edge of the table, where the distance between the table's border and the cells in the first/last column or row is the sum of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) p
adding on the table. note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing. syntax /* <length> */ border-spacing: 2px; /* horizontal <length> | vertical <length> */ border-spacing: 1cm 2em; /* global values */ border-spacing: inherit; border-s...
...djacent columns), and the second value defines the vertical spacing between cells (i.e., the space between cells in adjacent rows). values <length> the size of the spacing as a fixed value. formal definition initial value0applies totable and inline-table elementsinheritedyescomputed valuetwo absolute lengthsanimation typediscrete formal syntax <length> <length>? examples spacing and p
adding table cells this example applies a spacing of .5em vertically and 1em horizontally between a table's cells. note how, along its outside edges, the table's p
adding values are
added to its border-spacing values. html <table> <tr> <td>1</td><td>2</td><td>3</td> </tr> <tr> <td>4</td><td>5</td><td>6</td> </tr> <tr> <td>7</td><td>8</td><td>9</td> </tr> </table> css tabl...
...es a spacing of .5em vertically and 1em horizontally between a table's cells. note how, along its outside edges, the table's p
adding values are
added to its border-spacing values. html <table> <tr> <td>1</td><td>2</td><td>3</td> </tr> <tr> <td>4</td><td>5</td><td>6</td> </tr> <tr> <td>7</td><td>8</td><td>9</td> </tr> </table> css table { border-spacing: 1em .5em; p
adding: 0 2em 1em 0; border: 1px solid orange; } td { width: 1.5em; height: 1.5em; background: #d2d2d2; text-align: center; vertical-align: middle; } result specifications specification status comment css level 2 (revision 1)the definition of 'border-spacing' in that specification. recommendation initial definition. ...
border-style - CSS: Cascading Style Sheets
of the same side's border-width. dashed displays a series of short square-ended dashes or line segments. the exact size and length of the segments are not defined by the specification and are implementation-specific. solid displays a single, straight, solid line. double displays two straight lines that
add up to the pixel size defined by border-width. groove displays a border with a carved appearance. it is the opposite of ridge. ridge displays a border with an extruded appearance. it is the opposite of groove. inset displays a border that makes the element appear embedded. it is the opposite of outset. ...
... <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <td class="b6">double</td> <td class="b7">groove</td> <td class="b8">ridge</td> </tr> <tr> <td class="b9">inset</td> <td class="b10">outset</td> </tr> </table> css /* define look of the table */ table { border-width: 3px; background-color: #52e396; } tr, td { p
adding: 2px; } /* border-style example classes */ .b1 {border-style:none;} .b2 {border-style:hidden;} .b3 {border-style:dotted;} .b4 {border-style:dashed;} .b5 {border-style:solid;} .b6 {border-style:double;} .b7 {border-style:groove;} .b8 {border-style:ridge;} .b9 {border-style:inset;} .b10 {border-style:outset;} result specifications specification status comment cs...
... css level 1the definition of 'border-style' in that specification. recommendation initial definition. ...
font-stretch - CSS: Cascading Style Sheets
you can use font-stretch to select a condensed or expanded face from such fonts. if the font you are using does not offer condensed or expanded faces, this property has no effect. font face selection the face selected for a given value of font-stretch depend...
...all values of font-stretch less than 100% select the condensed face, while all other values select the normal face. league mono variable is a variable font that offers something like a continuous range of widths for different percentage values of font-stretch. formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-li...
...erfinck.com/) and used here under the terms of the sil open font license, version 1.1: http://scripts.sil.org/cms/scripts/page.php?item_id=ofl_web */ @font-face { src: url('https://mdn.mozillademos.org/files/16014/leaguemonovariable.ttf'); font-family:'leaguemonovariable'; font-style: normal; font-stretch: 1% 500%; /* required by chrome */ } .container { border: 10px solid #f5f9fa; p
adding: 0 1rem; font: 1.5rem 'leaguemonovariable', sans-serif; } .condensed { font-stretch: 50%; } .normal { font-stretch: 100%; } .expanded { font-stretch: 200%; } result specifications specification status comment css fonts module level 4the definition of 'font-stretch' in that specification. working draft
adds the <percentage> syntax for variable...
<length> - CSS: Cascading Style Sheets
note: although <percentage> values are also css dimensions, and are usable in some of the same properties that accept <length> values, they are not themselves <length> values. see <length-percentage>. syntax the <length> data type consists of a <number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the number. the length unit is optional after the number 0. ...
...gin-left: 20px; } .results { margin-top: 10px; } .input-container { position: absolute; display: flex; justify-content: flex-start; align-items: center; height: 50px; } label { margin: 0 10px 0 20px; } javascript const inputdiv = document.queryselector('.inner'); const inputelem = document.queryselector('input'); const resultsdiv = document.queryselector('.results'); inputelem.
addeventlistener('change', () => { inputdiv.style.width = inputelem.value; const result = document.createelement('div'); result.classname = 'result'; result.style.width = inputelem.value; result.innerhtml = `<code>width: ${inputelem.value}</code>`; resultsdiv.appendchild(result); inputelem.value = ''; inputelem.focus(); }) result specifications specification status ...
...classname = 'result'; result.style.width = inputelem.value; result.innerhtml = `<code>width: ${inputelem.value}</code>`; resultsdiv.appendchild(result); inputelem.value = ''; inputelem.focus(); }) result specifications specification status comment css values and units module level 4the definition of '<length>' in that specification. editor's draft
adds the vi, vb, ic, lh, and rlh units. css values and units module level 3the definition of '<length>' in that specification. candidate recommendation
adds the ch, rem, vw, vh, vmin, vmax, and q units. css level 2 (revision 1)the definition of '<length>' in that specification. recommendation explicit definition of the em, pt, pc, and px units. css level 1the de...
linear-gradient() - CSS: Cascading Style Sheets
line passing from the box corner which is in the same quadrant. the ending point can be simply understood as the symmetrical point of the starting point. these somewhat complex definitions lead to an interesting effect sometimes called magic corners: the corners nearest to the starting and ending points have the same color as their respective starting or ending points. customizing gradients by
adding more color-stop points on the gradient line, you can create a highly customized transition between multiple colors. a color-stop's position can be explicitly defined by using a <length> or a <percentage>. if you don't specify the location of a color, it is placed halfway between the one that precedes it and the one that follows it. the following two gradients are equivalent. linear-gradient(r...
...linear-gradient(red, orange, yellow, green, blue); linear-gradient(red 0%, orange 25%, yellow 50%, green 75%, blue 100%); by default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. you can move this midpoint to any position between two color stops by
adding an unlabelled % color hint between the two colors to indicate where the middle of the color transition should be. the following example is solid red from the start to the 10% mark and solid blue from 90% to the end. between 10% and 90% the color transitions from red to blue, however the midpoint of the transition is at the 30% mark rather than 50% as would have happened without the 30% color h...
... css images module level 3the definition of 'linear-gradient()' in that specification. candidate recommendation initial definition. ...
mask - CSS: Cascading Style Sheets
e area that is affected by the mask image. see mask-clip. <compositing-operator> sets the compositing operation used on the current mask layer. see mask-composite. ...
...)<image-set()> = image-set( <image-set-option>#...
...gs>? [ <image-src>? , <color>? ]! ...
max-block-size - CSS: Cascading Style Sheets
-dick) is presented in both the horizontal-tb and vertical-rl writing modes. everything else about the two boxes is identical, including the values used for max-block-size. html the html simply establishes the two <div> blocks that will be presented with their writing-mode set using the classes horizontal or vertical. both boxes share the standard-box class, which simply establishes coloring, p
adding, and their respective values of max-block-size. <p>writing mode <code>horizontal-tb</code> (the default):</p> <div class="standard-box horizontal"> call me ishmael. some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, i thought i would sail about a little and see the watery part of the world. it is a ...
... little and see the watery part of the world. it is a way i have of driving off the spleen and regulating the circulation. </div> css the css defines three classes. the first, standard-box, is applied to both boxes, as seen above. it provides standard styling including the minimum and maximum block sizes, font size, and so forth. ...
...ss defines three classes. the first, standard-box, is applied to both boxes, as seen above. it provides standard styling including the minimum and maximum block sizes, font size, and so forth. after that come the classes horizontal and vertical, which
add the writing-mode property to the box, with the value set to horizontal-tb or vertical-rl depending on which class is used. ...
min() - CSS: Cascading Style Sheets
er when needed. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest max() and other min() functions as expression values. the expressions are full math expressions, so you can use direct
addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the
addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules. make sure to put a space on each side of the + and - operands. the operands in the expression may be any <length> syntax value. you can (...
...). mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 examples setting a maximum size for a label and input another use case for css functions is to set a maximum size on responsive form controls: enabling the width of labels and inputs to shrink as the width of the form shrinks. ...
... and input another use case for css functions is to set a maximum size on responsive form controls: enabling the width of labels and inputs to shrink as the width of the form shrinks. let's look at some css: input, label { p
adding: 2px; box-sizing: border-box; display: inline-block; width: min(40%, 400px); background-color: pink; } form { margin: 4px; border: 1px solid black; p
adding: 4px; } here, the form itself, along with the margin, border, and p
adding, will be 100% of its parent's width. we declare the input and label to be the lesser of 40% of the form width up to the p
adding or 400px wide, whichever is smaller. in other words, the widest that the label and input can be is 400px. the narrowest they will be is 40% of the form's width, which on a smartwatch's screen ...
Guide to scroll anchoring - CSS: Cascading Style Sheets
n. suppression triggers the specification also details some suppression triggers, which will disable scroll anchoring in places where it might be problematic. if any of the triggers happen on the anchor node, or an ancestor of it, anchoring is suppressed. ...
...me suppression triggers, which will disable scroll anchoring in places where it might be problematic. if any of the triggers happen on the anchor node, or an ancestor of it, anchoring is suppressed. ...
...nchoring is suppressed. these suppression triggers are changes to the computed value of any of the following properties: top, left, right, or bottom margin or p
adding any width or height-related properties transform
additionally, position changes anywhere inside the scrolling box also disable scroll anchoring. ...
overflow-block - CSS: Cascading Style Sheets
t. syntax /* keyword values */ overflow-block: visible; overflow-block: hidden; overflow-block: scroll; overflow-block: auto; /* global values */ overflow-block: inherit; overflow-block: initial; overflow-block: unset; the overflow-block property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the p
adding box's block start and block end edges. hidden content is clipped if necessary to fit the block dimension in the p
adding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the block dimension in the p
adding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content ...
...desktop browsers provide scrollbars if content overflows. ...
...sum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><code>overflow-block:scroll</code> — always
adds a scrollbar <div id="div2"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><c...
overflow-inline - CSS: Cascading Style Sheets
tax /* keyword values */ overflow-inline: visible; overflow-inline: hidden; overflow-inline: scroll; overflow-inline: auto; /* global values */ overflow-inline: inherit; overflow-inline: initial; overflow-inline: unset; the overflow-inline property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the p
adding box's inline start and end edges. hidden content is clipped if necessary to fit the inline dimension in the p
adding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the p
adding box in the inline dimension. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content cha...
...desktop browsers provide scrollbars if content overflows. ...
...overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto examples setting inline overflow behavior html <ul> <li><code>overflow-inline:hidden</code> — hides the text outside the box <div id="div1"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-inline:scroll</code> — always
adds a scrollbar <div id="div2"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-inline:visible</code> — displays the text outside the box if needed <div id="div3"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-inline:auto</code> — on most browsers, equivalent to <code>scroll</code> <...
overflow-x - CSS: Cascading Style Sheets
s a pull request. syntax /* keyword values */ overflow-x: visible; overflow-x: hidden; overflow-x: clip; overflow-x: scroll; overflow-x: auto; /* global values */ overflow-x: inherit; overflow-x: initial; overflow-x: unset; the overflow-x property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the p
adding box's left and right edges. if overflow-y is hidden, scroll or auto and this property is visible, it will implicitly compute to auto. hidden content is clipped if necessary to fit horizontally in the p
adding box. no scrollbars are provided. clip like for hidden, the content is clipped to the element's p
adding box. the difference between clip and hidden is that the clip keyword also forbi...
...lipped to the element's p
adding box. the difference between clip and hidden is that 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 horizontally in the p
adding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents 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 p
adding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide sc...
...hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto examples html <ul> <li><code>overflow-x:hidden</code> — hides the text outside the box <div id="div1"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-x:scroll</code> — always
adds a scrollbar <div id="div2"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-x:visible</code> — displays the text outside the box if needed <div id="div3"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-x:auto</code> — on most browsers, equivalent to <code>scroll</code> <div id="di...
overflow-y - CSS: Cascading Style Sheets
y: scroll; overflow-y: auto; /* global values */ overflow-y: inherit; overflow-y: initial; overflow-y: unset; the overflow-y property is specified as a single keyword chosen from the list of values below. if overflow-x is hidden, scroll or auto and this property is visible (default) it will implicitly compute to auto. values visible content is not clipped and may be rendered outside the p
adding box's top and bottom edges. hidden content is clipped if necessary to fit vertically in the p
adding box. no scrollbars are provided. clip like for hidden, the content is clipped to the element's p
adding box. the difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a ...
... clipped to the element's p
adding box. the difference between clip and hidden is that 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 vertically in the p
adding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents 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 p
adding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide sc...
...m ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><code>overflow-y:scroll</code> — always
adds a scrollbar <div id="div2"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><c...
overflow - CSS: Cascading Style Sheets
alues */ overflow: inherit; overflow: initial; overflow: unset; the overflow property is specified as one or two keywords chosen from the list of values below. if two keywords are specified, the first applies to overflow-x and the second to overflow-y. otherwise, both overflow-x and overflow-y are set to the same value. values visible content is not clipped and may be rendered outside the p
adding box. hidden content is clipped if necessary to fit the p
adding box. no scrollbars are provided, and no support for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. the content can be scrolled programmatically (for example, by setting the value of a property such as offsetleft), so the element is still a scroll container. clip like for hidden, the cont...
...ped if necessary to fit the p
adding box. no scrollbars are provided, and no support for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. the content can be scrolled programmatically (for example, by setting the value of a property such as offsetleft), so the element is still a scroll container. clip like for hidden, the content is clipped to the element's p
adding box. the difference between clip and hidden is that 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 p
adding box. browsers always display scrollba...
...desktop browsers provide scrollbars if content overflows. overlay behaves the same as auto, but with the scrollbars drawn on top of content instead of taking up space. ...
Used value - CSS: Cascading Style Sheets
<div id="width-50"> <p>explicit width: 50%.</p> <p class="show-used-width">..</p> <div id="width-inherit"> <p>explicit width: inherit.</p> <p class="show-used-width">..</p> </div> </div> </div> css #no-width { width: auto; } #width-50 { width: 50%; } #width-inherit { width: inherit; } /* make results easier to see */ div { border: 1px solid red; p
adding: 8px; } javascript function updateusedwidth(id) { var div = document.queryselector(`#${id}`); var par = div.queryselector('.show-used-width'); var wid = window.getcomputedstyle(div)["width"]; par.textcontent = `used width: ${wid}.`; } function updateallusedwidths() { updateusedwidth("no-width"); updateusedwidth("width-50"); updateusedwidth("width-inherit"); } updateallusedwid...
...then, css 2.1 introduced the distinct definition of used value. an element could then explicitly inherit a width/height of a parent, whose computed value is a percentage. for css properties that don't depend on layout (e.g., dis...
...line-height), the computed values and used values are the same. the following are the css 2.1 properties that do depend on layout, so they have a different computed value and used value: (taken from css 2.1 changes: specified, computed, and actual values): background-position bottom, left, right, top height, width margin-bottom, margin-left, margin-right, margin-top min-height, min-width p
adding-bottom, p
adding-left, p
adding-right, p
adding-top text-indent specification specification status comment css level 2 (revision 2)the definition of 'used value' in that specification. working draft no change. css level 2 (revision 1)the definition of 'used value' in that specification. recommendation initial definition. ...
Media buffering, seeking, and time ranges - Developer guides
dio = document.getelementbyid('my-audio'); var mycanvas = document.getelementbyid('my-canvas'); var context = mycanvas.getcontext('2d'); context.fillstyle = 'lightgray'; context.fillrect(0, 0, mycanvas.width, mycanvas.height); context.fillstyle = 'red'; context.strokestyle = 'white'; var inc = mycanvas.width / myaudio.duration; // display timeranges myaudio.
addeventlistener('seeked', function() { for (i = 0; i < myaudio.buffered.length; i++) { var startx = myaudio.buffered.start(i) * inc; var endx = myaudio.buffered.end(i) * inc; var width = endx - startx; context.fillrect(startx, 0, width, mycanvas.height); context.rect(startx, 0, width, mycanvas.height); context.stroke(); } }); } thi...
... block; height: 100%; background-color: #777; width: 0; } .progress { margin-top: -20px; height: 20px; position: relative; width: 300px; } #progress-amount { display: block; height: 100%; background-color: #595; width: 0; } and the following javascript provides our functionality: window.onload = function(){ var myaudio = document.getelementbyid('my-audio'); myaudio.
addeventlistener('progress', function() { var duration = myaudio.duration; if (duration > 0) { for (var i = 0; i < myaudio.buffered.length; i++) { if (myaudio.buffered.start(myaudio.buffered.length - 1 - i) < myaudio.currenttime) { document.getelementbyid("buffered-amount").style.width = (myaudio.buffered.end(myaudio.buffered.length - 1 - i) / duration) * 10...
... the timeupdate event is fired 4 ti...
Block formatting context - Developer guides
becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you want to deal with overflowing content. there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc. in
addition, it is potentially not readable for a future developer, as it might not be obvious why you used overflow for this purpose. if you use overflow, it is a good idea to comment the code to explain. using display: flow-root a newer value of display lets us create a new bfc without any other potentially problematic side-effects. using display: flow-root on the containing block creates a new bfc ...
... html <section> <div class="float">try to resize this outer float</div> <div ...
... note that flexbox is a more efficient way to implement muti columns layout in morden css. margin collapsing creating a new bfc to avoid the margin collapsing between two neighbor div: html <div class="blue"></div> <div class="red-outer"> <div class="red-inne...
Mutation events - Developer guides
esign is flawed (see details in the "dom mutation events replacement: the story so far / existing points of consensus" post to public-webapps). mutation observers are the proposed replacement for mutation 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...
...}, false); the event object is passed to the listener in a mutationevent (see its definition in the specification) for most events, and mutationnameevent for domattributenamechanged and domelementnamechanged. ...
...}, false); the event object is passed to the listener in a mutationevent (see its definition in the specification) for most events, and mutationnameevent for domattributenamechanged and domelementnamechanged. ...
Parsing and serializing XML - Developer guides
alizes dom trees, converting them into strings containing xml. domparser constructs a dom tree by parsing a string containing xml, returning a xmldocument or document as appropriate based on the input data. xmlhttprequest loads content from a url; xml content is returned as an xml document object with a dom tree built from the xml itself. xpath a technology for creating strings that contain
addresses for specific portions of an xml document, and locating xml nodes based on those
addresses. creating an xml document using one of the following approaches to create an xml document (which is an instance of document. parsing strings into dom trees this example converts an xml fragment in a string into a dom tree using a domparser: var smystring = '<a id="a"><b id="b">hey!</b></a>'; var...
...n xml fragment in a string into a dom tree using a domparser: var smystring = '<a id="a"><b id="b">hey!</b></a>'; var oparser = new domparser(); var odom = oparser.parsefromstring(smystring, "application/xml"); // print the name of the root element or error message console.log(odom.documentelement.nodename == "parsererror" ? ...
... if the d...
Writing forward-compatible websites - Developer guides
<div onclick="alert(ownerdocument)">click me</div> then clicking on the text alerts the ownerdocument of the div. this happens even if there is a var ownerdocument declared in global scope. what this means is that any time you access a global variable in an event handler content attribute, including calling any function declared globally, you can end up with a name collision if a specification
adds a new dom property to elements or documents which has the same name as your function or variable, and a browser implements it. if that happens, then suddenly your function stops being called. this has happened multiple times to various sites already during the evolution of html5. to avoid this, fully qualify global variable access using "window.", like so: <script> function localname() { ...
...ent object available in event handlers. don't assume that browsers with support for a given dom feature must also have some other, especially nonstandard, dom feature. or, conversely, that they don't have support for some other feature (e.g., don't assume that a browser that supports onload on script elements will never support onreadystatechange on them). as browsers converge behavior, they both
add features and remove them. they also fix bugs. all three of these have happened in the past and will happen again. so don't sniff for one feature or object and then assume that, because it exists or doesn't exist, some other feature or object must also exist or not exist. don't ua-sniff this is really a particularly common instance of assuming that one feature (the presence of a particular sub...
... to target past browser versions of particular browsers. first, have a default code path that runs in unknown browsers and in the current and future versions of browsers you are testing with. then, if the default code path doesn't work in past versions of particular browsers and the breakage cannot be detected by sniffing for the absence of certain features your default code path uses, it's ok to
add hacks that are targeted to old versions of particular browsers by sniffing for those old browser versions. for the purpose of this piece of advice, "current" means the most recent version of a browser you have tested. for example, if you have tested that your default code path runs properly in firefox aurora but firefox beta and the latest release have a bug that make your default code path fail...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
<bdi>. examples no <bdi> with only ltr this example lists the winners of a competition using <span> elements only. when the names only contain ltr text the results look fine: <ul> <li><span class="name">henrietta boffin</span> - 1st place</li> <li><span class="name">jerry cruncher</span> - 2nd place</li> </ul> body { border: 1px solid #3f87a6; max-width: calc(100% - 40px - 6px); p
adding: 20px; width: calc(100% - 40px - 6px); border-width: 1px 1px 1px 5px; } no <bdi> with rtl text this example lists the winners of a competition using <span> elements only, and one of the winners has a name consisting of rtl text. in this case the "- 1", which consists of characters with neutral or weak directionality, will adopt the directionality of the rtl text, and the result will...
...text. in this case the "- 1", which consists of characters with neutral or weak directionality, will adopt the directionality of the rtl text, and the result will be garbled: <ul> <li><span class="name">اَلأَعْشَى</span> - 1st place</li> <li><span class="name">jerry cruncher</span> - 2nd place</li> </ul> body { border: 1px solid #3f87a6; max-width: calc(100% - 40px - 6px); p
adding: 20px; width: calc(100% - 40px - 6px); border-width: 1px 1px 1px 5px; } using <bdi> with ltr and rtl text this example lists the winners of a competition using <bdi> elements. these elements instruct the browser to treat the name in isolation from its embedding context, so the example output is properly ordered: <ul> <li><bdi class="name">اَلأَعْشَى</bdi> - 1st place</...
... of a competition using <bdi> elements. these elements instruct the browser to treat the name in isolation from its embedding context, so the example output is properly ordered: <ul> <li><bdi class="name">اَلأَعْشَى</bdi> - 1st place</li> <li><bdi class="name">jerry cruncher</bdi> - 2nd place</li> </ul> body { border: 1px solid #3f87a6; max-width: calc(100% - 40px - 6px); p
adding: 20px; width: calc(100% - 40px - 6px); border-width: 1px 1px 1px 5px; } specifications specification status comment html living standardthe definition of '<bdi>' in that specification. living standard html5the definition of '<bdi>' in that specification. recommendation ...
<button>: The Button element - HTML: Hypertext Markup Language
...
...t and generate an accessibility tree. assistive technology then uses the accessibility tree to navigate and manipulate page content. to give an icon button an accessible name, put text in the <button> element that concisely describes the button's functionality. example <button name="favorite"> <svg aria-hidden="true" viewbox="0 0 10 10"><path d="m7 9l5 8 3 9v6l1 4h3l1-3 1 3h3l7 6z"/></svg>
add to favorites </button> if you want to visually hide the button's text, an accessible way to do so is to use a combination of css properties to remove it visually from the screen, but keep it parseable by assistive technology. however, it is worth noting that leaving the button text visually apparent can aid people who may not be familiar with the icon's meaning or understand the button's purpo...
...content — including buttons — placed in close visual proximity to each other should have space separating them. this spacing is beneficial for people who are experiencing motor control issues, who may accidentally activate the wrong interactive content. spacing may be created using css properties such as margin. hand tremors and the giant-button-problem - axess lab firefox firefox will
add a small dotted border on a focused button. this border is declared through css in the browser stylesheet, but you can override it to
add your own focused style using button::-moz-focus-inner { }. if overridden, it is important to ensure that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it. color contras...
<footer> - HTML: Hypertext Markup Language
xamples and send us a pull request. content categories flow content, palpable content. permitted content flow content, but with no <footer> or <header> descendants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. note that a <footer> element must not be a descendant of an <
address>, <header> or another <footer> element. implicit aria role contentinfo, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement attributes this element only include...
...fo, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement attributes this element only includes the global attributes. usage notes enclose information about the author in an <
address> element that can be included into the <footer> element. the <footer> element is not sectioning content and therefore doesn't introduce a new section in the outline. examples <footer> some copyright info or perhaps some author info for an <article>? </footer> accessibility concerns the voiceover screen reader has an issue where the footer landmark role is not announced in the...
...an be included into the <footer> element. the <footer> element is not sectioning content and therefore doesn't introduce a new section in the outline. examples <footer> some copyright info or perhaps some author info for an <article>? </footer> accessibility concerns the voiceover screen reader has an issue where the footer landmark role is not announced in the landmark rotor. to
address this,
add role="contentinfo" to the footer element. webkit bugzilla: 146930 – ax: html native elements (header, footer, main, aside, nav) should work the same as aria landmarks, sometimes they don't specifications specification status comment html living standardthe definition of '<footer>' in that specification. living standard html5the def...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
this wrapping; you can choose to simplify it by leaving out the external <kbd> element. in other words, simplifying this to just <kbd>ctrl</kbd>+<kbd>n</kbd> would be perfectly valid. depending on your style sheet, though, you may find it useful to do this kind of nesting. ...
...ose to simplify it by leaving out the external <kbd> element. in other words, simplifying this to just <kbd>ctrl</kbd>+<kbd>n</kbd> would be perfectly valid. depending on your style sheet, though, you may find it useful to do this kind of nesting. ...
.../kbd> would be perfectly valid. depending on your style sheet, though, you may find it useful to do this kind of nesting. ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
ository. 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, palpable content. permitted content phrasing content. tag omission the start tag is required. the end tag may be omitted if the <p> element is immediately followed by an <
address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element. permitted parents any element that accepts flow content. implicit a...
.../i>. ...
...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 previous 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 screen reader. if extra space is desired, use css properties like margin to create the effect: p { margin-bottom: 2em; // incr...
Microdata - HTML: Hypertext Markup Language
provide a simpler way of annotating html elements with machine-readable tags than the similar approaches of using rdfa and classic microformats. at a high level, microdata consists of a group of name-value pairs. the groups are called items, and each name-value pair is a property. items and properties are represented by regular elements. to create an item, the itemscope attribute is used. to
add a property to an item, the itemprop attribute is used on one of the item's descendants. vocabularies google and other major search engines support the schema.org vocabulary for structured data. this vocabulary defines a standard set of type names and property names, for example, schema.org music event indicates a concert performance, with startdate and location properties to specify the concer...
...yandex, a major search engine in russia, supports microformats such as hcard (company contact information), hrecipe (food recipe), hreview (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 more successful. global attributes itemid – the unique, global identifier of an item. itemprop – used to
add properties to an item. every html element may have an itemprop attribute specified, where an itemprop consists of a name and value pair. itemref – pro...
... itemscope – itemscope (usually) works along with itemtype to specify that the html contained in a block is about a particular item. itemscope creates the item and defines the scope of the itemtype associated with it. ...
HTML: Hypertext Markup Language
the functionality you need for interacting with websites, e.g. registering and logging in, sending feedback, buying products, and more. this module gets you started with creating the client-side/front-end parts of forms. use html to solve common problems provides links to sections of content explaining how to use html to solve very common problems when creating a web page: dealing with titles,
adding images or videos, emphasizing content, creating a basic form, etc. advanced topics cors enabled image the crossorigin attribute, in combination with an appropriate cors header, allows images defined by the <img> element to be loaded from foreign origins and used in a <canvas> element as if they were being loaded from the current origin. cors settings attributes some html elements that ...
...ding to performance improvements. this article provides a basic guide to how preload works. references html reference html consists of elements, each of which may be modified by some number of attributes. html documents are connected to each other with links. html element reference browse a list of all html elements. html attribute reference elements in html have attributes. these are
additional values that configure the elements or adjust their behavior in various ways. global attributes global attributes may be specified on all html elements, even those not specified in the standard. this means that any non-standard elements must still permit these attributes, even though those elements make the document html5-noncompliant. inline elements and block-level elements html eleme...
...contexts and is disallowed in others. similarly, each has a set of other content categories they can contain and elements that can or can't be used in them. this is a guide to these categories. quirks mode and standards mode historical information on quirks mode and standards mode. related topics applying color to html elements using css this article covers most of the ways you use css to
add color to html content, listing what parts of html documents can be colored and what css properties to use when doing so. includes examples, links to palette-building tools, and more. view all... ...
Identifying resources on the Web - HTTP
he web are mostly given by a single url (uniform resource locator, a kind of uri). there are sometimes reasons identity and location are not given by the same uri: http uses a specific http header, alt-svc when the resource requested wants the client to access it at another location. urls and urns urls the most common form of uri is the uniform resource locator (url), which is known as the web
address. https://developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's
address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others are optional. a more complex example might look like this: http://www.example.com:80/path/to/myfi...
...ent) or ftp: to handle file transfer, so don't be surprised if you see such protocols. common schemes are: scheme description data data uris file host-specific file names ftp file transfer protocol http/https hyper text transfer protocol (secure) javascript url-embedded javascript code mailto electronic mail
address ssh secure shell tel telephone urn uniform resource names view-source source code of the resource ws/wss (encrypted) websocket connections authority www.example.com is the domain name or authority that governs the namespace. it indicates which web server is being requested. alternatively, it is possible to directly use an...
... ssh secure shell tel telephone urn uniform resource names view-source source code of the resource ws/wss (encrypted) websocket connections authority www.example.com is the domain name or authority that governs the namespace. it indicates which web server is being requested. alternatively, it is possible to directly use an ip
address, but because it is less convenient, it is not often used on the web. port :80 is the port in this instance. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. path /path/to...
CORS errors - HTTP
p in question and open the developer tools. now try to reproduce the failing transaction and check the console if you are seeing a cors violation error message. it will probably look like this: the text of the error message will be something similar to the following: cross-origin request blocked: the same origin policy disallows reading the remote resource at https://some-url-here. (reason:
additional information here). note: for security reasons, specifics about what went wrong with a cors request are not available to javascript code. all the code knows is that an error occurred. the only way to determine what specifically went wrong is to look at the browser's console for details. cors error messages firefox's console displays messages in its console when requests fail due to cor...
...fics about what went wrong with a cors request are not available to javascript code. all the code knows is that an error occurred. the only way to determine what specifically went wrong is to look at the browser's console for details. cors error messages firefox's console displays messages in its console when requests fail due to cors. ...
...sages in its console when requests fail due to cors. part of the error text is a "reason" message that provides
added insight into what went wrong. the reason messages are listed below; click the message to open an article explaining the error in more detail and offering possible solutions. ...
Content negotiation - HTTP
ept-language). though strictly speaking user-agent is not in this list, it is sometimes also used to send a specific representation of the requested resource, though this is not considered as a good practice. the server uses the vary header to indicate which headers it actually used for content negotiation (or more precisely the associated response headers), so that caches can work optimally. in
addition to these, there is an experimental proposal to
add more headers to the list of available headers, called client hints. client hints advertise what kind of device the user agent runs on (for example, if it is a desktop computer or a mobile device). even if server-driven content negotiation is the most common way to agree on a specific representation of a resource, it has several drawbacks: ...
... it is comma-separated lists of mime types, each combined with a quality factor, a parameter indicating the relative degree of preference between the different mime types. the accept header is defined by the browser, or any other user-agent, and can vary according to the context, like fetching an html page or an image, a video, or a script: it is different when fetching a document entered in the
address bar or an element linked via an <img>, <video> or <audio> element. browsers are free to use the value of the header that they think is the most adequate; an exhaustive list of default values for common browsers is available. the accept-ch header this is part of an experimental technology called client hints. initial support is in chrome 46 or later. the device-memory value is in chrome 6...
...ontent negotiation phase. the header is needed in order to inform the cache of the decision criteria so that it can reproduce it, allowing the cache to be functional while preventing serving erroneous content to the user. 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. 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 w...
Access-Control-Allow-Headers - HTTP
(requests without http cookies or http authentication 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. examples a custom header here's an example of what an access-control-allow-headers header might look like. ...
... access-control-allow-headers: accept example preflight request let's look at an example of a preflight request involving access-control-allow-headers. ...
... access-control-allow-headers: accept example preflight request let's look at an example of a preflight request involving access-control-allow-headers. ...
Clear-Site-Data - HTTP
all directives must comply with the quoted-string grammar. a directive that does not include the double quotes is invalid. "cache" indicates that the server wishes to remove locally cached data (i.e. the browser cache, see http caching) for the origin of the response url. depending on the browser, this might also clear out things like pre-rendered pages, script caches, webgl shader caches, or
address bar suggestions. "cookies" indicates that the server wishes to remove all cookies for the origin of the response url. http authentication credentials are also cleared out. this affects the entire registered domain, including subdomains. so https://example.com as well as https://stage.example.com, will have cookies cleared. "storage" indicates that the server wishes to remove all dom stora...
...rregistration.unregister), appcache, websql databases, filesystem api data, plugin data (flash via npp_clearsitedata). "executioncontexts" indicates that the server wishes to reload all browsing contexts for the origin of the response (location.reload). "*" (wildcard) indicates that the server wishes to clear all types of data for the origin of the response. ...
...origin of the response (location.reload). "*" (wildcard) indicates that the server wishes to clear all types of data for the origin of the response. if more data types are
added in future versions of this header, they will also be covered by it. examples sign out of web site if a user signs out of your website or service, you might want to remove locally stored data. ...
CSP: base-uri - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
... content-security-policy: base-uri <source> <source>; sources while this directive uses the same arguments as other csp directives, some of them don’t make sense for `<base>`, such as the keywords 'unsafe-inline' and 'strict-dynamic' <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
...e-inline' are ignored. see script-src for an example. 'report-sample' requires a sample of the violating code to be included in the violation report. examples meta tag configuration <meta http-equiv="content-security-policy" content="base-uri 'self'"> apache configuration <ifmodule mod_headers.c> header set content-security-policy "base-uri 'self'"; </ifmodule> nginx configuration
add_header content-security-policy "base-uri 'self';" violation case since your domain isn't example.com, a <base> element with its href set to https://example.com will result in a csp violation. <meta http-equiv="content-security-policy" content="base-uri 'self'"> <base href="https://example.com/"> // error: refused to set the document's base uri to 'https://example.com/' // because it violates ...
CSP: default-src - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
... 1 directive type fetch directive syntax one or more sources can be allowed for the default-src policy: content-security-policy: default-src <source>; content-security-policy: default-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
... content security policy level 2the definition of 'default-src' in that specification. recommendation initial definition. ...
CSP: script-src-attr - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...source>; content-security-policy: script-src-attr <source> <source>; script-src-attr can be used in conjunction with script-src: content-security-policy: script-src <source>; content-security-policy: script-src-attr <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
...me time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored. see script-src for an example. 'report-sample' requires a sample of the violating code to be included in the violation report. examples fallback to script-src if script-src-attr is absent, user agent falls back to the script-src directive, and if that is absent as well, to default-src. todo:
add comprehensive examples. specifications specification status comment content security policy level 3the definition of 'script-src-attr' in that specification. working draft initial definition. ...
CSP: script-src-elem - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...source>; content-security-policy: script-src-elem <source> <source>; script-src-elem can be used in conjunction with script-src: content-security-policy: script-src <source>; content-security-policy: script-src-elem <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
...me time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored. see script-src for an example. 'report-sample' requires a sample of the violating code to be included in the violation report. examples fallback to script-src if script-src-elem is absent, user agent falls back to the script-src directive, and if that is absent as well, to default-src. todo:
add comprehensive examples. specifications specification status comment content security policy level 3the definition of 'script-src-elem' in that specification. working draft initial definition. ...
CSP: style-src-attr - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...-attr <source>; content-security-policy: style-src-attr <source> <source>; style-src-attr can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-attr <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
... the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applied only to inline scripts. csp 3.0 allows it in the case of script-src for external scripts. 'report-sample' requires a sample of the violating code to be included in the violation report. examples todo:
add examples specifications specification status comment content security policy level 3the definition of 'style-src-attr' in that specification. working draft initial definition. ...
CSP: style-src-elem - HTTP
examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...m <source>; content-security-policy: style-src-elem <source> <source>; style-src-elem can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-elem <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.examp...
... the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applied only to inline scripts. csp 3.0 allows it in the case of script-src for external scripts. 'report-sample' requires a sample of the violating code to be included in the violation report. examples todo:
add examples specifications specification status comment content security policy level 3the definition of 'style-src-elem' in that specification. working draft initial definition. ...
Forwarded - HTTP
the reverse proxy servers that is altered or lost when a proxy is involved in the path of the request. 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. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy. this can be either: ...
...e client. therefore the user's privacy must be kept in mind when deploying this header. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy. this can be either: an ip
address (v4 or v6, optionally with a port, and ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made). by=<identifier> the interface where the request came in to the proxy server. for=<identifier> the client that ini...
... x-forwarded-for: 123.34.567.89 forwarded: for=123.34.567.89 x-forwarded-for: 192.0.2.43, "[2001:db8:cafe::17]" forwarded: for=192.0.2.43, for="[2001:db8:cafe::17]" specifications specification title rfc 7239, section 4: forwarded forwarded http extension ...
Firefox user agent string reference - HTTP
the recommended way to do this, if it's absolutely necessary (remember that it slows down every request) is t...
...1) gecko/20100101 firefox/10.0.1 seamonkey/2.7.1 implementation notes for applications, vendors, and extensions prior to firefox 4 and gecko 2.0, it was possible for extensions to
add user agent parts through the general.useragent.extra.identifier preferences, (see the obsolete user agent strings reference). but that has not been possible since bug 581008. in the past, specific plug-ins,
add-ons or extensions
added user agent parts to notify sites they were installed. the recommended way to do this, if it's absolutely necessary (remember that it slows down every request) is to set a custom http header. see also firefox os user agent string (blog post w/bug 777710 reference) final user agent string for firefox 4 (blog post) recommendations on sniffing the ua string for cross-bro...
...to notify sites they were installed. ...
HTTP Messages - HTTP
y other header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the type of the header. the whole header, including its value, presents as a single line. there are numerous response headers available. these can be divided into several groups: general headers, like via, apply to the whole message. response headers, like vary and accept-ranges, give
additional information about the server which doesn't fit in the status line. entity headers, like content-length, apply to the body of the response. typically, no such headers are transmitted when there is no body in the response. body the last part of a response is the body. not all responses have one: responses with a status code that sufficiently answers the request without the need for cor...
... more efficient than cold ones. http/2 introduces an extra step: it divides http/1.x messages into frames which are embedded in a stream. data and header frames are separated, this allows header compression. several streams can be combined together, a process called multiplexing, allowing more efficient underlying tcp connections. http frames are now transparent to web developers. ...
...n
additional step in http/2, between http/1.1 messages and the underlying transport protocol. no changes are needed in the apis used by web developers to utilize http frames; when available in both the browser and the server, http/2 is switched on and used. conclusion http messages are the key in using http; their structure is simple, and they are highly extensible. the http/2 framing mechanism
adds a new intermediate layer between the http/1.x syntax and the underlying transport protocol, without fundamentally modifying it: building upon proven mechanisms. ...
Equality comparisons and sameness - JavaScript
either positively or negatively signed. this is useful in representing certain mathematical solutions, but as most situations don't care about the difference between +0 and -0, strict equality treats them as the same value. the second is that floating point includes the concept of a not-a-number value, nan, to represent the solution to certain ill-defined mathematical problems: negative infinity
added to positive infinity, for example. strict equality treats nan as unequal to every other value -- including itself. (the only case in which (x !== x) is true is when x is nan.) loose equality using == loose equality compares two values for equality, after converting both values to a common type. after conversions (one or both sides may undergo conversions), the final equality comparison is per...
...e console.log(obj == str); // true console.log(null == undefined); // true // both false, except in rare cases console.log(obj == null); console.log(obj == undefined); in most cases, using loose equality is discouraged. the result of a comparison using strict equality is easier to predict, and may evaluate more quickly due to the lack of type coercion. same-value equality same-value equality
addresses a final use case: determining whether two values are functionally identical in all contexts. (this use case demonstrates an instance of the liskov substitution principle.) one instance occurs when an attempt is made to mutate an immutable property: //
add an immutable negative_zero property to the number constructor. object.defineproperty(number, 'negative_zero', { va...
...ion of the other. for example, someone might say that double equals is an extended version of triple equals, because the former does everything that the latter does, but with type conversion on its operands. e.g., 6 == "6". (alternatively, someone might say that double equals is the baseline, and triple equals is an enhanced version, because it requires the two operands to be the same type, so it
adds an extra constraint. which one is the better model for understanding depends on how you choose to view things.) however, this way of thinking about the built-in sameness operators is not a model that can be stretched to allow a place for es2015's object.is on this "spectrum". object.is isn't simply "looser" than double equals or "stricter" than triple equals, nor does it fit somewhere in betwee...
Regular expressions - JavaScript
h. if using the regexp constructor with a string literal, remember that the backslash is an escape in string literals, so to use it in the regular expression, you need to escape it at the string literal level. /a\*b/ and new regexp("a\\*b") create the same expression, which searches for "a" followed by a literal "*" followed by "b". if escape strings are not already part of your pattern you can
add them using string.replace: function escaperegexp(string) { return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string } the "g" after the regular expression is an option or flag that performs a global search, looking in the whole string and returning all matches. it is explained in detail below in advanced searching with flags. why isn't this built into jav...
...ction escaperegexp(string) { return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string } the "g" after the regular expression is an option or flag that performs a global search, looking in the whole string and returning all matches. it is explained in detail below in advanced searching with flags. why isn't this built into javascript? there is a proposal to
add such a function to regexp, but it was rejected by tc39. using parentheses parentheses around any part of the regular expression pattern causes that part of the matched substring to be remembered. once remembered, the substring can be recalled for other use. see groups and ranges for more details. using regular expressions in javascript regular expressions are used with the regexp methods test...
... regexp.prototype.unicode y perform a "sticky" search that matches starting at the current position in the target string. see sticky. regexp.prototype.sticky to include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new regexp('pattern', 'flags'); note that the flags are an integral part of a regular expression. they cannot be
added or removed later. for example, re = /\w+\s/g creates a regular expression that looks for one or more characters followed by a space, and it looks for this combination 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('\...
JavaScript technologies overview - JavaScript
however, the umbrella term "javascript" as understood in a web browser context contains several very different elements. one of them is the core language (ecmascript), another is the collection of the web apis, including the dom (document object model). javascript, the core language (ecmascript) the core language of javascript is standardized by the ecma tc39 committee as a language named ecmascript. ...
...ement ecmascript 5.1 and ecmascript 2015, but older versions (still in use) implement ecmascript 5 only. future the major 6th edition of ecmascript was officially approved and published as a standard on june 17, 2015 by the ecma general assembly. since then ecmascript editions are published on a yearly basis. internationalization api the ecmascript internationalization api specification is an
addition to the ecmascript language specification, also standardized by ecma tc39. the internationalization api provides collation (string comparison), number formatting, and date-and-time formatting for javascript applications, letting the applications choose the language and tailor the functionality to their needs. the initial standard was approved in december 2012; the status of implementations in...
...ed on a yearly basis and browsers constantly improve their implementation. dom apis webidl the webidl specification provides the glue between the dom technologies and ecmascript. the core of the dom the document object model (dom) is a cross-platform, language-independent convention for representing and interacting with objects in html, xhtml and xml documents. objects in the dom tree may be
addressed and manipulated by using methods on the objects. the w3c standardizes the core document object model, which defines language-agnostic interfaces that abstract html and xml documents as objects, and also defines mechanisms to manipulate this abstraction. among the things defined by the dom, we can find: the document structure, a tree model, and the dom event architecture in dom core: node...
Array.prototype.reduceRight() - JavaScript
rst call 10 4 4 [0, 1, 2, 3, 4] 14 second call 14 3 3 [0, 1, 2, 3, 4] 17 third call 17 2 2 [0, 1, 2, 3, 4] 19 fourth call 19 1 1 [0, 1, 2, 3, 4] 20 fifth call 20 0 0 [0, 1, 2, 3, 4] 20 the value returned by reduceright this time would be, of course, 20. polyfill reduceright was
added to the ecma-262 standard in the 5th edition; as such it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of reduceright in implementations which do not natively support it. // production steps of ecma-262, edition 5, 15.4.4.22 // reference: http://es5.github.io/#x15.4.4.22 if ('fun...
...cat(b); }, []); // flattened is [4, 5, 2, 3, 0, 1] run a list of asynchronous functions with callbacks in series each passing their results to the next const waterfall = (...functions) => (callback, ...args) => functions.reduceright( (composition, fn) => (...results) => fn(composition, ...results), callback )(...args); const randint = max => math.floor(math.random() * max) const
add5 = (callback, x) => { settimeout(callback, randint(1000), x + 5); }; const mult3 = (callback, x) => { settimeout(callback, randint(1000), x * 3); }; const sub2 = (callback, x) => { settimeout(callback, randint(1000), x - 2); }; const split = (callback, x) => { settimeout(callback, randint(1000), x, x); }; const
add = (callback, x, y) => { settimeout(callback, randint(1000), x + y); }; c...
...imeout(callback, randint(1000), x * 3); }; const sub2 = (callback, x) => { settimeout(callback, randint(1000), x - 2); }; const split = (callback, x) => { settimeout(callback, randint(1000), x, x); }; const
add = (callback, x, y) => { settimeout(callback, randint(1000), x + y); }; const div4 = (callback, x) => { settimeout(callback, randint(1000), x / 4); }; const computation = waterfall(
add5, mult3, sub2, split,
add, div4); computation(console.log, 5) // -> 14 // same as: const computation2 = (input, callback) => { const f6 = x=> div4(callback, x); const f5 = (x, y) =>
add(f6, x, y); const f4 = x => split(f5, x); const f3 = x => sub2(f4, x); const f2 = x => mult3(f3, x);
add5(f2, input); } difference between reduce and reduceright var a = ['1', '2',...
Array.prototype.map() - JavaScript
o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let new_array = arr.map(function callback( currentvalue[, index[, array]]) { // return element for new_array }[, thisarg]) parameters callback function that is called for every element of arr. each time callback executes, the returned value is
added to new_array. the callback function accepts the following arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional value to use as this when executing callback. return value a new array with each element being the re...
...g elements of the array are changed, their value as passed to callback will be the value at the time map visits them. elements that are deleted after the call to map begins and before being visited are not visited. due to the algorithm defined in the specification, if the array which map was called upon is sparse, resulting array will also be sparse keeping same indices blank. polyfill map was
added to the ecma-262 standard in the 5th edition. therefore, it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of map in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, and array have t...
...s = document.queryselectorall('select option:checked') let values = array.prototype.map.call(elems, function(obj) { return obj.value }) an easier way would be the array.from() method. tricky use case (inspired by this blog post) it is common to use the callback with one argument (the element being traversed). certain functions are also commonly used with one argument, even though they take
additional optional arguments. these habits may lead to confusing behaviors. consider: ["1", "2", "3"].map(parseint) while one might expect [1, 2, 3], the actual result is [1, nan, nan]. parseint is often used with one argument, but takes two. the first is an expression and the second is the radix to the callback function, array.prototype.map passes 3 arguments: the element the index the arr...
Intl.Locale.prototype.collation - JavaScript
cjk characters (used in chinese) trad traditional style ordering (such as in spanish) unihan pinyin ordering for latin, unihan radical-stroke ordering for cjk characters (used in chinese) zhuyin pinyin ordering for latin, zhuyin order for bopomofo and cjk characters (used in chinese) examples like other locale subtags, the collation type can be
added to the intl.locale object via the locale string, or a configuration object argument to the constructor.
adding a collation type via the locale string in the unicode locale string spec, collation types are locale key "extension subtags". these subtags
add additional data about the locale, and are
added to locale identifiers by using the -u extension. thus, the collation type can be
added to th...
...ument to the constructor.
adding a collation type via the locale string in the unicode locale string spec, collation types are locale key "extension subtags". these subtags
add additional data about the locale, and are
added to locale identifiers by using the -u extension. thus, the collation type can be
added to the inital locale identifier string that is passed into the locale constructor. to
add the collation type, first
add the -u extension to the string. next,
add the -co extension to indicate that you are
adding a collation type. finally,
add the collation to the string. ...
...set the collation property of the configuration object to your desired collation type, and then pass it into the constructor. ...
Intl.Locale - JavaScript
ect that represents a unicode locale identifier. description the intl.locale object was created to allow for easier manipulation of unicode locales. unicode represents locales with a string, called a locale identifier. the locale identifier consists of a language identifier and extension tags. language identifiers are the core of the locale, consisting of language, script, and region subtags. ...
... constructor intl.locale() creates a new locale object. ...
... constructor intl.locale() creates a new locale object. instance properties intl.locale.prototype.basename returns basic, core information about the locale in the form of a substring of the complete data string. ...
Object.preventExtensions() - JavaScript
the object.preventextensions() method prevents new properties from ever being
added to an object (i.e. prevents 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.preventextensions(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.preventextensions() 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...
...urn value the object being made non-extensible. description an object is extensible if new properties can be
added to it. object.preventextensions() 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 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.preventextensions() only prevents
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.
...ions // object.preventextensions returns the object // being made non-extensible. var obj = {}; var obj2 = object.preventextensions(obj); obj === obj2; // true // objects are extensible by default. var empty = {}; object.isextensible(empty); // === true // ...but that can be changed. object.preventextensions(empty); object.isextensible(empty); // === false // object.defineproperty throws when
adding // a new property to a non-extensible object. var nonextensible = { removable: true }; object.preventextensions(nonextensible); object.defineproperty(nonextensible, 'new', { value: 8675309 }); // throws a typeerror // in strict mode, attempting to
add new properties // to a non-extensible object throws a typeerror. function fail() { 'use strict'; // throws a typeerror nonextensible.ne...
WeakSet - JavaScript
against circular data structures by tracking which objects have already been processed. weaksets are ideal for this purpose: // execute a callback on everything stored inside an object function execrecursively(fn, subject, _refs = null){ if(!_refs) _refs = new weakset(); // avoid infinite recursion if(_refs.has(subject)) return; fn(subject); if("object" === typeof subject){ _refs.
add(subject); for(let key in subject) execrecursively(fn, subject[key], _refs); } } const foo = { foo: "foo", bar: { bar: "bar" } }; foo.bar.baz = foo; // circular reference! execrecursively(obj => console.log(obj), foo); here, a weakset is created on the first run, and passed along with every subsequent function call (using the internal _refs parameter). the number of objects or thei...
... and passed along with every subsequent function call (using the internal _refs parameter). the number of objects or their traversal order is immaterial, so a weakset is more suitable (and performant) than a set for tracking object references, especially if a very large number of objects is involved. constructor weakset() creates a new weakset object. ...
....prototype.
add(value) appends value to the weakset object. weakset.prototype.delete(value) removes value from the weakset. weakset.prototype.has(value) will return false afterwards. weakset.prototype.has(value) returns a boolean asserting whether value is present in the weakset object or not. examples using the weakset object const ws = new weakset(); const foo = {}; const bar = {}; ws.
add(foo); ws.
add(bar); ws.has(foo); // true ws.has(bar); // true ws.delete(foo); // removes foo from the set ws.has(foo); // false, foo has been removed ws.has(bar); // true, bar is retained note that foo !== bar. while they are similar objects, they are not the same object. and so they are both
added to the set. specifications specification ecmascript (ecma-262...
Grouping operator ( ) - JavaScript
scription the grouping operator consists of a pair of parentheses around an expression or sub-expression to override the normal operator precedence so that expressions with lower precedence can be evaluated before an expression with higher priority. as it sounds, it groups what's inside of the parentheses. ...
...ists of a pair of parentheses around an expression or sub-expression to override the normal operator precedence so that expressions with lower precedence can be evaluated before an expression with higher priority. as it sounds, it groups what's inside of the parentheses. examples using the grouping operator overriding multiplication and division first, then
addition and subtraction to evaluate
addition first. ...
...an expression with higher priority. as it sounds, it groups what's inside of the parentheses. examples using the grouping operator overriding multiplication and division first, then
addition and subtraction to evaluate
addition first. var a = 1; var b = 2; var c = 3; // default precedence a + b * c // 7 // evaluated by default like this a + (b * c) // 7 // now overriding precedence //
addition before multiplication (a + b) * c // 9 // which is equivalent to a * c + b * c // 9 specifications specification ecmascript (ecma-262)the definition of 'the grouping operator' in that specification. ...
Operator precedence - JavaScript
ll request. precedence and associativity consider an expression describable by the representation below. note that both op1 and op2 are fill-in-the-blanks for operators. a op1 b op2 c if op1 and op2 have different precedence levels (see the table below), the operator with the highest precedence goes first and associativity does not matter. observe how multiplication has higher precedence than
addition and executed first, even though
addition is written first in the code. console.log(3 + 10 * 2); // logs 23 console.log(3 + (10 * 2)); // logs 23 because parentheses here are superfluous console.log((3 + 10) * 2); // logs 26 because the parentheses change the order left-associativity (left-to-right) means that it is processed as (a op1 b) op2 c, while right-associativity (right-to-left) ...
...lsy" a ?? (b || c); // evaluate `a` first, then produce `a` if `a` is not `null` and not `undefined` a?.b.c; // evaluate `a` first, then produce `undefined` if `a` is `null` or `undefined` examples 3 > 2 && 2 > 1 // returns true 3 > 2 > 1 // returns false because 3 > 2 is true, then true is converted to 1 // in inequality operators, therefore true > 1 becomes 1 > 1, which // is false.
adding parentheses makes things clear: (3 > 2) > 1. table the following table is ordered from highest (21) to lowest (1) precedence. precedence operator type associativity individual operators 21 grouping n/a ( … ) 20 member access left-to-right … . … computed member access left-to-right … [ … ] new (with argu...
...ation - … prefix increment ++ … prefix decrement -- … typeof typeof … void void … delete delete … await await … 16 exponentiation right-to-left … ** … 15 multiplication left-to-right … * … division … / … remainder … % … 14
addition left-to-right … + … subtraction … - … 13 bitwise left shift left-to-right … << … bitwise right shift … >> … bitwise unsigned right shift … >>> … 12 less than left-to-right … < … less than or equal … <= … greater than … > … greater than or equal …...
delete operator - JavaScript
strict vs. non-strict mode when in strict mode, if delete is used on a direct reference to a variable, a function argument or a function name, it will throw a syntaxerror. therefore, to avoid syntax errors in strict mode, you must use the...
...mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in strict mode. ...
... 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, preventing 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 want to use an ordered associative array in a cross-browser environment, use a map object if available, or simulate this structure with two separate arrays (one for the keys and the ot...
new operator - JavaScript
(not null, false, 3.1415 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. ...
... 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. (normally constructors don't return a value, but they can choose to do so if they want to override the normal object creation process.) you can always
add a property to a previously 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 must
add the property to the definition of the car object type. you can
add a shared property to a previously defined object type by using the function.prototype property. this defines a property that is shared by all objects ...
...for more information, see prototype. ...
async function - JavaScript
ardless of the order of rejection of the promises, and the error will always occur within the configured promise chain, enabling it to be caught in the normal way. rewriting a promise chain with an async function an api that returns a promise will result in a promise chain, and it splits the function into many parts. ...
... return await promisevalue vs. return ...
...). return await promisevalue vs. return promisevalue the implicit wrapping of return values in promise.resolve does not imply that return await promisevalue is functionally equivalent to return promisevalue. consider the following rewrite of the above code. it returns null if processdatainworker rejects with an error: async function getprocesseddata(url) { let v try { v = await downlo
addata(url) } catch(e) { v = await downloadfallbackdata(url) } try { return await processdatainworker(v) // note the `return await` vs. just `return` } catch (e) { return null } } writing return processdatainworker(v) would have caused the promise returned by the function to reject, instead of resolving to null if processdatainworker(v) rejects. this highlights the subtle di...
for...in - JavaScript
...
...s of an object in an arbitrary order (see the delete operator for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). if a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. a property that is deleted before it has been visited will not be visited later. ...
...n, at least in a cross-browser setting). if a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. a property that is deleted before it has been visited will not be visited later. properties
added to the object over which iteration is occurring may either be visited or omitted from iteration. in general, it is best not to
add, modify, or remove properties from the object during iteration, other than the property currently being visited. there is no guarantee whether an
added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted. array iteration and for...in note: for...in s...
JavaScript typed arrays - JavaScript
javascript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers. as you may already know, array objects grow and shrink dynamically and can have any javascript value. javascript engines perform optimizations so that these arrays are fast. however, as web applications become more and more powerful,
adding features such as audio and video manipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data. this is where typed arrays come in. each entry in a javascript typed array is a raw binary value in one of a number of supported formats, from 8-bit integers to 64-bit floating-point n...
...ith different types of data, for example. typed array views are in the native byte-order (see endianness) of your platform. with a dataview you are able to control the byte-order. it is big-endian by default and can be set to little-endian in the getter/setter methods. web apis using typed arrays these are some examples of apis that make use of typed arrays; there are others, and more are being
added all the time. filereader.prototype.readasarraybuffer() the filereader.prototype.readasarraybuffer() method starts reading the contents of the specified blob or file. xmlhttprequest.prototype.send() xmlhttprequest instances' send() method now supports typed arrays and arraybuffer objects as argument. imagedata.data is a uint8clampedarray representing a one-dimensional array containing th...
...aybuffer(24); // ... read the data into the buffer ... let idview = new uint32array(buffer, 0, 1); let usernameview = new uint8array(buffer, 4, 16); let amountdueview = new float32array(buffer, 20, 1); then you can access, for example, the amount due with amountdueview[0]. note: the data structure alignment in a c structure is platform-dependent. take precautions and considerations for these p
adding differences. conversion to normal arrays after processing a typed array, it is sometimes useful to convert it back to a normal array in order to benefit from the array prototype. this can be done using array.from(), or using the following code where array.from() is unsupported. let typedarray = new uint8array([1, 2, 3, 4]), normalarray = array.prototype.slice.call(typedarray); normalarr...
<mstyle> - MathML
attributes dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). decimalpoint this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. ...
...p and movablelimits on <mo>. infixlinebreakstyle specifies the default linebreakstyle to use for infix operators. the values before, after and duplicate are allowed. scriptlevel controls mostly the font-size. the higher the scriptlevel, the smaller the font size. this attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. in
addition, the scriptlevel attribute can never reduce the font size below scriptminsize in order to avoid unreadable small font sizes and depends on the multiplier specified in scriptsizemultiplier. scriptminsize specifies a minimum font size allowed due to changes in scriptlevel. the default value is 8pt. scriptsizemultiplier specifies the multiplier to be used to adjust font size due to changes ...
...nsize specifies a minimum font size allowed due to changes in scriptlevel. the default value is 8pt. scriptsizemultiplier specifies the multiplier to be used to adjust font size due to changes in scriptlevel. the default value is 0.71. the <mstyle> element accepts all attributes of all presentation elements with the following exceptions: height, depth or width do not apply to <mglyph>, <mp
added> or <mtable>. rowalign, columnalign, or groupalign do not apply to <mtr>, <mlabeledtr>, <mtd> or <maligngroup>. lspace or voffset do not apply to <mp
added>. fontfamily does not apply to <mglyph>. align does not apply to <mtable> or <mstack>. index cannot be set on <mstyle>. src and alt on <mglyph> cannot be set on <mstyle>. actiontype on <maction> cannot be set on <mstyle>. examples u...
Introduction to progressive web apps - Progressive web apps (PWAs)
e technology. they represent a new philosophy for building web apps, involving some specific patterns, apis, and other features. it's not that obvious if a web app is a pwa or not from first glance. an app could be considered a pwa when it meets certain requirements, or implements a set of given features: works offline, is installable, is easy to synchronize, can send push notifications, etc. in
addition, there are tools to measure how complete (as a percentage) a web app is, such as lighthouse. by implementing various technological advantages, we can make an app more progressive, thus ending up with a higher lighthouse score. but this is only a rough indicator. there are some key principles a web app should try to observe to be identified as a pwa. it should be: discoverable, so the con...
...ontent 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 which may even be based on your own site, which only
adds to the confusion. web apps eliminate that confusion and ensure that users get the best possible experience. browser support as mentioned before, pwas don't depend on a single api, but rather using various technologies to achieve the goal of delivering the best web experience possible. the key ingredient required for pwas is service worker support. thankfully service workers are now supporte...
...owser support as mentioned before, pwas don't depend on a single api, but rather using various technologies to achieve the goal of delivering the best web experience possible. the key ingredient required for pwas is service worker support. thankfully service workers are now supported on all major browsers on desktop and mobile. other features such as web app manifest, push notifications, and
add to home screen functionality have wide support too. currently, safari has limited support for web app manifest and
add to home screen and no support for web push notifications. however, other major browsers support all these features. above all you should follow the progressive enhancement rule: use technologies that enhance the appearance and utility of your app when they're available, but stil...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
very useful when combined with them. let’s look at them in isolation to begin with. request permission to show a notification, we have to request permission to do so first. instead of showing the notification immediately though, best practice dictates that we should show the popup when the user requests it by clicking on a button: var button = document.getelementbyid("notifications"); button.
addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if(result === 'granted') { randomnotification(); } }); }); this shows a popup using the operating system’s own notifications service: when the user confirms to receive notifications, the app can then show them. the result of the user action can be default, granted...
...lowing everyone to send push messages unsecured using your app would be a terrible idea. see the web push data encryption test page for detailed information about securing the server. the server stores all the information received when the user subscribed, so the messages can be sent later on when needed. to receive push messages, we can listen to the push event in the service worker file: self.
addeventlistener('push', function(e) { /* ... */ }); the data can be retrieved and then shown as a notification to the user immediately. this, for example, can be used to remind the user about something, or let them know about new content being available in the app. push example push needs the server part to work, so we're not able to include it in the js13kpwa example hosted on github pages, as i...
... ttl: req.body.ttl }; settimeout(function() { webpush.sendnotification(subscription, payload, options) .then(function() { res.sendstatus(201); }) .catch(function(error) { console.log(error); res.sendstatus(500); }); }, req.body.delay * 1000); }); }; service-worker.js the last file we will look at is the service worker: self.
addeventlistener('push', function(event) { const payload = event.data ? event.data.text() : 'no payload'; event.waituntil( self.registration.shownotification('serviceworker cookbook', { body: payload, }) ); }); all it does is
add a listener for the push event, create the payload variable consisting of the text taken from the data (or create a string to use if ...
Media - Progressive web apps (PWAs)
ent that is disabled or read-only has the disabled attribute or the readonly attribute. selectors can specify these attributes like any other attributes, by using square brackets: [disabled] or [readonly]. ...
...ond section...</p> <div id="print-head"> heading for paged media </div> <div id="print-foot"> page: </div> </body> </html> make a new stylesheet, style4.css. ...
... 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 preview) 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... page: 1 ...
Progressive web apps (PWAs)
an app-like format. pwa advantages pwas should be discoverable, installable, linkable, network independent, progressive, re-engageable, responsive, and safe. to find out more about what these mean, read progressive web app advantages. to find out how to implement pwas, read through our pwa developer guide. documentation <-- the temporary automatic list below will be replaced soon -->
add to home screen
add to home screen (or a2hs for short) is a feature available in modern browsers that allows a user to "install" a web app, ie.
add a shortcut to their home screen representing their favorite web app (or site) so they can subsequently access it with a single tap. this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.
...ing their favorite web app (or site) so they can subsequently access it with a single tap. this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.how to make pwas installablein this article, we learned about how we can make pwas installable with a properly-configured web manifest, and how the user can then install the pwa with the "
add to home screen" feature of their browser.how to make pwas re-engageable using notifications and pushhaving the ability to cache the contents of an app to work offline is a great feature. 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 deli...
...earn the essentials behind the web push api. using the notifications api — web notifications in a nutshell. the building blocks of responsive design — learn the basics of responsive design, an essential topic for modern app layout. mobile first — often when creating responsive application layouts, it makes sense to create the mobile layout as the default, and build wider layouts on top.
add to home screen guide — learn how your apps can take advantage of
add to home screen (a2hs). tools localforage — a nice simple javascript library for making client-side data storage really simple; it uses indexeddb by default and falls back to web sql/web storage if necessary. serviceworkerware — an express-like microframework for easy service worker development. oghliner — not on...
<a> - SVG: Scalable Vector Graphics
it is very similar to html’s <a> element. svg's <a> element is a container, which means you can create a link around text (like in html) but also around any shape. ...
... see warning below */ svg|a:link, svg|a:visited { cursor: pointer; } svg|a text, text svg|a { fill: blue; /* even for text, svg uses fill over color */ text-decoration: underline; } svg|a:hover, svg|a:active { outline: dotted 1px blue; } since this elemen...
... none; animatable: yes hreflang the human language of the url or url fragment that the hyperlink points to. value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. for a more widely-supported feature
addressing the same use cases, see navigator.sendbeacon(). value type: <list-of-urls> ; default value: none; animatable: no referrerpolicy which referrer to send when fetching the url. value type: no-referrer|no-referrer-when-downgrade|same-origin|origin|strict-origin|origin-when-cross-origin|strict-origin-when-cross-origin|unsafe-url ; default value: none; animatable: no rel the relationsh...
<animate> - SVG: Scalable Vector Graphics
the svg <animate> element provides a way to animate an attribute of an element over time. ...
... accessibility concerns blinking and flashing animation can be problemat...
...attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes this element implements the svganimateelement interface. accessibility concerns blinking and flashing animation can be problematic for people with cognitive concerns such as attention deficit hyperactivity disorder (adhd).
additionally, certain kinds of motion can be a trigger for vestibular disorders, epilepsy, and migraine and scotopic sensitivity. consider providing a mechanism for pausing or disabling animation, as well as using the reduced motion media query to create a complimentary experience for users who have expressed a preference for no animated experiences. designing safer web animation for motion sensi...
<script> - SVG: Scalable Vector Graphics
the svg script element allows to
add scripts to an svg document. ...
...scripts to an svg document. ...
... value type: <string>; default value: ?; animatable: yes href the url to the script to load. ...
<set> - SVG: Scalable Vector Graphics
the svg <set> element provides a simple means of just setting the value of an attribute for a specified duration. it supports all attribute types, including those that cannot reasonably be interpolated, such as string and boolean values. for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-
additive. ...
... the svg <set> element provides a simple means of just setting the value of an attribute for a specified duration. it supports all attribute types, including those that cannot reasonably be interpolated, such as string and boolean values. for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-
additive. ...
... duration. it supports all attribute types, including those that cannot reasonably be interpolated, such as string and boolean values. for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-
additive. the
additive and accumulate attributes are not allowed, and will be ignored if specified. ...
Namespaces crash course - SVG: Scalable Vector Graphics
way. scripting in namespaced xml namespaces affect not only markup, but also scripting. if you write scripts for namespaced xml such as svg, read on. the dom level 1 recommendation was created before the original namespaces in xml recommendation was released; therefore, dom1 isn't namespace aware. this causes problems for namespaced xml such as svg. to resolve these problems, dom level 2 core
added namespace aware equivalents of all the applicable dom level 1 methods. when scripting svg, it is important to use the namespace aware methods. the table below lists the dom1 methods that shouldn't be used in svg, along with their equivalent dom2 counterparts that should be used instead. dom1 (don't use) dom2 (use these instead!) createattribute createattributens ...
...that shouldn't be used in svg, along with their equivalent dom2 counterparts that should be used instead. ...
...declarations when creating new svg files. if you don't already have one, make one up starting with the following code: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> </svg> even if you don't use all those namespaces in a particular document, there's no harm in including the namespace declarations. it may save you from some annoying errors if you end up
adding content from one of the unused namespaces at a later date. a full example for a full example see svg: namespaces crash course: example. ...
Introduction - SVG: Scalable Vector Graphics
whether or not to use it often depends on your specific use case. basic ingredients html provides elements for defining headers, paragraphs, tables, and so on. in much the same way svg provides elements for circles, rectangles, and simple and complex curves. a simple svg document consists of nothing more than the <svg> root element and several basic shapes that build a graphic together. in
addition there is the <g> element, which is used to group several basic shapes together. starting from there, the svg image can become arbitrarily complex. svg supports gradients, rotations, filter effects, animations, interactivity with javascript, and so on. but all these extra features of the language rely on this relatively small set of elements to define the graphics area. before you start th...
... placed inside quotes, even if they are numbers. svg is a huge specification. this tutorial attempts to cover the basics. once you are familiar you should be able to use the element reference and the interface reference to find out anything else you need to know. flavors of svg since becoming a recommendation in 2003, the most recent "full" svg version is 1.1. it builds on top of svg 1.0, but
adds more modularization to ease implementation. the second edition of svg 1.1 became a recommendation in 2011. "full" svg 1.2 was meant to be the next major release of svg. it was dropped for the upcoming svg 2.0, which is under heavy development right now and follows a similar approach to css 3 in that it splits components into several loosely coupled specifications. apart from the full svg recomm...
...ese two profiles are aimed mainly at mobile devices. the first, svg tiny, should yield graphics primitives for small devices with low capabilities. svg basic offers many features of full svg, but doesn't include the ones which are hard to implement or heavy to render (like animations). in 2008, svg tiny 1.2 became a w3c recommendation. there were plans for an svg print specification, which would
add support for multiple pages and enhanced color management. this work was discontinued. « previousnext » ...
Using shadow DOM - Web Components
documents). as an example, consider the following html fragment: <!doctype html> <html> <head> <meta charset="utf-8"> <title>simple dom example</title> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will
add a link to the <a href="https://www.mozilla.org/">mozilla homepage</a></p> </section> </body> </html> this fragment produces the following dom structure: shadow dom allows hidden dom trees to be attached to elements in the regular dom tree — this shadow dom tree starts with a shadow root, underneath which can be attached to any elements you want, in the same way as the normal dom. ...
...om is attached to. shadow tree: the dom tree inside the shadow dom. shadow boundary: the place where the shadow dom ends, and the regular dom begins. shadow root: the root node of the shadow tree. you can affect the nodes in the shadow dom in exactly the same way as non-shadow nodes — for example appending children or setting attributes, styling individual nodes using element.style.foo, or
adding style to the entire shadow dom tree inside a <style> element. the difference is that none of the code inside a shadow dom can affect anything outside it, allowing for handy encapsulation. note that the shadow dom is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element. think for example of a <video> element, with the default b...
...img.src = imgurl; icon.appendchild(img); styling the shadow dom after that we create a <style> element and populate it with some css to style it: // create some css to apply to the shadow dom let style = document.createelement('style'); style.textcontent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; p
adding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; position: absolute; bottom: 20px; left: 10px; z-index: 3; } img { width: 1.2rem; } .icon:hover + .info, .icon:focus + .info { opacity: 1; }`; attaching the shadow dom to the shadow root the final step is to attach all the created elements to the shadow root: // attach the created element...
Introduction to using XPath in JavaScript - XPath
of the node to be retrieved. the total number of nodes contained can be accessed through the snapshotlength property. snapshots do not change with document mutations, so unlike the iterators, the snapshot does not become invalid, but it may not correspond to the current document, for example, the nodes may have been moved, it might contain nodes that no longer exist, or new nodes could have been
added. snapshot example var nodessnapshot = document.evaluate('//phonenumber', documentnode, null, xpathresult.ordered_node_snapshot_type, null ); for ( var i=0 ; i < nodessnapshot.snapshotlength; i++ ) { alert( nodessnapshot.snapshotitem(i).textcontent ); } first node when the specified result type in the resulttype parameter is either: any_unordered_node_type first_ordered_node_type t...
...rned from our expression, any further calls to iteratenext() will return null. evaluating against an xml document within an extension the following uses an xml document located at chrome://yourextension/content/peopledb.xml as an example. ...
... at chrome://yourextension/content/peopledb.xml as an example. ...
XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes xpath stands for xml path language. it uses a non-xml syntax to provide a flexible way of
addressing (pointing to) different parts of an xml document. it can also be used to test
addressed nodes within a document to determine whether they match a pattern or not. xpath is mainly used in xslt, but can also be used as a much more powerful way of navigating through the dom of any xml-like language document using xpathexpression, such as html and svg, instead of relying on the document.getelementbyid() or parentnode.queryselectorall() methods, the node.childnodes properties, and other dom core features. xpath uses a path notation (as in urls) for navigating through the hierarchical structure of an xm...
...ll. if you need a polyfill, you may consider js-xpath or wicked-good-xpath. documentation introduction to using xpath in javascript describes a non-xslt use of xpath. xpath:axes list and definition of the axes defined in the xpath specification. axes are used to describe the relationships between nodes. xpath:functions list and description of the core xpath functions and xslt-specific
additions to xpath. transforming xml with xslt xslt uses xpath to
address code segments in an xml document that it wishes to transform. xpath snippets these are javascript utility functions, that can be used in your own code, based on dom level 3 xpath apis. what is xslt? this extensive introduction to xslt and xpath assumes no prior knowledge of the technologies, and guides the reader through...
...ere are some cases in which the whole content of an xml document must be read from the javascript interpreter (like for web-apps languages or settings xml documents, for example). in these cases jxon could represent the most practical way and valid alternative to xpath. view all... tools chropath xpath panel that integrates tightly into firebug, providing an editor and inspector (firefox
add-on). xmlquire (formerly known as sketchpath) a graphical xpath builder/debugger(.net). xpath tester an online xpath builder/debugger. related topics xslt, xquery, xml, dom, jxon, jsonpath comparison of css selectors and xpath ...
Compiling from Rust to WebAssembly - WebAssembly
ultiple versions of rust. by default, it installs the latest stable rust release, which you can use for general rust development. rustup installs rustc, the rust compiler, as well as cargo, rust's package manager, rust-std, rust's standard libraries, and some helpful docs — rust-docs. note: pay attention to the post-install note about needing cargo's bin directory in your system path. this is
added automatically, but you must restart your terminal for it to take effect. wasm-pack to build the package, we need an
additional tool, wasm-pack. this helps compile the code to webassembly, as well as produce the right packaging for npm. to download and install it, enter the following command into your terminal: $ cargo install wasm-pack install node.js we are building an npm package in thi...
...e externally defined functions. the attribute says "wasm-bindgen knows how to find these functions". the third line is a function signature, written in rust. it says "the alert function takes one argument, a string named s." as you might suspect, this is the alert function provided by javascript. we call this function in the next section. whenever you want to call javascript functions, you can
add them to this file, and wasm-bindgen takes care of setting everything up for you. not everything is supported yet, but we're working on it. please file bugs if something is missing. producing rust functions that javascript can call the final part is this one: #[wasm_bindgen] pub fn greet(name: &str) { alert(&format!("hello, {}!", name)); } once again, we see the #[wasm_bindgen] attribute. ...
...ackage] name = "hello-wasm" version = "0.1.0" authors = ["your name <you@example.com>"] description = "a sample project with wasm-pack" license = "mit/apache-2.0" repository = "https://github.com/yourgithubusername/hello-wasm" [lib] crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2" fill in your own repository and use the same info that git uses for the authors field. the big part to
add is the stuff at the bottom. the first part — [lib] — tells rust to build a cdylib version of our package; we won't get into what that means in this tutorial. for more, consult the cargo and rust linkage documentation. the last section is the [dependencies] section. here's where we tell cargo what version of wasm-bindgen we want to depend on; in this case, that's any 0.2.z version (but not 0.
Compiling an Existing C Module to WebAssembly - WebAssembly
make canvas same size as image const canvas = document.createelement('canvas'); canvas.width = img.width; canvas.height = img.height; // draw image onto canvas const ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); return ctx.getimagedata(0, 0, img.width, img.height); } now it's "only" a matter of copying the data from javascript into wasm. ...
...t up again: #include <stdlib.h> // required for malloc definition emscripten_keepalive uint8_t* create_buffer(int width, int height) { return malloc(width * height * 4 * sizeof(uint8_t)); } emscripten_keepalive void destroy_buffer(uint8_t* p) { free(p); } the create_buffer() function allocates a buffer for the rgba image — hence 4 bytes per pixel. the pointer returned by malloc() is the
address of the first memory cell of that buffer. when the pointer is returned to javascript land, it is treated as just a number. after exposing the function to javascript using cwrap, you can use that number to find the start of our buffer and copy the image data: const api = { version: module.cwrap('version', 'number', []), create_buffer: module.cwrap('create_buffer', 'number', ['number', 'num...
...esultpointer); note: new uint8array(somebuffer) will create a new view onto the same memory chunk, while new uint8array(sometypedarray) will copy the data. depending on the size of your image, you might run into an error where wasm can't grow the memory enough to accommodate both the input and the output image: luckily, the solution to this problem is in the error message. you just need to
add -s allow_memory_growth=1 to your compilation command. and there you have it. you have compiled a webp encoder and transcoded a jpeg image to webp. to prove that it worked, turn your result buffer into a blob and use it on an <img> element: const blob = new blob([result], {type: 'image/webp'}); const bloburl = url.createobjecturl(blob); const img = document.createelement('img'); img.src = blobur...
2015 MDN Fellowship Program - Archive of obsolete content
programmable shaders and the opengl, opengl es, webgl, or direct3d apis. command of javascript and module systems preferred. mentor information nick desaulniers, sleeps at desk. github: nickdesaulniers twitter: @lostoracle web app performance brief project description web performance is a feature that needs to be considered from serving content to rendering to interactivity. finding and
addressing performance bottlenecks depends on tooling the browser networking and rendering but also, often more important, user perception. activities and deliverables help us develop a curriculum on mdn for teaching developers to master performance tooling and to develop web apps with performance as a feature. required skills and experience experienced web developer with expertise in javascript,...
...curriculum development brief project description mdn serves as a trusted resource for literally millions of developers on a regular basis. in 2015, mdn will expand the impact of this content by developing kits of key learning materials, including such elements as code samples, videos and other elements being finalized. activities and deliverables act as lead curator for technical curriculum
addressing a key web technology, developing code samples, videos, interactive exercises and other components to be determined. you may propose your own subject area (examples: virtual reality on the web, network security, css, etc.) or we will work with you to match you to the best subject based on your background and mozilla priorities. required skills and experience experienced web developer with...
Loading Content Scripts - Archive of obsolete content
contentscript option, which enables you to pass in the text of the script itself as a string literal. this version of the api avoids the need to maintain a separate file for the content script. the contentscriptfile option enables you to pass in the local file url from which the content script will be loaded. to supply the file "my-content-script.js", located in the /data subdirectory under your
add-on's root directory, use a line like: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... contentscriptfile: data.url("my-content-script.js") both contentscript and contentscriptfile accept an array of strings, so you can load multiple scripts, which can also interact directly with each other in the content process: // "data" is supplied by the "self" module va...
...ontent-script.js")] scripts specified using contentscriptfile are loaded before those specified using contentscript. this enables you to load a javascript library 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 ...
Contributor's Guide - Archive of obsolete content
vascript does not have native support for classical inheritance. instead, it uses something called prototypal inheritance. as it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. content processes a content process was supposed to run all the code associated with a single tab. ...
... it uses something called prototypal inheritance. as it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. content processes a content process was supposed to run all the code associated with a single tab. conversely, an
add-on process was supposed to run all the code associated with a single
add-on. neither content or
add-on proceses were ever actually implemented, but by the time they were cancelled, the sdk was already designed with them in mind. to understand this article, it's probably best to read it as if content and
add-on processes actually exist. getting started learn how to contribute to the
add-on sdk. modules a module is a self-contained unit of code, which is usu...
hotkeys - Archive of obsolete content
assign hotkey combinations to functions in your
add-on. usage to define a hotkey combination, create a hotkey object, passing it the combination and a function to be called when the user presses that combination. for example, this
add-on defines two hotkey combinations, to show and hide a panel: // define keyboard shortcuts for showing and hiding a custom panel. var { hotkey } = require("sdk/hotkeys"); var showhotkey = hotkey({ combo: "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 ...
...-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, and to clash with some other
add-on, so consider making the combination you choose user-configurable. globals constructors hotkey(options) creates a hotkey whose onpress listener method is invoked when key combination defined by hotkey is pressed. if more than one hotkey is created for the same key combination, the listener is executed only on the last one created. parameters options : object required options: ...
system - Archive of obsolete content
query the
add-on's environment and access arguments passed to it. usage querying your environment using the system module you can access environment variables (such as path), find out which operating system your
add-on is running on and get information about the host application (for example, firefox or fennec), such as its version. var system = require("sdk/system"); // path environment variable console.log(system.env.path); // operating system console.log("platform = " + system.platform); // processor architecture console.log("architecture = " + system.architecture); // compiler used to build host application console.log("compiler = " + system.compiler); // host application build identifier console.log("build = " + system.build); // host application uuid console.log("id = " + system.
...tted, exit() uses the success code 0. to exit with failure use 1. var system = require("sdk/system"); system.exit(); parameters code : integer to exit with failure, set this to 1. to exit with success, omit this argument. pathfor(id) firefox enables you to get the path to certain "special" directories, such as the desktop or the profile directory. this function exposes that functionality to
add-on authors. for the full list of "special" directories and their ids, see "getting_files in special directories". for example: // get firefox profile path var profilepath = require('sdk/system').pathfor('profd'); // get os temp files directory (/tmp) var temps = require('sdk/system').pathfor('tmpd'); // get os desktop path for an active user (~/desktop on linux // or c:\documents and settings\...
timers - Archive of obsolete content
parameters callback : 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. ...
... 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 repeatedly every ms milliseconds. any
additional arguments are passed straight through to the callback. 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) cle...
content/loader - Archive of obsolete content
provides one of the building blocks for those modules that use content scripts to interact with web content, such as panel and page-mod. usage the module exports a constructor for the loader object, which inherits on(), once(), and removelistener() functions that enable its users to listen to events. loader
adds code to initialize and validate a set of properties for managing content scripts: contenturl contentscript contentscriptfile contentscriptwhen contentscriptoptions allow when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action. the loader is used by modules that use content scripts but don't themselves load content, such as page-mod. modules that load their own content, such as panel and page...
...: var hiddenframes = require("sdk/frame/hidden-frame"); var { loader } = require("sdk/content/content"); var pageloader = loader.compose({ constructor: function pageloader(options) { options = options || {}; if (options.contenturl) this.contenturl = options.contenturl; this.on('propertychange', this._onchange = this._onchange.bind(this)); let self = this; hiddenframes.
add(hiddenframes.hiddenframe({ onready: function onready() { let frame = self._frame = this.element; self._emit('propertychange', { contenturl: self.contenturl }); } })); }, _onchange: function _onchange(e) { if ('contenturl' in e) this._frame.setattribute('src', this._contenturl); } }); loader properties contentscriptfile the local file urls of con...
content/mod - Archive of obsolete content
experimental provides functions to modify a page content. globals constructors functions attachto(modification, window) function applies given modification to a given window. for example, the following code applies a style to a content window,
adding a border to all divs in page: var attachto = require("sdk/content/mod").attachto; var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); parameters modification : object the modification we want to apply to the target. window : nsidomwindow the window to be modified. detachfrom(modification, window) function removes attached modification from a given window. if window is not sp...
...s modification : object the modification we want to apply to the target. window : nsidomwindow the window to be modified. detachfrom(modification, window) function removes attached modification from a given window. if window is not specified, modification is removed from all the windows it's being attached to. for example, the following code applies and removes a style to a content window,
adding a border to all divs in page: var { attachto, detachfrom } = require("sdk/content/mod"); var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); // ... detachfrom(style, window); parameters modification : object the modification we want to...
content/symbiont - Archive of obsolete content
used by sdk modules that can load web content and attach content scripts to it. usage a symbiont loads the specified contenturl and content scripts into a frame, and sets up an asynchronous channel between the content scripts and the
add-on code, enabling them to exchange messages using the port or postmessage apis. you map optionally pass a frame into the symbiont's constructor: if you don't, then a new hidden frame will be created to host the content. this trait is composed from the loader and worker traits. it inherits functions to load and configure content scripts from the loader, and functions to exchange messages between content scripts and the main
add-on code from the worker. var { symbiont } = require('sdk/content/content'); var thing = symbiont.resolve({ constructor: '_init'...
.... allow object permissions for the content, with the following keys: script boolean whether or not to execute script in the content. defaults to true. optional. optional. symbiont symbiont is composed from the worker trait, therefore instances of symbiont and their descendants expose all the public properties exposed by worker along with
additional public properties that are listed below: properties contentscriptfile the local file urls of content scripts to load. content scripts specified by this property are loaded before those specified by the contentscript property. contentscript the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property...
content/worker - Archive of obsolete content
the worker is similar to the web worker interface defined by the w3c. but unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the ui. globals constructors worker(options) creates a content worker. ...
... onmessage function functions that will registered as a listener to a 'message' events. onerror function functions that will registered as a listener to an 'error' events. worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with
additional public properties that are listed below. methods postmessage(data) asynchronously emits "message" events in the enclosed worker, where content script was loaded. parameters data : number,string,json the data to send. must be stringifiable to json. destroy() destroy the worker by removing the content script from the page and removing all registered listeners. a detach event is fired...
net/xhr - Archive of obsolete content
provides access to xmlhttprequest functionality. usage security concerns by default, the xmlhttprequest object grants 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 prevented, 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 prevented, malicious code could access sensitive data. if transmission of cookies isn't prevented, m...
...ible attenuations before being exposed to unprivileged code, this object needs to be attenuated in such a way that, at the very least, it can't access the user's filesystem. this can probably be done most securely by white-listing the protocols that can be used in the url passed to the open() method, and limiting them to http:, https:, and possibly a special scheme that can be used to access the
add-on's packaged, read-only resources. finally, we need to also consider attenuating http/https requests such that they're "sandboxed" and don't communicate potentially sensitive cookie information. globals constructors xmlhttprequest() creates an xmlhttprequest. this is a constructor, so its use should always be preceded by the new operator. for more information about xmlhttprequest objects, s...
places/history - Archive of obsolete content
", to: lastweek }, // second query searches all entries after last week with 'javascript' { query: "javascript", from: lastweek }], // we want to order chronologically by visit date { sort: "date" } ).on("end", function (results) { // results is an array of objects containing visit data, // sorted by visit date, with all entries from more than a week ago // that contain 'ruby', *in
addition to* entries from this last week // that contain 'javascript' }); globals functions search(queries, options) queries can be performed on history entries by passing in one or more query options. each query option can take several properties, which are and'd together to make one complete query. for
additional queries within the query, passing more query options in will or the total result...
...y object. multiple query objects are then or'd together. options : object optional options: name type count number the number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'keyword', 'date
added' and 'lastmodified'. descending boolean a boolean specifying whether the results should be in descending order. by default, results are in ascending order. placesemitter the placesemitter is not exposed in the module, but returned from the search functions. the placesemitter inherits from event/target, and emits data, error, and end. data events are emitted f...
jpm-mobile - Archive of obsolete content
jpm usage is: jpm-mobile [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version number installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already. ...
...oject team members discuss problems and proposals on the project mailing list. someone else may have had the same problem you do, so try searching the list. you're welcome to post a question, too. you can also chat with other sdk users in #jetpack on mozilla's irc network. command reference there are currently two jpm commands: jpm-mobile run launch an instance of firefox with your
add-on installed. jpm-mobile test runs your
add-on's unit tests. jpm-mobile run this command runs a new instance of firefox with the
add-on installed: jpm-mobile run jpm-mobile run accepts the following options: --adb /path/to/adb provides the path to adb. -b --binary binary use the package name of firefox specified in binary. jpm-mobile run -b...
Tools - Archive of obsolete content
articles listed here provide a reference for the sdk's tools: cfx enables you to test, run, and package
add-ons. cfx is is no longer supported as of firefox 44 and no longer accepted for
add-on submission, jpm should now be used instead. cfx to jpm a guide to working with jpm if you're already familiar with cfx. console enables your
add-on to log error, warning or informational messages. jpm jpm is a command-line tool that enables you to test, run, and package
add-ons. jpm-mobile the node-based replacement for cfx --force-mobile. enables you to run and test
add-ons for firefox mobile (aka fennec). ...
...informational messages. jpm jpm is a command-line tool that enables you to test, run, and package
add-ons. jpm-mobile the node-based replacement for cfx --force-mobile. enables you to run and test
add-ons for firefox mobile (aka fennec). jpmignore use .jpmignore to ignore files from your xpi builds created via jpm. package.json the package.json file contains manifest data for your
add-on, providing not only descriptive information about the
add-on for presentation in the
add-ons manager, but other metadata required of
add-ons. ...
Annotator - Archive of obsolete content
and removed in firefox 38. warning: this tutorial relies on the since-removed widget api and no longer works with firefox. the widget api is deprecated from firefox 29 onwards. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. in this tutorial we'll build an
add-on that uses many of the sdk's high-level apis. the
add-on is an annotator: it enables the user to select elements of web pages and enter notes (annotations) associated with them. the annotator stores the notes. whenever the user loads a page containing annotated elements these elements are highlighted, and if the user moves the mouse over an annotated element its annotation is displayed. next ...
...es (annotations) associated with them. the annotator stores the notes. whenever the user loads a page containing annotated elements these elements are highlighted, and if the user moves the mouse over an annotated element its annotation is displayed. next we'll give a quick overview of the annotator's design, then go through the implementation, step by step. if you want to refer to the complete
add-on you can find it under the examples directory in the sdk. design overview implementing the widget creating annotations storing annotations displaying annotations ...
Listen for Page Load - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. you can get notifications about new pages loading using the tabs module. the following
add-on listens to the tab's built-in ready event and just logs the url of each tab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a script to the tab using tab.attach(). this
add-on attaches a script to all open tabs. ...
...s the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a script to the tab using tab.attach(). this
add-on attaches a script to all open tabs. ...
Troubleshooting - Archive of obsolete content
check your text console when errors are generated in the sdk's apis and your code, they are logged to the text console. ...
...s page lists some starting points that might help you track down your problem. check your firefox jpm searches well known locations on your system for firefox. jpm may not have found an installation, or if you have multiple installations, jpm may have found the wrong one. in those cases you need to use jpm's --binary option. see the jpm guide for more information. when you run jpm to test your
add-on or run unit tests, it prints out the location of the firefox or xulrunner binary that it found, so you can check its output to be sure. check your text console when errors are generated in the sdk's apis and your code, they are logged to the text console. this should be the same console or shell from which you ran the jpm command. search for known issues someone else might have experienced...
Using XPCOM without chrome - Archive of obsolete content
s and xpcomutils as described in the following links: (observing changes to bookmarks and tags) , (creating event targets). however, with the sdk module , we can remove this need. below is an example, where we extend the xpcom module's unknown class with an nsinavbookmarkobserverinterface and one of its optional interface methods (onitemchanged). we can then create an object from it and
add it as an observer to the bookmarks service. // this removes the need to import ci and the xpcomutils const { class } = require("sdk/core/heritage"); const { unknown } = require('sdk/platform/xpcom'); const { placesutils } = require("resource://gre/modules/placesutils.jsm"); let bmlistener = class({ extends: unknown, interfaces: [ "nsinavbookmarkobserver" ], //this event most often ...
...: function(bid, prop, an, nv, lm, type, parentid, aguid, aparentguid) { console.log("onitemchanged", "bid: "+bid, "property: "+prop, "isanno: "+an, "new value: "+nv, "lastmod: "+lm, "type: "+type, "parentid:"+parentid, "aguid:"+aguid);0 // code to handle the event here } }); //we just have a class, but need an object. notice the small l var bmlistener = bmlistener(); placesutils.bookmarks.
addobserver(bmlistener, false); ...
Canvas code snippets - Archive of obsolete content
300; remotecanvas.canvas_height = 300; remotecanvas.prototype.load = function() { var windowwidth = window.innerwidth - 25; var iframe; iframe = document.createelement('iframe'); iframe.id = 'test-iframe'; iframe.height = '10px'; iframe.width = windowwidth + 'px'; iframe.style.visibility = 'hidden'; iframe.src = this.url; // here is where the magic happens... ...
...pe.load = function() { var windowwidth = window.innerwidth - 25; var iframe; iframe = document.createelement('iframe'); iframe.id = 'test-iframe'; iframe.height = '10px'; iframe.width = windowwidth + 'px'; iframe.style.visibility = 'hidden'; iframe.src = this.url; // here is where the magic happens... ...
Drag & Drop - Archive of obsolete content
dropping files onto an xul application it's possible to setup drag and drop events to handle dropping files from external applications or os file managers onto your xul-based application. first, you need to hook up the basic drag event handlers: elem.
addeventlistener("dragover", _dragover, true); elem.
addeventlistener("dragdrop", _dragdrop, true); here, elem could be a window or an xul element. next, setup the handlers so that files can be dropped on the application: function _dragover(aevent) { var dragservice = components.classes["@mozilla.org/widget/dragservice;1"].getservice(components.interfaces.nsidragservice); var dragsession = dragservice.getcurrentsession(); var supported = dragsession.isdataflavorsupported("text/x-moz-url"); if (!supported) supported =...
...].getservice(components.interfaces.nsiioservice); var uris = new array(); // if sourcenode is not null, then the drop was from inside the application if (dragsession.sourcenode) return; // setup a transfer item to retrieve the file data var trans = components.classes["@mozilla.org/widget/transferable;1"].createinstance(components.interfaces.nsitransferable); trans.
adddataflavor("text/x-moz-url"); trans.
adddataflavor("application/x-moz-file"); for (var i=0; i<dragsession.numdropitems; i++) { var uri = null; dragsession.getdata(trans, i); var flavor = {}, data = {}, length = {}; trans.getanytransferdata(flavor, data, length); if (data) { try { var str = data.value.queryinterface(components.interfaces.nsis...
QuerySelector - Archive of obsolete content
s a nodelist. ...
...or xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></script> document.prototype.$ = function (selector) { // only for plain xml return this.queryselector(selector); }; var foo = document.implementation.createdocument('somens', 'foo', null); // create an xml document <foo xmlns="somens"/> var bar = foo.createelementns('somens', 'bar'); //
add <bar xmlns="somens"/> foo.documentelement.appendchild(bar); alert(foo.$('bar').nodename); // gives 'bar' element.prototype.$ = function (selector) { // works for html, xul, and plain xml return this.queryselector(selector); }; html example: <h1><a>test!<a/></h1> <script> element.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.getelementsbytagna...
SVG General - Archive of obsolete content
ilding an svg document: <svg xmlns="http://www.w3.org/2000/svg"> <!-- svg elements go here --> </svg> note: it is recommended that you do not use dtd's with svg documents. the tutorial and authoring guidelines have more information. dynamic scripting helper this little helper script can be used to simplify creation of svg elements in script. svg requires you to use setattributens to
add attributes to a newly created svg dom element. no properties like html. svg image also requires the use of xlink for the href attribute, which can be tricky to remember, especially when you're mixing svg with html or xul. here is the script: var svgns = "http://www.w3.org/2000/svg"; var xlinkns = "http://www.w3.org/1999/xlink"; var attr_map = { "classname": "class", "svghref": "href" } var...
...here are some examples of using it: var circle = makesvg("circle", {id: "circle1", cx: "60", cy: "60", r: "50"}); var img = makesvg("image", {id: "img1", x: "110", y: "110", width: "100", height: "100", svghref: "bubbles.png"}); var text = makesvg("text", {id: "text1", x: "60", y: "60"}); text.textcontent = "hello world"; ...
Sidebar - Archive of obsolete content
er extension going last "winning". web panels sidebar content such as web pages can be safely loaded as sidebar in the "viewwebpanelssidebar". bookmarks with "load this bookmark in sidebar" checked in the properties open in the "viewwebpanelssidebar". a web page can use window.sidebar to create bookmark with that property. to open a page in the "viewwebpanelssidebar" from chrome code (browser/
addon/extension) such as from menuitem, it can call: openwebpanel(atitle, auri); accessing the sidebar from a browser.xul script the sidebar content is always in a document separate from the main browser document (the sidebar is actually implemented as a xul browser element). this means you can't directly access the sidebar content from a script referenced from a browser.xul overlay. to access yo...
...itter").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.document.getelementbyid("sidebar-box").hidden; see also bootstrap demo
addon that creates a sidebar with html content: https://gist.github.com/noitidart/8728393 ...
XPath - Archive of obsolete content
s moved from document.evaluate) obj.evaluate(xpathexpression,contextnode,namespaceresolver,resulttype,result); //obj and contextnode should be the same object, if context is a ajax xml object (example: returnedxml) this should be used as : returnedxml.evaluate(xpathexpression,returnedxml,namespaceresolver,returntype,result); //contextnode should be used in the one in which it was created //
add by mooring 2008-11-15 16:00 china var xhr = new ajax('post','demo.xml',parsexml,'xml'); //ajax is a class written by javascript which return responsexml object to parsexml function function parsexml(obj)//obj is the returnxml object now { if(!obj.documentelement) { alert("your browser does't support this script!"); return; } var fields = [];//store the results if(window.activ...
...(tmp.textcontent); tmp = tobj.iteratenext(); } } alert(fields); } //here is the demo xml file for xpath <?xml version="1.0"?> <root> <field> <item>art_id</item> <item>psection</item> <item>qkind</item> <item>qtitle</item> <item>question</item> <item>pic</item> <item>answer1</item> <item>answer2</item> <item>answer3</item> <item>answer4</item> </field> </root> //
add by mooring 2008-11-15 16:16 china ...
Deploying a Plugin as an Extension - Archive of obsolete content
estart firefox so the plugin will be available. after restarting firefox, the extension manager will include an entry for the rhapsody player engine. because it is an extension, we can disable/enable it, as well as uninstall it. you'll notice that one thing we did not do is provide a mechanism for updating the plugin, as discussed at the beginning of this article. let's cover that now. one of the
additional things that can be placed in the install.rdf is called an updateurl. for example: <em:updateurl><http://www.rhapsody.com/update.rdf></em:updateurl> this url specifies an rdf file that can be used to tell firefox that there are updates available for your extension. this rdf file can be updated to indicate that an update to our extension/plugin is available. finally, if you want to package ...
...sion/plugin is available. finally, if you want to package plugins for multiple platforms into a single extension, you can do that as well. there are two ways to do this. first, you can simply put all the files in the plugins directory. firefox will load the correct plugins based on the platform, simply because the plugins for other platforms won't load. if your plugin is for windows, don't forget
add to version resources to your plugin's dll. also, supply mimetype and fileextents, without these your plugin won't work. michael kaply firefox advocate mkaply@us.ibm.com ...
Displaying web content in an extension without security issues - Archive of obsolete content
id"); entry.getelementsbyclassname("title")[0].textcontent = title; entry.getelementsbyclassname("description")[0].textcontent = description; template.parentnode.appendchild(entry); the important difference here is that the result will always have the same structure as the template tag. clonenode() always creates a copy and textcontent only manipulates text. so there is no chance of accidentally
adding new elements or attributes. but what if you have to display html rather than only text, e.g. an rss feed entry? extension authors will often come up with flawed attempts to sanitize html code. instead, nsiscriptableunescapehtml.parsefragment() method should be used that is meant for just that scenario: var target = entry.getelementsbyclassname("description")[0]; var fragment = components.class...
...ment() method should be used that is meant for just that scenario: var target = entry.getelementsbyclassname("description")[0]; var fragment = components.classes["@mozilla.org/feed-unescapehtml;1"] .getservice(components.interfaces.nsiscriptableunescapehtml) .parsefragment(description, false, null, target); target.appendchild(fragment); this will
add the html code to the specified node — minus all the potentially dangerous content. ...
Extension Theming Guidelines - Archive of obsolete content
kage. custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. branding certain items of your extensions style, in particular logos and icons can be kept in the chrome content package such that they are not replaceable by custom themes stylesheets guidelines include stylesheets for every new window that your extension
adds and for every window that your extension overlays content into be sure to
add a stylesheet from your chrome skin package. while it may be tempting to use the same stylesheet in multiple places try to avoid this so that themes can correctly target the right windows. css selectors when writing stylesheet rules for windows that you are overlaying always try to be specific with the css selector. if...
...tylesheet from your chrome skin package. while it may be tempting to use the same stylesheet in multiple places try to avoid this so that themes can correctly target the right windows. css selectors when writing stylesheet rules for windows that you are overlaying always try to be specific with the css selector. if you are not then you run a risk of conflicting with content that other extensions
add to the window. xul guidelines xbl bindings xbl bindings are applied using style rules. however these are rarely part of the style of the widgets but more about
adding custom widgets. in this case you should
add a stylesheet to your chrome content package and apply the bindings there. this is one of the rare cases where it is sensible to put the stylesheet into the content area. style attributes...
Multiple item extension packaging - Archive of obsolete content
dividual items contained by the multiple item package after the download completes in the same manner that it would if the user had chosen to install multiple individual items simultaneously. the manager will not display the multiple item package in the list of items after the download has completed. signing all extensions now require signing by mozilla. for multiple item packages, all internal
add-ons need to be signed, but the container doesn't need to be signed. this means that the contained
add-ons need to be submitted to amo individually for signing.
additionally, the container
add-on id must not be the same as the id of any of the contained
add-ons. official references for toolkit api official references. do not
add to this list without contacting benjamin smedberg. note that this p...
...to be signed. this means that the contained
add-ons need to be submitted to amo individually for signing.
additionally, the container
add-on id must not be the same as the id of any of the contained
add-ons. official references for toolkit api official references. do not
add to this list without contacting benjamin smedberg. note that this page is included from the pages listed below. ...
Connecting to Remote Content - Archive of obsolete content
nodevalue); // => 2 } }; using dom functions is good for simple xml documents, but dom manipulation code can become too complicated if the documents are more complex. there are a couple of tools you can use to process these documents more efficiently: using xpath xpath stands for xml path language, 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 previously. xpath is very useful for cases when you're receiving l...
...t.firstchild); document.getelementbyid("foo").appendchild(xulnode); }; we effectively transformed the xml file into xul and integrated it into the ui. note: security should be your number one priority when handling remote content. do not allow event handlers or any other kinds of code to be passed through your parsers. if you need your generated xul to have js code in it, all of it should be
added locally, never from the remote source. here are a couple of practical situations were you may want to use xslt: convert a large xml document directly into xul. filter a complex xml file and generate a simpler xml document with only the data you need, so then you can use regular dom functions to read it. convert xml into sql statements. you could use this to generate a script to run on you...
Overlay extensions - Archive of obsolete content
nsions for gecko-based applications which uses: xul overlays to specify the interface apis available to privileged code, such as tabbrowser and javascript modules, to interact with the application and content. prior to firefox 4, and the gecko 2 engine that powers it, this was the only way to develop extensions. this methodology has largely been superseded by restartless extensions, and the
add-on sdk, which is built on top of them. the privileged javascript apis described here can still be used in these newer types of
add-ons. xul school xul school is a comprehensive
add-on development tutorial, focusing on firefox extension development but mostly applicable to other gecko-based applications. more resources setting up your environment setting up the application for extension d...
...ions. more resources setting up your environment setting up the application for extension development. xul tutorials and reference for the user interface language used by xul extensions. code snippets sample code for many of the things you'll want to do. installing extensions how to install an extension by copying the extension files into the application's install directory. firefox
add-ons developer guide a guide to developing overlay extensions. javascript code modules javascript modules available to extension developers. extension preferences how to specify the preferences for your extension that will appear in the
add-ons manager. extension packaging how extensions are packaged and installed. binary firefox extensions creating binary extensions for firefox. ...
Supporting search suggestions in search plugins - Archive of obsolete content
iginal query string. this allows firefox to verify that the suggestions match the current search term. completion list an array of suggested search terms. the array should be enclosed in square brackets. for example: ["term 1", "term 2", "term 3", "term 4"] descriptions this optional element is an array of descriptions for each of the suggestions in thecompletion list . these can be any
additional information the search engine might want to return to be displayed by the browser, such as the number of results available for that search. descriptions are not supported in firefox, and are ignored if any are specified. query urls this optional element is an array of alternate urls for each of the suggestions in thecompletion list . for example, if you want to offer a map link inste...
... the following json: ["fir", ["firefox", "first choice", "mozilla firefox"]] note that in this example, only the query string and completion array are specified, leaving out the optional elements. your completion list can include as many suggestions as you like, although it should be kept manageable, given that the display will be updating live while the user is typing their search string. in
addition, the method you use to select suggestions is entirely up to you. note: firefox requires that suggest requests complete within 500ms for suggestions to be displayed. if the request for the suggest url does not return data before 500ms have elapsed, no search suggestions will be shown. ...
Install.js - Archive of obsolete content
install.profile_chrome : install.delayed_chrome; // register content install.registerchrome(install.content | installtype, jarpath, 'content/' + this.extshortname + '/'); // register locales...
...install.profile_chrome : install.delayed_chrome; // register content install.registerchrome(install.content | installtype, jarpath, 'content/' + this.extshortname + '/'); // register locales for (var locale in t...
List of Former Mozilla-Based Applications - Archive of obsolete content
the following is a list of all known applications that at one point used mozilla technologies or that are no longer being actively maintained. a list of actively maintained mozilla-based applications is also available. ...
...nitially but now uses adobe air rift technologies software installation over internet no longer using mozilla technology -- need confirmation and details second life virtual world desktop client switched from embedded mozilla browser to a plugin architecture with a qtwebkit plugin applications that are no longer being developed name description
additional information aphrodite browser inactive aol client for mac internet software no longer available beonex communicator internet software last news item on site from 2004 chameleon theme builder inactive civil netizen p2p file delivery (email attachment replacement) site not updated since 2006 compuserve client...
Monitoring WiFi access points - Archive of obsolete content
this capability was introduced primarily to allow wifi-based location services to be used by geolocation services. example this example simply displays a list of the available access points. ...
...ifications of changes to the access point list. this object is described in lines 11 through 40 in the code above. the onchange() method (lines 13 through 27) begins by enabling universalxpconnect privileges, then clearing out the div (d) that will receive the updated list of access points. then the loop in lines 19-22 iterates over the list of access points received in the accesspoints array and
adds them to the html in the div. then the c div is updated with the number of times the list has been refreshed. the onerror() method simply opens an alert that displays the error code received. starting to monitor access points to start monitoring the access points, we instantiate the listener (on line 44), then get access to the wifi monitor interface on line 45. the monitoring is started up on li...
Source code directories overview - Archive of obsolete content
edding embedding] code wraps this code with higher level browser functions like forward, back and history. dom contains c interfaces and code for implementing and tracking dom (document object model) objects in javascript. it forms the c substructure which creates, destroys and manipulates built-in and user-defined objects according to the javascript script. for example, if the javascript script
adds a user-defined attribute to the document (e.g. document.goofy = 1), this code will create the "goofy" node, put it on the "document" node and manipulate it according to any later javascript commands. editor contains c interfaces, c code and xul for the embeddable editor component which can edit both plain text and html. it is used for the html editor (i.e. composer in mozilla classic), for plai...
...ith extra classes for editing text and managing undo/redo. embedding contains c interfaces and code for generic high-level browser functions (e.g. forward, back, history). the [#seamonkey-webshell webshell] code wraps these interfaces according to the particular platform and way (e.g. activex) that is being supported. extensions contains c interfaces, c code, xul and javascript code for various
add-ins that are related to browsing. these include: cookies, irc, wallet, dom inspector, p3p, schema validation, spellchecker, transformiix, typeaheadfind, javascript debugger, xforms, etc. gfx contains c interfaces and code for platform independent drawing and imaging. it can be used to draw rectangles, lines, images, etc. essentially, it is a a set of interfaces for a platform-independent device ...
Building TransforMiiX standalone - Archive of obsolete content
this document is out of date. we support building a standalone version of transformiix on windows, unix and os x. read the build instructions for your platform to get the requirements, which are the same as for mozilla. you need to get the source from cvs.
add tx_exe=1 mk_
add_options build_modules="xpcom transformiix" ac_
add_options --enable-standalone-modules="xpcom transformiix" to your .mozconfig, and use client.mk to pull as usual. this will pull the necessary subtree with mozilla/client.mk mozilla/build/unix/modules.mk mozilla/build mozilla/config mozilla/expat mozilla/extensions/transformiix mozilla/include mozilla/allmakefiles.sh mozilla/client.mk mozilla/aclocal.m4 mozilla/configure mozilla/configure.in mozilla/makefile.in plus nspr and xpcom from the cvs repository. building...
...ssary subtree with mozilla/client.mk mozilla/build/unix/modules.mk mozilla/build mozilla/config mozilla/expat mozilla/extensions/transformiix mozilla/include mozilla/allmakefiles.sh mozilla/client.mk mozilla/aclocal.m4 mozilla/configure mozilla/configure.in mozilla/makefile.in plus nspr and xpcom from the cvs repository. building from a full mozilla tree is not supported. it is recommended to
add ac_
add_options --disable-gtktest ac_
add_options --without-jpeg ac_
add_options --without-zlib ac_
add_options --without-png ac_
add_options --without-x to your .mozconfig, too, as it stops configure from testing unneeded libs. make -f client.mk build as usual. of course, make -f client.mk checks out and builds just transformiix alright. the binary transformiix(.exe) will be in extensions/...
Creating a Firefox sidebar extension - Archive of obsolete content
f how xul works and how firefox handles extensions. see building an extension for more detailed information about structuring, packaging, and deploying extensions. packages extensions to firefox are installed with packages ("bundles"). an extension package usually contains a "content" provider, which contains the xul code and application logic. optionally locales and skins can be included. most
additions are provided with a default tree structure, although not required it is recommended to use this structure. here the package for the sidebar is created, the files included are listed below. example 1. package structure emptysidebar \- chrome |- content |- locale | \- en-us \- skin create all folders, except for skin. it is not used for this tutorial. the locale holds the l...
...bar" title="&emptysidebar.title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > <vbox flex="1"> <label id="atest" value="&emptysidebar.title;" /> </vbox> </page> new extensions can be registered in the menus or popups, firefox uses overlays for extending menus. this is an separate xul file that specifies the location of menu items. the sidebar here is
added to the view | sidebar menu. the overlay file is listed in example 4. example 4. chrome/content/firefoxoverlay.xul <?xml version="1.0"?> <!doctype overlay system "chrome://emptysidebar/locale/emptysidebar.dtd"> <overlay id="emptysidebaroverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menupopup id="viewsidebarmenu"> <menuitem key="key_openemptys...
Conclusion - Archive of obsolete content
file:/// url). 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. how would you use javascript to determine whether the tree is open or closed and css to style the icon accordingly? mozilla applications often store their css and image files in a separate skin subdirectory within the installation directory. how would you modify the xpi structure and installer script...
...e skin subdirectory within the installation directory. how would you modify the xpi structure and installer script to install these files in that subdirectory? how could you modify the extension to load the tinderbox page when you click on the status icon? mozilla has a fourth ui layer--localized text--that wasn't discussed in the tutorial because there is no text to localize. how could it be
added to the extension if necessary? tinderbox actually keeps track of more than one codebase. in particular, it tracks both the main mozilla codebase (the trunk) and a stable branch. how could you modify tinderstatus to show the status of both the trunk and the branch? this extension can be installed into netscape 7 without problems. firefox has slightly different chrome registry requirements, s...
Finding the code to modify - Archive of obsolete content
e flashing red border around the horizontal status bar at the bottom of the browser window. click the plus sign next to the statusbar node in the dom inspector and select each statusbarpanel node in turn. notice the flashing red border around each different section of the status bar. open the navigator.xul file in a text editor. find the statusbar element within it. ...
...rowser window. click the plus sign next to the statusbar node in the dom inspector and select each statusbarpanel node in turn. notice the flashing red border around each different section of the status bar. open the navigator.xul file in a text editor. find the statusbar element within it. this is where we are going to
add our tinderbox status ui. inspectorwidget the inspectorwidget extension
adds a toolbar button and context menus for invoking the dom inspector (domi) for either chrome or content elements.thus this makes it possible to save all the above dom inspector user interface diggings. as a side note it would be good if the inspectorwidget
additions were integrated directly in domi, that would help everyone. « previousnext » ...
Finding the file to modify - Archive of obsolete content
ion (alignment), and the behavior layer specifies how the widgets behave and how users can use them to accomplish their goals. mention the localization layer (note: these layers are not completely mutually exclusive. in particular, positioning information can be specified in both the structure layer and the style layer, and some behavior can be partly defined in the style layer.) we're going to
add code to all three ui layers, starting with the structure layer. the structure layer consists of xul files. xul, which is short for xml-based user interface language (and is pronounced like "zool"), is an xml-based language specifically designed for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees,...
...s an xml-based language specifically designed for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). each window and dialog box in mozilla is defined by a single xul file (in some cases other xul files called overlays contribute portions of another window's structure). to
add a tinderbox status icon to mozilla, we need to find the xul file that defines the structure of the browser window. the best way to find a xul file for a window is to use the dom inspector. the dom inspector is a tool bundled with mozilla that allows you to examine the dom of web pages and xul windows. to access it, go to the "tools" menu, select the "web development" submenu, then select the "do...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
der applications, like mozilla suite, firefox 1.0. see building an extension for updated instructions. now that we have a static overlay we're in good shape to create a xpi package that installs our extension as a dynamic overlay. xpis have a complex structure designed to separate ui layers from each other. to make our xpi we'll start out by creating a directory to hold the files we're going to
add to the xpi. then we'll modify urls in our files so they point to the right place. after that we'll create a contents.rdf file describing the tinderstatus component for the chrome registry and an install.js script to perform the installation. finally we'll zip the files into an archive. start out by creating a directory called tinderstatus-installer. create a tinderstatus subdirectory in it and a...
...rome://navigator/content/navigator.xul"> <rdf:li>chrome://tinderstatus/content/tinderstatusoverlay.xul</rdf:li> </rdf:seq> </rdf:rdf> install.js, on the other hand, goes into the tinderstatus-installer directory: initinstall( "mozilla tinderstatus extension", "/mozdev/tinderstatus", "0.1"); var installdir = getfolder("chrome","tinderstatus"); setpackagefolder(installdir);
adddirectory("tinderstatus"); registerchrome( content | delayed_chrome, getfolder(installdir, "content")); var result = performinstall(); if ( result != success ) cancelinstall(result); once all the files are in place, use your zip utility from within the tinderstatus-installer directory to create a zip archive called tinderstatus.xpi with install.js and the entire contents of the tind...
Creating a Mozilla Extension - Archive of obsolete content
warning: the content of this article may be out of date. this tutorial describes how to create an extension for the old versions of mozilla suite (currently seamonkey). see building an extension for an up-to-date tutorial (it focuses on firefox, but is also applicable to other new applications). a mozilla extension is an installable enhancement to the mozilla browser that provides
additional functionality (for example linky, which
adds an item to the context menu for opening multiple links in a document or selection). this tutorial walks you through the process of building a mozilla extension that
adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e. whether or not the latest version of the code is compiling successfully and passing tests). the e...
...urce code for the ui you want to extend, how to make an installation of mozilla modifiable, how to use mozilla's network library to load and parse web pages in javascript, and how to use dynamic overlays to package a mozilla extension for installation by others. ...
Getting Started - Archive of obsolete content
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 components of the browser you're modifying. if we also had skins for chatzilla, we would need to
add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. skin global my_theme jar:chrome/my_theme.jar!/global/ skin mozapps my_theme jar:chrome/my_theme.jar!/mozapps/ skin messenger my_theme jar:chrome/my_theme.jar!/messen...
...n> establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of seamonkey your theme wasn't designed for -- or wasn't tested on. see install manifests for the reference information about the install.rdf file. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and p
adding it should put around them, and so on. as an example, let's change the standard button. go into the global directory and open button.css in your favorite text editor. scroll down to button {. this section defines the normal button in its basic state (there is no mouse over it, it's not disabled, and it's not selected). change the background-color: to darkblue and the color: to white, and save t...
Getting Started - Archive of obsolete content
wn individual directory. you'll be able to change the bookmark manager and the profile migration window here. the three remaining directories are pretty self-explanatory. they contain the images/styles for the browser, email client, or html editor. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and p
adding it should put around them, etc. for this next part, let's modify the standard button. go into \mozilla\chrome\classic\skin\classic\global and open button.css in your favourite text editor. scroll down to button {. this section defines the normal button in its basic state (there is no mouse over it, it's not disabled, and it's not selected). change the background-color: to darkblue and the colo...
... can press to activate the skin in the preferences. replace the author section with your name. the description shows up below the preview image. place your theme name and version number on this line point to your preview.png/preview.jpg/preview.gif here the packages section lists which components of the browser suit that you are modifying. if we also had skins for chatzilla, we would have to
add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. <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:g...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
ontents.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 name of your theme. the packages section lists which components of the browser you're modifying. if we also had skins for chatzilla, we would need to
add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. <rdf:li resource="urn:mozilla:skin:my_theme:communicator"/> <rdf:li resource="urn:mozilla:skin:my_theme:editor"/> <rdf:li resource="urn:mozilla:skin:my_theme:global...
... establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of firefox your theme wasn't designed for -- or wasn't tested on. see install manifests for the reference information about the install.rdf file. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and p
adding it should put around them, and so on. as an example, let's change the standard button. go into the global global directory and open button.css in your favorite text editor. scroll down to "button {". this section defines the normal button in its basic state (there is no mouse over it, it's not disabled, and it's not selected). change the background-color: to darkblue and the color: to white...
DTrace - Archive of obsolete content
dtrace is sun microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active. probe data can be collected with scripts written in d (no, not that one). mozilla dtrace support has been
added by the sun dtrace team and can be used on solaris 10 and mac os x 10.5. dtrace has been largely supplanted by the gecko profiler and other tools, so this documentation has been archived. if you find that there are still use cases of consequence, you're welcome to file a documentation bug. the dtrace probes currently built into the codebase may be enabled by default in the future, but for now you'll need to create a build with --enable-dtrace (on mac os x you also have to...
...k, unlike the common configuration that uses the 10.4 sdk). trunk nightly builds with shark support (*-mac-shark.dmg here) are built with --enable-dtrace. documentation writing scripts a general introduction to writing d scripts and using the built-in mozilla probes. optimizing javascript with dtrace a guide on profiling javascript code using dtrace.
adding probes a guide on creating probes and the build system magic needed to
add probes to your code. pounce on dtrace a guide to using dtrace on mac os x 10.5. dtrace for web developers how to use dtrace to profile your web application. view all... community dtrace forums #dtrace on irc.freenode.org sun's dtrace howto guide tools ...
Developing New Mozilla Features - Archive of obsolete content
...
...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 code who is connected to what you are doing if you can’t make this happen, let mozilla.org staff know and we will try to facilitate this. it’s possible developers may not pay much attention to you because they be...
Drag and drop events - Archive of obsolete content
drag sent when a drag operation begins. dragend sent when a drag operation ends. for more information about drag and drop, see the article drag and drop. ...
... new events that allow you to determine when drag operations begin and end. these events are new in the current working draft of the html 5 specification. note: the drag and drop event support advertised in the firefox 3 release notes is not the same as the events described in the drag and drop section of the html 5 working draft. e.g. firefox 3 does not support the 'drag' event. this support is
added in firefox 3.5, and is documented separately on the page [drag and drop]. drag sent when a drag operation begins. dragend sent when a drag operation ends. for more information about drag and drop, see the article drag and drop. you can see an example of these events in action here: view source view example see also ^: drag and drop html 5 working draft: drag and drop ns...
Editor Embedding Guide - Archive of obsolete content
the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is done loading. ...
...that differ such as splitting of mail quotes) editor commands you need to call commands and receive updates in order to make any changes to the content on the browser. below is the sequence of steps that need to be followed for the same: 1. get the nsicommandmanager from the nsiwebbrowser using do_getinterface: nscomptr<nsicommandmanager> commandmanager; nsiwebbrowser->do_getinterface(getter_
addrefs(commandmgr)); 2. call a command -- docommand: commandmanager->docommand(acommand, acommandparams); acommand is a const char * to a supported command name (see list below). acommandparams could possibly be a null pointer or a pointer to a valid structure filled with relative parameters to acommand (see list below for legal params). 3. verify if a command is enabled -- iscommandenabled: ...
Embedding FAQ - Archive of obsolete content
faq mozilla.dev.embedding how to start embedding you can find a examples, faqs, and the api from mozilla itself. you can get more detailed information on what interfaces are required and which are optional to impelement here. scroll down to "initalization and teardown. how to customize document retrieval one method is to implement your own protocol method. you can find more information on
adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a stripped down, uncommented code with eclipse libraries in this thread. here is the code : import org.eclipse.swt.swt; import org.eclipse.swt.browser.mozillabrowser; import org.eclipse.swt.browser.progressevent; import org.eclipse.swt.browser.progresslistener; import ...
...ipse.swt.widgets.shell; import org.mozilla.xpcom.nsidomdocument; public class test { public static void main(string args[]) { display display = new display(); shell shell = new shell(display); final mozillabrowser browser = new mozillabrowser(shell,wt.border); browser.seturl("http://www.google.com"); browser.
addprogresslistener(new progresslistener() { public void changed(progressevent event) { } public void completed(progressevent event) { nsidomdocument doc = browser.getdocument(); system.out.println(doc); } }); whi...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
ed from the mozilla source tree. xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects. as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++. prerequisites java 1.4.2 or newer xulrunner 1.8.0.1 or newer embedding in order to embed mozilla in your java application, you 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. first, the java application must find a suitable xulrunner installation: mozilla mozilla = mozilla.getinstance(); greversionrange[] ...
... terminate the embedding process: try { mozilla.termembedding(); } catch (xpcomexception e) { // this exception is thrown if termembedding failed } working with xpcom objects now that mozilla is embedded, the java application can work with xpcom objects. the mozilla class provides several methods to facilitate this, such as getservicemanager, getcomponentmanager, and newlocalfile. in
addition to retrieving and calling methods on xpcom objects, javaxpcom allows the java application to pass java class objects to xpcom methods. for example: mozilla mozilla = mozilla.getinstance(); windowcreator creator = new windowcreator(); // implements nsiwindowcreator nsiservicemanager servicemanager = mozilla.getservicemanager(); nsiwindowwatcher windowwatcher = (nsiwindowwatcher) serv...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
p data into). most often, the one we find is nsdsuricontentlistener, which corresponds to a docshell and handles most of the data types that mozilla handles internally. nsiexternalhelperappservice if we can't do anything else with a load, we give it to the nsiexternalhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
...en, the one we find is nsdsuricontentlistener, which corresponds to a docshell and handles most of the data types that mozilla handles internally. nsiexternalhelperappservice if we can't do anything else with a load, we give it to the nsiexternalhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
Documentation for BiDi Mozilla - Archive of obsolete content
d) so that a logical application will display it (from a bidi point of view) as it is displayed by mozilla. text pasted from the clipboard is treated exactly as if it came from a logical source. form controls: based on bidi options in preferences, the text mode of form controls may be "logical", "visual" or "like containing document". we have also tested behaviour of all controls with dir=rtl and
added support where necessary. some support
added for alignment in tables and lists, and fixes for problems with different combinations of dir and align. improvements to lists with hebrew and arabic list-style-type summary of new classes class name xpcom interface (if applicable) implementation comments nsibidi intl\unicharutil\public\nsibidi.h intl\unicharutil\src\nsbidiimp.cpp implementation...
...it is created when resolving text containing a unicode bidi control character, a bdo tag, or right-to-left alignment caused by a dir tag or css. nsibidikeyboard widget/public...
Enabling Experimental Jetpack Features - Archive of obsolete content
note: this page 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! the proposed method for accessing jetpack features that are still in development and may be
added in the future is inspired by python's future module. in python, you can call from __future__ import foo which
adds the functionality that foo yields to the script. in jetpack, we propse
adding a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the script. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a ...
...where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the clipboard) from the future. jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without
additionally changing the script (barring any other changes made during integration). list() arrayreturns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an example of how to get this array. a quick way of displaying the list is to write it to the console.log. var list = jetpack.future.list();console.log(list); open the firebug console to view. ...
Message Summary Database - Archive of obsolete content
essages and threads in a folder, and some meta information about the folder. nsimsgdatabase the main access point to the summary information is nsimsgdatabase. nsimsgfolder has a method to get the database for a folder. nsimsgdatabase is an abstraction on top of mdb, which is a set of db interfaces. the mdb interfaces are implemented in mork. mdb is a schema-less db interface, so it's trivial to
add new attributes without regenerating the db, and it's trivial for older code to read newer databases, because the code can ignore but maintain the attributes it doesn't know about. if we were to replace mork, we could do it at the mdb level (unlikely, because implementing the mdb interface on top of a different db would be very hard), the nsimsgdatabase level (probably the easiest), or we could in...
...d, there are very few bugs in the mork code. mork loads the whole database in memory, and keeps it there. this makes it very fast to access our database objects, but it does increase memory usage. mork assumes the caller will do file locking, so two processes or threads writing to the same database can corrupt it. but i believe sql-lite has the same problem. mork is schema-less. this means we can
add properties to rows arbitrarily. and we only pay the storage cost for a property if the row has the property set. we can still index on these properties, if we want. we would need the equivalent capabilities if we replaced mork. ...
How to Write and Land Nanojit Patches - Archive of obsolete content
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's tm/tr repo, ie. mozilla people for tm, and adobe people for tr. propagate all recent nanojit-central changes to your local tm/tr repo. for tracemonkey, use the "make update-nanojit" target (it requires that mercurial's "convert" extension be enabled;
add "hgext.convert =" to your .hgrc file under "[extensions]"). for tamarin, use the update-nanojit.sh script. note that updating will clobber the contents of the nanojit/ directory in your private tm/tr repo. it will also generate a commit that updates the nanojit-import-rev file in your target repository; this file records which commits have been copied over from nanojit. build and test the cha...
...lready-reviewed!) tr/tm portion of the patch(es) on top of your current, un-pushed tip. at this point the set of changes you are about to push will consist of a sequence of converted revisions from nanojit-central, followed by one of more "fixups" to tr/tm to make them work properly. test this entire group and land them with a single hg push. then update the whiteboard for the each such bug p and
add a comment url. and likewise for all revisions involved in the update. you're done, but watch the tm/tr testing results (tbpl or buildbot). if you ever want to "undo" revisions you copied from nanojit-central, you can backout copied revisions using the existing mercurial "backout" command in your target repository. if you do so, the next time you copy revisions from nanojit-central to your target...
Porting NSPR to Unix Platforms - Archive of obsolete content
entation strategy. this is referred to as pthreads nspr. pthreads nspr has relatively orthogonal source code in the thread management, thread synchronization, and i/o area. the pthreads source files are in <tt>mozilla/nsprpub/pr/src/pthreads</tt>. i use the netbsd port i recently received as an example to illustrate the mechanical part of the porting process. there are a few new files you need to
add: <tt>mozilla/nsprpub/config/netbsd.mk</tt> the name of this file is the return value of <tt>uname -s</tt> on the platform, plus the file suffix <tt>.mk</tt>. if the return value of <tt>uname -s</tt> is too long or ambiguous, you can modify it in <tt>mozilla/nsprpub/config/arch.mk</tt> (the makefile variable <tt>os_arch</tt>). <tt>mozilla/nsprpub/pr/include/md/_netbsd.cfg</tt> we have a progr...
...t which element in the <tt>jmp_buf</tt> is the stack pointer. usually <tt>jmp_buf</tt> is an array of integers, and some platforms have a <tt>jb_sp</tt> macro that tells you which array element is the stack pointer. if you can't find a <tt>jb_sp</tt> macro, you must resort to brute-force experiments. i usually print out every element in the <tt>jmp_buf</tt> and see which one is the closest to the
address of a local variable (local variables are allocated on the stack). on some platforms, <tt>jmp_buf</tt> is a struct, then you should look for a struct member named <tt>sp</tt> or something similar. <tt>mozilla/nsprpub/pr/src/md/unix/netbsd.c</tt> you need to modify the following existing files: <tt>mozilla/nsprpub/pr/include/md/makefile</tt> <tt>mozilla/nsprpub/pr/include/md/_unixos.h</tt...
Build - Archive of obsolete content
st release source code from mozilla's ftp site. extract the source code, and you should have a directory called mozilla/. change directory into mozilla/ and checkout the latest prism code : cd mozilla/ svn co http://svn.mozilla.org/projects/webrunner/trunk prism create a file called .mozconfig make sure it is in the mozilla/ directory. the contents of the file should look something like this : mk_
add_options moz_co_project=xulrunner mk_
add_options moz_objdir=@topsrcdir@/mozilla-obj ac_
add_options --enable-application=xulrunner ac_
add_options --disable-debug ac_
add_options --enable-optimize ac_
add_options --disable-tests ac_
add_options --disable-javaxpcom build xulrunner : make -f client.mk build once the build is done, there will be a directory called mozilla-obj. go into the prism/ direct...
..._
add_options moz_objdir=@topsrcdir@/mozilla-obj ac_
add_options --enable-application=xulrunner ac_
add_options --disable-debug ac_
add_options --enable-optimize ac_
add_options --disable-tests ac_
add_options --disable-javaxpcom build xulrunner : make -f client.mk build once the build is done, there will be a directory called mozilla-obj. go into the prism/ directory and create a .mozconfig file mk_
add_options moz_objdir=@topsrcdir@/mozilla-obj/prism ac_
add_options --with-libxul-sdk=../dist ac_
add_options --enable-application=prism you need to define an environment variable to point the build to the new .mozconfig. this variable is called mozconfig export mozconfig=$pwd/.mozconfig #this should point to mozilla/prism/.mozconfig go back to the mozilla/ directory and do another build, this time,...
Priority Content - Archive of obsolete content
update: i've removed documents from this list that have been migrated into the wiki. the list of completed documents is available through the devedge page. if you would like to sign up to do the migration of any of these works, just "edit" this page and
add your name to the "migrators" list for the piece. if there is devedge content you think should be migrated that isn't currently on this list, feel free to
add it. note: use example at sample:original document information to credit original authors. devedge devedge mirror note: if you're digging around the mirror and see anything there that you think should be migrated to devmo that isn't on this list, feel free to
add it below. a raw list of everything that has not been migrated at all appears there. book length works in prog...
...nal: author's page and planned host, ben's temporary host wiki location: toc and links page still under construction. migrators: nigel mcfarlane and ben karel shorter works mostly completed: bypassing security restrictions and signing code original: bypassing security restrictions and signing code wiki location: bypassing security restrictions and signing code migrators: joel stanley i
added the related links from the original article. however, the link about signtool seems to be broken. anyone knows what to do? mathieu deaudelin 15:22, 17 may 2005 (pdt) mostly completed: netscape gecko compatibility handbook original: netscape gecko compatibility handbook wiki location: gecko compatibility handbook migrators: mathieu deaudelin there are inline examples on this page that cann...
Hacking wiki - Archive of obsolete content
copy one from the mediawiki tarball. once you're done with the configuration script, copy the <tt>config/localsettings.php</tt> file it created to the parent directory and navigate to the location you installed mediawiki to. a main page should appear. you can log in and switch the skin to devmo if you like. mdc customizations the mdc wiki uses a few mediawiki extensions. you can enable them by
adding include("extensions/exampleext.php"); to the end of your <tt>localsettings.php</tt>. for example: [snip] include("extensions/breadcrumbs.php"); include("extensions/titleoverride.php"); include("extensions/abbr.php"); include("extensions/object.php"); include("extensions/kbd.php"); ?> tbd installing/configuring rss and doxygen extensions - anything special needs to be done? the title-overr...
...hp"); to the end of your <tt>localsettings.php</tt>. for example: [snip] include("extensions/breadcrumbs.php"); include("extensions/titleoverride.php"); include("extensions/abbr.php"); include("extensions/object.php"); include("extensions/kbd.php"); ?> tbd installing/configuring rss and doxygen extensions - anything special needs to be done? the title-override / breadcrumbs extensions need an
additional table created. to configure it, run <tt>update-devmo.php</tt> from the command line. the following worked for me (from the <tt>www</tt> directory): /path/to/php -f ./maintenance/update-devmo.php done you should have a working install of the mdc wiki now. if you have problems with setting up the mdc wiki (and not the web server or php or mediawiki), feel free to ask in #devmo. random ...
RDF Datasource How-To - Archive of obsolete content
a "file system datasource" would translate the file system into statements like "/tmp is a directory" and "/tmp/foo is contained within /tmp". an "imap datasource" would use the imap protocol to translate your mail server's inbox as a collection of statements like "message number 126's subject is 'make money fast on the internet'" and "message number 126 was sent by 'spammer128@hotmail.com'". ...
...deciding on a vocabulary the vocabulary is the set of properties that you will use to express relationships between elements (resources and literals) in your data model. ...
Safely loading URIs - Archive of obsolete content
er it's safe to load a particular uri. these methods are exposed on the nsiscriptsecuritymanager interface and are called checkloaduri, checkloaduriwithprincipal, and checkloaduristr. all three methods take three arguments: the first argument identifies the source of the uri, the second argument is the uri that one plans to load, and the third argument is a set of flags that can be used to impose
additional restrictions on the uris that may be loaded. it's important to make sure that the first argument to these methods identifies the source of the uri. so if you're implementing a context menu and you
add a "view image" option, the source of the image uri would be the page the image is in, not the chrome document the context menu code is in. differences between the methods the three methods ...
...s uri objects, etc.) use whichever method best fits the data you can get your hands on. if you have a choice as to what data you have, prefer checkloaduriwithprincipal to checkloaduri and prefer checkloaduri to checkloaduristr. note that checkloaduriwithprincipal is not scriptable in gecko 1.8, so extensions are not able to use it. changes in gecko 1.9 a key security change in gecko 1.9 is the
addition of the new security.fileuri.strict_origin_policy preference. this boolean preference, which defaults to true, can be set to false if the user doesn't want to strictly enforce the same origin policy on file: uris. see same-origin policy for file: uris for details. ...
Running Tamarin acceptance tests - Archive of obsolete content
runtests.py with -h/--help) --nohtml : will suppress the creation of an html output file --rebuildtests : will only rebuild test .abc's, will not attempt to run them. ...
... the creation of an html output file --rebuildtests : will only rebuild test .abc's, will not attempt to run them. can also be using in conjunction with --threads -f --forcerebuild force rebuild all test files -q --quiet : will print a period (.) for each test run regardless of results, then print the test run summary when finished --ascargs= :
additional arguments to pass to asc.jar --vmargs= :
additional arguments to pass to avmshell --random : run tests in random order --timeout : max time for testrun --verify : run a verify pass instead of running abcs --verifyonly : run a -dverifyonly pass: only checks test exitcode (only works with debugger vms) testing the android shell the instructions above apply to running tests on an android device as well, but with a few differences. you should...
Using Breakpoints in Venkman - Archive of obsolete content
e executed when the associated breakpoint is hit, you can select a number of different options from the future breakpoint properties dialog that determine how venkman will deal with the output of the associated script. the following options are available: continue regardless of result causes venkman to continue normal execution after running the breakpoint script. this can be useful to try out
additional code, on the fly. stop regardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. if the breakpoint script returns a true value (it doesn't have to strictly be a boolean true, any non-null, non-empty string, non-zero, non-undefined, and non-fa...
...the //@jsd_eval command will insert a breakpoint which is set to execute the script that follows without stopping and without logging the result. these meta comments can be used 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—previous article on venkman. venkman's home page on devmo. original document information authors: robert ginda, ian oeschger published 02 may 2003 ...
Anonymous Content - Archive of obsolete content
chical. style rules can be written with the assumption that they will match (in the above example) both the file control and the element focused inside the file control. in other words, an arbitrary chain of elements can be in the :focus state at the same time. mouseover and mouseout events mouseover and mouseout events are retargeted if the mouse genuinely enters or exits the bound element (in
addition to entering or exiting some anonymous content). if, however, the user has simply moved the mouse from one anonymous element to another, without entering or exiting the bound element itself, then the event is stopped. for example, if the user enters the html file upload control from the left, a mouseover event is generated for the anonymous textfield. because this event also constitutes a mo...
...ves the button, then the mouseout generated will be retargeted, since the file control will also have been exited. anonymous content and css selectors and scopes bindings can interleave anonymous elements between the bound element and its explicit children. see insertion points for more information. in this situation, a new tree emerges that is different from the explicit content node tree. in
addition to having a single explicit parent (the bound element) the explicit children also have an arbitrary set of anonymous parents (created by bindings when child insertion points were used). child, descendant, and sibling selectors will match on any path of anonymous and explicit elements. as far as css is concerned, anonymous content nodes are children (or descendants) of the bound element, the...
Binding Attachment and Detachment - Archive of obsolete content
using element.style property none of the xbl inheritance properties of element.style.mozbinding described here are implemented (if ever). bindings can be attached to elements through the scripting by assigning the element.style.mozbinding property. respectively bindings can be detached by setting element.style.mozbinding to empty string. note: some older papers mentioned dom methods document.
addbinding and document.removebinding; these were subsequently discarded as redundant and not implemented. var checkbox = document.getelementbyid("mycheckbox"); checkbox.style.mozbinding = "url(http://www.mozilla.org/xbl/htmlbindings.xml#checkbox)"; this attachment is not necessarily synchronous. scripts that invoke this method should not assume that the binding is installed immediately after thi...
...then the base binding at the end of the inheritance chain is the one that will inherit from the most derived binding that is already attached. for example, given a binding d1, with an explicit inheritance chain of d1 -> d2 -> d3 if this element is attached to an element using element.style.mozbinding that already has a binding chain of s1 -> s2 -> s3 the resulting binding chain following the
addition of the binding is d1 -> d2 -> d3 -> s1 -> s2 -> s3 the inheritance between d3 and s1 is implicit, meaning that there is no connection in the xbl documents between the two bindings. the inheritance link has been forged dynamically through the invocation of the element.style.mozbinding. <constructor> call as a document is loaded and style rules are matched for elements, any binding documen...
Event Handlers - Archive of obsolete content
his 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 preventing 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 attribute. this attribute is a comma-separated list of modifier keys that must be down at the time t...
...vent handler will fire. for both mouse and key events, modifier keys can be specified using the modifiers attribute. this attribute is a comma-separated list of modifier keys that must be down at the time the key or mouse event occurs in order for the handler to execute. examples of common keys in the list are shift and control. for more details, see the xbl element reference for <handler>. in
addition, mouse events can specify the button and the clickcount. this allows xbl authors to easily define handlers for right-click, or for left double-click, without having to write script on the same handler to differentiate those cases. key events support the charcode and keycode attributes. when set, the corresponding fields in the event object must match for the event to fire. [editor's note: ...
XBL - Archive of obsolete content
res needed for svg. it's similar in spirit to mozilla's xbl, but there are a few subtle (and not-so-subtle) differences. for example, names of the elements are different. also sxbl lacks some features of xbl, such as bindings inheritance and defining methods/properties on bound elements. xbl 2.0 (w3c candidate recommendation) was developed to
address problems found in xbl 1.0 and to allow for implementations in a broader range of web browsers. in 2009 mozilla announced plans to implement xbl2 in future versions of gecko. some differences between sxbl and xbl2 are listed in an article by anne van ke ( seesteren (november, 2005). an overvi...
... by jonas sicking (april, 2007). still living "shadow dom" related specs shadow dom (editor's draft) css scoping » shadow encapsulation see also introduction to xbl from the xul tutorial. custom xul elements with xbl from the xul school tutorial for
add-on developers xbl chapter of "rapid application development with mozilla" xbl 2.0 primer (draft) xbl 2.0 cross-browser implementation in javascript more xbl resources... community view mozilla forums... mailing list newsgroup rs...
File.windowsShortcut - Archive of obsolete content
file.windowsshortcut in this example, the windowsshortcut method is used to
add a shortcut in the program directory ("program" is a keyword for the directory in which the program itself is installed, for example, c:\program files\netscape\netscape 6\" on windows) to windows software (misc.exe) that is installed in the "windows" directory. ...
... program directory ("program" is a keyword for the directory in which the program itself is installed, for example, c:\program files\netscape\netscape 6\" on windows) to windows software (misc.exe) that is installed in the "windows" directory. ...
Examples - Archive of obsolete content
examples trigger scripts and install scripts describes typical kinds of script that use the xpinstall api. ...
... examples trigger scripts and install scripts describes typical kinds of script that use the xpinstall api. ...
refreshPlugins - Archive of obsolete content
ser. note that refreshplugins must be called after the performinstall method that initiates the actual installation. ...
...eshplugins must be called after the performinstall method that initiates the actual installation. ...
XTech 2005 Presentations - Archive of obsolete content
web 1.6: a rope of sand - opening keynote, mike shaver mozilla e4x - brendan eich "ecmascript for xml" (ecma-357), a new standard for writing and processing xml directly in javascript (ecma-262, iso-16262). e4x marries xml and javascript syntax, and extends javascript to include namespaces, qualified names, and xml elements and lists. e4x also
adds new javascript operators for filtering xml lists, and for enumerating xml children and descendants. another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other. directions of the mozilla rdf engine: website scripting, standards conformance and perfomance - axel hecht this presentation showed new...
...otential in web applications, browsers must expose rich new graphics apis to web content. the mozilla project will meet this challenge with two major new features to be delivered in firefox 1.1: integrated svg and a new canvas html element. work is also underway "under the hood" on a new unified graphics architecture that uses 3d graphics processors to accelerate all rendering. this work provides
additional benefits to web developers such as the ability to apply svg effects to html content. extending gecko with xbl and xtf - brian ryner this session explored ways to extend mozilla/firefox to handle new xml tags and namespaces via drop-in extensions to the layout engine. xul - mozilla's xml user interface language - ben goodger ben goodger, lead engineer for mozilla firefox, talked a...
buttons - Archive of obsolete content
wing values can be used in the list: accept: the ok button, which will accept the changes when pressed. this button will also be the default button. cancel: the cancel button which will cancel the operation. help: a help button for displaying help about the dialog. disclosure: a button to show more information. this might be a button or a disclosure triangle. extra1: an optional
additional button. you can set its label with the buttonlabelextra1 attribute and its command with the ondialogextra1 attribute. extra2: a second optional
additional button. you can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a si...
...his attribute to "," (a single comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an
additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). ...
right - Archive of obsolete content
type: string (representing an integer) for elements placed directly within a stack, specifies the pixel position of the right edge of the element relative to the right edge of the stack. positive values are to the left; negative values are to the right of the right edge of the stack. this location is specified with respect to the right edge of the stack prior to the element being evaluated, or
added to the stack. placing the element which contains this attribute within the stack may result in the stack changing size. for example, using right="-80" causes the stack to be enlarged 80 pixels to the right and the element's right edge to be at the same location as the right edge of the stack. in other words, the right edge of the element is placed 80 pixels to the right of where the right edg...
...ntains this attribute within the stack may result in the stack changing size. for example, using right="-80" causes the stack to be enlarged 80 pixels to the right and the element's right edge to be at the same location as the right edge of the stack. in other words, the right edge of the element is placed 80 pixels to the right of where the right edge of the stack was prior to the element being
added. the stack is then enlarged to include the element. ...
spellcheck - Archive of obsolete content
« xul reference home spellcheck type: boolean if true, spell checking is enabled by default for the text box; if false, spell checking is disabled by default. ...
... ...
Uploading and Downloading Files - Archive of obsolete content
a file, it can be uploaded to a server. this operation can also be performed via a script using the xmlhttprequest object. this is a common technique for uploading files as it is compatible with existing servers and formdata interface makes that task fairly simple. a formdata object will automatically generate request data with mime type multipart/form-data that existing servers can process. to
add a file field to the data you use a file object that an extension can construct from file path. the formdata object can then simply be passed to xmlhttprequest: function upload(posturl, fieldname, filepath) { var formdata = new formdata(); formdata.append(fieldname, new file(filepath)); var req = new xmlhttprequest(); req.open("post", posturl); req.onload = function(event) { alert(even...
...nction upload(posturl, fieldname, filepath) { var formdata = new formdata(); formdata.append(fieldname, new file(filepath)); var req = new xmlhttprequest(); req.open("post", posturl); req.onload = function(event) { alert(event.target.responsetext); }; req.send(formdata); } http put you can also upload a file using an http put operation. this is simpler but it doesn't allow sending
additional data and web servers usually need special configuration to support put operations. function uploadput(posturl, filepath) { var req = new xmlhttprequest(); req.open("put", posturl); req.setrequestheader("content-type", "text/plain"); req.onload = function(event) { alert(event.target.responsetext); } req.send(new file(filepath)); } in this example, a new input stream is created ...
loadOneTab - Archive of obsolete content
ference home loadonetab( url, referreruri, charset, postdata, loadinbackground, allowthirdpartyfixup ) loadonetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackground: ..., allowthirdpartyfixup: ..., relatedtocurrent: ... }) return type: tab element opens a new tab that loads a page with the specified url. the rest of the parameters are optional. this method works the same as
addtab except for the loadinbackground parameter which allows you to choose whether to open the new tab in foreground or background. there's also no owner parameter as the owner tab is specified automatically. parameters inbackground if true the tab will be loaded in the background, if false the tab will be the newly selected tab. and if null or not specified, this parameter will default to...
...ound or background. there's also no owner parameter as the owner tab is specified automatically. parameters inbackground if true the tab will be loaded in the background, if false the tab will be the newly selected tab. and if null or not specified, this parameter will default to the browser.tabs.loadinbackground preference. firefox 3.6 note the second form of this method was
added in firefox 3.6; it
adds the relatedtocurrent parameter, and allows the parameters to be specified by name, in any order. ...
Methods - Archive of obsolete content
« xul reference home acceptdialog
additemtoselection
addpane
addprogresslistener
addsession
addtab
addtabsprogresslistener advance advanceselectedtab appendcustomtoolbar appendgroup appenditem appendnotification blur cancel canceldialog centerwindowonscreen checkadjacentelement clearresults clearselection click close collapsetoolbar contains decrease decreasepage docommand ensureelementisvisible ensureindexisvisible ensureselectedelementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffir...
...sprogresslistener removetransientnotifications replacegroup reset rewind scrollbyindex scrollbypixels scrolltoindex select selectall selectitem selectitemrange selecttabatindex setselectionrange showpane showpopup sizeto startediting stop stopediting swapdocshells syncsessions timedselect toggleitemselection related dom element methods dom:element.
addeventlistener dom:element.appendchild dom:element.comparedocumentposition dom:element.dispatchevent dom:element.getattribute dom:element.getattributenode dom:element.getattributenodens dom:element.getattributens dom:element.getelementsbytagname dom:element.getelementsbytagnamens dom:element.getfeature fixme: brokenlink dom:element.getuserdata dom:element.hasattribute dom:...
Popup Guide - Archive of obsolete content
s properties of a selected element. tooltips when the mouse is positioned over a ui control, a tooltip provides a small box with descriptive help about that control. when the mouse is moved away from the control, the tooltip automatically disappears. a tooltip can be created by setting the tooltiptext attribute on an element or by using the tooltip element. working with popups the following
additional information is available about manipulating menus and popups. opening a menu or popup most menus and popups are opened automatically when they are associated with an element. to open a popup using script use the openpopup method or the openpopupatscreen method. for detailed information about how to open a popup see opening a popup or opening a menu. closing a menu or popup for inf...
...e popup events. handling keys within popups for information about how keys are handled within menus and panels, see handling keys within popups. platform specific menu considerations see special per-platform menu considerations for some notes about handling menus on certain platforms, for instance creating the application menu on a macintosh. using popups in extensions extensions may
add additional menuitems either to a menu on the menu bar or to the context menu. in
addition, an extension may
add an entirely new menu. for example, an extension might wish to
add a new command on the tools menu to open a dialog specific to the extension. another common task is to create an extension which
adds an item to the browser's context menu. see using menus and popups in extensions for deta...
Actions - Archive of obsolete content
button id="http://www.xulplanet.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 previous 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 button's label will be the value of the ?relateditem variable. you would only use the uri attribute on a single element since only one of the generated elements should be given a particular id. although the uri attribute should only be on one element, it does not have to be the outermost element in the action body. ...
Introduction - Archive of obsolete content
hich are all combined into a single datasource as if they were all in one datasource to begin with. only the built-in rdf type supports this mechanism; the xml and sqlite types do not. when multiple datasources are used, an nsirdfcompositedatasource is created to hold all of the datasources. you can get this composite datasource in a script by using an element's 'database' property if you want to
add or remove datasources from it. when multiple datasources are used, the rdf is combined as if it were one large datasource. that means that a template query can grab data from anywhere in all of the datasources. this combining of datasources is often termed 'aggregation'. this can be quite a useful feature and works regardless of the datasource. for instance, you might use the built-in bookmarks d...
...bined as if it were one large datasource. that means that a template query can grab data from anywhere in all of the datasources. this combining of datasources is often termed 'aggregation'. this can be quite a useful feature and works regardless of the datasource. for instance, you might use the built-in bookmarks datasource which holds the user's browser bookmarks and use your own datasource to
add custom data about those bookmarks. <vbox datasources="rdf:bookmarks http://www.xulplanet.com/ds/sample.rdf"> in
addition, when using the rdf type for chrome xul (such as in extensions), the datasource rdf:local-store is always included in the composite. the local store is a datasource which is usually used to hold state information such as window sizes, which columns in a tree are showing, and w...
Recursive Generation - Archive of obsolete content
xulplanet.com/rdf/a"/> <button label="http://www.xulplanet.com/rdf/c"/> </hbox> <hbox id="http://www.xulplanet.com/rdf/d"> <button label="http://www.xulplanet.com/rdf/a"/> <button label="http://www.xulplanet.com/rdf/d"/> </hbox> </vbox> for the next iteration, the insertion point will be the three <hbox> elements. however, since c is the only element that will end up having any
additional content, only the second <hbox> element will have
additional children
added to it. for a nested item, the builder processes the query in the same way as usual, however instead of using the ref attribute as the seed starting point, the end point or member is used instead. this will correspond to the id on the appropriate element in the generated content above. to begin, b is evaluated and s...
...uated and seeded with the right value: (?start = http://www.xulplanet.com/rdf/b) the <triple> statement is then examined, however, item b doesn't have a relateditem arc out of it, so the result is rejected. since there are no potential results, the builder doesn't generate anything. a similar situation will occur for item d. however, for item c, the triple does match an item, so the data will be
added to the potential result: (?start = http://www.xulplanet.com/rdf/c, ?relateditem = http://www.xulplanet.com/rdf/d) a match has occured, so the content within the action body will be created and
added inside item c. since the ?start variable points to item c and the ?relateditem variable points to d, the buttons will be created with these labels. if you look at the image of the example again, y...
Simple Query Syntax - Archive of obsolete content
ver a template does not have a <query> element. if a <query> element is present, the full syntax is used instead. in the simple syntax, the builder will use the default query shown above, although the variable names are randomly generated. since the photos list iterates over the children of a container, we can use the simple syntax. here is what it might look like: <template> <vbox class="box-p
added" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </template> there is no <query> or <action> element used. instead, the builder uses a default query, and the action is placed directly inside the <template> element. you can see that this code is much simpler than the full syntax. to understand how this works, let's examine how the b...
...n this case, all of the criteria must match for the result to be accepted. for example, to filter for photos with a specific country: <hbox id="photoslist" datasources="template-guide-photos4.rdf" ref="http://www.xulplanet.com/rdf/myphotos" xmlns:r="http://www.xulplanet.com/rdf/"> <template> <rule r:country="http://www.daml.org/2001/09/countries/iso#it"> <vbox class="box-p
added" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </rule> </template> </hbox> this example shows how a single attribute may be used to filter for only those results that have a country set to 'http://www.daml.org/2001/09/countries/iso#it'. photos that do not have this country will not have any content generated for...
Static Content - Archive of obsolete content
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 one. one interesting thing about this example is that only one men...
...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 one. one interesting thing about this example is that only one menupopup will be crea...
XML Assignments - Archive of obsolete content
the xml. 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. here is an example: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?namelength" expr="string-length(@name)"/> ...
...e)"/> <assign var="?siblings" expr="count(../*) - 1"/> </query> <action> <hbox uri="?" align="center"> <button label="?name"/> <label value="?gender"/> <label value="?namelength"/> <label value="?siblings"/> </hbox> </action> </template> </vbox> two assign elements are placed as children of the query element. it allows us to declare
additional variables that may be used in the action body. the expr attribute specifies the xpath expression and the var attribute specifies the variable to assign to. note that while the query expression uses the root node (or reference node) as the xpath context, the expressions for the assign element are evaluated using each result node as the context. for each result, the ?namelength variable will...
Template Guide - Archive of obsolete content
basics of xul templates introduction rule compilation rdf template syntax result generation rdf query syntax actions recursive generation simple example bindings
additional navigation filtering static content simple query syntax containment properties xml template syntax xml templates xml assignments sql template syntax sqlite templates common template syntax attribute substitution multiple rules using recursive templates building menus with templates special condition tests multiple queries using multiple queries to generate more results building trees with templates building trees building hierarchical trees template modifications template builder interface template and tree listeners rdf modifications
additional topics sort...
...it allows to use javascript objects as a data source for xul templates. interwiki language links ...
Complete - Archive of obsolete content
ping extensions. introduction you can use the custom toolbar button tutorial as a very simple introduction to extensions. however, because it is so simple it does not support some of the usual features of extensions. this page describes how to structure the extension in a more conventional way. this page is not a step-by-step tutorial. instead it explains the missing features, and outlines how to
add them. if you want to see these techniques in action, then you can download and install the complete allcustom extension: allcustom.xpi (the link is external only because this wiki does not support xpi files.) the extension does not contain any useful functions. it is just an extended code sample. to see the code, use a jar tool or zip tool to unpack the xpi file that you downloaded. for more inf...
...ocale/fr-fr/allcustom/install.properties testing a locale to test the alternative locale, install the extension in the normal way. restart the application using the command line switch: -uilocale fr-fr (of course, if your application is already in french, specify en-us here to switch the extension to english.) notes: if you use a shortcut or launcher icon to start the application, then you can
add the command line switch by editing the icon's properties. the application's user interface only switches language if you have the appropriate language pack installed. but this extension switches between english and french without needing any language pack. some versions of firefox etc. have a bug that prevents this from working. to work around the bug, close the application, delete the file x...
Creating Dialogs - Archive of obsolete content
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. you can pass as many arguments as you wish. this is a convenient way to supply default values to the fields in the dialog. var somefile=document.getelementbyid('enterfile').value; window.opendialo...
... buttons="accept,cancel" ondialogaccept="return dook();" ondialogcancel="return docancel();"> <script> function dook(){ alert("you pressed ok!"); return true; } function docancel(){ alert("you pressed cancel!"); return true; } </script> <description value="select a button"/> </dialog> you may place any elements that you wish in a dialog. the dialog element has some
additional attributes that windows do not have. the buttons attribute is used to specify which buttons should appear in the dialog. the following values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosure button, which is used for showing more information you can set code to execute when the buttons are pressed using ...
Input Controls - Archive of obsolete content
multiline attribute to true, the text entry field will display multiple rows. example 2 : source view <textbox multiline="true" value="this is some text that could wrap onto multiple lines."/> like the html textarea, you can use the rows and cols attributes to set the size. this should be set to the number of rows and columns of characters to display. our find files example let's
add a search entry field to the find file dialog. we'll use the textbox element. <label value="search for:" control="find-text"/> <textbox id="find-text"/> <button id="find-button" label="find"/>
add these lines before the buttons we created in the last section. if you open this window, you will see something much like that shown in the image. notice that the label and the text input field hav...
...in the last section. if you open this window, you will see something much like that shown in the image. notice that the label and the text input field have now appeared in the window. the textbox is fully functional and you can type into it and select text. note that the control attribute has been used so that the textbox is selected when the label is clicked. checkboxes and radio buttons two
additional elements are used for creating check boxes and radio buttons. they are variations of buttons. the checkbox element is used for options that can be enabled or disabled. radio buttons can be used for a similar purpose when there are a set of them and only one can be selected at once. you can use most of the same attributes on checkboxes and radio buttons as with buttons. the example below s...
Introduction - Archive of obsolete content
s the displayed content can be created from the contents of a xul file or with data from a datasource. in mozilla, such datasources include a user's mailbox, their bookmarks and search results. the contents of menus, trees and other elements can be populated with this data, or with your own data supplied in an rdf file. there are several ways you can use xul: firefox extension an extension
adds functionality to the browser itself, often in the form of extra toolbars, context menus, or customizations to the browser's user interface. this is done using a feature of xul called an overlay, which allows the ui provided from one source, in this case, the firefox browser, to be merged together with the ui from the extension. extensions may also be applied to other mozilla based products such ...
...are some guidelines to keep in mind: xul elements and attributes should all be entered in lowercase as xml is case-sensitive (unlike html). attribute values in xul must be placed inside quotes, even if they are numbers. xul files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. in
addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko engine, such as netscape 6 or later and mozilla firefox. due to various changes in xul syntax over time, you will want to get the latest version for the examples to work properly. xul is fairly similar in firefox and to other browsers, although ...
Modifying the Default Skin - Archive of obsolete content
erchrome.css if you place a file called 'userchrome.css' in a directory called 'chrome' inside your user profile directory, you can override settings without changing the archives themselves. this directory should be created when you create a profile and some examples placed there. the file 'usercontent.css' customizes web pages, whereas 'userchrome.css' customizes chrome files. for example, by
adding the following to the end of the file, you can change all menubar elements to have a red background. menubar { background-color: red; } if you open any firefox window after making this change, the menu bars will be red. because this change was made to the user style sheet, it affects all windows. this means that the browser menu bar, the bookmarks menu bar and even the find files menu bar ...
... if you open any firefox window after making this change, the menu bars will be red. because this change was made to the user style sheet, it affects all windows. this means that the browser menu bar, the bookmarks menu bar and even the find files menu bar will be red. skin packages to have the change affect only one window, change the style sheet associated with that xul file. for example, to
add a red border around the menu commands in the bookmarks manager window,
add the following to bookmarksmanager.css in the classic.jar or your favorite skin archive. menuitem { border: 1px solid red; } if you look in one of the skin archives, you will notice that each contain a number of style sheets and a number of images. the style sheets refer to the images. you should avoid putting referenc...
Numeric Controls - Archive of obsolete content
for the entry of numeric values or ranges, and well as two elements for entering dates and times. 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. if these are set, you can control the range of values that the textbox may be ...
... using this increment by using the up and down cursor keys while the textbox is focused. the decimalplaces attribute indicates how many decimal places to show. the default value is 0, which means show integers only. however a different value may be used to show decimal values. <textbox type="number" decimalplaces="2"/> in this example, two digits right of the decimal point are shown. values with
additional fractional digits are rounded to two digits. scales a scale element may also be used to select from a range of values. instead of a textbox however, a sliding scale is used. the user may drag the thumb of the scale to adjust the value. many of the same attributes as a numeric textbox may be used with a scale: value, min, max and increment may all be used in a similar fashion. the scale...
Persistent Data - Archive of obsolete content
ation about each window. this method has the advantage that it works with mozilla user profiles, so that each user can have different settings. xul allows you to save the state of any element. you will typically want to save toolbar states, window positions and whether certain panels are displayed or not, but you can save almost anything. persist attribute to allow the saving of state, you simply
add a persist attribute to the element which holds a value you want to save. the persist attribute should be set to a space-separated list of attributes of the element that you want to save. the element must also have an id attribute in order to identify it. for example, to save the size of a window, you would do the following: <window id="somewindow" width="200" height="300" persist="width h...
... a space-separated list of attributes of the element that you want to save. the element must also have an id attribute in order to identify it. for example, to save the size of a window, you would do the following: <window id="somewindow" width="200" height="300" persist="width height" . . . the two attributes of the window element, the width and the height will be saved. you could
add additional attributes by
adding a space and another attribute name to the persist attribute. you can
add the persist attribute to any element and store any attribute. you might use unusual values if you adjust attributes using a script. our find files example let's
add the persist attribute to some of the elements in the find files dialog. to save the position of the window. to do this, we nee...
Scroll Bars - Archive of obsolete content
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. ...
...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. ...
The Chrome URL - Archive of obsolete content
set of files, yet the xul and scripts don't need to change. here are some more examples. note how none of the urls specify which theme or locale is used and none specify a specific directory. ...
...some dialog boxes may not work right, however, as they may be expecting arguments to be supplied from the window that opened them. ...
Tree Selection - Archive of obsolete content
« previousnext » the section will describe how to get and set the selected items in a tree. 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. the user may also chan...
...n 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 current selection or not. if true, the range will be
added to the existing selection. if false, all existing selected rows will be deselected first. finally, the clearrange() function may be used to deselect a range of rows, leaving rows outside the range unaffected. tree.view.selection.clearrange(2,7); next, we'll find out how to create a custom view for a tree. « previousnext » ...
Updating Commands - Archive of obsolete content
« previousnext » in this section, we will look at how to update commands. 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. a simple way of doing this is the following: var controller = document.commanddispatcher.getcontrollerforcommand("cmd...
...application. the only other thing you need to do is ensure that the enabled status of the paste command, and therefore the button, is updated at the right time, which is described below. command updaters a command updater is a feature of the commandset element which allows it to update commands when certain events happen. you will need to think about when a command is valid and when it is not. in
addition, you will need to consider when the state could change and when the commands should be updated. for example, the paste command is valid when a textbox has the focus and there is something on the clipboard to paste. the command will become enabled whenever a textbox is focused and when the clipboard contents change. a command updater will listen for these situations and code can be executed w...
Using spell checking in XUL - Archive of obsolete content
checking the spelling of a word to check the spelling of a word, you must first create an interface to the mozispellcheckingengine component and then call the check() method on the string you wish to test. this method returns true if the word is correctly spelled, or false if it's not. ...
... var mpersonaldictionary = components.classes["@mozilla.org/spellchecker/personaldictionary;1"] .getservice(components.interfaces.mozipersonaldictionary); if (mpersonaldictionary.check("kat", gspellcheckengine.dictionary)) { // it's spelled correctly accourdly to user personal dictionary } else { //...
Using the Editor from XUL - Archive of obsolete content
e to the nseditorshell goes away (as a result of nseditorboxobject releasing its reference) it releases the owning reference on the editor. editor event handling editing operations happen in response to user events: mouse, key, drag and drop, and ime (international text input) events. in order to receive these events, the editor registers several event listeners on the document being edited. in
addition, editor actions in the user interface are propagated via the xul and javascript, and call methods on the nseditorshell. this editor command dispatching is described separately. the following event listeners are registered: in nshtmleditor::installeventlisteners(), we install the following. these get installed for all types of editor (i.e. for text widgets and composer): nstexte...
...r sets the inline input composition string. nstexteditorcompositionlistener nstexteditorcompositionlistener implements another ime-related interface, nsidomcompositionlistener. this is called by ime at the start, end, and to query the current composition. nstexteditordraglistener the drag listener handles drag and drop events in the editor. it responds to the start of a drag in draggesture by
adding data to the drag, notifies the drag whether a drop can occur in dragover, and handles the drop by inserting data in dragdrop. nseditorshellmouselistener this is an odd-man-out event listener, in that it's registered from the editorshell, rather than internally to the editor. note: this is ugly, and should probably be redesigned to work on callbacks out of the editor, or moved entirely to jav...
XUL element attributes - Archive of obsolete content
ingle composite datasource which holds the data from all of the datasources. this composite datasource is accesssible via a script through the database property. for xml datasources, only one source is used, either the url of an xml file or an anchor reference to another element within the same document. for instance, the reference '#data' refers to an element with the id 'data'. if you plan on
adding a datasource to an element but don't want one to be
added right away, set this attribute to 'rdf:null'. this will make the element so that its contents can be generated from a datasource. otherwise, you cannot
add one later. when the xul document is contained on a remote web site, the datasources may only be loaded from the same domain as the document. dir type: one of the values belo...
...ed in xbl. the element should fire change, command, or input event when the value is changed so that the preference will update accordingly. see the pref system documentation for more information. querytype type: string indicates the type of datasource used in a template. firefox 3 provides 3 built-in datasources: 'rdf', default, 'xml' and 'storage'. extensions may provide support for
additional datasources. ref type: uri for template-generated elements, this attribute is used to specify the root rdf node where content generation begins. this will correspond to the value of an about attribute on an rdf container. this attribute should be placed alongside the datasources attribute. removeelement type: id when placed on an element in an overlay, it indicates that t...
arrowscrollbox - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. smoothscroll type: boolean true initially enables smooth scrolling for the corresponding arrowscrollbox, false disables it. currently, smooth scrolling supports horizontal arrowscrollboxes only. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. element...
... scroll forward that many lines, or a negative value to scroll backward that many lines. scrollbypixels( pixels ) return type: no return value scrolls the contents of the arrowscrollbox by a certain number of pixels. use a positive value as the pixels argument to scroll forward that many pixels, or a negative value to scroll backward that many pixels. ...
assign - Archive of obsolete content
for more information, see xml_assignments attributes expr, var examples (example needed) attributes expr type: string for xml queries, an xpath expression which returns results. any namespace prefixes declared on the element may be used within the expression. var type: string for the xul assign attribute, this is the variable to assign the value to; otherwise it's a reference to a template variable such as "?name". ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
caption - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on t...
... crop type: string gets and sets the value of the crop attribute. image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. tabindex type: integer gets and sets the value of the tabindex attribute. ...
colorpicker - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. color type: color string the currently selected color. this is modified when the user selects a color. you can assign a string of the form #rrggbb to this property to change the selected color. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed b...
... gets and sets the value of the disabled attribute. open type: boolean returns true if the popup for a button-type colorpicker is open. set this property to true to open the popup or false to close the popup. tabindex type: integer gets and sets the value of the tabindex attribute. ...
commandset - Archive of obsolete content
a common use of the command updater is to update cut, copy, and paste menu items. more information is available in the xul tutorial. ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
dialogheader - Archive of obsolete content
s text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can
add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description type: string descriptive text to appear in
addition to the dialog title. title type: string the text to appear in the title bar of the window. properties inherited properties align, , allowevents, , boxobject, builder, , , , classn...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
editor - Archive of obsolete content
attributes editortype type: one of the values below the type of editor to use. this value will be overridden depending on the content ty...
...gument. gethtmleditor( window ) return type: nsihtmleditor returns the html editing interface for the editor which contains methods for manipulating an html document. pass the editor's contentwindow as the argument. makeeditable( editortype, waitforload ) return type: no return value this function enables editing for an editor. specify text or html as the editortype. ...
image - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
...tnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes alert-icon class that
adds an alert icon. this typically looks like an exclamation mark. this and the other icon classes may be used by image elements or other elements which can have an image. error-icon class that
adds an error icon. this will typically be a red "x" icon. message-icon class that
adds a message box icon. question-icon class that
adds a question icon, which usually looks like a question mark. ...
keyset - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
listhead - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. 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, ordinal, orient, pack, persist, popup, posit...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
listheader - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, con...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
preference - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property 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 instea...
...alls onsynctopreference. boolean iselementeditable(in domelement element) returns true, if the given element is "editable" (see below). void setelementvalue(in domelement element); initializes the supplied element from the value stored in the preference. this function calls onsyncfrompreference. void updateelements(); update all elements that observe this preference. ...
prefpane - Archive of obsolete content
s attached. void userchangedvalue(in domelement element); the user changed the value in a widget that the preferences system does not automatically track state changes for (1) and the preference element associated with the widget should be updated based on the state held by the widget. for example, if you are using a listbox and the user changes the contents of the listbox (such as
adding or removing an item) and you want to sync the changes back to a preference, you must write an onsynctopreference handler for your listbox that returns the value to be written to the preference element, and then call the userchangedvalue function every time you edit the list in a way that should cause the preference's value to change. (1) an example of a widget that has state changes tra...
...ist in a way that should cause the preference's value to change. (1) an example of a widget that has state changes tracked for it includes the checkbox element, whose state is tracked automatically when the "command" event fires. void writepreferences(in boolean flushtodisk); writes all changes in this pane to preferences, optionally flushes to disk. ...
progressmeter - Archive of obsolete content
this is used when the length of time to complete an operation is not known beforehand. more information is available in the xul tutorial. ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
richlistitem - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. searchlabel type: string text used for 'find-as-you-type' (fayt) searching. in situations where the search text is ambiguous or missing, searchlabel can be used to give context to fayt. if searchlabel is not present, fayt falls back to use the label property. selected type: boolean indicates whether the element is selected or not. this value is read-only. to cha...
...arator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
rule - Archive of obsolete content
is used in a template. the children of the rule are used to declare the conditions in which the rule matches and the content that is generated. a rule may contain where, binding and/or action elements. a condition is defined used a where element. for each result that matches all of the conditions, content within the rule's action body is generated. the bindings element is optional and may specify
additional variable bindings to be used. when no query element is used in a template, a default query is used and the simple query syntax may be used for rdf datasources. for more information about this, see the simple query syntax. attributes iscontainer, isempty, parent, parsetype examples (example needed) attributes iscontainer type: boolean indicates whether rules match based on...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
scale - Archive of obsolete content
the disabled attribute is allowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update
additional state. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. min type: integer the minimum value the control's value may take. the default value is 0. type: integer th...
... the pageincrement attribute. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
statusbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element used to create a status bar, usually placed along the bottom of a window. it is virtually equivalent to a standard box, but may be rendered differently. contains statusbarpanels. ...
...align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbaritem - Archive of obsolete content
nly an item that appears on a toolbar. this element should wrap all customizable items (unless they're instances of toolbarbutton). if you don't need the thing you're placing in the toolbar to be customized then it doesn't need to be in a toolbaritem element. the element is used, for example, to hold the location bar's textbox in firefox. it is also used to group buttons together so they can be
added and removed all at once like firefox's unified-back-forward-button. examples <toolbaritem> <menulist label="bus"> <menupopup> <menuitem label="car"/> <menuitem label="taxi"/> <menuitem label="bus" selected="true"/> <menuitem label="train"/> </menupopup> </menulist> </toolbaritem> <toolbaritem id="sample-toolbutton-unified"> ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbarpalette - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] firefox only the item is a palette of available toolbar items. it is not displayed, but is used by the toolbar customization dialog to display the list of items. the children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be
added to the toolbar. do not
add the various spacing items, as those are
added automatically. you can
add your own custom buttons to the firefox browser by using an overlay that overlays the toolbarpalette with the idbrowsertoolbarpalette. examples <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="toolbarpalette-button" class="toolbarbutton-class" label="&mylabel;" ...
...ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbarset - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] firefox only this element is used as a container for custom toolbars, which are
added in the custom toolbar dialog. examples (example needed) 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, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait...
...align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
wizardpage - Archive of obsolete content
xul reference home [ examples | attributes | properties | methods | related ] this element defines a page in a wizard. the content in the pages should be placed inside the wizardpage element. more information is available in the xul tutorial. attributes description, label, next, pageid properties next, pageid attributes description type: string descriptive text to appear in
addition to the dialog title. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. next type: id set to the pageid of the next wizardpage after this one. when set, the page with this pageid is displaye...
...object, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
Getting started with XULRunner - Archive of obsolete content
the folder structure: 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 previous 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 ...
...l/xul file the application also has a javascript file. most xul applications will include some external javascript, so the sample application does too, just to show how to include it into the xul file. main.js: function showmore() { document.getelementbyid("more-text").hidden = false; } for more information about xul see: xul. for information about mixing html elements into your xul read
adding html elements. step 8: run the application the moment of truth. we need to get xulrunner to launch the bare-bones application. windows from a windows command prompt opened to the myapp folder, we should be able to execute this: c:\path\to\xulrunner.exe application.ini of course, if you opted to install xulrunner then you could simply do %programfiles%\xulrunner.exe application.ini...
XUL Application Packaging - Archive of obsolete content
xul app packages are typically zipped into an archive with the extension .xulapp or .xpi. they can be installed to xulrunner with a command line flag "--install-app" if xulrunner is registered on the system. see command line options for more details. note: for instructions on deploying your applications see deploying xulrunner. application.ini the application.ini manifest is located at the root of the extension and provides metadata that allows xulrunner to launch the application properly. ...
...d by this application. optional - default value is any xulrunner less than xulrunner 2 example: maxversion=1.8.0.* the [xre] section the xre section specifies various features of xulrunner startup that can be enabled enableextensionmanager specifies whether to enable extensions and extension management. legal values are 1 and 0. optional - default is 0 note: this option does not
add menu items that make the extension/theme manager available in the ui; that is the responsibility of the application author. example: enableextensionmanager=1 enableprofilemigrator specifies whether, when the application is launched for the first time and there are no profiles, to enable profile migration code through the nsiprofilemigrator interface. legal values are 1 and 0. optional...
XUL Explorer - Archive of obsolete content
installs latest version: install (windows): xulexplorer-1.0a1pre.en-us.win32.exe 6.6mb install (mac): xu...
... installs latest version: install (windows): xulexplorer-1.0a1pre.en-us.win32.exe 6.6mb install (mac): xulexplorer-1.0a1pre.en-us.
calICalendarViewController - Archive of obsolete content
summary a calicalendarviewcontroller provides a way for a calicalendarview to create, modify, and delete items. implementing a calicalendarviewcontroller allows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included. calendar/base/public/calicalendarviewcontroller.idlscriptable please
add a summary to this article. last changed in gecko ? interface code [scriptable, uuid(1f783898-f4c2-4b2d-972e-360e0de38237)] interface calicalendarviewcontroller : nsisupports { void createnewevent (in calicalendar acalendar, in calidatetime astarttime, in calidatetime aendtime); void modifyoccurrence (in caliitemoccurrence aoccurrence, in calidatetime anewstarttime, in...
...return this; }, createnewevent: function (acalendar, astarttime, aendtime) { // if we're given both times, skip the dialog if (astarttime && aendtime && !astarttime.isdate && !aendtime.isdate) { var event = createevent(); event.startdate = astarttime; event.enddate = aendtime; event.title = "new event"; acalendar.
additem(event, null); } else if (astarttime && astarttime.isdate) { var event = createevent(); event.startdate = astarttime; acalendar.
additem(event, null); } else { createeventwithdialog(acalendar, astarttime, aendtime); } }, modifyoccurrence: function (aoccurrence, anewstarttime, anewendtime) { // if we can mod...
2006-10-20 - Archive of obsolete content
- october 20, 2006 announcements content filtering, manipulation, and control in firefox 3 an open invitation from myk melez to contribute to the brainstorming of new features for firefox 3 and future firefox releases. myk will be paying close attention to features dealing with content filtering, manipulation and control in ff3. to contribute visit the wiki discussions i wanna make an
addon for firefox a commonly asked question in many newsgroups. jesper kristensen pointed the requester here change download action for .rdp files on windows and os x a question regarding enabling firefox 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 st...
...e 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 pages similar to the mcafee siteadvisor extension.
adding support for new uri scheme question regarding creating a new uri scheme for firefox on windows. helpful information was found here on mozillazine. meetings none this week. authors sara minc...
2006-11-03 - Archive of obsolete content
summary: mozilla.dev.apps.firefox - october 27, 2006 - november 3, 2006 announcements none this week. discussions google adsense plugin for firefox a user post a link to a plugin for displaying "adsense earning" within the status bar of the browser without logging into google. request to
add option for removal of firefox profiles during setup or uninstall a user suggests an option to remove profiles during setup or uninstall. does firefox provide any classes/objects or events to windows wmi ? a user asks if firefox provides any classes/objects or events to windows wmi. no replies yet. source code for the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. picking an alternate search engine for a particul...
...or the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. picking an alternate search engine for a particular search large discussion about how the search engine could be imporved. firing pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab. ff 1.5 hiding a user
adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user suggests a feature to compare different versions of a webpage to see what has changed. xml in firefox is a major problem a user draws attention to what they think is a bug, but the developers say it's proper browser behaviour. what gui lib was used for developing ...
2006-11-04 - Archive of obsolete content
summary: mozilla.dev.apps.firefox - october 27, 2006 - november 3, 2006 announcements none this week. discussions adsense plugin for firefox a user post a link to a plugin for displaying "adsense earning" within the status bar of the browser without logging into google. to
add option for removal of firefox profiles during setup or uninstall a user suggests an option to remove profiles during setup or uninstall. firefox provide any classes/objects or events to windows wmi ? a user asks if firefox provides any classes/objects or events to windows wmi. no replies yet. code for the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. an alternate search engine for a particular search large discussion about how...
...lies yet. code for the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. an alternate search engine for a particular search large discussion about how the search engine could be imporved. pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab. 1.5 hiding a user
adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user suggests a feature to compare different versions of a webpage to see what has changed. in firefox is a major problem a user draws attention to what they think is a bug, but the developers say it's propwer browser behaviour. gui lib was used for developing firefox ...
2006-10-06 - Archive of obsolete content
hence, they are looking for a mac user to test out the new features by building a mac.rdf file with all of the various .mac account properties mentioned in the document here. ...
...hence, they are looking for a mac user to test out the new features by building a mac.rdf file with all of the various .mac account properties mentioned in the document here. ...
2006-11-03 - Archive of obsolete content
irectory `/cygdrive/c/mozilla/obj-i686-pc-cygwin' make: *** [build] error 2 he also noted that he is using make 3.80-1. on november 1st gavin sharp responded phil's question. he said that the problem that phil is experiencing is a known issue. he also mentioned that airbag doesn't build with msvc 7.1. (http://www.google.com/url?sa=d&q=htt...tail%3fid%3d64) gavin recommended that phil should
add |ac_
add_options --disable-airbag| to his .mozconfig. new windows compatibility issue? originally posted on november 1st: dale dale has set up a windows machine in order to perform mozilla builds but has been unsuccessful to do so. according to him he has followed the windows build requirements recommended by mozilla. he also noted that he has had different results (error messages when compi...
...g browser's trunk on windows using vs 2005 originally posted on october 29th: ricardo sixel is trying to retrieve the trunk source code using the browser check out option. however it fails on him. he has created the following bug entry https://bugzilla.mozilla.org/show_bug.cgi?id=331404. announcements a change in tp2's numbers on october 31st adam guthrie announced that: rob helmer will be
adding his patch to fix tp2's reporting of average pre-load times. more tbox changes on the way, most hitting on friday on october 30th j. paul reed announced that: that he is taking down old tinderboxes and making a few changes to existing tinderboxes. on october 30th boris zbarsky boris expresses his opinion about paul taking down one of the two build boxes that produces nightly builds ...
2006-11-17 - Archive of obsolete content
special characters inquiry of how to use special characters in spidermonkey. ...
... special characters inquiry of how to use special characters in spidermonkey. ...
2006-09-29 - Archive of obsolete content
ontaining * block). * @param amargin the sum of the left and right margins of the * frame, including actual values resulting from * percentages, but not including actual values * resulting from 'auto'. * @param aborder the sum of the left and right border widths of the * frame. * @param ap
adding the sum of the left and right margins of the * frame, including actual values resulting from * percentages. * @param ashrinkwrap whether the frame is in a context where * non-replaced blocks should shrink-wrap (e.g., * it's floating, absolutely positioned, or * inline-block). */...
... percentages. * @param ashrinkwrap whether the frame is in a context where * non-replaced blocks should shrink-wrap (e.g., * it's floating, absolutely positioned, or * inline-block). */ virtual nssize computesize(nscoord aavailwidth, nscoord amargin, nscoord aborder, nscoord ap
adding, prbool ashrinkwrap) = 0; details can be located at refactoring some of nshtmlreflowstate. discussion on how to determine whether there is pending layout changes or reflows when using a popup. it was concluded that a frame model change is utilized within a popup, not a layout change. on the reflow branch, check the dirty and dirty_children framestate flags. that...
NPEvent - Archive of obsolete content
nting 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 adjustcursorevent 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 an xevent data structure, which is a union of a number of different x11 event structures. type the type member is an in...
...s: sent if the mouse is within the bounds of the instance. key events: sent if the instance has text focus (see below). update events: sent if the update region intersects the instance's bounds. activate events: sent to all instances in the window being activate or deactivated. suspend/resume events: sent to all instances in all windows. null events: sent to all instances in all windows. in
addition to these standard types, the browser provides three
additional event types that can be passed in the what field of the eventrecord: getfocusevent: sent when the instance could become the focus of subsequent key events, when the user clicks the instance or presses the tab key to focus the instance. if your instance accepts key events, return true, and key events will be sent to the instanc...
The First Install Problem - Archive of obsolete content
ed administrator privileges. thus, some installers may need to write to the hkey_current_user key; this doesn't require administrator privileges. traditionally, hkey_current_user is a copy of everything in hkey_local_machine. at present plugins registered using the hkey_current_user\software\mozillaplugins\ tree are ignored by firefox (bug 293062) but this is fixed in trunk builds (bug 293062).
add the following values to the newly created key -- some are string values (reg_sz), and some are actually subkeys. string values take the form stringvalue=valuedata, and subkeys contain their own string values and value data. "path" -- string value -- this would be the absolute path to the plugin module. this is the path to the actual dll. (note that the file name must still begin with "...
...e use of both "type" and "classid" attributes here offers the following user benefit: if there is another mimetype handler for application/x-myapp, only myapplication gets invoked. the resolution of a mimetype handler is no longer arbitrary. if the "data" file myfile.typ doesn't contain enough resource information to load the correct mimetype handling component (dll), specifying "type" is an
additional mechanism. unlike uuids, plids are human readable, and not lengthy "garbled" strings. (it should be noted that the "classid" attribute discussion here is a potential future direction; it doesn't yet work, at least as of firefox 3.6.8. the recommended <object> attribute to set is still either "type" or "data".) advantage: we now no longer have ambiguity in determining which plugin handle...
Syndicating content with RSS - Archive of obsolete content
ead, listen to, or watch. when you make a blog, an internet radio show, or an internet television show, you are syndicating. rss is a tool which helps to syndicate your content by organizing it into a form that's easy for machines to parse and reuse. this article provides a simple guide to using rss to syndicate web content. syndicating with rss consists of three steps: creating an rss feed.
adding a special <link> element to html page(s).
adding a special <a> element to html page(s). we've already discussed the first step—creating rss feeds— so we'll focus on the other two steps here.
adding the <link> often the data in an rss feed is also made available on an html web page. when this is the case, the html web page can let people and machines know about the feed by using the <l...
...to advertise the rss feed in a more direct way, the html <a> element can be used. this mimics the <link> element discussed above. ...
What is RSS - Archive of obsolete content
syndication but stood for rich site summary. in july of 1999 netscape's rss 0.91 was released. like rss 0.90, netscape's rss 0.91 was also a format for providing a summary of a website, and not really a syndication format (as it is today). netscape's rss 0.91 was created to simplify things. rss 0.90 was rdf-based, which many found to be overly complex. netscape's rss 0.91 was only xml-based and
added a dtd to allow several entities (commonly found in html). so at this point netscape deprecated the rdf-based rss 0.90 and told everyone to use netscape's rss 0.91, which was xml-based. in june of 2000 userland's rss 0.91 was released. (and yes, that means that there are 2 different version of rss 0.91.) the difference between the two different versions of rss 0.91 -- netscape's rss 0.91 and u...
... ...
Proposal - Archive of obsolete content
means that they are still working on it and trying to come up with a draft. those labeled with "draft exists" can be implemented, but be warned that they could radically change. name description status easy news topics easy news topics (ent) is intended to be a very simple standard for describing how topic information can be introduced into an rss2.0 news feed. draft exists icbm let's you
add latitude and longitude info to an item. spec exists itunes rss itunes extension modules used for ipradio/podcasting. spec exists media rss rss extension module used for iptv and ipradio/podcasting. spec exists newsgator feed extension created to make rss feeds work better with newsgator software. lets you specify an image, up to 277x78 pixels. and lets you specifies a specific rendering tra...
... transform must already exist on the machine running newsgator; stylesheets will not be downloaded or installed automatically. spec exists 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 previous item (called the source item) rss 2.0 offers the source element which allows the item to refer to the rss feed which contains the source item. the sguid specification provides a more granular approach by offering an sourceref element which can reference the gui...
Vulnerabilities - Archive of obsolete content
mptions may have been explicit—for example, a designer being aware of a security weakness and determining that a separate security control would compensate for it. however, trust assumptions are often implicit, such as creating a feature without first evaluating the risks it would introduce. threats may also change over the lifetime of software or a protocol used in software. for example, the
address resolution protocol (arp) trusts that an arp reply contains the correct mapping between media access control (mac) and internet protocol (ip)
addresses. the arp cache uses that information to provide a useful service—to enable sending data between devices within a local network. however, an attacker could generate false arp messages to poison a system’s arp table and thereby launch a deni...
...hard to differentiate software feature misuse vulnerabilities from the other two categories. for example, both software flaws and misuse vulnerabilities may be caused by deficiencies in software design processes. however, software flaws are purely negative—they provide no positive benefit to security or functionality—while software feature misuse vulnerabilities occur as a result of providing
additional features. there may also be confusion regarding misuse vulnerabilities for features that can be enabled or disabled—in a way, configured—versus security configuration issues. the key difference is that for a misuse vulnerability, the configuration setting enables or disables the entire feature and does not specifically alter just its security; for a security configuration issue vulner...
Solaris 10 Build Prerequisites - Archive of obsolete content
the installer will try to install the sunwsmbas package, which is not available in newer versions of sxde. ...
...me-2-20 5. unpack the extra spec file tarball to the spec file directory. % cd gnome-2-20 % gtar jxvf firefox-solaris-10-spec.tar.bz2 6. unpack the patch tarball to the patches directory. % cd gnome-2-20/patches % gtar jxvf firefox-3.0-solaris-10-patches.tar.bz2 7. build pkg-config and gtk-doc from source. just unpack the source tarball, run "./configure --prefix=/opt/sfw", make and make install.
add /opt/sfw/bin to path environment after installation. 8. build glib/atk/cairo/pango/gtk2/dbus/dbus-glib/firefox. % . /opt/jdsbld/bin/env.sh % pkgtool --download build-only -v solaris10/sfw{name1}.spec % pkg
add -d . {package_name1} % pkg
add -d . {package_name1}-devel % pkgtool --download build-only -v solaris10/sfw{name2}.spec % pkg
add -d . {package_name2} % pkg
add -d . {package_name2}-devel ......
Theme changes in Firefox 3.5 - Archive of obsolete content
ad a shadow and transparent windows never had a shadow. after that change, transparent windows also have a shadow by default. this can result in unwanted shadows in your theme, e.g. under the autoscroll icon or the identity panel. if you don't want the shadow, you can turn it off by setting the new -moz-window-shadow css property to none on the affected element. browser.xul bug 463189
added a new attribute on the xul window element of browser.xul named browsingmode. the value of this attribute is normal when the private browsing mode is inactive, and private when it's active. this attribute can be used to style different parts of the browser window inside the private browsing mode. see this blog post for an example. supporting 3.5 features video/audio player: controlb...
...n/media/videocontrols.css) shadow effect for disabled text using text-shadow. greying menus of inactive windows: active windows get attribute 'active="true"'. to do this only for 3.5 use a css selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } private browsing: show private browsing state by coloring the url bar, or by
adding an icon to the toolbox/tabbrowserbar. see private browsing for theme designers for details. native hyperlink color: use -moz-nativehyperlinktext, to select the computer's native hyperlink color. all known changes for a list of all the known changes see: mozillazine's forum: theme changes for firefox 3.5 ...
Browser Feature Detection - Archive of obsolete content
e true true true liststyleimage true true true liststyleposition true true true liststyletype true true true margin true true true margintop true true true marginright true true true marginbottom true true true marginleft true true true p
adding true true true p
addingtop true true true p
addingright true true true p
addingbottom true true true p
addingleft true true true textalign true true true textdecoration true true true textindent true true true texttransform true true true ...
...e', 'supported': false}, {name: 'liststyleimage', 'supported': false}, {name: 'liststyleposition', 'supported': false}, {name: 'liststyletype', 'supported': false}, {name: 'margin', 'supported': false}, {name: 'margintop', 'supported': false}, {name: 'marginright', 'supported': false}, {name: 'marginbottom', 'supported': false}, {name: 'marginleft', 'supported': false}, {name: 'p
adding', 'supported': false}, {name: 'p
addingtop', 'supported': false}, {name: 'p
addingright', 'supported': false}, {name: 'p
addingbottom', 'supported': false}, {name: 'p
addingleft', 'supported': false}, {name: 'textalign', 'supported': false}, {name: 'textdecoration', 'supported': false}, {name: 'textindent', 'supported': false}, {name: 'texttransform', 'supported': false}, {name: ...
-ms-filter - Archive of obsolete content
filterfrom.filters.item(0).transition=12; imagefrom.style.visibility = "hidden"; filterto.style.visibility = ""; filterfrom.filters.item(0).play(14); } </script> </body> gradient progid:dximagetransform.microsoft.gradient( <properties> ) where <pr...
...e commas (,) to separate multiple values, as shown in the examples section. an object must have layout for the filter to render. a simple way to accomplish this is to give the element a specified height and width, or both. the shadow filter can be applied to the <img> object by setting the filter on the image's parent container. the filter mechanism is extensible and enables you to develop and
add filters later. for more information about filters, see introduction to filters and transitions. ...
E4X for templating - Archive of obsolete content
warning: e4x is deprecated. 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. e4x can be used for creating templates for dynamic content. while it may be obvious after a study of the basics of e4x that it can be used for this purpose, if one
adds a few common purpose functions (especially along with the convenience of javascript 1.8 expression closures), the templates can function more dynamically, offering the power and readability of templating languages such as smarty for php (though admittedly without the currently wider cross-browser support of xslt or the strictly-xml approach of phptal or seethrough templating). security and escap...
... min; max = number.positive_infinity; min = 1; } if (h.length === 1) { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(arr[k], it, lev); // need to get it or lev via arguments[] since our length detection implies no explicit
additional params; otherwise define with more than one param (see below) ++it; } } else { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(k, arr[k], it, lev); ++it; } } return ret; } the following...
Array.unobserve() - Archive of obsolete content
cause this reference will be used to unset the previous observer. it's useless to call array.unobserve() with an anonymous function as callback, it will not remove any observer. ...
... arr.push(4); // [{type: "splice", object: <arr>, index: 3, removed:[],
addedcount: 1}] array.unobserve(arr, observer); arr.pop(); // the callback wasn't called using an anonymous function var persons = ['khalid', 'ahmed', 'mohammed']; array.observe(persons, function (changes) { console.log(changes); }); persons.shift(); // [{type: "splice", object: <arr>, index: 0, removed: [ "khalid" ],
addedcount: 0 }] array.unobserve(persons, function (changes) { console.log(changes); }); persons.push('abdullah'); // [{type: "splice", object: <arr>, index: 2, removed: [],
addedcount: 1 }] // the callback will always be called ...
New in JavaScript 1.1 - Archive of obsolete content
netscape navigator 3.0 was released on august 19, 1996. netscape navigator 3.0 was the second major version of the browser with javascript support. javascript versions netscape navigator 3.0 also introduced javascript language versions. <script language="javascript"> <!-- javascript for navigator 2.0. --> <script language="javascript1.1"> <!-- javascript for navigator 3.0. ...
...ray.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 object (was previously 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() no...
New in JavaScript 1.3 - Archive of obsolete content
the following is a changelog for javascript from netscape navigator 4.0 to 4.5. the old netscape documentation can be found on archive.org. netscape navigator 4.5 was released on october 19, 1998. the most significant change in javascript 1.3 was compliance with ecma-262 and unicode by removing inconsistencies between javascript 1.2 and the new ecma standard (which was published in june 1997).
additional features of version 1.2, at the time not specified by ecma-262 were kept in the javascript language (see below for a list of differences). javascript versions netscape communicator and navigator 4.06 and 4.5 executes javascript language versions up to 1.3. note that communicator and navigator 4.0-4.05 and earlier ignored scripts with the language attribute set to "javascript1.3" and highe...
...ours() date.prototype.setutcminutes() date.prototype.setutcseconds() date.prototype.setutcmilliseconds() other new features strict equality operators unicode support a javascript console was introduced. changed functionality in javascript 1.3 changes to date to conform with ecma-262 new constructor date(year, month, day, [,hours [, minutes [, seconds [, milliseconds ]]]])
additional method parameters: setmonth(month[, date]) sethours(hours[, min[, sec[, ms]]]) setminutes(min[, sec[, ms]]) setseconds(sec[, ms]) the length of an array (property length) is now an unsigned, 32-bit integer. array.prototype.push(): in javascript 1.2, the push method returned the last element
added to an array. under javascript 1.3, push returns the n...
New in JavaScript 1.5 - Archive of obsolete content
ersion 5.5 and internet explorer 5.5, which was released in july 2000. the corresponding ecma standard is ecma-262 edition 3 (from december 1999). new features in javascript 1.5 number.prototype.toexponential() number.prototype.tofixed() number.prototype.toprecision() const is now a reserved word. multiple catch clauses in a try...catch statement are supported. javascript authors can now
add getters and setters to their objects. changed functionality in javascript 1.5 runtime errors are now reported as exceptions. regular expression changes: quantifiers — +, *, ? and {} — can now be followed by a ? to force them to be non-greedy. non-capturing parentheses, (?:x) can be used instead of capturing parentheses, (x). when non-capturing parentheses are used, matched sube...
...now be followed by a ? to force them to be non-greedy. non-capturing parentheses, (?:x) can be used instead of capturing parentheses, (x). when non-capturing parentheses are used, matched subexpressions are not available as back-references. positive and negative lookahead assertions are supported. both assert a match depending on what follows the string being matched. the m flag has been
added to specify that the regular expression should match over multiple lines. functions can now be declared inside an if clause. functions can now be declared inside an expression. ...
ECMAScript 5 support in Mozilla - Archive of obsolete content
ecmascript 5.1, an older version of the standard upon which javascript is based, was approved in june 2011. the javascript runtime used in the latest versions of mozilla projects including both firefox and thunderbird has full support for ecmascript 5.1 features. this article covers the features supported by different versions of mozilla's javascript runtime. supported features
added in javascript 1.8.5 (gecko 2, firefox 4 and later) firefox 4 has full ecmascript 5 support including the object.* methods and strict mode. 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.stringi...
... 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 prevents 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.observe() - Archive of obsolete content
object to be observed. callback the function called each time changes are made, with the following argument: changes an array of objects each representing a change. the properties of these change objects are: name: the name of the property which was changed. object: the changed object 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", "preventextensions"] will be used. return value the object to be observed. description callback i...
...sions"] 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. ...
JavaArray - Archive of obsolete content
javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. ...
...ta types. when the javaarray is passed back to java, the array is unwrapped and can be used by java code. see the core javascript 1.5 guide for more information about data type conversions. in javascript 1.4 and later, the methods of java.lang.object are inherited by javaarray. backward compatibility javascript 1.3 and earlier the methods of java.lang.object are not inherited by javaarray. in
addition, the tostring method is inherited from the object object and returns the following value: [object javaarray] you must specify a class object, such as one returned by java.lang.object.forname, for the componenttype parameter of newinstance when you use this method to create an array. you cannot use a javaclass object for the componenttype parameter. properties length: the number of eleme...
background-size - Archive of obsolete content
(screenshot), and the same page without the -moz-border-image image rule (screenshot). user:robertc 2009-08-09 this is only an issue with <body> and <html>. <body>'s background extends per css spec to <html>. since you have a 8px default margin on <body> and your <body>'s content is smaller than the viewport's height, you see what you see. styles like this should work: body { border:0; margin:0; p
adding:0.6em } /* or for less content, if body is small */ html, body { height:100%; } body { border:0; margin:0; p
adding:0.6em } furthermore, you may simplify things a bit if you apply the background and border-image styles to <html> rather than <body>. user:jürgen jeka 2009-08-12 ok, probably my understanding of css inheritance isn't all it should be. i tried locating the part of the spec about...
...erstanding of css inheritance isn't all it should be. i tried locating the part of the spec about <body>'s background extending to <html> but it didn't seem to be explicitly mentioned in the cascading and inheritance section and both 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 p
adding 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 je...
XForms Custom Controls - Archive of obsolete content
o meaning outside of this context. focus() is used by the processor to tell the control that it is getting focus through one of a variety of ways (i.e. through xf:setfocus action) and that the control needs to ensure that the proper widget is given focus. with rare exception, your control should only need to implement the nsixformsuiwidget interface. but certain xforms controls need to implement
additional interfaces. such elements include upload and case. nsixformsaccessors the nsixformsaccessors interface allows access to the value and the state of the instance node that the control is bound to (see extensions/xforms/nsixformsaccessors.idl). currently interface is: interface nsixformsaccessors : nsisupports { /** * return value of instance node. */ domstring getvalue(); /** ...
...t 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. one is the base binding that implements the core behavior of the xforms control. the other is the implementation binding that
adds the host-language specific representation of the xforms control. an example of the latter is the binding that uses a html:input as the anonymous content of an xforms:input element when this element is hosted in a xhtml document. our xforms extension uses the following format for file names. the name of the file where base bindings for a control are placed is controlfile.xml. controlfile-xhtml.xm...
RFE to the Custom Controls - Archive of obsolete content
you have a custom control that you believe will help fulfill the needs of form authors or other custom controls authors, please file it here. this page could be of particular interest to people using custom controls in xul documents for the following reason. xul, in many cases, is much better suited for application development than xhtml. therefore the control set may need to be more extensive to
address the wider spectrum of requirements that a xul application will have on its controls. note: xul is a feature of mozilla only and custom control authors should be aware their controls won't work on other browser platforms. rfe put your requests here. output that shows the dom if output contains cdata section or text node and its data is any mozilla known language like xhtml/xul/svg then o...
...illa only and custom control authors should be aware their controls won't work on other browser platforms. rfe put your requests here. output that shows the dom if output contains cdata section or text node and its data is any mozilla known language like xhtml/xul/svg then output should parse and display it (see bug 316817). output should show data in current locale format the bug 331585
address the issue. probably this feature should be implemented by
adding a new custom control. input that shows/modifies the dom like the request above for output. the related bug is bug 348562. ...
RFE to the XForms API - Archive of obsolete content
forms api can fall into two categories. these are xforms dom and xforms interfaces that are exposed by xforms dom. xforms dom is a list of interfaces that are available from xforms elements directly. this means those interfaces available to be queried from the xforms element that resides in the dom. for example, every visual xforms element exposes the nsixformsdelegate interface. if you need some
additional functionality that shouldn't be exposed from the xforms element directly, then you should think which interface of the xforms element is more appropriate to expose it. mozilla xforms doens't offer any service you can get via xpcom. as an example, the nsixformsaccessors interface which allows a user to get/set the value of an instance node and get the state of an instance node, is exposed b...
...d by the nsixformsdelegate interface using the accessors property. xforms dom put here your requirements how to improve xforms dom api. reflect attributes to properties for the elements that can contain the incremental or selection attributes, it makes sense to expose analogous properties. xforms functional interfaces put here your requirements to improve existing xforms interfaces or to
add a new one. ability to get nsixformsaccessors for instance node we need the ability to get to the nsixformsaccessors interface on a node by specifying the node via an xpath expression or by specifying the instance node directly (see bug 312956). ...
Requests For Enhancement - Archive of obsolete content
s for enhancement to the mozilla xforms implementation. if you have an idea that might improve mozilla's xforms implementation then you should choose one of the following rfe categories and put your request there. you can also contact the xforms team about your request. you can do so by posting a message on the xforms newsgroup or file a new bug in the 'xforms' component of the 'core' product. an
additional way to attract the xforms team's attention to an enhancement request you are promoting is to vote for the bug that is related with the feature request (if there is no bug yet then please feel free to file it). then you can give a vote by clicking on the 'vote' link on the bug page. the xforms team looks at votes to help determine which bug is more important for our xforms users. rfe cate...
...ve a custom control that you believe will help fulfill the needs of form authors or other custom controls authors, please file it here. this section could be of particular interest to people using custom controls in xul documents for the following reasons: xul, in many cases, is much better suited for application development than xhtml. therefore the control set may need to be more extensive to
address the wider spectrum of requirements that a xul application will have on its controls. xul is a feature of mozilla only and custom control authors should be aware their controls won't work on other browser platforms. enhancements of xforms elements if you find that none of the elements proposed by the xforms spec
address your requirements, please post your usecase here. xforms extension u...
Mozilla XForms User Interface - Archive of obsolete content
a calendar. this article uses several notations. if you see fx 3.0 only, that means that the control will only be available for firefox 3.0 (gecko 1.9). there are several possible reasons for this restriction. the first is that the changes required for such controls could not be safely made to firefox 1.5 or firefox 2.0. the second is that the control is introduced in xforms 1.1 and we don't feel
adding the enhancement would be prudent until the 1.1 spec is more stable. for instance, when the spec reaches 'recommendation'-level status. if you see xhtml/xul then it means the control is available when xforms is hosted in either xhtml or xul. similarly, if you see xhtml only or xul only, then it means the control is available only in that host language. attribute sets this section describes attr...
...llowing representations: listbox - default representation checkbox group - used when appearance = 'full' select1 combobox control. allows the user to choose a single value from a list of pre-defined values (see the spec). it can have the following representations: combobox - default representation listbox - used when appearance = 'compact' radio group - used when appearance = 'full'
additional elements these elements may be used as child elements to the form controls described above. label specifies the label for the xforms control (see the spec). every form control other than the output element must contain a label element. it is valid for a form control to have an empty label element. help specifies contextual help for the containing form control (see the spec). the help will ...
XForms - Archive of obsolete content
me. try to avoid using it. note: support for xforms was removed from firefox in firefox 19. see the html forms guide for approaches to creating forms in html5. xforms essentials an online book giving you a guided tour of 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 obsolete. other strengths that xforms brings to the table is the separation of data from presentation, strong data typing, the ability to submit xml data to servers instead of name/value pairs, and a descriptive way to author forms so that they can be displayed by a wide variet...
...s to the table is the separation of data from presentation, strong data typing, the ability to submit xml data to servers instead of name/value pairs, and a descriptive way to author forms so that they can be displayed by a wide variety of devices. xforms is a w3c specification. xforms tutorial and cookbook xforms in wikibook format - over 50 examples tested with firefox. xforms support can be
added to firefox and seamonkey by installing the mozilla xforms extension. this extension, while supporting a significant subset of the xforms 1.0 and 1.1 candidate recommendations, is not actively maintained any more since about 2010. the last official release has been done for firefox 3.6 and is available for download on
addons.mozilla.org. for more details about the future of the mozilla xforms e...
Archived open Web documentation - Archive of obsolete content
displaying notifications (deprecated) firefox offers support for "desktop notifications"; these are notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system. e4x ecmascript for xml (e4x) is a programming language extension that
adds native xml support to javascript. it does this by providing access to the xml document in a form that feels natural for ecmascript programmers. the goal is to provide an alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. e4x tutorial this tutor...
...ew 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 obsolete. ...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
the links will also turn red when they are hovered. gecko behavior in browsers based on netscape gecko builds later than 20020410 (netscape 6.1+), :hover styles can be applied to any element in a document. thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk of seeing hover styles applied to more than just their links. the most reliable fix is to
add the anchor element to the selectors, like this: a:hover {color: red;} a.nav:hover {color: red;} in an attempt to avoid causing problems for legacy documents, browsers based on mozilla 1.0 and later (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...
...sers based on mozilla 1.0 and later (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 previously, 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 docum...
Parsing microformats in JavaScript - Archive of obsolete content
node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. datatype "html" if the search should be done using innerhtml(), or "text" to use innertext(). the default is "text". return value a string containing the property's value. emailgetter() specifically retrieves an email
address from a microformat node. this removes the subject if one is specified, as well as the mailto: prefix. email = microformats.parser.emailgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a stri...
...node. this removes the subject if one is specified, as well as the mailto: prefix. email = microformats.parser.emailgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a string containing the email
address. htmlgetter() retrieves all the html from a particular dom node. html = microformats.parser.htmlgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value an object containing a function you can call ...
Windows Media in Netscape - Archive of obsolete content
e/7.1 (ax<em>[;optional comments]</em>) the "vendor comment" (ax) following the "vendor version" netscape/7.1 is an indicator that the browser supports the windows media player activex control. for example on windows xp, netscape 7.1's user agent string may be: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.4) gecko/20030624 netscape/7.1 (ax) if the client was customized by a third party,
additional information may be present in the "vendor comment" area of the user agent string. for example: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.4) gecko/20030624 netscape/7.1 (ax; promostring) although geckoactivexobject is currently available only in netscape 7.1 on windows, it may be the case in the future that it will be available in other gecko-based browsers on other operating sy...
...1 and ie, you need to avoid browser-specific detection mechanisms like this. summary: cross browser use of windows media player in ie and netscape 7.1 don't use proprietary dom sniffs such as looking for document.all-- this will rule out netscape 7.1. when scripting the player, ensure that you use the syntax document.playerelementname.property as opposed to playerelementname.property. merely
adding document. as a prefix to player scripting calls solves the namespacing difference between netscape 7.1 and ie. both netscape 7.1 and ie handle the nonstandard html format script for event in script html tags. an example is the usage of close captioning. in the case of close captioning media content, the player api player.closedcaption.captioningid = "captext"; is not supported, and the worka...
Community - Extensions
if you know of useful mailing lists, newsgroups, forums, or other communities related to extension development, please link to them here. ...
... if you know of useful mailing lists, newsgroups, forums, or other communities related to extension development, please link to them here. ...
Efficient animation for web games - Game development
umed that our own, naive code was making the game slower than we would like. to an extent, this was true: we found plenty to optimise in our own code, but it got to the point where we knew what we were doing ought to perform quite well, and it still wasn’t quite there. at this point, we turned to the firefox javascript profiler, and this told us almost exactly what low-hanging-fruit was left to
address to improve performance. as it turned out, the code from some of the things mentioned above; the animation code had some corner cases where redraws were happening several times per frame, and some of the animations caused firefox to need to redraw everything (they were fine in other browsers, as it happens — that particular issue is now fixed). some of the third party code we were using was ...
...ple, easy-to-use animation library, heavily influenced by various parts of clutter, but with a focus on avoiding scope-creep. it does one thing, and it does it well. animator.js is a fire-and-forget style animation library, designed to be used with games, or other situations where you need many, synchronised, custom animations. it includes a handful of built-in tweening functions, the facility to
add your own, and helper functions for animating object properties. puzzowl uses it to drive all the drawing updates and transitions, by overriding its requestanimationframe function with a custom version that makes the request, and appending the game’s drawing function onto the end of the callback like so: animator.requestanimationframe = function(callback) { requestanimationframe(function(...
Techniques for game development - Game development
f, so that your game's javascript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. this article explains how. optimizing startup performance how to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. using webrtc peer-to-peer data channels in
addition to providing support for audio and video communication, webrtc lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. this article explains what this can do for you, and shows how to use libraries that make this easy. efficient animation for web games this article covers techniques and advice for creating efficient animation for web games,...
...es that make this easy. efficient animation for web games this article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. we touch on css transitions and css animations, and javascript loops involving window.requestanimationframe. audio for web games audio is an important part of any game — it
adds feedback and atmosphere. web-based audio is maturing fast, but there are still many browser differences to negotiate. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. 2d collision detection a concise introduction to collision detection in 2d games. tilemaps tiles are a very popular tec...
Game over - Game development
urce 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. ...
...ity to lose, we will disable the ball's collision with the bottom edge of the screen.
add the code below inside 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 p
addle misses it. we need a way to detect this and act accordingly.
add the following lines just below the previous 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 ...
Move the ball - Game development
/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.
add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } the code above
adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame. reload index.html and you should see the ball rolling across the screen. compare your code you can check the finished code for this lesson in the live demo bel...
...ll.x += 1; ball.y += 1; } the code above
adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame. reload index.html and you should see the ball rolling across the screen. 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 next step is to
add some basic collision detection, so our ball can bounce off the walls. this would take several lines of code — a significantly more complex step than we have seen so far, especially if we want to
add p
addle and brick collisions too — but fortunately phaser allows us to do this much more easily than if we wanted to use pure javascript. in any case, before we do all that we will first introduce...
Win the game - Game development
« previousnext » this is the 12th 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/lesson12.html. implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. ...
...ick's .alive() method. if there are no more bricks left alive, then we show a winning 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. « previousnext » ...
Visual-js game engine - Game development
will create visual.js in folder starter/ with all your game object was created in editor style . or you can use visual-js source editor. visual-js source editor (2d part only) is new and better way .in future visual staff will be better (real time simulator will be implemented).for now this place is good for coding . visual-js works direct with project files , no need for build .
add->new game object (form dialog for define type of new game object )
add->quick code (make your work faster -
add usually code blocks) resources - explorer view for images and audios , you can drag or edit also need to execute node build_resources for creating resources object for engine. inserting new code will be always at current line selected intro editor . save on drop menu or better with ...
...fine type of new game object )
add->quick code (make your work faster -
add usually code blocks) resources - explorer view for images and audios , you can drag or edit also need to execute node build_resources for creating resources object for engine. inserting new code will be always at current line selected intro editor . save on drop menu or better with ctrl+s before testing in browsers.
adding new script explanation : after
adding new script and save script if you have extra changes , open starter/run.js and you will found line : sys.script.load("scripts/new_script.js") ctrl+s use from menu run->choose browser for testing . - important safari not working at the moment chrome , firefox , opera tutorial - pencil (animation path) : how to use pencil tool to create path...
Visual JS GE - Game development
isual_js_file.js. this is a node.js app for local use. if you use editor.js to visually create game objects, you must start the build_from_editor_to_visual_js_file.js when you have finished. this tool will create visual.js in the starter/ directory along with all your game objects. it takes data from the system folder lib/visual_scripts/ and generates your code. resource js objects used for
adding images for animation purposes. this is done using server_instance/res.js. you need to put your images in a folder, for example test_res/ , inside project_instance/res/. next, run the command server_instance/node res.js. after this has finished processing, restart the web page by entering the following in the console: resource.test_res. resource objects contain the path data for all you...
...er_instance/res.js. you need to put your images in a folder, for example test_res/ , inside project_instance/res/. next, run the command server_instance/node res.js. after this has finished processing, restart the web page by entering the following in the console: resource.test_res. resource objects contain the path data for all your images. the actual image objects will be created after you
add animation to the game objects. this is good because it is memory safe. visual js.exe windows gui freeware only for windows users. contains the following tools. visual_js.exe version 1.0 — comes with source editor. ml_sys.exe — multilanguage tool for string labels (smart xml operation; no empty tags). scriptingjs.exe — based on javascriptobfuscator.com api. makelib.exe — neede for...
Accessibility tree (AOM) - MDN Web Docs Glossary: Definitions of Web-related terms
ility apis for assistive technologies, such as screen readers. there are four things in an accessibility tree object: name how can we refer to this thing? for instance, a link with the text ‘read more’ will have ‘read more’ as its name (more on how names are computed in the accessible name and description computation spec). ...
...n computation spec). description how do we describe this element, if we want to
add anything to the name? the description of a table could explain what kind of info that table offers. role what kind of thing is it? for example, is it a button, a nav bar, or a list of items? state does it have a state? think checked/unchecked for checkboxes, or collapsed/expanded for the <summary> element.
additionally, the accessibility tree often contains information on what can be done with an element: a link can be followed, a text input can be typed into, etc. ...
Fork - MDN Web Docs Glossary: Definitions of Web-related terms
forks are often seen in free and open source software development. this is now a more popular term thanks to contribution model using git (and/or the github platform). ...
... forks are often seen in free and open source software development. this is now a more popular term thanks to contribution model using git (and/or the github platform). ...
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
a css grid is defined using the grid value of the display property; you can define columns and rows on your grid using the grid-template-rows and grid-template-columns properties. the grid that you define using these properties is described as an explicit grid. if you place content outside of this explicit grid, or if you are relying on auto-placement and the grid algorithm needs to create
additional row or column tracks to hold grid items, then extra tracks will be created in the implicit grid. the implicit grid is the grid created automatically due to content being
added outside of the tracks defined. in the example below i have created an explicit grid of three columns and two rows. the third row on the grid is an implicit grid row track, formed due to their being more than the six...
...olumns and two rows. the third row on the grid is an implicit grid row track, formed due to their being more than the six items which fill the explicit tracks. ...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
in a css grid layout, a grid cell is the smallest unit you can have on your css grid. it is the space between four intersecting grid lines and conceptually much like a table cell. if you do not place items using one of the grid placement methods, direct children of the grid container will be placed one into each individual grid cell by the auto-placement algorithm.
additional row or column tracks will be created to create enough cells to hold all items. in the example we have created a three column track grid. the five items are placed into grid cells working along an initial row of three grid cells, then creating a new row for the remaining two. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wra...
...e column track grid. the five items are placed into grid cells working along an initial row of three grid cells, then creating a new row for the remaining two. ...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
gap properties. in the example below we have a three-column and two-row track grid, with 20-pixel gaps between column tracks and 20px-gaps between row tracks. ...
... <div>four</div> <div>five</div> </div> in terms of grid sizing, gaps act as if they were a regular grid track however nothing can be placed into the gap. the gap acts as if the grid line at that location has gained extra size, so any grid item placed after that line begins at the end of the gap. the grid-gap properties are not the only thing that can cause tracks to space out. margins, p
adding or the use of the space distribution properties in box alignment can all contribute to the visible gap – therefore the grid-gap properties should not be seen as equal to “the gutter size” unless you know that your design has not introduced any
additional space with one of these methods. learn more property reference grid-column-gap grid-row-gap grid-gap further reading css gr...
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
an http header is a field of an http request or response that passes
additional information, altering or precising the semantics of the message or of the body. headers are case-insensitive, begins at the start of a line and are immediately followed by a ':' and a value depending of the header itself. the value finish at the next crlf or at the end of the message. traditionally, headers are classed in categories, though this classification is no more part of any specification: general header: headers applying to both requests and responses but with no relation to the data eventually transmitted in the body. ...
...e. traditionally, headers are classed in categories, though this classification is no more part of any specification: general header: headers applying to both requests and responses but with no relation to the data eventually transmitted in the body. request header: headers containing more information about the resource to be fetched or about the client itself. response header: headers with
additional information about the response, like its location or about the server itself (name, version, …). entity header: headers containing more information about the body of the entity, like its content length or its mime-type. a basic request with one header: get /example.http http/1.1 host: example.com redirects have mandatory headers (location): 302 found location: /newpage.html a ty...
ICE - MDN Web Docs Glossary: Definitions of Web-related terms
ice (interactive connectivity establishment) is a framework used by webrtc (among other technologies) for connecting two peers, regardless of network topology (usually for audio and video chat). this protocol lets two peers find and establish a connection with one another even though they may both be using network
address translator (nat) to share a global ip
address with other devices on their respective local networks. ...
...with one another even though they may both be using network
address translator (nat) to share a global ip
address with other devices on their respective local networks. ...
Intrinsic Size - MDN Web Docs Glossary: Definitions of Web-related terms
how intrinsic sizes are calculated is defined in the css intrinsic and extrinsic sizing specification. intrinsic sizing takes into account the min-content and max-content size of an element. ...
... how intrinsic sizes are calculated is defined in the css intrinsic and extrinsic sizing specification. intrinsic sizing takes into account the min-content and max-content size of an element. ...
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
a packet, or network packet, is a formatted chunk of data sent over a network. the maincomponents of a network packet are the user data and control information. the user data is known as the payload. the control information is the information for delivering the payload. it consists of network
addresses for the source and destination, sequencing information, and error detection codes and is generally found in packet headers and footer. a packet contains: hop limit a hop occurs when a packet is passed from one network to the next network. it is a field that is decreases by one each time a packet goes through, once it reaches 0 it has failed and the packet is discarded. over time the number packets can cause traversing within closed circuits, the number of pa ckets circulat...
...rs at the transmitter, the calculation is performed before the packet is sent. when received at the destination, the checksum is recalculated, and compared with the one in the packet. priority this field indicates which packet should have higher priority over the others. the high priority queue is emptied more quickly than lower priority queues when the network is congested.
addresses when routing network packets it requires two network
addresses the source
address of the sending host, and the destination
address of the receiving host. user data - payload payload is the data that is carried on behalf of an application. it is usually of variable length, up to a maximum that is set by the network protocol and sometimes the equipment on the route. references...
TLD - MDN Web Docs Glossary: Definitions of Web-related terms
s (domain name system). a tld is the final component of a domain name, for example, "org" in developer.mozilla.org. icann (internet corporation for assigned names and numbers) designates organizations to manage each tld. depending on how strict an administrating organization might be, tld often serves as a clue to the purpose, ownership, or nationality of a website. consider an example internet
address: https://developer.mozilla.org here org is the tld; mozilla.org is the second-level domain name; and developer is a subdomain name. all together, these constitute a fully-qualified domain name; the
addition of https:// makes this a complete url. iana today distinguishes the following groups of top-level domains: country-code top-level domains (cctld) two-character domains established fo...
... operate directly under policies established by icann processes for the global internet community, for example "com" and "edu". sponsored top-level domains (stld) these domains are proposed and sponsored by private organizations that decide whether an applicant is eligible to use the tld, based on community theme concepts. infrastructure top-level domain this group consists of one domain, the
address and routing parameter area (arpa). learn more general knowledge tld on wikipedia list of top-level domains ...
Test your skills: WAI-ARIA - Learn web development
eant to be a list. assuming you are not able to change the elements used, how can you allow screenreader users to recognize this as a list? 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. ...
...editor or in an online editor. wai-aria 2 in our second wai-aria task, we present a simple search form, and we want you to
add in a couple of wai-aria features to improve its accessibility: how can you allow the search form to be called out as a separate landmark on the page 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 previously saw in the css and javascript skilltest. as before, we have a simple app that presents a list of animal names. clic...
What is accessibility? - Learn web development
ity and, of them, cognitive impairment is the most common for young people. in the u.s., “intellectual disabilities” is the new term for “mental retardation.” in the u.k., “intellectual disabilities” is commonly “learning disabilities” or “learning difficulties”. implementing accessibility into your project a common accessibility myth is that accessibility is an expensive "
added extra" to implement on a project. this myth actually can be true if either: you are trying to "retrofit" accessibility onto an existing website that has significant accessibility issues. you have only started to consider accessibility and uncovered related issues in the late stages of a project. if however, you consider accessibility from the start of a project, the cost of making most co...
...you can learn a lot more about wai-aria in our wai-aria basics article. summary this article should have given you a useful high-level overview of accessibility, shown you why it's important, and looked at how you can fit it into your workflow. you should now also have a thirst to learn about the implementation details tha...
CSS values and units - Learn web development
while many values accept a length or a percentage, there are some that only accept length. you can see which values are accepted on the mdn property reference pages. if the allowed value includes <length-percentage> then you can use a length or a percentage. if the allowed value only includes <length>, it is not possible to use a percentage. numbers some values accept numbers, without any unit
added to them. an example of a property which accepts a unitless number is the opacity property, which controls the opacity of an element (how transparent it is). this property accepts a number between 0 (fully transparent) and 1 (fully opaque). in the below example, try changing the value of opacity to various decimal values between 0 and 1 and see how the box and its contents become more or less o...
...nt, whereas 1 will make it fully opaque. values in between give you different levels of transparency. note: setting an alpha channel on a color has one key difference to using the opacity property we looked at earlier. when you use opacity you make the element and everything inside it opaque, whereas using rgba colors only makes the color you are specifying opaque. in the example below i have
added a background image to the containing block of our colored boxes. i have then set the boxes to have different opacity values — notice how the background shows through more when the alpha channel value is smaller. in this example, try changing the alpha channel values to see how it affects the color output. note: at some point modern browsers were updated so that rgba() and rgb(), and hsl...
Test your skills: Writing Modes and Logical Properties - 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. task one the box in the example is displayed with a horizontal writing mode. can you
add a line of css to change it so it uses a vertical writing mode with right to left text? your example should look like the image below. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. task two in the example below use logical properties t...
...ntain the aspect ratio of the box as it is turned vertically. your end result should look like the image below. try updating the live code below to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. task three use logical versions of the margin, border, and p
adding properties so that the edges of the box relate to the text rather than following top, left, bottom and right. you can see how this should look in the image below. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. assessment or further h...
How CSS works - Learn web development
<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 previous 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 black; background-color: lime; } the browser will parse the html and create a dom from it, then parse the css. since the only rule available in the css has ...
...isual representation to the screen. the updated output is as follows: in our debugging css article in the next module we will be using browser devtools to debug css problems, and will learn more about how the browser interprets css. what happens if a browser encounters css it doesn't understand? in an earlier lesson i mentioned that browsers do not all implement new css at the same time. in
addition, many people are not using the latest version of a browser. given that css is being developed all the time, and is therefore ahead of what browsers can recognise, you might wonder what happens if a browser encounters a css selector or declaration it doesn't recognise. the answer is that it does nothing, and just moves on to the next bit of css! if a browser is parsing your rules, and encou...
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. ...
...ss to change how this biography looks by changing the values of the properties i have used. make the level one heading pink, using the css color keyword hotpink. give the heading a 10px dotted border-bottom which uses the css color keyword purple. make the level 2 heading italic. give the ul used for the contact details a background-color of #eeeeee, and a 5px solid purple border. use some p
adding to push the content away from the border. make the links green on hover. you should end up with something like this image. afterwards try looking up some properties not mentioned on this page in the mdn css reference and get adventurous! remember that there is no wrong answer here — at this stage in your learning you can afford to have a bit of fun. assessment or further help if ...
CSS FAQ - Learn web development
that name. the class attribute assigns a class name to the element, and that name can be used on many elements within the page. css allows you to apply styles to particular id and/or class names. use a class-specific style when you want to apply the styling rules to many blocks and elements within the page, or when you currently only have element to style with that style, but you might want to
add more later. use an id-specific style when you need to restrict the applied styling rules to one specific block or element. this style will only be used by the element with that particular id. it is generally recommended to use classes as much as possible, and to use ids only when absolutely necessary for specific uses (like to connect label and form elements or for styling elements that must b...
...t with that particular id. it is generally recommended to use classes as much as possible, and to use ids only when absolutely necessary for specific uses (like to connect label and form elements or for styling elements that must be semantically unique): using classes makes your styling extensible — even if you only have one element to style with a particular ruleset now, you might want to
add more later. classes allow you to style multiple elements, therefore they can lead to shorter stylesheets, rather than having to write out the same styling information in multiple rules that use id selectors. shorter stylesheets are more performant. class selectors have lower specificity than id selectors, so are easier to override if needed. note: see selectors for more information. how do...
Use CSS to solve common problems - Learn web development
how to use background-clip to control how much of the box your background image covers. how to chang...
...s box that the background is drawn under how do i define inline, block, and inline-block? how to create fancy boxes (also see the styling boxes module, generally). how to use background-clip to control how much of the box your background image covers. how to change the box model completely using box-sizing how to control backgrounds how to control borders how to style an html table how to
add shadows to boxes uncommon and advanced techniques css allows some advanced design techniques. these articles help demystify some of the more complicated use cases. general how to calculate specificity of a css selector how to control inheritance in css advanced effects how to use filters in css how to use blend modes in css layout using css flexible boxes using css multi-col...
How do you upload your files to a web server? - Learn web development
ickbrownfox port: 5548 to publish on the web, put your files into the public/htdocs directory. let's first look at http://demozilla.examplehostingprovider.net/ — as you can see, so far there is nothing there: note: depending on your hosting provider, most of the time you'll see a page saying something like “this website is hosted by [hosting service].” when you first go to your web
address. to connect your sftp client to the distant server, follow these steps: choose file > site manager... from the main menu. in the site manager window, press the new site button, then fill in the site name as demozilla in the provided space. fill in the sftp server your host provided in the host: field. in the logon type: drop down, choose normal, then fill in your provided username and...
...options is a dash followed by a one or more letters, for example -v for verbose error messages, and -b to make backups. you can see the full list at the rsync man page (search for "options summary"). source is the path to the local file or directory that you want to copy files over from. user@ is the credentials of the user on the remote server you want to copy files over to. x.x.x.x is the ip
address of the remote server. destination is the path to the location you want to copy your directory or files to on the remote server. you'd need to get such details from your hosting provider. for more information and further examples, see how to use rsync to copy/sync files between servers. of course, it is a good idea to use a secure connection, like with ftp. in the case of rsync, you speci...
What are hyperlinks? - Learn web development
b server, and a search engine. objective: learn about links on the web and why they matter. summary hyperlinks, usually called links, are a foundational concept behind the web. to explain what links are, we need to 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,...
...m someone else's webpage to your site. it's the opposite of an external link. note that you don't have to link back when someone links to your site. when you're building a website, focus on internal links, since those make your site usable. find a good balance between having too many links and too few. we'll talk about designing website navigation in another article, but as a rule, whenever you
add a new webpage, make sure at least one of your other pages links to that new page. on the other hand, if your site has more than about ten pages, it's counter-productive to link to every page from every other page. when you're starting out, you don't have to worry about external and incoming links as much, but they are very important if you want search engines to find your site (see below for mor...
What is a web server? - Learn web development
iles. (for example, html documents, images, css stylesheets, and javascript files) a web server connects to the internet and supports physical data interchange with other devices connected to the web. on the software side, a web server includes several parts that control how web users access hosted files. at a minimum, this is an http server. an http server is software that understands urls (web
addresses) and http (the protocol your browser uses to view webpages). an http server can be accessed through the domain names of the websites it stores, and it delivers the content of these hosted websites to the end user's device. at the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via http. when the request reaches the correct (h...
...script files, fonts, and video. technically, you could host all those files on your own computer, but it's far more convenient to store files all on a dedicated web server because: a dedicated web server is typically more available. (up and running) excusing downtime and systems troubles, a dedicated web server is always connected to the internet. a dedicated web server can have the same ip
address all the time. this is known as a dedicated ip
address. (not all isps provide a fixed ip
address for home lines) a dedicated web server is typically maintained by a third-party. for all these reasons, finding a good hosting provider is a key part of building your website. examine the various services companies offer. choose one that fits your needs and budget. (services range from free to t...
What software do I need to build a website? - Learn web development
and a browser, which you can use to view websites. as a result, you usually only need to acquire software for transferring files to your web server. active learning there is no active learning available yet. dig deeper creating and editing webpages to create and edit a website, you need a text editor. text editors create and modify unformatted text files. other formats, like rtf, let you to
add formatting, like bold or underline. those formats are not suitable for writing web pages. you should put some thought into which text editor you use, since you'll be working with it extensively while you're building the website. all desktop operating systems come with a basic text editor. these editors are all straightforward, but lack special features for webpage coding. if you want something ...
...tes. there are dozens of browser options for your personal use, but when you're developing a website you should test it at least with the following major browsers, to make sure your site works for most people: mozilla firefox google chrome microsoft internet explorer apple safari if you're targeting a specific group (e.g., technical platform or country), you may have to test the site with
additional browsers, like opera, konqueror, or uc browser. but testing gets complicated because some browsers only run on certain operating systems. apple safari runs on ios and mac os, while internet explorer runs only on windows. it's best to take advantage of services like browsershots or browserstack. browsershots furnishes screenshots of your website as it will look in various browsers. browser...
How do you set up a local testing server? - Learn web development
will learn how to set up a local testing server. local files vs. remote files throughout most of the learning area, we tell you to just open your examples directly in a browser — this can be done by double clicking the html file, dragging and dropping it into the browser window, or choosing file > open... and navigating to the html file. there are many ways to achieve this. if the web
address path starts with file:// followed by the path to the file on your local hard drive, a local file is being used. in contrast, if you view one of our examples hosted on github (or an example on some other remote server), the web
address will start with http:// or https://, to show that the file has been received via http. the problem with testing local files some examples won't run if you ope...
...ready. if you are a windows user, you can get an installer from the python homepage and follow the instructions to install it: go to python.org under the download section, click the link for python "3.xxx". at the bottom of the page, choose the windows x86 executable installer and download it. when it has downloaded, run it. on the first installer page, make sure you check the "
add python 3.xxx to path" checkbox. click install, then click close when the installation has finished. open your command prompt (windows)/ terminal (macos/ linux). to check python is installed, enter the following command: python -v # or you might have the py command available, # in which case try py -v this should return a version number. if this is ok, navigate to the directo...
Test your skills: Advanced styling - Learn web development
lp section at the bottom of this page. advanced form styling 1 in our first advanced styling tasks, we want you to handle making a search input as consistent as possible across browsers — a trickier task than with standard text inputs, even on modern browsers. we've already provided you with a basic reset to build upon. first of all, try giving the search box a consistent width, height, p
adding, and border color across browsers. you'll find that some browsers will not behave in terms of the form element's height. this is due to native os styling being used in some cases. how can you remove this native styling? once you've removed the native styling, you'll need to
add back one of the features it was providing, to keep same look and feel we originally had. how do you do this? one t...
...we've made one available in the same directory as our html files — see search-24px.png — plus a <div> element after the search input to help you attach it, should you need it. ...
Example - Learn web development
t type="email" id="mail" name="user_email"> </div> <div> <label for="msg">message:</label> <textarea id="msg" name="user_message"></textarea> </div> <div class="button"> <button type="submit">send your message</button> </div> </form> css content form { /* just to center the form on the page */ margin: 0 auto; width: 400px; /* to see the limits of the form */ p
adding: 1em; border: 1px solid #ccc; border-radius: 1em; } div + div { margin-top: 1em; } label { /* to make sure that all label have the same size and are properly align */ display: inline-block; width: 90px; text-align: right; } input, textarea { /* to make sure that all text field have the same font settings by default, textarea are set with a monospace font */ font: 1em ...
... border-color: #000; } textarea { /* to properly align multiline text field with their label */ vertical-align: top; /* to give enough room to type some text */ height: 5em; /* to allow users to resize any textarea vertically it works only on chrome, firefox and safari */ resize: vertical; } .button { /* to position the buttons to the same position of the text fields */ p
adding-left: 90px; /* same size as the label elements */ } button { /* this extra magin represent the same space as the space between the labels and their text fields */ margin-left: .5em; } result ...
Web forms — Working with user data - Learn web development
puter/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. introductory guides your first form the first article in our series provides your very first experience of creating a web form, including designing a simple form, implementing it using the right html elements,
adding some very simple styling via css, and how data is sent to a server. how to structure a web form with the basics out of the way, we now look in more detail at the elements used to provide structure and meaning to the different parts of a form. the different form controls basic native form controls we start off this section by looking at the functionality of the the original html <input>...
...vide structure and meaning to the different parts of a form. the different form controls basic native form controls we start off this section by looking at the functionality of the the original html <input> types in detail, looking at what options are available to collect different types of data. the html5 input types here we continue our deep dive into the <input> element, looking at the
additional input types provided when html5 was released, and the various ui controls and data collection enhancements they provide.
additionally, we look at the <output> element. other form controls next we take a look at all the non-<input> form controls and associated tools, such as <select>, <textarea>, <meter>, and <progress>. form styling guides styling web forms this article provides ...
The web and web standards - Learn web development
s a top-level heading</h1> <p>this is a paragraph of text.</p> <img src="cat.jpg" alt="a picture of my cat"> if we adopted a house-building analogy, html would be like the foundations and walls of the house, which give it structure and hold it together. ...
...r html, for example setting text and background colors,
adding borders, animating things, or laying out a page in a certain way. as a simple example, the following code would turn our html paragraph red: p { color: red; } in the house analogy, css is like the paint, wallpaper, carpets and paintings you'd use to make the house look nice. javascript is the programming language we use to
add interactivity to web sites, from dynamic style switching, to fetching updates from the server, right through to complex 3d graphics. the following simple javascript will store a reference to our paragraph in memory and change the text inside it: let pelem = document.queryselector('p'); pelem.textcontent = 'we changed the text!'; in the house analogy, javascript is like the cooker, tv, microw...
Debugging HTML - Learn web development
art by running your html page through the markup validation service — created and maintained by the w3c, the organization that looks after the specifications that define html, css, and other web technologies. this webpage takes an html document as an input, goes through it, and gives you a report to tell you what is wrong with your html. to specify the html to validate, you can provide a web
address, upload an html file, or directly input some html code. active learning: validating an html document let's try this with our sample document. first, load the markup validation service in one browser tab, if it isn't already open. switch to the validate by direct input tab. copy all of the sample document's code (not just the body) and paste it into the large text area shown in the mark...
...rs and other information. interpreting the error messages the error messages are usually helpful, but sometimes they are not so helpful; with a bit of practice you can work out how to interpret these to fix your code. let's go through the error messages and see what they mean. you'll see that each message comes with a line and column number to help you to locate the error easily. "consider
adding a lang attribute to the html start tag to declare the language of this document.": this is not an error but a warning. the recommendation is to always define a language, and this warning explains how to do it. "end tag li implied, but there were open elements" (2 instances): these messages indicate that an element is open that should be closed. the ending tag is implied, but not actually ther...
Test your skills: Multimedia and embedding - Learn web development
ions 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. multimedia and embedding 1 in this task we want you to embed a simple audio file onto the page. you need to:
add the path to the audio file to an appropriate attribute to embed it on the page. the audio is called audio.mp3, and it is in a folder inside the current folder called media.
add an attribute to make browsers display some default controls.
add some appropriate fallback text for browsers that don't support <audio>. try updating the live code below to recreate the finished example: download t...
...lback text for browsers that don't support <audio>. 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. multimedia and embedding 2 in this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. you need to:
add an attribute to make browsers display some default controls.
add some appropriate fallback text for browsers that don't support <video>.
add multiple sources, containing the paths to the video files. the files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. let the browser know in advance what video formats the sources point to, so it can make a...
Choosing the right approach - Learn web development
prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. ...
...n be complex and hard to parse. if you nest a number of promises, you can end up with similar troubles to callback hell. for example: remotedb.alldocs({ include_docs: true, attachments: true }).then(function (result) { let docs = result.rows; docs.foreach(function(element) { localdb.put(element.doc).then(function(response) { alert("pulled doc with id " + element.doc._id + " and
added to local db."); }).catch(function (err) { if (err.name == 'conflict') { localdb.get(element.doc._id).then(function (resp) { localdb.remove(resp._id, resp._rev).then(function (resp) { // et cetera... 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 loc...
Image gallery - Learn web development
images — you just need to loop through five numbers, one representing each image. in each loop iteration, replace the xxx placeholder value with a string that will equal the path to the image in each case. we are setting the value of the src attribute to this value in each case. bear in mind that in each case, the image is inside the images directory and its name is pic1.jpg, pic2.jpg, etc.
adding an onclick handler to each thumbnail image in each loop iteration, you need to
add an onclick handler to the current newimage — this handler should find the value of the src attribute of the current image. set the src attribute value of the displayed-img <img> to the src value passed in as a parameter. alternatively, you can
add one event listener to the thumb bar. writing a handler that ...
...e of the current image. set the src attribute value of the displayed-img <img> to the src value passed in as a parameter. alternatively, you can
add one event listener to the thumb bar. writing a handler that runs the darken/lighten button that just leaves our darken/lighten <button> — we've already provided a line that stores a reference to the <button> in a constant called btn. you need to
add an onclick handler that: checks the current class name set on the <button> — you can again achieve this by using getattribute(). if the class name is "dark", changes the <button> class to "light" (using setattribute()), its text content to "lighten", and the background-color of the overlay <div> to "rgba(0,0,0,0.5)". if the class name not "dark", changes the <button> class to "dark", its t...
Test your skills: Arrays - Learn web development
ascript console, in the case of the downloadable version). arrays 1 let's start off with some basic array practice. in this task we'd like you to create an array of three items, stored inside a variable called myarray. the items can be anything you want — how about your favourite foods or bands? next, modify the first two items in the array using simple bracket notation and assignment. then
add a new item to the beginning of the array. 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. arrays 2 now let's move on to another task. here you are provided with a string to work with. we'd like you to: convert the string into an array, removing the + characters in the process...
...t item in the array in a variable called lastitem. 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. arrays 3 for this final array task, we provide you with a starting array, and you will work in somewhat the opposite direction. you need to: remove the last item in the array.
add two new names to the end of the array. go over each item in the array and
add its index number after the name inside parentheses, for example ryu (0). note that we don't teach how to do this in the arrays article, so you'll have to do some research. finally, join the array items together in a single string called mystring, with a separator of " - ". try updating the live code below to recreat...
Test your skills: Math - Learn web development
he bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). math 1 let's start out by testing your knowledge of basic math operators. you will have to create four numeric values, then
add the first two together, then subtract the fourth from the third, then multiply the two secondary results together to get a result of 48. finally, we need to write a test that proves that this value is an even number. so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain numbers. call the variables something sensible. ...
... the first two together, then subtract the fourth from the third, then multiply the two secondary results together to get a result of 48. finally, we need to write a test that proves that this value is an even number. so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain numbers. call the variables something sensible.
add the first two variables together and store the result in another variable. subtract the fourth variable from the third and store the result in another variable. multiply the results from the last two steps together, storing the result in a variable called finalresult. the product should be 48. if it isn't, you'll have to adjust some of the initial input values. finally, write a calculation tha...
Test your skills: Object-oriented JavaScript - Learn web development
...
...w shape() for both), and then calling their calcperimeter() methods. 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. oojs 3 finally, we'd like you to start with the es shape class you created in the last task. we'd like you to create a square class that inherits from shape, and
adds a calcarea() method that calculates the square's area. also set up the constructor so that the name property of square object instances is automatically set to square, and the sides property is automatically set to 4. when invoking the constructor, you should therefore just need to provide the sidelength property. create an instance of the square class called square with appropriate property va...
Introducing JavaScript objects - Learn web development
or functions, and how to create object instances. object prototypes prototypes are the mechanism by which javascript objects inherit features from one another, and they work differently to inheritance mechanisms in classical object-oriented programming languages. in this article, we explore that difference, explain how prototype chains work, and look at how the prototype property can be used to
add methods to existing constructors. inheritance in javascript with most of the gory details of oojs now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes. in
addition, we present some advice on when and where you might use oojs. working with json data javascript object notation (json) is a standard text-based form...
...nd writing your own json. object building practice in previous 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 assessment, you are expected to use the bouncing balls demo from the previous article as a starting point, and
add some new and interesting features to it. ...
Properly configuring server MIME types - Learn web development
this article may contain out of date information, as it has not been significantly updated in many years. background by default, many web servers are configured to report a mime type of text/plain or application/octet-stream for unknown content types. as new content types are invented or
added to web servers, web administrators may fail to
add the new mime types to their web server's configuration. this is a major source of problems for users of gecko-based browsers, which respect the mime types as reported by web servers and web applications. what are mime types? mime types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. examples of m...
... each document. if you're using the apache web server, simply copy this sample .htaccess file to the directory that contains the files that you want to send with the correct mime types. if you have an entire subdirectory of files, just place the file in the parent directory; you need not place it in each subdirectory. if you're using a server-side script to generate content, you can generally
add one line near the top of your script. you can serve content other than html from perl, php, asp, or java — just change the mime type accordingly. for perl cgi, you should have the line print "content-type: text/html\n\n"; before any other output lines. if you're using the cgi module, you can use the line print $cgi->header('text/html'); instead, where $cgi is your reference to the cgi ins...
Introduction to cross browser testing - Learn web development
level concepts involved in cross browser testing. what is cross browser testing? cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. as a web developer, it is your responsibility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or
additional assistive tools they are using. you need to think about: different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might still be using, which don't support all the latest, shiniest css and javascript features. different devices with different capabilities, from the latest greatest tablets and smartphones, th...
...all of this cross browser testing business may sound time 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 previously 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 — ...
Client-side tooling overview - Learn web development
into your final production code, or "minifying" to remove all the whitespace in your production code, making it as small as possible before it is uploaded to a server. parcel is a particularly clever tool that fits into this category — it can do the above tasks, but also helps to package assets like html, css, and image files into convenient bundles that you can then go on to deploy, and also
adds dependencies for you automatically whenever you try to use them. it can even handle some code transformation duties for you. webpack is another very popular packaging tool that does similar things. transformation this stage of your web app lifecycle typically allows you to code in either "future code" (such as the latest css or javascript features that might not have native support in browser...
...ur code in an entirely different language and have it transformed into a web-compatible language. for example: sass/scss: this css extension allows you to use variables, nested rules, mixins, functions, and many other features, some of which are available in native css (such as variables), and some of which aren't. typescript: typescript is a superset of javascript that offers a bunch of
additional features. the typescript compiler converts typescript code to javascript when building for production. frameworks such as react, ember, and vue: frameworks provide a lot of functionality for free and allow you to use it via custom syntax built on top of vanilla javascript. in the background, the framework’s javascript code works hard to interpret this custom syntax and render it as a ...
Understanding client-side web development tools - Learn web development
elopment, and how to find help with individual tools. 2. command line crash course in your development process you'll undoubtedly be required to run some command in the terminal (or on the "command line" — these are effectively the same thing). 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. 3. package management basics in this article we'll look at package managers in some detail to understand how we can use them in our own projects — to install project tool dependencies, keep them up-to-date, and more. 4. introducing a complete toolchain in the final couple of articles in the series we will solidify your tooling knowledge by walkin...
... 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 previous 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. ...
Learn web development
ll 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 more about how web technologies work. what's new? the content in the learning area is being
added to regularly. we have started keeping learning area release notes to show what has changed — keep checking back frequently! if you have questions regarding topics you'd like to see covered or feel are missing, drop us a message on our discourse forum. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work tow...
...tarted with the web provides a practical introduction to web development for complete beginners. html — structuring the web html is the language that we use to structure the different parts of our content and define what their meaning or purpose is. this topic teaches html in detail. css — styling the web css is the language that we can use to style and layout our web content, as well as
adding behavior like animation. this topic provides comprehensive coverage of css. javascript — dynamic client-side scripting javascript is the scripting language used to
add dynamic functionality to web pages. this topic teaches all the essentials needed to become comfortable with writing and understanding javascript. web forms — working with user data web forms are a potent tool for interac...
Chrome Worker Modules
nt, require() only accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating modules creating a module is just as simple. a module is a file, whose filename generally ends with either “.js” or “.jsm”, and designed to be opened through require(). any value you define in that file is private by default. ...
...stack traces unfortunately, the module loader doesn’t play nicely with error stack traces. that is, the following will not show human-readable stacks: try { mymodule.foo(); } catch (ex) { log("exception raised at " + ex.filename) log("stack: " + ex.stack); } rather, you should use properties modulename and modulestack, as follows: try { mymodule.foo(); } catch (ex) { ...
Accessibility information for UI designers and developers
es. the ratio should be 4.5:1 for regular text and 3:1 for large text. calculating this ratio is easiest done with a tool, for example lea verou's contrast ratio. there are also plug-ins available for design software, like stark for sketch. don't rely on color alone when your interface uses color to distinguish between things, make sure the distinction is also made in other ways. for example,
add text labels or texture in
addition to color differences. for example, in this chart, it helps to
add labels besides the colored chart lines:people who cannot see the difference between the colors, can use the labels instead. or in this one, you could consider using patterns besides colored areas: again, if people are unable to distinguish the colors, they can rely on the patterns instead. s...
...reduce-motion media query. see also: understanding success criterion 2.3.3: animation from interactions content on hover or focus if content is revealed on hover or focus, for example in tooltips, there are some things to keep in mind: if the extra content obscures existing content, there should be a way to close it without moving focus if the extra content is opened on hover, hovering the
additional content itself should not cause it to disappear consistent navigation navigation should be consistent across different pages on your site. it does not need to be exactly the same, it is fine to have a different current menu item or different subnavigation links. do make sure they appear in the same place. that way, users of screen readers and screen magnifiers can reliably make assumpt...
Software accessibility: Where are we today?
, dyslexic, cognitively disabled and illiterate individuals. physically disabled: users have amputations, paralysis, repetitive stress, cerebral palsy, muscular dystrophy, parkinson's or other problems limiting mobility. hearing impaired we must also consider the increasing numbers of aging baby boomers that are beginning to experience problems with their sight, vision or dexterity. when you
add all these groups of people together, that's a lot of potential users! in answer to this problem, many small accessibility hardware and software vendors created products and software which helped people who could not perform one of the four basic tasks to use common computer applications. some examples of these assistive devices and software include: screen reading software, which speaks text d...
...r impossible to use for persons with visual impairments. this need not be the case. here's how non-print readers use desktop software today: text-to-speech (tts) makes the computer talk to the user: those who can't read print at all usually use talking programs (text-to-speech). talking programs are also useful for print disabilities other than visual impairments, such as dyslexia.
additionally, text-to-speech is used by those who cannot speak, in place of their own voice. finally, this technology could be useful to mainstream users, on portable information appliances, or to access information when the eyes are busy elsewhere. magnification enlarges the screen's contents: for those with low vision, it may suffice to use a larger font, a built-in high contrast them...
Accessible Toolkit Checklist
-- there always are. for example, lists of checkboxes are implemented in windows with images of checked and unchecked checkboxes. owner drawn toolkits , like xul and flash's flex ui framework use few or no native widgets. these toolkits need to have accessibility implemented from the ground up, and get nothing for free in terms of keyboard, api or os-theme support. in this case,
adding a complete or even a partial accessibility solution is major work, and will require more than one full time person as well as cooperation from windows assistive technology vendors when parts of your msaa solution isn't working. often these kinds of toolkits don't use a separate window for each control; in that case remember to generate a unique 32 bit child id for each control so that the msaa...
...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 property sheet label making tab order definable. default tab order should be in document order. ...
Benchmarking
by such builds are largely unrelated to what would be found in a release browser. rust optimization level local optimized builds are compiled with rust optimization level 1 by default, unlike nightly builds, which use rust optimization level 2. this setting reduces build times significantly but comes with a serious hit to runtime performance for any rust code (for example stylo and webrender).
add the following to your mozconfig in order to build with level 2: ac_
add_options rustc_opt_level=2 gc poisoning many firefox builds have a diagnostic tool that causes crashes to happen sooner and produce much more actionable information, but also slow down regular usage substantially. in particular, "gc poisoning" is used in all debug builds, and in optimized nightly builds (but not opt develope...
... things look ok visually. normally you would want to leave acceleration enabled while profiling, but on linux you may wish to disable accelerated graphics (preferences -> advanced -> general -> use hardware acceleration when available). flash plugin if you are profiling real websites, you should disable the adobe flash plugin so you are testing firefox code and not flash jank problems. in about:
addons > plugins, set shockwave flash to "never activate". timer precision firefox reduces the precision of the performance apis and other clock and timer apis accessible to web content. they are currently reduce to a multiple of 2ms; which is controlled by the privacy.reducetimerprecision about:config flag. the exact value of the precision is controlled by the privacy.resistfingerprinting.reducet...
A bird's-eye view of the Mozilla framework
rfaces inherit the base interface nsisupports, the client can ask whether nsirdfnode supports nsirdfliteral by calling nsirdfnode.queryinterface(), a method in the nsisupports interface. [scriptable, uuid(00000000-0000-0000-c000-000000000046)] interface nsisupports { void queryinterface(in nsiidref uuid, iid_is(uuid),retval] out nsqiresult result); [noscript, notxpcom] nsrefcnt
addref(); [noscript, notxpcom] nsrefcnt release(); }; the uuid parameter to queryinterface() is the iid uniqely identifying the interface. if nsirdfnode doesn't support nsirdfliteral, it returns null and it's up to the client to choose an alternate course of action. the xpcom component keeps track of all interface pointers currently held by its clients using an internal reference count it incre...
...om] nsrefcnt release(); }; the uuid parameter to queryinterface() is the iid uniqely identifying the interface. if nsirdfnode doesn't support nsirdfliteral, it returns null and it's up to the client to choose an alternate course of action. the xpcom component keeps track of all interface pointers currently held by its clients using an internal reference count it increments via client calls to
addref(). it is up to the client to call release() when it no longer needs the interface. release() decrements the reference count and then the object becomes a candidate for destruction. javascript handles its own garbage collection, so it doesn’t need to call
addref() and release(). inside an xpcom component figure 3 shows a more detailed view of an xpcom component. figure 3. as noted e...
Creating a Login Manager storage module
arguments for debugging stub: function(arguments) { var args = []; for (let i = 0; i < arguments.length; i++) args.push(arguments[i]) this.log("called " + arguments.callee.name + "(" + args.join(",") + ")"); }, init: function slms_init() { this.stub(arguments); }, initwithfile: function slms_initwithfile(ainputfile, aoutputfile) { this.stub(arguments); },
addlogin: function slms_
addlogin(login) { this.stub(arguments); }, removelogin: function slms_removelogin(login) { this.stub(arguments); }, modifylogin: function slms_modifylogin(oldlogin, newlogin) { this.stub(arguments); }, getalllogins: function slms_getalllogins(count) { this.stub(arguments); }, removealllogins: function slms_removealllogins() { this.stub(argum...
... ...
Gecko Logging
imestamp'. for example, if you want to specify "sync", "timestamp" and "rotate": set moz_log="example_logger:3,timestamp,sync,rotate:10" to adjust the logging after firefox has started, you can set prefs under the logging. prefix. for example, setting logging.foo to 3 will set the log module foo to start logging at level 3. the special boolean prefs logging.config.sync and logging.config.
add_timestamp can be used to control the sync and timestamp properties described above. redirecting logging output to a file logging output can be redirected to a file by passing its path via an environment variable. by default logging output goes to stderr. set moz_log_file="log.txt" the rotate and append options described above only apply when logging to a file. the special pref logging.co...
...log_file="log.txt" the rotate and append options described above only apply when logging to a file. the special pref logging.config.log_file can be set at runtime to change the log file being output to. e10s note when a content process is in sandbox, it cannot write to stderr or any file. you may need to set preference security.sandbox.content.level to 0 to see the log. rust we're gradually
adding more rust code to gecko, and rust crates typically use a different approach to logging. many rust libraries use the log crate to log messages, which works together with env_logger at the application level to control what's actually printed via rust_log. you can set an overall logging level, though it could be quite verbose: set rust_log="debug" you can also target individual modules by path...
Commenting IDL for better documentation
/ note the two asterisks ("**") on the first line of the comment. that lets doxygen (and by extension, our automated documentation import tools) know that the comment should be absorbed into documentation. if you use any other format for your comments, our tools will ignore them. following the rules below will ensure that our tools are able to produce the best possible results, and will have the
added bonus of making your comments easier to read! include documentation comments for everything, even if you think it is obvious what it means. automatic documentation generation tools can not see what is obvious to human brains. plus, what is obvious to you is likely not obvious to everyone. use doxygen style comments only for information that is directly useful to someone using or implementing t...
...t the sample interface document idl would look like: /** * @brief a make-believe interface that eats and enjoys cookies. this is an * example of what an interface document should look like; however, it's not a * document about a real interface. * * @note the article's name should be simply "nsicookiemonster" but is not in * order to make it more obvious this is an example. also, you should
add the * "interfaces" tag to your article, as well as "interfaces:scriptable" if the * interface is scriptable. * * @remarks remember, this isn't a real interface. this is where you would * provide
additional information about the interface as necessary. * * @see nsicookie * @see nsicookiemanager */ /* * take note that this is not a doxygen style comment, there is only one * on * the lin...
Index
found 172 pages: # page tags and summary 1 firefox firefox, landing, mozilla here you can learn about how to contribute to the firefox project and you will also find links to information about the construction of firefox
add-ons, using the developer tools in firefox, and other topics. 3 building firefox with rust code build documentation, gecko, build, rust in may 2015 the rust programming language reached its 1.0 stability milestone, and various experiments with writing parts of gecko in rust began. rust code first shipped in august 2016 with the release of firefox 48. it became a requirement for building gecko in february 2017 with firefox 54. 8 experimental features in firefox experimental, firefox, preferences, feat...
... index, mozilla found 168 pages: 142 linux compatibility matrix the following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox. 143 multiple firefox profiles beginner, firefox, guide, intro, profiles, qa a profile in firefox is the collection of settings, customizations,
add-ons, and other personalizations that a user has made or installed into their copy of firefox. you can find details about profiles on mozilla's end-user support site. 168 performance best practices for firefox front-end engineers best practices, developing firefox, developing mozilla, firefox, front-end, mozilla, performance this guide will help firefox developers working on f...
Frame script environment
the frame script's global is a contentframemessagemanager, giving it the following environment: content the dom window of the content loaded in the browser. may be null (see below) docshell the nsidocshell associated with the browser.
addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content.
addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. sendsyncmessage() send a synchronous message to chrome. dump() print a message to the console. atob() base64 decode. btoa() base64 encode. ...
...se a sandbox. frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms. however, some apis that work in the chrome process will not work in a frame script. see limitations of frame scripts for more details. events besides the regular dom events being captured/bubbling up from content the current content object the following
additional events get fired in a frame script environment: unload fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager global object in order to avoid handling unload events from content. doe...
Frame script environment
the frame script's global is a contentframemessagemanager, giving it the following environment: content the dom window of the content loaded in the browser may be null (see below) docshell the nsidocshell associated with the browser.
addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content.
addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. sendsyncmessage() send a synchronous message to chrome. dump() print a message to the console. atob() base64 decode. btoa() base64 encode. ...
...d use a sandbox. frame scripts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms. however, some apis that work in the chrome process do not work in a frame script. see limitations of frame scripts for more details. events besides the regular dom events being captured/bubbling up from content the current content object the following
additional events get fired in a frame script environment: unload bubbles no fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager global object to avoid handling unload events...
Process scripts
when you need to run code in the content process in order to access web content, then you should use frame scripts. however, a problem with frame scripts is that they can be loaded multiple times in the content process, in multiple scopes that are insulated from each other. for example, if you call the global frame message manager's loadframescript() function, then the script will be loaded separately into all open tabs. this can then cause a problem the frame scripts are interacting with a global service in the content process. ...
...essage manager and calling its loadprocessscript() function. the following code uses the global parent process message manager, which will load the script into the the chrome process and any child processes: // chrome code let ppmm = cc["@mozilla.org/parentprocessmessagemanager;1"] .getservice(ci.nsiprocessscriptloader); ppmm.loadprocessscript("chrome://whatever/process-script.js", true); ppmm.
addmessagelistener("hello", function(msg) { ... }); the process script's global is a child process message manager, which enables the process script to receive messages from the chrome side, and to send messages to the chrome side: // process-script.js if (services.appinfo.processtype == services.appinfo.process_type_content) { dump("welcome to the process script in a content process"); } else { ...
Tracking Protection
at all, if the page grid works such that other page elements slide in to fill holes left by blocked elements. when firefox blocks content, it logs a message to the web console like this: the resource at "http://some/url" was blocked because tracking protection is enabled. note that with firefox for android, you can access console output using the remote debugger. click the ⓘ symbol in the
address bar to view information about the currently loaded page. the popup that appears will notify you when content has been blocked. you will also be able to disable tracking protection entirely if you choose by accessing the tracking settings. if tracking cookies were present, you would be able to view the list by clicking on "blocking tracking cookies" in the above image to view the following p...
... ...
Firefox
broad compatibility, the latest in web technologies, and powerful development tools, firefox is a great choice for both web developers and end users. firefox is an open source project; much of the code is contributed by our huge community of volunteers. here you can learn about how to contribute to the firefox project and you will also find links to information about the construction of firefox
add-ons, using the developer tools in firefox, and other topics. learn how to create
add-ons for firefox, how to develop and build firefox itself, and how the internals of firefox and its subprojects work. project documentation get detailed information about the internals of firefox and its build system, so you can find your way around in the code. developer guide our developer guide pro...
...x thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. linux compatibility matrixthe following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox.multiple firefox profilesa profile in firefox is the collection of settings, customizations,
add-ons, and other personalizations that a user has made or installed into their copy of firefox. you can find details about profiles on mozilla's end-user support site.performance best practices for firefox front-end engineersthis guide will help firefox developers working on front-end code produce code which is as performant as possible—not just on its own, but in terms of its impact on other par...
mozbrowserloadstart
nly boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. example in this example the mozbrowserloadend and mozbrowserloadstart events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. ...
...oolean whether the event is cancellable or not. example in this example the mozbrowserloadend and mozbrowserloadstart events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. ...
mozbrowsermetachange
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 mozbrowsermetachange event is fired when a <meta> element related to web applications is
added, removed or changed. see below for the applicable types. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read onl...
...nymous javascript object with the following properties: name a domstring representing the <meta> name attribute value. this can be viewmode, theme-color, theme-group, or application-name. content a domstring representing the <meta> content attribute value, i.e. the content of the meta tag. type a domstring representing the type of meta change that this event object represents. this can be
added, changed, removed, or undefined. lang optional a domstring representing the <meta> name attribute value, if included. if not included, the value returned is undefined. example var browser = document.queryselector("iframe"); browser.
addeventlistener("mozbrowsermetachange", function(event) { console.log("a meta tag has been " + event.details.type + ". its name is " + event.details.name ...
MozBeforePaint
usage outline in order to time your animation, the first thing you need to know is the time base; that is, the time at which your animation sequence started. you can determine this value by looking at window.mozanimationstarttime. this new property indicates the time, in milliseconds since epoch, at which all animations started in the specified window during the current refresh interval should be considered to have started running. with that value in hand, you can then schedule all your subsequent animation frames. ...
...this computes the current position for the animating box and updates the box's position on screen, and, if the animation sequence is not yet complete, calls window.requestanimationframe() to schedule the ...
Embedding the editor
ributes can be tweaked to change the state of the ui (e.g. the inline style buttons). this needs to be changed to allow embedders to provide their own, possibly native ui. editor needs to call through one or more interfaces when communicating with the ui. embedding objectives editor requires design changes such that the embedding applications above can be fulfilled, and these changes will need to
address the current problems. briefly, the embedding objectives are: <editor> should get you a working editor in a xul application should be able to have multiple <editor>s per xul window should be able to embed an editable content frame in a native application embedders should be able to supply their own chrome (toolbars etc). meeting these objectives will also solve the following existing...
...rown up by composer should go through this interface. use a new interface, nsieditoruserinterface, to mediate communication between the editor and the ui. an embedder would need to implement this to get native toolbars and menus to work. in composer, we'd have an implementation in js that talks to the existing commands, and updates the xul nodes. fix existing js and c++ code which explicitly
addresses elements in the xul document to go through nsieditoruserinterface. steps to embedding this section attempts to lay out an implementation plan, with the aim of keeping everything working as the various steps are taken. some of these tasks can be done concurrently. decide on how to implement editing session multiple-editor support eliminate specific interdependencies between composer an...
Gecko SDK
contains basic functionality, it is intended to run with every product of the mozilla platform. therefore it makes no sense to use a particular product to build general functionality. that's the reason why the gecko sdk was devised. do not confuse the gecko/xulrunner sdk with xulrunner itself. the gecko sdk is a collection of header files and tools used to develop general xpcom components which
add functionality to the existing platform, whereas xulrunner is a framework which can be used to run standalone or embedded applications based on the mozilla framework. the gecko sdk contains all of the necessary tools and headers for making scriptable npapi plugins including the xpidl compiler/linker and the latest npapi.h. get the sdk updates there is no need to download or rebuild the gecko s...
... of security updates. you do have to get and distribute the newest gecko components (gklayout.dll etc.), though. downloading for gecko versions before 2.0, you should choose the gecko sdk version for the earliest version of mozilla you wish to target. for gecko versions 2.0 and higher, you must recompile your component for each release as cross-version compatibility is no longer supported. in
addition to the below versions, you can find other versions (including beta) here: xulrunner releases (files include "sdk" in the name). the sdk follows the same release schedule as firefox/thunderbird. once the sdk enters beta, it is suitable for building extensions; your component should work with release builds of the sdk without any modifications. due to the rapid release process, it may be a ...
Gecko's "Almost Standards" Mode
"almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them. a common case that this affects is the layout of images inside table cells. ...
...ering engine found in mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. ...
Getting Started with Chat
me basic rules you should follow to ensure the most enjoyable and productive experience: as with all mozilla forums and events, agreeing to our community participation guidelines is a requirement for participation. try to keep messages as concise as possible. if you have something long to post, a code snippet for example, use paste.mozilla.org and paste the generated url in irc instead. when
addressing someone directly, try to use name: message format. for example, "ashughes: good morning!" every channel has its own topic. try to keep your messages within that subject matter. for example, do not talk about thunderbird issues in #firefox. mozilla's channels are most active between 9am and 7pm pst monday to friday, excluding us holidays. when asking a question, be patient. sometimes, it...
...matically posts messages to #developers about the status of automated tests. the following are some helpful commands which can be used by firebot: bug ###### when a bug number is mentioned in a message, firebot automatically displays the link and summary from bugzilla for that bug. /msg firebot uuid displays a unique identifier. this is useful when creating interfaces for
add-on development. /msg firebot cid displays a unique 128-bit number which can be used to identify a class or component. /invite firebot #channel
adds firebot to the specified channel. for more information about firebot go here. further reading irc channel operator's guide (new version) irc channel operator's guide (old version) [from 1995, but still quite useful] ...
How to get a stacktrace with WinDbg
the work offline mode. you will not receive any warnings of this in windbg, visual c++ or visual studio. ...
... of this in windbg, visual c++ or visual studio. even using the command line with symchk.exe to download symbols will fail. ...
How to implement a custom autocomplete search component
uals(class_id)) return simpleautocompletesearchfactory; throw components.results.ns_error_no_interface; }, canunload: function(acompmgr) { return true; } }; // module initialization function nsgetmodule(acompmgr, afilespec) { return simpleautocompletesearchmodule; } starting in gecko 2.0, component registration has been changed, so you need to make the following changes:
add an nsgetfactory() function: function nsgetfactory(cid) { if (cid.tostring().touppercase() != class_id.tostring().touppercase()) { throw components.results.ns_error_factory_not_registered; } return simpleautocompletesearchfactory; } you need to explicitly register the component by
adding these lines into your chrome.manifest file: component {6224daa1-71...
...s_error_factory_not_registered; } return simpleautocompletesearchfactory; } you need to explicitly register the component by
adding these lines into your chrome.manifest file: component {6224daa1-71x2-4d1a-ad90-01ca1c08e323} components/.js contract @mozilla.org/autocomplete/search;1?name=simple-autocomplete {6224daa1-71x2-4d1a-ad90-01ca1c08e323} you need to
add the following method: getlabelat: function(index) { return this._results[index]; } to simpleautocompleteresult use this newly available component in a xul file like this: <textbox id="text1" type="autocomplete" autocompletesearch="simple-autocomplete" showcommentcolumn="true" autocompletesearchparam='[{"value":"mark","comment":"cool dude"},{"value":"mary","comme...
JavaScript-DOM Prototypes in Mozilla
way through which one can access the prototype of an object is through the constructor property of the object, which itself points (initially) to the constructor: document.images[0].constructor.prototype.foo = bar; note though, the above may or may not work in mozilla. so far so good; we have shared prototypes, and xpconnect gives us most of this automatically. but this is not good enough, in
addition to being able to share and represent each "class" with a constructor, we also want users to be able to extend interfaces, like node. node is a dom interface, but there are no pure node instances; there are lots of different classes that implement node (htmlimageelement, htmldocument, processinginstruction, et c.). but the fact that an instance of a node will never exist in mozilla does not ...
...instance of a node will never exist in mozilla does not mean that the node interface is useless, in fact, node can be extended just as we've been doing. if you think back to the htmlimageelement examples above, those examples let you define new properties on all image elements. by modifying the node top-level object, you can do similar things to all objects that implement node. this means you can
add a property to every node in a dom tree by doing something like this: node.prototype.foo = bar; again, modifying host objects is an unsafe practice. it is not guaranteed to work or be error-free in any implementation. it is not standard and cannot be expected to have any result. here is an attempt to modify a host object: (function(){ try { image.prototype.src = 1; ...
DeferredTask.jsm
mponents.utils.import("resource://gre/modules/deferredtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. with deferredtask, the task is delayed by a few milliseconds and, should a new change to the data occur during this period, only the final version of the data is actually written; a further grace delay is
added to take into account other changes. the deferredtask constructor requires gecko 18.0(firefox 18.0 / thunderbird 18.0 / seamonkey 2.15) if you have a function call you want to defer for two seconds, you can do so using the deferredtask constructor, like this: var task = new deferredtask(myfunction, 2000); you can also pass a generator function as the first argument of constructo...
..., 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 terminates. ...
JNI.jsm
ipt scope: components.utils.import("resource://gre/modules/jni.jsm"); this module was available in firefox since version 17. if you would like to support versions before that, you can copy and paste the contents of the jsm file int jni stands for java native interface; this library allows calling java code running in java virtual machines (jvms), etc. the most common use for this module is in
add-ons and other works on firefox for android (fennec). with this module, all of the android sdk functions that firefox has permissions for are at your fingertips. a note about firefox for android, this jsm file is already globally imported and is available from the privileged window scope as window.jni. there also exists a jenv variable in the window scope, so if you need to run jni from the globa...
... name: 'window_service', sig: sig.string } // http://developer.android.com/reference/android/content/context.html#window_service // public static final string window_service ] }); var windowmanager = jni.loadclass(my_jenv, fullyqualifiednameofclass(sig.windowmanager), { methods: [ { name: '
addview', sig: '(' + sig.view + sig.viewgroup_layoutparams + ')' + sig.void }, { name: 'removeview', sig: '(' + sig.view + ')' + sig.void }] }); var acontext = geckoappshell.getcontext(); var wm = acontext.getsystemservice(context.window_service); var wm_casted = jni.classes.android.vi...
JavaScript OS.Constants
getservice(components.interfaces.nsiosfileconstantsservice). init(); from a chrome worker no initialization is required. module os.constants is always available for chrome workers. ...
...roid; linux; other variants of unix. os.constants.libc is available on all platforms, although some constants are not defined everywhere. before using a constant, you should check that it is defined. error values eacces permission denied eagain resource temporarily unavailable ebadf bad file descriptor eexist file exists efault bad
address efbig file too large einval invalid argument eio input/output error eisdir is a directory eloop (not always available under windows) too many levels of symbolic links. emfile too many open files in the process enametoolong name too long enfile too many open files on the system eno...
NetUtil.jsm
fetch() the asyncfetch() method opens an input source, asynchronously, and gives an nsiinputstream containing the data obtained to the callback provided. the callback may then consume data from the input stream passed to the callback. note: prior to gecko 2, the input source was required to be specified as an nsichannel. note: support for specifying an nsiinputstream as the input source was
added in gecko 5. asyncfetch( asource, acallback ); parameters asource the source to open asynchronously. this may be specified as an nsiuri, nsifile, nsichannel, nsiinputstream or as a string specifying the url to open. acallback a function that will be called when the open operation is completed. the callback receives three parameters: the input stream containing the data, if any (imp...
...ome of those bytes are zeros, instead of terminating the string at the first zero byte. string readinputstreamtostring( ainputstream, acount, aoptions ); parameters ainputstream the input stream from which to read the data. acount the number of bytes to read from the stream. you can call nsiinputstream.available() to get the number of bytes currently available. aoptions specifies
additional options to control the reading process. this is a javascript object with fields as specified in options. options the aoptions parameter is a javascript object which can have any or all of the following fields: field name description charset the character encoding to use when interpreting the input stream. if you don't provide this, the input won't be decoded at ...
PerfMeasurement.jsm
the perfmeasurement.jsm javascript code module lets you take detailed performance measurements of your code. note: the perfmeasurement.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an
add-on. before you can use this module, you need to import it into your scope: components.utils.import("resource://gre/modules/perfmeasurement.jsm") see measuring performance using the perfmeasurement.jsm code module for details on how to use this api. note: at present, perfmeasurement.jsm is only functional on linux, but it is planned to
add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems. method overview static bool canmeasuresomething(); void reset(); void start(); void sto...
...return true. otherwise, it returns false. reset() resets all the enabled counters to zero. void reset(); parameters none. start() starts measuring the performance indicators that were specified when the perfmeasurement object was created. void start(); parameters none. stop() stops measuring performance data. for each enabled counter, the number of measured events of that type that occurred are
added to the appropriate visible variable. void stop(); parameters none. ...
Promise.jsm
a promise is an object representing a value that may not be available yet. internally, a ...
...: components.utils.import("resource://gre/modules/commonjs/promise/core.js"); // gecko 17 to 20 components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js"); // gecko 21 to 24 this implementation also includes helper functions that are specific to the
add-on sdk. while you may still import this module from the above paths, the recommended way for loading it is through the
add-on sdk loader. introduction for an introduction to promises, you may start from the
add-on sdk documentation, keeping in mind that only the core subset is implemented in this module. a promise is an object representing a value that may not 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 m...
SourceMap.jsm
e sourcemapgenerator represents a source map which is being built incrementally. new sourcemapgenerator(startofsourcemap) to create a new one, you must pass an object with the following properties: file: the filename of the generated source that this source map is associated with. sourceroot: an optional root for all relative urls in this source map. sourcemapgenerator.prototype.
addmapping(mapping)
add a single mapping from original source line and column to the generated source's line and column for this source map being created. the mapping object should have the following properties: generated: an object with the generated line and column positions. original: an object with the original line and column positions. source: the original source file (relati...
...ne, column, source[, chunk]) line: the original line number associated with this source node, or null if it isn't associated with an original line. column: the original column number associated with this source node, or null if it isn't associated with an original column. source: the original source's filename. chunk: optional. is immediately passed to sourcenode.prototype.
add, see below. sourcenode.prototype.
add(chunk)
add a chunk of generated js to this source node. chunk: a string snippet of generated js code, another instance of sourcenode, or an array where each member is one of those things. sourcenode.prototype.prepend(chunk) prepend a chunk of generated js to this source node. chunk: a string snippet of generated js code, another instance of sourc...
Sqlite.jsm
transaction is automatically rolled back. this makes code easy to write and read. javascript-y api. sqlite.jsm feels like a pure javascript module. the complexities of xpcom are mostly hidden from view. javascript programmers should feel right at home using sqlite.jsm. note: the sqlite.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an
add-on. before you can use this module, you need to import it into your scope: components.utils.import("resource://gre/modules/sqlite.jsm") obtaining a connection sqlite.jsm exports the sqlite symbol. this symbol is an object with a single function: openconnection. this function takes an object defining connection options: path (required) the database file to open. this can be an absolute or ...
...the time this function is called, they will be cancelled. callers should not attempt to use the connection after calling this method as the connection will be unusable. it is possible to automatically close the connection when the browser is closed with the shutdown hook: const conn = await sqlite.openconnection({ path: "mydatabase.sqlite", sharedmemorycache: false }); try { sqlite.shutdown.
addblocker("my connection closing", async () => await conn.close()); } catch (e) { // it's too late to block shutdown, just close the connection. await conn.close(); throw e; } clone(readonly) this function returns a clone of the current connection-promise. these functions receive the following arguments: readonly (optional) if true the clone will be read-on...
WebChannel.jsm
mport("resource://gre/modules/webchannel.jsm"); constructor webchannel(string webchannelid, nsiuri originorpermission); 2nd argument is a valid origin that should be part of requests for this channel. webchannel(string webchannelid, string originorpermission); 2nd argument is a permission for which the permission manager will be checked to determine if the request is allowed. note that in
addition to the permission manager check, the request must be made over https. method overview listen(function callback); stoplistening(); send(object message, eventtarget target); attributes id string webchannel id methods listen() registers the callback for messages on this channel. registers the channel itself with the webchannelbroker.
... chrome code and a webpage chrome code let channel = new webchannel(webchannelid, services.io.newuri("https://mozilla.org", null, null)); // receive messages channel.listen(function (webchannelid, message, sendercontext) { // send messages channel.send({ data: { greeting: true } }, sendercontext); }); webpage code receive messages from an existing webchannel in content code window.
addeventlistener("webchannelmessagetocontent", function(e) { // receive messages console.log(e.detail); }, true); send messages to an existing webchannel in chrome code window.dispatchevent(new window.customevent("webchannelmessagetochrome", { detail: { id: webchannelid, message: { something: true } } })); ...
Webapps.jsm
gisteractivitiesforapps: function(aappstoregister, arunupdate) _registeractivities: function(amanifest, aapp, arunupdate) _createactivitiestounregister: function(amanifest, aapp, aentrypoint) _unregisteractivitiesforapps: function(aappstounregister) _unregisteractivities: function(amanifest, aapp) _processmanifestforids: function(aids, arunupdate) observe: function(asubject, atopic, adata)
addmessagelistener: function(amsgnames, aapp, amm) removemessagelistener: function(amsgnames, amm) formatmessage: function(adata) receivemessage: function(amessage) getappinfo: function getappinfo(aappid) broadcastmessage: function broadcastmessage(amsgname, acontent) registerupdatehandler: function(ahandler) unregisterupdatehandler: function(ahandler) notifyupdatehandlers: function(aapp, ama...
...all: 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) geticon: function(adata, amm) getall: function(acallback) isreceipt: function(data)
addreceipt: function(adata, amm) removereceipt: function(adata, amm) replacereceipt: function(adata, amm) setenabled: function(adata) getmanifestfor: function(amanifesturl, aentrypoint) getappbymanifesturl: function(amanifesturl) getfullappbymanifesturl: function(amanifesturl, aentrypoint, alang) getmanifestcspbylocalid: function(alocalid) getdefaultcspbylocalid: function(alocalid) getapploc...
JavaScript code modules
components.utils.import how to import a javascript code module. components.utils.unload how to unload a javascript code module. code snippets: modules examples of how to use code modules. mozilla labs js modules this page features a list of javascript modules, along with download links and documentation, that extension developers can use in their code. standard code modules
addonmanager.jsm an interface to install, manage, and uninstall
add-ons.
addonrepository.jsm provides a search of
add-ons in the repository. assert.jsm implements the commonjs unit testing specification version 1.1, which provides a basic standardized interface for performing in-code logical assertions with optional, customizable error reporting. bookmarkhtmlutils.jsm provides utility function...
...nts the editor and lets you interact with it. sqlite.jsm a promise-based api to mozistorage/sqlite. task.jsm implements a subset of task.js to make sequential, asynchronous operations simple, using the power of javascript's yield operator. timer.jsm a pure js implementation of window.settimeout. webapps.jsm provides an interface to manage open web apps. webrequest.jsm provides an api to
add event listeners for the various stages of making an http request. the event listener receives detailed information about the request, and can modify or cancel the request. xpcomutils.jsm contains utilities for javascript components loaded by the js component loader. ...
Bootstrapping a new locale
ository. we use a web service called bit bucket to start the learning process. to begin, contact the l10n-drivers to let them know that you are interested in starting a localization. the l10n-drivers will help set up an experimental hg repository in bit bucket. you will need to create an account so you can access the service. once you have that account, send the l10n-drivers the details to be
added as a "writer". with that level of authority, you will be able to push and pull and manage the repository remotely. it will be just like working on hg with mozilla, yet you will use the bit bucket platform to start. after your new bit bucket repository is created by the l10n-drivers, please visit the url for your repo. you can do this by entering the following url into your browser: $ http...
...ry (http://bitbucket.org/mozillal10n/ab-cd/ in the example above). after you have committed and pushed your initial translation, email the l10n-drivers team to let us know it's ready. set up for building the next step is to create a .mozconfig file with the compile options for the localized build of firefox, and to set up the object directory for the localized build. cd mozilla-1.9.1 echo "mk_
add_options moz_objdir=@topsrcdir@/../fx-ab-dc" > .mozconfig echo "ac_
add_options --with-l10n-base=../" >> .mozconfig echo "ac_
add_options --disable-compile-environment" >> .mozconfig echo "ac_
add_options --enable-application=browser" >> .mozconfig make -f client.mk configure create a language pack first, we'll create a build directory. this sounds worse than it is, you won't need to actually buil...
L10n Checks
source) mode l10n checks gathers the directories to compare from an ini file, usually found in $app/locales/l10n.ini. you pass both the path to the ini file and the parent directory of the localizations as first arguments, followed by the locale codes of the locales you want to compare. if you want to test the localization for de, run: check-l10n-completeness browser/locales/l10n.ini ../l10n/ de
add-ons (xpi) mode l10n checks gathers the locales to compare from the chrome.manifest file inside the xpi file. you pass the path to the xpi file (optionally) followed by the locale codes of the locales you want to compare. if you want to test the localization for de, run: check-l10n-completeness -i xpi my-extension.xpi de to check all locales in an extension: check-l10n-completeness -i xpi my-exte...
...the file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper. the output closes with a summary, giving the total counts of missing and obsolete strings and some statistics on how many strings are changed or not, excluding access and command keys. t...
Localization and Plurals
k up the corresponding entry in the following list of plural rules. list of plural rules this section contains a list of plural rules ordered by their plural rule number. each entry indicates how many plural forms are needed when localizing a word. for each entry, there is a list of families and languages in those families, to help you figure out if it's the rule you should pick for pluralrule.
additionally, there is a brief description of each plural form, followed by some sample numbers that fall into that particular form. for a given plural rule, the order in which the plural forms are listed is the same order you need to localize a word, separated by semi-colons. for example, english uses plural rule 1, and localizing plurals would require a string of "plural;plurals" where the first w...
... components.utils.import("resource://gre/modules/pluralform.jsm"); let downloads = "you have one download.;you have #1 downloads."; let num = 10; // for english, this would display "you have 10 downloads." print(pluralform.get(num, downloads).replace("#1", num); notice in the above example that the code can be written to support placeholders or not use placeholders in some forms of the string.
additionally, the localizer has control over where the placeholder is, in relation to the rest of the text. of course, the strings to be localized will be placed in a separate file, such as yourextension.properties, instead of being hardcoded in the javascript code file. the following 3 file snippets show how to use pluralform with your .xul, .properties, .js files. downloads.xul: <stringbundlese...
SVN for Localizers
double check your changes using the viewvc interface. after you commit your changes, wait 15 minutes and check the staging website for your locale. your recent changes should now be visible online. you will have the chance to see how the localized website will look when it's pushed to prod (i.e., a website that regular visitors will see). when localizing websites, l10n-drivers will always
add needed files to your repository or update your files with new strings in english. it's very important for you to update your working copy with the newest files from mozilla svn repository before you start making changes. enter the following command from the command-line: svn update your local svn repository (i.e., working directory) will be updated with the newest files from the url you initi...
...ne file, maybe it would be wiser to simply correct those errors instead of reverting your working directory and losing all your work. note: sometimes you'll find references to commands in abbreviated form (svn ci = svn commit, svn up = svn update, svn co = svn checkout, etc.) commit doesn't work, what's wrong? make you sure you're checking out the repository with https:// make sure you're
adding a commit message when running svn commit. commits with an empty message will be rejected. svn accounts are disabled after 6 months of inactivity. to be used again, they need to be reenabled. if you have any doubts, ping l10n-drivers on irc in the #l10n channel. off to the races! congratulations! you should now be able to use svn from the command-line to copy directories from the mozilla r...
Localization sign-off reviews
work in the previous revision, the sign-off criteria will be significantly less comprehensive than a technical review. here is some of the criteria we use to perform sign-off reviews: increased amount of untranslated strings we look for previously translated strings changing to untranslated strings in the new revision. this is a common problem with some tools. encoding some tools
add bom to utf-8 encoded files, and some change the encoding altogether. mistakenly localized code we look for changes in localized code that should not have been localized or wasn't localized in the previous revision. search plugin changes this greatly impacts productization. we look for these changes and file bugs when they're found in a new revision. further indications of tool...
...ess is then repeated until the bug is fixed to satisfaction. the diff generated for sign-off reviews the image to the right illustrates the revisions diff between the current release revision and your newly proposed release revision. this is generated from the revision attachment in your bugzilla bug and evaluated to verify the technical accuracy of your new changes. text in green font represent
additions you've made in this new revision. text in red font represents content you've removed since the last released revision. unseen here, orange font represents content that was replaced in your new release revision. using these colors helps us to identify potential bugs and approve your latest revision with speed while maintaining critical accuracy. all approved! once your work is entirely app...
Creating localizable web content
engines or dictionary should be adapted) look for strings that are likely hard to translate because they are unclear, use play on words or colloquialisms. depending on context, find alternate strings or document an explanation of the string for localizers check that we don't link in new pages to sub-pages with anchors. ...
... is announced with only 100 words but it is actually content
added to an existing page in english. happens for things like faq, or video pages for example. for video, use the code to display the video in an overlayed video player on the page instead of linking to a video section in english. per-locale customizations check if there are alternative links for localized pages (e.g., links to mdn,
addons.mozilla.org, or other external resources, are there translated equivalents we can use). if there are alternatives, use them by
adding the $lang; parameter in the urls evaluate the impact of new pages on all our web properties, especially links to community sites and redirects. sometimes you can leave some freedom of modification for a block of text so that the localizers link to relevant loca...
Writing localizable code
composite string is firefox's setting for visited pages: the translator can (implicitly) position the text field as he sees fit. don't use preprocessor macros the use of #if #else #endif or #expand is strongly discouraged. there are few exceptions to this rule, but in general, the localized file should comply with standards and should not require build tools to be transformed. ...
...omply with standards and should not require build tools to be transformed. if you want to
add build processing to localized files, be sure to request feedback from l10n@. in most cases, you can just as well put the processing into the content code and reference different key-value pairs in l10n. use a good source directory structure be sure to put the localizable files in the right place. the
addition of new top-level directories is a compromise between module ownership in the cvsroot repository and the ease of localization. use a good chrome directory structure for a particular module mod, a target path jar:ab-cd.jar!/locale/ab-cd/mod/foo.dtd has been widely tested and is a good place for your files referenced as chrome://mod/locale/foo.dtd. using a directory structure like this ease...
MathML In Action
</mrow> </mfrac> </mrow> </mstyle> </math> </p> javascript content function zoomtoggle() { if (this.hasattribute("mathsize")) { this.removeattribute("mathsize"); } else { this.setattribute("mathsize", "200%"); } } function load() { document.getelementbyid("zoomablemath"). ...
...yle> </math> </p> javascript content function zoomtoggle() { if (this.hasattribute("mathsize")) { this.removeattribute("mathsize"); } else { this.setattribute("mathsize", "200%"); } } function load() { document.getelementbyid("zoomablemath"). ...
Mozilla Port Blocking
site uses a port which is blocked by mozilla's default port blocking rules, you can either change the port of your service to a unblocked value (recommended if possible) or ask your mozilla users to enable the port. for details on which ports are blocked and how to override the blocking see below. modifying mozilla's port blocking at run time users can modify the default port blocking through the
addition of preferences containing comma delimited lists of port numbers to the user.js file (for single users with the user_pref(…) command) in the user's profile directory. see the example below.
additionaly administrators can edit the all.js file (for multi-user systems with pref(…) ) in the defaults/pref/ sub-directory in the installation directory. enabling ports user_pref("network.security.
...re blocked, you should contact the protocol handler owner to request that a specific port be blocked or unblocked. if that fails, contact dougt@netscape.com and/or darin@netscape.com. you must have a good reason for the change, a deep understanding of the security risk involved and be able to justify it. things to do allow user preference to override default port blocking. currently you need to
add preferences to either user.js or all.js. see bug 85601. per protocol port blocking/enabling preferences. better user interface allow the user to decide if the blocking is really required. some kind of way to manage the ports which are blocked. more information nsioservice.cpp gbadportlist bug 83401 vulnerability note vu#476267 dougt@netscape.com original document informat...
Mozilla Web Services Security Model
g to match a specific page will cause the entire match to fail. (is this correct?) web-scripts-access.xml examples these examples are untested! somebody should test them to make sure they do what is claimed. allow all services on a site to be accessed from any web page note that this is only a sensible thing to do if nothing on the site serves content based on cookies, http authentication, ip
address / domain origin, or any other method of authentication. <webscriptaccess xmlns="http://www.mozilla.org/2002/soap/security"/> allow access to soap services within a services directory to allow access to services only within a certain directory (i.e., the directory where the safe, public, non-authenticated services are), you need one web-scripts-access.xml in the root directory of the serv...
...irectory: <webscriptaccess xmlns="http://www.mozilla.org/2002/soap/security"> <allow type="soapv"/> <allow type="soap"/> </webscriptaccess> good examples (needed.) references new security model for web services, the original proposal for the web-scripts-access.xml file format web services roadmap, documenting when web services features, including the security model, were first supported
additional reading documentation of crossdomain.xml, a similar format used by macromedia flash player ...
Mozilla Style System Documentation
contexts can find their ancestors and their descendants easily. however, siblings in the style context tree are unordered, since the order is not relevant. thus the parent style context is an argument to the functions that create style contexts. if the parent is not given, the style context is taken to be the root of the style context tree. the functions that form the style context automatically
adds the context to the tree correctly. dynamic changes describe nsframemanager::reresolvestylecontext and nsiframe::getparentstylecontextframe ...</p> describe nscssframeconstructor::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" ...
...defined by the css cascade and finds the style rules (interface nsistylerule) thatmatch the content node or content node + pseudo-element pair. (the "non-element" style contexts are defined never to match any rules.) these interfaces nsistylesheet and nsistylerule correspond to the css concepts of style sheets and style rules, except they are more general, and are used by other code that needs to
add style information to the document. for the css stylesheets, this process corresponds to css selector matching. the output of css selector matching as defined by the css specification is an ordered list of rules, where the order determines which declarations override other declarations. (in css,declarations are the property-value pairs within style rules. in mozilla, nscssdeclaration objects corre...
GC and CC logs
s on the test harness, or you can modify the code in nscyclecollector to set that directly. to find the cc logs once the try run has finished, click on the particular job, then click on "job details" in the bottom pane in treeherder, and you should see download links. to set the environment variable, find the buildbrowserenv method in the python file for the test suite you are interested in, and
add something like this code to the file: browserenv["moz_cc_log_directory"] = os.environ["moz_upload_dir"] browserenv["moz_cc_log_shutdown"] = "1" analyzing gc and cc logs there are numerous scripts that analyze gc and cc logs on github. to find out why an object is being kept alive, the relevant scripts are find_roots.py and parse_cc_graph.py (which is called by find_roots.py). calling find_roo...
...to try if you don't have any better idea. to fix a leak, the next step is to figure out why the rooting object is alive. for a c++ object, you need to figure out where the missing references are from. for a js object, you need to figure out why the js object is reachable from a js root. for the latter, you can use the corresponding find_roots.py for js on the gc log. alternatives there are two
add-ons that can be used to create and analyze cc graphs. about:cc is simple, ugly, but rather powerful. about:ccdump is prettier but a bit slower. ...
JS::PerfMeasurement
the js::perfmeasurement class, found in jsperf.h, lets you take detailed performance measurements of your code. it is a stopwatch profiler -- that is, it counts events that occur while code of interest is running; it does not do call traces or sampling. ...
...events that are not being measured will have the fixed value (uint64)-1. void start() call this on a perfmeasurement instance to start timing. void stop() and call this to stop timing again. the counter variables do not update in real time; they only change when stop is called. counter values are accumulated across many start/stop cycles, and you can modify their values if you want; stop simply
adds counts read back from the os to whatever is already in each counter. void reset() resets all enabled counters to zero. uint64 cpu_cycles, uint64 instructions, etc. each potentially-measurable event corresponds to a regular old instance variable, which you can read and even modify. all presently-measurable events are measured with counters, not timers; that is, there is no defined relation betwe...
Profiling with the Gecko Profiler and Local Symbols on Windows
s is no longer needed. the profiler automatically reads symbols from the pdb files that are generated during the build process. you probably need a 64 bit build of firefox for this to work, though. it looks like we consume too much memory when creating the symbol table for this to work in 32 bit firefox builds. unfortunately, 32 bit is still the default when building firefox locally. you need to
add the lines ac_
add_options --target=x86_64-pc-mingw32 and ac_
add_options --host=x86_64-pc-mingw32 to your mozconfig in order to build a 64 bit build of firefox. profiling local talos runs if you would like to use the gecko profiler with a local talos run of a local build of firefox for windows, you will need to point talos to a zipfile containing breakpad-style symbols for your build. follow the ...
...ofiler with a local talos run of a local build of firefox for windows, you will need to point talos to a zipfile containing breakpad-style symbols for your build. follow the steps below: note: you only need to do this if you're on windows and you've built firefox yourself. for any official release of firefox (nightly, beta, etc), you do not need to use these steps. make sure you don't have ac_
add_options --disable-crashreporter in your firefox .mozconfig file. if you're building a beta or release channel version, and you want proper c++ callstacks in your profiles,
add ac_
add_options --enable-profiling to your firefox .mozconfig file. you don't need to do this if you're building nightly, because --enable-profiling is the default on nightly. build firefox as usual, e.g. using ./mach buil...
Scroll-linked effects
ipt> function snap(destination) { if (math.abs(destination - window.scrolly) < 3) { scrollto(window.scrollx, destination); } else if (math.abs(destination - window.scrolly) < 200) { scrollto(window.scrollx, window.scrolly + ((destination - window.scrolly) / 2)); settimeout(snap, 20, destination); } } var timeoutid = null;
addeventlistener("scroll", function() { if (timeoutid) cleartimeout(timeoutid); timeoutid = settimeout(snap, 200, parseint(document.getelementbyid('snaptarget').style.top)); }, true); </script> <div id="snaptarget" class="snaptarget" style="position: relative; top: 200px; width: 100%; height: 200px; background-color: green"></div> </body> in this example, there is a scroll even...
...he kinds of scroll-linked effects you are trying to implement, so that we can find good ways to support them in the compositor. currently there are a few proposals for apis that would allow such effects, and they all have their advantages and disadvantages. the proposals currently under consideration are: web animations: a new api for precisely controlling web animations in javascript, with an
additional proposal to map scroll position to time and use that as a timeline for the animation. compositorworker: allows javascript to be run on the compositor thread in small chunks, provided it doesn't cause the framerate to drop. scroll customization: introduces a new api for content to dictate how a scroll delta is applied and consumed. as of this writing, mozilla does not plan to support this...
Preference reference
nce browser.altclicksave controls whether clicking a link while holding the alt key starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console. set it to true to enable it, or false to disable it.browser.dom.window.dump.filebrowser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose
address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart.browser.download.lastdir.savepersitebrowser.download.lastdir.savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. if set to true, the data is stored as content preference.brow...
... controls whether a search from the context menu with "search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreground or keep focus on the current tab and open it in the background.browser.urlbar.formatting.enabledthe preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the
address bar by coloring it black and the other parts grey.browser.urlbar.trimurlsthe preference browser.urlbar.trimurls controls whether the protocol http and the trailing slash behind domain name (if the open page is exactly the domain name) are hidden.dom.event.clipboardevents.enableddom.event.clipboardevents.enabled lets websites get notifications if the user copies, pastes, or cuts something from...
Preferences
urrently a work in progress. a brief guide to mozilla preferences an introductory guide to where preferences are stored and other useful information about the core preference system. using preferences from application code firefox 6 introduced static functions for accessing preferences efficiently from within application code. this api is not available for
add-ons, but if you're working on a gecko application, this api is the preferred way to access preferences. mozilla networking preferences a guide to key networking-related preferences. mozilla preferences for uber-geeks a guide to preferences that only truly elite geeks should play with. examples code snippets ...
...is api is the preferred way to access preferences. mozilla networking preferences a guide to key networking-related preferences. mozilla preferences for uber-geeks a guide to preferences that only truly elite geeks should play with. examples code snippets preference-related code snippets.
adding preferences to an extension how to
add preferences to an existing extension. related topics xul, javascript, xpcom, extensions, developing mozilla ...
Productization guide
r can deliver a very good quality of search results — but only in a specific country or language, and we have to take this into account when considering default search engines for a locale. hence there is a need to customize the set of default web services on a per-locale basis in order to ensure a good user experience across all locales. purpose of productization there are two main purposes of
adding default web services to mozilla products: provide users with useful and relevant content demonstrate certain features of the product the first one (provide users with useful and relevant content) is obvious: we want to improve our users’ experience on the web, so we provide a couple of well-thought suggestions for different services. for example, we ship firefox with 6 or 7 search engi...
...nt: by providing these default services, we demonstrate particular features of the product, the ones which otherwise wouldn’t be as discoverable. for example, putting one sample news feed on the bookmarks toolbar in new profiles in firefox helps in learning about the live bookmarks. including a couple of search engines instead of one in the search toolbar can help users understand that they can
add as many plug-ins as they wish. this guide will walk you through the steps to successfully productizing your localization. the first page will cover performing research and preparing to submit productization recommendations. the following (and last) page will cover the technical steps to creating and submitting productization patches. next » ...
L20n
r developers wanting to implement localization functionality on their web apps using l20n. internationalization for your web app first read for developers looking to use the l20n infrastructure. l20n's html bindings tutorial on implementing l20n in your html code. l20n javascript api an api for l20n.js. l20n syntax cheatsheet for developers a simple cheatsheet to help developers as they
add l20n to their localization infrastructure. for localizers documentation for localizers creating localized content for a project that uses l20n. learn the l20n syntax how to naturally localize applications using l20n. complete with use cases and examples of l20n in action. localization use-cases how to naturally localize applications using l20n. complete with use cases and examples of l...
...l20n in action. localization use-cases how to naturally localize applications using l20n. complete with use cases and examples of l20n in action. l20n and translation memory exchange (tmx) how l20n impacts the translation memory exchange standard for translation memory data. l20n syntax cheatsheet for localizers a simple cheatsheet to help localizers as they localize projects with l20n.
additional resources some
additional resources for developers and localizers involved with l20n. l20n.org you can try l20n live in your browser on the project page. l20n tinker test out your own l20n code in l20n tinker. github where the main code for the l20n infrastructure and design spec lives. wiki page info about the project to develop l20n. ...
MailNews automated testing
ailnews development. it allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases. this page and its sub-pages describe (and link to) the available test mechanisms within mailnews, and provide supporting information for developers and testers. ...
... "make check" is used to run compiled code tests. these tests can go beyond the limitations of xpcshell-tests (for example, access c++ code) and other testing options that don't test at the right level. ...
MailNews
mailnews stands for "mail and newsgroups". mailnews is the back end of the messaging parts of seamonkey and thunderbird. it provides a number of functions and capabilities, including: communications protocols - smtp, pop3, imap, nntp message management, including search and filtering message composition
address book the mailnews code lives in the mailnews/ directory of comm-central. asynctestutils extended framework the asynctestutils extended framework is one mechanism for testing 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 ...
... ...
Midas editor module security preferences
h text editor component. this means that the corresponding buttons on the mozilla rich text editing demo page will not work. to enable these functions, you must modify your browser preferences. warning: changing these preferences can leave your browser insecure, especially if you grant permission to untrusted sites. ...
...o test your own
add-on or firefox-internal code, and be sure to restore the default settings when you're done! changing the preferences in firefox quit firefox. if you have quick launch running (on windows, this is an icon in the toolbar), quit that too. find your firefox profile directory. open the user.js file from that directory in a text editor. if there's no user.js file, create one.
add these lines to user.js: user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.sites", "https://www-archive.mozilla.org"); user_pref("capability.policy.allowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); change the url https://www.mozilla.org to the site for which you ...
PRIOMethods
ailable64 same as previous 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 previous field, except 64-bit. fileinfo get information about an open file. fileinfo64 same as previous field, except 64-bit. writev write from a vector of buffers. connect connect to the specified network
address. accept accept a connection from a network peer. bind associate a network
address with the file descriptor. listen prepare to listen for network connections. shutdown shut down a network connection. recv receive up to the specified number of bytes. send send all the bytes specified. recvfrom receive up to the specified number of bytes and report network source. sendto send byt...
...connection from a network peer. bind associate a network
address with the file descriptor. listen prepare to listen for network connections. shutdown shut down a network connection. recv receive up to the specified number of bytes. send send all the bytes specified. recvfrom receive up to the specified number of bytes and report network source. sendto send bytes to specified network
address. poll test the file descriptor to see if it is ready for i/o. acceptread accept and read from a new network file descriptor. transmitfile transmit an entire file to the specified socket. getsockname get network
address associated with a file descriptor. getpeername get peer's network
address. getsockopt get current setting of specified socket option. setsockopt set value of spec...
PR_Bind
binds an
address to a specified socket. syntax #include <prio.h> prstatus pr_bind( prfiledesc *fd, const prnet
addr *
addr); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
addr a pointer to a prnet
addr object representing the
address to which the socket will be bound. returns the function returns one of the following values: upon successful binding of an
address to a socket, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description when a new socket is created, it has no
address bound to it. pr_bind assigns the specified
address (also known as name) to the socket. ...
...urns the function returns one of the following values: upon successful binding of an
address to a socket, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description when a new socket is created, it has no
address bound to it. pr_bind assigns the specified
address (also known as name) to the socket. if you do not care about the exact ip
address assigned to the socket, set the inet.ip field of prnet
addr to pr_htonl(pr_in
addr_any). if you do not care about the tcp/udp port assigned to the socket, set the inet.port field of prnet
addr to 0. note that if pr_connect is invoked on a socket that is not bound, it implicitly binds an arbitrary
address the socket. call pr_getsockname to obtain the
address (name) bound to a socket. ...
PR_CEnterMonitor
enters the lock associated with a cached monitor. syntax #include <prcmon.h> prmonitor* pr_centermonitor(void *
address); parameter the function has the following parameter:
address a reference to the data that is to be protected by the monitor. this reference must remain valid as long as there are monitoring operations being performed. returns the function returns one of the following values: if successful, the function returns a pointer to the prmonitor associated with the value specified in the
address parameter. if unsuccessful (the monitor cache needs to be expanded and the system is out of memory), the function returns null. ...
... operations being performed. returns the function returns one of the following values: if successful, the function returns a pointer to the prmonitor associated with the value specified in the
address parameter. if unsuccessful (the monitor cache needs to be expanded and the system is out of memory), the function returns null. description pr_centermonitor uses the value specified in the
address parameter to find a monitor in the monitor cache, then enters the lock associated with the monitor. if no match is found, an available monitor is associated with the
address and the monitor's entry count is incremented (so it has a value of one). if a match is found, then either the calling thread is already in the monitor (and this is a reentrant call) or another thread is holding the monito...
PR_Initialize
provides an alternate form of explicit initialization. in
addition to establishing the sequence of operations, pr_initialize implicitly calls pr_cleanup on exiting the primordial function. syntax #include <prinit.h> printn pr_initialize( prprimordialfn prmain, printn argc, char **argv, pruintn maxptds); parameters pr_initialize has the following parameters: prmain the function that becomes the primordial thread's root function. returning from prmain leads to termination of the process. argc the length of the argument vector, whether passed in from the host's program-launching facility or fabricated by the actual main program. this approach conforms to standard c programming practice. ...
... pr_initialize has the following parameters: prmain the function that becomes the primordial thread's root function. returning from prmain leads to termination of the process. argc the length of the argument vector, whether passed in from the host's program-launching facility or fabricated by the actual main program. this approach conforms to standard c programming practice. argv the base
address of an array of strings that compromise the program's argument vector. this approach conforms to standard c programming practice. maxptds this parameter is ignored. returns the value returned from the root function, prmain. description pr_initialize initializes the nspr runtime and places nspr between the caller and the runtime library. this allows main to be treated like any other func...
PR OpenUDPSocket
can be pr_af_inet (ipv4), pr_af_inet6 (ipv6), or pr_af_local (unix domain, supported on posix systems only). returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened udp socket. if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. ...
...on successful completion, a pointer to the prfiledesc object created for the newly opened udp socket. if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_openudpsocket creates a new udp socket of the
address family af. the socket may be bound to a well-known port number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. ...
PR_SendTo
sends bytes a socket to a specified destination. syntax #include <prio.h> print32 pr_sendto( prfiledesc *fd, const void *buf, print32 amount, printn flags, const prnet
addr *
addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero.
addr a pointer to the
address of the destination. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. the value -1 indicate...
...ecifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_sendto sends a specified number of bytes from a socket to the specified destination
address. the calling thread blocks until all bytes are sent, a timeout has occurred, or there is an error. ...
NSPR API Reference
dentity and versioning name and version constants initialization and cleanup module initialization locks lock type lock functions condition variables condition variable type condition variable functions monitors monitor type monitor functions cached monitors cached monitor functions i/o types directory type file descriptor types file info types network
address types types used with socket options functions type used with memory-mapped i/o offset interpretation for seek functions i/o functions functions that operate on pathnames functions that act on file descriptors directory i/o functions socket manipulation functions converting between host and network
addresses memory-mapped i/o functions anonymous pipe function polling functions ...
...ions type used with memory-mapped i/o offset interpretation for seek functions i/o functions functions that operate on pathnames functions that act on file descriptors directory i/o functions socket manipulation functions converting between host and network
addresses memory-mapped i/o functions anonymous pipe function polling functions pollable events manipulating layers network
addresses network
address types and constants network
address functions atomic operations pr_atomicincrement pr_atomicdecrement pr_atomicset interval timing interval time type and constants interval functions date and time types and constants time parameter callback functions functions memory management operations memory allocation functions memory allocation macros st...
NSPR release process
set the nspr version number. five files need to be updated: configure.in, configure, repackage.sh, prinit.h, and vercheck.c. look at their cvs histories for examples. make a dummy change (
add or remove a blank line) to mozilla/nsprpub/config/prdepend.h. make sure the nss tinderboxes (which also build and test nspr) are all green. the build+test cycles of the nss tinderboxes are very long, so you usually need to wait half a day for them to cycle through. create a beta cvs tag. the naming convention is nspr_x_y_z_betan for nspr x.y.z beta n. ...
...o you usually need to wait half a day for them to cycle through. create a beta cvs tag. the naming convention is nspr_x_y_z_betan for nspr x.y.z beta n. push the beta tag to mozilla-central for testing in firefox trunk builds. ideally you should test it for a week. remove "beta" from the nspr version number for the final release. usually you just need to update prinit.h. make a dummy change (
add or remove a blank line) to mozilla/nsprpub/config/prdepend.h. create a rtm cvs tag. the naming convention is nspr_x_y_z_rtm for nspr x.y.z. upload a source tar file to https://ftp.mozilla.org/pub/mozilla....nspr/releases/ write the release notes. announce the release in the mozilla nspr newsgroup. ...
Building NSS
are some of the variables, along with possible values they may be set to. build_opt 0 build a debug (non-optimized) version of nss. this is the default. 1 build an optimized (non-debug) version of nss. use_64 0 build for a 32-bit environment/abi. this is the default. 1 build for a 64-bit environment/abi. this is recommended. use_asan 0 do not create an
addresssanitizer build. this is the default. 1 create an
addresssanitizer build. unit testing nss contains extensive unit tests. scripts to run these are found in the tests directory. run the standard suite by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scripts will attempt to infer valu...
...e by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scripts will attempt to infer values for host and domsuf, but can fail. replace localhost and localdomain with the hostname and domain suffix for your host. you need to be able to connect to $host.$domsuf. if you don't have a domain suffix you can
add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as follows: 127.0.0.1 localhost.localdomain validate this opening a command shell and typing: ping localhost.localdomain. remove the use_64=1 override if using a 32-bit build. test results running all tests can take a considerable amount of time. test output is stored in tests_results/security/$host.$number/. the fi...
NSS FAQ
omplete open-source implementation of the crypto libraries used by mozilla and other companies in the firefox browser, aol instant messenger (aim), server products from red hat, and other products. for an overview of nss, see overview of nss. for detailed information on the open-source nss project, see nss project page. what can i do with nss? is nss appropriate for my application? if you want
add support for ssl, s/mime, or other internet security standards to your application, you can use network security services (nss) to do so. because nss provides complete support for all versions of ssl and tls, it is particularly well-suited for applications that need to communicate with the many clients and servers that already support the ssl protocol. the pkcs #11 interface included in nss means...
... in many client and server products from netscape and other companies. what platforms and development environments are supported? this section is out of date iplanet e-commerce solutions has certified nss 3.1 on 18 platforms, including aix 4.3, hp-ux 11.0, red hat linux 6.0, solaris (2.6 or later), windows nt (4.0 or later), and windows 2000. other contributors are in the process of certifying
additional platforms. the nss 3.1 api requires c or c++ development environments. for the latest nss release notes and detailed platform information, see project information. what cryptography standards are supported? nss supports ssl v2 and v3, tls, pkcs #5, pkcs #7, pkcs #11, pkcs #12, s/mime, and x.509 v3 certificates. for complete details, see encryption technologies available in nss 3.11 wha...
HTTP delegation
g 111384, which tracks the implementation in mozilla client applications. specifying an ocsp proxy the remainder of this document is a short howto. one might expect the api defines a simple function that accepts the uri and data to be sent, and returns the result data. but there is no such simple interface. the api should allow nss to use the http client either asynchronously or synchronously. in
addition, during an application session with ocsp enabled, a large number of ocsp requests might have to be sent. therefore the api should allow for keep-alive (persistent) http connections. http uris consist of host:port and a path, e.g. http://ocsp.provider.com:80/cgi-bin/ocsp-responder if nss needs to access a http server, it will request that an "http server session object" be created (sec_httpse...
...prequest_createfcn). no full uri is provided as a parameter. instead, the parameters are a server session object (that carries host and port information already) and the request path. in our example the path is "/cgi-bin/ocsp-responder". (when issueing get requests, the "?query-string=data" portion should already be appended to the request path) after creation, nss might call functions to provide
additional details of the http request (e.g. sec_httprequest_setpostdatafcn). the application is expected to collect the details for later use. once nss is finished providing all details, it will request to initiate the actual network communication (sec_httprequest_trysendandreceivefcn). the application should try to reuse existing network connections associated with the server session object. once t...
HTTP delegation
g 111384, which tracks the implementation in mozilla client applications. specifying an ocsp proxy the remainder of this document is a short howto. one might expect the api defines a simple function that accepts the uri and data to be sent, and returns the result data. but there is no such simple interface. the api should allow nss to use the http client either asynchronously or synchronously. in
addition, during an application session with ocsp enabled, a large number of ocsp requests might have to be sent. therefore the api should allow for keep-alive (persistent) http connections. http uris consist of host:port and a path, e.g. http://ocsp.provider.com:80/cgi-bin/ocsp-responder if nss needs to access a http server, it will request that an "http server session object" be created (sec_httpse...
...tprequest_createfcn). no full uri is provided as a parameter. instead, the parameters are a server session object (that carries host and port information already) and the request path. in our example the path is "/cgi-bin/ocsp-responder". (when issuing get requests, the "?query-string=data" portion should already be appended to the request path) after creation, nss might call functions to provide
additional details of the http request (e.g. sec_httprequest_setpostdatafcn). the application is expected to collect the details for later use. once nss is finished providing all details, it will request to initiate the actual network communication (sec_httprequest_trysendandreceivefcn). the application should try to reuse existing network connections associated with the server session object. once t...
JSS
s mode, jss ensures fips compliance by ensuring that all cryptographic operations are performed by the nss cryptographic module. jss offers a jce provider, "mozilla-jss" jca provider notes. jss, jss4.jar, is still built with jdk 1.4.2. while jdk 1.4.2 is eol'd and all new product development should be using the latest javase, legacy business products that must use jdk 1.4 or 1.5 can continue to
add nss/jss security fixes/enhancements. jss is used by red hat and sun products that do crypto in java. jss is available under the mozilla public license, the gnu general public license, and the gnu lesser general public license. jss requires nspr and nss. java provides a jce provider called sunpkcs11 (see java pkcs#11 reference guide.) sunpkcs11 can be configured to use the nss module as the cryt...
...an be configured to use the nss module as the crytographic provider. if you are planning to just use jss jce provider as a bridge to nss's fips validated pkcs#11 module, then the sunpkcs11 jce provider may do all that you need. note that java 1.5 claimed no fips compliance, and java 1.6 or higher needs to be used. a current limitation to the configured sunpkcs11-nss bridge configuration is if you
add a pkcs#11 module to the nss database such as for a smartcard, you won't be able to access that smartcard through the sunpkcs11-nss bridge. if you use jss, you can easily get lists of modules and tokens that are configured in the nss db and freely access all of it. documentation before you use jss, you should have a good understanding of the crypto technologies it uses. you mig...
NSS 3.12.9 release notes
.7/. new in nss 3.12.9 removed functions new ssl options new error codes bugs fixed the following bugs have been fixed in nss 3.12.9. bug 609068: implement j-pake in freebl bug 607058: crash [@ nss_cms_decoder_work_data] bug 613394: november/december 2010 batch of nss root ca changes bug 610843: need way to recover softoken in child after fork() bug 617492:
add pk11_keygenwithtemplate function to pk11wrap (for firefox sync) bug 610162: sha-512 and sha-384 hashes are incorrect for inputs of 512mb or larger when running under windows and other 32-bit platforms (fx 3.6.12 and 4.0b6) bug 518551: vfychain crashes in pkits tests. bug 536485: crash during ssl handshake in [@ intel_aes_decrypt_cbc_256] bug 444367: nss 3.12 softoken returns the certifica...
...bject as ckc_x_509_attr_cert. bug 620908: certutil -t -d "sql:." dumps core bug 584257: need a way to expand partial private keys. bug 596798: win_rand.c (among others) uses unsafe _snwprintf bug 597622: do not use the sec_error_bad_info_access_location error code for bad crl distribution point urls bug 619268: memory leaks in cert_changecerttrust and cert_savesmimeprofile bug 585518:
addtrust qualified ca root serial wrong in certdata.txt trust entry bug 337433: need cert_findcertbynicknameoremail
addrbyusage 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 rev...
NSS 3.15.2 release notes
urity/nss/releases/nss_3_15_2_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.2. users are encouraged to upgrade immediately. bug 894370 - (cve-2013-1739) avoid uninitialized data read in the event of a decryption failure. new in nss 3.15.2 new functionality aes-gcm ciphersuites: aes-gcm cipher suite (rfc 5288 and rfc 5289) support has been
added when tls 1.2 is negotiated. specifically, the following cipher suites are now supported: tls_ecdhe_ecdsa_with_aes_128_gcm_sha256 tls_ecdhe_rsa_with_aes_128_gcm_sha256 tls_dhe_rsa_with_aes_128_gcm_sha256 tls_rsa_with_aes_128_gcm_sha256 new functions pk11_cipherfinal has been introduced, which is a simple alias for pk11_digestfinal. new types no new types hav...
...digestfinal. new types no new types have been introduced. new pkcs #11 mechanisms no new pkcs#11 mechanisms have been introduced notable changes in nss 3.15.2 bug 880543 - support for aes-gcm ciphersuites that use the sha-256 prf bug 663313 - md2, md4, and md5 signatures are no longer accepted for ocsp or crls, consistent with their handling for general certificate signatures. bug 884178 -
add pk11_cipherfinal macro bugs fixed in nss 3.15.2 bug 734007 - sizeof() used incorrectly bug 900971 - nssutil_readsecmoddb() leaks memory bug 681839 - allow ssl_handshakenegotiatedextension to be called before the handshake is finished. bug 848384 - deprecate the ssl cipher policy code, as it's no longer relevant. it is no longer necessary to call nss_setdomesticpolicy because all cipher ...
NSS 3.15.4 release notes
start is enabled, libssl will sometimes return unencrypted, unauthenticated data from pr_recv new in nss 3.15.4 new functionality implemented ocsp querying using the http get method, which is the new default, and will fall back to the http post method. implemented ocsp server functionality for testing purposes (httpserv utility). support sha-1 signatures with tls 1.2 client authentication.
added the --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...
..._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 start. in
addition to enabling the ssl_enable_false_start option, an application must now register a callback using the ssl_setcanfalsestartcallback function. when building on windows, os_target now defaults to win95. to use the winnt build configuration, specify os_target=winnt. bugs fixed in nss 3.15.4 a complete list of all bugs resolved in this release can be obtained at https://bugzilla.mozilla.org/bugl...
NSS 3.15.5 release notes
in nss 3.15.5 are described in the "bugs fixed" section below. distribution information the hg tag is nss_3_15_5_rtm. nss 3.15.5 requires nspr 4.10.2 or newer. nss 3.15.5 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_5_rtm/src/ new in nss 3.15.5 new functionality
added support for the tls application layer protocol negotiation (alpn) extension. two ssl socket options, ssl_enable_npn and ssl_enable_alpn, can be used to control whether npn or alpn (or both) should be used for application layer protocol negotiation.
added the tls p
adding extension. the extension type value is 35655, which may change when an official extension type value is assigned by iana. nss...
...the tls application layer protocol negotiation (alpn) extension. two ssl socket options, ssl_enable_npn and ssl_enable_alpn, can be used to control whether npn or alpn (or both) should be used for application layer protocol negotiation.
added the tls p
adding extension. the extension type value is 35655, which may change when an official extension type value is assigned by iana. nss automatically
adds the p
adding extension to clienthello when necessary.
added a new macro cert_list_tail, defined in certt.h, for getting the tail of a certcertlist. notable changes in nss 3.15.5 bug 950129: improve the ocsp fetching policy when verifying ocsp responses bug 949060: validate the iov input argument (an array of priovec structures) of ssl_writev (called via pr_writev). applications should still ...
NSS 3.16.1 release notes
fixes in nss 3.16.1 are described in the "bugs fixed" section below. distribution information the hg tag is nss_3_16_1_rtm. nss 3.16.1 requires nspr 4.10.5 or newer. nss 3.16.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_16_1_rtm/src/ new in nss 3.16.1 new functionality
added the "ecc" flag for modutil to select the module used for elliptic curve cryptography (ecc) operations. new functions in pk11pub.h pk11_exportderprivatekeyinfo and pk11_exportprivkeyinfo - exports a private key in a der-encoded asn.1 privatekeyinfo type or a seckeyprivatekeyinfo structure. only rsa private keys are supported now. in secmod.h secmod_internaltopubmechflags - c...
... functions in pk11pub.h pk11_exportderprivatekeyinfo and pk11_exportprivkeyinfo - exports a private key in a der-encoded asn.1 privatekeyinfo type or a seckeyprivatekeyinfo structure. only rsa private keys are supported now. in secmod.h secmod_internaltopubmechflags - converts from nss-internal to public representation of mechanism flags. new types in sslt.h ssl_p
adding_xtn - the value of this enum constant changed from the experimental value 35655 to the iana-assigned value 21. . new macros in secmod.h public_mech_ecc_flag - a public mechanism flag for elliptic curve cryptography (ecc) operations. in utilmodt.h secmod_ecc_flag - an nss-internal mechanism flag for elliptic curve cryptography (ecc) operations. this macro has the same ...
NSS 3.16.2 release notes
ls 1.2 is supported. the tls application layer protocol negotiation (alpn) extension is also supported on the server side. rsa-oeap is supported. use the new pk11_privdecrypt and pk11_pubencrypt functions with the ckm_rsa_pkcs_oaep mechanism. new intel aes assembly code for 32-bit and 64-bit windows, contributed by shay gueron and vlad krasnov of intel. new functions in cert.h cert_
addextensionbyoid -
adds an extension to a certificate. it is the same as cert_
addextension except that the oid is represented by a secitem instead of a secoidtag. in pk11pub.h pk11_privdecrypt - decrypts with a private key. the algorithm is specified with a ck_mechanism_type. pk11_pubencrypt - encrypts with a public key. the algorithm is specified with a ck_mechanism_type. new m...
..._next_protocol_no_protocol - an ssl error code that means the server supports no protocols that the client advertises in the alpn extension. notable changes in nss 3.16.2 the btoa command has a new command-line option -w suffix, which causes the output to be wrapped in begin/end lines with the given suffix. use "c" as a shorthand for the suffix certificate. the certutil commands supports
additionals types of subject alt name extensions: --extsan type:name[,type:name]... the certutil commands supports generic certificate extensions, by loading binary data from files, which have been prepared using external tools, or which have been extracted and dumped to file from other existing certificates: --dump-ext-val oid --extgeneric oid:critical-flag:filename[,oid:critica...
NSS 3.16.3 release notes
ion the hg tag is nss_3_16_3_rtm. nss 3.16.3 requires nspr 4.10.6 or newer. nss 3.16.3 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_3_rtm/src/ new in nss 3.16.3 this release consists primarily of ca certificate changes as listed below, and fixes an issue with a recently
added utility function. new functions in cert.h cert_getgeneralnametypefromstring - an utlity function to lookup a value of type certgeneralnametype given a human readable string. this function was already
added in nss 3.16.2, however, it wasn't declared in a public header file. notable changes in nss 3.16.3 the following 1024-bit ca certificates were removed cn = entrust.net...
... sha1 fingerprint: e5:df:74:3c:b6:01:c4:9b:98:43:dc:ab:8c:e8:6a:81:10:9f:e4:8e ou = valicert class 2 policy validation authority sha1 fingerprint: 31:7a:2a:d0:7f:2b:33:5e:f5:a1:c3:4e:4b:57:e8:b7:d8:f1:fc:a6 ou = valicert class 3 policy validation authority sha1 fingerprint: 69:bd:8c:f4:9c:d3:00:fb:59:2e:17:93:ca:55:6a:f3:ec:aa:35:fb
additionally, the following ca certificate was removed as requested by the ca ou = tdc internet root ca sha1 fingerprint: 21:fc:bd:8e:7f:6c:af:05:1b:d1:b3:43:ec:a8:e7:61:47:f2:0f:8a the following ca certificates were
added cn = certification authority of wosign sha1 fingerprint: b9:42:94:bf:91:ea:8f:b6:4b:e6:10:97:c7:fb:00:13:59:b6:76:cb cn =...
NSS 3.17.1 release notes
re https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_1_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.17.1. users are encouraged to upgrade immediately. bug 1064636 - (cve-2014-1568) rsa signature forgery in nss. see also mfsa 2014-73 for details. new in nss 3.17.1 this patch release
adds new functionality and fixes a bug that caused nss to accept forged rsa signatures. a new symbol, _sgn_verifypkcs1digestinfo is exported in this release. as with all exported nss symbols that have a leading underscore '_', this is an internal symbol for nss use only. applications that use or depend on these symbols can and will break in future nss releases. new functionality tls_fallback_scs...
...ocket option 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.17.1 signature algorithms now use sha-256 instead of sha-1 by default.
added support for linux on little-endian powerpc64. bugs fixed in nss 3.17.1 this bugzilla query returns all the bugs fixed in nss 3.17.1: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.17.1 acknowledgements the nss development team would like to thank antoine delignat-lavaud, security researcher at inria ...
NSS 3.17.3 release notes
fixed" section below. distribution information the hg tag is nss_3_17_3_rtm. nss 3.17.3 requires nspr 4.10.7 or newer. nss 3.17.3 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_3_rtm/src/ new in nss 3.17.3 new functionality support for tls_fallback_scsv has been
added to the ssltap and tstclnt utilities. notable changes in nss 3.17.3 the quickder decoder now decodes lengths robustly (cve-2014-1569). the following ca certificates were removed cn = gte cybertrust global root sha1 fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74 cn = thawte server ca sha1 fingerprint: 23:e5:94:94:51:95:f2:41:48...
...cates had the websites and code signing trust bits turned off ou = class 3 public primary certification authority - g2 sha1 fingerprint: 85:37:1c:a6:e5:50:14:3d:ce:28:03:47:1b:de:3a:09:e8:f8:77:0f cn = equifax secure ebusiness ca-1 sha1 fingerprint: da:40:18:8b:91:89:a3:ed:ee:ae:da:97:fe:2f:9d:f5:b7:d1:8a:41 the following ca certificates were
added cn = comodo rsa certification authority sha1 fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 cn = usertrust rsa certification authority sha1 fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e cn = usertrust ecc certification authority sha1 fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e...
NSS 3.23 release notes
qlite shipped with nss has been 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 prevent 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:...
...4:03:05 friendly name: verisign class 3 public pca – g2 sha-256 fingerprint: 83:ce:3c:12:29:68:8a:59:3d:48:5f:81:97:3c:0f:91:95:43:1e:da:37:cc:5e:36:43:0e:79:c7:a8:88:63:8b cn = ca disig sha-256 fingerprint: 92:bf:51:19:ab:ec:ca:d0:b1:33:2d:c4:e1:d0:5f:ba:75:b5:67:90:44:ee:0c:a2:6e:93:1f:74:4f:2f:33:cf the following ca certificates were
added cn = szafir root ca2 sha-256 fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe cn = certum trusted network ca 2 sha-256 fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 the following ca certificate had the email trust bit tu...
NSS 3.25 release notes
n the hg tag is nss_3_25_rtm. nss 3.25 requires netscape portable runtime (nspr) 4.12 or newer. nss 3.25 source distributions are available on ftp.mozilla.org for secure https download at the following location. source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_25_rtm/src/ new in nss 3.25 new functionality implemented dhe key agreement for tls 1.3.
added support for chacha with tls 1.3.
added support for tls 1.2 ciphersuites that use sha384 as the prf. removed the limitation that allowed nss to only support certificate_verify messages that used the same signature hash algorithm as the prf when using tls 1.2 client authentication. several functions have been
added to the public api of the nss cryptoki framework. new functions in nssckfw.
...no longer reports a failure if an application attempts to disable the ssl v2 protocol. the trusted ca certificate list has been updated to version 2.8. ...
NSS 3.26 release notes
g is nss_3_26_rtm. nss 3.26 requires netscape portable runtime (nspr) 4.12 or newer. ...
...w functionality the selfserv test utility has been enhanced to support alpn (http/1.1) and 0-rtt
added support for the system-wide crypto policy available on fedora linux, see http://fedoraproject.org/wiki/changes/cryptopolicy introduced build flag nss_disable_libpkix which allows compilation of nss without the libpkix library notable changes in nss 3.26 the following ca certificate was
added cn = isrg root x1 sha-256 fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 npn is disabled, and alpn is enabled by default the nss test suite now completes with the experimental tls 1.3 code enabled several test improvements and
additions, including a nist known answer test bugs fixed in nss 3.26 th...
NSS 3.28.1 release notes
nss_3_28_1_rtm. nss 3.28.1 requires nspr 4.13.1 or newer. nss 3.28.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_28_1_rtm/src/ new in nss 3.28.1 no new functionality is introduced in this release. this is a patch release to update the list of root ca certificates, and
address a minor tls compatibility issue, that some applications experienced with nss 3.28. notable changes in nss 3.28.1 the following ca certificates were removed cn = buypass class 2 ca 1 sha-256 fingerprint: 0f:4e:9c:dd:26:4b:02:55:50:d1:70:80:63:40:21:4f:e9:44:34:c9:b0:2f:69:7e:c7:10:fc:5f:ea:fb:5e:38 cn = root ca generalitat valenciana sha-256 fingerpri...
...:fb:5e:38 cn = root ca generalitat valenciana sha-256 fingerprint: 8c:4e:df:d0:43:48:f3:22:96:9e:7e:29:a4:cd:4d:ca:00:46:55:06:1c:16:e1:b0:76:42:2e:f3:42:ad:63:0e ou = rsa security 2048 v3 sha-256 fingerprint: af:8b:67:62:a1:e5:28:22:81:61:a9:5d:5c:55:9e:e2:66:27:8f:75:d7:9e:83:01:89:a5:03:50:6a:bd:6b:4c the following ca certificates were
added ou = ac raiz fnmt-rcm sha-256 fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa cn = amazon root ca 1 sha-256 fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e cn = amazon root ca 2 sha-256 fingerprint: 1b:a5:b2:aa:8c:6...
NSS 3.28.2 release notes
n ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_28_2_rtm/src/ incorrect version number note the version numbers embedded in the nss 3.28.2 are wrong (it reports itself as version 3.28.1). new in nss 3.28.2 no new functionality is introduced in this release. ...
...a program linked with older nss 3.x shared libraries will work with nss 3.28.2 shared libraries without recompiling or relinking. ...
NSS 3.28 release notes
957105), which is supported and enabled by default in all versions of tls. new functions in ssl.h ssl_exportearlykeyingmaterial implements a key exporter based on the tls 1.3 early exporter secret. this api is equivalent in function to ssl_exportkeyingmaterial, but it can only succeed if 0-rtt was attempted (on the client) or accepted (on the server). ssl_send
additionalkeyshares configures a tls 1.3 client so that it generates
additional key shares when sending a clienthello. ssl_signatureschemeprefset allows an application to set which signature schemes should be supported in tls and to specify the preference order of those schemes. ssl_signatureschemeprefget allows an application to learn the currently supported and enabled signa...
... prepare for this future change, we'd like to encourage all users of nss to override the standard 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 previously 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 func...
NSS 3.37 release notes
ewer. nss 3.37 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_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 previous 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 alte...
... newer. starting with nss version 3.31, an alternative implementation for rng seeding on the linux/unix platform was available (bug 1346735), which performed seeding exclusively based on /dev/urandom. this alternative implementation is selected at build time by defining the seed_only_dev_urandom symbol. (the classic implementation for rng seeding on the linux/unix platform, which may use
additional sources for the default seeding, is still available and will be used if seed_only_dev_urandom is undefined.) with nss 3.37, this alternative implementation for linux/unix can be selected in "make" builds by defining the environment variable nss_seed_only_dev_urandom. with nss 3.37, this alternative implementation for linux has been enhanced to use the glibc function getentropy(), ins...
NSS 3.44.1 release notes
bin distribution information the hg tag is nss_3_44_1_rtm. nss 3.44.1 requires nspr 4.21 or newer. nss 3.44.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_44_1_rtm/src/ other releases are available in nss releases. ...
...oken many new fips test cases (note: this has increased the source archive by approximately 50 megabytes for this release.) bugs fixed in nss 3.44.1 1554336 - optimize away unneeded loop in mpi.c 1515342 - more thorough input checking (cve-2019-11729) 1540541 - don't unnecessarily strip leading 0's from key material during pkcs11 import (cve-2019-11719) 1515236 -
add a sslkeylogfile enable/disable flag at build.sh 1473806 - fix seckey_converttopublickey handling of non-rsa keys 1546477 - updates to testing for fips validation 1552208 - prohibit use of rsassa-pkcs1-v1_5 algorithms in tls 1.3 (cve-2019-11727) 1551041 - unbreak build on gcc < 4.3 big-endian compatibility nss 3.44.1 shared libraries are backward compatible with all ol...
NSS 3.51 release notes
wapped pkcs11 values of ckm_aes_cmac and ckm_aes_cmac_general bug 1612259 - complete integration of wycheproof ecdh test cases bug 1614183 - check if ppc __has_include(<sys/auxv.h>) bug 1614786 - fix a compilation error for ‘getfipsenv’ "defined but not used" bug 1615208 - send dtls version numbers in dtls 1.3 supported_versions extension to avoid an incompatibility. ...
...ed but not used" bug 1615208 - send dtls version numbers in dtls 1.3 supported_versions extension to avoid an incompatibility. ...
NSS 3.53 release notes
n nss bug 1640041 - fix a null pointer in security/nss/lib/ssl/sslencode.c:67 bug 1640042 - fix a null pointer in security/nss/lib/ssl/sslsock.c:4460 bug 1638289 - avoid multiple definitions of sha{256,384,512}_* symbols when linking libfreeblpriv3.so in firefox on ppc64le bug 1636389 - relocate deprecated seed algorithm bug 1637083 - lib/ckfw: no such file or directory. stop. ...
...o such file or directory. stop. bug 1561331 -
additional modular inverse test bug 1629553 - rework and cleanup gmake builds bug 1438431 - remove mkdepend and "depend" make target bug 290526 - support parallel building of nss when using the makefiles bug 1636206 - hacl* update after changes in libintvector.h bug 1636058 - fix building nss on debian s390x, mips64el, and riscv64 bug 1622033 -
add option to build without seed this bugzilla query returns all the bugs fixed in nss 3.53: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.53 compatibility nss 3.53 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will wo...
NSS Developer Tutorial
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 changed. to stress this fact, we often explicitly assign numeric values to enumerators, rather than relying on the values assigned by the compiler. symbol export...
... in the symbol export lists (nss.def, ssl.def, smime.def, etc.) are truly public functions. unfortunately, public headers 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. 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, t...
NSS Sample Code Sample1
isk 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 two servers that are trying to extablish a shared key pair. we will
add message protection (encryption and macing) examples to this program in the future. sample code #include <iostream.h> #include "pk11pub.h" #include "keyhi.h" #include "nss.h" // key management for keys share among multiple hosts // // this example shows how to use nss functions to create and // distribute keys that need to be shared among multiple servers // or hosts. // // the management scheme ...
...t that is made to the primary // server. the example here shows how to create a permanent (token) // rsa key for this purpose. (this key will also be used for // storage of the keys, since nss does not support permanent symmetric // keys at the current time.) // 3. the secondary host sends its rsa public key to the primary host as // part of a request for a particular key, or to be
added to a list // of secondary hosts. // 4. the administrator of the primary host verifies that the rsa key // that was received belongs to a valid secondary host. the adminstrator // may do this by checking that the key was received in a signed email // message, or by checking a digest value with the adminstrator of the // secondary host. [need support for digest check values] // 5...
nss tech note3
his, see discussion of trust flags farther below). netscape has its own openly defined cert type extension, which can be used to explicitly set the cert type in any cert. the cert type extension has bits in it that correspond directly to the cert types named above. the oid for this extension is { 2 16 840 1 113730 1 1 } encoded in hex as 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01 in
addition to netscape's own cert type extension, nss recognizes various x.509 extensions. the x.509 key usage extension has oid { 2 5 29 0f } encoded in hex as 0x55, 0x1d, 0x0f. if present, this extension directly determines the values of the 8 key usages defined above. if absent, the cert is assumed to be valid for all key usages. the x.509v3 extended key usage extension as oid { 2 5 29 37 } enco...
...s extension is missing, but the user has trusted the cert as a ca cert, the cert also gets the status_responder cert type. if the cert has a fortezza type public key with the magic bits that signify that it is a ca, it is given cert types ssl_ca and email_ca. a cert with the extended key usage extension and the netscape cert type extension that has the cert type ssl_client and also has an email
address in the subject is also given the cert type email. this allows all ssl client authentication certs with email
addresses to also be used as email certs (provded they have adequate key usage). a cert with the extended key usage extension and the netscape cert type extension that as cert type ssl_ca is also always given cert type email_ca. this allows all ssl intermediate cas to also be used a...
Overview of NSS
nss provides a complete open-source implementation of the crypto libraries used by aol, red hat, google, and other companies in a variety of products, including the following: mozilla products, including firefox, thunderbird, seamonkey, and firefox os. aol instant messenger (aim) open source client applications such as evolution, pidgin, apache openoffice, and libreoffice. ...
...see encryption technologies. fips 140 validation and niscc testing the nss software crypto module has been validated three times for conformance to fips 140 at security levels 1 and 2. for more information, see the nss fips page (or this one). the nss libraries passed the niscc tls/ssl and s/mime test suites (1.6 million test cases of invalid input data). complete software development kit in
addition to libraries and apis, nss provides security tools 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) l...
PKCS 12 functions
rations required by some of the nss tools and other applications. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
...mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
FC_SeedRandom
note that fc_seedrandom() doesn't provide the initial seed material for the random number generator. the initial seed material is provided by the nss cryptographic module itself. a user may call fc_seedrandom() without logging into the token (to assume the nss user role). ...
...note that fc_seedrandom() doesn't provide the initial seed material for the random number generator. the initial seed material is provided by the nss cryptographic module itself. a user may call fc_seedrandom() without logging into the token (to assume the nss user role). ...
NSS tools : cmsutil
ile use infile as a source of data (default is stdin). -n nickname specify nickname of certificate to sign with (sign only). -n suppress output of contents (decode only). -o outfile use outfile as a destination of data (default is stdout). -p include an s/mime capabilities attribute. -p password use password as key database password. -r recipient1,recipient2, ... specify list of recipients (email
addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is certusageemailsigner). -y ekprefnick specify an encryption key preference by nickname. usage encrypt example cmsutil -c [-i infile] [-o outfile] [-d dbdir] [-p password] -r "recipient1,recipient2,...
...d] [-c content] [-n] [-h num] envelope example cmsutil -e [-i infile] [-o outfile] [-d dbdir] [-p password] -r "recipient1,recipient2, ..." certificate-only example cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." sign message example cmsutil -s [-i infile] [-o outfile] [-d dbdir] [-p password] -n nickname[-tgp] [-y ekprefnick] see also certutil(1) see also
additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code ch...
NSS tools : vfychain
this tool can also create certificate, key, and module security database files. ...
...ain". -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", "requireinfo" and "failifnoinfo".
additional resources for information about nss and other tools related to nss (like jss), check out the nss project wiki at [1]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto irc: freenode at #dogtag-pki authors the nss tools were written and maintained by developers wi...
NSS reference
ec_pkcs5createalgorithmid sec_pkcs5getcryptoalgorithm sec_pkcs5getkeylength sec_pkcs5getpbealgorithm sec_pkcs5isalgorithmpbealg pkcs #12 functions based on "archived pkcs #12 functions documentation." used to exchange data such as private keys and certificates between two parties. ...
... sec_pkcs5getcryptoalgorithm sec_pkcs5getkeylength sec_pkcs5getpbealgorithm sec_pkcs5isalgorithmpbealg pkcs #12 functions based on "archived pkcs #12 functions documentation." used to exchange data such as private keys and certificates between two parties. ...
OLD SSL Reference
certificate setting up the client db and certificate verifying the server and client certificates building nss programs chapter 3 selected ssl types and structures this chapter describes some of the most important types and structures used with the functions described in the rest of this document, and how to manage the memory used for them.
additional types are described with the functions that use them or in the header files. types and structures certcertdbhandle certcertificate pk11slotinfo secitem seckeyprivatekey secstatus managing secitem memory secitem...
...s are used for obtaining certificates, keys, and passwords. pk11_findcertfromnickname pk11_findkeybyanycert pk11_getslotname pk11_gettokenname pk11_ishw pk11_ispresent pk11_isreadonly pk11_setpasswordfunc chapter 8 nss and ssl error codes nss error codes are retrieved using the nspr function pr_geterror. in
addition to the error codes defined by nspr, pr_geterror retrieves the error codes described in this chapter. ssl error codes sec error codes ...
sslintro.html
can pass this function a model file descriptor to create the new ssl socket with the same configuration state as the model. it is also possible for an application to import a socket into ssl after the tcp connection on that socket has already been established. in this case, initial configuration takes place in the same way: pass the existing nspr file descriptor to ssl_importfd and perform any
additional configuration that has not already been determined by the model file descriptor. configuration functions control the configuration of an individual socket. pr_getsocketoption. retrieves the socket options currently set for a specified socket. optional. pr_setsocketoption. sets the socket options for a specified socket., including making it blocking or nonblocking. optional. ssl...
...ssl_handshakecallback. specifies a callback function that will be used by ssl to inform either a client application or a server application when the ssl handshake is completed. optional. communication at this point the application has set up the socket to communicate using ssl. for simple encrypted and authenticated communications, no further calls to ssl functions are required. a variety of
additional ssl functions are available, however. these can be used, for example, when interrupting and restarting socket communications, when the application needs to change socket parameters, or when an application imports a socket into ssl after the tcp connection on that socket has already been established. communication between ssl sockets always begins with the ssl handshake. the handshake occu...
ssltyp.html
ration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference selected ssl types and structures chapter 3 selected ssl types and structures this chapter describes some of the most important types and structures used with the functions described in the rest of this document, and how to manage the memory used for them. ...
...some of these functions also use types defined by nspr and described in the nspr reference. ...
SSL functions
if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference. ...
... if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference. the mozilla cross reference (dxr) link for each function provides access to the function definition, prototype definition, and source code references. ...
Utility functions
and later seckey_destroyencryptedprivatekeyinfo mxr 3.2 and later seckey_destroyprivatekeyinfo mxr 3.2 and later seckey_destroypublickey mxr 3.2 and later seckey_publickeystrength mxr 3.2 and later seckey_updatecertpqg mxr 3.2 and later secmod_
addnewmodule mxr 3.3 and later secmod_
addnewmoduleex mxr 3.4 and later secmod_deletemoduleex mxr 3.12 and later secmod_cancelwait mxr 3.9.3 and later secmod_candeleteinternalmodule mxr 3.5 and later secmod_createmodule mxr 3.4 and later ...
... 3.4 and later secmod_pubmechflagstointernal mxr 3.4 and later secmod_unloadusermodule mxr 3.4 and later secmod_updatemodule mxr 3.4 and later secmod_updateslotlist mxr 3.9.3 and later secmod_waitforanytokenevent mxr 3.9.3 and later secoid_
addentry mxr 3.10 and later secoid_comparealgorithmid mxr 3.2 and later secoid_copyalgorithmid mxr 3.2 and later secoid_destroyalgorithmid mxr 3.2 and later secoid_findoid mxr 3.2 and later secoid_findoidbytag mxr 3.2 and later secoid_...
NSS Tools ssltap
nications corpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...u... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .hardcore1'0%..u d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....hardcore cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | ii0...9805160103<
additional data lines>]<
additional records in same format>server socket closed. example 4 in this example, the -s option turns on ssl parsing, and the -h options turns on hex/ascii format. both formats are shown for each record. the output is routed to a text file. command ssltap.exe -hs -p 444 interzone.mcom.com:443 > hs.txt output connected to interzone.mcom.com:443--> [ 0: 80 3d 0...
... usage tips when ssl restarts a previous 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...
NSS tools : cmsutil
ame of certificate to sign with (sign only). -n suppress output of contents (decode only). -o outfile use outfile as a destination of data (default is stdout). -p include an s/mime capabilities attribute. -p password use password as key database password. -r recipient1,recipient2, ... specify list of recipients (email
addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is certusageemailsigner). -y ekprefnick specify an encryption key preference by nickname. usage encrypt example cmsutil -c...
...num] envelope example cmsutil -e [-i infile] [-o outfile] [-d dbdir] [-p password] -r "recipient1,recipient2, ..." certificate-only example cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." sign message example cmsutil -s [-i infile] [-o outfile] [-d dbdir] [-p password] -n nickname[-tgp] [-y ekprefnick] see also certutil(1) see also
additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates dir...
NSS tools : signver
common legacy type. using the sqlite databases must be manually specified by using the sql: prefix with the given security directory. for example: # signver -a -s signature -d sql:/home/my/sharednssdb to set the shared database type as the default type for the tools, set the nss_default_db_type environment variable to sql: export nss_default_db_type="sql" this line can be set
added to the ~/.bashrc file to make the change permanent. most applications do not use the shared database by default, but they can be configured to use them. for example, this how-to article covers how to configure firefox and thunderbird to use the new shared nss databases: o https://wiki.mozilla.org/nss_shared_db_howto for an engineering draft on the changes in the shared ns...
... o https://wiki.mozilla.org/nss_shared_db see also signtool (1) the nss wiki has information on the new database design and how to configure applications to use it. o setting up the shared nss database https://wiki.mozilla.org/nss_shared_db_howto o engineering and technical information about the shared nss database https://wiki.mozilla.org/nss_shared_db
additional resources for information about nss and other tools related to nss (like jss), check out the nss project wiki at [1]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto irc: freenode at #dogtag-pki authors the nss tools were written and m...
NSS tools : vfychain
this tool can also create certificate, key, and module security database files. ...
...sible 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", "requireinfo" and "failifnoinfo".
additional resources for information about nss and other tools related to nss (like jss), check out the nss project wiki at [1]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto irc: freenode at #dogtag-pki authors the nss tools were written and m...
Rhino overview
however, rhino is an implementation of the core language only and doesn't contain objects or methods for manipulating html documents. rhino contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language. ...
...ript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language. rhino 1.3 and greater conform to edition 3 of the standard. rhino 1.6 and greater implement ecma-357 ecmascript for xml (e4x). see the specification for more information on the standard, and rhino version 1.6r1 release notes for details on the implementation in rhino. in
addition, rhino has implemented javaadapters, which allows javascript to implement any java interface or extend any java class with a javascript object. see the enum.js example for more information. numerous books and tutorials on javascript are available. javascript: the definitive guide is recommended, and contains a chapter on rhino. deprecated language features several language features introd...
Rhino serialization
ve all of the references from the deserialized object to prototypes and parent scopes resolved correctly to refer to objects in the new scope. scriptableoutputstream takes a scope as a parameter to its constructor. if in the process of serialization it encounters a reference to the scope it will serialize a marker that will be resolved to the new scope upon deserialization. it is also possible to
add names of objects to a list in the scriptableoutputstream object. these objects will also be saved as markers upon serialization and resolved in the new scope upon deserialization. use the
addexcludedname method 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 ...
...objects will also be saved as markers upon serialization and resolved in the new scope upon deserialization. use the
addexcludedname method 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 prevent 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 scripta...
FOSS
getting started here. ...
...getting started here. ...
JIT Optimization Strategies
rty access are polymorphic (more than one type), this optimization cannot succeed. furthermore, even if the object type is monomorphic, the optimization will fail if the property being accessed is not a definite slot as described above. getprop_unboxed similar to getprop_definiteslot. unboxed property reads are possible on properties which satisfy all the characteristics of a definite slot, and
additionally have been observed to only store values of one kind of value. consider the following constructor: function point(x, y) { this.x = x; this.y = y; } if only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object. objects which have the unbo...
...rty access are polymorphic (more than one type), this optimization cannot succeed. furthermore, even if the object type is monomorphic, the optimization will fail if the property being written is not a definite slot as described above. setprop_unboxed similar to setprop_definiteslot. unboxed property writes are possible on properties which satisfy all the characteristics of a definite slot, and
additionally have been observed to only store values of one kind of value. consider the following constructor: function point(x, y) { this.x = x; this.y = y; } if only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object. objects which have the unbo...
JS::Evaluate
this article covers features introduced in spidermonkey 17 compile and execute a script. ...
...t length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::autoobjectvector &scopechain, const readonlycompileoptions &options, const char16_t *chars, size_t length, js::mutablehandlevalue rval); //
added in spidermonkey 17 bool js::evaluate(jscontext *cx, js::autoobjectvector &scopechain, const js::readonlycompileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlevalue rval); // obsolete since jsapi 39 bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, js::sourcebufferholder &sr...
JS::IdentifyStandardInstance
rticle covers features introduced in spidermonkey 31 determine if the given object is an instance/prototype/constructor for a standard class. syntax jsprotokey js::identifystandardinstance(jsobject *obj); jsprotokey js::identifystandardprototype(jsobject *obj); jsprotokey js::identifystandardinstanceorprototype(jsobject *obj); jsprotokey js::identifystandardconstructor(jsobject *obj); //
added in spidermonkey 38 name type description obj jsobject * pointer to the instance/prototype/constructor object to determine. description js::identifystandardinstance determines if the given object is an instance for a standard class. if so, return the associated jsprotokey. if not, return jsproto_null. js::identifystandardprototype determines if the given ...
...or determines if the given object is a constructor for a standard class. if so, return the associated jsprotokey. if not, return jsproto_null. see also mxr id search for js::identifystandardinstance mxr id search for js::identifystandardprototype mxr id search for js::identifystandardinstanceorprototype mxr id search for js::identifystandardconstructor jsprotokey bug 975277 bug 976148 -
added identifystandardconstructor ...
JSNative
arguments, the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. description jsnative is the type of native implementations of javascript functions. full documentation of how to define a jsnative (or a jsfastnative, the equivalent typedef which preceded it) is available in the api header "js/callargs.h"
added in spidermonkey 24. this header is new, but the semantics it describes are applicable to all recent spidermonkey releases. the preferred way to implement a function is to use the js::callargs structure defined there; the macros providing equivalent functionality are deprecated. the behavior of a jsnative is implemented using a js::callargs structure
added in spidermonkey 17. (this structure ...
... is new, but the semantics it describes are applicable to all recent spidermonkey releases. the preferred way to implement a function is to use the js::callargs structure defined there; the macros providing equivalent functionality are deprecated. the behavior of a jsnative is implemented using a js::callargs structure
added in spidermonkey 17. (this structure is now provided in "js/callargs.h"
added in spidermonkey 24 as well as through "jsapi.h".) this structure encapsulates access to the callee function, this, the function call's arguments, and the eventual return value. on success, the callback must set js::callargs::rval() or call js_set_rval (at least once) and return true. otherwise it should either report an error (using e.g. js_reporterror or js_reportoutofmemory) or raise an exce...
JSNewEnumerateOp
the type of objectops::enumerate. this callback overrides a portion of spidermonkey's default [[enumerate]] internal method. syntax typedef bool (* jsnewenumerateop)(jscontext *cx, js::handleobject obj, js::autoidvector &properties); //
added in spidermonkeysidebar 38 typedef bool (* jsnewenumerateop)(jscontext *cx, js::handleobject obj, jsiterateop enum_op, js::mutablehandlevalue statep, js::mutablehandleid idp); // obsolete since jsapi 37 name type description cx jscontext * the context in which the enumeration is taking place. obj js::handleobject the object to be enumerated. properties js::autoidvector & out parameter. id array to populate with all property keys. enum...
...um_op. see the description below. description from spidermonkey 38, jsnewenumerateop is the type of objectops::enumerate. this callback overrides a portion of spidermonkey's default [[enumerate]] internal method. when an ordinary object is enumerated, that object and each object on its prototype chain is tested for an enumerate op, and those ops are called in order. the properties each op
adds to the properties vector are
added to the set of values the for-in loop will iterate over. all of this is nonstandard. an object is "enumerated" when it's the target of a for-in loop or js_enumerate. all other property inspection, including object.keys(obj), goes through [[ownkeys]]. the callback's job is to populate properties with all property keys that the for-in loop should visit. before...
JSPrincipals
e enabled globally. obsolete since jsapi 12 destroy void (*)(jscontext *, jsprincipals *) pointer to the function that decrements the reference count and possibly frees the principals if they are no longer in use. obsolete since jsapi 13 methods name description void dump() this is not defined by the js engine but should be provided by the embedding.
added in spidermonkey 17 description jsprincipals is the abstract base class of all principals objects, the objects that identify the source of a function or script and are used to determine its privileges. a principals object is like a java codesource. jsprincipals could be passed into the js engine through the js_newglobalobject function. jsprincipals has refcount property that is the ref...
...must be decremented by one. when refcount reaches zero, the principals are no longer in use and are destroyed. ...
JSPropertySpec
tinyid int8 obsolete since jsapi 31 unique id number for the property to aid in resolving getproperty and setproperty method calls. this value should be zero if you...
... properties and assign them to an object. to define an array of jspropertyspec, use js_psg, js_psgs, js_self_hosted_get, js_self_hosted_getset, and js_ps_end see also mxr id search for jspropertyspec jsfunctionspec jsnativewrapper js_defineproperties js_psg js_psgs js_self_hosted_get js_self_hosted_getset js_ps_end bug 766448 - changed type of getter and setter to wrapper bug 938728 -
added selfhostedgetter and selfhostedsetter bug 958262 - changed type of getter and setter to union, and removed selfhostedgetter and selfhostedsetter. ...
JSVAL_LOCK
s 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. locks a js value to prevent garbage collection on it. syntax jsval_lock(cx,v) description jsval_lock is a deprecated feature that is supported only for backward compatibility with existing applications. to lock a value, use local roots with js_
addroot. jsval_lock locks a js value, v, to prevent the value from being garbage collected. 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. if locking is successful, or v already cannot be garbage collected because it is not an object, string, or double value, jsval_lock evaluates to true. otherwise, it eva...
... collected. v is a js object, string, or double value. ...
JS_CallFunction
calls a specified js function. ...
...n js::handlefunction pointer to the function to call. fun should be a native function or jsapi-compiled function. see below. name const char * pointer to the name of function to call. fval js::handlevalue pointer to the function value to call. args const js::handlevaluearray & reference to the array of argument values to pass to the function.
added in spidermonkey 31 argc unsigned number of arguments you are passing to the function. obsolete since jsapi 30 argv jsval * pointer to the array of argument values to pass to the function. obsolete since jsapi 30 rval js::mutablehandlevalue out parameter. on success, *rval receives the return value from the function call. description js_callfu...
JS_ConvertArgumentsVA
signed argc, jsval *argv, const char *format, va_list ap); 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. args const js::callargs & reference to the arguments to convert.
added in spidermonkey 31 argc unsigned the number of arguments to convert. obsolete since jsapi 30 argv jsval * pointer to the vector of arguments to convert. obsolete since jsapi 30 format const char * character array containing the recognized format to which to convert. ap va_list the list of pointers into which to store the converted ...
...e of the c programming language. ...
JS_DefineConstDoubles
create multiple constant double or integer valued properties on an object. syntax bool js_defineconstdoubles(jscontext *cx, js::handleobject obj, const jsconstdoublespec *cds); bool js_defineconstintegers(jscontext *cx, js::handleobject obj, const jsconstintegerspec *cis); //
added in spidermonkey 38 name type description cx jscontext * the context in which to define the new properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. cds jsconstdoublespec * pointer to an array of jsconstdoublespec records containing property names and values to create. the last array elem...
...eld. ...
JS_DeleteElement
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. ...
...nd earlier, if failure occurs because you attempt to delete a permanent or read-only element, js_deleteelement reports the error before returning false. for javascript 1.3 and later, the attempt is silently ignored. to truncate an array, use js_setarraylength. to remove all elements and properties from an object, call js_clearscope. see also mxr id search for js_deleteelement bug 1113369 --
added result parameter ...
JS_EncodeString
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.. str jsstring * / js::handlestring a string to encode. ...
...s to access the 16-bit characters of a javascript string without conversions or copying. on success, js_encodestring and js_encodestringtoutf8 return a pointer to the char array, which is null-terminated. on failure, js_encodestring and js_encodestringtoutf8 return null see also mxr id search for js_encodestring mxr id search for js_encodestringtoutf8 js_encodestringtobuffer bug 397215 -
added js_encodestring bug 835719 -
added js_encodestringtobuffer ...
JS_GetContextPrivate
data void * (in js_setcontextprivate or js_setsecondcontextprivate) pointer to application-defined data to be associated with the context cx. ...
... data void * (in js_setcontextprivate or js_setsecondcontextprivate) pointer to application-defined data to be associated with the context cx. ...
JS_GetFunctionId
description js_getfunctionid returns the name of a function, fun, as a jsstring, or null if fun is unnamed. the returned string lives as long as fun, so you don't need to root a saved reference to it if fun is well-connected or rooted, and provided you bound the use of the saved reference by fun's lifetime. ...
... // a.d< -- the '<' loosely means "contributor to" return function() {}; // a.d })(); var foo = function() { // foo var bar = function() {}; // foo/bar }; settimeout(function() {}, 100); // no name, js_getfunctiondisplayid returns null see also mxr id search for js_getfunctionid mxr id search for js_getfunctiondisplayid bug 433529 -
added js_getfunctiondisplayid ...
JS_GetGCParameter
adjust performance parameters related to garbage collection. syntax uint32_t js_getgcparameter(jsruntime *rt, jsgcparamkey key); void js_setgcparameter(jsruntime *rt, jsgcparamkey key, uint32_t value); uint32_t js_getgcparameterforthread(jscontext *cx, jsgcparamkey key); //
added in spidermonkeysidebar 17 void js_setgcparameterforthread(jscontext *cx, jsgcparamkey key, uint32_t value); //
added in spidermonkeysidebar 17 name type description rt jsruntime * the runtime to configure. cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. key jsgcparamkey specifies which garbage collection parameter to get or set. value uint32_t (js...
... as a baseline or default heap size. jsgc_allocation_threshold_factor / "allocationthresholdfactor" these thresholds (as percentages) are compared with the zone threshold (above) to decide when to begin an incremental collection. jsgc_allocation_threshold_factor_avoid_interrupt is used when a gc is already in progress for other zones and we may wish to avoid interrupting it.
additionally if a zone expands beyond the threshold without this factor, then it will be collected non-incrementally jsgc_allocation_threshold_factor_avoid_interrupt / "allocationthresholdfactoravoidinterrupt" jsgc_min_empty_chunk_count / "minemptychunkcount" we try to keep at least this many unused chunks in the free chunk pool at all times, even after a shrinking gc. ...
JS_GetOwnPropertyDescriptor
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the property. id const char * or js::handleid or const char16_t the name of the property to look up. desc js::muta...
...d description of that property (returned in desc->obj). if desc->obj is null, then this property was not found on the prototype chain. see also mxr id search for js_getownpropertydescriptor mxr id search for js_getownpropertydescriptorbyid mxr id search for js_getownucpropertydescriptor js_getpropertydescriptor js_getpropertydescriptorbyid jspropertydescriptor bug 893186 bug 1135731 --
added js_getownpropertydescriptor ...
JS_GetPropertyDescriptor
finds a specified property of an object and gets a detailed description of that property. syntax bool js_getpropertydescriptor(jscontext *cx, js::handleobject obj, const char *name, js::mutablehandle<jspropertydescriptor> desc); //
added in spidermonkey 31 bool js_getpropertydescriptorbyid(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandle<jspropertydescriptor> desc); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the property. id const char * or js::handleid the name of the property to look up. ...
...d property of an object and gets a detailed description of that property on the prototype chain (returned in desc->obj). if desc->obj is null, then this property was not found on the prototype chain. see also mxr id search for js_getpropertydescriptor mxr id search for js_getpropertydescriptorbyid js_getownpropertydescriptor js_getownpropertydescriptorbyid jspropertydescriptor bug 482381 -
added js_getpropertydescriptorbyid bug 893186 -
added js_getpropertydescriptor ...
JS_InstanceOf
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...text from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> object to test. clasp jsclass * class against which to test the object. args js::callargs * optional pointer to arguments. if non-null, report an error if obj is not of type clasp.
added in spidermonkey 38 argv jsval * optional argument vector. if non-null, report an error if obj is not of type clasp. argv must be the argv argument passed from the engine to a jsnative callback, js_argv(cx, rv) in a jsfastnative callback, or null. obsolete since jsapi 32 description js_instanceof can be used to check whether an object obj is of a particular jsclass. to use...
JS_IsArrayObject
e object to examine. ...
... isarray bool whether the value/object is an array. ...
JS_LookupProperty
text *cx, js::handleobject obj, const char *name, js::mutablehandlevalue vp); bool js_lookupucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::mutablehandlevalue vp); bool js_lookuppropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); //
added in spidermonkey 1.8.1 bool js_lookupelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); // ---- obsolete since spidermonkey 31 ---- bool js_lookuppropertywithflags(jscontext *cx, js::handleobject obj, const char *name, unsigned flags, js::mutablehandlevalue vp); bool js_lookuppropertywithflagsbyid(jscontext *cx...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t *or js::handleid ...
JS_NewGlobalObject
the caller must ensure that the jsclass remains alive throughout the lifetime of the new object, including the garbage collection cycle that finally frees it. the usual way to do this is to make jsclasses global or static. principals jsprincipals * the security information to associate with this compartment. hookoption js::onnewglobalhookoption see debugger api hook
added in spidermonkey 31 options const js::compartmentoptions & the option for new compartment (passed to jscompartment constructor).
added in spidermonkey 31 description js_newglobalobject creates a new global object based on the specified class. the new object has no parent. it initially has no prototype either, since it is typically the first object created; call js_ini...
...he global should not be in a half-baked state. but this creates a problem for consumers that need to set slots on the global to put it in a consistent state. this api provides a way for consumers to set slots atomically (immediately after the global is created), before any debugger hooks are fired. it's unfortunately on the clunky side, but that's the way the cookie crumbles. if callers have no
additional state on the global to set up, they may pass fireonnewglobalhook to js_newglobalobject, which causes that function to fire the hook as its final act before returning. otherwise, callers should pass dontfireonnewglobalhook, which means that they are responsible for invoking js_fireonnewglobalobject upon successfully creating the global. if an error occurs and the operation aborts, callers s...
JS_PSGS
this article covers features introduced in spidermonkey 17 macros for describing properties, for use with js_defineproperties and js_initclass. syntax #define js_psg(name, getter, flags) ... #define js_psgs(name, getter, setter, flags) ... #define js_self_hosted_get(name, gettername, flags) ... //
added in spidermonkey 31 #define js_self_hosted_getset(name, gettername, settername, flags) ... //
added in spidermonkey 31 #define js_ps_end ... name type description name const char * the javascript name for the property. (or index, if jsprop_index is present in flags) getter jsnative pointer to the c/c++ implementation of the getter function. setter jsnative pointer to the c/c++ implementation of the setter function. ...
...in self-hosted javascript code for setter function. description these macros encapsulate the definition of jsnative-backed jspropertyspecs, by defining the jsnativewrappers for them. see also mxr id search for js_psg mxr id search for js_psgs mxr id search for js_self_hosted_get mxr id search for js_self_hosted_getset jspropertyspec js_defineproperties js_initclass bug 684526 -
added. bug 938728 -
added js_self_hosted_get and js_self_hosted_getset. ...
JS_PushArguments
tore the resulting jsvals in an array. syntax jsval * js_pusharguments(jscontext *cx, void **markp, const char *format, ...); jsval * js_pushargumentsva(jscontext *cx, void **markp, const char *format, va_list ap); name type description cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_
addargumentformatter has been called. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. markp void ** out parameter. on success, *markp receives the internally allocated stack mark which should be passed to js_poparguments. format const char * null-terminated string holding a list of format types to convert the following a...
...2 (32-bit, signed integer) d jsdouble i jsdouble (converted to an integer value) s char * (c string) s jsstring * (unicode string) w jschar * (unicode null-terminated string) o jsobject * f jsfunction * * none. any asterisks (*) in format are ignored. this function also takes in consideration any
additional custom types defined in cx using js_
addargumentformatter. for example, if format is "biob", then there must be four arguments after format. their types must be jsbool, jsdouble, jsobject *, and jsbool. if successful, js_pusharguments would return a pointer to the first element of an array of four jsvals: a boolean, a number, an object (or null), and a boolean. on success, js_pusharguments ...
JS_RemoveExternalStringFinalizer
ny time. try to avoid using it. unregister a custom string memory manager. syntax int js_removeexternalstringfinalizer(jsstringfinalizeop finalizer); name type description finalizer jsstringfinalizeop the finalizer to remove. description remove finalizer from the global gc finalizers table, returning its type code if found, -1 if not found. as with js_
addexternalstringfinalizer, there is a threading restriction if you compile the engine js_threadsafe: this function may be called for a given finalizer pointer on only one thread; different threads may call to remove distinct finalizers safely. you must ensure that all strings with finalizer's type have been collected before calling this function. otherwise, string data will be leaked by the gc, for...
...restriction if you compile the engine js_threadsafe: this function may be called for a given finalizer pointer on only one thread; different threads may call to remove distinct finalizers safely. you must ensure that all strings with finalizer's type have been collected before calling this function. otherwise, string data will be leaked by the gc, for want of a finalizer to call. see also js_
addexternalstringfinalizer bug 724810 ...
JS_ReportErrorNumber
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. flags unsigned error report flags. errorcallback jserrorcallback callback to fetch the error message. userref void * a pointer ...
... userref void * a pointer to application data. the javascript engine passes this pointer to errorcallback. the meaning of the data is up to the application. errornumber const unsigned an error code. the javascript engine passes this number to errorcallback. the meaning of the error number is up to the application. ... / args ... / const char16_t **
additional arguments for the error message. these arguments must be of type char * for js_reporterrornumber or js_reporterrorflagsandnumber, or char16_t * for js_reporterrornumberuc or js_reporterrorflagsandnumberuc. the number of
additional arguments required depends on the error message, which is determined by the errorcallback. callback syntax typedef const jserrorformatstring * (* j...
JS_SetContextCallback
scontext is created or destroyed. syntax void js_setcontextcallback(jsruntime *rt, jscontextcallback cxcallback, void *data); name type description rt jsruntime * pointer to a js runtime. cxcallback jscontextcallback pointer to the callback function, described below. data void * any data passed as 3rd argument to the callback function.
added in spidermonkey 31 callback syntax 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_getcontextpriva...
...as just created, or is about to be destroyed. for example, the callback my call js_getcontextprivate(cx) in order to free up resources previously 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 meaning jscontext_new js_newcontext successfully created a new jscontext instance. the callback can initialize the instance as required. if the callback returns js_false, the instance will be destroyed and js_newcontext returns null. in this case the c...
JS_SetThreadStackLimit
obsolete since jsapi 13this 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. enable or disable checks to avoid overflowing the c stack. this is deprecated, use js_setnativestackquota instead. ...
... in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. enable or disable checks to avoid overflowing the c stack. this is deprecated, use js_setnativestackquota instead. syntax void js_setthreadstacklimit(jscontext *cx, jsuword limit
addr) name type description cx jscontext * the context to configure. limit
addr jsuword an
address near the top of the c stack. this should be a safely writeable
address well short of the actual top of the stack. description js_setthreadstacklimit sets the maximum (if stack grows upward) or minimum (downward) legal stack byte
address in limit
addr for the thread or process stack used by cx. to disable stack size checking, pass 0 for limit
addr. in a js_threadsafe ...
Parser API
importing), the global singleton object reflect currently contains just the parse method. properties of the reflect object the reflect object currently consists of a single method. reflect.parse(src[, options]) coerces src to a string and parses the result as a javascript program. by default, the parsing returns a program object (see below) representing the parsed abstract syntax tree (ast).
additional options may be provided via the options object, which can include any of the following properties: loc boolean default: true when loc is true, the parser includes source location information in the returned ast nodes. source string default: null a description of the input source; typically a filename, path, or url. this string is not meaning...
...ion"; head: [ variabledeclarator ]; body: expression; } a let expression. note: the let expression form is spidermonkey-specific. patterns interface pattern <: node { } javascript 1.7 introduced destructuring assignment and binding forms. all binding forms (such as function parameters, variable declarations, and catch block headers) accept array and object destructuring patterns in
addition to plain identifiers. the left-hand sides of assignment expressions can be arbitrary expressions, but in the case where the expression is an object or array literal, it is interpreted by spidermonkey as a destructuring pattern. since the left-hand side of an assignment can in general be any expression, in an assignment context, a pattern can be any expression. in binding positions (such as ...
Profiling SpiderMonkey
instructions 1.) get yourself an optimized libxul build of firefox, with debugger info. for the mac, you'll want to read up on profiling javascript with shark. here's a sample mozconfig: mk_
add_options moz_objdir=@topsrcdir@/ff-opt-libxul mk_
add_options moz_make_flags=-j3 ac_
add_options --enable-optimize ac_
add_options --enable-libxul ac_
add_options --enable-shark ac_
add_options --enable-debugger-info-modules ac_
add_options --enable-application=browser 2.) you'll want to run shark on both the browser and [xpcshell], since the host environments differ. here are some instrumented tests to work from: media:profiling-ammo.zip 3.) once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static bui...
...ed tests to work from: media:profiling-ammo.zip 3.) once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static builds. make -c my-obj-dir/js/src other ways to profile for linux, there are global jprof functions available. see the documentation on the --enable-jprof mozconfig option. we're working to
add support for other profilers, such as oprofile, intel vtune, and callgrind. when we have js scriptable profiling options available for all tier 1 platforms, we'll look at
adding global start/stop profiling functions. if you'd like to profile something at a higher level of detail than the js shark functions allow, there are corresponding c functions available at the bottom of jsdbgapi.h. costs of t...
SpiderMonkey 1.8.8
n 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 previously 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 no plans to keep the jsapi, nor the jsdbgapi stable for embedders. we have chosen to concentrate on performance and correctness as primary concerns instead. the team is considering th...
...rmance and correctness as primary concerns instead. the team is considering the removal of tinyids js_threadsafe is going away, with future versions supporting only thread-safe builds a new debugging api is on the way to replace jsd. release notes errata this is a list of changes which need to be made to the release notes asap. feel free to fix any problems you spot -- this is a wiki! don't
add anything here -- this is for after the release notes are completed. :-) ...
SpiderMonkey 1.8
onkey team via email, bugzilla, or irc.) alternatively, you can install mozillabuild and run the command make -f makefile.ref in the js/src directory. spidermonkey 1.8 does not include the new tracemonkey jit or the configure-based build system, both of which are (a) pretty darn awesome and (b) coming in spidermonkey 1.8.1. on to the fun stuff. new javascript language features javascript 1.8
adds array.reduce() and reduceright(), expression closures, and generator expressions. there is also one obscure non-backwards-compatible change. for details, see new in javascript 1.8. new jsapi features it has been a couple years since spidermonkey 1.7 was released, and many improvements have been made to the jsapi. however, one of the most important advances for jsapi application developers is t...
...fe-only in spidermonkey 1.7 (js_beginrequest, for example) are now present, but do nothing, in non-js_threadsafe builds. this is to help applications share and reuse code regardless of whether they use threads. there are two new jsextendedclass hooks, jsextendedclass.iteratorobject and jsextendedclass.wrappedobject. both are documented but obscure. many new memory management features have 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 ...
SpiderMonkey 17
iously 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
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 no plans to keep the jsapi, nor the jsdbgapi stable for embedders. we have chosen to concentrate on performance and correctness as primary concerns instead. the team is considering th...
...ting only thread-safe builds a new debugging api is on the way to replace jsd. in the future every api is going to take handles instead of raw pointers. exact stack rooting is requirement for a (moving) generational garbage collector. release notes errata this is a list of changes which need to be made to the release notes asap. feel free to fix any problems you spot -- this is a wiki! don't
add anything here -- this is for after the release notes are completed. :-) ...
SpiderMonkey 31
me and all the other existing spidermonkey apis as usual. once all jsapi operation has completed, the corresponding js_shutdown method uninitializes spidermonkey, cleaning up memory and allocations performed by js_init. it is not required to call js_shutdown at present, but it is strongly recommended: calling it may be required in a future spidermonkey release. javascript shell changes detail
added/removed methods here... on posix platforms, building a threadsafe shell no longer requires nspr. embedders still need to build with nspr, as the new wrappers require using spidermonkey internal functions which are not exposed to the public api. known issues detail any known issues here... future direction ...insert details on future plans... spidermonkey embedders should be aware that ...
...dders. we have chosen to concentrate on performance and correctness as primary concerns instead. js_threadsafe is going away, with future versions supporting only thread-safe builds a new debugging api is on the way to replace jsd. release notes errata this is a list of changes which need to be made to the release notes asap. feel free to fix any problems you spot -- this is a wiki! don't
add anything here -- this is for after the release notes are completed. :-) ...
Setting up CDT to work on SpiderMonkey
e instructions up until the point of invoking configure. the initial build was in clang, so the modified build commands look like this: mkdir _dbg.obj cd _dbg.obj cc='clang -qunused-arguments -fcolor-diagnostics' cxx='clang++ -qunused-arguments -fcolor-diagnostics' \ ../configure --enable-debug --disable-optimize --enable-debug-symbols note: if you want to use ccache, you can enable it by
adding --with-ccache to the arguments list. due to a bug in cdt, you have to make a small change to cdt's build configuration as explained in step 3 below for that to work, though. step 2 - installing eclipse and setting up the project the following run-down is a condensed and updated version of what is explained in much more detail for the entire mozilla codebase. luckily, improvements in cdt have...
..._dbg.obj}. under "behavior", make sure that "enable parallel build" is deactivated, as cdt’s indexer will freak out otherwise. remove "all" from "build (incremental build)". deactivate "clean" so that your builds do not take ages. if you want to use ccache: select "c/c++ general", then "preprocessor include patterns". under the "providers" group tab, select "cdt gcc build output parser" and
add the string |(ccache) to the end of the "compiler command pattern" text input. start the build by selecting "build all" from the "project" menu. start the indexer by either: selecting "index > rebuild" from the project's context menu located in the project explorer window, or selecting "c/c++ index > rebuild" from the "project" menu. and that is pretty much it: large parts of spi...
TPS History Lists
the history list used for operations other than delete has the following properties: uri: required. title: optional. the page title for this uri. visits: required. an array of objects representing visits to the page, each object has the following properties: type: required. an integer value from one of the transition types listed at https://developer.mozilla.org/en/nsinavhistoryservice#constants. date: required. an integer representing when the visit took place, expressed in hours from the present. for example, 0 is now, -24 is 24 hours in the past. ...
... all history in a certain time period, use an object with begin and end properties, which should have integer values that express time since the present in hours (see date above) for example: var history_to_delete = [ { uri: "http://www.cnn.com/" }, { begin: -24, end: -1 }, { host: "www.google.com" } ]; history lists and phase actions history lists cannot be modified, they can only be
added, deleted, and verified, using the following functions: history.
add history.delete history.verify history.verifynot ...
TPS Tab Lists
tabs.verify - verifies that the specified tabs can be found in the specified profile. tabs.verifynot - verifies that the specified tabs cannot be found in the specified profile. there are a handful of static pages at http://hg.mozilla.org/services/tps/file/tip/pages which can be used for ...
...automation/crossweave/raw-file/2d9aca9585b6/pages/page1.html", title: "crossweave test page 1", profile: "profile1" }, { uri: "data:text/html,<html><head><title>hello</title></head><body>hello</body></html>", title: "hello", profile: "profile1" } ]; tab lists and phase actions tabs cannot be modified or deleted, only
added or verified with the following functions: tabs.
add - opens the specified tabs in the browser window. tabs.verify - verifies that the specified tabs can be found in the specified profile. tabs.verifynot - verifies that the specified tabs cannot be found in the specified profile. there are a handful of static pages at http://hg.mozilla.org/services/tps/file/tip/pages which can be used for tab testing, and data: url's can be used as well. examp...
Mozinfo
not consolidated, checks are not done consistently, nor is it defined what we are checking for. mozinfo proposes to solve this problem. mozinfo is a bridge interface, making the underlying (complex) plethora of os and architecture combinations conform to a subset of values of relevance to mozilla software. the current implementation exposes relevant key, values: os, version, bits, and processor.
additionally, the service pack in use is available on the windows platform. api usage mozinfo is a python package. downloading the software and running python setup.py develop will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. the top level attribute...
...thon package. downloading the software and running python setup.py develop will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. the top level attributes (os, version, bits, processor) are available as module globals: if mozinfo.os == 'win': ... in
addition, mozinfo exports a dictionary, mozinfo.info, that contain these values. mozinfo also exports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "unknown". unknown will evaluate as false in python: if not mozinfo.os: ...
Setting up an update server
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 not exist): ac_
add_options --disable-verify-mar several files contain a line that must be uncommented. open them and find this line: #defines['disable_updater_authenticode_check'] = true. delete the # at the beginning of the line to uncomment it. these are the files that must be changed: toolkit/components/maintenanceservice/moz.build toolkit/mozapps/update/tests/moz.build firefox should otherwise ...
...rther incremental builds will not work properly, and a clobber will be needed when building next. to move the installation, first call ./mach package, then you can either copy <obj dir>/dist/firefox to a new "install directory" elsewhere, or run the installer located in the <obj dir>/dist/install/sea. if you are running windows and want the mozilla maintenance service to be used, there are a few
additional steps to be taken here. first, the maintenance service needs to be "installed". most likely, a different maintenance service is already installed, probably at c:\program files (x86)\mozilla maintenance service\maintenanceservice.exe. backup that file to another location and replace it with <obj dir>/dist/bin/maintenanceservice.exe. don't forget to restore the backup when you are done. also...
Task graph
these tasks include build and test tasks, along with lots of other kinds of tasks to build docker images, build toolchains, perform analyses, check syntax, and so on. these tasks are arranged in a "task graph", with some tasks (e.g., tests) depending on others (builds). ...
...ult of each task is sent to treeherder where developers and sheriffs can track the status of the push. the outputs from each task, log files, firefox installers, and so on, appear attached to each task when it completes. these are viewable in the task inspector. all of this is controlled from within the gecko source code, through a process called task-graph generation. this means it's easy to
add a new job or tweak the parameters of a job in a try push, eventually landing that change on an integration branch. the details of task-graph generation are documented in the source code itself, including a some quick recipes for common changes. ...
Gecko object attributes
nges within the current region or subtree should be automatically presented. possible values are "off" which is the same as not being set -- this means the region is not live. other possible values are "polite", "assertive", and "rude", which is a suggestion for the policy when interrupting the user for changes to this region. please see the aria states and properties module for more information. ...
...please see the aria states and properties module for more information. ...
XForms Accessibility
et been done, although everything should work and is ready to be tested. you will find trunk builds of firefox at ftp.mozilla.org, trunk builds of xforms extension (windows) at ftp.mozilla.org or trunk builds of xforms extension (linux) ftp.mozilla.org. build it yourself if you would like to build firefox/seamonkey yourself then please ensure your .mozconfig file has the following option: ac_
add_options --enable-extensions=default,xforms,schema-validation how to test there are two approaches to test xforms accessibility. the first is to use and assistive technology such as a screen reader, or an accessibility testing tool, to make sure xforms elements have proper accessible objects. or you may be guided by toolkit checklist to check keyboard navigation for xforms controls. you can tr...
...esented by button. select allows the user to choose one or multiple values from a list of pre-defined values (see the spec, the docs). it can have the following representations: listbox checkboxes group select1 allows the user to choose a single value from a list of pre-defined values (see the spec, the docs). it can have the following representations: combobox listbox radio group
additional elements these elements may be used as child elements to the form controls described above. some of these elements are not accessible itself but they makes accessibility properties for xforms elements that hold them. label specifies the label for the xforms control (see the spec, the docs). every form control other than the output element must contain a label element. the value of label...
Embedded Dialog API
posing gecko dialogs in embedding applications problem statement an application embedding gecko cannot tightly control its own windows and still allow gecko to be a fully functional web browser. in any single window, gecko can be expected to play nicely within its given boundaries. but it must be allowed to create
additional windows at times perhaps unexpected by the containing appliction. these new windows can be entire new browser windows opened in response to web page script, or dialogs or alerts which may arise from script or merely during normal operation of the browser. part of gecko's embedding api is callbacks into the embedding application for creating new windows. the complete windowing portion of the api is large and complex, but it need not be entirely implemented. its s...
...rder for a piece of code's dialogs to be overrideable, they can't be implemented directly in the code. all ui-related code must be implemented in a registered component so that it can be swapped out by the embedding application. nsipromptservice is the canonical example. of course this is a relatively simple example. more complex dialogs may themselves require their own interface. (examples to be
added as they come online. the print dialogs should be available soon.) dialogs posed by the embedding app ("down calls") some components will not pose dialogs directly, but maintain a database of information an embedding app may wish to display as a dialog. preferences are the canonical example. in this case, we must be sure to have an api which an embedding app can use to populate its own dialog, ...
Querying Places
ult_type_visit, and provide a session id for each visit. this session id is the same for all pages that were reached by clicking links. a new session starts when the user types a new url or follows a bookmark (xxx link to more details about what constitutes a session). results_as_full_visit: this is an extended version of result_type_visit. the results are of type result_type_full_visit and have
additional information about the visit, such as the referring visit, and how the transition happened (typed, redirect, link, etc). not yet implemented -- see bug 320831. basic query search parameters const unsigned long time_relative_epoch = 0 const unsigned long time_relative_today = 1 const unsigned long time_relative_now = 2 attribute prtime begintime attribute unsigned long begintimerefe...
...3 const unsigned short sort_by_date_descending = 4 const unsigned short sort_by_uri_ascending = 5 const unsigned short sort_by_uri_descending = 6 const unsigned short sort_by_visitcount_ascending = 7 const unsigned short sort_by_visitcount_descending = 8 const unsigned short sort_by_keyword_ascending = 9 const unsigned short sort_by_keyword_descending = 10 const unsigned short sort_by_date
added_ascending = 11 const unsigned short sort_by_date
added_descending = 12 const unsigned short sort_by_lastmodified_ascending = 13 const unsigned short sort_by_lastmodified_descending = 14 const unsigned short sort_by_annotation_ascending = 15 const unsigned short sort_by_annotation_descending = 16 const unsigned short results_as_uri = 0 const unsigned short results_as_visit = 1 const unsig...
FUEL
we want to start with areas that will provide the most benefit. fuel has a fueliapplication interface that implements all the functions of extiapplication. the library has also been implemented in thunderbird ("steel") and in seamonkey ("smile"). ...
...we want to start with areas that will provide the most benefit. fuel has a fueliapplication interface that implements all the functions of extiapplication. the library has also been implemented in thunderbird ("steel") and in seamonkey ("smile"). ...
XML Extras
ss the temporary document into send(). xmlhttprequest.open("ahost") ok file:// documents can access http:// documents but you need to enable universalbrowserread privilege in your scripts - see the javascript security: signed scripts document for more details. normally your files should reside on a webserver so this shouldn't pose a problem (there you do not need that line either).
additionally, "foo.com:80" and "foo.com:313" are considered different hosts for security purposes. you cannot open a connection to a different host. domparser creation not available new domparser() xmlserializer creation not available new xmlserializer() minimal documentation for the components listed above can be found using mozilla documentation generated by dox...
...and "foo.com:313" are considered different hosts for security purposes. you cannot open a connection to a different host. domparser creation not available new domparser() xmlserializer creation not available new xmlserializer() minimal documentation for the components listed above can be found using mozilla documentation generated by doxygen. file new bugs for
additional documentation contributions, either specifically aimed at javascript developers or to complete & clarify the javadoc-style comments in the idl files. nsidomserializer (currently, the javascript constructor is xmlserializer()) nsidomparser (currently, the javascript constructor is domparser()) nsixmlhttprequest please see the xml linking and pointing section in xml in mozilla documen...
Accessing the Windows Registry Using XPCOM
access the windows registry for information about the environment or other installed programs. to this end, there exist xpcom interfaces to read and write registry data. this article will show you how to use the available interfaces in several mozilla products. the examples in this document are all written in javascript using xpcom. support in firefox 1.5 or newer in firefox 1.5, a new api was
added, nsiwindowsregkey, which provides extensive registry functionality. the interface follows the windows api fairly closely, but with many of the low-level details taken care of for you. if you are writing an extension that only needs to support firefox 1.5 or newer, then you only need to read this section. a simple example here's a simple example showing how to read your windows productid: var...
...ode. it is specified as a bitwise combination of flags defined on the interface. you can read the interface documentation for a full explanation, but we will show only the three most commonly used modes here: access_read — for reading values, enumerating keys, and receiving notifications access_write — for setting values and creating sub keys access_all — access for all operations in
addition to open() and create(), there are the openchild() and createchild() methods. you can call these methods on an already-opened registry key to open a child key. both methods take a relative path and access mode as parameters and return a new object implementing nsiwindowsregkey. here's the simple example again, but using openchild(): var wrk = components.classes["@mozilla.org/windows-registry...
Aggregating the In-Memory Datasource
nscomptr<nsisupports>: class myclass : public nsimyinterface { ... private: nscomptr<nsisupports> minner; }; construct the datasource delegate when your object is constructed (or, at worst, when somebody qi's for it): rv = nscomponentmanager::createinstance( krdfinmemorydatasourcecid, this, /* the "outer" */ nscomtypeinfo<nsisupports>::getiid(), getter_
addrefs(minner)); note passing this as the "outer" parameter. now, if the in-memory datasource's implementation of queryinterface() fails because it doesn't support the requested interface, it willforward the query interface to its "outer" (which is "us"). this preserves the symmetrical property of queryinterface(). for us to preserve symmetry, our queryinterface() implementation needs to forward...
...for example: ns_imethodimp myclass::dosomething() { nscomptr<nsirdfdatasopurce> ds = do_queryinterface(minner); ...
Generic factory
create); } return factory; } this example assumes that the xpcom repository is available as an interface (which it soon will be). background (this is based on my original news posting <beard-2402991733140001@h-198-93-95-151.mcom.com>.) we seem to be creating a huge number of different factory implementations. it seems to me that we can cut down on code size (all those queryinterface,
addref, release implementations) if we just use the following class for all of the simple factories: // idea: why not create a generic factory facility so we can avoid // duplication of so much nsifactory code? all we need is an allocator // function, the rest of the implementation is exactly the same. #include "nsifactory.h" class nsgenericfactory : public nsifactory { public: typedef n...
... original document information author: patrick beard last updated date: february 26, 1999 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under...
Preface
d use xpcom is to download the gecko sdk, which is a collection of libraries and tools that features the xpcom component framework. whether you compile your code in the mozilla source tree or use the gecko sdk, you can build your own components which leverage components that already exist in gecko. the weblock component we describe in this tutorial is a practical (and, we hope, genuinely useful)
addition to the browser. in order to build it, your gecko sdk or mozilla source tree needs to be version 1.2 or later (xpcom interfaces were not fully frozen in prior releases). this book assumes you are using the sdk rather than compiling in a mozilla source tree, though the difference between these two approaches is minimal. details about downloading the sdk, building, and getting programmatic acc...
...asier to scan. the goal is to use as few formats as possible, but to distinguish the various different types of information clearly. format description bold component names appear in bold in the text monospace code listings, interface names and members of interfaces (e.g., createinstance()) appear in monospaced font. lines of code are placed in separate boxes.
additionally, filenames and directories appear in monospaced font. italic variables appear in italic. important terms and new concepts are also italicized the first 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 ...
XPCOM Stream Guide
ing stream. nsbinaryoutputstream @mozilla.org/binaryoutputstream;1 nsiobjectoutputstream (inherits from nsibinaryoutputstream) converter write to an underlying stream with automatic conversion of unicode characters. nsconverteroutputstream @mozilla.org/intl/converter-output-stream;1 nsiconverteroutputstream .init(stream, charset, buffersize, replacechar)
additional stream interfaces the nsilineinputstream interface supports a .readline() method for reading a single line from an input stream. the nsfileinputstream and nspartialfileinputstream classes implement this interface. (xxx nsiunicharinputstream interface) (xxx nsiunicharlineinputstream interface) (xxx nsisearchableinputstream interface) stream converters (tbd: @mozilla.org/streamconve...
...ed the zipreader anymore zipreader.close(); for writing from an input stream to a zip archive, see the nsizipwriter interface: // file is an nsifile object mapping to a zip archive var zipwriter = components.classes["@mozilla.org/zipwriter;1"] .createinstance(components.interfaces.nsizipwriter); zipwriter.open(file, ioflags); // stream is the output stream zipwriter.
addentrystream("/path/to/zipped/file", modtime, compression, stream, queueforlater); // if queued for later operations, and all operations are queued zipwriter.processqueue(); // when we don't need the zipwriter anymore zipwriter.close(); concatenating input streams var stringstream = components.constructor("@mozilla.org/io/string-input-stream;1", "nsi...
Components.utils.createObjectIn
at this function is now mostly obsolete when you are using sandbox, because you can create an object in a different compartment using new. for example, to create a new object in the compartment identified by contentwindow: var newobject = new contentwindow.object(); but it is really needeed from firefox 30 onwards when trying to manipulate the dom window. see details in https://blog.mozilla.org/
addons/2014/04/10/changes-to-unsafewindow-for-the-
add-on-sdk/. syntax var newobject = components.utils.createobjectin(obj, options); parameters obj an object indicating the compartment in which the new object should be created; the new object will be created in the scope of this object's compartment. options an object containing a single option defineas, which determines the name of the ob...
... to create an object with a specified name, use defineas: var foo = components.utils.createobjectin(mywindow, {defineas: "foo"}); now the target compartment's window has a new global object named foo. ...
Components.utils.import
import was introduced in firefox 3 and is used for sharing code between different scopes easily. for example, you can import xpcomutils.jsm to avoid copy/pasting long xpcom component registration boilerplate in your component files. see using javascript code modules for more details. note: prior to gecko 2.0, javascript code modules could only be loaded using file: or resource: urls. gecko 2.0
adds support for loading modules from chrome: urls, even those inside jar archives. syntax components.utils.import(url [, scope]); // or, if you use a tool such as jslint which reports compiler errors for the above, components.utils["import"](url [, scope]); parameters url a string of the url of the script to be loaded. the url must point to a file on the disk, possibly in a jar. scope an...
...omponents.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript(someurl, obj1); loader.loadsubscript(someurl, obj2); assert(obj2 === obj1); ...returns false. this means components.utils.import is better suited for efficient sharing of code (and data?) between js scripts running in different scope.
additional resources components.utils bug 238324 the documentation in xpccomponents.idl the tests in js/xpconnect/tests/unit/ importing sdk/commonjs modules into other code ...
Components.utils.unload
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. if the javascript code module has not yet been imported then this method will do nothing. ...
...use by other extensions and the application. only unload modules you include as part of your extension. syntax components.utils.unload( url ); parameters url the "resource://" url of the script to unload. this must be the same url that was used to load the script. example you can unload a module called mymodule.jsm using the following line of code: components.utils.unload("resource://my
addon/modules/mymodule.jsm"); note: currently components.utils.unload clears the global object of an unloaded module. this may cause modules to misbehave after unloading even if you have a reference to them. see bug 769253 see also bug 481603 the documentation in xpccomponents.idl the tests in js/xpconnect/tests/unit/ ...
Components.utils.unwaiveXrays
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. ...
...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. syntax xray = components.utils.unwaivexrays(obj); parameters obj the object for which we wish to restore xrays. returns the object with xrays restored. example suppose a page script
adds an expando to its global window: // page script foo = "i'm an expando"; by default, chrome code won't see foo, because it sees the content window with xray vision, but the chrome code can waive xray protection. the chrome code can then use unwaivexrays to restore xray protection: // chrome code // contentwindow is an xray var isxray = components.utils.isxraywrapper(gbrowser.contentwindow); /...
Monitoring HTTP activity
case nsihttpactivityobserver.activity_subtype_response_header: // received response header break; case nsihttpactivityobserver.activity_subtype_response_complete: // received complete http response break; } } } }; then you need to install your activity observer. ...
...eak; } } } }; then you need to install your activity observer. this is done using the nsihttpactivitydistributor.
addobserver() method in nsihttpactivitydistributor: var activitydistributor = components.classes["@mozilla.org/network/http-activity-distributor;1"] .getservice(components.interfaces.nsihttpactivitydistributor); activitydistributor.
addobserver(httpobserver); observable activities there are two classes of observable activities: those that occur at the socket level and those that occur at the http transaction level. observable socket activities when the activity type reported to your nsihttpactivityobserver.observeactivity() method is activity_type_socket_transport, the activity subtype, which indicates the specific type of acti...
nsDirectoryService
erefore be accessed via the xpcom service manager. example code #include "nsxpcom.h" #include "nscomptr.h" #include "nsdirectoryservicedefs.h" #include "nsiservicemanager.h" #include "nsiproperties.h" /** * get the location of the system's "temp" directory. ...
...ttempdir(nsifile **aresult) { nsresult rv; nscomptr<nsiservicemanager> svcmgr; rv = ns_getservicemanager(getter_
addrefs(svcmgr)); if (ns_failed(rv)) return rv; nscomptr<nsiproperties> directory; rv = svcmgr->getservicebycontractid("@mozilla.org/file/directory_service;1", ns_get_iid(nsiproperties), getter_
addrefs(directory)); if (ns_failed(rv)) return rv; rv = directory->get(ns_os_temp_dir, ns_get_iid(nsifile), aresult); return rv; } note that ns_os_temp_dir is defined in nsdirectoryservicedefs.h along with a number of other directory service keys. see also using nsidirectoryservice nsiproperties.get() nsidirectoryserviceprovider ...
NS_ConvertASCIItoUTF16
urce buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const prunichar**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
NS_ConvertUTF16toUTF8
- source buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const char**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
NS_ConvertUTF8toUTF16
urce buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const prunichar**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
NS_LossyConvertUTF16toASCII
- source buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const char**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
nsACString_internal
- source buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const char**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
nsAString_internal
urce buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const prunichar**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
nsAdoptingCString
- source buffer sizing parameters pruint32 newcapacity setlength void setlength(pruint32) - source parameters pruint32 newlength truncate void truncate(pruint32) - source parameters pruint32 newlength getdata pruint32 getdata(const char**) const - source get a const pointer to the string's internal buffer. ...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. if true, the string will be truncated. ...
XPCOM glue classes
declarationnspromiseflatstringclass declarationnsrefptrrefptr (formerly known as nsrefptr, see bug 1207245) is a general class to implement reference counting pointers for objects. it is similar to nscomptr, but does not require that the type be an xpcom interface. like with nscomptr, it is the responsibility of the object itself to implement reference counting. ...
...o implement reference counting. ...
inIDOMUtils
nidomutils.idlscriptable dom utility functions. ...
...lement aelement, in nsidomcssstylerule arule, in unsigned long aselectorindex, in domstring apseudo optional ) parameters aelement the element to check the selector against. arule the style rule containing the selector. aselectorindex the index of the selector. apseudo optional a string specifying the pseudo-element to match. may be omitted when checking the regular elements.
addpseudoclasslock() makes the element take on style properties that would apply if the element had the given pseudo-classes. void
addpseudoclasslock( in nsidomelement aelement, in domstring apseudoclass ); parameters aelement the element to set the pseudo-class lock on. apseudoclass the pseudo-class to set. e.g. ":hover". removepseudoclasslock() removes a pseudo-class lock from the ...
mozIVisitInfoCallback
oziplaceinfo aplaceinfo);obsolete since gecko 8.0 methods handleerror() called when a moziplaceinfo couldn't be processed. void handleerror( in nsresult aresultcode, in moziplaceinfo aplaceinfo ); parameters aresultcode nsresult indicating the reason why the change failed. aplaceinfo the information that was unable to be processed. handleresult() called for each visit
added, title change, or guid change when passed to moziasynchistory.updateplaces(). if more than one operation is done for a given visit, this method is only called once (for all changes at once). void handleresult( in moziplaceinfo aplaceinfo ); parameters aplaceinfo the information that was entered into the database. oncomplete() obsolete since gecko 8.0 (firefox 8.0 ...
...pdateplaces(). if more than one operation is done for a given visit, this method is only called once (for all changes at once). void handleresult( in moziplaceinfo aplaceinfo ); parameters aplaceinfo the information that was entered into the database. oncomplete() obsolete since gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) called for each visit
added, title change, or guid change when passed to moziasynchistory.updateplaces(). void oncomplete( in nsresult aresultcode, in moziplaceinfo aplaceinfo ); parameters aresultcode nsresult of the change indicating success or failure reason. aplaceinfo the information that was being entered into the database. notes this method was replaced by the separate handleresult() and hand...
nsIAccessibilityService
accessible/public/nsiaccessibilityservice.idlscriptable please
add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsiaccessibleretrieval method overview nsiaccessible createouterdocaccessible(in nsidomnode anode); nsiaccessible createrootaccessible(in nsipresshell ashell, in nsidocument adocument); nsiaccessible createhtml4buttonaccessible(in nsisupports aframe); nsiaccessible createhypertextaccessible(in nsisupports aframe); nsiaccessible createhtmlbraccessible(in nsisupports aframe); nsiaccessible createhtmlbuttonaccessible(in nsisupports aframe); nsiaccessible createhtmlaccessiblebymarkup(in nsiframe aframe, in nsiweakreference aweakshell, in nsidomnode adomnode); nsiaccessible ...
...ode adomnode); nsiaccessible createhtmltextaccessible(in nsisupports aframe); nsiaccessible createhtmltextfieldaccessible(in nsisupports aframe); nsiaccessible createhtmlcaptionaccessible(in nsisupports aframe); nsiaccessible getaccessible(in nsidomnode anode, in nsipresshell apresshell, in nsiweakreference aweakshell, inout nsiframe framehint, out boolean aishidden); nsiaccessible
addnativerootaccessible(in voidptr aatkaccessible); void removenativerootaccessible(in nsiaccessible arootaccessible); void invalidatesubtreefor(in nsipresshell apresshell, in nsicontent achangedcontent, in pruint32 aevent); methods removenativerootaccessible() void removenativerootaccessible( in nsiaccessible arootaccessible ); invalidatesubtreefor() invalidate the accessibilit...
nsIAccessibleEvent
change 0x000e 0x000b an object's help has changed. event_defaction_change 0x000f 0x000c an object's default action has changed. event_action_change 0x0010 0x000d an object's action has changed. event_accelerator_change 0x0011 0x000e an object's keyboard shortcut has changed. event_selection 0x8006 0x0012 0x000f the selection within a container object has changed. event_selection_
add 0x8007 0x0013 0x0010 an item within a container object has been
added to the selection. event_selection_remove 0x8008 0x0014 0x0011 an item within a container object has been removed from the selection. event_selection_within 0x8009 0x0015 0x0012 numerous selection changes have occurred within a container object. event_alert 0x0002 0x0016 0x0013 an alert has been generated. server applicati...
...document_load_start 0x002a event_internal_load 0x005b used internally in gecko. example to listen to in-process accessibility invents, make your object an nsiobserver, and listen for accessible-event by using code something like this: nscomptr<nsiobserverservice> observerservice = do_getservice("@mozilla.org/observer-service;1", &rv); if (ns_succeeded(rv)) { rv = observerservice->
addobserver(this, "accessible-event", pr_true); } ...
nsIAccessibleSelectable
accessible/public/nsiaccessibleselectable.idlscriptable an interface for the accessibility module and in-process accessibility clients for dealing with getting and changing the selection of accessible nodes. ...
...lection(); nsiarray getselectedchildren(); boolean ischildselected(in long index); nsiaccessible refselection(in long index); void removechildfromselection(in long index); boolean selectallselection(); attributes attribute type description selectioncount long the number of accessible children currently selected. read only. constants constant value description eselection_
add 0 eselection_remove 1 eselection_getstate 2 methods
addchildtoselection()
adds the specified accessible child of the object to the object's selection. if the specified object is already selected, then it does nothing. void
addchildtoselection( in long index ); parameters index the zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is n...
nsIBinaryInputStream
pruint8 read8(); parameters none. return value an 8-bit integer read from the stream. read16() reads from the stream. pruint16 read16(); parameters none. return value a 16-bit integer read from the stream. r...
...eters alength the number of bytes to read. astring a string containing the bytes read from the stream. exceptions thrown ns_error_failure if it can't read alength bytes. readcstring() reads an 8-bit pascal style string from the stream. 32-bit length field, followed by length 8-bit chars. acstring readcstring(); parameters none. return value the string read from the stream. re
addouble() reads from the stream. double re
addouble(); parameters none. return value a double read from the stream. readfloat() reads from the stream. float readfloat(); parameters none. return value a float read from the stream. readstring() reads an 16-bit pascal style string from the stream. 32-bit length field, followed by length prunichars. astring readstring(); parameters n...
nsIBlocklistPrompt
face is used, if available, by the default implementation of nsiblocklistservice to display a confirmation user interface to the user before blocking extensions or plugins. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void prompt([array, size_is(acount)] in nsivariant a
addons, [optional] in pruint32 acount); methods prompt() prompt the user about newly blocked
addons. the prompt is then responsible for soft-blocking any
addons that need to be afterwards. void prompt( [array, size_is(acount)] in nsivariant a
addons, in pruint32 acount optional ); parameters a
addons an array of
addons and plugins that are blocked. these are javascript objects with ...
... a
addons, in pruint32 acount optional ); parameters a
addons an array of
addons and plugins that are blocked. these are javascript objects with properties: name - the plugin or extension name version - the version of the extension or plugin icon - the plugin or extension icon disable - can be used by the nsiblocklistprompt to allows users to decide whether a soft-blocked
add-on should be disabled blocked - true if the item is hard-blocked, false otherwise item - the nsiplugintag or
addon object acount optional the number of
addons. ...
nsICachingChannel
inherits from: nsicacheinfochannel last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface provides: support for "stream as file" semantics (for jar and plugins). support for "pinning" cached data in the cache (for printing and save-as). support for uniquely identifying cached data in cases when the url is insufficient. for example a http form submission. a channel may optionally implement this interface to allow clients to affect its behavior with respect to how it uses the cache service. ...
...efault value of this attribute depends on the particular implementation of nsicachingchannel. cachefile nsifile get the "file" where the cached data can be found. this is valid for as long as a reference to the cache token is held. this may return an error if cacheasfile is false. read 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 prevent the cached data from being removed. a cache key retrieved from a particular instance of nsicachingchannel co...
nsIConsoleService
gisters a listener, to notify when an error is logged. note: to guard against stack overflows from listeners which could log messages (this could be done inadvertently through listeners implemented in javascript), we do not call any listeners when another error is already being logged. void registerlistener( in nsiconsolelistener listener ); parameters listener the nsiconsolelistener to
add. reset() to clear the message buffer (for example, for privacy reasons): void reset(); parameters none. note: console listeners expect you to log an empty string message before calling reset, so they too can clear their message buffers. (this also works before gecko 19.) unregisterlistener() deregisters a listener. void unregisterlistener( in nsiconsolelistener listener ); paramete...
...ple message a common usage is logging a message string to the console: function log(msg) { var consoleservice = components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice); consoleservice.logstringmessage(msg); } alternative logging methods include components.utils.reporterror and dump(). logging a message with
additional information to include other information an nsiconsolemessage object must be used. in this example nsiscripterror, which implements nsiconsolemessage, is used to include information about the source file and line number of the error. function mylogtoconsole(amessage, asourcename, asourceline, alinenumber, acolumnnumber, aflags, acategory) { var consoleservice = ...
nsIControllers
exceptions thrown ns_error_out_of_memory getcontrollerat() returns the controller instance at the given position. nsicontroller getcontrollerat( in unsigned long index ); parameters index the position of the wanted contro...
... void removecontroller(in nsicontroller controller); nsicontroller removecontrollerat(in unsigned long index); attributes attribute type description commanddispatcher nsidomxulcommanddispatcher obsolete since gecko 1.9 methods appendcontroller()
adds a controller to the end of the list. void appendcontroller( in nsicontroller controller ); parameters controller a controller to be
added to the list of controllers. exceptions thrown ns_error_out_of_memory getcontrollerat() returns the controller instance at the given position. nsicontroller getcontrollerat( in unsigned long index ); parameters index the position of the wanted controller. return value the controller at the given position. exceptions thrown ns_error_failure the given index is out of range. getcontroller...
nsICookieManager
last changed in gecko 1.7 inherits from: nsisupports this interface is intended to be used as a service. ...
..., and path. if the cookie cannot be found, no exception is thrown. typically, the arguments to this method will be obtained directly from the desired nsicookie object. void remove( in autf8string ahost, in acstring aname, in autf8string apath, in boolean ablocked, in jsval aoriginattributes ); parameters ahost the host or domain for which the cookie was set. see nsicookiemanager2.
add() for a description of acceptable host strings. if the target cookie is a domain cookie, a leading dot must be present. aname the name specified in the cookie. apath the path for which the cookie was set. ablocked indicates if cookies from this host should be permanently blocked. aoriginattributes the originattributes of this cookie. removeall() this method is called to remove all cook...
nsICrashReporter
ed. only https and http urls are allowed, as the submission is handled by os-native networking libraries. exceptions thrown ns_error_failure on get if no url is set. ns_error_invalid_arg on set if a non-http(s) url is assigned. ns_error_not_initialized if crash reporting is not initialized. submitreports boolean user preference for submitting crash reports. methods annotatecrashreport()
add some extra data to be submitted with a crash report. void annotatecrashreport( in acstring key, in acstring data ); parameters key name of the data to be
added. data data to be
added. exceptions thrown ns_error_invalid_arg if key or data contain invalid characters. invalid characters for key are '=' and '\n'. invalid character for data is '\0'. ns_error_not_initialized if crash reporting ...
...d characters for key are '=' and '\n'. invalid character for data is '\0'. ns_error_not_initialized if crash reporting not initialized. appendappnotestocrashreport() append some data to the "notes" field, to be submitted with a crash report. unlike annotatecrashreport(), this method will append to existing data. void appendappnotestocrashreport( in acstring data ); parameters data data to be
added. exceptions thrown ns_error_invalid_arg if data contains invalid characters. the only invalid character is '\0'. ns_error_not_initialized if crash reporting not initialized. native code only!appendobjcexceptioninfotoappnotes append note containing an obj-c exception's info. void appendobjcexceptioninfotoappnotes( in voidptr aexception ); parameters aexception nsexception object to appen...
nsIDOMHTMLSourceElement
the value must be a valid url. ...
...the value must be a valid url. this attribute must be present. note that dynamically manipulating this value after the page has loaded has no effect on the containing element; instead, change the src attribute of that element (audio or video) instead. ...
nsIDOMStorage
torage object stores an arbitrary set of key-value pairs, which may be retrieved, modified and removed as needed. a key may only exist once within a storage object, and only one value may be associated with a particular key. keys are stored in a particular order with the condition that this order not change by merely changing the value associated with a key, but the order may change when a key is
added or removed. method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the number of keys stored in the session store. read only. methods clear() clear the content of this storage bo...
...ntaining the requested key. exceptions thrown index_size_err there is no key at the specified index. removeitem() given a key, removes the corresponding entry from the session store. void removeitem( in domstring key ); parameters key the key for which data should be removed from storage. setitem() sets the value corresponding to a given key. if the key does not already exist, a new key is
added, associated with the specified value. if the key already exists, the existing value is replaced with the specified value. void setitem( in domstring key, in domstring data ); parameters key the key for which data should be set. data the data to associate with the specified key. see also dom storage structured client-side storage (html 5 specification) nsidomstorageitem ...
nsIDOMStorage2
the nsidomstorage2 interface represents the storage space used for local storage in the dom. items stored in local storage may only be accessed by the same origin that created the items in the first place. a dom window's local storage object can be retrieved from the window's localstorage attribute. dom/public/idl/storage/nsidomstorage2.idlscriptable please
add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the number of keys stored ...
...ing containing the requested key. exceptions thrown index_size_errthere is no key at the specified index. removeitem() given a key, removes the corresponding entry from local storage. void removeitem( in domstring key ); parameters key the key for which data should be removed from storage. setitem() sets the value corresponding to a given key. if the key does not already exist, a new key is
added, associated with the specified value. if the key already exists, the existing value is replaced with the specified value. void setitem( in domstring key, in domstring data ); parameters key the key for which data should be set. data the data to associate with the specified key. ...
nsIDOMXULElement
element's align attribute. allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false. removes the attribute if you set it to false. boxobject nsiboxobject read only. gets or creates a box object for the element; browser, editor, iframe, listbox, menu, menupopup, scrollbox, tooltip and tree elements receive specialized box objects allowing access to
additional properties not normally available from script. builder nsixultemplatebuilder read only. retrives the element's template builder, if it has a template. classname domstring gets/sets the value of the element's class attribute. collapsed boolean true if the element's collapsed attribute is the string "true", otherwise false. removes the attribute if you set it to false. contextmenu do...
...as a template. classname domstring gets/sets the value of the element's class attribute. collapsed boolean true if the element's collapsed attribute is the string "true", otherwise false. removes the attribute if you set it to false. contextmenu domstring gets/sets the value of the element's contextmenu attribute. controllers nsicontrollers read only. returns an nsicontrollers object that
additional controllers may be appended to so as to provide focus-specific actions for commands. database nsirdfcompositedatasource read only. returns the template builder's database, if it is an rdf template. datasources domstring gets/sets the value of the element's datasources attribute. dir domstring gets/sets the value of the element's dir attribute. flex domstring gets/sets the value of ...
nsIDownloadProgressListener
/toolkit/components/downloads/nsidownloadprogresslistener.idlscriptable this interface gives applications and extensions a way to monitor the status of downloads being processed by the download manager. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) to use simply implement this interface in your code, then call nsidownloadmanager.
addlistener() to start listening. when you no longer need to listen to the download manager's state, call nsidownloadmanager.removelistener() to stop listening. as the states of downloads change, the methods described here are called by the download manager so your code can take whatever steps it needs to. this interface works very similarly to the nsiwebprogress interface. it is important to note...
...t be null. astatus the new state information for the download. see nsiwebprogresslistener.onstatechange() for details. amessage a user-readable status message intended to be displayed visibly on the screen. adownload the download whose status changed. example var dm = components.classes["@mozilla.org/download-manager;1"] .getservice(components.interfaces.nsidownloadmanager); dm.
addlistener({ onsecuritychange : function(prog, req, state, dl) { }, onprogresschange : function(prog, req, prog, progmax, tprog, tprogmax, dl) { }, onstatechange : function(prog, req, flags, status, dl) { }, ondownloadstatechange : function(state, dl) { } }); even if you do not want to use some of the listeners, you must include all of them. an exception will be thrown if one of them is mi...
nsIDragService
the only exception is getcurrentsession(), since there's currently no way to check for a drag in progress using standard dom methods or properties. ...
...the only exception is getcurrentsession(), since there's currently no way to check for a drag in progress using standard dom methods or properties. ...
nsIDynamicContainer
services that want to provide containers for temporary contents. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) the service can fill result nodes directly into the container when it is opened. it can use the property bag on every result node to store data associated with each item, such as a full path on disk. it can also create
additional containers for each container, registered to its service. method overview void oncontainermoved(in long long aitemid, in long long anewparent, in long anewindex); void oncontainernodeclosed(in nsinavhistorycontainerresultnode acontainer); void oncontainernodeopening(in nsinavhistorycontainerresultnode acontainer, in nsinavhistoryqueryoptions aoptions); void oncontainerremoving(in ...
...store state. void oncontainernodeopening( in nsinavhistorycontainerresultnode acontainer, in nsinavhistoryqueryoptions aoptions ); parameters acontainer the container node for the container being opened. aoptions the options used to generate this query. containers should follow these when possible, for example, whether to expand queries, etc. implementations should use this when possible if
adding query and folder nodes to the container. do not modify this value. oncontainerremoving() this method is called when the given container is about to be deleted from the bookmarks table, so that the service can do any necessary cleanup. it is called before the container is deleted, so that the service can still reference it. void oncontainerremoving( in long long aitemid ); parameters aitem...
nsIFilePicker
this attribute has no effect if private browsing mode is in effect. defaultextension astring the extension for the type of files you want to work with. on some platforms, this i...
...this attribute has no effect if private browsing mode is in effect. defaultextension astring the extension for the type of files you want to work with. on some platforms, this is automatically appended to filenames the user enter...
nsIFormHistory2
user has submitted. so, several values may exist for a single name. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: this interface provides no means to access stored values. stored values are used by the formfillcontroller to generate autocomplete matches. ...
...long abegintime, in long long aendtime); void removeentriesforname(in astring name); void removeentry(in astring name, in astring value); attributes attribute type description dbconnection mozistorageconnection returns the underlying db connection the form history module is using. read only. hasentries boolean returns true if the form history has any entries. read only. methods
addentry()
adds a name and value pair to the form history. void
addentry( in astring name, in astring value ); parameters name value entryexists() gets whether a name and value pair exists in the form history. boolean entryexists( in astring name, in astring value ); parameters name value return value nameexists() returns true if there is no entry that is paired with a name. boolea...
nsIHttpChannel
f the new channel supports nsihttpchannel, then it will be assigned a value to its redirectionlimit attribute one less than the value of the redirected channel's redirectionlimit attribute. the initial value for this attribute may be a configurable preference (depending on the implementation). referrer nsiuri get or set the uri of the http referer: header. this is the
address (uri) of the resource from which this channel's uri was obtained (see rfc2616 section 14.36). this attribute may only be set before the channel is opened. note: the channel may silently refuse to set the referer: header if the uri does not pass certain security checks (e.g., a "https://" url will never be sent as the referrer for a plaintext http request). the implementation is...
...ned long areferrerpolicy ); parameters areferrer the uri to base the referrer on. areferrerpolicy the referrer policy to use when determining the referrer to use. exceptions thrown ns_error_failure if called during visitrequestheaders(). setrequestheader() this method is called to set the value of a particular request header. this method allows, for example, the cookies module to
add "cookie" headers to the outgoing http request. this method may only be called before the channel is opened. if avalue is empty and amerge is false, the header will be cleared. void setrequestheader( in acstring aheader, in acstring avalue, in boolean amerge ); parameters aheader the case-insensitive name of the request header to query (for example "cookie"). avalue the request head...
nsIHttpChannelInternal
if and only if the channel has been canceled. read only. channelisfordownload boolean external handlers may set this to true to notify the channel that it is open on behalf of a download. documenturi nsiuri an http channel can own a reference to the document uri. forceallowthirdpartycookie boolean force relevant cookies to be sent with this load even if normally they would not be. local
address autf8string the local ip
address to which the channel is bound, in the same format produced by pr_net
addrtostring(). this may be either an ipv4 or ipv6
address. note: if network
address translation (nat) is in effect, this may not be the same
address the remote host thinks it is talking to. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't be...
... the local port number to which the channel is bound. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. proxyinfo nsiproxyinfo get the proxy info in use by the channel. read only. obsolete since gecko 1.9 remote
address autf8string the ip
address of the remote host to which this channel is bound, in the same format produced by pr_net
addrtostring(). this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. remoteport print32 the remo...
nsIInputStream
order to satisfy a call to close(), available(), read(), or readsegments(). a non-blocking input stream, on the other hand, must not block the calling thread of execution. note: blocking input streams are often read on a background thread to avoid locking up the main application thread. for this reason, it is generally the case that a blocking input stream should be implemented using thread-safe
addref and release. method overview unsigned long available();deprecated since gecko 17.0 unsigned long long available(); void close(); boolean isnonblocking(); unsigned long read(in charptr abuf, in unsigned long acount); native code only! unsigned long readsegments(in nswritesegmentfun awriter, in voidptr aclosure, in unsigned long acount); na...
... unsigned long long available(); void close(); boolean isnonblocking(); unsigned long read(in charptr abuf, in unsigned long acount); native code only! unsigned long readsegments(in nswritesegmentfun awriter, in voidptr aclosure, in unsigned long acount); native code only! methods available() determine number of bytes available in the stream. in
addition to the number of bytes available in the stream, this method also informs the caller of the current status of the stream. a stream that is closed will throw an exception when this method is called. that enables the caller to know the condition of the stream before attempting to read from it. if a stream is at end-of-file, but not closed, then this method returns 0 bytes available. note: som...
nsIInstallLocation
sisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) note: while this api still works, firefox 4 no longer extracts xpis by default, so this will now point to the xpi file instead of to the directory. any nsifile operations that assume a directory and plain files will fail in firefox 4, unless you specify <em:unpack>. ...
...rectory. any nsifile operations that assume a directory and plain files will fail in firefox 4, unless you specify <em:unpack>. ...
nsILocalFile
66 introduced gecko 1.0 deprecated gecko 14 inherits from: nsifile last changed in gecko 1.0 implemented by: @mozilla.org/file/local;1. ...
...ters none. native code only! load returns the result of pr_loadlibrary() on the file. the caller is responsible for calling pr_unloadlibrary() on the result. prlibrarystar load(); parameters none. return value a pointer to a prlibrary. example #include "prlink.h" #include "nserror.h" #include "nsilocalfile.h" // load the dll corresponding to the given nsilocalfile... nsresult lo
addll(nsilocalfile *alocalfile) { prlibrary *dll; nsresult rv = alocalfile->load(&dll); if (ns_failed(rv)) return rv; // do something with the library now that it is open... pr_freelibrary(dll); return ns_ok; } native code only! openansifiledesc returns the result of fopen() on the file. the caller is responsible for calling fclose() on the result. file openansifiledesc( ...
nsILoginManagerStorage
stem, implementing and registering a storage module for the login manager is how you do it. see creating a login manager storage module for details. note: extensions that simply want to access/store logins should use the login manager service and nsiloginmanager interface instead. the login manager will handle selecting and using the correct nsiloginmanangerstorage module. ...
...emovealllogins(); void removelogin(in nsilogininfo alogin); void searchlogins(out unsigned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); attributes attribute type description uibusy boolean true when a master password prompt is being shown. read only. methods
addlogin() called by the login manager to store a new login. gecko 1.9.1 note default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them. void
addlogin( in nsilogininfo alogin ); parameters alogin the login to
add to the login storage. countlogins() implement this method to return the number of logins matching the specified criteri...
nsIMemory
he 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 previously 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 minimization will occur immediately if the call was made on the main thread. if false, the flush w...
...atch for the low memory notifications "memory-pressure" notifications instead. boolean islowmemory(); parameters none. return value true if we are in a low-memory situation. otherwise false. note: from gecko 2.0 always returns false. see bug 592308. realloc() reallocates a block of memory to a new size. voidptr realloc( in voidptr ptr, in size_t newsize ); parameters ptr the
address of the memory block to reallocate. this may be null, in which case realloc behaves like alloc(). newsize specifies the new size in bytes of the block of memory to allocate. this may be 0, in which case realloc behaves like alloc(). return value null if the memory allocation fails. otherwise, it returns a pointer to the newly allocated memory segment. the result must be freed with a call ...
nsIMemoryMultiReporter
print64 the sum of all of this multi-reporter's measurements that have a path that starts with "explicit" and are of the kind kind_nonheap. note: this is a hack that makes nsimemoryreportermanager.explicit more efficient. this is important; multi-reporters can special-case this operation so it's much faster than gathering all the reports, filtering out the unneeded ones, and
adding up the rest. method overview void collectreports(in nsimemorymultireportercallback callback, in nsisupports closure); methods collectreports() void collectreports( in nsimemorymultireportercallback callback, in nsisupports closure ); parameters callback the nsimemorymultireportercallback to call when collection is complete. closure an object conta...
... rest. method overview void collectreports(in nsimemorymultireportercallback callback, in nsisupports closure); methods collectreports() void collectreports( in nsimemorymultireportercallback callback, in nsisupports closure ); parameters callback the nsimemorymultireportercallback to call when collection is complete. closure an object containing any
additional data your callback might need; this gets passed to the callback. you can specify null if your callback doesn't require any
additional data. see also nsimemorymultireportercallback nsimemoryreportermanager nsimemoryreporter ...
nsIMessageWakeupService
for android, but was not provided on desktop until gecko 13.0 (firefox 13). there is no idl for this interface. the parentprocessmessagemanager is used for this, so messages send from childprocessmessagemanagers will be heard. requesting wakeups to request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. ...
...ssages send from childprocessmessagemanagers will be heard. requesting wakeups to request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. the easiest way to do this is to
add the appropriate entry to the chrome manifest that registers your component (see category in "chrome registration"). to indicate a wakeup request in a manifest file,
add a line that looks something like this: category wakeup-request nscomponent @mozilla.org/myservice;1,nsimyinterface,getservice,mymessage1,mymessage2[,..] the category entry value consists of a comma separate string that contains: the contract id for your component (e.g. "@mozilla.org/myservice;1"). the string name of interface to instantiate the component as (e.g. "nsimyinterface"). the met...
nsIMessenger
the nsidocshell will be used for future nsimessenger operations. if there is no messagepane element, then the root xul nsidocshell will be used (so that openurl() will still work). if null is passed in then observers are removed in preparation for shutdown. amsgwindow the nsimsgwindow with the transation manager to be used. openurl() opens a url in the current window (set by setwindow()) and
adds it to the current history. void openurl(in acstring aurl); parameters aurl the url to open. loadurl() load a custom message by url. similar to openurl() except can be used to load things that appear as messages to users (e.g load an attachment as a email). void loadurl(in nsidomwindow awin, in acstring aurl); parameters awin a window. as far as i can tell this is...
...imsgdbhdr msghdrfromuri(in acstring auri); getmsguriatnavigatepos() gets the message a particular position in the navigation history. for example, back-forward history needs a list of visited messages, and where it is in the list. unfortunately, you must call this before navigating to a position, because calling this has the side effect of making us adjust our current history position, and not
adding the loaded message to the history queue. acstring getmsguriatnavigatepos(in long apos); parameters apos the position to get the url from relative to the current history cursor. +1 is forward, -1 is back. return value the url at that point in the history. getfolderuriatnavigatepos() gets the folder url at a particular position in the navigation history. acstring getfolderuriat...
nsIMicrosummarySet
access to sets of microsummaries returned from the nsimicrosummaryservice. ...
...anged in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void
addobserver(in nsimicrosummaryobserver observer); nsisimpleenumerator enumerate(); void removeobserver(in nsimicrosummaryobserver observer); methods
addobserver()
add a microsummary observer to this microsummary set.
adding an observer to a set is the equivalent of
adding it to each constituent microsummary. void
addobserver( in nsimicrosummaryobserver observer ); parameters observer the microsummary observer to
add. enumerate() retrieve an nsisimpleenumerator of microsummaries in the set. nsisimpleenumerator enumerate(); para...
nsIMsgAccount
nsimsgaccount mailnews/base/public/nsimsgaccount.idlscriptable an account consists of an incoming server and one or more outgoing identities. inherits from: nsisupports last changed in gecko 1.7 method overview void
addidentity(in nsimsgidentity identity); void clearallvalues(); void init(); void removeidentity(in nsimsgidentity identity); astring tostring(); attributes attribute type description defaultidentity nsimsgidentity identities nsisupportsarray read only. ...
...void clearallvalues(); void init(); void removeidentity(in nsimsgidentity identity); astring tostring(); attributes attribute type description defaultidentity nsimsgidentity identities nsisupportsarray read only. outgoing identity list (array of nsimsgidentity's) incomingserver nsimsgincomingserver incoming server stuff key acstring internal key identifying itself methods
addidentity()
adds a new identity to this account. void
addidentity( in nsimsgidentity identity ); parameters identity the identity to
add. clearallvalues() clear all user preferences associated with an account. void clearallvalues(); parameters none. init() initializes an account. void init(); parameters none. exceptions thrown ns_error_already_opened if it is called more then once remo...
Building an Account Manager Extension
panel is only shown for imap accounts... 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 previous. 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}"); // ... t...
...ype.classid = components.id("{659ce960-9dfb-11dd-ad8b-0800200c9a55}"); // ... the description and ... devmoaccountmanagerextension.prototype.classdescription = "devmo account manager extension"; // ... textual unique identifier or rendez-vous point in the category manager. ...
nsIMsgCompFields
raryfiles char * obsolete temporaryfiles obsolete, do not use anymore to astring usemultipartalternative prbool uuencodeattachments prbool methods utility methods prbool checkcharsetconversion ( out char * fallbackcharset ); nsimsgrecipientarray splitrecipients ( in prunichar * recipients, in prbool email
addressonly ); void convertbodytoplaintext ( ); attachment handling methods void
addattachment ( in nsimsgattachment attachment ); void removeattachment ( in nsimsgattachment attachment ); void removeattachments ( ); header methods void setheader(char* name, char* value); references this interface is the type of the following pr...
...ar* value); references this interface is the type of the following properties: nsimsgcompose.compfields, nsimsgcomposeparams.composefields this interface is passed as an argument to the following methods: nsimsgcomposesecure.begincryptoencapsulation, nsimsgcomposesecure.requirescryptoencapsulation, nsimsgsend.createandsendmessage, nsimsgsend.sendmessagefile, nsismimejshelper.getnocert
addresses, nsismimejshelper.getrecipientcertsinfo ...
nsIMsgCustomColumnHandler
last changed in gecko 1.9 (firefox 3) inherits from: nsitreeview this interface is meant to be implemented by extensions, as shown in the tutorial. ...
...celltext: function(arow, acol) { }, getsortstringforrow: function(ahdr) { return ""; }, isstring: function() {return true;}, getcellproperties: function(arow, acol, aprops) { }, getrowproperties: function(arow, aprops) { }, getimagesrc: function(arow, acol) {return null;}, getsortlongforrow: function(ahdr) {return 0;} } to attach it use the nsimsgdbview.
addcolumnhandler() method (recall gdbview is the global nsimsgdbview in thunderbird): gdbview.
addcolumnhandler("newcolumn", columnhandler); after which it can be retrieved using the nsimsgdbview.getcolumnhandler() method: var handler = gdbview.getcolumnhandler("newcolumn"); and removed using the nsimsgdbview.removecolumnhandler() method: gdbview.removecolumnhandler("newcolumn"); method overview...
nsIMsgIdentity
oid setboolattribute(in string name, in boolean value); long getintattribute(in string name); void setintattribute(in string name, in long value); astring tostring(); attributes attribute type description identityname astring fullname astring user's full name, i.e. john doe email astring user's e-mail
address, i.e. john@doe.com replyto astring optional replyto
address, i.e. johnnospam@doe.com organization astring optional organization composehtml boolean should we compose with html by default? attachsignature boolean should we attach a signature by default? attachvcard boolean should we attach a vcard by default? a...
... valid boolean determines if the ui should use this identity and the wizard uses this to determine whether or not to ask the user to complete all the fields. smtpserverkey astring the preferred smtp server for this identity. if this is set, this is the smtp server that should be used for the message send. requestreturnreceipt boolean ...
nsIMsgSendLater
by: @mozilla.org/messengercompose/sendlater;1. to create an instance, use var msgsendlater = components.classes["@mozilla.org/messengercompose/sendlater;1"] .getservice(components.interfaces.nsimsgsendlater); method overview void sendunsentmessages(in nsimsgidentity identity); void removelistener(in nsimsgsendlaterlistener listener); void
addlistener(in nsimsgsendlaterlistener listener); nsimsgfolder getunsentmessagesfolder](in nsimsgidentity identity); attributes attribute type description msgwindow nsimsgwindow methods sendunsentmessages() sends all unsent messages for an identity. void sendunsentmessages(in nsimsgidentity identity) parameters identity the nsimsgident...
...dunsentmessages() sends all unsent messages for an identity. void sendunsentmessages(in nsimsgidentity identity) parameters identity the nsimsgidentity to send unsent messages for removelistener() remove an event listener from this nsisendmsglater instance void removelistener(in nsimsgsendlaterlistener listener); parameters listener the nsimsgsendlaterlistener to remove.
addlistener()
add an event listener to this nsisendmsglater instance. void
addlistener(in nsimsgsendlaterlistener listener); parameters listener the nsimsgsendlaterlistener to
add. getunsentmessagesfolder() get the unsent messages folder for an identity. nsimsgfolder getunsentmessagesfolder(in nsimsgidentity identity); parameters identity the nsimsgidentity to get the folder for...
nsINavHistoryQueryOptions
t_by_visitcount_ascending 7 sort by the ascending visit count order. sort_by_visitcount_descending 8 sort by the descending visit count order. sort_by_keyword_ascending 9 sort by the ascending keyword order. sort_by_keyword_descending 10 sort by the descending keyword order. sort_by_date
added_ascending 11 sort by the ascending
added date order. sort_by_date
added_descending 12 sort by the descending
added date order. sort_by_lastmodified_ascending 13 sort by the ascending last modified order. sort_by_lastmodified_descending 14 sort by the descending last modified order. sor...
... tag node is a results_as_tag_contents container defined as place:querytype=1&resulttype=7&folder=tag_folder_id. note: using this result type forces the query type to be query_type_bookmarks. results_as_tag_contents 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_hi...
nsIPermission
last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports attributes attribute type description capability pruint32 the permission to set: allow, deny, or unknown (which is the default). ...
...cified time, or never. constants are defined in nsipermissionmanager.permission_expiration_constants. read only. host autf8string the host, that is uri, on which the permission is applied. read only. type acstring the type of permission: cookie, image, and so on. this is a case-sensitive string. this string is specified by the consumer when
adding a permission via nsipermissionmanager read only. ...
nsIPluginHost
dom/plugins/base/nsipluginhost.idlscriptable please
add a summary to this article. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsifile createtempfiletopost(in string apostdataurl); native code only! void createtmpfiletopost(in string apostdataurl, out string atmpfilename); native code only! obsolete since gecko 2.0 void deletepluginnativewindow(in nspluginnativewindowptr apluginnativewindow); native code only! void destroy(); native code only! void findproxyforurl(in string aurl, out string aresult); native code only! nsiplugin getplugin(in string amimetype); native code only! void getplugincount(out unsigned long aplugincount); obsolete s...
...some where after that, then it assumes there is http headers in the input buffer and continue to search for end of headers (crlfcrlf or lflf). it will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with lf, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "if no custom headers are required, simply
add a blank line ('\n') to the beginning of the file or buffer.", it skips that '\n' and considers rest of the input buffer as data. if "content-length" string and end of headers is found it substitutes single lf with crlf in the headers, so the end of headers always will be crlfcrlf (single cr in headers, if any, remain untouched) else it puts "content-length: "+size_of_data+crlfcrlf at the beginnin...
nsIProxyInfo
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports attributes attribute type description failoverproxy nsiproxyinfo this attribute specifies the proxy to failover to when this proxy fails. failovertimeout unsigned long this attribute specifies the failover timeout in seconds for this proxy. ...
...read only. note: prior to gecko 1.8 type was available by the type method. constants the following "proxy flags" may be bit-wise combined to construct the flags attribute defined on this interface. all unspecified bits are reserved for future use. constant value description transparent_proxy_resolves_host 1 << ...
nsIRequest
he nsistreamlistener on each onstartrequest, ondataavaliable, and onstoprequest invocation. method overview void cancel(in nsresult astatus); boolean ispending(); void resume(); void suspend(); attributes attribute type description loadflags nsloadflags the load flags of this request. bits 0-15 are reserved. when
added to a load group, this request's load flags are merged with the load flags of the load group. loadgroup nsiloadgroup the load group of this request. while pending, the request is a member of the load group. it is the responsibility of the request to implement this policy. name autf8string the name of the request. often this is the uri of the request. read only. ...
...ate_never 1 << 12 disables validation of expired content. validate_once_per_session 1 << 13 disables validation of expired content, 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 prevent 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_abor...
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 prevent 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(...
...by index, for example, when nsiwebnavigation.gotoindex() is called. boolean onhistorygotoindex( in long aindex, in nsiuri agotouri ); parameters aindex the index in session history of the entry to be loaded. agotouri the uri of the session history entry to be loaded. return value true to allow the operation to proceed or false to cancel it. onhistorynewentry() called when a new document is
added to session history. new documents are
added to session history by the docshell when new pages are loaded in a frame or content area; for example 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 ...
nsIScriptError2
1.0 66 introduced gecko 2.0 obsolete gecko 12.0 inherits from: nsiscripterror last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) in gecko 12.0 this interface was merged into the nsiscripterror interface. ...
...conds, from a platform-specific zero time to the time the message was created. read only. methods initwithwindowid() void init( in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category, in unsigned long long innerwindowid ); parameters message 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 prevent showing the source line in...
nsISelectionPrivate
siselectionprivate.idlscriptable internal support for content selection handling. inherits from: nsisupports last changed in gecko 35 (firefox 35 / thunderbird 35 / seamonkey 2.32) warning: the content of this article may be out of date. this page wasn't updated since the initial import in 2011. see the idl file linked above for up-to-date information. ...
...ead only. constants constant value description endofprecedingline 0 startofnextline 1 tableselection_none 0 tableselection_cell 1 tableselection_row 2 tableselection_column 3 tableselection_table 4 tableselection_allcells 5 methods
addselectionlistener() void
addselectionlistener( in nsiselectionlistener newlistener ); parameters newlistener endbatchchanges() will resume user interface updates after a previous call to startbatchchanges(). void endbatchchanges(); parameters none. native code only!getcachedframeoffset returns cached value for nstextframe::getpointfromoffset. void getcachedframeoffset( in ns...
nsISmsRequestManager
cko 13.0 inherits from: nsisupports last changed in gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) implemented by: @mozilla.org/sms/smsrequestmanager;1. ...
...n long arequestid, in long aerror); void notifysmssendfailed(in long arequestid, in long aerror); void notifysmssent(in long arequestid, in nsidommozsmsmessage amessage); constants all sms related errors that could apply to smsrequest objects. constant value description success_no_error 0 no_signal_error 1 not_found_error 2 unknown_error 3 internal_error 4 methods
addrequest() track an already existing request object. long
addrequest( in nsidommozsmsrequest arequest ); parameters arequest an smsrequest. return value the request id. createrequest() create a new request object. long createrequest( in nsidommozsmsmanager amanager, out nsidommozsmsrequest arequest ); parameters amanager an smsmanager. arequest an smsrequest. return value the request id...
nsISocketTransportService
id notifywhencanattachsocket(in nsirunnable aevent); native code only! void shutdown(); obsolete since gecko 1.8 attributes attribute type description autodialenabled boolean controls whether or not the socket transport service should poke the autodialer on connection failure. obsolete since gecko 1.8 methods native code only! attachsocket
adds a new socket to the list of controlled sockets. this will fail with the error code ns_error_not_available if the maximum number of sockets is already reached. in this case, the notifywhencanattachsocket() method should be used. note: this function may only be called from an event dispatch on the socket thread. void attachsocket( in prfiledescptr afd, in nsasockethandlerptr ahandler ); p...
...> asockettypes, in autf8string ahost, in long aport, in nsiproxyinfo aproxyinfo ); parameters asockettypes array of socket type strings. currently "starttls", "ssl" and "udp" are supported. pass an empty array [] if the default socket type should be used. you do not need to specify the strings "socks" or "socks4", use the aproxyinfo instead. ahost specifies the target hostname or ip
address literal of the peer for this socket. aport specifies the target port of the peer for this socket. aproxyinfo specifies the transport-layer proxy type to use. set to null if no proxy should be used. for more details on communicating information about proxies like socks (which are transparent to upper protocols), see nsiproxiedprotocolhandler , nsiprotocolproxyservice or proxies in necko. ...
nsIThread
this interface provides a high-level abstraction for an operating system thread. threads have a built-in event queue, and a thread is an event target that can receive nsirunnable objects (events) to be processed on the thread. to create a thread, use the nsithreadmanager interface. xpcom/threads/nsithread.idlscriptable please
add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsieventtarget method overview void shutdown() boolean haspendingevents() boolean processnextevent(in boolean maywait) attributes attribute type description prthread prthread the nspr thread object corresponding to the nsithread. read only. methods shutdown() shuts down the thread. this causes events...
... is already in the process of being shut down. haspendingevents() determines whether or not the thread has events that are ready to be processed. note: this method must be called from within the thread itself, and not from another thread. boolean haspendingevents() parameters none. return value true if there are pending events at the time the function was called. since other threads may
add events to the current thread, it's possible that by the time this method returns, the event queue may no longer be empty, even if a false result is reported. exceptions thrown ns_error_unexpected the method was called when this thread wasn't the current thread. processnextevent() processes the next pending event. if there aren't any pending events, this method may wait -- depending on the...
nsIThreadInternal
last changed in gecko 1.9 (firefox 3) inherits from: nsithread method overview void popeventqueue(); void pusheventqueue(in nsithreadeventfilter filter); attributes attribute type description observer nsithreadobserver get/set the current thread observer; set to null to disable observing. ...
...er 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 specified filter. if the filter is null, all new events are accepted. calls to pusheventqueue() may be nested, and must each be paired with a corresponding call to popeventqueue() to restore the original state of the thread. void pusheventqueue( in nsithreadeventfilter filter ); parameters filte...
nsITransactionList
editor/txmgr/idl/nsitransactionlist.idlscriptable please
add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview nsitransactionlist getchildlistforitem(in long aindex); nsitransaction getitem(in long aindex); long getnumchildrenforitem(in long aindex); boolean itemisbatch(in long aindex); attributes attribute type description numitems long the number of transactions contained in this list. read only. methods getchildlistforitem() returns the list of children associated with the item at aindex. implementations may return null if there are no children, or an empty list. the list returned is
addref'd so it is up to the caller to release the transaction when it is done. nsitransactionlist getchildlistforitem( in lon...
...to release the transaction when it is done. nsitransactionlist getchildlistforitem( in long aindex ); parameters aindex the index of the item in the list. return value the nsitransactionlist of children associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is
addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the list. return value missing description getnumchildrenforitem() returns the number of child (auto-aggreated) transactions the item at aindex has. long getnumchildrenforitem( in long aindex ); parameters aindex the index of the ...
nsITransport
tream semantics. this means that if the stream has no data and is not closed, then reading from it will block the calling thread until at least one byte is available or until the stream is closed. if this flag is not specified, then the stream has non-blocking stream semantics. this means that if the stream has no data and is not closed, then reading from it returns ns_base_stream_would_block. in
addition, in non-blocking mode, the stream is guaranteed to support nsiasyncinputstream. this interface allows the consumer of the stream to be notified when the stream can again be read. open_unbuffered if specified, the resulting stream may not support readsegments. readsegments is only guaranteed to be implemented when this flag is not specified. asegmentsize if open_unbuffered is not set, then t...
...e blocking stream semantics. this means that if the stream is full and is not closed, then writing to it will block the calling thread until all of the data can be written or until the stream is closed. if this flag is not specified, then the stream has non-blocking stream semantics. this means that if the stream is full and is not closed, then writing to it returns ns_base_stream_would_block. in
addition, in non- blocking mode, the stream is guaranteed to support nsiasyncoutputstream. this interface allows the consumer of the stream to be notified when the stream can again accept more data. open_unbuffered if specified, the resulting stream may not support writesegments and writefrom. writesegments and writefrom are only guaranteed to be implemented when this flag is not specified. asegment...
nsITreeColumns
the nsitreecolumns interface represents the tree columns. 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 nsitreecolumn getcolumnat(in long index); nsitreecolumn getcolumnfor(in nsidomelement element); nsitreecolumn getfirstcolumn(); nsitreecolumn getkeycolumn(); nsitreecolumn getlastcolumn(); nsitreecolumn getnamedcolumn(in astring id); nsitreecolumn getprimarycolumn(); nsitreecolumn getsortedcolumn(); void invalidatecolumns(); void restorenaturalorder(); attributes attribute type description count long the number of columns. read only. length long an alias for count (for the benefit of scripts which treat this as an arra...
...edcolumn( in astring id ); parameters id a column id return value the nsitreecolumn for this id. getprimarycolumn() get the primary column. nsitreecolumn getprimarycolumn(); parameters none. return value the primary nsitreecolumn. getsortedcolumn() nsitreecolumn getsortedcolumn(); parameters none. return value a nsitreecolumn. invalidatecolumns() this method is called whenever a treecol is
added or removed and the column cache needs to be rebuilt. void invalidatecolumns(); parameters none. restorenaturalorder() restore the original order of the columns before the user moved them. void restorenaturalorder(); parameters none. see also nsitreecolumn ...
nsIURI
ng relativepath); boolean schemeis(in string scheme); attributes attribute type description asciihost acstring the uri host with an ascii compatible encoding. follows the idna draft specification for converting internationalized domain names (utf-8) to ascii for compatibility with existing internet infrastructure. read only. note: ipv6
addresses are not enclosed in square brackets. asciispec acstring (us-ascii) the uri spec with an ascii compatible encoding. the host portion follows the idna draft spec. other parts are url-escaped per the rules of rfc3986. the result is strictly ascii. read only. hasref boolean returns if there is a reference portion (the part after the "#") of the uri. ...
...e encoding. the host portion follows the idna draft spec. other parts are url-escaped per the rules of rfc3986. the result is strictly ascii. read only. hasref boolean returns if there is a reference portion (the part after the "#") of the uri. host autf8string the host is the internet domain name to which this uri refers. it could be an ipv4 (or ipv6)
address literal. if supported, it could be a non-ascii internationalized domain name. exceptions thrown ns_error_failure if host is not applicable to the uri scheme (e.g. about:blank) note: characters are not escaped. ipv6
addresses are not enclosed in square brackets. hostport autf8string the "host:port" part of the uri (or simply the host, if p...
nsIUpdate
ails 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 previous, 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, this value is zero. ok (0) no error. mem_error (1) a memory error occurred. usage_error (3) a usage error occurred; this needs to be described in more detail. crc_error (4) a checksum error occurred. parse_error (5) an error occurred whil...
...ror (3) a usage error occurred; this needs to be described in more detail. crc_error (4) a checksum error occurred. parse_error (5) an error occurred while parsing the patch. read_error (6) an error occurred while reading the patch. write_error (7) an error occurred while writing the patched application. unexpected_error (8) an unanticipate type of error occurred. extensionversion astring the
add-on version of this update. used by the extension system to track compatibility of installed
add-ons with this update. obsolete since gecko 2.0 installdate long long the date and time at which the update was installed. iscompleteupdate boolean true if the update is a complete replacement of the existing installation; false if the update is a patch representing the difference between the new ve...
nsIUploadChannel
ew void setuploadstream(in nsiinputstream astream, in acstring acontenttype, in long acontentlength); attributes attribute type description uploadstream nsiinputstream get the stream (to be) uploaded by this channel. read only. methods setuploadstream() sets a stream to be uploaded by this channel. most implementations of this interface require that the stream: implement threadsafe
addref and release implement nsiinputstream.readsegments() implement nsiseekablestream.seek(). history here is that we need to support both streams that already have headers (for example, content-type and content-length) information prepended to the stream (by plugins) as well as clients (composer, uploading application) that want to upload data streams without any knowledge of protocol specificatio...
...reams without any knowledge of protocol specifications. for this reason, we have a special meaning for the acontenttype parameter. void setuploadstream( in nsiinputstream astream, in acstring acontenttype, in long acontentlength ); parameters astream the stream to be uploaded by this channel. acontenttype if acontenttype is empty, the protocol will assume that no content headers are to be
added to the uploaded stream and that any required headers are already encoded in the stream. in the case of http, if this parameter is non-empty, then its value will replace any existing content-type header on the http request. in the case of ftp and file, this parameter is ignored. acontentlength a value of -1 indicates that the length of the stream should be determined by calling the stream's avai...
nsIWebNavigation
a reload was triggered as a result of detecting an incorrect character encoding while parsing a previously 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 prompted by an external program: take care! load_flags_allow_third_party_fixup 8192 this flag specifies that the uri may be submitted to a third-party server for correction. this should only be applied to non-sensitive uris entered by users. load_flags_first_load 16384 th...
...bination of the load flags defined above. (undefined bits are reserved for future use.) generally you will pass load_flags_none for this parameter. referrer the referring uri. if this argument is null, then the referring uri will be inferred internally. postdata if the uri corresponds to a http request, then this stream is appended directly to the http request headers. it may be prefixed with
additional http headers. this stream must contain a \r\n sequence separating any http headers from the http request body. this parameter may be null. headers if the uri corresponds to a http request, then any http headers contained in this stream are set on the http request. the http header stream is formatted as: ( header \r\n )* this parameter may be null. reload() tells the object to reload t...
nsIWinTaskbar
ew. 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 elements on the window. unlike window previews, tab previews require most of the functionality of the nsitaskbarpreviewcontroller interface be implemented. 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. implemented by: @mozilla.org/windows-taskbar;1. to create an instance, use: var wintaskbar = components.classes["@mozilla.org/windows-taskbar;1"] .getservice(components.interfaces.nsiwintaskbar); metho...
... for xulrunner applications, the defaultgroupid attribute is configured using application.ini settings, and is of the format "vendor.application.version". for example, if the vendor is configured to "foobar systems", the application's name is "squashweb", and the application's version is 1.0, the defaultgroupid attribute would be "foobar systems.squashweb.1.0". see xul application packaging for
additional details. methods createjumplistbuilder() retrieve a taskbar jump list builder. fails if a jump list build operation has already been initiated, developers should make use of a single instance of nsijumplistbuilder for building lists within an application. nsijumplistbuilder createjumplistbuilder(); parameters none. return value an nsijumplistbuilder. createtaskbartabpreview() creates a ta...
nsIXPConnect
dl/nsixpconnect.idlnot scriptable provides the xpconnect service. ...
...dingexception nsiexception constants constant value description init_js_standard_classes 1 << 0 flag_system_global_object 1 << 1 omit_components_object 1 << 2 xpc_xow_clearscope 1 tells updatexows() to clear the scope of all of the xows it finds. obsolete since gecko 2.0 methods native code only!
addjsholder root js objects held by aholder. void
addjsholder( in voidptr aholder, in nsscriptobjecttracerptr atracer ); parameters aholder the object that hold the js objects that should be rooted. atracer missing description exceptions thrown missing exception missing description clearallwrappednativesecuritypolicies() void clearallwrappednativesecuritypolicies(); paramet...
nsMsgSearchAttrib
smsgsearchattribvalue sender = 1; const nsmsgsearchattribvalue body = 2; const nsmsgsearchattribvalue date = 3; const nsmsgsearchattribvalue priority = 4; /* mail only */ const nsmsgsearchattribvalue msgstatus = 5; const nsmsgsearchattribvalue to = 6; const nsmsgsearchattribvalue cc = 7; const nsmsgsearchattribvalue toorcc = 8; const nsmsgsearchattribvalue all
addresses = 9; const nsmsgsearchattribvalue location = 10; /* result list only */ const nsmsgsearchattribvalue messagekey = 11; /* message result elems */ const nsmsgsearchattribvalue ageindays = 12; const nsmsgsearchattribvalue folderinfo = 13; /* for "view thread context" from result */ const nsmsgsearchattribvalue size = 14; const nsmsgsearchatt...
...alue anytext = 15; const nsmsgsearchattribvalue keywords = 16; // keywords are the internal representation of tags. ...
xpidl
this older tool has been fully retired. xpidl is based on the libidl idl compiler from the gnome project. the libidl compiler depends on glib, also from the gnome project. the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components. please check the build documentation for further information on where to get libidl and glib. using xpidl to
add an idl file to the build, use the xpidlsrcs makefile variable. for testing purposes, or one-off interface compilation, xpidl can be run from the command line: usage: ./xpidl -m mode [-w] [-v] [-t version number] [-d filename.pp] [-i path] [-o basename | -e filename.ext] filename.idl -a emit annotations to typelib -w turn on warnings (recommended) -v verbose mode (n...
...``/tmp/nsithing) for output -e use explicit output filename -d write dependencies (requires -e) -m specify output mode: header generate c++ header (.h) typelib generate xpconnect typelib (.xpt) doc generate html document...
nsIMsgCloudFileProvider
void uploadfile(in nsilocalfile afile, in nsirequestobserver acallback); acstring urlforfile(in nsilocalfile afile); void cancelfileupload(in nsilocalfile afile); void refreshuserinfo(in boolean awithui, in nsirequestobserver acallback); void deletefile(in nsilocalfile afile, in nsirequestobserver acallback); void createnewaccount(in acstring aemail
address, in acstring apassword, in acstring afirstname, in acstring alastname, in nsirequestobserver acallback); void createexistingaccount(in nsirequestobserver acallback); acstring providerurlforerror(in unsigned long aerror); attributes attribute type description type acstring readonly: the ...
...eates a new user account for the storage provider represented by the nsimsgcloudfileprovider. note: this function is not directly called by the filelink ui. this might change in the future, but as it stands, this function can simply return ns_error_not_implemented unless there are plans to call createnewaccount from the management or settings xhtml files. void createnewaccount(in acstring aemail
address, in acstring apassword, in acstring afirstname, in acstring alastname, in nsirequestobserver acallback); parameters aemail
address the new user account email
address. apassword the desired password for the new account. afirstname the new account holder's first name. alastname the new account holder's last name. acallback the nsirequesto...
Building a Thunderbird extension 1: introduction
and will show you how to build your own. the tutorial has the following pages: introduction (this page) the extension filesystem (setting up your local system) install manifest (the install.rdf file that contains meta-information about the extension) chrome manifest (list of packages and overlays) xul (the xml user interface language that is used to modify the thunderbird user interface)
adding javascript (explains how to
add some simple javascript to your thunderbird extension) installing locally (enabling the extension on your local thunderbird instance) packaging (making a distribution package that contains the extension) distributing (from your own site or from http://
addons.mozilla.org/) this tutorial is compatible with thunderbird versions 2,3 and 5. all thunderbird builds...
...y: any utility that is capable of creating archive files can be used. there are also a number of extension and applications that are useful for testing and debugging thunderbird extensions, such as javascript consoles and xpcom inspectors. these are described on the page "setting up an extension development environment". documentation thunderbird extensions (documentation overview) firefox
addons developer guide (many topics are applicable to thunderbird) mozilla cross-reference source code browser ("comm-central" contains the thunderbird code repository) community the thunderbird development community has a mailing list with an extensive searchable archive with an extensive searchable archive. you can also talk with the community on the #maildev irc channel. next » ...
Building a Thunderbird extension 3: install manifest
on> </rdf> the following items (shown in bold) should be customized for your application: <em:id>myfirstext@jen.zed</em:id>: this is the id of the extension. the first portion is the short name of the extension and must be in lowercase; the last portion is a two-part period-delimited value such as your first and last name or the top-level domain of your website. while this value is in email
address format, it is not an email
address. it should, however, be a unique value so that it does not conflict with other extensions. <em:name>my first extension</em:name>: the extension name is displayed in the thunderbird
add-on manager. <em:version>1.0</em:version>: this is the version number of your extension. it must be updated each time you release a new version of your extension. it is not ...
...on. it must be updated each time you release a new version of your extension. it is not the thunderbird version number (which is stored in the minversion and maxversion fields). <em:creator>jenzed</em:creator>: this optional value is used to store the extension author's name. <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>: this element contains the version id of the application that this
add on is developed for. it is defined by mozilla. a list of valid application ids can be found here. normally the id does not change and is always the same even for different versions of thunderbird. <em:minversion>1.5</em:minversion>: this element indicates the earliest version of thunderbird for which the extension is intended to work. do not use a wildcard (such as "*"). see valid application ve...
Using C struct and pointers
entation of the c struct. using c strings with js-ctypes a pointer to char in javascript is declared as follows: var str = ctypes.pointertype(ctypes.char); now imagine you call a c function that returns a c string and you want to modify the contents of this string. in the js-ctypes context, you can only operate on buffers of known capacity. therefore, the size of the buffer must be specified.
additionally, the js-ctypes pointer must be casted to reflect the size of the buffer: var ptr = ctypes.cast( str, ctypes.arraytype( ctypes.char, buff_size ).ptr ); here buff_size is of type ctypes.size_t. once we have a ctypes char pointer that points to a buffer of known size, we modiify the contents of the memory block as follows: ptr.contents = string("hello world from javascript!!!"); str...
... references this example is based on code found here. ...
Working with ArrayBuffers
var imgwidth = 400; var imgheight = 400; var myimgdat = new imagedata(imgwidth, imgheight); method 1: passing arraytype cdata to uint8clampedarray.prototype.set one method is to get into a js-ctypes array, and then set it into the imagedata, as illustrated by the following code example. // cast pointer to array, to pass to uint8clampedarray.prototype.set. var casted = ctypes.cast(pixelbuffer.
address(), ctypes.uint8_t.array(myimgdata.data.length).ptr).contents; // myimgdat.data.length is imgwidth * imgheight * 4 because per pixel there is r, g, b, a numbers casted.tostring(); // "ctypes.uint8_t.array(640000)([45, 66, 135, 255, 99, 86, 55, 255, .......... ])" myimgdat.data.set(casted); the ctypes.cast takes a couple of milliseconds, however, the myimgdat.data.set takes up to 800ms for a ...
...yimgdat.data.set(casted); the ctypes.cast takes a couple of milliseconds, however, the myimgdat.data.set takes up to 800ms for a size of 52,428,800 (which is image size of 1280 x 1024 pixels). so, for the size of 640,000 it takes about 98ms. ...
Blocking By Domain - Plugins
not installed. there are two versions of plugin blocking: first-party plugin blocking list sites on this list may not use plugins. third-party plugin block list sites on this list may not use plugins when they are loaded into a third-party iframe in another site. criteria in order to improve firefox security and performance, there are two major categories of sites mozilla may choose to
add to plugin domain blocking: sites commonly embedded in a 3rd-party context web sites which are commonly embedded into other sites using iframes can have a large impact on browser security and also cause many sites to show plugin activation prompts. sites in this category may include advertisers, social media sites, and other utilities. top sites many popular sites work properly without plugi...
...rompts. sites in this category may include advertisers, social media sites, and other utilities. top sites many popular sites work properly without plugins, but still prompt users for activation. in order to improve site performance and reduce the number of plugin prompts that users see, popular sites that show unnecessary plugin prompts or slow the browser down with unnecessary plugins will be
added to the plugin block list. list contents and updates the plugin block lists are freely-licensed lists maintained by mozilla in github. the initial contents of the third-party plugin block list are based on disconnect's open source blocklist. subsequent updates to the list will be made using telemetry from firefox experiments. in general, sites will not be removed from the list unless there is...
Streams - Plugins
8k buffer to hold the data written from that stream. in the first call, npp_writeready could return 8192, resulting in a call to npp_write with a buffer of up to 8k bytes. after this data is copied from the browser's buffer to the plug-in's buffer, the plug-in begins to process the data asynchronously. at the next npp_writeready call, only half of the data has been processed. to avoid allocating
additional buffers, the plug-in could return 4096, resulting in a call to npp_write with a buffer of up to 4k bytes. the buffer passed to npp_write may accommodate more bytes than the maximum number returned from npp_writeready . this maximum is only a promise to consume a certain amount of data from the buffer, not an upper limit on the buffer size. in the example above, suppose that the plug-in al...
...t of byte ranges. the open stream is converted from normal mode to seek mode in an effort to pass the plug-in data that was already on the way, rather than just discarding it. all npp_write calls for streaming data eventually stop, and npp_write calls will be completed only for data requested with npn_requestread. the browser does not create a new stream for each byte range it requests. instead,
additional npp_writeready and npp_write calls occur on the same stream. an individual call to npn_requestread can request discontiguous ranges, and you can have many outstanding npn_requestread calls. there is no guarantee that npp_write will receive requests for ranges in the same order as you requested (although this typically is the case; the server controls the order). so, you'll need to pay atte...
Accessibility Inspector - Firefox Developer Tools
and only those items that have issues. simulate the accessibility inspector offers (as of firefox 70), a simulator that lets you see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity loss. ...
...ou see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity loss. ...
The Web Developer Menu - Firefox Developer Tools
ilt into firefox. ...
...ns: the first section lists tools that are hosted in the toolbox, which is a dedicated window for developer tools the second section lists integrated tools that are not hosted in the toolbox, as well as any tools installed as
add-ons (you'll see in the windows screenshot above that i've installed the firefox os simulator) the third section, "get more tools", is a link to more web development
add-ons for firefox ...
Introduction to DOM Inspector - Firefox Developer Tools
pector is standalone; it supports all toolkit applications, and it's possible to embed it in your own xulrunner app. dom inspector can serve as a sanity check to verify the state of the dom, or it can be used to manipulate the dom by hand, if desired. note: starting with firefox 3, the dom inspector is not included in firefox by default; instead, you must download and install it from the mozilla
add-ons web site. (note: this is now a dead link.) when you first start the dom inspector, you are presented with a two-pane application window that looks a little like the main mozilla browser. like the browser, the dom inspector includes an
address bar, and some of the same menus. in seamonkey
additional global menus will be available. inspecting a document when the dom inspector opens, it may...
...ck of all the windows that are open, so to inspect the dom of a particular window in the dom inspector, simply access that window as you would normally and then choose its title from this dynamically updated menulist. inspecting arbitrary urls you may also inspect the dom of arbitrary urls by using the inspect a url menuitem in the file menu, or by just entering a url into the dom inspector's
address bar and clicking inspect or pressing enter. for example, you can enter http://www.mozilla.org in the
address bar and see the dom structure of the mozilla.org home page. you should not use this approach to inspect chrome documents. instead, ensure that the document loads via normal means and use the inspect chrome document menupopup to select it for inspection. when you inspect a web page ...
DOM Inspector - Firefox Developer Tools
the dom inspector (also known as domi) is a developer tool used to inspect, browse, and edit the document object model of documents - usually web pages or xul windows. the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within. this tool is an
add-on for xul-based applications such as firefox and thunderbird. if you are looking for the dom inspector that's built into firefox, see the documentation for the page inspector. documentation introduction to dom inspector a guided tutorial that will help you get started with dom inspector. dom inspector faq answers to common questions on dom inspector. dom inspector page at mozillazine more information on the dom inspector. how to build the dom ...
...he dom inspector blog post on building the dom inspector from source. getting dom inspector firefox & thunderbird you may download and install the dom inspector from the amo web site. (thunderbird users browsing amo in firefox should save the installation link, or visit the dom inspector for thunderbird page.) thunderbird 2 dom inspector for thunderbird 2 is available from thunderbird
add-ons. or, build thunderbird yourself with the following options: ac_
add_options --enable-extensions="default inspector" ac_
add_options --enable-inspector-apis mozilla suite and seamonkey select tools > web development > dom inspector. you can install the sidebar panel via edit > preferences > advanced > dom inspector, then simply open up the inspector panel and visit a website. report a b...
Examine, modify, and watch variables - Firefox Developer Tools
ts and this variables as well as local variables defined by the function like user and greeting. similarly, in global scope you'll see global variables you've defined, like greetme, as well as built-in globals like localstorage and console. each object can be expanded, using a disclosure triangle, to show its properties. pointing your cursor at a variable's name displays a tooltip that provides
additional information about the variable. see object.defineproperty() for details on what these property descriptors mean. you can filter the variables that are displayed, either by using the "*" modifier in the script filter, or by typing into the filter variables box, if you have enabled this in the debugger settings. if a variable exists in the source but has been optimized away by the javasc...
...ebugger. just click on the variable's current value and you'll be able to type there: watch an expression watch expressions are expressions that are evaluated each time execution pauses. you can then examine the results of these expressions. these are useful in that they let you inspect invariants in your code that you know are there but aren't necessarily in the code ready for inspection. to
add a watch expression, click in the box that says "
add watch expression" and enter a javascript expression whose output you'd like to monitor as you step through code. then start running your code. the watch expression does nothing until you begin to step through your code, so nothing happens until you reach a breakpoint. at that point, a box showing your active watch expressions and their current ...
Set a logpoint - Firefox Developer Tools
can use a special type of breakpoint, the logpoint. logpoints print a message to the console panel instead of pausing code execution. the logpoint is especially useful in cases where breaking the execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic. to create a logpoint: right click on a line number in the debugger panel and pick
add log action from the context menu. create an expression inline. the result is logged in the console panel every time the line with the logpoint executes. you can use any variable or function available in the current scope. working with logpoints when you set a logpoint, the indicator is purple, rather than the blue of an unconditional breakpoint or the orange of a conditional breakpoint...
... press esc or select the elipsis menu (...) and then click show split console.) when should you use logpoints? when you want to know that a specific line in your code has executed, but you don’t want to break code execution, set a logpoint. logpoints are useful to log the value of a variable at a specific point in the code. it’s faster than changing the underlying source code itself to
add calls to the console.log method. if you need to execute
additional logic related to the source code and you can’t change the source code itself, you can use a logpoint. note that you can use logpoints with source-mapped code, as well as with your unmapped source files. ...
Set event listener breakpoints - Firefox Developer Tools
vents supported in your version of firefox are listed, arranged by which api or api area they're part of. now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. when execution pauses, the source pane displays the highlighted line of the javascript code that is next to be executed, along with the surrounding code for context. in
addition, you get a box overlaid on the viewport saying "paused on event breakpoint", with buttons to step over that line of code or resume execution. you could
add regular breakpoints at the entry point of the listener to achieve the same effect. if however you have multiple elements, all of which have event listeners attached that you want to break on, this becomes an enormous time saver. this is...
...ere inside jquery. instead, it’d be far more useful if we showed where in our own app code is calling the jquery that fired the event. this can be done by finding jquery.js in the sources panel, and choosing the ignore source option from its context menu. now the logs will show where in your app jquery was called, rather than where 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 preview new in firefox 71, the source pane now gives you an instan...
Debugger-API - Firefox Developer Tools
however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. ...
...e the debuggee from within the same thread, and then handle any needed communication themselves. (firefox’s builtin tools have a protocol defined for this purpose.) in gecko, the debugger api is available to chrome code only. by design, it ought not to introduce security holes, so in principle it could be made available to content as well; but it is hard to justify the security risks of the
additional attack surface. the debugger api cannot currently observe self-hosted javascript. this is not inherent in the api’s design, but simply that the self-hosting infrastructure isn’t prepared for the kind of invasions the debugger api can perform. debugger instances and shadow objects debugger reflects every aspect of the debuggee’s state as a javascript value—not just actual javascr...
Edit fonts - Firefox Developer Tools
he browser's default styling (times new roman for most browsers), and no author-defined font has been supplied. they are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. they are system fallback fonts used when nothing from the font-family css declaration has been applied. fonts editor firefox 63
adds the font editor — a new area below "fonts used" with
additional controls for editing the fonts’ characteristics. for standard (static) fonts, you will be able to change the settings listed below size the font-size for the inspected element. this can be set using em, rem, %, px, vh, or vw units. you can select values using the slider or enter a numeric value directly into the text box...
...ined 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 preview 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? variable fonts, or opentype font variations, define a new font file format that allows the font designer to include multiple variations of a typeface inside a single font file. that means you no longer have to apply several different web fonts to...
Animation inspector example: CSS transitions - Firefox Developer Tools
firefox-logo-animation example animation using css transitions. ...
...utton != 0) { return; } if (e.target.classlist.contains("icon")) { var wasselected = (e.target.getattribute("id") == "selected"); clearselection(); if (!wasselected) { e.target.setattribute("id", "selected"); } } } function clearselection() { var selected = document.getelementbyid("selected"); if (selected) { selected.removeattribute("id"); } } document.
addeventlistener("click", toggleselection); ...
Animation inspector example: Web Animations API - Firefox Developer Tools
firefox-logo-animation example animation using the web animations api. ...
...keyframeset, 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); ...
Animating CSS properties - Firefox Developer Tools
sight into the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. if you want to play along, the demo website is here. it looks like this: it has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. there are a number of elements, and we've
added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. there's also a video version of this walkthrough: animating using margin leaving the "use margin" option set, start the animation, open the performance tool, and make a recording. you'll only need to record a few seconds. open up the first recording. exactly what you...
...ompressed view of the waterfall. the predominance of green is telling us that we're spending a lot of time painting. frame rate this is showing frame rate. average frame rate here is 46.67fps, well below the target of 60fps. worse, though, is that the frame rate is very jagged, with lots of dips into the twenties and teens. it's unlikely you'll see a smooth animation here, especially when you
add in user interaction. waterfall the rest of the recording shows the waterfall view. if you scroll through this, you'll see a pattern like this: this is showing us the rendering waterfall. in each animation frame, we recalculate styles for every element, then perform a single layout, then a repaint. you can see that paint especially is hurting performance here. in the screenshot above we've h...
Intensive JavaScript - Firefox Developer Tools
then we need a new file...
...on, false); worker.postmessage({ "multiplier": multiplier, "iterations": iterations }); } the main difference here, compared with the original, is that we need to: create a worker send it a message when we are ready to calculate listen for a message called "done", which indicates that the worker has finished. ...
Waterfall - Firefox Developer Tools
whether the gc was incremental or not the reason the gc was performed if the gc was non-incremental, the reason it was non-incremental starting in firefox 46, if the gc event was caused by allocation pressure, a link appears, labeled "show allocation triggers". click the link to see the allocation profile leading up to this gc event. see allocations and garbage collection for more details.
adding markers with the console api two markers are directly controlled by console api calls: "console" and "timestamp". console markers these enable you to mark a specific section of the recording. to make a console marker, call console.time() at the start of the section, and console.timeend() at the end. these functions take an argument which is used to name the section. for example, suppose w...
...e stack at the end of the period: that is, at the point console.timeend() was called. if console.timeend() was called from the resolution of a promise, it will also display "(async: promise)", under which it will show the "async stack": that is, the call stack at the point the promise was made. ...
Storage Inspector - Firefox Developer Tools
y the name of the cache: indexeddb objects are organized by origin, then by database name, then by object store name: with the cookies, local storage, and session storage types, there's only one level in the hierarchy, so stored items are listed directly under each origin: you can click on each item in the tree to expand or collapse its children. the tree is live, so if a new origin gets
added (by
adding an iframe, for example), it will be
added to each storage type automatically. clicking on a tree item will display detailed information about that item in the table widget on the right. for example, clicking on an origin which is a child of the cookies storage type will show all the cookies belonging to that domain. table widget the table widget displays a list of all the items co...
...icking on the table header and selecting the columns you want to see: search there's a search box at the top of the table widget: this filters the table to show only items which match the search term. items match the search term if any of their fields (including fields whose columns you have hidden) contain the search term. you can use ctrl + f (cmd + f on a mac) to focus the search box.
add and refresh storage you'll also have buttons available to
add a new storage entry or refresh the view of the currently viewed storage type where applicable (you can't
add new entries to indexeddb or cache): sidebar when you select any row in the storage table widget, the sidebar is shown with details about that row. if a cookie is selected, it will list all the details about that cookie. th...
Toolbox - Firefox Developer Tools
style editor profiler network monitor note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools support remote debugging yet, so if the debugging target is not the firefox instance that launched the window, not all the hosted tools will be shown). ...
... tools will be shown). extra tools next there's an array of buttons that can be
added or removed in the developer tool settings. by default this array includes: toggle split console responsive design mode select a frame as the currently targeted document (this is only included by default from firefox 41 onwards). ...
View Source - Firefox Developer Tools
view source lets you look at the html or xml source for the page you're viewing. to activate view source: context-click in the page and select view page source press ctrl + u on windows and linux, or cmd + u on macos the command opens a new tab with the source for the current page. view source features view source has three
additional features, which can be accessed from the context menu in the view source tab: go to line scrolls to the specified line. if the number is higher than the lines in a file, you receive an error message. wrap long lines (toggle) wraps long lines to the width of the page. syntax highlighting (toggle) applies syntax highlighting to the code.when syntax highlighting is on, view source also highlights parsing errors in red. hovering your mouse over er...
...x highlighting is on, view source also highlights parsing errors in red. hovering your mouse over errors displays a tooltip explaining the error. this feature is useful when you're looking for html errors. to access go to line from the keyboard, press control + option + l on macos, or alt + shift + l on windows or linux. link to a line number it is possible to link to a particular line, by
adding the #linennn anchor to the url the browser will jump to the nnn line. for example view-source:https://www.mozilla.org/#line100 view selection source if you select part of a web page and conext-click, you'll see a context menu item labeled "view selection source", that behaves just like "view page source", except you only see the source for the selection. view mathml source if you context-...
Firefox Developer Tools
download firefox developer edition connecting the developer tools if you open the developer tools using keyboard shortcuts or the equivalent menu items, they'll target the document hosted by the currently active tab. but you can attach the tools to a variety of other targets, too, both within the current browser and in different browsers or even different devices. about:debugging debug
add-ons, content tabs, and workers running in the browser. connecting to firefox for android connect the developer tools to an instance of firefox running on an android device. connecting to iframes connect the developer tools to a specific iframe in the current page. connecting to other browsers connect the developer tools to chrome on android and safari on ios. debugging the browser by de...
...on an android device. connecting to iframes connect the developer tools to a specific iframe in the current page. connecting to other browsers connect the developer tools to chrome on android and safari on ios. debugging the browser by default, the developer tools are attached to a web page or web app. but you can also connect them to the browser as a whole. this is useful for browser and
add-on development. browser console see messages logged by the browser itself and by
add-ons, and run javascript code in the browser's scope. browser toolbox attach the developer tools to the browser itself. migrating from firebug firebug has come to the end of its lifespan (see firebug lives on in firefox devtools for details of why), and we appreciate that some people will find migrating...
AbortSignal: abort event - Web APIs
cancelable no interface event event handler onabort examples in the following snippets, we create a new abortcontroller object, and get its abortsignal (available in the signal property). later on we check whether or not it the signal has been aborted using the onabort property, and send an appropriate log to the console. ...
...he following snippets, we create a new abortcontroller object, and get its abortsignal (available in the signal property). later on we check whether or not it the signal has been aborted using the onabort property, and send an appropriate log to the console. you can use the abort event in an
addeventlistener method: var controller = new abortcontroller(); var signal = controller.signal; signal.
addeventlistener('abort', function() { console.log('request aborted'); }; or use the onabort event handler property: var controller = new abortcontroller(); var signal = controller.signal; signal.onabort = function() { console.log('request aborted'); }; specifications specification status domthe definition of 'abort' in that specification. living standard ...
AbortSignal - Web APIs
communicate with a dom request (such as a fetch) and abort it if required via an abortcontroller object. properties the abortsignal interface also inherits properties from its parent interface, eventtarget. abortsignal.aborted read only a boolean that indicates whether the request(s) the signal is communicating with is/are aborted (true) or not (false). events listen to this event using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort invoked when the dom request(s) the signal is communicating with is/are aborted. also available via the onabort property. methods the abortsignal interface inherits methods from its parent interface, eventtarget. examples in the following snippet, we aim to download a video using the fe...
...options object (see {signal}, below). this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener. var controller = new abortcontroller(); var signal = controller.signal; var downloadbtn = document.queryselector('.download'); var abortbtn = document.queryselector('.abort'); downloadbtn.
addeventlistener('click', fetchvideo); abortbtn.
addeventlistener('click', function() { controller.abort(); console.log('download aborted'); }); function fetchvideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with an aborterr...
AbsoluteOrientationSensor - Web APIs
ples basic example the following example, which is loosely based on intel's orientation phone demo, instantiates an absoluteorientationsensor with a frequency of 60 times a second. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. ...
...of 60 times a second. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. const options = { frequency: 60, referenceframe: 'device' }; const sensor = new absoluteorientationsensor(options); sensor.
addeventlistener('reading', () => { // model is a three.js object instantiated elsewhere. model.quaternion.fromarray(sensor.quaternion).inverse(); }); sensor.
addeventlistener('error', error => { if (event.error.name == 'notreadableerror') { console.log("sensor is not available."); } }); sensor.start(); permissions example using orientation sensors requires requesting permissions for multiple device sensors. because the permissions uses promises, a good way to request permissions is to use promise.all. const sensor = new absoluteorientationsenso...
Animation.onfinish - Web APIs
ttime - (animation.currenttime * animation.playbackrate). syntax var finishhandler = animation.onfinish; animation.onfinish = finishhandler; value a function to be called to handle the finish event, or null if no finish event handler is set. examples animation.onfinish is used several times in the alice in web animations api land growing/shrinking alice game. here is one instance where we
add pointer events back to an element after its opacity animation has faded it in: //
add an animation to the game's ending credits var endingui = document.getelementbyid("ending-ui"); var bringui = endingui.animate(keysfade, timingfade); // pause said animation's credits bringui.pause(); // this function removes pointer events on the credits. hide(endingui); // when the credits are later faded i...
...nts back to an element after its opacity animation has faded it in: //
add an animation to the game's ending credits var endingui = document.getelementbyid("ending-ui"); var bringui = endingui.animate(keysfade, timingfade); // pause said animation's credits bringui.pause(); // this function removes pointer events on the credits. hide(endingui); // when the credits are later faded in, // we re-
add the pointer events when they're done bringui.onfinish = function() { endingui.style.pointerevents = 'auto'; }; specifications specification status comment web animationsthe definition of 'animation.onfinish' in that specification. working draft editor's draft. ...
Attr - Web APIs
the attr interface represents one of a dom element's attributes as an object. in most dom methods, you will directly retrieve the attribute as a string (e.g., element.getattribute()), but certain functions (e.g., element.getattributenode()) or means of iterating return attr types. ...
...ce gecko 14 modify the value of attr.value instead. replacechild() obsolete since gecko 14 modify the value of attr.value instead. setattributenode() use element.setattribute() instead. setattributenodens() use element.setattributens() instead. specifications specification status comment domthe definition of 'attr' in that specification. living standard
added ownerelement property back dom4the definition of 'attr' in that specification. obsolete moved namespaceuri, prefix and localname from node to this api and removed ownerelement, schematypeinfo and isid. document object model (dom) level 3 core specificationthe definition of 'attr' in that specification. obsolete initial definition ...
AudioContext.createMediaStreamDestination() - Web APIs
representing an audio stream, which may be stored in a local file or sent to another computer. the mediastream is created when the node is created and is accessible via the mediastreamaudiodestinationnode's stream attribute. this stream can be used in a similar way as a mediastream obtained via navigator.getusermedia — it can, for example, be sent to a remote peer using the rtcpeerconnection
addstream() method. for more details about media stream destination nodes, check out the mediastreamaudiodestinationnode reference page. syntax var audioctx = new audiocontext(); var destination = audioctx.createmediastreamdestination(); returns a mediastreamaudiodestinationnode. examples in the following simple example, we create a mediastreamaudiodestinationnode, an oscillatornode and a medi...
...opus file </p> <button>make sine wave</button> <audio controls></audio> <script> var b = document.queryselector("button"); var clicked = false; var chunks = []; var ac = new audiocontext(); var osc = ac.createoscillator(); var dest = ac.createmediastreamdestination(); var mediarecorder = new mediarecorder(dest.stream); osc.connect(dest); b.
addeventlistener("click", function(e) { if (!clicked) { mediarecorder.start(); osc.start(0); e.target.innerhtml = "stop recording"; clicked = true; } else { mediarecorder.stop(); osc.stop(0); e.target.disabled = true; } }); mediarecorder.ondataavailable = function(evt) { // push eac...
AudioContext.getOutputTimestamp() - Web APIs
of a performance interface; the time after the document containing the audio context was first rendered examples in the following code we start to play an audio file after a play button is clicked, and start off a requestanimationframe loop running, which constantly outputs the contexttime and performancetime. you can see full code of this example at output-timestamp (see it live also). ...
...me loop running, which constantly outputs the contexttime and performancetime. you can see full code of this example at output-timestamp (see it live also). ...
AudioParamDescriptor - Web APIs
28235e38. maxvalue optional a float which represents maximum value of the audioparam. defaults to 3.4028235e38. defaultvalue optional a float which represents initial value of the audioparam. defaults to 0. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audioworkletnode page. there we've created a simple node which outputs white noise. here,
additionally, we'll create a custom gain parameter, so we can directly change volume of the output (although you could use gainnode to achieve this as well). first, we need to define a custom audioworkletprocessor, and register it. note that this should be done in a separate file. we expand the processor by
adding a static parameterdescriptors getter. it will be used internally by the audioworkletn...
...// if no automation is scheduled for the moment. } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main scripts file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor, and connect the node to an audio graph. ...
AudioScheduledSourceNode - Web APIs
sourcenode. unless stated otherwise, nodes based upon audioscheduledsourcenode output silence when not playing (that is, before start() is called and after stop() is called). silence is represented, as always, by a stream of samples with the value zero (0). properties inherits properties from its parent interface, audionode. ...
...herits methods from its parent interface, audionode, and
adds the following methods: start() schedules the node to begin playing the constant sound at the specified time. if no time is specified, the node begins playing immediately. stop() schedules the node to stop playing at the specified time. if no time is specified, the node stops playing at once. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface: ended fired when the source node has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. also available using the onended event handler property. specification specifica...
AudioWorkletNode.parameters - Web APIs
udioparammap object containing audioparam instances. they can be automated in the same way as with default audionodes, and their calculated values can be used in the process method of your audioworkletprocessor. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audioworkletnode page. there we've created a simple node which outputs white noise. here,
additionally, we'll create a custom gain parameter, so we can directly change volume of the output (although you could use gainnode to achieve this as well). first, we need to define a custom audioworkletprocessor, and register it. note that this should be done in a separate file. we expand the processor by
adding a static parameterdescriptors getter. it will be used internally by the audioworkletn...
...// if no automation is scheduled for the moment. } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main scripts file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor, and connect the node to an audio graph. ...
AudioWorkletProcessor() - Web APIs
ount: [n, m] specifies the number of channels in the first output to be n and the second output to be m. the array length must match numberofoutputs. parameterdata optional an object containing the initial values of custom audioparam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value. processoroptions optional any
additional data that can be used for custom initialization of the underlying audioworkletprocessor. note that there are default values for the first two properties, so even if there are no options object passed to the audioworkletnode constructor, the options object passed by the node to the audioworkletprocessor constructor will exist and at minimum have numberofinputs and numberofoutputs. return ...
...essor) next, in our main script file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor and options object. in the options object we pass processoroptions with a map instance under someusefulvariable key. we don't pass numberofinputs and see how it gets its default value. ...
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
28235e38. maxvalue optional a float which represents maximum value of the audioparam. defaults to 3.4028235e38. defaultvalue optional a float which represents initial value of the audioparam. defaults to 0. examples to demonstrate creation and usage of custom audioparams, we'll expand the example from audioworkletnode page. there we've created a simple node which outputs white noise. here,
additionally, we'll create a custom gain parameter, so we can directly change volume of the output (although you could use gainnode to achieve this as well). first, we need to define a custom audioworkletprocessor, and register it. note that this should be done in a separate file. we expand the processor by
adding a static parameterdescriptors getter. it will be used internally by the audioworkletn...
...// if no automation is scheduled for the moment. } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main scripts file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor, and connect the node to an audio graph. ...
AudioWorkletProcessor - Web APIs
shape the node output accordingly. processing audio an example algorithm of creating a custom audio processing mechanism is: create a separate file; in the file: extend the audioworkletprocessor class (see "deriving classes" section) and supply your own process() method in it; register the processor using audioworkletglobalscope.registerprocessor() method; load the file using
addmodule() method on your audio context's audioworklet property; create an audioworkletnode based on the processor. the processor will be instantiated internally by the audioworkletnode constructor. connect the node to the other nodes. examples in the example below we create a custom audioworkletnode that outputs white noise. first, we need to define a custom audioworkletprocessor, which will ...
...+) { channel[i] = math.random() * 2 - 1 } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main script file we'll load the processor, create an instance of audioworkletnode, passing it the name of the processor, then connect the node to an audio graph. const audiocontext = new audiocontext() await audiocontext.audioworklet.
addmodule('white-noise-processor.js') const whitenoisenode = new audioworkletnode(audiocontext, 'white-noise-processor') whitenoisenode.connect(audiocontext.destination) specifications specification status comment web audio apithe definition of 'audioworkletprocessor' in that specification. working draft ...
BaseAudioContext.createDynamicsCompressor() - Web APIs
cially important in games and musical applications where large numbers of individual sounds are played simultaneously, where you want to control the overall signal level and help avoid clipping (distorting) of the audio output. syntax baseaudioctx.createdynamicscompressor(); returns a dynamicscompressornode. example the below code demonstrates a simple usage of createdynamicscompressor() to
add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a compressor node var compressor = audioctx.createdynamicscompressor(); compressor.threshold.setvalueattime(-50, audioctx.cur...
... working draft ...
BatteryManager - Web APIs
ge event; this event is sent when the battery charging time is updated batterymanager.ondischargingtimechange a handler for the dischargingtimechange event; this event is sent when the battery discharging time is updated. batterymanager.onlevelchange a handler for the levelchange event; this event is sent when the battery level is updated. ...
... see also webidl bindings. ...
Beacon API - Web APIs
requests are guaranteed to be initiated before a page is unloaded and they are run to completion, without requiring a blocking request (for example xmlhttprequest). example use cases of the beacon api are logging activity and sending analytics data to the server. example code of the interfaces described in this document is included in using the beacon api. why use beacon? the beacon interface
addresses the needs of analytics and diagnostics code that typically attempts to send data to a web server before unloading the document. sending the data any sooner may result in a missed opportunity to gather data. however, ensuring that the data is sent during the unloading of a document is something that has traditionally been difficult for developers. user agents will typically ignore asynchron...
...ad, data can be submitted during the unload. another technique is to create a no-op loop for several seconds within the unload handler to delay the unload and submit data to a server. not only do these techniques represent poor coding patterns, some of them are unreliable and result in the perception of poor page load performance for the next navigation. the beacon api provides a standard way to
address these issues. global context the beacon api's navigator.sendbeacon() method is used to send a beacon of data to the server in the global browsing context. the method takes two arguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, ...
BeforeInstallPromptEvent - Web APIs
the beforeinstallpromptevent is fired at the window.onbeforeinstallprompt handler before a user is prompted to "install" a web site to a home screen on mobile. this interface inherits from the event interface. ...
...which would allow the user to chose between a web version or an android version. beforeinstallpromptevent.userchoice read only returns a promise that resolves to a domstring containing either "accepted" or "dismissed". ...
BeforeUnloadEvent - Web APIs
ing the users for confirmation to leave the page (see example below). when no value is provided, the event is processed silently. some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. ...
...><text x="201" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">beforeunloadevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} bubbles no cancelable yes target objects defaultview interface event examples window.
addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.
addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't follow the spec for the dialog box. an almost-cross-browser working example would be close to the below example. window.
addeventlistener("beforeunload", function (e) { var ...
BluetoothDevice - Web APIs
the bluetoothdevice interface of the web bluetooth api represents a bluetooth device inside a particular script execution environment. ...
... read only lists the uuid's of gatt services provided by the device, that the current origin is allowed to access. bluetoothdevice.watchingadvertisements read only if advertisments were activated using bluetoothdevice.watchadvertisements(). non-standard chrome os properties these properties were only implemented on google’s chrome os 45 and removed from chrome 52. bluetoothdevice.
addata read only an instance of bluetoothadvertisingdata containing the most recent advertising data received for the device. bluetoothdevice.deviceclass read only a number representing the bluetooth devices "class of device". bluetoothdevice.vendoridsource read only the vendor id source field in the pnp_id characteristic in the device_information service. bluetoothdevice.vendorid ...
CDATASection - Web APIs
n: <![cdata[ < > & ]]> with all kinds of unescaped text.</foo> the only sequence which is not allowed within a cdata section is the closing sequence of a cdata section itself, ]]>: <![cdata[ ]]> will cause an error ]]> note that cdata sections should not be used within html; they only work in xml. ...
...:hover text { fill: #0095dd; pointer-events: all;} properties this interface has no specific properties and implements those of its parent text. methods this interface has no specific methods and implements those of its parent text. specifications specification status comment domthe definition of 'cdatasection' in that specification. living standard re-
added in issue #295 due to web breakage dom4the definition of 'cdatasection' in that specification. obsolete removed in favour of the more generic text interface document object model (dom) level 3 core specificationthe definition of 'cdatasection' in that specification. obsolete no change from document object model (dom) level 2 core specification document obje...
CSSCounterStyleRule - Web APIs
the csscounterstylerule interface represents an @counter-style at-rule. ...
...ptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.symbols is a domstring object that contains the serialization of the symbols descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.
additivesymbols is a domstring object that contains the serialization of the
additive-symbols descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.negative is a domstring object that contains the serialization of the negative descriptor defined for the associated rule. if the descriptor wa...
CSSMathSum - Web APIs
the cssmathsum interface of the css typed object model api represents the result obtained by calling
add(), sub(), or tosum() on cssnumericvalue. a cssmathsum is the object type returned when the stylepropertymapreadonly.get() method is used on a css property whosevalue is created with a calc() function. constructor cssmathsum.cssmathsum() creates a new cssmathsum object. properties cssmathsum.values returns a cssnumericarray object which contains one or more cssnumericvalue objects. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. ...
...ect. properties cssmathsum.values returns a cssnumericarray object which contains one or more cssnumericvalue objects. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. ...
CSSMathValue - Web APIs
hmin cssmathnegate cssmathproduct cssmathsum properties cssmathvalue.operator indicates the operator that the current subtype represents. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
... specifications specification status comment css typed om level 1the definition of 'cssmathvalue' in that specification. working draft initial definition. ...
CSSPseudoElement - Web APIs
b animations api. instances of this interface may be obtained by calling element.pseudo(). properties csspseudoelement.element read only returns the originating/parent element of the pseudo-element. csspseudoelement.type read only returns the pseudo-element selector as a cssomstring. ...
...ollowing methods: eventtarget.
addeventlistener() registers an event handler of a specific event type on the pseudo-element. eventtarget.dispatchevent() dispatches an event to this pseudo-element. eventtarget.removeeventlistener() removes an event listener from the pseudo-element. examples basic example using element.pseudo using pseudo-elements, most modern browsers will automatically
add quotation marks around text inside a <q> element. (a style rule may be needed to
add quotation marks in older browsers.) the example below demonstrates the basic properties of the csspseudoelement object representing the opening quotation mark. const element = document.queryselector('q'); const csspseudoelement = element.pseudo('::before'); console.log(csspseudoelement.element); // outputs [obje...
CSSRule - Web APIs
nknownrule cssrule.charset_rule 2 csscharsetrule (removed in most browsers.) an up-to-date informal list of constants can be found on the csswg wiki. specifications specification status comment css object model (cssom)the definition of 'cssrule' in that specification. working draft obsoleted values charset_rule and unknown_rule.
added value namespace_rule. css animationsthe definition of 'cssrule' in that specification. working draft
added values keyframes_rule and keyframe_rule. css fonts module level 4the definition of 'cssrule' in that specification. working draft
added value font_feature_values_rule. css counter styles level 3the definition of 'cssrule' in that specification. can...
... css animationsthe definition of 'cssrule' in that specification. working draft
added values keyframes_rule and keyframe_rule. css fonts module level 4the definition of 'cssrule' in that specification. working draft
added value font_feature_values_rule. css counter styles level 3the definition of 'cssrule' in that specification. candidate recommendation
added value counter_style_rule. css conditional rules module level 3the definition of 'cssrule' in that specification. candidate recommendation
added value supports_rule. (document_rule has been pushed to css conditional rules level 4) document object model (dom) level 2 style specificationthe definition of 'cssrule' in that specification. obsolete initial definition. ...
CSSStyleSheet - Web APIs
s section for the various ways a cssstylesheet object can be obtained. properties inherits properties from its parent, stylesheet. cssrules read only returns a live cssrulelist which maintains an up-to-date list of the cssrule objects that comprise the stylesheet. this is normally used to access individual rules like this: stylesheet.cssrules[i] // where i = 0..cssrules.length-1 to
add or remove items in cssrules, use the cssstylesheet's insertrule() and deleterule() methods. ownerrule read only if this stylesheet is imported into the document using an @import rule, the ownerrule property returns the corresponding cssimportrule; otherwise, this property's value is null. methods inherits methods from its parent, stylesheet. deleterule() deletes the rule at the specif...
...e soon. rules read only the rules property is functionally identical to the standard cssrules property; it returns a live cssrulelist which maintains an up-to-date list of all of the rules in the style sheet. legacy methods these methods are legacy methods first introduced by microsoft; they should not be used if they can be avoided, but are not in danger of being removed anytime soon.
addrule()
adds a new rule to the stylesheet given the selector to which the style applies and the style block to apply to the matching elements. this differs from insertrule(), which simply takes the textual representation of the entire rule as a single string. removerule() functionally identical to deleterule(); removes the rule at the specified index from the stylesheet's rule list. note...
Determining the dimensions of elements - Web APIs
elp you make that decision. note that all these properties are read-only. if you want to set the width and height of an element, use width and height or the overriding min-width and max-width, and min-height and max-height properties. how much room does it use up? if you need to know the total amount of space an element occupies, including the width of the visible content, scrollbars (if any), p
adding, and border, you want to use the htmlelement.offsetwidth and htmlelement.offsetheight properties. most of the time these are the same as width and height of element.getboundingclientrect(), when there aren't any transforms applied to the element. in case of transforms, the offsetwidth and offsetheight returns the element's layout width and height, while getboundingclientrect() returns the rend...
...ment's layout width and height, while getboundingclientrect() returns the rendering width and height. as an example, if the element has width: 100px; and transform: scale(0.5); the getboundingclientrect() will return 50 as the width, while offsetwidth will return 100. what's the size of the displayed content? if you need to know how much space the actual displayed content takes up, including p
adding but not including the border, margins, or scrollbars, you want to use the element.clientwidth and element.clientheight properties: how big is the content? if you need to know the actual size of the content, regardless of how much of it is currently visible, you need to use the element.scrollwidth and element.scrollheight properties. these return the width and height of the entire content o...
CSS Painting API - Web APIs
rns the read-only values of the output bitmap's width and height. dictionaries paintrenderingcontext2dsettings a dictionary providing a subset of canvasrenderingcontext2d settings. examples to draw directly into an element's background using javascript in our css, we define a paint worklet using the registerpaint() function, tell the document to include the worklet using the paintworklet
addmodule() method, then include the image we created using the css paint() function. we create our paintworklet called 'hollowhighlights' using the registerpaint() function: registerpaint('hollowhighlights', class { static get inputproperties() { return ['--boxcolor']; } static get inputarguments() { return ['*','<length>']; } static get contextoptions() { return {alpha: true}; } pain...
...i> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> css.paintworklet.
addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); then we can use the <image> with the css paint() function: li { --boxcolor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowhighlights, filled, 3px); } li:nth-of-type(3n+1) {...
CSS Typed Object Model API - Web APIs
g one of the supplied values. stylepropertymap the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an alternative to cssstyledeclaration. stylepropertymap.set() method of stylepropertymap interface that changes the css declaration with the given property to the value given. stylepropertymap.append() method that
adds a new css declaration to the stylepropertymap with the given property and value. stylepropertymap.delete() method that removes the css declaration with the given property from the stylepropertymap. stylepropertymap.clear() method that removes all declarations in the stylepropertymap. cssunparsedvalue the cssunparsedvalue interface of the css typed object model api represents property valu...
...t take an image, for example background-image, list-style-image, or border-image-source. csskeywordvalue an interface which creates an object to represent css keywords and other identifiers. when used where a string is expected, it will return the value of csskeyword.value. cssnumericvalue an interface representing operations that all numeric values can perform, including: cssnumericvalue.
add -
adds supplied numbers to the cssnumericvalue. cssnumericvalue.sub - subtracts supplied numbers to the cssnumericvalue. cssnumericvalue.mul - multiplies supplied numbers to the cssnumericvalue. cssnumericvalue.div - divides a supplied number by other numbers, throwing an error if 0. cssnumericvalue.min - returns the minimum value passed cssnumericvalue.max - returns the maximum value p...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
lly, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. ...
...o the canvas context, and is rendered to a filled rectangle. html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // create a linear gradient // the start gradient point is at x=20, y=0 // the end gradient point is at x=220, y=0 var gradient = ctx.createlineargradient(20,0, 220,0); //
add three color stops gradient.
addcolorstop(0, 'green'); gradient.
addcolorstop(.5, 'cyan'); gradient.
addcolorstop(1, 'green'); // set the fill style and draw a rectangle ctx.fillstyle = gradient; ctx.fillrect(20, 20, 200, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.createlineargradient' in that specification. living stand...
CanvasRenderingContext2D.createRadialGradient() - Web APIs
is rendered to a filled rectangle. ...
...le. html <canvas id="canvas" width="200" height="200"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // create a radial gradient // the inner circle is at x=110, y=90, with radius=30 // the outer circle is at x=100, y=100, with radius=70 var gradient = ctx.createradialgradient(110,90,30, 100,100,70); //
add three color stops gradient.
addcolorstop(0, 'pink'); gradient.
addcolorstop(.9, 'white'); gradient.
addcolorstop(1, 'green'); // set the fill style and draw a rectangle ctx.fillstyle = gradient; ctx.fillrect(20, 20, 160, 160); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.createradialgradient' in that specification. living stand...
CanvasRenderingContext2D.lineTo() - Web APIs
like other methods that modify the current path, this method does not directly render anything. to draw the path onto a canvas, you can use the fill() or stroke() methods. syntax ctx.lineto(x, y); parameters x the x-axis coordinate of the line's end point. y the y-axis coordinate of the line's end point. return value undefined. examples drawing a straight line this example draws a straight line using the lineto() method. ...
... 50) and ends at (150, 100). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); // start a new path ctx.moveto(30, 50); // move the pen to (30, 50) ctx.lineto(150, 100); // draw a line to (150, 100) ctx.stroke(); // render the path result drawing connected lines each call of lineto() (and similar methods) automatically
adds to the current sub-path, which means that all the lines will all be stroked or filled together. this example draws a letter 'm' with a single contiguous line. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.moveto(90, 130); ctx.lineto(95, 25); ctx.lineto(150, 80); ctx.lineto(205, 25); ctx.lineto(210, 1...
Compositing example - Web APIs
nvas content.', 'the existing canvas content is kept where both the new shape and existing canvas content overlap. everything else is made transparent.', 'the existing content is kept where it doesn\'t overlap the new shape.', 'the existing canvas is only kept where it overlaps the new shape. the new shape is drawn behind the canvas content.', 'where both shapes overlap the color is determined by
adding color values.', 'only the new shape is shown.', 'shapes are made transparent where both overlap and drawn normal everywhere else.', 'the pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. a darker picture is the result.', 'the pixels are inverted, multiplied, and inverted again. a lighter picture is the result (opposite of multiply)', 'a combination of...
...alfwidth = width / 2; var rotate = (1 / 360) * math.pi * 2; // per degree var offset = 0; // scrollbar offset var oleft = -20; var otop = -20; for (var n = 0; n <= 359; n ++) { var gradient = ctx.createlineargradient(oleft + halfwidth, otop, oleft + halfwidth, otop + halfwidth); var color = color.hsv_rgb({ h: (n + 300) % 360, s: 100, v: 100 }); gradient.
addcolorstop(0, "rgba(0,0,0,0)"); gradient.
addcolorstop(0.7, "rgba("+color.r+","+color.g+","+color.b+",1)"); gradient.
addcolorstop(1, "rgba(255,255,255,1)"); ctx.beginpath(); ctx.moveto(oleft + halfwidth, otop); ctx.lineto(oleft + halfwidth, otop + halfwidth); ctx.lineto(oleft + halfwidth + 6, otop); ctx.fillstyle = gradient; ctx.fill();...
CharacterData - Web APIs
the characterdata abstract interface represents a node object that contains characters. this is an abstract interface, meaning there aren't any object of type characterdata: it is implemented by other interfaces, like text, comment, or processinginstruction which aren't abstract. ...
...h the specified domstring; when this method returns, data contains the modified domstring. characterdata.substringdata() returns a domstring containing the part of characterdata.data of the specified length and starting at the specified offset. specifications specification status comment domthe definition of 'characterdata' in that specification. living standard
added implemention of the childnode and nondocumenttypechildnode interface. document object model (dom) level 3 core specificationthe definition of 'characterdata' in that specification. obsolete no change from document object model (dom) level 2 core specification. document object model (dom) level 2 core specificationthe definition of 'characterdata' in that specification. ...
Client.postMessage() - Web APIs
sfer }]); parameters message the message to send to the client. this can be any structured-clonable type. transfer optional a sequence of objects that are transferred with the message. the ownership of these objects is given to the destination side and they are no longer usable on the sending side. return value undefined. examples sending a message from a service worker to a client:
addeventlistener('fetch', event => { event.waituntil(async function() { // exit early if we don't have access to the client. // eg, if it's cross-origin. if (!event.clientid) return; // get the client. const client = await clients.get(event.clientid); // exit early if we don't get the client. // eg, if it closed. if (!client) return; // send a message to the cl...
...tid) return; // get the client. const client = await clients.get(event.clientid); // exit early if we don't get the client. // eg, if it closed. if (!client) return; // send a message to the client. client.postmessage({ msg: "hey i just got a fetch from you!", url: event.request.url }); }()); }); receiving that message: navigator.serviceworker.
addeventlistener('message', event => { console.log(event.data.msg, event.data.url); }); specifications specification status comment service workersthe definition of 'postmessage()' in that specification. working draft initial definition. ...
Clients.openWindow() - Web APIs
el 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 previously
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 a prom...
...(windowc...
Clipboard - Web APIs
board's text once it's available. write() writes arbitrary data to the system clipboard. this asynchronous operation signals that it's finished by resolving the returned promise. writetext() writes text to the system clipboard, returning a promise which is resolved once the text is fully copied into the clipboard. clipboard availability the asynchronous clipboard api is a relatively recent
addition, and the process of implementing it in browsers is not yet complete. due to both potential security concerns and technical complexities, the process of integrating this api is happening gradually in most browsers. for example, firefox does not yet support the "clipboard-read" and "clipboard-write" permissions, so access to the methods that access and change the contents of the clipboard are...
...oard-write" permissions, so access to the methods that access and change the contents of the clipboard are restricted in other ways. for webextensions, you can request the clipboardread and clipboardwrite permissions to be able to use clipboard.readtext() and clipboard.writetext(). content scripts applied on http sites do not have access to the clipboard object. see extensions in firefox 63. in
addition, read() and write() are disabled by default and require changing a preference to enable them. check the compatibility tables for each method before using it. specifications specification status comment clipboard api and eventsthe definition of 'clipboard' in that specification. working draft initial definition. ...
Comment - Web APIs
nterface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. comments are represented in html and xml as content between '<!--' and '-->'. in xml, the character sequence '--' cannot be used within a comment. ...
...d indirectly those of node. constructor comment() returns a comment object with the parameter as its textual content. methods this interface has no specific method, but inherits those of its parent, characterdata, and indirectly those of node. specifications specification status comment domthe definition of 'comment' in that specification. living standard
added the constructor. document object model (dom) level 3 core specificationthe definition of 'comment' in that specification. obsolete no change from document object model (dom) level 2 core specification document object model (dom) level 2 core specificationthe definition of 'comment' in that specification. obsolete no change from document object model (dom) level 1 s...
Console.timeEnd() - Web APIs
specifications specification status comment console apithe definition of 'console.timeend()' in that specification. living standard initial definition ...
... specifications specification status comment console apithe definition of 'console.timeend()' in that specification. living standard initial definition ...
Console.timeLog() - Web APIs
specifications specification status comment console apithe definition of 'console.timelog()' in that specification. living standard initial definition ...
... specifications specification status comment console apithe definition of 'console.timelog()' in that specification. living standard initial definition ...
ConstantSourceNode - Web APIs
the constantsourcenode interface—part of the web audio api—represents an audio source (based upon audioscheduledsourcenode) whose output is single unchanging value. this makes it useful for cases in which you need a constant value coming in from an audio source. in
addition, it can be used like a constructible audioparam by automating the value of its offset or by connecting another node to it; see controlling multiple parameters with constantsourcenode. a constantsourcenode has no inputs and exactly one monaural (one-channel) output. the output's value is always the same as the value of the offset parameter. number of inputs 0 number of outputs 1 constructor constantsourcenode() creates and returns a new constantsourcenode instance, optionally specif...
...sourcenode() creates and returns a new constantsourcenode instance, optionally specifying an object which establishes initial values for the object's properties. you can also create a constantsourcenode whose properties are initialized to their default values by calling audiocontext.createconstantsource(). properties inherits properties from its parent interface, audioscheduledsourcenode, and
adds the following properties: offset an audioparam which specifies the value that this source continuously outputs. the default value is 1.0. event handlers inherits event handlers from its parent interface, audioscheduledsourcenode. some browsers' implementations of this event handler are part of the audioscheduledsourcenode interface. onended fired whenever the constantsourcenode da...
ConstrainDouble - Web APIs
the constraindouble type is used to specify a constraint for a property whose value is a double-precision floating-point number. it extends the doublerange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on.
additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constraindouble is an object rather than a number, it may have the properties below in
addition the properties it inherits from doublerange. exact a double-precision floating-point number specifying a specific, required, value the property mus...
...ly have, but which can be considered optional if necessary to find a match. specifications specification status comment media capture and streamsthe definition of 'constraindouble' in that specification. candidate recommendation initial definition technically, constraindouble is actually based on an intermediary dictionary named constraindoublerange, which
adds exact and ideal to doublerange, with constraindouble being a type that can be either a long integer or a doublerange. however, for the sake of documentation clarity, the intermediate type (present only because of quirks in webidl syntax) is ignored here. ...
ConstrainULong - Web APIs
the constrainulong type is used to specify a constraint for a property whose value is an integral number. it extends the ulongrange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. in
addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constrainulong is an object rather than a number, it may have the properties below in
addition to the properties it inherits from ulongrange. exact an integer specifying precise, required, value the property must have to be considered acceptable. ideal an integer specifying a va...
...eally have, but which can be considered optional if necessary to find a match. specifications specification status comment media capture and streamsthe definition of 'constrainulong' in that specification. candidate recommendation initial definition technically, constrainulong is actually based on an intermediary dictionary named constrainulongrange, which
adds exact and ideal to ulongrange, with constrainulong being a type that can be either a long integer or a ulongrange. however, for the sake of documentation clarity, the intermediate type (present only because of quirks in webidl syntax) is ignored here. ...
ContentIndexEvent - Web APIs
he id of the indexed content to be removed. the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. it is not fired when the contentindex.delete method is called. constructor contentindexevent() creates and returns a new contentindexevent object whose type and other options are configured as specified. properties in
addition to the properties listed below, this interface inherits the properties of its parent interface, extendableevent. id read only a string which identifies the deleted content index via it's id. methods while contentindexevent offers no methods of its own, it inherits any specified by its parent interface, extendableevent. examples this example shows the sevice worker script listen...
...f its parent interface, extendableevent. id read only a string which identifies the deleted content index via it's id. methods while contentindexevent offers no methods of its own, it inherits any specified by its parent interface, extendableevent. examples this example shows the sevice worker script listening for the contentdelete event and logs the removed content index id. self.
addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'contentindexevent' in that specification. unknown initial definition. ...
CustomElementRegistry.define() - Web APIs
; style.textcontent = '.wrapper {' + 'position: relative;' + '}' + '.info {' + 'font-size: 0.8rem;' + 'width: 200px;' + 'display: inline-block;' + 'border: 1px solid black;' + 'p
adding: 10px;' + 'background: white;' + 'border-radius: 10px;' + 'opacity: 0;' + 'transition: 0.6s all;' + 'position: absolute;' + 'bottom: 20px;' + 'left: 10px;' + 'z-index: 3;' ...
...constructor super(); // count words in element's parent element var wcparent = this.parentnode; function countwords(node){ var text = node.innertext || node.textcontent return text.split(/\s+/g).length; } var count = 'words: ' + countwords(wcparent); // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create text node and
add word count to it var text = document.createelement('span'); text.textcontent = count; // append it to the shadow root shadow.appendchild(text); // update count when element content changes setinterval(function() { var count = 'words: ' + countwords(wcparent); text.textcontent = count; }, 200) } } // define the new element customelements.define('word-...
DOMImplementation - Web APIs
ture is supported or not. this function is unreliable and kept for compatibility purpose alone: except for svg-related queries, it always returns true. old browsers are very inconsistent in their behavior. specifications specification status comment domthe definition of 'domimplementation' in that specification. living standard removed the getfeature() method.
added the createhtmldocument() method. modified the return type of createdocument() from document to xmldocument. document object model (dom) level 3 core specificationthe definition of 'domimplementation' in that specification. obsolete
added the getfeature() method (never implemented by any user agent). document object model (dom) level 2 core specificationthe definition...
...pe of createdocument() from document to xmldocument. document object model (dom) level 3 core specificationthe definition of 'domimplementation' in that specification. obsolete
added the getfeature() method (never implemented by any user agent). document object model (dom) level 2 core specificationthe definition of 'domimplementation' in that specification. obsolete
added the createdocument() and createdocumenttype() methods. document object model (dom) level 1 specificationthe definition of 'domimplementation' in that specification. obsolete initial definition. ...
DataTransfer.setData() - Web APIs
the datatransfer.setdata() method sets the drag operation's drag data to the specified data and type. if data for the given type does not exist, it is
added at the end of the drag data store, such that the last item in the types list will be the new type. if data for the given type already exists, the existing data is replaced in the same position. that is, the order of the types list is not changed when replacing data of the same type. example data types are text/plain and text/uri-list. syntax void datatransfer.setdata(format, data); arguments format a domstring representing the type of the drag data to
add to the drag object. data a domstring representing the data to
add to the drag object. return value void example this example shows the use of the datatransfer object'...
...ag object. data a domstring representing the data to
add to the drag object. return value void example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods. <!doctype html> <html lang=en> <title>examples of datatransfer's setdata(), getdata() and cleardata()</title> <meta content="width=device-width"> <style> div { margin: 0em; p
adding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </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. use the event target's id for the data ev.da...
DataTransferItemList.clear() - Web APIs
the clear() method. ...
...hen release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> css div { margin: 0em; p
adding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } javascript function dragstart_handler(ev) { console.log("dragstart"); //
add this element'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>... paragraph ...</p>", "text/html"); datalist.
add("http://www.example.org","text/uri-list"); } function drop_handler(ev) { console.log("dr...
DedicatedWorkerGlobalScope: message event - Web APIs
rker receives a message from its parent (i.e. when the parent sends a message using worker.postmessage()). ...
...no interface messageevent event handler property onmessage examples this code creates a new worker and sends it a message using worker.postmessage(): const worker = new worker("static/scripts/worker.js"); worker.
addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) }); the worker can listen for this message using
addeventlistener(): // inside static/scripts/worker.js self.
addeventlistener('message', (event) => { console.log(`received message from parent: ${event.data}`); }); alternatively, it could listen using the onmessage event handler property: // static/scripts/worker.js self.onmessage = (event) => { console.log(`received message from parent: ${event.data}`); }; specifications ...
DedicatedWorkerGlobalScope: messageerror event - Web APIs
the messageerror event is fired on a dedicatedworkerglobalscope object when it receives a message that can't be deserialized. ...
... the messageerror event is fired on a dedicatedworkerglobalscope object when it receives a message that can't be deserialized. ...
Document.createDocumentFragment() - Web APIs
syntax var fragment = document.createdocumentfragment(); value a newly created, empty, documentfragment object, which is ready to have nodes inserted into it. usage notes documentfragments are dom node objects which are never part of the main dom tree. the usual use case is to create the document fragment, append elements to the document fragment and then append the document fragment to the dom tree. in the dom tree, the document fragment is replaced by all its children. ...
...he main dom tree, appending children to it does not cause page reflow (computation of element's position and geometry). historically, using document fragments could result in better performance. you can also use the documentfragment constructor to create a new fragment: let fragment = new documentfragment(); example this example creates a list of major web browsers in a documentfragment, then
adds the new dom subtree to the document to be displayed. html <ul id="ul"> </ul> javascript var element = document.getelementbyid('ul'); // assuming ul exists var fragment = document.createdocumentfragment(); var browsers = ['firefox', 'chrome', 'opera', 'safari', 'internet explorer']; browsers.foreach(function(browser) { var li = document.createelement('li'); li.textcontent = brow...
Document.createProcessingInstruction() - Web APIs
new xmlserializer().serializetostring(doc)); // displays: <?xml-stylesheet href="mycss.css" type="text/css"?><foo/> specifications specification status comment domthe definition of 'createprocessinginstruction()' in that specification. living standard no change dom4the definition of 'createprocessinginstruction()' in that specification. ...
...cessinginstruction()' in that specification. living standard no change dom4the definition of 'createprocessinginstruction()' in that specification. obsolete
added more explicit definition of how the data parameter is validated. document object model (dom) level 3 core specificationthe definition of 'createprocessinginstruction()' in that specification. obsolete
added note that the namespace of the target name is not checked whether it is well-formed, defined what is considered an illegal character for the target name and specified the returned processinginstruction object more precisely. document object model (dom) level 2 core specificationthe definition of 'createprocessinginstruction()' in that specification. obsolete no change do...
Document.createTextNode() - Web APIs
creates a new text node. this method can be used to escape html characters. syntax var text = document.createtextnode(data); text is a text node. data is a string containing the data to be put in the text node. ...
...tetextnode(data); text is a text node. data is a string containing the data to be put in the text node. example <!doctype html> <html lang="en"> <head> <title>createtextnode example</title> <script> function
addtextnode(text) { var newtext = document.createtextnode(text), p1 = document.getelementbyid("p1"); p1.appendchild(newtext); } </script> </head> <body> <button onclick="
addtextnode('yes! ');">yes!</button> <button onclick="
addtextnode('no! ');">no!</button> <button onclick="
addtextnode('we can! ');">we can!</button> <hr /> <p id="p1">first line of paragraph.</p> </body> </html> specifications specification status comment domthe definition of 'document: createtextnode' in that specification. living standard ...
Document: keypress event - Web APIs
alue are modifier keys such as alt, shift, ctrl, or meta. since this event has been deprecated, you should look to use beforeinput or keydown instead. ...
... varies: keypress event; launch text composition system; blur and focus events; domactivate event; other event examples
addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key. ...
Document: keyup event - Web APIs
vents are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.
addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples this example logs the keyboardevent.code value whenever you release a key.
addeventlistener keyup example <p>focus the iframe first (e.g. by clicking in it), then try pressing some keys.</p> <p id="log"></p> const log = document.getelementbyid('log'); document...
...ventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples this example logs the keyboardevent.code value whenever you release a key.
addeventlistener keyup example <p>focus the iframe first (e.g. ...
Document.onafterscriptexecute - Web APIs
the document.onafterscriptexecute property references a function that fires when a static <script> element finishes executing its script. it does not fire if the element is
added dynamically, such as with appendchild(). syntax document.onafterscriptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the <script> element that just finished executing. ...
... script. it does not fire if the element is
added dynamically, such as with appendchild(). syntax document.onafterscriptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the <script> element that just finished executing. ...
Document.onbeforescriptexecute - Web APIs
fired when the code in a <script> element declared in an html document is about to start executing. does not fire if the element is
added dynamically, eg with appendchild(). syntax document.onbeforescriptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the script element that is about to be executed. ...
... start executing. does not fire if the element is
added dynamically, eg with appendchild(). syntax document.onbeforescriptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the script element that is about to be executed. ...
Document.ononline - Web APIs
the document.online event is fired on the <body> of each page when the browser switches between online and offline mode.
additionally, the events bubble up from document.body, to document, ending at window. both events are non-cancellable (you can't prevent the user from coming online, or going offline). 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. it is important to note that this event and attribute are inherently unreliable. ...
...r 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. it is important to note that this event and attribute are inherently unreliable. a computer can be connected to a network without having internet access. 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 function object. (note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup. example there's a simple test case that...
Document: pointercancel event - Web APIs
er started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. ...
...entally. this can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. ...
Document: pointerdown event - Web APIs
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. ...
...om 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). ...
...res 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. ...
... 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. ...
DynamicsCompressorNode - Web APIs
m representing the amount of time, in seconds, required to reduce the gain by 10 db. dynamicscompressornode.release read only is a k-rate audioparam representing the amount of time, in seconds, required to increase the gain by 10 db. methods no specific methods; inherits methods from its parent, audionode. example the below code demonstrates a simple usage of createdynamicscompressor() to
add compression to an audio track. for a more complete example, have a look at our basic compressor example (view the source code). // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a compressor node var compressor = audioctx.createdynamicscompressor(); compressor.threshold.setvalueattime(-50, audioctx.cur...
... working draft ...
EXT_blend_minmax - Web APIs
the ext_blend_minmax extension is part of the webgl api and extends blending capabilities by
adding two new blend equations: the minimum or maximum color components of the source and destination colors. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. the constants in webgl2 are gl.min and gl.max. ...
...rs. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. the constants in webgl2 are gl.min and gl.max. constants this extension
adds two new constants, which can be used in webglrenderingcontext.blendequation() and webglrenderingcontext.blendequationseparate(): ext.min_ext produces the minimum color components of the source and destination colors. ext.max_ext produces the maximum color components of the source and destination colors. examples var ext = gl.getextension('ext_blend_minmax'); gl.blendequation(ext.min_ex...
Element.animate() - Web APIs
ults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. you can also include a composite operation or iteration composite operation in your options list: composite optional determines how values are combined between this animation and other, separate animations that do not specify their own specific composite 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 previous value with the new one. ite...
... web animationsthe definition of 'animate()' in that specification. working draft initial definition ...
Element: auxclick event - Web APIs
istening for auxclick events originating on elements that do not support input or navigation, you will often want to explicitly prevent other default actions mapped to the down action of the middle mouse button. on windows this is usually autoscroll, and on macos and linux this is usually clipboard paste. this can be done by preventing the default behaviour of the mousedown or pointerdown event.
additionally, you may need to avoid opening a system context menu after a right click. due to timing differences between operating systems, this too is not a preventable default behavior of auxclick. instead, this can be done by preventing the default behavior of the contextmenu event. examples in this example we define functions for two event handlers — onclick and onauxclick. the former changes...
... html <button><h1>click me!</h1></button> css html { height: 100%; overflow: hidden; } body { height: inherit; display: flex; justify-content: center; align...
Element: click event - Web APIs
't typically interactive (e.g. <div>) and which also don't have event listeners directly attached to the elements themselves (i.e. event delegation is being used). see this live example for a demonstration. see also safari's docs on making elements clickable and the definition of "clickable element". known workarounds for this bug: set cursor: pointer; on the element or any of its ancestors.
add a dummy onclick="void(0)" attribute to the element or any of its ancestors up to but not including <body>. use a typically interactive element (e.g., <a>) instead of one that isn't typically interactive (e.g., <div>). stop using click event delegation. safari mobile considers the following elements to be typically interactive (and thus they aren't affected by this bug): <a> (but it must ha...
... (but it must have an href) <button> <img> <input> <label> (but it must be associated with a form control) <textarea> this list is incomplete; you can help mdn by doing further testing/research and expanding it. examples this example displays the number of consecutive clicks on a <button>. html <button>click</button> javascript const button = document.queryselector('button'); button.
addeventlistener('click', event => { button.innerhtml = `click count: ${event.detail}`; }); result try making rapid, repeated clicks on the button to increase the click count. if you take a break between clicks, the count will reset. specifications specification status ui events working draft document object model (dom) level 3 events specificationthe definiti...
Element.clientHeight - Web APIs
when clientheight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. this is a special case of clientheight. ...
... when clientheight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. this is a special case of clientheight. ...
Element.computedStyleMap() - Web APIs
a stylepropertymapreadonly interface which provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. syntax var stylepropertymapreadonly = element.computedstylemap() parameters none. return value a stylepropertymapreadonly interface. examples we start with some simple html: a paragraph with a link, and a definition list to which we will
add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we
add a little bit of css a { --colour: red; color: var(--colour); } we
add javascript to grab our link and return back a definition list of all the css property values using computedstylemap(). // get the element const myelement = document.queryselector('a'); // get the ...
... list of all the css property values using computedstylemap(). ...
Element: copy event - Web APIs
d data. it's possible to construct and dispatch a synthetic copy event, but this will not affect the system clipboard. ...
...ve 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 { border: 1px solid gray; margin: .5rem; p
adding: .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.preventdefault(); }); result specifications specification status clipboard api and events working draft ...
Element: cut event - Web APIs
construct and dispatch a synthetic cut event, but this will not affect the system clipboard or the document's contents. ...
...ve example html <div class="source" contenteditable="true">try cutting text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; p
adding: .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.preventdefault(); }); result specifications specification status clipboard api and events working draft ...
Element: dblclick event - Web APIs
of time. dblclick fires after two click events (and by extension, after two pairs of mousedown and mouseup events). bubbles yes cancelable yes interface mouseevent event handler property ondblclick examples this example toggles the size of a card when you double click on it. ...
... examples this example toggles the size of a card when you double click on it. javascript const card = document.queryselector('aside'); card.
addeventlistener('dblclick', function (e) { card.classlist.toggle('large'); }); html <aside> <h3>my card</h3> <p>double click to resize this object.</p> </aside> css aside { background: #fe9; border-radius: 1em; display: inline-block; p
adding: 1em; transform: scale(.9); transform-origin: 0 0; transition: transform .6s; } .large { transform: scale(1.3); } result specifications specification status ui eventsthe definition of 'dblclick' in that specification. working draft document object model (dom) level 3 events specificationthe definition of 'dblclick' in that specification. obsole...
Element.getElementsByClassName() - Web APIs
or more class names to match on, separated by whitespace. return value an htmlcollection providing a live-updating list of every element which is a member of every class in names. usage notes as always, the returned collection is live, meaning that it always reflects the current state of the dom tree rooted at the element on which the function was called. as new elements that match names are
added to the subtree, they immediately appear in the collection. similarly, if an existing element that doesn't match names has its set of classes adjusted so that it matches, it immediately appears in the collection. the opposite is also true; as elements no longer match the set of names, they are immediately removed from the collection. in quirks mode, the class names are compared in a case-inse...
...rned htmlcollection or standard array syntax to examine individual elements in the collection. however the following code will not work as one might expect because "matches" will change as soon as any "colorbox" class is removed. var matches = element.getelementsbyclassname('colorbox'); for (var i=0; i<matches.length; i++) { matches[i].classlist.remove('colorbox'); matches.item(i).classlist.
add('hueframe'); } instead, use another method, such as: var matches = element.getelementsbyclassname('colorbox'); while (matches.length > 0) { matches.item(0).classlist.
add('hueframe'); matches[0].classlist.remove('colorbox'); } this code finds descendant elements with the "colorbox" class,
adds the class "hueframe", by calling item(0), then removes "colorbox" (using array notation). anothe...
Element.insertAdjacentElement() - Web APIs
syntaxerror the position specified is not a recognised value. typeerror the element specified is not a valid element. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. ...
... afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. example beforebtn.
addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('beforebegin',tempdiv); } setlistener(tempdiv); }); afterbtn.
addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('afterend',tempdiv); } setlistener(tempdiv); }); have a look at our insertadjacentelement.html demo on github (see the source code too.) here we have a sequence of <div> elements inside a container. when on...
Element.insertAdjacentText() - Web APIs
ue void. exceptions exception explanation syntaxerror the position specified is not a recognised value. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. example beforebtn.
addeventlistener('click', function() { para.insertadjacenttext('afterbegin',textinput.value); }); afterbtn.
addeventlistener('click', function() { para.insertadjacenttext('beforeend',textinput.value); }); have a look at our insertadjacenttext.html demo on github (see the source code too.) here we have a simple paragraph. you can enter some text into the form element, then press the insert before...
...a.insertadjacenttext('beforeend',textinput.value); }); have a look at our insertadjacenttext.html demo on github (see the source code too.) here we have a simple paragraph. you can enter some text into the form element, then press the insert before and insert after buttons to insert it before or after the existing paragraph text using insertadjacenttext(). note that the existing text node is not
added to — further text nodes are created containing the new
additions. polyfill you can polyfill the insertadjacenttext() method in internet explorer 5.5 (maybe earlier) and higher with the following code: if (!element.prototype.insertadjacenttext) element.prototype.insertadjacenttext = function(type, txt){ this.insertadjacenthtml( type, (txt+'') // convert to string .
Element: keydown event - Web APIs
nts are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.
addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples
addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element. <input placeholder="click here, then press down a key." size="40"> <p id="log"></p> const input = document.queryselector(...
...| event.keycode === 229) { return; } // do something }); examples
addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element. ...
Element: keypress event - Web APIs
alue are modifier keys such as alt, shift, ctrl, or meta. since this event has been deprecated, you should look to use beforeinput or keydown instead. ...
... examples
addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key after focussing the <input> element. ...
Element: keyup event - Web APIs
vents are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.
addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples
addeventlistener keyup example this example logs the keyboardevent.code value whenever you release a key inside the <input> element. <input placeholder="click here, then press and release a key." size="40"> <p id="log"></p> const input = document.queryselector(...
...event.keycode === 229) { return; } // do something }); examples
addeventlistener keyup example this example logs the keyboardevent.code value whenever you release a key inside the <input> element. ...
Element: mouseover event - Web APIs
seevent event handler property onmouseover examples the following example illustrates the difference between mouseover and mouseenter events. ...
... working draft ...
Element: overflow event - Web APIs
proprietary event specific to gecko (firefox). ...
...tyle> #wrapper { width: 20px; height: 20px; background: #000; p
adding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.
addeventlistener("overflow", function( event ) { console.log( event ); }, false); wrapper.
addeventlistener("underflow", function( event ) { console.log( event ); }, false); toggle.
addeventlistener("change", function( event ) { if ( event.target.checked ) { child.style.width = "40px"; child.style.height = "40px"; } else { child.style.widt...
Element: paste event - Web APIs
lly. it's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. ...
...ve 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 { border: 1px solid gray; margin: .5rem; p
adding: .5rem; height: 1rem; background-color: #e9eef1; } js const target = document.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.preventdefault(); }); result specific...
Element.scrollTop - Web APIs
an be set to any integer value, with certain caveats: if the element can't be scrolled (e.g. it has no overflow or if the element has a property of "non-scrollable"), scrolltop is 0. scrolltop doesn't respond to negative values; instead, it sets itself back to 0. if set to a value greater than the maximum available for the element, scrolltop settles itself to the maximum value. example p
adding-top if you can see this, scrolltop = 0 lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. if you can see this, scrolltop is > 0 duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugi...
... ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. if you can see this, scrolltop is > 0 duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. if you can see this, scrolltop is maxed-out p
adding-bottom left top right bottom margin-top margin-bottom border-top border-bottom specifications specification status comment css object model (cssom) view modulethe definition of 'scrolltop' in that specification. working draft ...
Element.shadowRoot - Web APIs
syntax var shadowroot = element.shadowroot; value a shadowroot object instance, or null if the associated shadow root was attached with its mode set to closed. (see element.attachshadow() for further details). examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes. ...
... and color specified in the element's attributes. inside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. connectedcallback() { console.log('custom square element
added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot. from here we use standard dom traversal techniques to find the <style> element inside the shadow dom and then update the cs...
Element: underflow event - Web APIs
overflow event is fired when overflow occurs. ...
...tyle> #wrapper { width: 20px; height: 20px; background: #000; p
adding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.
addeventlistener("overflow", function( event ) { console.log( event ); }, false); wrapper.
addeventlistener("underflow", function( event ) { console.log( event ); }, false); toggle.
addeventlistener("change", function( event ) { if ( event.target.checked ) { child.style.width = "40px"; child.style.height = "40px"; } else { child.style.widt...
ErrorEvent - Web APIs
the errorevent interface represents events providing information related to errors in scripts or in files. ...
...rred. errorevent.error read only is a javascript object that is concerned by the event. constructor errorevent() creates an errorevent event with the given parameters. methods inherits methods from its parent event. specifications specification status comment html living standardthe definition of 'errorevent' in that specification. living standard
added the error property and the 5th parameter to the constructor. html5the definition of 'errorevent' in that specification. recommendation initial definition. ...
Event - Web APIs
r interfaces based on the main event interface. event itself contains the properties and methods which are common to all events. many dom elements can be set up to accept (or "listen" for) these events, and execute code in response to process (or "handle") them. event-handlers are usually connected (or "attached") to various html elements (such as <button>, <div>, <span>, etc.) using eventtarget.
addeventlistener(), and this generally replaces using the old html event handler attributes. further, when properly
added, such handlers can also be disconnected if needed using removeeventlistener(). note: one element can have several such handlers, even for the exact same event—particularly if separate, independent code modules attach them, each for its own independent purposes. (for example, a...
...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.timestamp read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in
addition, work is underway to change this to be a domhighrestimestamp instead. event.type read only the name of the event. case-insensitive. event.istrusted read only indicates whether or not the event was initiated by the browser (after a user click, for instance) or by a script (using an event creation method, like event.initevent). deprecated properties event.scoped read only a bool...
EventListener - Web APIs
his is shown in the example below. properties this interface neither implements, nor inherits, any properties. methods this interface doesn't inherit any methods. eventlistener.handleevent() a function that is called whenever an event of the specified type occurs. example html <button id="btn">click here!</button> javascript const buttonelement = document.getelementbyid('btn'); //
add a handler for the 'click' event by providing a callback function. // whenever the element is clicked, a pop-up with "element clicked!" will // appear. buttonelement.
addeventlistener('click', function (event) { alert('element clicked through function!'); }); // for compatibility, a non-function object with a `handleevent` property is // treated just the same as a function itself. buttonelement.
... a handler for the 'click' event by providing a callback function. // whenever the element is clicked, a pop-up with "element clicked!" will // appear. buttonelement.
addeventlistener('click', function (event) { alert('element clicked through function!'); }); // for compatibility, a non-function object with a `handleevent` property is // treated just the same as a function itself. buttonelement.
addeventlistener('click', { handleevent: function (event) { alert('element clicked through handleevent property!'); } }); result see also:
addeventlistener specifications specification status comment domthe definition of 'eventlistener' in that specification. living standard no change. document object model (dom) level 2 events specificati...
ExtendableMessageEvent - Web APIs
ssociated message channel. methods inherits methods from its parent, extendableevent. examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then calls its postmessage() function. ...
...r.serviceworker.
addeventlistener('message', event => { // event is a messageevent object console.log(`the service worker sent me a message: ${event.data}`); }); navigator.serviceworker.ready.then( registration => { registration.active.postmessage("hi service worker"); }); } the service worker can receive the message by listening to the message event: // in the service worker
addeventlistener('message', event => { // event is an extendablemessageevent object console.log(`the client sent me a message: ${event.data}`); event.source.postmessage("hi client"); }); specifications specification status comment service workersthe definition of 'extendablemessageevent' in that specification. working draft initial definition. ...
FetchEvent.replacesClientId - Web APIs
the replacesclientid read-only property of the fetchevent interface is the id of the client that is being replaced during a page navigation. for example, when navigating from page a to page b replacesclientid is the id of the client associated with page a. it can be an empty string when navigating from about:blank to another page, as about:blank's client will be reused, rather than be replaced. ...
... about:blank to another page, as about:blank's client will be reused, rather than be replaced.
additionally, if the fetch isn't a navigation, replacesclientid will be an empty string. this could be used to access/communicate with a client that will imminently be replaced, right before a navigation. syntax var myreplacedclientid = fetchevent.replacesclientid; value a domstring. example self.
addeventlistener('fetch', function(event) { console.log(event.replacesclientid); }); specifications specification status comment service workersthe definition of 'replacesclientid' in that specification. working draft initial definition. ...
FetchEvent - Web APIs
the lifetime of the event. used to notify the browser of tasks that extend beyond the returning of a response, such as streaming and caching. examples this 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; // prevent 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.reque...
...ndle 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. event.waituntil(cache.
add(event.request)); return cachedresponse; } // if we didn't find a match in the cache, use the network. return fetch(event.request); }()); }); specifications specification status comment service workersthe definition of 'fetchevent()' in that specification. working draft initial definition. ...
FileError - Web APIs
represents an error that occurs while using the filereader interface. note: this interface is obsolete per the latest specification. use the new dom4 domerror interface instead. in the file system api, a fileerror represents error conditions that you might encounter while accessing the file system using the asynchronous api. it extends the fileerror interface described in file writer and
adds several new error codes. fileerror objects are passed to error callbacks. the objects have a code that shows the type of error that occurred. best practices most people don't read the page on errors and exceptions unless they're stumped. so the following are a few tips that could help you avoid some pitfalls. error callbacks are not optional for your sanity although error callbacks are option...
...ped. so the following are a few tips that could help you avoid some pitfalls. error callbacks are not optional for your sanity although error callbacks are optional, you should include them in the arguments of the methods for the sake of the sanity of your users. a web app could fail for various reasons, so you don't want to spend the rest of your day guessing what's going on and going through m
addening troubleshooting. don't run your app from file:// for security reasons, browsers do not allow you to run your app from file://. in fact, many of the powerful storage apis (such as file system, blobbuilder, and filereader) throw errors if you run the app locally from file://. when you're just testing your app, and you don't want to set up a web server, you can bypass the security restriction...
FileException - Web APIs
to simplify things a bit, wrap your worker code in a try/catch. ...
...to simplify things a bit, wrap your worker code in a try/catch. ...
FileReader: error event - Web APIs
as not found or not readable). ...
...operty filereader.onerror examples const fileinput = document.queryselector('input[type="file"]'); const reader = new filereader(); function handleselected(e) { const selectedfile = fileinput.files[0]; if (selectedfile) { reader.
addeventlistener('error', () => { console.error(`error occurred reading file: ${selectedfile.name}`); }); reader.
addeventlistener('load', () => { console.error(`file: ${selectedfile.name} read successfully`); }); reader.readasdataurl(selectedfile); } } fileinput.
addeventlistener('change', handleselected); specifications specification status file api working draft ...
FileReader.readAsDataURL() - Web APIs
eader.readasdataurl(blob); parameters blob the blob or file from which to read. ...
...iles()" multiple> <div id="preview"></div> javascript function previewfiles() { var preview = document.queryselector('#preview'); var files = document.queryselector('input[type=file]').files; function readandpreview(file) { // make sure `file.name` matches our extensions criteria if ( /\.(jpe?g|png|gif)$/i.test(file.name) ) { var reader = new filereader(); reader.
addeventlistener("load", function () { var image = new image(); image.height = 100; image.title = file.name; image.src = this.result; preview.appendchild( image ); }, false); reader.readasdataurl(file); } } if (files) { [].foreach.call(files, readandpreview); } } note: the filereader() constructor was not supported by internet ex...
FileReader - Web APIs
h time the reading is starting. filereader.onloadend a handler for the loadend event. this event is triggered each time the reading operation is completed (either in success or failure). filereader.onprogress a handler for the progress event. this event is triggered while reading a blob content. as filereader inherits from eventtarget, all those events can also be listened for by using the
addeventlistener method. methods filereader.abort() aborts the read operation. upon return, the readystate will be done. filereader.readasarraybuffer() starts reading the contents of the specified blob, once finished, the result attribute contains an arraybuffer representing the file's data. filereader.readasbinarystring() starts reading the contents of the specified blob, once finished, t...
...dasdataurl() starts reading the contents of the specified blob, once finished, the result attribute contains a data: url representing the file's data. filereader.readastext() starts reading the contents of the specified blob, once finished, the result attribute contains the contents of the file as a text string. an optional encoding name can be specified. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when a read has been aborted, for example because the program called filereader.abort(). also available via the onabort property. error fired when the read failed due to an error. also available via the onerror property. load fired when a read has completed successfully. also ava...
FileSystemDirectoryEntry.getDirectory() - Web APIs
filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. example in this example, a function is presented whose job it is to locate within a user's app data directory a json file containing a user dictionary for a specified language, then load that dictionary. ...
...y for a specified language, then load that dictionary. let dictionary = null; function lo
addictionaryforlanguage(appdatadirentry, lang) { dictionary = null; appdatadirentry.getdirectory("dictionaries", {}, function(direntry) { direntry.getfile(lang + "-dict.json", {}, function(fileentry) { fileentry.file(function(dictfile)) { let reader = new filereader(); reader.
addeventlistener("loadend", function() { dictionary = json.parse(reader.result); }); reader.readastext(dictfile); }); }); }); } the lo
addictionaryforlanguage() function starts by using getdirectory() to obtain the filesystemdirectoryentry object representing a subfolder named "dictionaries" located inside the specified app data directory. the success callback ...
FileSystemDirectoryEntry.getFile() - Web APIs
filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. example in this example, a function is presented whose job it is to locate within a user's app data directory a json file containing a user dictionary for a specified language, then load that dictionary. ...
...y for a specified language, then load that dictionary. let dictionary = null; function lo
addictionaryforlanguage(appdatadirentry, lang) { dictionary = null; appdatadirentry.getdirectory("dictionaries", {}, function(direntry) { direntry.getfile(lang + "-dict.json", {}, function(fileentry) { fileentry.file(function(dictfile)) { let reader = new filereader(); reader.
addeventlistener("loadend", function() { dictionary = json.parse(reader.result); }); reader.readastext(dictfile); }); }); }); } the lo
addictionaryforlanguage() function starts by using getdirectory() to obtain the filesystemdirectoryentry object representing a subfolder named "dictionaries" located inside the specified app data directory. the success callback ...
Introduction to the File and Directory Entries API - Web APIs
the file and directory entries api simulates a local file system that web apps can navigate around. you can develop apps that can read, write, and create files and directories in a sandboxed, virtual file system. the file and directory entries api interacts with other related apis. it was built on the file writer api, which, in turn, was built on file api. each of the apis
adds different functionality. these apis are a giant evolutionary leap for web apps, which can now cache and process large amounts of data. about this document this introduction discusses essential concepts and terminology in the file and directory entries api. it gives you the big picture and orients you to key concepts. it also describes restrictions that raise security errors if you ignore them. to learn m...
... the file and directory entries api and other storage apis the file and directory entries api is an alternative to other storage apis like indexeddb, websql (which has been deprecated since november18, 2010), and appcache. the api is a better choice for apps that deal with blobs for the following reasons: the file and directory entries api offers client-side storage for use cases that are not
addressed by databases. if you want to have large mutable chunks of data, the file and directory entries api is a much more efficient storage solution than a database. while firefox supports blob storage for indexeddb, chrome currently does not (chrome is still implementing support for blob storage in indexeddb). if you are targeting chrome for your app and you want to store blobs, the file and dire...
FormData - Web APIs
ssion. an object implementing formdata can directly be used in a for...of structure, instead of entries(): for (var p of myformdata) is equivalent to for (var p of myformdata.entries()). note: this feature is available in web workers. constructor formdata() creates a new formdata object. methods formdata.append() appends a new value onto an existing key inside a formdata object, or
adds the key if it does not already exist. formdata.delete() deletes a key/value pair from a formdata object. formdata.entries() returns an iterator allowing to go through all key/value pairs contained in this object. formdata.get() returns the first value associated with a given key from within a formdata object. formdata.getall() returns an array of all the values associated with a given ke...
...ormdata.getall() returns an array of all the values associated with a given key from within a formdata. formdata.has() returns a boolean stating whether a formdata object contains a certain key. formdata.keys() returns an iterator allowing to go through all keys of the key/value pairs contained in this object. formdata.set() sets a new value for an existing key inside a formdata object, or
adds the key/value if it does not already exist. formdata.values() returns an iterator allowing to go through all values contained in this object. specifications specification status comment xmlhttprequestthe definition of 'formdata' in that specification. living standard formdata defined in xhr spec ...
FormDataEvent.formData - Web APIs
the formdata read only property of the formdataevent interface contains the formdata object representing the data contained in the form when the event was fired. syntax formdata = formdataevent.formdata returns a formdata object. ...
...nt.formdata returns a formdata object. ...
FormDataEvent - Web APIs
mdataevent object instance. properties inherits properties 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. ...
...ethods from its parent interface, event. ...
Gamepad - Web APIs
properties gamepad.axes read only an array representing the controls with axes present on the device (e.g. ...
...e access to experimental features like haptic feedback and webvr controller pose information. gamepad.hand read only an enum defining what hand the controller is being held in, or is most likely to be held in. gamepad.hapticactuators read only an array containing gamepadhapticactuator objects, each of which represents haptic feedback hardware available on the controller. example 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, e.gamepad.axes.length); }); specifications specification status comment gamepadthe definition of 'gamepad' in that specification. working draft initial definition gamepad extens...
GamepadEvent.gamepad - Web APIs
%d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); value a gamepad object. ...
...%d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); value a gamepad object. ...
GamepadEvent - Web APIs
the gamepadevent interface of the gamepad api contains references to gamepads connected to the system, which is what the gamepad events window.gamepadconnected and window.gamep
addisconnected are fired in response to. constructor gamepadevent() returns a new gamepadevent object. properties gamepadevent.gamepad read only returns a gamepad object, providing access to the associated gamepad data for the event fired. examples the gamepad property being called on a fired window.gamepadconnected event. window.
addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. ...
...providing access to the associated gamepad data for the event fired. examples the gamepad property being called on a fired window.gamepadconnected event. 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, e.gamepad.axes.length); }); and on a window.gamep
addisconnected event. window.
addeventlistener("gamep
addisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); specifications specification status comment gamepadthe definition of 'gamepadevent' in that specification. working draft initial definition browser compatibility desktopmobilechromeedge...
GeolocationCoordinates.longitude - Web APIs
's location and display the resulting coordinates once they're returned. javascript the javascript code below creates an event listener so that when the user clicks on a button, the location information is retrieved and displayed. ...
...when the user clicks the button, we'll fetch and display the location information. upon receiving a click event, we call getcurrentposition() to request the device's current position. this is an asynchronous request, so we provide a callback which receives as in put a geolocationposition object describing the determined position. from the geolocationposit...
Using the Geolocation API - Web APIs
message that describes what the error code means. you could use it like so: function errorcallback(error) { alert(`error(${error.code}): ${error.message}`); }; examples in the following example the geolocation api is used to retrieve the user's latitude and longitude. if sucessful, the available hyperlink is populated with an openstreetmap.org url that will show their location. ...
...e: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve your location'; } if(!navigator.geolocation) { status.textcontent = 'geolocation is not supported by your browser'; } else { status.textcontent = 'locating…'; navigator.geolocation.getcurrentposition(success, error); } } document.queryselector('#find-me').
addeventlistener('click', geofindme); result ...
GlobalEventHandlers.onclick - Web APIs
the onclick property of the globaleventhandlers mixin is the eventhandler for processing click events on a given element. the click event is raised when the user clicks on an element. it fires after the mousedown and mouseup events, in that order. note: when using the click event to trigger an action, also consider
adding this same action to the keydown event, to allow the use of that same action by people who don't use a mouse or a touch screen. syntax target.onclick = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. within the function, this will be the element upon which the event was triggered. only one onclick handler can be assigned to an object at a time. you may prefer to use the eventt...
...ple who don't use a mouse or a touch screen. syntax target.onclick = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. within the function, this will be the element upon which the event was triggered. only one onclick 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 detecting clicks this example simply changes the color of an element when it's clicked upon. html <div id="demo">click here</div> javascript document.getelementbyid('demo').onclick = function changecontent() { document.getelementbyid('demo').innerhtml = "help me"; document.getelementbyid('demo').style = "color: red"; ...
GlobalEventHandlers.oncontextmenu - Web APIs
use button is clicked on the window. unless the default behavior is prevented, 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 prevents 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.preventdefault(); } result pausing an animation this example pauses a spi...
... } to { transform: rotate(1turn); } } .shape { width: 8em; height: 8em; display: flex; align-items: center; justify-content: center; animation: spin 18s linear infinite; background: lightsalmon; border-radius: 42%; margin: 1em; } .paused { background-color: #ddd; } .paused .shape { animation-play-state: paused; } javascript function pause(e) { body.classlist.
add('paused'); note.removeattribute('hidden'); } function play(e) { body.classlist.remove('paused'); note.setattribute('hidden', ''); } const body = document.queryselector('body'); const note = document.queryselector('.note'); window.oncontextmenu = pause; window.onpointerdown = play; result specifications specification status comment html living standardthe defi...
GlobalEventHandlers.onloadstart - Web APIs
handler representing the code to be called when the loadstart event is raised (when progress has begun on the loading of a resource.) syntax img.onloadstart = funcref; value funcref is the handler function to be called when the resource's loadstart event fires. ...
...en progress has begun on the loading of a resource.) syntax img.onloadstart = funcref; value funcref is the handler function to be called when the resource's loadstart event fires. examples html content <img src="myimage.jpg"> javascript content // 'loadstart' fires first, then 'load', then 'loadend' image.
addeventlistener('load', function(e) { console.log('image loaded'); }); image.
addeventlistener('loadstart', function(e) { console.log('image load started'); }); image.
addeventlistener('loadend', function(e) { console.log('image load finished'); }); specifications specification status comment html living standardthe definition of 'onloadstart' in that specification. living standard initial definition ...
GlobalEventHandlers.ontransitioncancel - Web APIs
tion-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. in
addition, we also use a click event to make the box dissappear (display: none;), showing how it triggers the transitioncancel event to fire. html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such. <div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size chan...
...<div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size change, and causes the box to rotate, while the mouse cursor hovers over it. ...
HTMLAudioElement - Web APIs
the htmlaudioelement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. it's based on, and inherits properties and methods from, the htmlmediaelement interface. ...
...n page load. modern browser's default autoplay policy will block that from happening. refer to firefox and chrome for best practices and work arounds. some of the more commonly used properties of the audio element include src, currenttime, duration, paused, muted, and volume. this snippet copies the audio file's duration to a variable: var audioelement = new audio('car_horn.wav'); audioelement.
addeventlistener('loadeddata', () => { let duration = audioelement.duration; // the duration variable now holds the duration (in seconds) of the audio clip }) events inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. listen to events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. specifications ...
HTMLBodyElement - Web APIs
the htmlbodyelement interface provides special properties (beyond those inherited from the regular htmlelement interface) for manipulating <body> elements. ...
...n moved to windoweventhandlers. htmlbodyelement implements this interface. html 5.1the definition of 'htmlbodyelement' in that specification. recommendation html5the definition of 'htmlbodyelement' in that specification. recommendation the following properties are now obsolete: alink, bgcolor, background, link, text, and vlink. the following properties have been
added: onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload. 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 obj...
HTMLDetailsElement: toggle event - Web APIs
ethius' reproaches, and proves that the gifts of fortune are hers to give and to take away. </details> <details id="ch3"> <summary>chapter iii</summary> boethius falls back upon his present sense of misery. philosophy reminds him of the brilliancy of his former fortunes. ...
... living standard ...
HTMLDetailsElement - Web APIs
the htmldetailselement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <details> elements. ...
...: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmldetailselement.open is a boolean reflecting the open html attribute, indicating whether or not the element’s contents (not counting the <summary>) is to be shown to the user. methods no specific method; inherits methods from its parent, htmlelement. events listen to this event using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. toggle fired when the open/closed state of a <details> element is toggled. specifications specification status comment html living standardthe definition of 'htmldetailselement' in that specification. candidate recommendation ...
HTMLDialogElement: cancel event - Web APIs
nt handler oncancel examples live example html <dialog class="example-dialog"> <button class="close" type="reset">close</button> </dialog> <button class="open-dialog">open dialog</button> <div class="result"></div> css button, div { margin: .5rem; } js const result = document.queryselector('.result'); const dialog = document.queryselector('.example-dialog'); dialog.
addeventlistener('cancel', (event) => { result.textcontent = 'dialog was canceled'; }); const opendialog = document.queryselector('.open-dialog'); opendialog.
addeventlistener('click', () => { if (typeof dialog.showmodal === 'function') { dialog.showmodal(); result.textcontent = ''; } else { result.textcontent = 'the dialog api is not supported by this browser'; } }); const...
... living standard ...
HTMLDialogElement: close event - Web APIs
ler property onclose examples live example html <dialog class="example-dialog"> <button class="close" type="reset">close</button> </dialog> <button class="open-dialog">open dialog</button> <div class="result"></div> css button, div { margin: .5rem; } js const result = document.queryselector('.result'); const dialog = document.queryselector('.example-dialog'); dialog.
addeventlistener('close', (event) => { result.textcontent = 'dialog was closed'; }); const opendialog = document.queryselector('.open-dialog'); opendialog.
addeventlistener('click', () => { if (typeof dialog.showmodal === 'function') { dialog.showmodal(); result.textcontent = ''; } else { result.textcontent = 'the dialog api is not supported by this browser'; } }); const ...
... living standard ...
HTMLDialogElement - Web APIs
the htmldialogelement interface provides methods to manipulate <dialog> elements. it inherits properties and methods from the htmlelement interface. ...
...'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.
addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.
addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script> note: you can find this example on github as htmldialogelement-basic (see it live also)...
HTMLElement: change event - Web APIs
try entering something into the field below, and then click somewhere else to trigger the event. html <i...
...ment for some elements, including <input type="text">, the change event doesn't fire until the control loses focus. try entering something into the field below, and then click somewhere else to trigger the event. html <input placeholder="enter some text" name="name"/> <p id="log"></p> javascript const input = document.queryselector('input'); const log = document.getelementbyid('log'); input.
addeventlistener('change', updatevalue); function updatevalue(e) { log.textcontent = e.target.value; } result specifications specification status html living standardthe definition of 'change' in that specification. living standard ...
HTMLElement.hidden - Web APIs
ents which are. syntax ishidden = htmlelement.hidden; htmlelement.hidden = true | false; value a boolean which is true if the element is hidden from view; otherwise, the value is false. example here's an example where a hidden block is used to contain a thank you message that is displayed after a user agrees to an unusual request. javascript document.getelementbyid("okbutton") .
addeventlistener("click", function() { document.getelementbyid("welcome").hidden = true; document.getelementbyid("awesome").hidden = false; }, false); this code sets up a handler for the welcome panel's "ok" button that hides the welcome panel and makes the follow-up panel—with the curious name "awesome"—visible in its place. html the html for the two boxes are shown here. the welcome pan...
...looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for agreeing to be awesome today! now get out there and do awesome things awesomely to make the world more awesome!</p> </div> css the content is styled using the css below. .panel { font: 16px "open sans", helvetica, arial, sans-serif; border: 1px solid #22d; p
adding: 12px; width: 500px; text-align: center; } .button { font: 22px "open sans", helvetica, arial, sans-serif; p
adding: 5px 36px; } h1 { margin-top: 0; font-size: 175%; } result specifications specification status comment html living standardthe definition of 'htmlelement.hidden' in that specification. living standard html 5.1the definiti...
HTMLElement: pointercancel event - Web APIs
er started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. ...
...e, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. ...
HTMLElement: pointerdown event - Web APIs
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. ...
... button depressed. for touch, it is fired when physical contact is made with the digitizer. for pen, it is fired when the stylus makes physical contact with the digitizer. ...
HTMLElement: 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). ...
...o 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. ...
...nting 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: pointerout event - Web APIs
st 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. ...
...that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer. ...
HTMLElement: pointerover event - Web APIs
the pointerover event is fired when a pointing device is moved into an element's hit test boundaries. ...
... the pointerover event is fired when a pointing device is moved into an element's hit test boundaries. ...
HTMLFieldSetElement - Web APIs
the htmlfieldsetelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. ...
... specification status comment html living standardthe definition of 'htmlfieldsetelement' in that specification. living standard html 5.1the definition of 'htmlfieldsetelement' in that specification. recommendation html5the definition of 'htmlfieldsetelement' in that specification. recommendation the following properties have been
added: disabled, elements, name, type, valdiationmessage, validity, and willvalidate. the following methods have been
added: checkvalidity(), setcustomvalidity(). document object model (dom) level 2 html specificationthe definition of 'htmlfieldsetelement' in that specification. obsolete no change document object model (dom) level 1 specificationthe definition of 'htmlfiel...
HTMLFormElement: formdata event - Web APIs
is happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor. ...
... globaleventhandlers.onformdata examples // grab reference to form const formelem = document.queryselector('form'); // submit handler formelem.
addeventlistener('submit', (e) => { // on form submission, prevent default e.preventdefault(); // construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.
addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }); the onformdata version would look like this: formelem.onform...
HTMLFormElement: submit event - Web APIs
put 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 prevents 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 prevents 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 stam...
... 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.preventdefault(); } 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. recommendation no change html 5.1the definition of 'submit' in that specification. recommendati...
HTMLHRElement - Web APIs
the htmlhrelement interface provides special properties (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating <hr> elements. ...
...representing the height of the rule. htmlhrelement.width is a domstring representing the width of the rule on the page. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlhrelement' in that specification. living standard the color property has been
added, as an obsolete property, to increase compatibility with the existing web. html5the definition of 'htmlhrelement' in that specification. recommendation following properties are now obsolete: align, noshade, size, and width. document object model (dom) level 2 html specificationthe definition of 'htmlhrelement' in that specification. obsolete no change from document...
HTMLImageElement.border - Web APIs
es to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. the width, specifically, is controlled using the writing-mode aware border-block-start-width, border-block-end-width, border-inline-start-width, and border-inline-end-width properties. for compatibility (or perhaps other) reasons, you can use the older properties instead (or in
addition): border-top-width, border-right-width, border-bottom-width, and border-left-width. syntax htmlimageelement.border = thickness; let thickness = htmlimageelement.border; value a domstring containing an integer value specifying the thickness of the border that should surround the image, in css pixels. a value of 0, or an empty string, indicates that there should be no border drawn. the d...
...er is 0 usage notes do not use border. it is obsolete. instead, use the css border property and its longhand properties to establish borders around images. for example, if you have the following html: <img src="image.png" border="2"> the following will provide the same appearance using css instead of this obsolete property: <img src="image.png" style="border: 2px;"> you can further provide
additional information to change the color and other features of the border: <img src="image.png" style="border: dashed 2px #333388;"> specifications specification status comment html living standardthe definition of 'htmlimageelement.border' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.border' in that...
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, prevents 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...
...lution image's url, then using decode() to get a promise which is resolved once the full-resolution image is ready for use. at that time, you can then replace the low-resolution image with the full-resolution one that's now available. examples the following example shows how to use the decode() method to control when an image is appended to the dom. without a promise-returning method, you would
add the image to the dom in a load event handler, such as by using the img.onload event handler, and by handling the error in the error event's handler. const img = new image(); img.src = 'nebula.jpg'; img.decode() .then(() => { document.body.appendchild(img); }) .catch((encodingerror) => { // do something with the error. }) specifications specification status comment ...
HTMLImageElement.naturalHeight - Web APIs
ral, density-adjusted size of an image as well as its rendered size as altered by the page's css and other factors. html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed inside a <div>. ...
.... css .box { width: 200px; height: 200px; } .image { width: 100%; } .output { p
adding-top: 2em; } the main thing of note in the css above is that the style used for the container the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.
addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.naturalheight} pixels<br>`; output.innerhtml += `displayed size: ${image.width} x ` + `${image.height} pixels`; }); the javascript code simply dumps the natural and as-displayed sizes into the <div> with the class output. this is done in respons...
HTMLImageElement.naturalWidth - Web APIs
ral, density-adjusted size of an image as well as its rendered size as altered by the page's css and other factors. html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed inside a <div>. ...
.... css .box { width: 200px; height: 200px; } .image { width: 100%; } .output { p
adding-top: 2em; } the main thing of note in the css above is that the style used for the container the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.
addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.naturalheight} pixels<br>`; output.innerhtml += `displayed size: ${image.width} x ` + `${image.height} pixels`; }); the javascript code simply dumps the natural and as-displayed sizes into the <div> with the class output. this is done in respons...
HTMLImageElement.sizes - Web APIs
) 30em, (max-width: 30em) 20em"> <p>then there's even more amazing stuff to say down here. ...
...e handles the two buttons that let you toggle the third width option between 40em and 50em; this is done by handling the click event, using the javascript string object method replace() to replace the relevant portion of the sizes string. let image = document.queryselector("article img"); let break40 = document.getelementbyid("break40"); let break50 = document.getelementbyid("break50"); break40.
addeventlistener("click", event => image.sizes = image.sizes.replace(/50em,/, "40em,")); break50.
addeventlistener("click", event => image.sizes = image.sizes.replace(/40em,/, "50em,")); result this result may be viewed in its own window here. specifications specification status comment html living standardthe definition of 'htmlimageelement.sizes' in that sp...
HTMLImageElement.useMap - Web APIs
lient-side image map to apply to the image. syntax htmlimageelement.usemap = imagemapanchor; let imagemapanchor = htmlimageelement.usemap; value a usvstring providing the page-local url (that is, a url that begins with the hash or pound symbol, "#") of the <map> element which defines the image map to apply to the image. you can learn more about client-side image maps in our learning article
add a hitmap on top of an image. usage notes the string value of usemap must be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. consider a <map> that looks like this: <map name="mainmenu-map"> <area shape="circle" coords="25, 25, 75, 75" href="/index.html" alt="return to ho...
... example 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. specifications ...
HTMLImageElement.x - Web APIs
lement.x; value an integer value indicating the distance in pixels from the left edge of the element's nearest root element and the left edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its x is relative to that frame. in the diagram below, the left border edge is the left edge of the blue p
adding area. so the value returned by x would be the distance from that point to the left edge of the content area. note: the x property is only valid if the computed value of the image's display property is either table-column or table-column-group; in other words, either of those are set directly on the <img> or they're inherited from a containing element or by being located within a column des...
...on the htmltablecellelement representing that cell. finally, we can look up and display the values of the htmlimageelement's x and y properties. css the css defining the appearance of the table: .group1 { background-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); p
adding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe definition of 'htmlimageelement.x' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'...
HTMLImageElement.y - Web APIs
mageelement.y; value an integer value indicating the distance in pixels from the top edge of the element's nearest root element to the top edge of the <img> element's border box. the nearest root element is the outermost <html> element that contains the image. if the image is in an <iframe>, its y is relative to that frame. in the diagram below, the top border edge is the top edge of the blue p
adding area. so the value returned by y would be the distance from that point to the top edge of the content area. note: the y property is only valid if the computed value of the image's display property is either table-column or table-column-group; in other words, either of those are set directly on the <img> or they're inherited from a containing element or by being located within a column desc...
...on the htmltablecellelement representing that cell. finally, we can look up and display the values of the htmlimageelement's x and y properties. css the css defining the appearance of the table: .group1 { background-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); p
adding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe definition of 'htmlimageelement.y' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'...
HTMLLabelElement - Web APIs
the htmllabelelement interface gives access to properties specific to <label> elements. it inherits methods and properties from the base htmlelement interface. ...
...ts methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmllabelelement' in that specification. living standard html5the definition of 'htmllabelelement' in that specification. recommendation the property accesskey is now defined on htmlelement. the following property has been
added: control. document object model (dom) level 2 html specificationthe definition of 'htmllabelelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmllabelelement' in that specification. obsolete initial definition. ...
HTMLMapElement - Web APIs
the htmlmapelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. ...
...resenting the <area> elements associated to this <map>. methods no specific method; inherits methods from its parent, htmlelement . specifications specification status comment html living standardthe definition of 'htmlmapelement' in that specification. living standard html5the definition of 'htmlmapelement' in that specification. recommendation
adds the images property. document object model (dom) level 2 html specificationthe definition of 'htmlareaelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmlareaelement' in that specification. obsolete initial definition. ...
HTMLMediaElement: loadedmetadata event - Web APIs
the loadedmetadata event is fired when the metadata has been loaded. bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onloadedmetadata specification html5 media
additional properties property type description mozchannels read only int the number of channels. ...
...onloadedmetadata specification html5 media
additional properties property type description mozchannels read only int the number of channels. mozsamplerate read only int the sample rate per second. mozframebufferlength read only int the number of samples collected in all channels. examples these examples
add an event listener for the htmlmediaelement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. using
addeventlistener(): const video = document.queryselector('video'); video.
addeventlistener('loadedmetadata', (event) => { console.log('the duration and dimensions ' + ' of the media and tracks are now known. '); }); using the onloadedmeta...
HTMLMediaElement: loadstart event - Web APIs
examples live example html <div class="example"> <button type="button">load video</button> <video controls width="250"></video> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video { grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; } js const loadvideo = document.queryselector('button'); const video = document.queryselector('video')...
...deo { grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; } js const loadvideo = document.queryselector('button'); const video = document.queryselector('video'); const eventlog = document.queryselector('.event-log-contents'); let source = null; function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}\n`; } video.
addeventlistener('loadstart', handleevent); video.
addeventlistener('progress', handleevent); video.
addeventlistener('canplay', handleevent); video.
addeventlistener('canplaythrough', handleevent); loadvideo.
addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('sour...
HTMLMediaElement.play() - Web APIs
te response. for even more in-depth information about autoplay and autoplay blocking, see our article autoplay guide for media and web audio apis. ...
...it tries to play the video, and if successful sets the class name of ...
HTMLMediaElement: progress event - Web APIs
examples live example html <div class="example"> <button type="button">load video</button> <video controls width="250"></video> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; p
adding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video { grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; } javascript const loadvideo = document.queryselector('button'); const video = document.queryselector(...
...grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; } javascript const loadvideo = document.queryselector('button'); const video = document.queryselector('video'); const eventlog = document.queryselector('.event-log-contents'); let source = null; function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}\n`; } video.
addeventlistener('loadstart', handleevent); video.
addeventlistener('progress', handleevent); video.
addeventlistener('canplay', handleevent); video.
addeventlistener('canplaythrough', handleevent); loadvideo.
addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('sour...
HTMLMediaElement.textTracks - Web APIs
the read-only texttracks property on htmlmediaelement objects returns a texttracklist object listing all of the texttrack objects representing the media element's text tracks, in the same order as in the list of text tracks. you can detect when tracks are
added to and removed from an <audio> or <video> element using the
addtrack and removetrack events. however, these events aren't sent directly to the media element itself. instead, they're sent to the track list object of the htmlmediaelement that corresponds to the type of track that was
added to the element the returned list is live; that is, as tracks are
added to and removed from the media element, the list's contents change dynamically. once you have a reference to the list, you can monitor it for changes to detect when new ...
... see event handlers in texttracklist to learn more about watching for changes to a media element's track list. ...
HTMLOListElement - Web APIs
the htmlolistelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating ordered list elements. ...
...css property 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. ...
Option() - Web APIs
lement when the page is first loaded. if this is not specified, a default value of false is used. note that a value of true does not set the option to selected if it is not already selected. selected optional a boolean that sets the option's selected state; the default is false (not selected). if omitted, even if the defaultselected argument is true, the option is not selected. ...
...>second</option> <option>third</option> </select> */ var s = document.getelementbyid('s'); var options = [ 'zero', 'one', 'two' ]; options.foreach(function(element, key) { if (element == 'zero') { s[s.options.length] = new option(element, s.options.length, false, false); } if (element == 'one') { s[s.options.length] = new option(element, s.options.length, true, false); // will
add the "selected" attribute } if (element == 'two') { s[s.options.length] = new option(element, s.options.length, false, true); // just will be selected in "view" } }); /* result <select id="s"> <option value="0">zero</option> <option value="1" selected="">one</option> <option value="2">two</option> // user will see this as 'selected' </select> */ specification specificat...
HTMLOptionElement - Web APIs
the htmloptionelement interface represents <option> elements and inherits all classes and methods of the htmlelement interface. ...
..., the value of defaultselected, and the value of selected. the last three values are optional. specifications specification status comment html living standardthe definition of 'htmloptionelement' in that specification. living standard html5the definition of 'htmloptionelement' in that specification. recommendation a constructor, option(), has been
added. the form property can be the null value. document object model (dom) level 2 html specificationthe definition of 'htmloptionelement' in that specification. obsolete the selected property changed its meaning: it now indicates if the option is currently selected and no longer if it was initally selected. the defaultselected property is no longer read-only. documen...
HTMLOptionsCollection - Web APIs
the htmloptionscollection interface represents a collection of <option> html elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. this object is returned only by the options property of select. ...
...ace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloptionscollection</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties name type description length unsigned long as optionally allowed by the spec, this property isn't read-only. you can either remove options from the end by lowering the value, or
add blank options at the end by raising the value. mozilla allows this, while other implementations could potentially throw a domexception. methods this interface inherits the methods of its parent, htmlcollection. specifications specification status comment html living standardthe definition of 'htmloptionscollection' in that specification. living standard ...
HTMLOrForeignElement.dataset - Web APIs
ut they are always similar: in html, the name of a custom data attribute begins with data-. it must contain only letters, numbers, and the following characters: dash (-), dot (.), colon (:), underscore (_)—but not any ascii capital letters (a to z). in javascript, the name of a custom data attribute is the name of the same html attribute, but in camelcase and with no dashes, dots, etc. in
addition to the information below, you'll find a how-to guide for using html data attributes in our article using data attributes. name conversion dash-style to camelcase conversion a custom data attribute name is transformed to a key for the domstringmap entry with the following rules the prefix data- is removed (including the dash); for any dash (u+002d) followed by an ascii lowercase...
... letter is transformed into its uppercase counterpart; other characters (including other dashes) are left unchanged. camelcase to dash-style conversion the opposite transformation, which maps a key to an attribute name, uses the following rules: restriction: before the transformation, a dash must not be immediately followed by an ascii lowercase letter a to z; the prefix data- is
added; any ascii uppercase letter a to z is transformed into a dash, followed by its lowercase counterpart; other characters are left unchanged. the restriction in the rules above ensures that the two transformations are the inverse one of the other. for example, the attribute named data-abc-def corresponds to the key abcdef. accessing values attributes can be set and read by using the...
HTMLOrForeignElement - Web APIs
note: htmlorforeignelement is a mixin and not an interface; you can't actually create an object of type htmlorforeignelement. ...
... note: htmlorforeignelement is a mixin and not an interface; you can't actually create an object of type htmlorforeignelement. ...
HTMLSelectElement.selectedIndex - Web APIs
living standard no change since the latest snapshot, html5. html5the defini...
... living standard no change since the latest snapshot, html5. html5the definition of 'htmlselectelement' in that specification. recommendation initial defin...
HTMLSlotElement: slotchange event - Web APIs
the slotchange event is fired on an htmlslotelement instance (<slot> element) when the node(s) contained in that slot change. note: the slotchange event doesn't fire if the children of a slotted node change — only if you change (e.g.
add or delete) the actual nodes themselves. bubbles yes cancelable no interface event event handler property none in order to trigger a slotchange event, one has to set or remove the slot attribute. ...
...roperty none in order to trigger a slotchange event, one has to set or remove the slot attribute. examples element.setattribute('slot', slotname); // element.assignedslot = $slot element.removeattribute('slot'); // element.assignedslot = null the following snippet is taken from our slotchange example (see it live also). let slots = this.shadowroot.queryselectorall('slot'); slots[1].
addeventlistener('slotchange', function(e) { let nodes = slots[1].assignednodes(); console.log('element in slot "' + slots[1].name + '" changed to "' + nodes[0].outerhtml + '".'); }); here we grab references to all the <slot>s, then
add a slotchange event listener to the template's second slot — which is the one which has its contents changed in the example. every time the element inserted in...
HTMLSpanElement - Web APIs
the htmlspanelement interface represents a <span> element and derives from the htmlelement interface, but without implementing any
additional properties or methods. ...
... the htmlspanelement interface represents a <span> element and derives from the htmlelement interface, but without implementing any
additional properties or methods. ...
HTMLStyleElement - Web APIs
its properties and methods from its parent, htmlelement, and from linkstyle. this interface doesn't allow to manipulate the css it contains (in most case). to manipulate css, see using dynamic styling information for an overview of the objects used to manipulate specified css properties using the dom. ...
...specifications specification status comment html living standardthe definition of 'htmlstyleelement' in that specification. living standard html 5.1the definition of 'htmlstyleelement' in that specification. recommendation html5the definition of 'htmlstyleelement' in that specification. recommendation the following property has been
added: scoped. document object model (dom) level 2 html specificationthe definition of 'htmlstyleelement' in that specification. obsolete
added a second inheritence, the linkstyle interface. document object model (dom) level 1 specificationthe definition of 'htmlstyleelement' in that specification. obsolete initial definition ...
HTMLTableRowElement - Web APIs
the htmltablerowelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an html table. ...
...espect to the surrounding context. the possible values are "left", "right", and "center". htmltablerowelement.bgcolor is a domstring containing the background color of the cells. it reflects the obsolete bgcolor attribute. htmltablerowelement.cells read only returns a live htmlcollection containing the cells in the row. the htmlcollection is live and is automatically updated when cells are
added or removed. htmltablerowelement.ch is a domstring containing one single character. this character is the one to align all the cell of a column on. it reflects the char and default to the decimal points associated with the language, e.g. '.' for english, or ',' for french. this property was optional and was not very well supported. htmltablerowelement.choff is a domstring containing a in...
HTMLTableSectionElement - Web APIs
the htmltablesectionelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an html table. ...
...domstring containing an enumerated value reflecting the align attribute. it indicates the alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", and "center". htmltablesectionelement.rows read only returns a live htmlcollection containing the rows in the section. the htmlcollection is live and is automatically updated when rows are
added or removed. htmltablesectionelement.ch is a domstring containing one single chararcter. this character is the one to align all the cell of a column on. it reflects the char and default to the decimal points associated with the language, e.g. '.' for english, or ',' for french. this property was optional and was not very well supported. htmltablesectionelement.choff is a domstring contai...
HTMLUnknownElement - Web APIs
the htmlunknownelement interface represents an invalid html element and derives from the htmlelement interface, but without implementing any
additional properties or methods. ...
... the htmlunknownelement interface represents an invalid html element and derives from the htmlelement interface, but without implementing any
additional properties or methods. ...
onMSVideoFormatChanged - Web APIs
r may change in the future. onmsvideoformatchanged is an event which occurs when the video format changes. this proprietary property is specific to internet explorer and microsoft edge. ...
... onmsvideoformatchanged is an event which occurs when the video format changes. this proprietary property is specific to internet explorer and microsoft edge. ...
onMSVideoFrameStepCompleted - Web APIs
pcompleted is an event which occurs when the video frame has been stepped forward or backward one frame. this proprietary property is specific to internet explorer and microsoft edge. ...
...s when the video frame has been stepped forward or backward one frame. this proprietary property is specific to internet explorer and microsoft edge. ...
onMSVideoOptimalLayoutChanged - Web APIs
eooptimallayoutchanged is an event which occurs when the msislayoutoptimalforplayback state changes. this proprietary property is specific to internet explorer and microsoft edge. ...
... which occurs when the msislayoutoptimalforplayback state changes. this proprietary property is specific to internet explorer and microsoft edge. ...
HTMLVideoElement - Web APIs
d htmlelement. the list of supported media formats varies from one browser to the other. you should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
... ancestor htmlelement. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object that contains the current playback metrics. this information includes things like the number of dropped or corrupted frames, as well as the total number of frames. events inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. specifications specification status comment html living standardthe definition of 'htmlvideoelement' in that specification. living standard ...
HashChangeEvent - Web APIs
the hashchangeevent interface represents events that fire when the fragment identifier of the url has changed. the fragment identifier is the part of the url that follows (and includes) the # symbol. ...
...ng. hashchangeevent.oldurl read only the previous 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); basic example function locationhashchanged() { if (location.hash === '#somecoolfeature') { somecoolfeature(); } } window.
addeventlistener('hashchange', locationhashchanged); polyfill there are several fallback scripts listed on the modernizr github page. basically, those scripts check the location.hash at a regular interval. here is a ...
Headers.append() - Web APIs
the append() method of the headers interface appends a new value onto an existing header inside a headers object, or
adds the header if it does not already exist. the difference between set() and append() is that if the specified header already exists and accepts multiple values, set() will overwrite the existing value with the new one, whereas append() will append the new value onto the end of the set of values. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.append(name, value); parameters name the name of the http header you want to
add to the headers object. value the value of the http header you want to
add. returns void. example creating an...
...hese headers include the forbidden header names and forbidden response header names. syntax myheaders.append(name, value); parameters name the name of the http header you want to
add to the headers object. value the value of the http header you want to
add. returns void. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could
add a header to this using append(): myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns 'image/jpeg' if the specified header already exists, append() will change its value to the specified value. if the specified header already exists and accepts multiple values, append() will append the new value to the end of the value set: myheaders.append('accept-encodin...
Headers.set() - Web APIs
the difference between set() and headers.append is that if the specified header already exists and accepts multiple values, set() overwrites the existing value with the new one, whereas headers.append appends the new value to the end of the set of values. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. ...
...n response header names. syntax myheaders.set(name, value); parameters name the name of the http header you want to set to a new value. if the given name is not the name of an http header, this method throws a typeerror. value the new value you want to set. returns void. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could
add a header to this using headers.append, then set a new value for this header using set(): myheaders.append('content-type', 'image/jpeg'); myheaders.set('content-type', 'text/html'); if the specified header does not already exist, set() will create it and set its value to the specified value. if the specified header does already exist and does accept multiple values, set() will overwrite the exi...
Working with the History API - Web APIs
the referrer will be the url of the document whose window is this at the time of creation of the xmlhttprequest object. ...
...the referrer will be the url of the document whose window is this at the time of creation of the xmlhttprequest object. ...
IDBDatabase: versionchange event - Web APIs
the versionchange event is fired when a database structure change (idbopendbrequest.onupgradeneeded event or idbfactory.deletedatabase) was requested. ...
...' }); // define what data items the objectstore will contain objectstore.createindex('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.
addeventlistener('success', event => { const db = event.target.result; db.
addeventlistener('versionchange', event => { console.log('the version of this database has changed'); }); }); the same example, using the onversionchange event handler property: // open the database const dbopenrequest = window.indexeddb.open('nonexistent', 4); dbopenrequest.onupgradeneeded = event => { const db...
IDBDatabase - Web APIs
happens in the context of a transaction, representing interactions with data in the database. all objects in indexeddb — including object stores, indexes, and cursors — are tied to a particular transaction. thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
.... idbdatabase.deleteobjectstore() destroys the object store with the given name in the connected database, along with any indexes that reference it. idbdatabase.transaction() immediately returns a transaction object (idbtransaction) containing the idbtransaction.objectstore method, which you can use to access your object store. runs in a separate thread. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when when a transaction is aborted and bubbles up to the connection object. also available via the onabort property. close fired when the database connection is unexpectedly closed. also available via the onclose property. error fired when a request returns an error and the event bu...
IDBIndexSync - Web APIs
synchronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbindexsync interface of the indexeddb api provides synchronous access to an index in a database. ...
...mstring the key path of this index. if this attribute is null, this index is not auto-populated. name readonly domstring the name of this index. storename readonly domstring this index's referenced object store. unique readonly boolean if true, a key can have only one value within the index; if false, a key can have duplicate values. methods
add() stores the given value into this index, optionally with the specified key. if a record already exists with the given key, an exception is raised. any
add( in any value, in optional any key ) raises (idbdatabaseexception); parameters returns exceptions this method can raise a idbdatabaseexception with the following code: value the value to store into the index. key a key to use ...
IDBObjectStoreSync - Web APIs
ersion of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbobjectstoresync interface of the indexeddb api provides synchronous access to an object store of a database. ...
... constants mode constants constant value description read_only 1 modification operations are not allowed on this object store. read_write 0 modification operations are allowed on this object store. snapshot_read 2 any read operations must access a snapshot view of the data, which cannot change once it is created. methods
add() stores the given value into this object store, optionally with the specified key. if a record already exists with the given key, an exception is raised. any
add( in any value, in optional any key ) raises (idbdatabaseexception); parameters returns exceptions this method can raise a idbdatabaseexception with the following codes: value the value to store into the index. key a key...
IDBOpenDBRequest: blocked event - Web APIs
the blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database. ...
...e.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.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var...
IDBOpenDBRequest - Web APIs
the idbopendbrequest interface of the indexeddb api provides access to the results of requests to open or delete databases (performed using idbfactory.open and idbfactory.deletedatabase), using specific event handler attributes. note: this feature is available in web workers. ...
...onaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">idbopendbrequest</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties also inherits methods from its parents idbrequest and eventtarget. methods no methods, but inherits methods from its parents idbrequest and eventtarget. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. blocked fired when an open connection to a database is blocking a versionchange transaction on the same database. also available via the onblocked property. upgradeneeded fired when an attempt was made to open a database with a version number higher than its current version. also available via th...
IDBRequest.error - Web APIs
d. the following error codes are returned under certain conditions: error explanation aborterror if you abort the transaction, then all requests still in progress receive this error. constrainterror if you insert data that doesn't conform to a constraint. it's an exception type for creating stores and indexes. you get this error, for example, if you try to
add a new key that already exists in the record. quotaexceedederror if you run out of disk quota and the user declined to grant you more space. unknownerror if the operation failed for reasons unrelated to the database itself. a failure due to disk io errors is such an example. noerror if the request succeeds. versionerror if you try to open a database ...
...exceedederror if you run out of disk quota and the user declined to grant you more space. unknownerror if the operation failed for reasons unrelated to the database itself. a failure due to disk io errors is such an example. noerror if the request succeeds. versionerror if you try to open a database with a version lower than the one it already has. in
addition to the error codes sent to the idbrequest object, asynchronous operations can also raise exceptions. the list describes problems that could occur when the request is being executed, but you might also encounter other problems when the request is being made. for example, if the the request failed and the result is not available, the invalidstateerror exception is thrown. example the followi...
IDBRequest: success event - Web APIs
the success event is fired when an idbrequest succeeds. ...
...le' }); // define what data items the objectstore will contain objectstore.createindex('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 }); }; openrequest.
addeventlistener('success', (event) => { console.log('database opened successfully!'); }); the same example, but using the onsuccess event handler property: // open the database const openrequest = window.indexeddb.open('todolist', 4); openrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // crea...
IDBRequest - Web APIs
e request (idbrequest.onsuccess). if an error occurs while performing the operation, the exception is made available through the result property and an error event is fired (idbrequest.onerror). the interface idbopendbrequest is derived from idbrequest. note: this feature is available in web workers. ...
...ly or when an error occurs. idbrequest.transaction read only the transaction for the request. this property can be null for certain requests, for example those returned from idbfactory.open unless an upgrade is needed. (you're just connecting to a database, so there is no transaction to return). methods no methods, but inherits methods from eventtarget. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. error fired when an error caused a request to fail. also available via the onerror property. success fired when an idbrequest succeeds. also available via the onsuccess property. example in the following code snippet, we open a database asynchronously and make a request; onerror and onsucces...
Basic concepts - Web APIs
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 previously. 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 a value that you just inserted into the database). indexeddb uses ...
...orting has been allowed with an experimental flag enabled (currently for firefox only) since firefox 43. synchronizing. the api is not designed to take care of synchronizing with a server-side database. you have to write code that synchronizes a client-side indexeddb database with a server-side database. full text searching. the api does not have an equivalent of the like operator in sql. in
addition, be aware that browsers can wipe out the database, such as in the following conditions: the user requests a wipe out. many browsers have settings that let users wipe all data stored for a given website, including cookies, bookmarks, stored passwords, and indexeddb data. the browser is in private browsing mode. some browsers, have "private browsing" (firefox) or "incognito" (chrome) modes...
InputDeviceCapabilities API - Web APIs
a touch screen. input device capabilities concepts and usage because dom events abstract device input, they provide no way to learn what device or type of device fired an event. this can lead to instances where the same action triggers multiple event handlers. to deal with this, developers make assumptions and use heuristics to normalize behavior on web pages. the inputdevicecapabilities api
addresses this problem by abstracting the capabilities of input devices. for example, let's say we have a web page that implements both a touchstart and a mousedown event. we can assume that if the touchstart event is triggered that the user's device has a touch interface. what about when the mousedown event is triggered? it would be useful to know if a touchstart event were also triggered so that w...
...ements both a touchstart and a mousedown event. we can assume that if the touchstart event is triggered that the user's device has a touch interface. what about when the mousedown event is triggered? it would be useful to know if a touchstart event were also triggered so that we don't take the same action twice. we can do this by checking the sourcecapabilities property of the uievent. mybutton.
addeventlistener('mousedown', function(e) { // touch event case handled above, don't change the style again on tap. if (!e.sourcecapabilities.firestouchevents) mybutton.classlist.
add("pressed"); }); interfaces inputdevicecapabilities provides logical information about an input device. specifications specification status comment inputdevicecapabilities draft ...
InputEvent.data - Web APIs
ed characters. this may be an empty string if the change doesn't insert text (such as when deleting characters, for example). syntax var astring = inputevent.data; value a domstring. ...
... when any change is made to the contents of the <input> element (either by typing or pasting), the text that was
added is retrieved via the inputevent.data property and reported in the paragraph below the input. <p>some text to copy and paste.</p> <input type="text"> <p class="result"></p> var editable = document.queryselector('input') var result = document.queryselector('.result'); editable.
addeventlistener('input', (e) => { result.textcontent = "inputted text: " + e.data; }); specifications specification status comment input events level 2the definition of 'data' in that specification. working draft initial definition. ...
InputEvent.dataTransfer - Web APIs
syntax var datatransfer = inputevent.datatransfer value a datatransfer object. examples in the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input. ...
... working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like...
InputEvent.inputType - Web APIs
hat was made. there are many possible values, such as inserttext, deletecontentbackward, insertfrompaste, and formatbold. for a complete list of the available input types, see the attributes section of the input events level 1 spec. examples this example logs the inputtype for input events on an editable <div>. html <p id="log">input type: </p> <div contenteditable="true" style="margin: 20px;p
adding: 20px;border:2px dashed red;"> <p>some sample text. try inserting line breaks, or deleting text in different ways, or pasting different content in.</p> <hr> <ul> <li>a sample</li> <li>bulleted</li> <li>list.</li> </ul> <p>another paragraph.</p> </div> javascript const log = document.getelementbyid('log'); const editable = document.queryselector('div[contenteditable]'); ...
...;border:2px dashed red;"> <p>some sample text. try inserting line breaks, or deleting text in different ways, or pasting different content in.</p> <hr> <ul> <li>a sample</li> <li>bulleted</li> <li>list.</li> </ul> <p>another paragraph.</p> </div> javascript const log = document.getelementbyid('log'); const editable = document.queryselector('div[contenteditable]'); editable.
addeventlistener('input', loginputtype); function loginputtype(event) { log.textcontent = `input type: ${event.inputtype}`; } result try editing the text inside the <div> and see what happens. note: see also masayuki nakano's inputevent test suite for a more detailed example. specifications specification status comment ui eventsthe definition of 'inputtype' in tha...
InputEvent - Web APIs
the inputevent interface represents an event notifying of editable content change. ...
...perties this interface inherits properties from its parents, uievent and event. inputevent.dataread only returns a domstring with the inserted characters. this may be an empty string if the change doesn't insert text (such as when deleting characters, for example). inputevent.datatransferread only returns a datatransfer object containing information about richtext or plaintext data being
added to or removed from editable content. inputevent.inputtyperead only returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. see the property page for a complete list of input types. inputevent.iscomposingread only returns a boolean value indicating if the event is fired after compositionstart and before compositionend. methods this ...
InstallEvent - Web APIs
llevent interface represents an install action that is dispatched on the serviceworkerglobalscope of a serviceworker. as a child of extendableevent, it ensures that functional events such as fetchevent are not dispatched during installation. this interface inherits from the extendableevent interface. ...
...you can use this approach for multiple caches. the code maps a shorthand identifier for a cache to a specific, versioned cache name. note: logging statements are visible in google chrome via the "inspect" interface for the relevant service worker accessed via chrome://serviceworker-internals. var cache_version = 1; var current_caches = { prefetch: 'prefetch-cache-v' + cache_version }; self.
addeventlistener('install', function(event) { var urlstoprefetch = [ './static/pre_fetched.txt', './static/pre_fetched.html', 'https://www.chromium.org/_/rsrc/1302286216006/config/customlogo.gif' ]; console.log('handling install event. resources to pre-fetch:', urlstoprefetch); event.waituntil( caches.open(current_caches['prefetch']).then(function(cache) { return cache.a...
IntersectionObserver.rootMargin - Web APIs
this lets you, for example, adjust the bounds outward so that the target element is considered 100% visible even if a certain number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. ...
... bounding box. see the root element and root margin in intersection observer api for a more in-depth look at the root margin and how it works with the root's bounding box. syntax var marginstring = intersectionobserver.rootmargin; value a string, formatted similarly to the css margin property's value, which contains offsets for one or more sides of the root's bounding box. these offsets are
added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersectionobserver was instantiated. the browser is permitted to alter the values if rootmargin isn't specified when the object was instantiated, it defaults to the string...
KeyframeEffectOptions - Web APIs
l not play. simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. properties composite optional determines how values are combined between this animation and other, separate animations that do not specify their own specific composite 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 previous value with the new one. iter...
...way through a third iteration. defaults to 0.0. iterations optional the number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. specifications specification status comment web animations level 2the definition of 'keyframeeffectoptions' in that specification. draft
added the iterationcomposite option. web animationsthe definition of 'keyframeeffectoptions' in that specification. working draft initial definition. ...
MSCandidateWindowShow - Web APIs
internet explorer. general info synchronous no bubbles no cancelable no note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event. on internet explorer in the new windows ui, this event is supported in windows 8.1 imes of all languages. syntax event property object.oncandidatewindowshow = handler;
addeventlistener method object.
addeventlistener("mscandidatewindowshow", handler, usecapture) parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event. this event fires after the positioning information of the ime candidate window has been determined. you can obtain the positioning information using the getcandidatewindowclientrect method...
...r will remain valid for the lifetime of the element). example in ie11, developers can detect the opening of the ime candidate window by listening to mscandidatewindowshow event, then call getcandidatewindowclientrect() function to find out where the candidate window is and position the suggestion ui away from it: var context = document.getelementbyid("mysearchbox").msgetinputcontext(); context.
addeventlistener("mscandidatewindowshow", candidatewindowshowhandler); function candidatewindowshowhandler(e) { var imerect = context.getcandidatewindowclientrect(); var suggestionrect = document.getelementbyid("mysuggestionlist").getboundingclientrect(); // check if the two rects intersect, and position them away from each other. } when the ime candidate window changes position or closes...
MediaDevices.getDisplayMedia() - Web APIs
specifications specification status comment screen capturethe definition of 'mediadevices.getdisplaymedia()' in that specification. working draft initial definition ...
....getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } this uses await to asynchronously wait for getdisplaymedia() to resolve with a mediastream which contains the display contents as requested by the specified options. the stream is then returned to the caller for use, perhaps for
adding to a webrtc call using rtcpeerconnection.
addtrack() to
add the video track from the stream. specifications specification status comment screen capturethe definition of 'mediadevices.getdisplaymedia()' in that specification. working draft initial definition ...
MediaDevices.ondevicechange - Web APIs
list" id="audiolist"></ul> </div> <div class="right"> <h2>video devices:</h2> <ul class="devicelist" id="videolist"></ul> </div> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; } h2 { margin-bottom: 4px; } .left { float:left; width: 48%; margin-right: 2% } .right { float:right; width: 48%; margin-left: 2% } .devicelist { border: 1px solid black; list-style-type: none; margin-top: 2px; p
adding: 6px; } javascript content other code below is other code which, whi...
... p
adding: 6px; } javascript content other code below is other code which, while needed to make this example work, isn'tt related directly to ondevicechange, so we won't go into any detail. ...
MediaError.message - Web APIs
een describing the error, including both the code and the message. only the relevant parts of the code are displayed; you can see the complete source code here. the example creates an <audio> element and lets the user assign either a valid music file to it, or a link to a file which doesn't exist. this lets us see the behavior of the error event handler, which is received by an event handler we
add to the <audio> element itself. the error handler looks like this: audioelement.onerror = function() { let s = ""; let err = audioelement.error; switch(err.code) { case mediaerror.media_err_aborted: s += "the user canceled the audio."; break; case mediaerror.media_err_network: s+= "a network error occurred while fetching the audio."; bre...
... { s += " " + message; } displayerrormessage("<strong>error " + err.code + ":</strong> " + s + "<br>"); }; this gets the mediaerror object describing the error from the error property on the htmlaudioelement representing the audio player. the error's code attribute is checked to determine a generic error message to display, and, if message is not empty, it's appended to provide
additional details. then the resulting text is output to the log. result you can try out this example below, and can see the example in action outside this page here. specifications specification status comment html living standardthe definition of 'mediaerror.message' in that specification. living standard initial definition ...
msExtendedCode - Web APIs
, the media element's error event will be fired. the element's error property will then contain an msextendedcode read-only property with platform-specific error code information. ...
...code read-only property with platform-specific error code information. msextendedcode is a read-only proprietary property specific to internet explorer and microsoft edge. ...
MediaQueryListEvent - Web APIs
constructor mediaquerylistevent() creates a new mediaquerylistevent instance. properties the mediaquerylistevent interface inherits properties from its parent interface, event. ...
... working draft initial definition ...
MediaRecorder: error event - Web APIs
ror 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 mediarecordererrorevent event handler property onerror for details of the all the possible errors see the documentation for the event handler property: onerror. ...
...cordererrorevent event handler property onerror for details of the all the possible errors see the documentation for the event handler property: onerror. ...
MediaRecorder - Web APIs
media recording resumes after being paused. mediarecorder.onstart an eventhandler called to handle the start event, which occurs when media recording starts. mediarecorder.onstop an eventhandler called to handle the stop event, which occurs when media recording ends, either when the mediastream ends — or after the mediarecorder.stop() method is called. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. error fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsupported codec. also available via the onerror property. example if (navigator.mediadevices) { console.log('getusermedia supported.'); var constraints = { audio: true }; var chunks...
...on(e) { console.log("data available after mediarecorder.stop() called."); var clipname = prompt('enter a name for your sound clip'); var clipcontainer = document.createelement('article'); var cliplabel = document.createelement('p'); var audio = document.createelement('audio'); var deletebutton = document.createelement('button'); clipcontainer.classlist.
add('clip'); audio.setattribute('controls', ''); deletebutton.innerhtml = "delete"; cliplabel.innerhtml = clipname; clipcontainer.appendchild(audio); clipcontainer.appendchild(cliplabel); clipcontainer.appendchild(deletebutton); soundclips.appendchild(clipcontainer); audio.controls = true; var blob = new blob(chunks, { 'type' : 'audio/ogg; codec...
MediaSource.activeSourceBuffers - Web APIs
rcebuffers; value a sourcebufferlist containing the sourcebuffer objects for each of the active tracks. ...
...h of the active tracks. example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.
addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.
addeventlistener('updateend', function (_) { mediasource.endofstream(); console.log(mediasource.activesourcebuffers); // will contain the source buffer that was
added above, // as it is selected for playing in the video player video.play(); //console.log(mediasource.readystate); // ended }); sourcebuffer.appendbuffer(buf); }); }; ... specifications ...
MediaSource.isTypeSupported() - Web APIs
an successfully create sourcebuffer objects for that mime type. if the returned value is false, then the user agent is certain that it cannot access media of the specified format. syntax var isitsupported = mediasource.istypesupported(mimetype); parameters mimetype the mime media type that you want to test support for in the current browser. this may include the codecs parameter to provide
added details about the codecs used within the file. return value a boolean which is true if the browser feels that it can probably play media of the specified type. this is not a guarantee, however, and your code must be prepared for the possibility that the media will not play correctly if at all. a value of false is a guarantee that media of the given type will not play, however. all web apis ...
...rl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.
addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.
addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.
addeventlistener('updateend', function (_) { mediasource.endofstream...
MediaSource.readyState - Web APIs
a domstring. ...
... { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.
addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.
addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.
addeventlistener('updateend', function (_) { mediasource.endofstream(); video.play(); //console.log(mediasource.readystate); // ended }); sourcebuffer.appendbuffer(buf); }); }; specifications specification status comment media source extensionsthe definition of 'read...
MediaStreamAudioSourceNode - Web APIs
d in the selected audio track. number of inputs 0 number of outputs 1 channel count defined by the first audio mediastreamtrack passed to the audiocontext.createmediastreamsource() method that created it. constructor new mediastreamaudiosourcenode() creates a new mediastreamaudiosourcenode object instance with the specified options. properties in
addition to the following properties, mediastreamaudiosourcenode inherits the properties of its parent, audionode. mediastream read only the mediastream used when constructing this mediastreamaudiosourcenode. methods inherits methods from its parent, audionode. exceptions invalidstateerror the stream specified by the mediastream parameter does not contain any audio tracks. usage notes ...
...se kind is audio, then sorting the tracks by their id property's values, in unicode code point order (essentially, in alphabetical or lexicographical order, for ids which are simple alphanumeric strings). the first track, then, is the track whose id comes first when the tracks' ids are all sorted by unicode code point. however, it's important to note that the rule establishing this ordering was
added long after this interface was first introduced into the web audio api. as such, you can't easily rely on the order matching between any two browsers or browser versions. this is why it is typically wiser to use mediastreamtrackaudiosourcenode, which provides similar capabilities but was better-defined upon being
added to the specification, so it's more reliable. example in this example, we gr...
MediaStreamConstraints.audio - Web APIs
onstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").
addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audi...
...onstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").
addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audi...
MediaStreamConstraints.video - Web APIs
onstration.</p> <div id="startbutton" class="button"> start </div> <video id="video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").
addeventlistener("click", function() { navigator.mediadevices.getusermedia({ vi...
...onstration.</p> <div id="startbutton" class="button"> start </div> <video id="video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; p
adding-top: 2px; p
adding-bottom: 4px; color: white; background-color: darkgreen; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").
addeventlistener("click", function() { navigator.mediadevices.getusermedia({ vi...
MediaStreamEvent() - Web APIs
the mediastreamevent() constructor creates a new mediastreamevent. syntax var event = new mediastreamevent(type, mediastreameventinit); values type is a domstring containing the name of the event, like
addstream or removestream. mediastreameventinit is a mediastreameventinit dictionary, having the following fields: "stream" of type mediastream representing the stream being concerned by the event. "bubbles", optional and defaulting to false, inherited from eventinit, and indicating if the event must bubble or not. ...
...ream" of type mediastream representing the stream being concerned by the event. "bubbles", optional and defaulting to false, inherited from eventinit, and indicating if the event must bubble or not. "cancelable", optional and defaulting to false, inherited from eventinit, and indicating if the event can be canceled or not. example // s is a mediastream var event = new mediastreamevent("
addstream", {"stream": s}); ...
MediaStreamEvent.stream - Web APIs
the read-only property mediastreamevent.stream returns the mediastream associated with the event. ...
... the read-only property mediastreamevent.stream returns the mediastream associated with the event. ...
MediaStreamTrack.applyConstraints() - Web APIs
ny existing constraints are replaced with the new values specified, and any constrainable properties not included are restored to their default constraints. if this parameter is omitted, all currently set custom constraints are cleared. this object represents the basic set of constraints that must apply for the promise to resolve. the object may contain an advanced property containing an array of
additional mediatrackconstrants objects, which are treated as exact requires. return value a promise which resolves when the constraints have been successfully applied. if the constraints cannot be applied, the promise is rejected with a mediastreamerror whose name is overconstrainederror, to indicate that the constraints could not be met. this can happen if the specified constraints are too stri...
... ...
MediaStreamTrack: mute event - Web APIs
track.enabled property, for which there are no events. bubbles no cancelable no interface event event handler property onmute examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack referenced by musictrack. ...
... event handler property onmute examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack referenced by musictrack. musictrack.
addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; }, false); musictrack.
addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its background color changed to #aaa. when the track exits the muted state—detected by the arrival of an unmute event—the background color is...
MediaStreamTrack: unmute event - Web APIs
e think of as "muted" (that is, a user-controllable way to silence a track) is actually managed using the mediastreamtrack.enabled property, for which there are no events. examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack stored in the variable musictrack. ...
...rty, for which there are no events. examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack stored in the variable musictrack. musictrack.
addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; }, false); musictrack.
addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its background color changed to #aaa. when the track exits the muted state—detected by the arrival of an unmuted event—the background color i...
Media Session API - Web APIs
back position, and playback speed. mediasessionactiondetails provides information needed in order to perform the action which has been requested, including the type of action to perform and any other information needed, such as seek distances or times. examples the following example shows feature detection for the media session api. ...
...tactionhandler('seekforward', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('previoustrack', 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.
addeventlistener('pointerup', function(event) { var audio = document.queryselector('audio'); // user interacted with the page. let's play audio... audio.play() .then(_ => { /* set up media session controls, as shown above. */ }) .catch(error => { console.log(error) }); }); ...
MessagePort.close() - Web APIs
he close() method of the messageport interface disconnects the port, so it is no longer active. this stops the flow of messages to that port. note: this feature is available in web workers. syntax port.close() returns void. parameters none. ...
...ort interface disconnects the port, so it is no longer active. this stops the flow of messages to that port. note: this feature is available in web workers. syntax port.close() returns void. parameters none. example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.
addeventlistener. channel.port1.
addeventlistener('message', handlemessage, false); function handlemessage(e) { para.innerhtml = e.data; textinput.value = ''; } channel.port1.start(); you could stop messages being sent at any time using channel.port1.close(); specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
MessagePort: messageerror event - Web APIs
he ports to a different browsing context, such as another <iframe>, using code like this: const channel = new messagechannel(); const myport = channel.port1; const targetframe = window.top.frames[1]; const targetorigin = 'https://example.org'; const messagecontrol = document.queryselector('#message'); const channelmessagebutton = document.queryselector('#channel-message'); channelmessagebutton.
addeventlistener('click', () => { myport.postmessage(messagecontrol.value); }) targetframe.postmessage('init', targetorigin, [channel.port2]); the target can receive the port and start listening for messages and message errors on it using code like this: window.
addeventlistener('message', (event) => { const myport = event.ports[0]; myport.
addeventlistener('message', (event) => { ...
...agecontrol.value); }) targetframe.postmessage('init', targetorigin, [channel.port2]); the target can receive the port and start listening for messages and message errors on it using code like this: window.
addeventlistener('message', (event) => { const myport = event.ports[0]; myport.
addeventlistener('message', (event) => { received.textcontent = event.data; }); myport.
addeventlistener('messageerror', (event) => { console.error(event.data); }); myport.start(); }); note that the listener must call messageport.start() before any messages will be delivered to this port. this is only needed when using the
addeventlistener() method: if the receiver uses onmessage instead, start() is called implicitly: window.
addeventlistener('message', (event) => { ...
MessagePort - Web APIs
to be sent from one port and listening out for them arriving at the other. note: this feature is available in web workers. methods inherits methods from its parent, eventtarget postmessage() sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts. start() starts the sending of messages queued on the port (only needed when using eventtarget.
addeventlistener; it is implied when using messageport.onmessage.) close() disconnects the port, so it is no longer active. event handlers inherits event handlers from its parent, eventtarget onmessage an eventlistener called when messageevent of type message is fired on the port—that is, when the port receives a message. onmessageerror an eventlistener called when a messageevent of type...
....port1 and transfer messagechannel.port2 to the iframe using the window.postmessage method along with a message. when a message is received back from the iframe, the onmessage function simply outputs the message to a paragraph. ...
MouseEvent.buttons - Web APIs
for example, if the secondary (2) and auxilary (4) buttons are pressed simultaneously, the value is 6 (i.e., 2 + 4). note: do not confuse this property with the mouseevent.button property. ...
...ward" button) example this example logs the buttons property when you trigger a mousedown event. html <p>click anywhere with one or more mouse buttons.</p> <pre id="log">buttons: </pre> javascript let log = document.createtextnode('?'); // let log = new text('?'); function logbuttons(e) { log.data = `${e.buttons} (${e.type})`; // log.nodevalue= `${e.buttons} (${e.type})`; } document.
addeventlistener('mouseup', logbuttons); document.
addeventlistener('mousedown', logbuttons); // document.
addeventlistener('mousemove', logbuttons); document.queryselector('#log').appendchild(log) result specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'mouseevent.buttons' in that specification. obsol...
MutationEvent - Web APIs
esign is flawed (see details in the "dom mutation events replacement: the story so far / existing points of consensus" post to public-webapps). mutation observers are the proposed replacement for mutation 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...
...s. mutation events list the following is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified usage you can register a listener for mutation events using eventtarget.
addeventlistener() as follows: element.
addeventlistener("domnodeinserted", function (event) { // ... }, false); the event object is passed to the listener in a mutationevent (see its definition in the specification) for most events, and mutationnameevent for domattributenamechanged and domelementnamechanged. ...
MutationObserverInit.childList - Web APIs
the mutationobserverinit dictionary's optional childlist property indicates whether or not to monitor the specified node or nodes for the
addition or removal of new child nodes. if childlist is false (the default),
adding or removing new nodes does not trigger mutation callbacks. by setting childlist to true, your callback will be invoked any time nodes are
added to or removed from the dom node or nodes being watched. syntax var options = { childlist: true | false } value a boolean value indicating whether or not to invoke the callback function when new nodes are
added to or removed from the section of the dom being monitored.. ...
...oved from the dom node or nodes being watched. syntax var options = { childlist: true | false } value a boolean value indicating whether or not to invoke the callback function when new nodes are
added to or removed from the section of the dom being monitored.. if subtree is false, only the node indicated by the observer's target node is monitored for changes. setting subtree to true causes
addition or removal of nodes anywhere within the subtree rooted at target to be reported. example specifications specification status comment domthe definition of 'mutationobserverinit.childlist' in that specification. living standard ...
MutationRecord - Web APIs
haracterdata node, and "childlist" if it was a mutation to the tree of nodes. mutationrecord.target node returns the node the mutation affected, depending on the mutationrecord.type. for attributes, it is the element whose attribute 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.previoussibling node return the previous sibling of the
added or removed nodes, or null. mutationrecord.nextsibling node return ...
... mutationrecord.attributename string returns the local name of the changed attribute, or null. mutationrecord.attributenamespace string returns the namespace of the changed attribute, or null. mutationrecord.oldvalue string the return value depends on the mutationrecord.type. ...
NavigationPreloadManager - Web APIs
navigationpreloadmanager.setheadervalue() sets the value of the service-worker-navigation-preload header and returns an empty promise. navigationpreloadmanager.getstate() returns a promise that resolves to an object with properties indicating whether preload is enabled and the contents of the service-worker-navigation-preload. ...
...d enabling navigation preloading
addeventlistener('activate', event => { event.waituntil(async function() { if (self.registration.navigationpreload) { // enable navigation preloads! await self.registration.navigationpreload.enable(); } }()); }); using a preloaded response the following example shows the implementation of a fetch event that uses a preloaded response.
addeventlistener('fetch', event => { event.respondwith(async function() { // respond from the cache if we can const cachedresponse = await caches.match(event.request); if (cachedresponse) return cachedresponse; // else, use the preloaded response, if it's there const response = await event.preloadresponse; if (response) return response; // else try the network. ret...
Navigation Timing API - Web APIs
measure data that was previously difficult to obtain, such as the amount of time needed to unload the previous 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: timing and navigation, of the types below. performancenavigationtiming provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. performancetiming used as the type for the value of timing, objects of this type cont...
... ...
Navigator.getBattery() - Web APIs
note: in some browsers access to this feature is controlled by feature-policy directive battery. ...
...t not be explicitly allowed or restricted via feature-policy battery feature. example this example fetches the current charging state of the battery and establishes a handler for the chargingchange event, so that the charging state is recorded whenever it changes. let batteryischarging = false; navigator.getbattery().then(function(battery) { batteryischarging = battery.charging; battery.
addeventlistener('chargingchange', function() { batteryischarging = battery.charging; }); }); for more examples and details, see battery status api. specifications specification status comment battery status apithe definition of 'navigator.getbattery()' in that specification. candidate recommendation initial definition ...
Network Information API - Web APIs
note: this feature is available in web workers. ...
...s detect connection changes this example watches for changes to the user's connection. var connection = navigator.connection || navigator.mozconnection || navigator.webkitconnection; var type = connection.effectivetype; function updateconnectionstatus() { console.log("connection type changed from " + type + " to " + connection.effectivetype); type = connection.effectivetype; } connection.
addeventlistener('change', updateconnectionstatus); preload large resources the connection object is useful for deciding whether to preload resources that take large amounts of bandwidth or memory. this example would be called soon after page load to check for a connection type where preloading a video may not be desirable. if a cellular connection is found, then the preloadvideo flag is set to fa...
Node.cloneNode() - Web APIs
the node.clonenode() method returns a duplicate of the node on which this method was called. syntax let newclone = node.clonenode([deep]) node the node to be cloned. newclone the new node, cloned from node. the newclone has no parent and is not part of the document, until it is
added to another node that is part of the document (using node.appendchild() or a similar method). deep optional* if true, then node and its whole subtree—including text that may be in child text nodes—is also copied. if false, only node will be cloned. any text that node contains is not cloned, either (since text is contained by one or more child text nodes). deep has no effect on empty elements (such as the <img> and <input> elements). *note: in the dom4 specification (since gecko 13.
...evelopers not to omit the argument. starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone. example let p = document.getelementbyid("para1") let p_prime = p.clonenode(true) notes cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners. it does not copy event listeners
added using
addeventlistener() or those assigned to element properties (e.g., node.onclick = somefunction).
additionally, for a <canvas> element, the painted image is not copied. warning: clonenode() may lead to duplicate element ids in a document! if the original node has an id attribute, and the clone will be placed in the same document, then you should modify the clone's id to be unique. name ...
NonDocumentTypeChildNode.nextElementSibling - Web APIs
cument.getelementbyid('div-01').nextelementsibling; console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </script> this example outputs the following into the console when it loads: siblings of div-01: div script polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to
add support to ie8: // source: https://github.com/alhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "nextelementsibling", { get: function(){ var e = this.nextsibling; while(e && 1 !== e.nodetype) e = e.nextsibling; return e; ...
...tsibling' in that specification. living standard split the elementtraversal interface in childnode, parentnode, and nondocumenttypechildnode. this method is now defined on the former. the element and characterdata interfaces implemented the new interface. element traversal specificationthe definition of 'elementtraversal.nextelementsibling' in that specification. obsolete
added its initial definition to the elementtraversal pure interface and use it on element. 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 webviewchrome...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
while (el) { document.write('<li>' + el.nodename + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </script> this example outputs the following into the page when it loads: siblings of div-03 1. li 2. li 3. div 4. ...
...g' in that specification. living standard splitted the elementtraversal interface in childnode, parentnode, and nondocumenttypechildnode. this method is now defined on the former. the element and characterdata interfaces implemented the new interface. element traversal specificationthe definition of 'elementtraversal.previouselementsibling' in that specification. obsolete
added its initial definition to the elementtraversal pure interface and use it on element. ...
Notification.close() - Web APIs
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). syntax notification.close(); parameters none. returns void. examples in the following snippet, we have a simple function that when called creates an options object and then a new notification. ...
...reates an options object and then a new notification. at the end of the function, it also calls close() inside a
addeventlistener() function to remove the notification when the relevant content has been read on the webpage. function spawnnotification(thebody, theicon, thetitle) { var options = { body: thebody, icon: theicon }; var n = new notification(thetitle,options); document.
addeventlistener('visibilitychange', function() { if (document.visibilitystate === 'visible') { // the tab has become visible so clear the now-stale notification. n.close(); } }); } specifications specification status comment notifications api living standard living standard ...
OES_texture_half_float - Web APIs
webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. the constant in webgl2 is gl.half_float. constants ext.half_float_oes half floating-point type (16-bit). ...
...on. if you set the magnification or minification filter in the webglrenderingcontext.texparameter() method to one of gl.linear, gl.linear_mipmap_nearest, gl.nearest_mipmap_linear, or gl.linear_mipmap_linear, and use half floating-point textures, the texture will be marked as incomplete. to use linear filtering on half floating-point textures, enable the oes_texture_half_float_linear extension in
addition to this extension. half floating-point color buffers this extension implicitly enables the ext_color_buffer_half_float extension (if supported), which allows rendering to 16-bit floating point formats. examples var ext = gl.getextension('oes_texture_half_float'); var texture = gl.createtexture(); gl.bindtexture(gl.texture_2d, texture); gl.teximage2d(gl.texture_2d, 0, gl.rgba, gl.rgba, ...
OfflineAudioContext - Web APIs
n audiocontext interface representing an audio-processing graph built from linked together audionodes. in contrast with a standard audiocontext, an offlineaudiocontext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an audiobuffer. ...
...eprecated methods offlineaudiocontext.resume() resumes the progression of time in an audio context that has previously 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 fired when the rendering of an offline audio context is complete. also available using the oncomplete event handler property. examples in this simple example, we declare both an audiocontext and an offlineaudiocontext object. we use the audiocontext to load an audio track via xhr (audi...
OrientationSensor - Web APIs
mples basic example the following example, which is loosely based on intel's orientation phone demo, instantiates an absoluteorientationsensor with a frequency of 60 times a second. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. ...
... of 60 times a second. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. const options = { frequency: 60, referenceframe: 'device' }; const sensor = new absoluteorientationsensor(options); sensor.
addeventlistener('reading', () => { // model is a three.js object instantiated elsewhere. model.quaternion.fromarray(sensor.quaternion).inverse(); }); sensor.
addeventlistener('error', error => { if (event.error.name == 'notreadableerror') { console.log("sensor is not available."); } }); sensor.start(); permissions example using orientation sensors requires requsting permissions for multiple device sensors. becuase the permissions uses promises, a good way to request permissions is to use promise.all. const sensor = new absoluteorientationsensor...
OscillatorNode - Web APIs
interpretation speakers constructor oscillatornode() creates a new instance of an oscillatornode object, optionally providing an object specifying default values for the node's properties. if the default values are acceptable, you can simply call the baseaudiocontext.createoscillator() factory method. properties inherits properties from its parent, audioscheduledsourcenode, and
adds the following properties: oscillatornode.frequency an a-rate audioparam representing the frequency of oscillation in hertz (though the audioparam returned is read-only, the value it represents is not). the default value is 440 hz (a standard middle-a note). oscillatornode.detune an a-rate audioparam representing detuning of oscillation in cents (though the audioparam returned is read-on...
...a periodicwave to describe a custom waveform. different waves will produce different tones. standard values are "sine", "square", "sawtooth", "triangle" and "custom". the default is "sine". event handlers oscillatornode.onended sets the event handler for the ended event, which fires when the tone has stopped playing. methods inherits methods from its parent, audioscheduledsourcenode, and
adds the following: oscillatornode.setperiodicwave() sets a periodicwave which describes a periodic waveform to be used instead of one of the standard waveforms; calling this sets the type to custom. this replaces the now-obsolete oscillatornode.setwavetable() method. oscillatornode.start() specifies the exact time to start playing the tone. oscillatornode.stop() specifies the time to stop pl...
PageTransitionEvent - Web APIs
the pagetransitionevent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded. ...
...or="middle" alignment-baseline="middle">pagetransitionevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, event. pagetransitionevent.persisted read only indicates if the document is loading from a cache. example html <!doctype html> <html> <body> </body> </html> javascript window.
addeventlistener('pageshow', myfunction); function myfunction(event) { if (event.persisted) { alert("the page was cached by the browser"); } else { alert("the page was not cached by the browser"); } } specifications specification status comment html living standardthe definition of 'pagetransitionevent' in that specification. living standard initia...
PaintWorklet.registerPaint - Web APIs
ons typeerror thrown when one of the arguments is invalid or missing. invalidmodificationerror thrown when the a worklet already exists with the specified name. examples the following shows registering an example worklet module. this should be in a separate js file. note that registerpaint() is called without a reference to paintworklet. the file itself is loaded through css.paintworklet.
addmodule() (documented here on the parent class of paintworklet, at worklet.
addmodule(). /* checkboardworklet.js */ class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', 'green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const ...
...npath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); the first step in using a paintworket is defining the paint worklet using the registerpaint() function, as done above. to use it, you register it with the css.paintworklet.
addmodule() method: <script> css.paintworklet.
addmodule('checkboardworklet.js'); </script> you can then use the paint() css function in your css anywhere an <image> value is valid. li { background-image: paint(checkerboard); } specifications specification status comment css painting api level 1the definition of 'paintworklet.registerpaint' in that specification. ...
PaintWorklet - Web APIs
cts a file. access this interface through css.paintworklet. properties paintworklet.devicepixelratio returns the current device's ratio of physical pixels to logical pixels. event handlers none. methods this interface inherits methods from worklet. paintworklet.registerpaint() registers a class programmatically generate an image where a css property expects a file. css.paintworklet.
addmodule() the
addmodule() method, inhertied from the worklet interface loads the module in the given javascript file and
adds it to the current paintworklet. examples the following three examples go together to show creating, loading, and using a paintworklet. create a paintworklet the following shows an example worklet module. this should be in a separate js file. note that registerpaint() i...
...llstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); load a paintworklet the following example demonstrates loading the above worklet from its js file and does so by feature detection. <script> if ('paintworklet' in css) { css.paintworklet.
addmodule('checkerboard.js'); } </script> use a paintworklet this example shows how to use a paintworklet in a stylesheet, including the simplest way to provide a fallback if paintworklet isn't supported. <style> textarea { background-image: url(checkerboard); background-image: paint(checkerboard); } </style> <textarea></textarea> you can also use the @supports at-rule. @supports ...
ParentNode.firstElementChild - Web APIs
shouldn't affect compatibility. syntax var element = node.firstelementchild; example <ul id="foo"> <li>first (1)</li> <li>second (2)</li> <li>third (3)</li> </ul> <script> var foo = document.getelementbyid('foo'); // yields: first (1) console.log(foo.firstelementchild.textcontent); </script> polyfill for ie8, ie9 and safari // overwrites native 'firstelementchild' prototype. //
adds document & documentfragment support for ie9 & safari. ;(function(constructor) { if (constructor && constructor.prototype && constructor.prototype.firstelementchild == null) { object.defineproperty(constructor.prototype, 'firstelementchild', { get: function() { var node, nodes = this.childnodes, i = 0; while (node = nodes[i++...
...efinition of 'parentnode.firstelementchild' in that specification. living standard split the elementtraversal interface in childnode and parentnode. this method is now defined on the latter. the document and documentfragment implemented the new interfaces. element traversal specificationthe definition of 'elementtraversal.firstelementchild' in that specification. obsolete
added its initial definition to the elementtraversal pure interface and use it on element. ...
ParentNode.replaceChildren() - Web APIs
are transferring to in another constant. it then calls replacechildren() on the list to transfer the options to, using the spread operator to pass in all the options contained in both constants. ...
...ntbyid('yes'); const nobtn = document.getelementbyid('to-no'); const yesbtn = document.getelementbyid('to-yes'); yesbtn.
addeventlistener('click', () => { const selectedtransferoptions = document.queryselectorall('#no option:checked'); const existingyesoptions = document.queryselectorall('#yes option'); yesselect.replacechildren(...selectedtransferoptions, ...existingyesoptions); }); nobtn.
addeventlistener('click', () => { const selectedtransferoptions = document.queryselectorall('#yes option:checked'); const existingnooptions = document.queryselectorall('#no option'); noselect.replacechildren(...selectedtransferoptions, ...existingnooptions); }); the end result looks like this: specification specification status comment domthe definition of 'parentno...
PasswordCredential - Web APIs
supporting browsers an instance of this class may be passed in the credential member of the init object for global fetch. note: this interface is restricted to top-level contexts and cannot be used from an <iframe>. constructor passwordcredential()secure context creates a new passwordcredential object. properties inherits properties from its ancestor, credential. passwordcredential.
additionaldata secure context one of a formdata instance, a urlsearchparams instance, or null. the data in the objects will be
added to the request body and sent to the remote endpoint with the credentials. passwordcredential.iconurl read only secure context a usvstring containing a url pointing to an image for an icon. this image is intended for display in a credential chooser. the url must be a...
... ? webview android full support 51chrome android full support 51firefox android ? opera android ? safari ios ? samsung internet android full support 5.0
additionaldata experimentaldeprecatedchrome full support 51edge full support ≤79firefox ? ie ? opera ? safari ? webview android full support 51chr...
PayerErrors.email - Web APIs
the email property is included in a payererrors object if the paymentresponse.payeremail property failed validation; in this case, the property should contain a string describing how to correct the problem. if the payer's email
address passed validation, this property is not included in the payererrors object. syntax payeremail = payererrors.email; value if validation of the payer's email
address (paymentresponse.payeremail) found problems, this property should be set to a domstring that explains the validation problem and how to correct it. if the email
address is valid, this property should be omitted from the payererrors object. example function validatepayment(response) { const correctionpromises let paymenterrors = {}; let payererrors = {}; // check payer detai...
...ns the validation problem and how to correct it. if the email
address is valid, this property should be omitted from the payererrors object. example function validatepayment(response) { const correctionpromises let paymenterrors = {}; let payererrors = {}; // check payer details if (!validemail(response.payeremail)) { payererrors.email = "please make sure you enter a valid email
address." } if (!validname(response.payername)) { payererrors.email = "please enter a valid name, using only <appropriate characters>." } if (!validphone(response.payerphone)) { payererrors.phone = "please enter a valid phone number in the form ###-###-####." } // check everything else too... // } specifications specification status comment payment r...
PaymentRequest: merchantvalidation event - Web APIs
an event handler is established for the merchantvalidation event. it uses the fetch() to send a request to its own server with an argument of the payment method's validation url, obtained from the event's validationurl property. the merchant server should access the validation url in accordance with the payment method documention. typically, a client should not access the validation url. ...
... candidate recommendation ...
PaymentRequest.onpaymentmethodchange - Web APIs
onpaymentmethodchange is invoked when the paymentmethodchange is fired, indicating that the user has changed payment methods within a given payment handler. for example, when using apple pay, the user can swipe to select different credit cards, debit cards, and so forth. each time the user does so, this event is fired. this event may not be fired by all payment handlers. syntax paymentrequest.
addeventlistener('paymentmethodchange', paymentmethodchangeevent => { ... }); paymentrequest.onpaymentmethodchange = function(paymentmethodchangeevent) { ... }; value an event handler function which is to be called whenever the paymentmethodchange event is fired at the paymentrequest, indicating that the user has changed payment methods within the same payment handler. the paymentmethodchange eve...
...er function which is to be called whenever the paymentmethodchange event is fired at the paymentrequest, indicating that the user has changed payment methods within the same payment handler. the paymentmethodchange event is triggered by a user-agent controlled interaction (i.e., the end-user switches from a debit to a credit card in the payment ui). to make sure you receive the event, you should
add event listeners to paymentrequest object after instantiation, but before you call show(). examples an example payment method change handler is shown below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple...
PaymentRequest.shippingOption - Web APIs
e paymentrequest.onshippingoptionchange and the paymentrequest.onshippingaoptionchange events are dispatched. in each calls to updatedetails() are made, one using a promise, and the other with a plain js object. this demotrates synchrounous and asynchronous updates to a payment sheet. ...
...ate to the total request.onshippingoptionchange = ev => { const shippingoption = shippingoptions.find( option => option.id === request.id ); const newtotal = { currency: "usd", label: "total due", value: calculatenewtotal(shippingoption), }; ev.updatewith({ ...details, total: newtotal }); }; async function checkshipping(request) { try { const json = request.shipping
address.tojson(); await ensurecanshipto(json); const { shippingoptions, total } = await calculateshipping(json); return { ...details, shippingoptions, total }; } catch (err) { return { ...details, error: `sorry! we can't ship to your
address.` }; } } specifications specification status comment payment request apithe definition of 'shippingoption' in th...
PaymentRequestUpdateEvent - Web APIs
the paymentrequestupdateevent interface is used for events sent to a paymentrequest instance when changes are made to shipping-related information for a pending paymentrequest. those events are: shipping
addresschange secure context dispatched whenever the user changes their shipping
address. also available using the onshipping
addresschange event handler property. shippingoptionchange secure context dispatched whenever the user changes a shipping option. also available using the onshippingoptionchange event handler property. ...
...event handler property. shippingoptionchange secure context dispatched whenever the user changes a shipping option. also available using the onshippingoptionchange event handler property. constructor paymentrequestupdateevent() secure context creates a new paymentrequestupdateevent object. properties provides only the properties inherited from its parent interface, event. methods in
addition to methods inherited from the parent interface, event, paymentrequestupdateevent offers the following methods: paymentrequestupdateevent.updatewith() secure context if the event handler determines that information included in the payment request needs to be changed, or that new information needs to be
added, it calls updatewith() with the information that needs to be replaced or
added. ...
PaymentResponse.onpayerdetailchange - Web APIs
le the payerdetailchange event when the user makes changes to their personal information while editing a payment request form. examples in the example below, onpayerdetailchange is used to set up a listener for the payerdetailchange event in order to validate the information entered by the user, requesting that any mistakes be corrected // options for paymentrequest(), indicating that shipping
address, // payer email
address, name, and phone number all be collected. const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerp...
...rname) { promisestovalidate.push(validatename(payername)); oldpayername = payername; } if (oldpayeremail !== payeremail) { promisestovalidate.push(validateemail(payeremail)); oldpayeremail = payeremail; } if (oldpayerphone !== payerphone) { promisestovalidate.push(validatephone(payerphone)); oldpayerphone = payerphone; } // as each validation promise resolves,
add the results of the // validation to the errors list const errors = await promise.all(promisestovalidate).then(results => results.reduce((errors, result), object.assign(errors, result)) ); // if we found any errors, wait for them to be corrected if (object.getownpropertynames(errors).length) { await response.retry(errors); } else { // we have a good payment; send the dat...
Performance - Web APIs
l context about the operations included in the times listed in timing, including whether the page was a load or a refresh, how many redirections occurred, and so forth. not available in workers. performance.timing read only a legacy performancetiming object containing latency-related performance information. not available in workers. performance.memory read only a non-standard extension
added in chrome, this property provides an object with basic memory usage information. you should not use this non-standard api. performance.timeorigin read only returns the high resolution timestamp of the start time of the performance measurement. methods the performance interface doesn't inherit any methods. performance.clearmarks() removes the given mark from the browser's performance...
...urns a domhighrestimestamp representing the number of milliseconds elapsed since a reference instant. performance.setresourcetimingbuffersize() sets the browser's resource timing buffer size to the specified number of "resource" type performance entry objects. performance.tojson() is a jsonizer returning a json object representing the performance object. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. resourcetimingbufferfull fired when the browser's resource timing buffer is full. also available via the onresourcetimingbufferfull property. specifications specification status comment high resolution time level 2the definition of 'performance' in that specification. ...
PerformanceFrameTiming - Web APIs
process a frame in about 16.7ms. an application can register a performanceobserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. this information can be used to help identify areas that take too long to provide a good user experience. ...
...erformanceframetiming</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but it extends the following performanceentry properties (for "frame" performance entry types) by qualifying and constraining the properties as follows: performanceentry.entrytype returns "frame". performanceentry.name returns the document's
address. performanceentry.starttime returns the timestamp when the frame was started. performanceentry.duration returns a timestamp indicating the difference between the starttimes of two successive frames. methods this interface has no methods. example see the example in using the frame timing api. specifications specification status comment frame timingthe definit...
PerformanceMark - Web APIs
performancemark is an abstract interface for performanceentry objects with an entrytype of "mark". entries of this type are created by calling performance.mark() to
add a named domhighrestimestamp (the mark) to the browser's performance timeline. ...
... performancemark is an abstract interface for performanceentry objects with an entrytype of "mark". entries of this type are created by calling performance.mark() to
add a named domhighrestimestamp (the mark) to the browser's performance timeline. ...
PerformanceMeasure - Web APIs
performancemeasure is an abstract interface for performanceentry objects with an entrytype of "measure". entries of this type are created by calling performance.measure() to
add a named domhighrestimestamp (the measure) between two marks to the browser's performance timeline. ...
... performancemeasure is an abstract interface for performanceentry objects with an entrytype of "measure". entries of this type are created by calling performance.measure() to
add a named domhighrestimestamp (the measure) between two marks to the browser's performance timeline. ...
PerformanceNavigationTiming - Web APIs
the performancenavigationtiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. ...
...>performancenavigationtiming</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface extends the following performanceentry properties for navigation performance entry types by qualifying and constraining them as follows: performanceentry.entrytype read only returns "navigation". performanceentry.name read only returns the document's
address. performanceentry.starttime read only returns a domhighrestimestamp with a value of "0". performanceentry.duration read only returns a timestamp that is the difference between the performancenavigationtiming.loadeventend and performanceentry.starttime properties. this interface also extends following performanceresourcetiming properties for navigation performance entry types by qualif...
PerformanceResourceTiming - Web APIs
on can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an xmlhttprequest, <svg>, image, or script. the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc.. ...
...s redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc..
additionally, the interface extends performanceentry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
Multi-touch interaction - Web APIs
ointer is a hardware-agnostic device that can target a specific set of screen coordinates. having a single event model for pointers can simplify creating web sites, applications and provide a good user experience regardless of the user's hardware. pointer events have many similarities to mouse events but they support multiple simultaneous pointers such as multiple fingers on a touch screen. this
additional feature can be used to provide richer user interaction models but at the cost of
additional complexity in the multi-touch interaction handling. this document demonstrates via example code, using pointer events with different multi-touch interactions. a live version of this application is available on github. the source code is available on github; pull requests and bug reports are welcome...
...thub. the source code is available on github; pull requests and bug reports are welcome. example this example demonstrates using pointer events' various event types (pointerdown, pointermove, pointerup pointercancel, etc.) for different multi-touch interactions. define touch targets the application uses <div> to define three different touch target areas. <style> div { margin: 0em; p
adding: 2em; } #target1 { background: white; border: 1px solid black; } #target2 { background: white; border: 1px solid black; } #target3 { background: white; border: 1px solid black; } </style> global state to support multi-touch interaction, preserving a pointer's event state during various event phases is required. this application uses three arrays to cach...
Pinch zoom gestures - Web APIs
there are many types of gestures, from the simple single-touch swipe gesture to the more complex multi-touch twist gesture, where the touch points (aka pointers) move in different directions. this example shows how to detect the pinch/zoom gesture, which uses pointer events to detect whether the user moves two pointers closer or farther apart from each other. a live version of this application is available on github. the source code is available on github; pull requests and bug reports are welcome. example in this example, you use the pointer events to simultaneously detect two pointing devices of any type, including fingers, mice, and pens. ...
...nch in (zoom out) gesture, which moves the two pointers toward each other, changes the target element's background color to lightblue. the pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the target element's background color to pink. define touch target the application uses <div> to define the pointers' target areas. <style> div { margin: 0em; p
adding: 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 prevdiff = -1; register event handlers event ha...
Using Pointer Events - Web APIs
ton> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below should be called by our <body> element's onload attribute (but in the example we use a button to trigger it, due to limitations of the mdn live example system). function startup() { var el = document.getelementsbytagname("canvas")[0]; el.
addeventlistener("pointerdown", handlestart, false); el.
addeventlistener("pointerup", handleend, false); el.
addeventlistener("pointercancel", handlecancel, false); el.
addeventlistener("pointermove", handlemove, false); log("initialized."); } 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...
...the result is that we stop tracking that touch point. handling canceled touches if the user's finger wanders into browser ui, or the touch otherwise needs to be canceled, the pointercancel event is sent, and we call the handlecancel() function below. function handlecancel(evt) { log("pointercancel: id = " + evt.pointerid); var idx = ongoingtouchindexbyid(evt.
ProgressEvent - Web APIs
the progressevent interface represents events measuring progress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
...derlying process is in the progress of performing. when downloading a resource using http, this only represent the content itself, not headers and other overhead. methods also inherits methods from its parent event. progressevent.initprogressevent() initializes a progressevent created using the deprecated document.createevent("progressevent") method. examples the following example
adds a progressevent to a new xmlhttprequest and uses it to display the status of the request. var progressbar = document.getelementbyid("p"), client = new xmlhttprequest() client.open("get", "magical-unicorns") client.onprogress = function(pe) { if(pe.lengthcomputable) { progressbar.max = pe.total progressbar.value = pe.loaded } } client.onloadend = function(pe) { progressbar.valu...
Proximity Events - Web APIs
nts but will never fire them. proximity events when the device proximity sensor detects a change between the device and an object, it notifies the browser of that change. when the browser gets such a notification, it fires a deviceproximityevent for any change, and a userproximityevent event in the case of a more rough change. this event can be captured at the window object level by using the
addeventlistener method (using the deviceproximity or userproximity event name) or by attaching an event handler to the window.ondeviceproximity or window.onuserproximity properties. once captured, the event object gives access to different kinds of information: the deviceproximityevent event provides an exact match for the distance between the device and the object through its value property. it...
...device and the object through its value property. it also provides the closest and farthest distance the device is able to detect something through its min and max properties. the userproximityevent event provides a rough approximation of the distance, expressed through a boolean. the userproximityevent.near property is true if the object is close or false if the object is far. ...
PublicKeyCredentialRequestOptions.extensions - Web APIs
for instance, extensions may be used for: backward compatibility with the legacy fido js api, knowing the user verification process, etc. note: an analogous option exists for the creation operation (navigators.credentials.create()), see publickeycredentialcreationoptions.extensions. ...
... appid usvstring fido appid. an appid which was used with legacy fido js apis to identify the current relying party. txauthsimple usvstring simple transaction authorization. this text is displayed on a prompt of the authenticator before verifying the user or testing their presence. the client outputs a usvstring which is the text as it was displayed (line breaks may have been
added). txauthgeneric an object with two properties: contenttype (usvstring) content (arraybuffer) generic transaction authorization. this is used to display an image or some non-textual content on the authenticator before verifying the user or testing their presence. the contenttype gives the mime type of the resource to be displayed while content gives i...
PushEvent.data - Web APIs
the data read-only property of the pushevent interface returns a reference to a pushmessagedata object containing data sent to the pushsubscription. syntax var mypushdata = pushevent.data; value a pushmessagedata object. examples the following example takes data from a pushevent and displays it on all of the service workers' clients. ...
... working draft initial definition. browser compatibility the compatibility table on this page...
RTCDTMFSender: tonechange event - Web APIs
ent 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>". ...
...rty 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>". ...
RTCDTMFSender - Web APIs
ation clients to be connected to a public-switched telephone network (pstn) or other legacy telephone service, including extant voice over ip (voip) services. for that reason, dtmf can't be used between two webrtc-based devices, because there is no mechanism provided by webrtc for receiving dtmf codes. ...
...nder.insertdtmf() given a string describing a set of dtmf codes and, optionally, the duration of and inter-tone gap between the tones, insertdtmf() starts sending the specified tones. calling insertdtmf() replaces any already-pending tones from the tonebuffer. you can abort sending queued tones by specifying an empty string ("") as the set of tones to play. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. tonechange the tonechange event is sent to the rtcdtmfsender instance's event handler to indicate that a tone has either started or stopped playing. also available using the ontonechange event handler property. example see the article using dtmf with webrtc for a full example. specifications ...
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 previous 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...
... 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 previously-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 definition of 'rtcdtmftonechangeevent' in that specification. candidate recommendation initia...
RTCDataChannel: message event - Web APIs
celable no interface messageevent event handler property onmessage note: the message event uses as its event object type the messageevent interface defined by the html specification. ...
... the message event uses as its event object type the messageevent interface defined by the html specification. examples for a given rtcdatachannel, dc, created for a peer connection using its createdatachannel() method, this code sets up a handler for incoming messages and acts on them by
adding the data contained within the message to the current document as a new <p> (paragraph) element. dc.
addeventlistener("message", ev => { let newparagraph = document.createelement("p"); let textnode = document.createtextnode(event.data); newparagraph.appendchild(textnode); document.body.appendchild(newparagraph); }, false); lines 2-4 create the new paragraph element and
add the message data to it as a new text node. line 6 appends the new paragraph to the end of the document's body. you c...
RTCDataChannel: open event - Web APIs
the webrtc open event is sent to an rtcdatachannel object's onopen event handler when the underlying transport used to send and receive the data channel's messages is opened or re-opened. ...
...le
adds to the rtcdatachannel dc a handler for the open event that adjusts the user interface to indicate that a chat window is ready to be used after a connection has been established. it enables the message input box and send button as well as enabling the disconnect button and disabling the connect button. finally, the message input box is focused so the user can immediately begin to type. dc.
addeventlistener("open", ev => { messageinputbox.disabled = false; sendmessagebutton.disabled = false; disconnectbutton.disabled = false; connectbutton.disabled = true; messageinputbox.focus(); }, false); this can also be done by directly setting the value of the channel's onopen event handler property. dc.onopen = ev => { messageinputbox.disabled = false; sendmessagebutton.disabled...
RTCIceCandidate.priority - Web APIs
er; the higher this value is, the better the remote peer considers the candidate to be. as is the case with most of rtcicecandidate's properties, the value of priority is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from an a-line string passed into rtcpeerconnection.
addicecandidate() instead of an rtcicecandidate. syntax var priority = rtcicecandidate.priority; value a long, unsigned integer value indicating the priority of the candidate according to the remote peer. the larger this value is, the more preferable the remote peer considers this candidate to be. priority is initialized to null if it is not specified in the candidate, or if the candidate string...
...ate.priority; value a long, unsigned integer value indicating the priority of the candidate according to the remote peer. the larger this value is, the more preferable the remote peer considers this candidate to be. priority is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. note: if priority is null, passing the candidate to
addicecandidate() will fail, throwing an operationerror exception. this applies only if the candidate implements the priority property. usage notes 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 e...
RTCIceCandidateInit.candidate - Web APIs
ect that encapsulates it. this is done in the event handler for the icecandidate event. if your client-side signaling layer builds and transmits a json string including the candidate to the remote peer, the remote peer might handle receiving that json message like this: function goticecandidatemessage(msg) { var icecandidate = new rtcicecandidate({ candidate: msg.candidate; }); pc.
addicecandidate(icecandidate).catch({ /* handle error */ }); } it's helpful to note that for backward compatibility with older versions of the webrtc specification, the rtcicecandidate() constructor accepts the value of candidate as its only input, in place of the rtcicecandidateinit dictionary. that usage would change the above sample to look like this: function goticecandidatemessage(msg) ...
... it's helpful to note that for backward compatibility with older versions of the webrtc specification, the rtcicecandidate() constructor accepts the value of candidate as its only input, in place of the rtcicecandidateinit dictionary. that usage would change the above sample to look like this: function goticecandidatemessage(msg) { var icecandidate = new rtcicecandidate(msg.candidate); pc.
addicecandidate(icecandidate).catch({ /* handle error */ }); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.candidate' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateStats.priority - Web APIs
e anywhere from 1 to 2,147,483,647. determining priority the ice specification describes how user agents and other software using webrtc should calculate the priority. ...
... specifications speci...
RTCIceTransport.state - Web APIs
tate 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 candidates will be sent. in
addition, all candidate pairs have been considered and a pair has been selected for use. if consent checks fail on all successful candidate pairs, the transport state will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has o...
...te will change to "failed". "disconnected" the ice agent has determined that connectivity has been lost for this rtcicetransport. this is not a failure state (that's "failed"). a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action. see the disconnected state for
additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking pairs of candidates, without successfully finding a pair that is both valid and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" ...
RTCIceTransport - Web APIs
ceparameters object describing the ice parameters established by a call to the rtcpeerconnection.setlocaldescription() method. returns null if parameters have not yet been received. getremotecandidates() returns an array of rtcicecandidate objects, one for each of the remote device's ice candidates that have been received by the local end of the rtcpeerconnection and delivered to ice by calling
addicecandidate(). getremoteparameters() returns a rtciceparameters object containing the ice parameters for the remote device, as set by a call to rtcpeerconnection.setremotedescription(). if setremotedescription() hasn't been called yet, the return value is null. getselectedcandidatepair() returns a rtcicecandidatepair object that identifies the two candidates—one for each end of the connecti...
...turns a rtcicecandidatepair object that identifies the two candidates—one for each end of the connection—that have been selected so far. it's possible that a better pair will be found and selected later; if you need to keep up with this, watch for the selectedcandidatepairchange event. if no candidate pair has been selected yet, the return value is null. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. gatheringstatechange sent to the rtcicetransport object to indicate that the value of the gatheringstate property has changed, indicating a change in this transport's ice candidate negotiation process. also available through the ongatheringstatechange event handler property. selectedcandidatepair...
RTCInboundRtpStreamStats.qpSum - Web APIs
in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcinboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcinboundrtpstreamstats object. ...
...that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process.
additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream. function cal...
RTCOutboundRtpStreamStats.qpSum - Web APIs
in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcoutboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent so far on the track described by the rtcoutboundrtpstreamstats object. ...
...that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process.
additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream. function cal...
RTCPeerConnection: datachannel event - Web APIs
a datachannel event is sent to an rtcpeerconnection instance when an rtcdatachannel has been
added to the connection, as a result of the remote peer calling rtcpeerconnection.createdatachannel(). note: this event is not dispatched when the local end of the connection creates the channel. bubbles no cancelable no interface rtcdatachannelevent event handler property ondatachannel examples this example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly
added rtcdatachannel and by
adding event handlers for the events that occur on that channel. ...
... the channel. bubbles no cancelable no interface rtcdatachannelevent event handler property ondatachannel examples this example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly
added rtcdatachannel and by
adding event handlers for the events that occur on that channel. pc.
addeventlistener("datachannel", ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; }, false); receivechannel is set to the value of the event's channel property, which specifies the rtcdatachannel object representing the data channel linking the remote peer to the local one. this sam...
RTCPeerConnection.getConfiguration() - Web APIs
onstructed with. the configuration includes a list of the ice servers used by the connection, information about transport policies, and identity information. syntax var configuration = rtcpeerconnection.getconfiguration(); parameters this method takes no input parameters. return value an rtcconfiguration object describing the rtcpeerconnection's current configuration. example this example
adds a new certificate to an active connection if it doesn't already have one in use. let configuration = mypeerconnection.getconfiguration(); if ((configuration.certificates != undefined) && (!configuration.certificates.length)) { rtcpeerconnection.generatecertificate({ name: 'rsassa-pkcs1-v1_5', hash: 'sha-256', moduluslength: 2048, publicexponent: new uint8array([1, 0,...
...hes the current configuration of the rtcpeerconnection, then looks to see if it has any certificates set by examining whether or not (a) the configuration has a value for certificates, and (b) whether its length is zero. if it's determined that there are no certificates in place, rtcpeerconnection.generatecertificate() is called to create a new certificate; we provide a fulfillment handler which
adds a new array containing the one newly-created certificate to the current configuration and passes it to setconfiguration() to
add the certificate to the connection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'getconfiguration()' in that specification. candidate recommendation initial definition.
RTCPeerConnection: iceconnectionstatechange event - Web APIs
when the negotiation process runs out of candidates to check, the ice connection transitions to one of two states. if no suitable candidates were found, the state transitions to failed. if at least one suitable candidate was successfully identified, the state transitions to completed. the ice layer makes this determination upon receiving the end-of-candidates signal, which is provided by caling
addicecandidate() with a candidate whose candidate property is an empty string (""), or by setting the rtcpeerconnection property cantrickleicecandidates to false. examples an event handler for this event can be
added using the rtcpeerconnection.oniceconnectionstatechange property or by using
addeventlistener() on the rtcpeerconnection. in this example, a handler for iceconnectionstatechange is se...
...connectionstatechange property or by using
addeventlistener() on the rtcpeerconnection. in this example, a handler for iceconnectionstatechange is set up to update a call state indicator by using the value of iceconnectionstate to create a string which corresponds to the name of a css class that we can assign to the status indicator to cause it to reflect the current state of the connection. ...
RTCPeerConnection: icecandidateerror event - Web APIs
of type rtcpeerconnectioniceerrorevent, and contains information describing the error in some amount of detail. bubbles no cancelable no interface rtcpeerconnectioniceerrorevent 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 is fired only once per server url from the list of available stun or turn servers provided when creating the rtcpeerconnection. these errors occur only when the connection's i...
... gathering. example the following example establishes a handler for icecandidateerrors that occur on the rtcpeerconnection pc. this handler looks specifically for 701 errors that indicate that candidates couldn't reach the stun or turn server. when this happens, the server url and the error message are passed to a function called reportconnectfail() to log or output the connection failure. pc.
addeventlistener("icecandidateerror", (event) => { if (event.errorcode === 701) { reportconnectfail(event.url, event.errortext); } }); note that if multiple stun and/or turn servers are provided when creating the connection, this error may happen more than once, if more than one of those servers fails. each provided server is tried until a connection is established. specifications ...
RTCPeerConnection.onnegotiationneeded - Web APIs
ifies a function which is called to handle the negotiationneeded event when it occurs on an rtcpeerconnection instance. this event is fired when a change has occurred which requires session negotiation. this negotiation should be carried out as the offerer, because some session changes cannot be negotiated as the answerer. most commonly, the negotiationneeded event is fired after a send track is
added to the rtcpeerconnection. if the session is modified in a manner that requires negotiation while a negotiation is already in progress, no negotiationneeded event will fire until negotiation completes, and only then if negotiation is still needed. syntax rtcpeerconnection.onnegotiationneeded = eventhandler; value this should be set to a function you provide which is passed a single paramete...
...at requires negotiation while a negotiation is already in progress, no negotiationneeded event will fire until negotiation completes, and only then if negotiation is still needed. syntax rtcpeerconnection.onnegotiationneeded = eventhandler; value this should be set to a function you provide which is passed a single parameter: an event object containing the negotiationneeded event. there's no
additional information provided in the event; anything you need, you can get by examining the properties of the rtcpeerconnection. example this example, derived from the example in signaling and video calling, establishes a handler for negotiationneeded events to handle creating an offer, configuring the local end of the connection, and sending the offer to the remote peer. pc.onnegotiationneeded ...
RTCPeerConnection.ontrack - Web APIs
syntax rtcpeerconnection.ontrack = eventhandler; value set ontrack to be a function you provide that accepts as input a rtctrackevent object describing the new track and how it's being used. ...
... syntax rtcpeerconnection.ontrack = eventhandler; value set ontrack to be a function you provide that accepts as input a rtctrackevent object describing the new track and how it's being used. ...
RTCPeerConnection.removeStream() - Web APIs
o "stable", the event negotiationneeded is sent on the rtcpeerconnection. ...
...erconnection. syntax rtcpeerconnection.removestream(mediastream); parameters mediastream a mediastream specifying the stream to remove from the connection. ...
RTCPeerConnection.removeTrack() - Web APIs
e the change until this negotiation occurs. a negotiationneeded event is sent to the rtcpeerconnection to let the local end know this negotiation must occur. syntax pc.removetrack(sender); parameters mediatrack a rtcrtpsender specifying the sender to remove from the connection. return value undefined. exceptions invalidstateerror the connection is not open. ...
... value undefined. exceptions invalidstateerror the connection is not open. example this example
adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button. var pc, sender; navigator.getusermedia({video: true}, function(stream) { pc = new rtcpeerconnection(); var track = stream.getvideotracks()[0]; sender = pc.
addtrack(track, stream); }); document.getelementbyid("closebutton").
addeventlistener("click", function(event) { pc.removetrack(sender); pc.close(); }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.removetrack()' in that specification. candidate recommendation initial...
RTCPeerConnection.setConfiguration() - Web APIs
common use case for this method (and even then, probably not a very common use case) is to replace the set of ice servers to be used. two potential scenarios in which this might be done: the rtcpeerconnection was instantiated without specifying any ice servers. if, for example, the rtcpeerconnection() constructor was called with no parameters, you would have to then call setconfiguration() to
add ice servers before ice negotiation could begin. renegotiation of the connection is needed, and a different set of ice servers needs to be used for some reason. perhaps the user has moved into a new region, so using new regional ice servers is necessary, for example. in this situation, one might call setconfiguration() to switch to new regional ice servers, then initiate an ice restart. you ca...
...r example. in this situation, one might call setconfiguration() to switch to new regional ice servers, then initiate an ice restart. you cannot change the identity information for a connection once it's already been set. syntax rtcpeerconnection.setconfiguration(configuration); parameters configuration an rtcconfiguration 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 prevents successful login to the server. invalidmodificationerror the configu...
RTCPeerConnection.setLocalDescription() - Web APIs
take place. invalidsessiondescriptionerror the rtcsessiondescription specified by the sessiondescription parameter is invalid. examples implicit descriptions one of the advantages of the parameter-free form of setlocaldescription() is that it lets you simplify your negotiation code substantially. this is all your negotiationneeded event handler needs to look like, for the most part. ...
...ondescription parameter is invalid. examples implicit descriptions one of the advantages of the parameter-free form of setlocaldescription() is that it lets you simplify your negotiation code substantially. this is all your negotiationneeded event handler needs to look like, for the most part. just
add the signaling server code, which here is represented by the call to signalremotepeer(). ...
RTCPeerConnection.setRemoteDescription() - Web APIs
at that for more details and a more in-depth explanation of what's going on. ...
...(handlegetusermediaerror); } after creating our rtcpeerconnection and saving it as mypeerconnection, we pass the description included in the received offer message, msg, directly into setremotedescription() to tell the user agent's webrtc layer what configuration the caller has proposed using. when our promise fulfillment handler is called, indicating that this has been done, we create a stream,
add it to the connection, then create an sdp answer and call setlocaldescription() to set that as the configuration at our end of the call before forwarding that answer to the caller. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.setremotedescription()' in that specification. candid...
RTCPeerConnection: track event - Web APIs
the track event is sent to the ontrack event handler on rtcpeerconnections after a new track has been
added to an rtcrtpreceiver which is part of the connection. bubbles yes cancelable no interface rtctrackevent event handler property ontrack by the time this event is delivered, the new track has been fully
added to the peer connection. see track event types in rtctrackevent for details. examples this example shows code that creates a new rtcpeerconnection, then
adds a new track event handler. ...
...ed, the new track has been fully
added to the peer connection. see track event types in rtctrackevent for details. examples this example shows code that creates a new rtcpeerconnection, then
adds a new track event handler. pc = new rtcpeerconnection({ iceservers: [ { urls: "turn:fake.turnserver.url", username: "someusername", credential: "somepassword" } ] }); pc.
addeventlistener("track", e => { videoelement.srcobject = e.streams[0]; hangupbutton.disabled = false; }, false); the event handler assigns the new track's first stream to an existing <video> element, identified using the variable videoelement. you can also assign the event handler function to the ontrack property, rather than use
addeventlistener(). pc.ontrack = e => { videoelement.srcobjec...
RTCPeerConnectionIceErrorEvent - Web APIs
tor rtcpeerconnectioniceerrorevent() creates and returns a new rtcpeerconnectioniceerrorevent 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 rtcpeerconnectioniceerrorevent 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 stating the numeric stun error code returned by the stun or turn server. if no host candidate can reach the ser...
...errortext read only a domstring containing the stun reason text returned by the stun or turn server. if communication with the stun or turn server couldn't be established at all, this string will be a browser-specific string explaining the error. 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 rtcpeerconnectioniceerrorevent has no methods other than any provided by the parent interface, event. examples tbd specifications specification status comment ...
RTCRtpStreamStats.qpSum - Web APIs
in general, the higher this number is, the more heavily compressed the video data is. syntax var qpsum = rtcrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcrtpstreamstats object. ...
...that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process.
additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcrtpstreamstats object, returning 0 if the object doesn't describe an rtp stream. function calculateaverageqp(stats) { ...
RTCRtpStreamStats - Web APIs
the rtcrtpstreamstats dictionary is returned by the rtcpeerconnection.getstats(), rtcrtpsender.getstats(), and rtcrtpreceiver.getstats() methods to provide detailed statistics about webrtc connectivity. while the dictionary has a base set of properties that are present in each of these cases, there are also
additional properties
added depending on which interface the method is called on. rtcrtpstreamstats is the base class for all rtp-related statistics reports. it's based on rtcstats and
adds the following
additional fields. note: this interface was called rtcrtpstreamstats until a specification update in the spring of 2017. check the browser compatibility table to know if and when the name change was implemented in specific browsers. properties the rtcrtpstreamstats dictionary is bas...
... standard fields included for all media types codecid a domstring which uniquely identifies the object which was inspected to produce the rtccodecstats object associated with this rtp stream. ...
RTCStats - Web APIs
is statistics object. type a domstring indicating the type of statistics the object contains, taken from the enum type rtcstatstype. ...
...rtcstatstype. the statistics type hierarchy the various dictionaries that are used to define the contents of the objects that contain each of the various types of statistics for webrtc are structured in such a way that they build upon the core rtcstats dictionary, each layer
adding more relevant information. rtcstats is the foundation of all webrtc statistics objects rtcrtpstreamstats
adds to rtcstats information that applies to all rtp endpoints (that is, both local and remote endpoints, and regardless of whether the endpoint is a sender or a receiver) rtcreceivedrtpstreamstats further
adds statistics measured at the receiving end of an rtp stream, regardless of whether it's local or remote. rtcinboundrtpstreamstats contains statistics that can only be m...
RTCTrackEvent() - Web APIs
the rtctrackevent() constructor creates and returns a new rtctrackevent object, configured to describe the track which has been
added to the rtcpeerconnection. in general, you won't need to use this constructor, as rtctrackevent objects are created by webrtc and delivered to your rtcpeerconnector's ontrack event handler as appropriate. syntax trackevent = new rtctrackevent(eventinfo); parameters eventinfo an object based on the rtctrackeventinit dictionary, providing information about the track which has been
added to the rtcpeerconnection. this object has the following properties: receiver the rtcrtpreceiver which is being used to receive the track's media. streams optional an array of mediastream objects representing each of the streams that comprise the event's corresponding ...
...eiver the rtcrtpreceiver which is being used to receive the track's media. streams optional an array of mediastream objects representing each of the streams that comprise the event's corresponding track. track the mediastreamtrack the event is associated with. transceiver the rtcrtptransceiver associated with the event. return value a new rtctrackevent describing a track which has been
added to the rtcpeerconnection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent()' in that specification. candidate recommendation initial specification. ...
Range.selectNodeContents() - Web APIs
(referencenode); parameters referencenode the node whose contents will be selected within a range. example range = document.createrange(); referencenode = document.getelementsbytagname("div")[0]; range.selectnodecontents(referencenode); live sample this example lets the user select and deselect a paragraph with buttons. document.createrange(), range.selectnodecontents(), and selection.
addrange() are used to select the content. window.getselection() and selection.removeallranges() are used to deselect it. html <p id="p"><b>use the buttons below</b> to select or deselect the contents of this paragraph.</p> <button id="select-button">select paragraph</button> <button id="deselect-button">deselect paragraph</button> javascript const p = document.getelementbyid('p'); const selectb...
...="p"><b>use the buttons below</b> to select or deselect the contents of this paragraph.</p> <button id="select-button">select paragraph</button> <button id="deselect-button">deselect paragraph</button> javascript const p = document.getelementbyid('p'); const selectbutton = document.getelementbyid('select-button'); const deselectbutton = document.getelementbyid('deselect-button'); selectbutton.
addeventlistener('click', e => { // clear any current selection const selection = window.getselection(); selection.removeallranges(); // select paragraph const range = document.createrange(); range.selectnodecontents(p); selection.
addrange(range); }); deselectbutton.
addeventlistener('click', e => { const selection = window.getselection(); selection.removeallranges(); }); result ...
Range - Web APIs
e given node intersects the range. range.ispointinrange() returns a boolean indicating whether the given point is in the range. specifications specification status comment domthe definition of 'range' in that specification. living standard do not use rangeexception anymore, use domexception instead. made the second parameter of collapse() optional.
added the methods ispointinrange(), comparepoint(), and intersectsnode().
added the constructor range(). dom parsing and serializationthe definition of 'extensions to range' in that specification. working draft
added the method createcontextualfragment(). css object model (cssom) view modulethe definition of 'extensions to range' in that specification. working draft ...
...ed the methods ispointinrange(), comparepoint(), and intersectsnode().
added the constructor range(). dom parsing and serializationthe definition of 'extensions to range' in that specification. working draft
added the method createcontextualfragment(). css object model (cssom) view modulethe definition of 'extensions to range' in that specification. working draft
added the methods getclientrects() and getboundingclientrect(). document object model (dom) level 2 traversal and range specificationthe definition of 'range' in that specification. obsolete initial specification. ...
ReadableStream.ReadableStream() - Web APIs
e generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. ...
...ut of the stream. ...
ReadableStreamDefaultController.close() - Web APIs
e generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. ...
...ut of the stream. ...
ReadableStreamDefaultController.enqueue() - Web APIs
e generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. ...
...ut of the stream. ...
ReadableStreamDefaultController - Web APIs
is provided as the parameter of the start() and pull() functions. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. ...
...ut of the stream. ...
RelativeOrientationSensor - Web APIs
ientation phone demo, instantiates an relativeorientationsensor with a frequency of 60 times a second. note that the intel demo this is based on uses the absoluteoreintationsensor. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. ...
...uteoreintationsensor. on each reading it uses orientationsensor.quaternion to rotate a visual model of a phone. const options = { frequency: 60, referenceframe: 'device' }; const sensor = new relativeorientationsensor(options); sensor.
addeventlistener('reading', () => { // model is a three.js object instantiated elsewhere. model.quaternion.fromarray(sensor.quaternion).inverse(); }); sensor.
addeventlistener('error', error => { if (event.error.name == 'notreadableerror') { console.log("sensor is not available."); } }); sensor.start(); permissions example using orientation sensors requires requsting permissions for multiple device sensors. becuase the permissions uses promises, a good way to request permissions is to use promise.all. const sensor = new relativeorientationsensor...
SVGAnimationElement: endEvent event - Web APIs
rg/2000/svg" width="300px" height="100px"> <title>svg smil animate with path</title> <circle cx="0" cy="50" r="50" fill="blue" stroke="black" stroke-width="1"> <animatemotion path="m 0 0 h 300 z" dur="5s" repeatcount="indefinite" /> </circle> </svg> <hr> <button>stop animation</button> <ul> </ul> ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; p
adding: 10px 30px; } let svgelem = document.queryselector('svg'); let animateelem = document.queryselector('animatemotion'); let list = document.queryselector('ul'); let btn = document.queryselector('button'); animateelem.
addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.ad...
... = document.queryselector('button'); animateelem.
addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.
addeventlistener('endevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'endevent fired'; list.appendchild(listitem); }) animateelem.
addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) btn.
addeventlistener('click', () => { btn.disabled = true; animateelem.setattribute('repeatcount', '1'); }) event handler property equivalent note...
SVGFEGaussianBlurElement - Web APIs
the svgfegaussianblurelement interface corresponds to the <fegaussianblur> element. ...
...lso inherits methods of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. svgfegaussianblurelement.setstddeviation() sets the values for the stddeviation attribute. specifications specification status comment filter effects module level 1the definition of 'svgfegaussianblurelement' in that specification. working draft
added edgemode property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgfegaussianblurelement' in that specification. recommendation initial definition ...
SVGImageElement - Web APIs
the svgimageelement interface corresponds to the <image> element. ...
...eady to be used. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgimageelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggraphicselement, removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable and
added the crossorigin property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgimageelement' in that specification. recommendation initial definition ...
SVGSVGElement - Web APIs
the svgsvgelement interface provides access to the properties of <svg> elements, as well as methods to manipulate them. this interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
... specification status comment scalable vector graphics (svg) 2the definition of 'svgsvgelement' in that specification. candidate recommendation replaced the inheritance from svgelement by svggraphicselement, removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, svglocatable, documentevent, viewcss, and documentcss and
added implemented interface windoweventhandlers. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgsvgelement' in that specification. recommendation initial definition ...
SVGScriptElement - Web APIs
the svgscriptelement interface corresponds to the svg <script> element. ...
...ipt> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgscriptelement' in that specification. candidate recommendation removed the implemented interface svgexternalresourcesrequired and
added the crossorigin property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgscriptelement' in that specification. recommendation initial definition ...
SVGStyleElement - Web APIs
svg style interface the svgstyleelement interface corresponds to the svg <style> element. ...
...his restriction was removed in svg 2. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement and implements methods from linkstyle. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgstyleelement' in that specification. candidate recommendation
added inheritance of linkstyle. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgstyleelement' in that specification. recommendation initial definition ...
SVGTextContentElement - Web APIs
the svgtextcontentelement interface is implemented by elements that support rendering child text content. it is inherited by various text-related interfaces, such as svgtextelement, svgtspanelement, svgtrefelement, svgaltglyphelement and svgtextpathelement. ...
... the given element. svgtextcontentelement.lengthadjust read only an svganimatedenumeration reflecting the lengthadjust attribute of the given element. the numeric type values represent one of the constant values above. methods this interface also inherits methods from its parent, svggraphicselement. svgtextcontentelement.getnumberofchars() returns a long representing the total number of
addressable characters available for rendering within the current element, regardless of whether they will be rendered. svgtextcontentelement.getcomputedtextlength() returns a float representing the computed length for the text within the element. svgtextcontentelement.getsubstringlength() returns a float representing the computed length of the formatted text advance distance for a substring of t...
SVGURIReference - Web APIs
the svgurireference interface is used to reflect the href attribute and the deprecated xlink:href attribute. ...
...r-events: all;} properties svgurireference.href read only an svganimatedstring that represents the value of the href attribute, and, on elements that are defined to support it, the deprecated xlink:href attribute. on getting href, an svganimatedstring object is returned that reflects the href attribute, and if the element is defined to support the deprecated xlink:href attribute,
additionally reflects that deprecated attribute. methods this interface does not provide any specific methods. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgurireference' in that specification. candidate recommendation replaced the deprecated xlink:href attribute reference by the href attribute and made the pri...
Screen - Web APIs
le between 0 and 1.0 is expected. events handler screen.onorientationchange a handler for the orientationchange event. ...
... see also webidl bindings. ...
Screen Wake Lock API - Web APIs
atuselem.textcontent = `${err.name}, ${err.message}`; } } releasing wake lock the following example shows how to release the previously acquired wake lock. wakelock.release() .then(() => { wakelock = null; }); listening for wake lock release this example updates the ui if the wake lock has been released for any reason (such as navigating away from the active window/tab). ...
...wake lock has been released for any reason (such as navigating away from the active window/tab). wakelock.
addeventlistener('release', () => { // the wake lock has been released statuselem.textcontent = 'wake lock has been released'; }); reacquiring a wake lock the following code reacquires the wake lock should the visibility of the document change and the wake lock is released. document.
addeventlistener('visibilitychange', () => { if (wakelock !== null && document.visibilitystate === 'visible') { wakelock = await navigator.wakelock.request('screen'); } }); putting it all together you can find the complete code on github here. the demo uses a button to acquire a wake lock and also release it, which in turn updates the ui. the ui also updates if the wake lock is released aut...
ScriptProcessorNode: audioprocess event - Web APIs
the audioprocess event of the scriptprocessornode interface is fired when an input buffer of a script processor is ready to be processed. ...
...} specifications specification status comment web audio apithe definition of 'audioprocessingevent' in that...
Selection.containsNode() - Web APIs
snode() only returns true when the entire node is part of the selection. if not specified, the default value false is used. example check for selection this snippet checks whether anything inside the body element is selected. console.log(window.getselection().containsnode(document.body, true)); find the hidden word in this example, a message appears when you select the secret word. ...
...the secret word. it uses
addeventlistener() to check for selectionchange events. html <p>can you find the secret word?</p> <p>hmm, where <span id="secret" style="color:transparent">secret</span> could it be?</p> <p id="win" hidden>you found it!</p> javascript const secret = document.getelementbyid('secret'); const win = document.getelementbyid('win'); // listen for selection changes document.
addeventlistener('selectionchange', () => { const selection = window.getselection(); const found = selection.containsnode(secret); win.toggleattribute('hidden', !found); }); result specifications specification status comment selection apithe definition of 'selection.containsnode()' in that specification. working draft current ...
Selection API - Web APIs
er. concepts and usage to retrieve the current text range the user has selected, you can use the window.getselection() or document.getselection() method, storing the return value — a selection object — in a variable for futher use. once your selection is in a variable, you perform a variety of operations on it, for example copying the selection to a text string using selection.tostring(),
adding a range (as represented by a standard range object) to the selection (or removing one) with selection.
addrange()/selection.removerange(), or changing the selection to be the entire contents of a dom node using selection.selectallchildren(). you can run code in response to the selection being changed, or a new selection being started, using the globaleventhandlers.onselectionchange and globale...
... opera full support yessafari full support yeswebview andr...
ServiceWorker.onstatechange - Web APIs
} ) examples this code snippet is from the service worker registration-events sample (live demo). the code listens for any change in the serviceworker.state and returns its value. ...
...for example: navigator.serviceworker.register(..).then(function(swr) { swr.installing.state == "installing" swr.installing.onstatechange = function() { swr.installing == null; // at this point, swr.waiting or swr.active mig...
ServiceWorkerContainer.startMessages() - Web APIs
rolling service worker to the page (using client.postmessage()) are queued while the page is loading, and get dispatched once the page's html document has been loaded and parsed (i.e. after the domcontentloaded event fires). it's possible to start dispatching these messages earlier by calling serviceworkercontainer.startmessages(), for example if you've invoked a message handler using eventtarget.
addeventlistener() before the page has finished loading, but want to start processing the messages right away. note: the messages start being sent automatically when setting the handler directly using serviceworkercontainer.onmessage. in this you don't need startmessages(). syntax serviceworkercontainer.startmessages(); parameters none. return value undefined. examples if('serviceworker' i...
...r directly using serviceworkercontainer.onmessage. in this you don't need startmessages(). syntax serviceworkercontainer.startmessages(); parameters none. return value undefined. examples if('serviceworker' in navigator) { navigator.serviceworker .register('/sw.js') .then(function() { console.log('service worker registered'); }); } // ... navigator.serviceworker.
addeventlistener('message', (e) => { // ... }); navigator.serviceworker.startmessages(); specifications specification status comment service workersthe definition of 'serviceworkercontainer: startmessages()' in that specification. working draft initial definition. ...
ServiceWorkerGlobalScope: install event - Web APIs
eworkerregistration.installing worker. ...
... event handler property serviceworkerglobalscope.oninstall examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.
addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.
add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ); }) ); }); you can also set up the ev...
ServiceWorkerGlobalScope: message event - Web APIs
interface extendablemessageevent event handler property onmessage examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then calls its postmessage() function. ...
...r.serviceworker.
addeventlistener('message', event => { // event is a messageevent object console.log(`the service worker sent me a message: ${event.data}`); }); navigator.serviceworker.ready.then( registration => { registration.active.postmessage("hi service worker"); }); } the service worker can receive the message by listening to the message event: // in the service worker
addeventlistener('message', event => { // event is an extendablemessageevent object console.log(`the client sent me a message: ${event.data}`); event.source.postmessage("hi client"); }); specifications specification status service workersthe definition of 'message' in that specification. working draft ...
ServiceWorkerGlobalScope: notificationclick event - Web APIs
the notificationclick event is fired to indicate that a system notification spawned by serviceworkerregistration.shownotification() has been clicked. ...
... the notificationclick event is fired to indicate that a system notification spawned by serviceworkerregistration.shownotification() has been clicked. ...
ServiceWorkerGlobalScope.oninstall - Web APIs
ace is an event handler fired whenever an install event occurs (when the service worker installs). this happens before activation. syntax serviceworkerglobalscope.oninstall = function(event) { ... ...
... syntax serviceworkerglobalscope.oninstall = function(event) { ... ...
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so). this offers an opportunity to resubscribe in order to continue receiving push messages, if desired. this might happen if, for example, the push service sets an expiration time a subscription. syntax serviceworkerglobalscope.onpushsubscriptionchange = function() { ... ...
...een invalidated (or is about to become so). this offers an opportunity to resubscribe in order to continue receiving push messages, if desired. this might happen if, for example, the push service sets an expiration time a subscription. syntax serviceworkerglobalscope.onpushsubscriptionchange = function() { ... } self.
addeventlistener('pushsubscriptionchange', function() { ... }) example self.
addeventlistener('pushsubscriptionchange', function() { // do something, usually resubscribe to push and // send the new subscription details back to the // server via xhr or fetch }); specifications specification status comment push apithe definition of 'onpushsubscriptionchange' in that specification. working draft initial definition (note: this event is specif...
SharedWorker - Web APIs
ess it, even if their pages are running inside different windows. the following code snippet shows creation of a sharedworker object using the sharedworker() constructor. both scripts contain this: var myworker = new sharedworker('worker.js'); both scripts then access the worker through a messageport object created using the sharedworker.port property. ...
...e the worker we use the sharedworkerglobalscope.onconnect handler to connect to the same port discussed above. the ports associated with that worker are accessible in the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.
addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using
addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'sharedworker' in that specification. ...
SharedWorkerGlobalScope: connect event - Web APIs
ssage() method can be used to send messages back to the main thread using the worker. ...
...worker. self.onconnect = function(e) { var port = e.ports[0]; port.onmessage = function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); } port.start(); } for a complete running example, see our basic shared worker example (run shared worker.)
addeventlistener equivalent you could also set up an event handler using the
addeventlistener() method: self.
addeventlistener('connect', function(e) { var port = e.ports[0]; port.onmessage = function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); } }); specifications specification status html living standardthe definition of 'connect event' in that specification. living standard ...
SharedWorkerGlobalScope - Web APIs
see the complete list of functions available to workers. properties this interface inherits properties from the workerglobalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. ...
...ry data. windowtimers.clearinterval() cancels the repeated execution set using windowtimers.setinterval(). windowtimers.cleartimeout() cancels the repeated execution set using windowtimers.settimeout(). windowtimers.setinterval() schedules the execution of a function every x milliseconds. windowtimers.settimeout() sets a delay for executing a function. events listen to this event using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. connect fired on shared workers when a new client connects. also available via the onconnect property. specifications specification status comment html living standardthe definition of 'sharedworkerglobalscope' in that specification. living standard ...
SourceBuffer.abort() - Web APIs
se api is fully asynchronous, but this step seems to suggest a synchronous (blocking) operation, which doesn't make sense. saying that, current implementations can be useful in certain situations, when you want to stop the current append (or whatever) operation occuring on a sourcebuffer, and then immediately start performing operations on it again. for example, consider this code: sourcebuffer.
addeventlistener('updateend', function (_) { ... }); sourcebuffer.appendbuffer(buf); let's say that after the call to appendbuffer but before the updateend event fires (i.e. a buffer is being appended but the operation has not yet completed) a user "scrubs" the video seeking to a new point in time. in this case you would want to manually call abort() on the source buffer to stop the decoding of ...
...ser "scrubs" the video seeking to a new point in time. in this case you would want to manually call abort() on the source buffer to stop the decoding of the current buffer, then fetch and append the newly requested segment that relates to the current new position of the video. you can see something similar in action in nick desaulnier's bufferwhenneeded demo — in line 48, an event listener is
added to the playing video so a function called seek() is run when the seeking event fires. in lines 92-101, the seek() function is defined — note that abort() is called if mediasource.readystate is set to open, which means that it is ready to receive new source buffers — at this point it is worth aborting the current segment and just getting the one for the new seek position (see checkbuffer() a...
SourceBuffer - Web APIs
the sourcebuffer interface represents a chunk of media to be passed into an htmlmediaelement and played, via a mediasource object. this can be made up of one or several media segments. ...
... = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.
addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.
addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.
addeventlistener('updateend', function (_) { mediasource.endofstream...
SourceBufferList - Web APIs
ultiple sourcebuffer objects. the source buffer list containing the sourcebuffers appended to a particular mediasource can be retrieved using the mediasource.sourcebuffers property. the individual source buffers can be accessed using array operator (i.e. []) or functions such as foreach() for example. ...
...ext x="231" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">sourcebufferlist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties sourcebufferlist.length read only returns the number of sourcebuffer objects in the list. event handlers sourcebufferlist.on
addsourcebuffer the event handler for the
addsourcebuffer event. sourcebufferlist.onremovesourcebuffer the event handler for the removesourcebuffer event. methods inherits methods from its parent interface, eventtarget. sourcebufferlist: indexed property getter this getter allows the sourcebuffer objects in the list to be accessed with an array operator (i.e. [].) examples tbd. specific...
SpeechGrammarList.SpeechGrammarList() - Web APIs
the speechgrammarlist() constructor creates a new speechgrammarlist object instance. syntax var mygrammarlist = new speechgrammarlist(); parameters none. examples in our simple speech color changer example, we create a new speechrecognition object instance using the speechrecognition() constructor, create a new speechgrammarlist,
add our grammar string to it using the speechgrammarlist.
addfromstring method, and set it to be the grammar that will be recognised by the speechrecognition instance using the speechrecognition.grammars property. var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lim...
... draft ...
SpeechRecognition: end event - Web APIs
the end event of the web speech api speechrecognition object is fired when the speech recognition service has disconnected. ...
...event of the web speech api speechrecognition object is fired when the speech recognition service has disconnected. bubbles no cancelable no interface event event handler property onend examples you can use the end event in an
addeventlistener method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.
addeventlistener('end', function() { console.log('speech recognition service disconnected'); }); or use the onend event handler property: recognition.onend = function() { console.log('speech recognition service disconnected'); } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specification. draft ...
SpeechSynthesisUtterance: start event - Web APIs
the start event of the web speech api speechsynthesisutterance object is fired when the utterance has begun to be spoken. ...
... the start event of the web speech api speechsynthesisutterance object is fired when the utterance has begun to be spoken. ...
Storage - Web APIs
the storage interface of the web storage api provides access to a particular domain's session or local storage. it allows, for example, the
addition, modification, or deletion of stored data items. to manipulate, for instance, the session storage for a domain, a call to window.sessionstorage is made; whereas for local storage the call is made to window.localstorage. properties storage.length read only returns an integer representing the number of data items stored in the storage object. methods storage.key() when passed a number n, this method will return the name of the nth key in the storage. ...
...ndow.localstorage. properties storage.length read only returns an integer representing the number of data items stored in the storage object. methods storage.key() when passed a number n, this method will return the name of the nth key in the storage. storage.getitem() when passed a key name, will return that key's value. storage.setitem() when passed a key name and value, will
add that key to the storage, or update that key's value if it already exists. storage.removeitem() when passed a key name, will remove that key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor')...
StorageEvent - Web APIs
a storageevent is sent to a window when a storage area it has access to is changed within the context of another document. ...
...ey attribute is null when the change is 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 previous 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...
Using the Storage Access API - Web APIs
t.cookie access, as browsers will often return an empty cookie jar when third-party cookies are blocked. accessing a user's cookies in an embedded cross-origin iframe in this example we show how an embedded cross-origin <iframe> can access a user’s cookies under a storage access policy that blocks third-party cookies. first of all, if the <iframe> is sandboxed, the embedding website needs to
add the allow-storage-access-by-user-activation sandbox token to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin"> ... </iframe> now on to the code exec...
... // set a cookie localstorage.setitem("username", "john"); // access a localstorage entry }).catch(_ => { // error obtaining storage access. }); note that access requests are automatically denied unless the embedded content is currently processing a user gesture such as a tap or click — so this code needs to be run inside some kind of user gesture-based event handler, for example: btn.
addeventlistener('click', () => { // run code here }); ...
Streams API concepts - Web APIs
some of the concepts and terminology associated with streams might be new to you — this article explains all you need to know. readable streams a readable stream is a data source represented in javascript by a readablestream object that flows from an underlying source — this is a resource somewhere on the network or elsewhere on your domain that you want to get data from. ...
... see transform streams for ideas, and this web sockets example. readablestream.pipeto() — pipes to a writable stream that acts as the end point of the pipe chain. the start of the pipe chain is called the original source, and the end is called the ultimate sink. note: this functionality isn't fully thought through yet, or available in many browsers. at some point the spec writers hope to
add something like a transformstream class to make creating transform streams easier. backpressure an important concept in streams is backpressure — this is the process by which a single stream or a pipe chain regulates the speed of reading/writing. when a stream later in the chain is still busy and isn't yet ready to accept more chunks, it sends a signal backwards through the chain to tell earl...
StylePropertyMap.append() - Web APIs
value the value the given property should have. return value undefined. ...
... value the value the given property should have. return value undefined. ...
StylePropertyMap - Web APIs
the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an alternative to cssstyledeclaration. ...
..."12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">stylepropertymap</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, stylepropertymapreadonly. methods inherits methods from its parent, stylepropertymapreadonly. stylepropertymap.append()
adds a new css declaration to the stylepropertymap with the given property and value. stylepropertymap.clear() removes all declarations in the stylepropertymap. stylepropertymap.delete() removes the css declaration with the given property. stylepropertymap.set() changes the css declaration with the given property. specifications specification status comment css typed ...
SubmitEvent - Web APIs
the submitevent interface defines the object used to represent an html form's submit event. this event is fired at the <form> when the form's submit action is invoked. constructor submitevent() creates and returns a new submitevent object whose type and other options are configured as specified. note that currently, the only valid type for a submitevent is submit. properties in
addition to the properties listed below, this interface inherits the properties of its parent interface, event. submitter read only an htmlelement object which identifies the button or other element which was invoked to trigger the form being submitted. methods while submitevent offers no methods of its own, it inherits any specified by its parent interface, event. examples in this example, a shoppin...
...ples in this example, a shopping cart may have an assortment of different submit buttons depending on factors such as the user's settings, the shop's settings, and any minimum or maximum shopping card totals established by the payment processors. each of the submit elements' id is used to identify which payment processor the button corresponds to. let form = document.queryselector("form"); form.
addeventlistener("submit", (event) => { let submitter = event.submitter; let handler = submitter.id; if (handler) { processorder(form, handler); } else { showalertmessage("an unknown or unaccepted payment type was selected. please try again.", "ok"); } }); the handler id is obtained by using the submit event's submitter property to get the submit button, from which we then get t...
SubtleCrypto.deriveKey() - Web APIs
y(aliceskeypair.privatekey, bobskeypair.publickey); // bob generates the same secret key using his private key and alice's public key. let bobssecretkey = await derivesecretkey(bobskeypair.privatekey, aliceskeypair.publickey); // alice can then use her copy of the secret key to encrypt a message to bob. ...
...iceskeypair.publickey); // alice can then use her copy of the secret key to encrypt a message to bob. let encryptbutton = document.queryselector(".ecdh .encrypt-button"); encryptbutton.
addeventlistener("click", () => { encrypt(alicessecretkey); }); // bob can use his copy to decrypt the message. let decryptbutton = document.queryselector(".ecdh .decrypt-button"); decryptbutton.
addeventlistener("click", () => { decrypt(bobssecretkey); }); } pbkdf2 in this example we ask the user for a password, then use it to derive an aes key using pbkdf2, then use the aes key to encrypt a message. see the complete code on github. /* get some key material to use as input to the derivekey method. the key material is a password supplied by the user. */ function getkeymaterial() { ...
Text - Web APIs
o information items and text nodes that form its children. new documents have a single text node for each block of text. over time, more text nodes may be created as the document's content changes. the node.normalize() method merges adjacent text objects back into a single node for each block of text. ...
...ext of the current node and all logically adjacent nodes with the specified text. text.splittext breaks the node into two nodes at a specified offset. specifications specification status comment domthe definition of 'text' in that specification. living standard removed the iselementcontentwhitespace property. removed the replacewholetext() method.
added the text() constructor.
added the assignedslot property. document object model (dom) level 3 core specificationthe definition of 'text' in that specification. obsolete
added the iselementcontentwhitespace and wholetext properties.
added the replacewholetext() method. document object model (dom) level 2 core specificationthe definition of 'text' in that specificat...
TextTrack.mode - Web APIs
syntax var mode = texttrack.mode; texttrack.mode = "disabled" | "hidden" | "showing"; value a domstring which indicates the track's current mode. ...
...desired chapter, which begins at the cue's start position and ends at the cue's end position. example in this example, we configure the text track's cues so that every time a cue is finished, the video automatically pauses playback. this is done by setting the pauseonexit property on each cue to true. however, to ensure that the track's cues are available, we first set mode to showing. ...
Supporting both TouchEvent and MouseEvent - Web APIs
hanced user experiences on touch enabled devices. however, the reality is the vast majority of today's web content is designed only to work with mouse input. consequently, even if a browser supports touch, the browser must still emulate mouse events so content that assumes mouse-only input will work as is without direct modification. ideally, a touch-based application does not need to explicitly
address mouse input. however, because the browser must emulate mouse events, there may be some interaction issues that need to be handled. below are some details about the interaction and the ramifications for application developers. event firing the touch events standard defines a few browser requirements regarding touch and mouse interaction (see the interaction with mouse events and click sectio...
...e 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. consequently, if an application does not want mouse events fired on a specific touch target element, the element's touch event handlers should call preventdefault() and no
additional mouse events will be dispatched. here is a code snippet of the touchmove event handler calling preventdefault(). // touchmove handler function process_touchmove(ev) { // call preventdefault() to prevent any further handling ev.preventdefault(); } event order although the specific ordering of touch and mouse events is implementation-defined, the standard indicates the following ord...
UIEvent - Web APIs
h the uievent.inituievent() method is kept for backward compatibility, you should create a uievent object using the uievent() constructor. several interfaces are direct or indirect descendants of this one: mouseevent, touchevent, focusevent, keyboardevent, wheelevent, inputevent, and compositionevent. ...
...c keycode of the key pressed, or the character code (charcode) for an alphanumeric key pressed. methods this interface also inherits methods of its parent, event. uievent.inituievent() initializes a uievent object. if the event has already being dispatched, this method does nothing. specifications specification status comment inputdevicecapabilities draft
added sourcecapabilities property. ui events working draft extend dom3 document object model (dom) level 3 events specificationthe definition of 'uievent' in that specification. obsolete
added the uievent() constructor, deprecated the inituievent() method and changed the type of view from abstractview to windowproxy. document object model (dom) level 2 events sp...
VTTCue - Web APIs
of all the lines of text within the cue box. vttcue.text returns a domstring with the contents of the cue. methods getcueashtml() returns the cue text as a documentfragment. ...
...s a domstring with the contents of the cue. methods getcueashtml() returns the cue text as a documentfragment. example html <video controls src="https://udn.realityripple.com/samples/c6/f8a3489533.webm"></video> css video { width: 320px; height: 180px; } javascript let video = document.queryselector('video'); video.
addeventlistener('loadedmetadata', () => { const track = video.
addtexttrack("captions", "简体中文subtitles", "zh_cn"); track.mode = "showing"; const cuecn = new vttcue(0, 2.500, '字幕会在0至2.5秒间显示'); track.
addcue(cuecn); const cueen = new vttcue(2.6, 4, 'subtitles will display between 2.6 and 4 seconds'); track.
addcue(cueen); }); result chrome: please open in jsfiddle to view the live sample. embed live sample can not show sub...
WebGL2RenderingContext - Web APIs
> element. to get an object of this interface, call getcontext() on a <canvas> element, supplying "webgl2" as the argument: var canvas = document.getelementbyid('mycanvas'); var gl = canvas.getcontext('webgl2'); webgl 2 is an extension to webgl 1. the webgl2renderingcontext interface implements all members of the webglrenderingcontext interface. some methods of the webgl 1 context can accept
additional values when used in a webgl 2 context. you will find this info noted on the webgl 1 reference pages. the webgl tutorial has more information, examples, and resources on how to get started with webgl. constants see the webgl constants page. state information webgl2renderingcontext.getindexedparameter() returns the indexed value for the given target. buffers webgl2renderingcont...
...ta formats and locations of vertex attributes in a vertex attributes array. drawing buffers webgl2renderingcontext.vertexattribdivisor() modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawarraysinstanced() and gl.drawelementsinstanced(). webgl2renderingcontext.drawarraysinstanced() renders primitives from array data. in
addition, it can execute multiple instances of the range of elements. webgl2renderingcontext.drawelementsinstanced() renders primitives from array data. in
addition, it can execute multiple instances of a set of elements. webgl2renderingcontext.drawrangeelements() renders primitives from array data in a given range. webgl2renderingcontext.drawbuffers() specifies a list of color buffers to be dr...
WebGLRenderingContext.bindBuffer() - Web APIs
rget. syntax void gl.bindbuffer(target, buffer); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available
additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpac...
...mment webgl 1.0the definition of 'bindbuffer' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glbindbuffer' in that specification. standard man page of the (similar) opengl es 2 api. webgl 2.0the definition of 'bindbuffer' in that specification. editor's draft updated definition for webgl 2.
adds new target buffers: gl.copy_read_buffer, gl.copy_write_buffer, gl.transform_feedback_buffer, gl.uniform_buffer, gl.pixel_pack_buffer, gl.pixel_unpack_buffer opengl es 3.0the definition of 'glbindbuffer' in that specification. standard man page of the (similar) opengl es 3 api. ...
WebGLRenderingContext.bindFramebuffer() - Web APIs
) method of the webgl api binds a given webglframebuffer to a target. syntax void gl.bindframebuffer(target, framebuffer); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available
additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. framebuffer a webglframebuffer object to bind. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer, gl.draw_framebuffer, o...
... comment webgl 1.0the definition of 'bindframebuffer' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glbindframebuffer' in that specification. standard man page of the opengl api. webgl 2.0the definition of 'bindframebuffer' in that specification. editor's draft updated definition for webgl 2.
adds: gl.draw_framebuffer and gl.read_framebuffer opengl es 3.0the definition of 'glbindframebuffer' in that specification. standard man page of the (similar) opengl es 3 api. ...
WebGLRenderingContext.bindTexture() - Web APIs
ingcontext.bindtexture() method of the webgl api binds a given webgltexture to a target (binding point). syntax void gl.bindtexture(target, texture); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available
additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. texture a webgltexture object to bind. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.texture_2d, gl.texture_cube_map, gl.texture_3d, or gl.texture_2d_array. examples binding a texture var canvas = document.getelementbyid...
...omment webgl 1.0the definition of 'bindtexture' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glbindtexture' in that specification. standard man page of the (similar) opengl es 2.0 api. webgl 2.0the definition of 'bindtexture' in that specification. editor's draft updated definition for webgl 2.
adds: gl.texture_3d and gl.texture_2d_array opengl es 3.0the definition of 'glbindtexture' in that specification. standard man page of the (similar) opengl es 3.0 api. ...
WebGLRenderingContext.bufferSubData() - Web APIs
fset, arraybufferview srcdata, srcoffset, length); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available
additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operations. gl.uniform_buffer: buffer used for storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpac...
... webgl 1.0the definition of 'buffersubdata' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glbuffersubdata' in that specification. standard man page of the opengl es 2 api. opengl es 3.0the definition of 'glbuffersubdata' in that specification. standard man page of the (similar) opengl es 3 api.
adds new target buffers: gl.copy_read_buffer, gl.copy_write_buffer, gl.transform_feedback_buffer, gl.uniform_buffer, gl.pixel_pack_buffer, gl.pixel_unpack_buffer. ...
WebGLRenderingContext.disable() - Web APIs
(). gl.cull_face deactivates culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test deactivates depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither deactivates dithering of color components before they get written to the color buffer. gl.polygon_offset_fill deactivates
adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage deactivates the computation of a temporary coverage value determined by the alpha value. gl.sample_coverage deactivates anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). g...
...ntext.samplecoverage(). gl.scissor_test deactivates the scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test deactivates stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available
additionally: constant description gl.rasterizer_discard deactivates that primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value none. examples gl.disable(gl.dither); to check if a capability is disabled, use the webglrenderingcontext.i...
WebGLRenderingContext.enable() - Web APIs
lendfunc(). gl.cull_face activates culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test activates depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither activates dithering of color components before they get written to the color buffer. gl.polygon_offset_fill activates
adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage activates the computation of a temporary coverage value determined by the alpha value. gl.sample_coverage activates anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.sc...
...ngcontext.samplecoverage(). gl.scissor_test activates the scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test activates stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available
additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value none. examples gl.enable(gl.dither); to check if a capability is enabled, use the webglrenderingcontext.isenabled() method: ...
WebGLRenderingContext.framebufferRenderbuffer() - Web APIs
object. syntax void gl.framebufferrenderbuffer(target, attachment, renderbuffertarget, renderbuffer); parameters target a glenum specifying the binding point (target) for the framebuffer. possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available
additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the render buffer. possible values: gl.color_attachment0: color buffer. gl.depth_attachment: depth buffer. ...
...ramebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the render buffer. possible values: gl.color_attachment0: color buffer. gl.depth_attachment: depth buffer. gl.depth_stencil_attachment: depth and stencil buffer. gl.stencil_attachment: stencil buffer. ...
WebGLRenderingContext.framebufferTexture2D() - Web APIs
aches a texture to a webglframebuffer. syntax void gl.framebuffertexture2d(target, attachment, textarget, texture, level); parameters target a glenum specifying the binding point (target). possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. when using a webgl 2 context, the following values are available
additionally: gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. gl.read_framebuffer: used as a source for reading operations. attachment a glenum specifying the attachment point for the texture. possible values: gl.color_attachment0: attaches the texture to the framebuffer's ...
... attachment a glenum specifying the attachment point for the texture. possible values: gl.color_attachment0: attaches the texture to the framebuffer's color buffer. gl.depth_attachment: attaches the texture to the framebuffer's depth buffer. gl.stencil_attachment: attaches the texture to the framebuffer's stencil buffer. when using a webgl 2 context, the following values are available
additionally: gl.depth_stencil_attachment: depth and stencil buffer. gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl.colo...
WebGLRenderingContext.generateMipmap() - Web APIs
solution until a 1x1 dimension texture image is created. syntax void gl.generatemipmap(target); parameters target a glenum specifying the binding point (target) of the active texture whose mipmaps will be generated. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available
additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. return value none. examples gl.generatemipmap(gl.texture_2d); specifications specification status comment webgl 1.0the definition of 'generatemipmap' in that specification. recommendation initial definition for webgl. ope...
...1.0the definition of 'generatemipmap' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'glgeneratemipmap' in that specification. standard man page of the (similar) opengl es 2.0 api. opengl es 3.0the definition of 'glgeneratemipmap' in that specification. standard man page of the (similar) opengl es 3.0 api.
adds: gl.texture_3d and gl.texture_2d_array ...
WebGLRenderingContext.getProgramParameter() - Web APIs
ion operation was successful. gl.attached_shaders: returns a glint indicating the number of attached shaders to a program. gl.active_attributes: returns a glint indicating the number of active attribute variables to a program. gl.active_uniforms: returns a glint indicating the number of active uniform variables to a program. when using a webgl 2 context, the following values are available
additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the buffer mode when transform feedback is active. may be gl.separate_attribs or gl.interleaved_attribs. gl.transform_feedback_varyings: returns a glint indicating the number of varying variables to capture in transform feedback mode. gl.active_uniform_blocks: returns a glint indicating the number of uniform ...
... specification status comment webgl 1.0the definition of 'getprogramparameter' in that specification. ...
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
or. gl.renderbuffer_alpha_size: returns a glint that is the resolution size (in bits) for the alpha component. gl.renderbuffer_depth_size: returns a glint that is the resolution size (in bits) for the depth component. gl.renderbuffer_stencil_size: returns a glint that is the resolution size (in bits) for the stencil component. when using a webgl 2 context, the following value is available
additionally: gl.renderbuffer_samples: returns a glint indicating the number of samples of the image of the currently bound renderbuffer. return value depends on the requested information (as specified with pname). either a glint or a glenum. examples gl.getrenderbufferparameter(gl.renderbuffer, gl.renderbuffer_width); specifications specification status comm...
...enderbufferparameteriv' in that specification. ...
WebGLRenderingContext.getTexParameter() - Web APIs
renderingcontext.gettexparameter() method of the webgl api returns information about the given texture. syntax any gl.gettexparameter(target, pname); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available
additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. pname a glenum specifying the information to query. possible values: pname return type description possible return values available in a webgl 1 context gl.texture_mag_filter glenum texture magnification...
...arest, gl.nearest_mipmap_linear (default value), gl.linear_mipmap_linear. gl.texture_wrap_s glenum wrapping function for texture coordinate s gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. gl.texture_wrap_t glenum wrapping function for texture coordinate t gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat.
additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext glfloat maximum anisotropy for a texture any float values.
additionally available when using a webgl 2 context gl.texture_base_level glint texture mipmap level any int values. gl.texture_compare_func glenum compar...
WebGLRenderingContext.getVertexAttribOffset() - Web APIs
examples gl.getvertexattriboffset(i, gl.vertex_attrib_array_pointer); specifications specification status comment webgl 1.0the definition of 'getvertexattriboffset' in that specification. recommendation initial definition. ...
... examples gl.getvertexattriboffset(i, gl.vertex_attrib_array_pointer); specifications specification status comment webgl 1.0the definition of 'getvertexattriboffset' in that specification. recommendation initial definition. ...
WebGLRenderingContext.isEnabled() - Web APIs
olor values. see webglrenderingcontext.blendfunc(). gl.cull_face culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither dithering of color components before they get written to the color buffer. gl.polygon_offset_fill
adding an offset to depth values of polygon's fragments. see webglrenderingcontext.polygonoffset(). gl.sample_alpha_to_coverage computation of a temporary coverage value determined by the alpha value. gl.sample_coverage anding the fragment's coverage with the temporary coverage value. see webglrenderingcontext.samplecoverage(). gl.scissor_test scissor t...
... value. see webglrenderingcontext.samplecoverage(). gl.scissor_test scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available
additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value a glboolean indicating if the capability cap is enabled (true), or not (false). examples gl.isenabled(gl.stencil_test); // fal...
WebGLRenderingContext.makeXRCompatible() - Web APIs
vr mode button. this is important, which we'll explore shortly. ...
...handles starting up graphics, switching to vr mode, and so forth looks like this: const outputcanvas = document.queryselector(".output-canvas"); const gl = outputcanvas.getcontext("webgl"); let xrsession = null; let usingxr = false; let currentscene = "scene1"; let glstartbutton; let xrstartbutton; window.
addeventlistener("load", (event) => { loadsceneresources(currentscene); glstartbutton.
addeventlistener("click", handlestartbuttonclick); xrstartbutton.
addeventlistener("click", handlestartbuttonclick); }); outputcanvas.
addeventlistener("webglcontextlost", (event) => { /* the context has been lost but can be restored */ event.canceled = true; }); /* when the gl context is reconnected, reload the resources for the current scene. */ outputcanvas.
addeventlistener("webglcontextr...
WebGLRenderingContext.pixelStorei() - Web APIs
_premultiply_alpha_webgl multiplies the alpha channel into the other color channels glboolean false true, false webgl gl.unpack_colorspace_conversion_webgl default color space conversion or no color space conversion. glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available
additionally: constant description type default value allowed values (for param) specified in gl.pack_row_length number of pixels in a row. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_pixels number of pixel locations skipped before the first pixel is written into memory. glint 0 0 to infinity opengl es 3.0 gl.p...
...enderingcontext.getparameter(). gl.getparameter(gl.pack_alignment); gl.getparameter(gl.unpack_alignment); specifications specification status comment webgl 1.0the definition of 'pixelstorei' in that specification. recommendation initial definition for webgl. webgl 1.0the definition of 'pixel storage parameters' in that specification. recommendation
additional pixel storage parameters that aren't specified in opengl. opengl es 2.0the definition of 'glpixelstorei' in that specification. standard man page of the opengl es 2.0 api. webgl 2.0the definition of 'pixelstorei' in that specification. editor's draft updated definition for webgl 2. opengl es 3.0the definition of 'glpixelstorei' in that specification. ...
WebGLRenderingContext.readPixels() - Web APIs
eight a glsizei specifying the height of the rectangle. format a glenum specifying the format of the pixel data. possible values: gl.alpha: discards the red, green and blue components and reads the alpha component. gl.rgb: discards the alpha components and reads the red, green and blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. ...
...ponents. gl.rgba: red, green, blue and alpha 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_...
WebGLRenderingContext.renderbufferStorage() - Web APIs
internal format of the renderbuffer. possible values: gl.rgba4: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits. gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. ...
... ...
WebGLRenderingContext.texImage2D() - Web APIs
.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. ...
...texture extension: gl.unsigned_short gl.unsigned_int ext.unsigned_int_24_8_webgl (constant provided by the extension) when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: ext.half_float_oes (constant provided by the extension) when using a webgl 2 context, the 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 t...
WebGLRenderingContext.texParameter[fi]() - Web APIs
arameters. syntax void gl.texparameterf(glenum target, glenum pname, glfloat param); void gl.texparameteri(glenum target, glenum pname, glint param); parameters target a glenum specifying the binding point (target). possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available
additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. the pname parameter is a glenum specifying the texture parameter to set. the param parameter is a glfloat or glint specifying the value for the specified parameter pname. pname description param available in webgl 1 gl.texture_m...
...t_mipmap_nearest, gl.linear_mipmap_nearest, gl.nearest_mipmap_linear (default value), gl.linear_mipmap_linear. gl.texture_wrap_s wrapping function for texture coordinate s gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat. gl.texture_wrap_t wrapping function for texture coordinate t gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat.
additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext maximum anisotropy for a texture a glfloat value.
additionally available when using a webgl 2 context gl.texture_base_level texture mipmap level any int values. gl.texture_compare_func texture comparison function gl.lequal (default value),...
WebGLRenderingContext.texSubImage2D() - Web APIs
blue components. gl.rgba: red, green, blue and alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available
additionally: gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the texel data. possible values: gl.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.
...s, 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. ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
. possible values: gl.byte: signed 8-bit integer, with values in [-128, 127] gl.short: signed 16-bit integer, with values in [-32768, 32767] gl.unsigned_byte: unsigned 8-bit integer, with values in [0, 255] gl.unsigned_short: unsigned 16-bit integer, with values in [0, 65535] gl.float: 32-bit ieee floating point number when using a webgl 2 context, the following values are available
additionally: gl.half_float: 16-bit ieee floating point number normalized a glboolean specifying whether integer data values should be normalized into a certain range when being cast to a float. for types gl.byte and gl.short, normalizes the values to [-1, 1] if true. for types gl.unsigned_byte and gl.unsigned_short, normalizes the values to [0, 1] if true. for types gl.f...
...ex shader. each vertex has a few attributes, like position, normal vector, or texture coordinate, that are defined in an arraybuffer and will be supplied to the vertex buffer object (vbo). first, we need to bind the webglbuffer we want to use to gl.array_buffer, then, with this method, gl.vertexattribpointer(), we specify in what order the attributes are stored, and what data type they are in. in
addition, we need to include the stride, which is the total byte length of all attributes for one vertex. also, we have to call gl.enablevertexattribarray() to tell webgl that this attribute should be filled with data from our array buffer. usually, your 3d geometry is already in a certain binary format, so you need to read the specification of that specific format to figure out the memory layout. h...
A basic 2D WebGL animation example - Web APIs
]; // vertex information let vertexarray; let vertexbuffer; let vertexnumcomponents; let vertexcount; // rendering data shared with the // scalers. ...
...tebuffer(); gl.bindbuffer(gl.array_buffer, vertexbuffer); gl.bufferdata(gl.array_buffer, vertexarray, gl.static_draw); vertexnumcomponents = 2; vertexcount = vertexarray.length/vertexnumcomponents; currentangle = 0.0; rotationrate = 6; animatescene(); } after getting the webgl context, gl, we need to begin by building the shader program. here, we're using code designed to let us
add multiple shaders to our program quite easily. the array shaderset contains a list of objects, each describing one shader function to be compiled into the program. each function has a type (one of gl.vertex_shader or gl.fragment_shader) and an id (the id of the <script> element containing the shader's code). the shader set is passed into the function buildshaderprogram(), which returns the compil...
Basic scissoring - Web APIs
en the webgl state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline. ...
...rawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline. <p>result of of scissoring.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; p
adding : 0; border : none; background-color : black; } window.
addeventlistener("load", function setupwebgl (evt) { "use strict" window.removeeventlistener(evt.type, setupwebgl, false); var paragraph = document.queryselector("p"); var canvas = document.queryselector("canvas"); // the following two lines set the size (in css pixels) of // the drawing buffer to be identical to the size of the // canvas html element, as determined by css. canvas.wi...
Canvas size and WebGL - Web APIs
we get the desired result. in the second, the square has the wrong shape, size, and position. ...
...shape, size, and position. ...
Lighting in WebGL - Web APIs
y(vertexnormals), gl.static_draw); ... return { position: positionbuffer, normal: normalbuffer, texturecoord: texturecoordbuffer, indices: indexbuffer, }; this should look pretty familiar by now; we create a new buffer, bind it to be the buffer we're working with, then send along our array of vertex normals into the buffer by calling bufferdata(). then we
add the code to drawscene() to bind the normals array to a shader attribute so the shader code can get access to it: // tell webgl how to pull out the normals from // the normal buffer into the vertexnormal attribute. { const numcomponents = 3; const type = gl.float; const normalize = false; const stride = 0; const offset = 0; gl.bindbuffer(gl.array_buffer, buffers.norm...
...ds to be applied to the vertex by calculating the dot product of the transformed normal and the directional vector (that is, the direction from which the light is coming). if this value is less than zero, then we pin the value to zero, since you can't have less than zero light. once the amount of directional lighting is computed, we can generate the lighting value by taking the ambient light and
adding in the product of the directional light's color and the amount of directional lighting to provide. as a result, we now have an rgb value that will be used by the fragment shader to adjust the color of each pixel we render. the fragment shader the fragment shader now needs to be updated to take into account the lighting value computed by the vertex shader: const fssource = ` varying hi...
WebGL types - Web APIs
gl extensions. type web idl type description gluint64ext long long unsigned 64-bit integer number. ...
...er. specifications specification status comment webgl 1.0the definition of 'types' in that specification. ...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
ions. those conditions may be affected by everything from the underlying layers of the network stack to the physical network connection, the intervening networks, the performance of the remote endpoint, noise levels, traffic levels, and so forth. since rtp is simply a data transport, it is augmented by the closely-related rtp control protocol (rtcp), which is defined in rfc 3550, section 6. rtcp
adds features including quality of service (qos) monitoring, participant information sharing, and the like. it isn't adequate for the purposes of fully managing users, memberships, permissions, and so forth, but provides the basics needed for an unrestricted multi-user communication session. the very fact that rtcp is defined in the same rfc as rtp is a clue as to just how closely-interrelated these...
...on. it can be used for any form of continuous or active data transfer, including data streaming, active badges or status display updates, or control and measurement information transport. things rtp doesn't do rtp itself doesn't provide every possible feature, which is why other protocols are also used by webrtc. some of the more noteworthy things rtp doesn't include: editor's note: we should
add information about where these deficiencies are compensated for, if they are at all. rtp does not guarantee quality-of-service (qos). while rtp is intended for use in latency-critical scenarios, it doesn't inherently offer any features that ensure qos. instead, it only offers the information necessary to allow qos to be implemented elsewhere in the stack. rtp doesn't handle allocation or rese...
Improving compatibility using WebRTC adapter.js - Web APIs
while you can manually code around these issues, there is an easier way. the webrtc organization provides on github the webrtc adapter to work around compatibility issues in different browsers' webrtc implementations. the adapter is a javascript shim which lets your code to be written to the specification so that it will "just work" in all browsers with webrtc support. there's no need to conditionally use prefixed apis or implement other workarounds. ...
...lly recommended. the adapter is provided under a bsd-style license. what adapter.js does for each version of each browser that supports webrtc, adapter.js implements the needed polyfills, establishes the non-prefixed names of apis, and applies any other changes needed to make the browser run code written to the webrtc specification. for example, on firefox versions older than 38, the adapter
adds the rtcpeerconnection.urls property; firefox doesn't natively support this property until firefox 38, while on chrome, the adapter
adds support for the promise based api is
added if it's not present. these are just a couple of examples; there are of course other adjustments made for you by the shim. the webrtc adapter currently supports mozilla firefox, google chrome, apple safari, and microsof...
WebSocket.onerror - Web APIs
syntax websocket.onerror = eventhandler; value a function or eventhandler which is executed whenever an error event occurs on the websocket connection. ...
... syntax websocket.onerror = eventhandler; value a function or eventhandler which is executed whenever an error event occurs on the websocket connection. ...
WebSocket - Web APIs
n the connection is opened. websocket.protocol read only the sub-protocol selected by the server. websocket.readystate read only the current state of the connection. websocket.url read only the absolute url of the websocket. methods websocket.close([code[, reason]]) closes the connection. websocket.send(data) enqueues data to be transmitted. events listen to these events using
addeventlistener() or by assigning an event listener to the oneventname property of this interface. close fired when a connection with a websocket is closed. also available via the onclose property error fired when a connection with a websocket has been closed because of an error, such as when some data couldn't be sent. also available via the onerror property. message fired when data is re...
... some data couldn't be sent. also available via the onerror property. message fired when data is received through a websocket. also available via the onmessage property. open fired when a connection with a websocket is opened. also available via the onopen property. examples // create websocket connection. const socket = new websocket('ws://localhost:8080'); // connection opened socket.
addeventlistener('open', function (event) { socket.send('hello server!'); }); // listen for messages socket.
addeventlistener('message', function (event) { console.log('message from server ', event.data); }); specifications specification status html living standardthe definition of 'websocket' in that specification. living standard ...
Writing WebSocket client applications - Web APIs
ecify an array of protocols: var examplesocket = new websocket("wss://www.example.com/socketserver", ["protocolone", "protocoltwo"]); once the connection is established (that is, readystate is open), examplesocket.protocol will tell you which protocol the server selected. establishing a websocket relies on the http upgrade mechanism, so the request for the protocol upgrade is implicit when we
address the web server as ws://www.example.com or wss://www.example.com. sending data to the server once you've opened your connection, you can begin transmitting data to the server. to do this, simply call the websocket object's send() method for each message you want to send: examplesocket.send("here's some text that the server is urgently awaiting!"); you can send data as a string, blob, or a...
... // send the msg object as a json-formatted string. examplesocket.send(json.stringify(msg)); // blank the text input element, ready to receive the next line of text from the user. document.getelementbyid("text").value = ""; } receiving messages from the server websockets is an event-driven api; when messages are received, a message event is sent to the websocket object. to handle it,
add an event listener for the message event, or use the onmessage event handler. to begin listening for incoming data, you can do something like this: examplesocket.onmessage = function (event) { console.log(event.data); } receiving and interpreting json objects let's consider the chat client application first alluded to in using json to transmit objects. there are assorted types of data packet...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
sidered: perspective. perspective, properly applied to the objects in a scene, can take a scene that would otherwise look as flat as a typical 2d screen and make it pop as if it were truly 3d. there are several kinds of perspective; those are defined and their mathematics explained in the article webgl model view projection. importantly, the effect of perspective on a vector can be represented by
adding a fourth component to the vector: the perspective component, called w. the value of w is applied by dividing each of the other three components by it to get the final position or vector; that is, for a coordinate given as (x, y, z, w), the point in the 3d space is actually (x/w, y/w, z/w, 1) or simply (x/w, y/w, z/w). if you're not using perspective, w is always 1. in that situation, the comp...
... like this: let matrixarray = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16]; in this array, the leftmost column contains the entries a1, a2, a3, and a4. the topmost row contains the entries a1, a5, a9, and a13. keep in mind that most webgl and webxr programming is done using third-party libraries which expand upon the basic functionality of webgl by
adding routines that make it much easier to perform not only core matrix and other operations, but often also to simulate these standard cinematography techniques. you should strongly consider using one instead of directly using webgl. this guide uses webgl directly since it's useful to understand to some extent what goes on under the hood, and to aide in the development of libraries or to help you o...
Geometry and reference spaces in WebXR - Web APIs
at a fundamental level, rendering of scenes for webxr presentation in either augmented reality or virtual reality contexts is performed using webgl, so the two apis share much of the same design language. however, in order to provide the ability to present scenes in true 3d using xr headsets and other such equipment, webxr has
additional concepts that must be understood. in this article, we introduce the ways in which webxr expands upon the geometry of webgl, and how the positions and orientations of objects—both physical and virtual—are described in relation to one another using spaces and, in particular, reference spaces. the article spatial tracking in webxr builds upon the information provided here to cover how the physical position and orientation of the user's head, as well as ...
...same coordinates yet appear in the world to be located at (and be see the world from the perspective of) its new location. for a more detailed look at how to use reference spaces to manage the player's viewpoint, see the article in the case of our game avatar example, it's rare for an avatar (or any other moving creature or machine) to be a simple blob sliding around the world. they usually have
additional form, as well as internal movement, such as moving legs, arms that swing as they walk, a head that turns or bobs, weapons that move around, and so forth. bring these to life using standard webgl techniques and a positioning matrix or xrrigidtransform to shift the objects to the correct position relative to the effective origin. device limitations on reference spaces some xr devices simpl...
Rendering and the WebXR frame animation callback - Web APIs
ating: const xdistancemoved = xspeedpersecond * deltatime; const ydistancemoved = yspeedpersecond * deltatime; const zdistancemoved = zspeedpersecond * deltatime; xspeedpersecond, yspeedpersecond, and zspeedpersecond each contian that axis's component of the object's velocity. in other words, [xdistancemoved, ydistancemoved, zdistancemoved] is a vector representing the velocity of the object.
additional tasks related to animating the scene there are, of course, other things that probably need to happen each pass through the renderer. two of the most common are handling of user inputs and performing updates to the positions of objects (or the viewer) based on known factors, such as those user control states or known animation paths of the objects in the scene. handling user control input...
... might have enemy non-player characters being controlled by the computer and moving around the scene. not only are their locations in the world changing over time, but each npc likely has body parts or components that are moving in relation to one another. arms and legs swing as a creature walks, heads bob and turn, hair bounces and sways, torsos expand and contract as the character breathes. in
addition, there may be objects and structures in motion. in a sports game, there may be a ball arcing through the air, its movement needing to be simulated. in racing games there may be cars or other vehicles, with moving parts to animate including the wheels. if there's water in the scene, it needs ripples or waves to look realistic. parts of structures may be moving, such as doors, walls and floors...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
the webxr apis used for implementing augmented and virtual reality is designed specifically to provide the ability to insert a human into a virtual environment. to accomplish this, software needs the ability to not only track the locations, orientation, and movements of objects in the virtual world, but the user's location, orientation, and movement as well. but webxr goes beyond that by
adding the ability to track the location, orientation, and motion of the input devices which generate data used to determine the position and movement of individual parts of the viewer's body (with appropriate equipment). the location and movement of the user's headset represent their head's position and orientation in the virtual environment. hand controllers represent their hands in the same manner. oth...
...e data used to determine the position and movement of individual parts of the viewer's body (with appropriate equipment). the location and movement of the user's headset represent their head's position and orientation in the virtual environment. hand controllers represent their hands in the same manner. other hardware elements can be used similarly to represent other parts of the body, providing
additional data to use when simulating the user's actions in their environment. in this guide, we'll explore how webxr uses spaces and, more specifically, reference spaces, to track the positions, orientations, and movements of objects and of the user's body in the virtual world. note: this article presumes that you are familiar with the concepts introduced in geometry and reference spaces in webx...
Web Audio API best practices - Web APIs
create an audio context (either offline or online) it is created with a state, which can be suspended, running, or closed. when working with an audiocontext, if you create the audio context from inside a click event the state should automatically be set to running. here is a simple example of creating the context from inside a click event: const button = document.queryselector('button'); button.
addeventlistener('click', function() { const audioctx = new audiocontext(); }, false); if however, you create the context outside of a user gesture, its state will be set to suspended and it will need to be started after user interaction. we can use the same click event example here, test for the state of the context and start it, if it is suspended, using the resume() method. const audioctx =...
..., false); if however, you create the context outside of a user gesture, its state will be set to suspended and it will need to be started after user interaction. we can use the same click event example here, test for the state of the context and start it, if it is suspended, using the resume() method. const audioctx = new audiocontext(); const button = document.queryselector('button'); button.
addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } }, false); you might instead be working with an offlineaudiocontext, in which case you can resume the suspended audio context with the startrendering() method. user control if your website or application contains sound,...
Using IIR filters - Web APIs
uffersource(); soundsource.buffer = audiobuffer; soundsource.connect(audiocontext.destination); soundsource.start(); return soundsource; } this function is called when the play button is pressed. the play button html looks like this: <button class="button-play" role="switch" data-playing="false" aria-pressed="false">play</button> and the click event listener starts like so: playbutton.
addeventlistener('click', function() { if (this.dataset.playing === 'false') { srcnode = playsourcenode(audioctx, sample); ... }, false); the toggle that turns the iir filter on and off is set up in the similar way. first, the html: <button class="button-filter" role="switch" data-filteron="false" aria-pressed="false" aria-describedby="label" disabled></button> the filter butto...
...ioctx, sample); ... }, false); the toggle that turns the iir filter on and off is set up in the similar way. first, the html: <button class="button-filter" role="switch" data-filteron="false" aria-pressed="false" aria-describedby="label" disabled></button> the filter button's click handler then connects the iirfilter up to the graph, between the source and the detination: filterbutton.
addeventlistener('click', function() { if (this.dataset.filteron === 'false') { srcnode.disconnect(audioctx.destination); srcnode.connect(iirfilter).connect(audioctx.destination); ... }, false); frequency response we only have one method available on iirfilternode instances, getfrequencyresponse(), this allows us to see what is happening to the frequencies of the audio b...
Attestation and Assertion - Web APIs
hat is commonly used by devices whose sole function is as a webauthn authenticator, such as security keys. tpm - the trusted platform module (tpm) is a set of specifications from the trusted platform group (tpg). this attestation format is commonly found in desktop computers and is used by windows hello as its preferred attestation format. android key attestation - one of the features
added in android o was android key attestation, which enables the android operating system to attest to keys. android safetynet -prior to android key attestation, the only option for android devices was to create android safetynet attestations fido u2f - security keys that implement the fido u2f standard use this format none - browsers may prompt users whether they want a site to ...
...ce being used (how the private key is protected; if / what kind of biometric is being used; whether a device has been certified; etc.). it should be noted that while attestation provides the capability for a root of trust, validating the root of trust is frequently 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 previously registered to that service. this creates an assertion. unlike the attestation, the format of the assertion is always the same regard...
Window: afterprint event - Web APIs
the afterprint event is fired after the associated document has started printing or the print preview has been closed. ...
... the afterprint event is fired after the associated document has started printing or the print preview has been closed. ...
Window: appinstalled event - Web APIs
the appinstalled event of the web manifest api is fired when the browser has successfully installed a page as an application. ...
... the appinstalled event of the web manifest api is fired when the browser has successfully installed a page as an application. ...
Window: beforeprint event - Web APIs
the beforeprint event is fired when the associated document is about to be printed or previewed for printing. ...
... the beforeprint event is fired when the associated document is about to be printed or previewed for printing. ...
Window: blur event - Web APIs
the blur event fires when an element has lost focus. the opposite of blur is focus. bubbles no cancelable no interface focusevent event handler property onblur sync / async sync composed yes examples live example this example changes the appearance of a document when it loses focus. it uses
addeventlistener() to monitor focus and blur events. html <p id="log">click on this document to give it focus.</p> css .paused { background: #ddd; color: #555; } javascript function pause() { document.body.classlist.
add('paused'); log.textcontent = 'focus lost!'; } function play() { document.body.classlist.remove('paused'); log.textcontent = 'this document has focus. click outside the document to lose foc...
...cument to give it focus.</p> css .paused { background: #ddd; color: #555; } javascript function pause() { document.body.classlist.
add('paused'); log.textcontent = 'focus lost!'; } function play() { document.body.classlist.remove('paused'); log.textcontent = 'this document has focus. click outside the document to lose focus.'; } const log = document.getelementbyid('log'); window.
addeventlistener('blur', pause); window.
addeventlistener('focus', play); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Window.external - Web APIs
see autodiscovery of search plugins. issearchproviderinstalled() dummy function; does nothing. ...
...see autodiscovery of search plugins. issearchproviderinstalled() dummy function; does nothing. ...
Window: focus event - Web APIs
the focus event fires when an element has received focus. the opposite of focus is blur. bubbles no cancelable no interface focusevent event handler property onfocus sync / async sync composed yes examples live example this example changes the appearance of a document when it loses focus. it uses
addeventlistener() to monitor focus and blur events. html <p id="log">click on this document to give it focus.</p> css .paused { background: #ddd; color: #555; } javascript function pause() { document.body.classlist.
add('paused'); log.textcontent = 'focus lost!'; } function play() { document.body.classlist.remove('paused'); log.textcontent = 'this document has focus. click outside the document...
...cument to give it focus.</p> css .paused { background: #ddd; color: #555; } javascript function pause() { document.body.classlist.
add('paused'); log.textcontent = 'focus lost!'; } function play() { document.body.classlist.remove('paused'); log.textcontent = 'this document has focus. click outside the document to lose focus.'; } const log = document.getelementbyid('log'); window.
addeventlistener('blur', pause); window.
addeventlistener('focus', play); result specifications specification status comment ui events working draft
added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Window: hashchange event - Web APIs
the hashchange event is fired when the fragment identifier of the url has changed (the part of the url beginning with and following the # symbol). ...
... the hashchange event is fired when the fragment identifier of the url has changed (the part of the url beginning with and following the # symbol). ...
Window: load event - Web APIs
cluding all dependent resources such as stylesheets and images. this is in contrast to domcontentloaded, which is fired as soon as the page dom has been loaded, without waiting for resources to finish loading. ...
...plate-areas: "control log"; } .controls { grid-area: control; display: flex; align-items: center; justify-content: center; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } #reload { height: 2rem; } js const log = document.queryselector('.event-log-contents'); const reload = document.queryselector('#reload'); reload.
addeventlistener('click', () => { log.textcontent =''; window.settimeout(() => { window.location.reload(true); }, 200); }); window.
addeventlistener('load', (event) => { log.textcontent = log.textcontent + 'load\n'; }); document.
addeventlistener('readystatechange', (event) => { log.textcontent = log.textcontent + `readystate: ${document.readystate}\n`; }); document.
addeventliste...
Window: messageerror event - Web APIs
the messageerror event is fired on a window object when it receives a message that can't be deserialized. ...
... the messageerror event is fired on a window object when it receives a message that can't be deserialized. ...
Window.ondragdrop - Web APIs
b: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. removed in firefox 50, and never implemented in any other browser. use the modern standard html5 drag and drop feature instead. summary an event handler for drag and drop events sent to the window. syntax window.ondragdrop = funcref; window.
addeventlistener("dragdrop", funcref, usecapturing); funcref the event handler function to be registered. the window.ondragdrop property and the ondragdrop 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,...
...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(); prevents 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: orientationchange event - Web APIs
the orientationchange event is fired when the orientation of the device has changed. ...
... the orientationchange event is fired when the orientation of the device has changed. ...
Window.sessionStorage - Web APIs
tions securityerror the request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: scheme, for example). for example, the user may have their browser configured to deny permission to persist data for the specified origin. example the following snippet accesses the current origin's session storage object and
adds data to it with storage.setitem(). sessionstorage.setitem('mycat', 'tom'); the following example autosaves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost. // get the text field that we're going to track let field = document.getelementbyid("field"); // see if we have an autosave value // (this will only happen if the p...
...riting is lost. // get the text field that we're going to track let field = document.getelementbyid("field"); // see if we have an autosave value // (this will only happen if the page is accidentally refreshed) if (sessionstorage.getitem("autosave")) { // restore the contents of the text field field.value = sessionstorage.getitem("autosave"); } // listen for changes in the text field field.
addeventlistener("change", function() { // and save the results into the session storage object sessionstorage.setitem("autosave", field.value); }); note: please refer to the using the web storage api article for a full example. specifications specification status comment html living standardthe definition of 'sessionstorage' in that specification. living standard ...
Window.sidebar - Web APIs
returns a sidebar object which contains several methods for registering
add-ons with the browser. methods the sidebar object returned has the following methods: method description (seamonkey) description (firefox)
addpanel(title, contenturl, "")
adds a sidebar panel. obsolete since firefox 23 (only present in seamonkey). end users can use the "load this bookmark in the sidebar" option instead. also see creating a firefox sidebar.
addpersistentpanel(title, contenturl, "")
adds a sidebar panel, which is able to work in the background.
addsearchprovider(descriptionurl) dummy function; does nothing. see autodiscovery of search plugins. ...
...since firefox 23 (only present in seamonkey). end users can use the "load this bookmark in the sidebar" option instead. also see creating a firefox sidebar.
addpersistentpanel(title, contenturl, "")
adds a sidebar panel, which is able to work in the background.
addsearchprovider(descriptionurl) dummy function; does nothing. see autodiscovery of search plugins.
addsearchengine(engineurl, iconurl, suggestedtitle, suggestedcategory) obsolete since gecko 44 installs a search engine (sherlock).
adding sherlock search engines contains more details. note: this was made obsolete in firefox 44, and has been removed completely in firefox 59. issearchproviderinstalled(descriptionurl) indicates if a specific search provider (open...
WindowEventHandlers.onbeforeprint - Web APIs
s 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. ...
...le, 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'). var mediaquerylist = window.matchmedia('print'); mediaquerylist.
addlistener(function(mql) { if(mql.matches) { console.log('webkit equivalent of onbeforeprint'); } }); specification specification status comment html living standardthe definition of 'onbeforeprint' in that specification. living standard ...
WindowEventHandlers - Web APIs
note: windoweventhandlers is a mixin and not an interface; you can't actually create an object of type windoweventhandlers. properties the events properties, of the form onxyz, are defined on the windoweventhandlers, and implemented by window, and workerglobalscope for web workers. ...
...ods this interface defines no method. specifications specification status comment html living standardthe definition of 'windoweventhandlers' in that specification. living standard no change since the latest snapshot, html 5.1. html 5.1the definition of 'windoweventhandlers' in that specification. recommendation snapshot of html living standard.
added onlanguage since the html5 snapshot. html5the definition of 'windoweventhandlers' in that specification. recommendation snapshot of html living standard. creation of windoweventhandlers (properties where on the target before it). ...
WindowOrWorkerGlobalScope.caches - Web APIs
returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. syntax var mycachestorage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. ...
... offline use, and generating custom responses to requests. syntax var mycachestorage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. ...
WindowOrWorkerGlobalScope.fetch() - Web APIs
: schemes. a request object. init optional an object containing any custom settings that you want to apply to the request. the possible options are: method the request method, e.g., get, post. note that the origin header is not set on fetch requests with a method of head or get. (this behavior was corrected in firefox 65 — see bug 1508661). headers any headers you want to
add to your request, contained within a headers object or an object literal with bytestring values. note that some names are forbidden. body any body that you want to
add to your request: this can be a blob, buffersource, formdata, urlsearchparams, usvstring, or readablestream object. note that a request using the get or head method cannot have a body. mode the mode you want to use for the re...
... ...
Worker: message event - Web APIs
ge event is fired on a worker object when the worker's parent receives a message from its worker (i.e. when the worker sends a message using dedicatedworkerglobalscope.postmessage()). ...
...m its worker (i.e. when the worker sends a message using dedicatedworkerglobalscope.postmessage()). ...
XMLDocument - Web APIs
the xmldocument interface represents an xml document. it inherits from the generic document and does not
add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
... the xmldocument interface represents an xml document. it inherits from the generic document and does not
add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
HTML in XMLHttpRequest - Web APIs
this feature allows web apps to obtain an html resource as a parsed dom using xmlhttprequest. to get an overview of how to use xmlhttprequest in general, see using xmlhttprequest. limitations to discourage the synchronous use of xmlhttprequest, html support is not available in the synchronous mode. also, html support is only available if the responsetype property has been set to "document". this limitation avoids wasting time parsing html uselessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources. ...
...ed. failing that, if there is a byte order mark, the encoding indicated by the byte order mark is used. failing that, if there is a <meta> element that declares the encoding within the first 1024 bytes of the file, that encoding is used. otherwise, the file is decoded as utf-8. handling html on older browsers xmlhttprequest originally supported only xml parsing. html parsing support is a recent
addition. for older browsers, you can even use the xmlhttprequest.responsetext property in association with regular expressions in order to get, for example, the source code of an html element given its id: function gethtml (oxhr, stargetid) { var ropen = new regexp("<(?!\!)\\s*([^\\s>]+)[^>]*\\s+id\\=[\"\']" + stargetid + "[\"\'][^>]*>" ,"i"), ssrc = oxhr.responsetext, aexec = ropen.exec(...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
gerprint + "\n"); var validity = cert.validity.queryinterface(ci.nsix509certvalidity); dump("\tvalid from " + validity.notbeforegmt + "\n"); dump("\tvalid until " + validity.notaftergmt + "\n"); } } catch(err) { alert(err); } } function test(url) { var req = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(); req.open('get', url, true); req.
addeventlistener("error", function(e) { var error = createtcperrorfromfailedxhr(req); dumpsecurityinfo(req, error); }, false); req.onload = function(e) { dumpsecurityinfo(req); }; req.send(); } then test("https://
addons.mozilla.org"); produced the following output in my console: connection status: succeeded security info: security state: secure ...
... function(e) { var error = createtcperrorfromfailedxhr(req); dumpsecurityinfo(req, error); }, false); req.onload = function(e) { dumpsecurityinfo(req); }; req.send(); } then test("https://
addons.mozilla.org"); produced the following output in my console: connection status: succeeded security info: security state: secure common name (cn) =
addons.mozilla.org organisation = mozilla corporation issuer = verisign, inc. sha1 fingerprint = f4:99:64:18:6b:7d:c8:fa:c0:0c:2e:a9:61:77:28:67:13:c4:97:7b valid from 7/14/2011 0:00:00 am valid until 8/20/2013 23:59:59 pm and here is the output of making an https request to a server that uses an expired certificate: test("https://www.appliancetherapy.com/"); ...
XMLHttpRequest() - Web APIs
st() constructor creates a new xmlhttprequest. for details about how to use xmlhttprequest, see using xmlhttprequest. syntax const request = new xmlhttprequest(); parameters none. return value a new xmlhttprequest object. the object must be prepared by at least calling open() to initialize it before calling send() to send the request to the server. non-standard firefox syntax firefox 16
added a non-standard parameter to the constructor that can enable anonymous mode (see bug 692677). setting the mozanon flag to true effectively resembles the anonxmlhttprequest() constructor described in older versions of the xmlhttprequest specification. const request = new xmlhttprequest(paramsdictionary); parameters (non-standard) objparameters there are two flags you can set: mozanon ...
...r versions of the xmlhttprequest specification. const request = new xmlhttprequest(paramsdictionary); parameters (non-standard) objparameters there are two flags you can set: mozanon boolean: setting this flag to true will cause the browser not to expose the origin and user credentials when fetching resources. most important, this means that cookies will not be sent unless explicitly
added using setrequestheader. mozsystem boolean: setting this flag to true allows making cross-site connections without requiring the server to opt-in using cors. requires setting mozanon: true, i.e. this can't be combined with sending cookies or other user credentials. this only works in privileged (reviewed) apps (bug 692677); it does not work on arbitrary webpages loaded in firefox ...
XMLHttpRequest - Web APIs
xmlhttprequest (xhr) objects are used to interact with servers. you can retrieve data from a url without having to do a full page refresh. this enables a web page to update just part of a page without disrupting what the user is doing. xmlhttprequest is used heavily in ajax programming. ...
...response to the request, as a javascript typed array. xmlhttprequest.multipartobsolete since gecko 22 this gecko-only feature, a boolean, was removed in firefox/gecko 22. please use server-sent events, web sockets, or responsetext from progress events instead. event handlers onreadystatechange as a property of the xmlhttprequest instance is supported in all browsers. since then, a number of
additional event handlers have been implemented in various browsers (onload, onerror, onprogress, etc.). see using xmlhttprequest. more recent browsers, including firefox, also support listening to the xmlhttprequest events via standard
addeventlistener() apis in
addition to setting on* properties to a handler function. methods xmlhttprequest.abort() aborts the request if it has already been se...
XRInputSourceArray - Web APIs
the interface xrinputsourcearray represents a live list of webxr input sources, and is used as the return value of the xrsession property inputsources. each entry is an xrinputsource representing one input device connected to the webxr system. in
addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available. properties the following properties are available on xrinputsourcearray objects. length read only the number of xrinputsource objects in the list. methods the following methods are available on xrinputsourcearray objects. you may also use the features of the symbol type. entries() returns an it...
...ed is an array whose first value is the index and whose second value is the xrinputsource at that index. foreach() iterates over each item in the list, in order from first to last. keys() a list of the keys corresponding to the entries in the input source list. values() returns an iterator you can use to go through all the values in the list. each item is a single xrinputsource object. in
addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code below calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty. let sources = xrsession.inputsources; if (sources.length > 0) { handleinput(sources[0]); } examples specifications specification status c...
XRInputSourcesChangeEventInit.removed - Web APIs
the xrinputsourceschangeeventinit property removed is an array of zero or more xrinputsource objects, each representing one input source which has been removed from the xrsession. ...
...ession,
added: [newdevice1, ..., newdevicen], removed: [removeddevice1, ..., newdevicen], }; myinputsourceschangeevent = new xrinputsourceschangeeventinit("inputsourceschange", inputsourceseventinit); myinputsourceschangeevent = new xrinputsourceschangeeventinit("inputsourceschange", { session: xrsession,
added:
addeddevicelist, removed: removeddevicelist }); value an array of zero or more xrinputsource objects, each representing one input device removed from the xr system. specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.removed' in that specification. ...
XRSession: select event - Web APIs
eo tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselect for details on how the selectstart, select, and selectend events work, and how you should react to them, see primary actions in inputs and input sources. ...
...lectstart, select, and selectend events work, and how you should react to them, see primary actions in inputs and input sources. examples the following example uses
addeventlistener() to set up a handler for the select event. the handler fetches the pose representing the target ray for tracked-pointer inputs and sends the pose's transform to a function called myhandleselectwithray(). ...
XRSession: squeeze event - Web APIs
system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueeze for details on how the squeezestart, squeeze, and squeezeend events work, and how you should react to them, see primary squeeze actions in inputs and input sources. examples the following example uses
addeventlistener() to set up a handler for the squeeze event. the handler fetches the pose representing the target ray for tracked-pointer inputs and sends the pose's transform to a function called myhandlesqueezewithray(). this code treats the squeeze as an instantaneous action that doesn't involve tracking an ongoing activity. if you need to track a squeeze action that isn't instantaneous, listen ...
... target ray for tracked-pointer inputs and sends the pose's transform to a function called myhandlesqueezewithray(). this code treats the squeeze as an instantaneous action that doesn't involve tracking an ongoing activity. if you need to track a squeeze action that isn't instantaneous, listen for the squeezestart and squeezeend events to sense when the squeeze action begins and ends. ...
XRSession: visibilitychange event - Web APIs
litystate property to determine the new visibility state. bubbles yes cancelable no interface xrsessionevent event handler property onvisibilitychange when the xrsession receives this event, the visibility state has already been changed. ...
...e xrsessionevent event handler property onvisibilitychange when the xrsession receives this event, the visibility state has already been changed. ...
XRSession - Web APIs
ed to interact with and control the session. to open a webxr session, use the xrsystem interface's requestsession() method. with xrsession methods, you can poll the viewer's position and orientation (the xrviewerpose), gather information about the user's environment, and present imagery to the user. xrsession supports both inline and immersive virtual and augmented reality modes. properties in
addition to the properties listed below, xrsession inherits properties from its parent interface, eventtarget. environmentblendmode read only returns this session's blend mode which denotes how much of the real-world environment is visible through the xr device and how the device will blend the device imagery with it. note: environmentblendmode() is part of the webxr augmented reality mo...
...jects can be and still get rendered), as well as field of view information. visibilitystate read only a domstring whose value is one of those found in the xrvisibilitystate enumerated type, indicating whether or not the session's imagery is visible to the user, 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 previous call to requestanimationframe(). end() ends the webxr session. returns a promise which resolves when the session has been shut down...
XRSessionEvent - Web APIs
the webxr device api's xrsessionevent interface describes an event which indicates the change of the state of an xrsession. these events occur, for example, when the session ends or the visibility of its context changes. constructor xrsessionevent() creates and returns a new xrsessionevent object configured using the specified xrsessioneventinit object's values as available. properties in
addition to properties inherited from its parent interface, event, xrsessionevent provides the folllowing: session read only the xrsession to which the event refers. methods while xrsessionevent defines no methods, it inherits methods from its parent interface, event. session event types the following events are represented using the xrsessionevent interface, and are permitted values for it...
...e fired at the session whenever its visibility state changes. examples this example creates a listiener that watches for the visibility state of the session to change. it reacts by calling a function mysessionvisible() with a boolean indicating whether or not the session is visible; this function might, for instance, spin up or reconfigure a worker that handles rendering the scene. xrsession.
addeventlistener("visibilitystate", e => { switch(e.session.visibilitystate) { case "visible": case "visible-blurred": mysessionvisible(true); break; case "hidden": mysessionvisible(false); break; } }); specifications specification status comment webxr device apithe definition of 'xrsessionevent' in that specification. working ...
XRSessionMode - Web APIs
the webxr augmented reality module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr indicates that the rendered session will be displayed using an immersive xr device in vr mode; it is not intended to be overlaid or integrated into the surrounding environment. the environmentblendmode is expected to be opaque if possible, but might be
additive if the hardware requires it. inline the output is presented inline within the context of an element in a standard html document, rather than occupying the full visual space. inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. inline sessions don't require special hardware and should be avalable on any user agent offering webxr ...
...f webxr is available, the inline mode is always supported. specifications specification status comment webxr device apithe definition of 'xrsessionmode' in that specification. working draft initial definition. webxr augmented reality modulethe definition of 'xrsessionmode: immersive-ar' in that specification. editor's draft the immersive-ar value
added ...
XRSystem: devicechange event - Web APIs
note: not to be confused with the mediadevices devicechange event. ...
...r for the availability of a webxr-compatible device so that you can enable a ui element which the user can use to activate immersive mode. this is shown in the example below. example the example shown here handles the devicechange event by toggling the availability of the "enter xr" button based on whether or not any immersive devices are currently available. ...
XRSystem - Web APIs
the webxr device api interface xrsystem provides methods which let you get access to an xrsession object representing a webxr session. with that xrsession in hand, you can use it to interact with the augmented reality (ar) or virtual reality (vr) device. properties while xrsystem directly offers no properties, it does inherit properties from its parent interface, eventtarget. methods in
addition to inheriting methods from its parent interface, eventtarget, the xrsystem interface includes the following methods: issessionsupported() returns a promise which resolves 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. ...
...as changed. also available using the ondevicechange event handler. usage notes thsi interface was previously 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(). ...
ARIA: contentinfo role - Accessibility
are intended to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. one contentinfo landmark per page the <body> element there should be only one contentinfo landmark per document, used as the immediate descendant of the <body> element. mega-footers do not nest
additional <footer> elements or contentinfo landmarks inside of the document's footer. use other content sectioning elements instead. labeling landmarks multiple landmarks if there is more than one contentinfo landmark role or <footer> element in a document, provide a label with the aria-label attribute for each landmark. this label will allow assitive technology users to quickly understand the pu...
...info footer". best practices prefer html when it is an immediate descendant of the <body> element, using the <footer> element will automatically communicate a section has a role of contentinfo (save for a known issue in voiceover). if at all possible, prefer using <footer> instead. note that a footer element nested within an article, aside, main, nav, or section is not considered contentinfo.
added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'contentinfo...
ARIA: document role - Accessibility
indicate a section of a complex composit widget that an assistive technology user should read using its browse or virtual reading mode, if available. because ats with reading mode default to that mode for all elements except for those with a widget or application role set, document role is only useful for focusable elements within a widget or application that should be read as static rich text.
adding role="document" and tabindex="0" to the element containing the text within a widget enables the screen reader user to press the tab key to place focus on the document element and read the text with the screen reader's reading cursor. assistive technologies should switch context back to document mode, possibly intercepting from controls rewired for the parent's dynamic context, re-enabling the...
...message list either by activating the back button or pressing an asociated keystroke, direct application interaction mode is invoked again, and the user can move to a different conversation in the list with the arrow keys. best practices always make sure an item with the document role is focusable, by setting the tabindex attribute with a value of 0. that will also include it in the tab order.
added benefits the document role is an easy way to indirectly control assistive technology behavior by unambiguously stating that this is content the user should read with standard screen reader commands. specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'document' in that specification. recommendation screen re...
ARIA: figure role - Accessibility
lude images, video, audio, code snippets, or other content) can be identified as a figure using role="figure". there are no hard and fast rules about how you should write your figure content. you should make sure that it is accessible just like any other content. for example, make sure it is perceivable by users of assistive technology, navigable by keyboard as well as mouse, and so on. you can
add a caption or label to your figure in a number of ways. you could
add an id to an element containing content that describes the figure, and then reference that id inside an appropriate attribute on the figure to associate the figure with the label: <div role="figure" aria-labelledby="figure-1"> ... <p id="figure-1">text that describes the figure.</p> </div> use aria-labelledby when the tex...
...igure and its caption — <figure> and <figcaption>. see best practices for a full example. associated wai-aria roles, states, and properties aria-describedby the id of an element containing reference text serving as a caption. aria-labelledby the id of an element containing text serving as a label. aria-label if there is no element containing text that could serve as a label, you can
add the label directly as a value on the aria-label on the element with the figure role or on the <figure> element. keyboard interactions no role specific keyboard interactions. required javascript features no role specific javascript requirements. if you don't have control over the html semantics, you can improve the accessibility of html by
adding these roles and properties with javascript. e...
ARIA: Main role - Accessibility
e <main> element will automatically communicate a section has a role of main. if at all possible, prefer using it instead. skip navigation skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.). this allows the user to access the main content of the page faster. ...
...r to access the main content of the page faster.
adding an id attribute to the element with a declaration of role="main" allows it to be a target of a skip navigation link. <body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <div id="main-content" role="main"> <!-- main page content --> </div> </body> webaim: "skip navigation" links
added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria navigt...
ARIA: Region role - Accessibility
> role with discretion</h3> <!-- content --> </div> ... <div role="region" aria-labelledby="please-reconsider"> <h3 id="please-reconsider">please reconsider your document structure</h3> <!-- content --> </div> in this example, the region's label is being generated by the aria-labelledby attribute. ...
...ledby attribute. scrolling content areas with overflow text if there is a content area with tabindex="0",
add role="region" to convey to screen reader users that is a generic region. this is done to allow keyboard-only users to scroll regions with overflow text. svg role="region" can be declared on areas of svg along with an aria-label to allow individual sections of the svg to be described.
added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria region...
ARIA: search role - Accessibility
the search landmark role is used to identify a section of the page used to search the page, site, or collection of sites. <form role="search"> <!-- search input --> </form> description the search role is a landmark. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. the search role is
added to the container element that encompasses the items and objects that, as a whole, combine to create search functionality. when a <form> is a search form, use the search role instead of form. if a document includes more than one search, each should have a unique label. while there is a input of type search, there is html element that defines a search landmark. examples <form id="search" role="search"> <label for="search-input">search ...
...om" role="search" aria-label="sitewide"> <!-- search input --> </form> </footer> redundant descriptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="search" with an of aria-label="sitewide search" may be announced redundantly as, "sitewide search search".
added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria search...
Accessibility: What users can do to browse more safely - Accessibility
ttings can help prevent 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 afforded to developers. the user can do much to protect himself by learning his operating system, its personalization and accessibility settings. those in the public sector who must accomodate those with special sensitivities, should consider setting aside at leas...
...sibility settings can actually be a money-saving endeavor. one work station can be set up to acommodate both a low-vision individual (needs high-contrast) and to accomodate an individual with photosensitive susceptibilities, by simply, adjusting personalization and accessiblity settings. use modern browers. learn personalization and accessibility settings firefox 73 and above (dekstop) firefox
added support for css prefers-reduced-motion in october 2018. chrome 74 and above (desktop) chrome 74
added support for reduced-motion-query, it has 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. examples include: transitionrun trans...
Architecture - Accessibility
\n remains in the containing text. they are in the nsiaccessible hierarchy to make it easy for nshypertextaccessible to piece its text representation together. everything else uses whatever nsaccessible-derived implementation that's appropriate. if it has text siblings, then it gets exposed as the unicode char for an embedded object, which is '\xfffc' within the parent nshypertextaccessible. in
addition, nsiaccessiblehyperlink is implemented on any non-text child inside a container that also has text. this allows at's to find its position within that text, because the hyperlink interface exposes a start and end index. in fact, the end index will always be 1 larger than the start index, because the object is always represented by a single '\xfffc' character. if you want to know that somethin...
...//www.mozilla.org/access">my link<img src="image.gif">is cool</a>bye</div> both the <a> and <img> are hyperlinks also, both the <div> and <a> are hypertexts so the <a> is both a hypertext and a hyperlink, because it contains text and is contained within text. this means that we have an exact mirror to the dom, but text lives in the parents instead of in the leaves, which now don't really provide
additional useful information. they are only provided under msaa/ia2 for backward compatibility. implementation classes here are some notes on the classes we use: nshypertextaccessible is for any container that may wrap both text and embedded object: nsiaccessibletext is supported if there is potentially any text in the container nsiaccessiblehypertext is supported if there is potentially text a...
Keyboard-navigable JavaScript widgets - Accessibility
earlier in the tab order than larger values (for example, tabindex="7" will be positioned before tabindex="11"). non-native controls native html elements that are interactive, like <a>, <input> and <select>, are already accessible by keyboards, so to use one of them is the fastest path to make components work with keyboards. authors can also make a <div> or <span> keyboard accessible by
adding a tabindex of 0. this is particularly useful for components that use interactive elements that do not exist in html. grouping controls for grouping widgets such as menus, tablists, grids, or tree views, the parent element should be in the tab order (tabindex="0"), and each descendent choice/tab/cell/row should be removed from the tab order (tabindex="-1"). users should be able to navigate th...
...d dosomething() to the key down event as well: onkeydown="return event.keycode != 13 || dosomething();". always draw the focus for tabindex="-1" items and elements that receive focus programatically ie will not automatically draw the focus outline for items that programatically receive focus. choose between 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). prevent used key events from performing browser functions if your widget handles a key event, ...
Understandable - Accessibility
t view, the user should be asked to confirm this action, save their work if appropriate, etc. globaleventhandlers.oninput is useful here. 3.2.3 consistent navigation (aa) navigation menu/control style and positioning should be consistent between different pages or views of a web page, and the existing items should appear in the same order, even if for example new iteam are
added. if the user has initiated a change, e.g. choosing a different color scheme or position for the navigation, their choice should be respected across all pages. again, sensible design — make the navigation controls the same across all pages or views. see page layouts for information on modern markup for layouts. see also styling links as buttons for a useful accessible navigation me...
...or information on live regions. 3.3.2 labels or instructions (a) clear instructions should be provided when data input is required. when a simple instruction or prompt is required, you can use <label> elements for single inputs like name or age, a combination or <label>s and <fieldset>s/<legend>s for multiple inputs that go together (like the elements of a date of birth or postal
address). when more complex explanation is required, you can always include explanatory paragraphs too, or maybe you need to try to make your forms more intuitive. meaningful text labels how to structure an html form text labels and names 3.3.3 error suggestion (aa) when an error is detected and suggestions for correction are known, provide t...
-webkit-mask-position-x - CSS: Cascading Style Sheets
left equivalent to 0%. center equivalent to 50%. right equivalent to 100%. formal definition ...
...itial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <length-percentage> a length indicating the position of the left edge of the image relative to the box's left p
adding edge. percentages are calculated against the horizontal dimension of the box p
adding area. that means, a value of 0% means the left edge of the image is aligned with the box's left p
adding edge and a value of 100% means the right edge of the image is aligned with the box's right p
adding edge. left equivalent to 0%. center equivalent to 50%. right equivalent to 100%. formal definition initial value0%applies toall elementsinheritednopercentagesrefer to the size of the b...
-webkit-mask-position-y - CSS: Cascading Style Sheets
top equivalent to 0%. bottom equivalent to 100%. center equivalent to 50%. formal definition initial value0...
... initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <length-percentage> a length indicating the position of the top side of the image relative to the box's top p
adding edge. percentages are calculated against the vertical dimension of the box p
adding area. a value of 0% means the top edge of the image is aligned with the box's top p
adding edge and a value of 100% means the bottom edge of the image is aligned with the box's bottom p
adding edge. top equivalent to 0%. bottom equivalent to 100%. center equivalent to 50%. formal definition initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcom...
::-webkit-scrollbar - CSS: Cascading Style Sheets
proin at nulla elementum, consectetur ex eget, commodo ante. sed eros mi, bibendum ut dignissim et, maximus eget nibh. phasellus blandit quam turpis, at mollis velit pretium...
... proin at nulla elementum, consectetur ex eget, commodo ante. sed eros mi, bibendum ut dignissim et, maximus eget nibh. phasellus blandit quam turpis, at mollis velit pretium ut. nunc consequat efficit...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
t-variant-position, font-weight, font-size, font-size-adjust, line-height and font-family all background properties : background, background-color, background-image, background-clip, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode all margin properties: margin, margin-top, margin-right, margin-bottom, margin-left all p
adding properties: p
adding, p
adding-top, p
adding-right, p
adding-bottom, p
adding-left all border properties: the shorthands border, border-style, border-color, border-width, border-radius, border-image, and the longhands properties the color property the text-decoration, text-shadow, text-transform, letter-spacing, word-spacing (when appropriate), line-height, text-decoration-color, text-decoration...
...vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est.</p> <p>duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> css p { width: 500px; line-height: 1.5; } h2 + p::first-letter { color: white; background-color: black; border-radius: 2px; box-shadow: 3px 3px 0 red; font-size: 250%; p
adding: 6px 3px; margin-right: 6px; float: left; } result effect on special punctuation and non-latin characters this example illustrates the effect of ::first-letter on special punctuation and non-latin characters. html <p>duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> <p>-the beginning of a special punctuation mark.</p> <p>_the beginning of a...
:host - CSS: Cascading Style Sheets
specifications specification status comment css scoping module level 1the definition of ':host' in that specification. working draft initial definition. browser compatib...
... specifications specification status comment css scoping module level 1the definition of ':host' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from s...
:target - CSS: Cascading Style Sheets
<li><a href="#nowhere">this link goes nowhere, because the target doesn't exist.</a></li> </ol> <h3>my fun article</h3> <p id="p1">you can target <i>this paragraph</i> using a url fragment. click on the link above to try out!</p> <p id="p2">this is <i>another paragraph</i>, also accessible from the links above. isn't that delightful?</p> css p:target { background-color: gold; } /*
add a pseudo-element inside the target element */ p:target::before { font: 70% sans-serif; content: "►"; color: limegreen; margin-right: .25em; } /* style italic elements within the target element */ p:target i { color: red; } result pure-css lightbox you can use the :target pseudo-class to create a lightbox without using any javascript. this technique relies on the ability of ancho...
...is neque arcu, nec gravida magna.</figcaption> </figure> </div> css /* unopened lightbox */ .lightbox { display: none; } /* opened lightbox */ .lightbox:target { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; } /* lightbox content */ .lightbox figcaption { width: 25rem; position: relative; p
adding: 1.5em; background-color: lightpink; } /* close button */ .lightbox .close { position: relative; display: block; } .lightbox .close::after { right: -1rem; top: -1rem; width: 2rem; height: 2rem; position: absolute; display: flex; z-index: 1; align-items: center; justify-content: center; background-color: black; border-radius: 50%; color: white; content: "×"; ...
pad - CSS: Cascading Style Sheets
the pad descriptor can be used with custom counter style definitions when you need the marker representations to have a minimum length. syntax pad: 3 "0"; values <integer> && <symbol> the <integer> specifies a minimum length that all counter representations must reach. the value must be non-negative. if the minimum length is not reached, the representation will be p
added with the specified <symbol>. description if a marker representation is smaller than the specified pad length, then the marker will be p
added with the specified pad symbol. marker representations longer than the pad length are constructed as normal. pad descriptor takes the minimum marker length as an integer and a symbol to be used for p
adding as the second parameter. a common usage of the pad descriptor is when y...
...<number> | <angle><linear-color-stop> = <color> <color-stop-length>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples p
adding a counter html <ul class="list"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> css @counter-style pad-example { system: numeric; symbols: "0" "1" "2" "3" "4" "5"; pad: 2 "0"; } .list { list-style: pad-example; } result specifications specification status comment css counter styles level 3the definition of 'pad...
range - CSS: Cascading Style Sheets
es */ range: 2 5; range: infinite 10; range: 6 infinite; range: infinite infinite; /* multiple range values */ range: 2 5, 8 10; range: infinite 6, 10 infinite; values auto the range depends on the counter system: for cyclic, numeric, and fixed systems, the range is negative infinity to positive infinity. for alphabetic and symbolic systems, the range is 1 to positive infinity. for
additive systems, the range is 0 to positive infinity. for extends systems, the range is whatever auto would produce for the extended system; if extending a complex predefined style (§7 complex predefined counter styles), the range is the style’s defined range. [ [ | infinite ]{2} ]# defines a comma-separated list of ranges. for each individual range, the first value is the lower bound and...
...ire descriptor is invalid and will be ignored. description the value of the range descriptor can be either auto or a comma separated list of lower and upper bounds specified as integers. if value is auto, then for cyclic, numeric, and fixed system, the range will be from negative infinity to positive infinity. for alphabetic and symbolic systems, range will be from 1 to positive infinity. for
additive systems, auto will result in the range 0 to positive infinity. for extends systems, the range is whatever auto will produce for the extended system. when range is specified as integers, the value infinite can be used to denote infinity. if infinite is specified as the first value in a range, then it is interpreted as negative infinity. if used as upper bound, it is taken as positive infinit...
font-style - CSS: Cascading Style Sheets
tyle: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; values normal selects the normal version of the font-family. italic specifies that font-face is an italicized version of the normal font. oblique specifies that the font-face is an artificially sloped version of the normal font. oblique with angle selects a font classified as oblique, and
additionally specifies an angle for the slant of the text. oblique with angle range selects a font classified as oblique, and
additionally specifies a range of allowable angle for the slant of the text. note that a range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is allowed. formal definition related at-rule@font-faceinitial valuenormalcom...
...y have a rounded and calligraphic quality. these fonts are specially created by font designers and are not artificially sloped. @font-face { font-family: garamond; src: url('garamond-italic.ttf'); font-style: italic; } specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft
adds oblique keyword with angle value css fonts module level 3the definition of 'font-style' in that specification. candidate recommendation initial definition ...
marks - CSS: Cascading Style Sheets
the marks css at-rule descriptor, used with the @page at-rule,
adds crop and/or cross marks to the presentation of the document. crop marks indicate where the page should be cut. cross marks are used to align sheets. crop marks and cross marks are printed outside the page box. to have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. syntax /* keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; values crop crop marks will be displayed. cross cross marks will be displayed. none no marks will be displayed. ...
... will have to be somewhat bigger than the page box. syntax /* keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; values crop crop marks will be displayed. cross cross marks will be displayed. none no marks will be displayed. formal definition related at-rule@pageinitial valuenonecomputed valueas specified formal syntax none | [ crop | cross ] examples
adding crop and cross marks @page { marks: crop cross; } specifications specification status comment css paged media module level 3the definition of 'marks' in that specification. working draft initial definition this css property was initially proposed in css level 2, but was dropped from css level 2 (revision 1). ...
@page - CSS: Cascading Style Sheets
the @page css at-rule is used to modify some css properties when printing a document. syntax @page { margin: 1cm; } @page :first { margin: 2cm; } descriptors size specifies the target size and orientation of the page box’s containing block. in the general case, where one page box is rendered onto one page sheet, it also indicates the size of the destination page sheet. marks
adds crop and/or registration marks to the document. bleed specifies the extent beyond the page box at which the page rendering is clipped. description you can't change all css properties with @page. you can only change the margins, orphans, widows, and page breaks of the document. attempts to change any other css properties will be ignored. the @page at-rule can be accessed via the css object...
...@right-top | @right-middle | @right-bottom examples @page pseudo-class examples please refer to the various pseudo-classes of @page for examples. :blank :first :left :right :recto :verso specifications specification status comment 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 ...
Mastering margin collapsing - CSS: Cascading Style Sheets
, if they are equal), a behavior known as margin collapsing. note that the margins of floating and absolutely positioned elements never collapse. margin collapsing occurs in three basic cases: adjacent siblings the margins of adjacent siblings are collapsed (except when the latter sibling needs to be cleared past floats). no content separating parent and descendants if there is no border, p
adding, inline part, block formatting context created, or clearance to separate the margin-top of a block from the margin-top of one or more of its descendant blocks; or no border, p
adding, inline content, height, min-height, or max-height to separate the margin-bottom of a block from the margin-bottom of one or more of its descendant blocks, then those margins collapse. the collapsed margin ends up ...
... some things to note: more complex margin collapsing (of more than two margins) occurs when the above cases are combined. ...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
t, including all descendent elements, into columns. this happens in the same way that content is fragmented into pages when we work with css paged media, for example by creating a print stylesheet. the properties defined by the specification are: column-width column-count columns column-rule-color column-rule-style column-rule-width column-rule column-span column-fill column-gap by
adding column-count or column-width to an element, that element becomes a multi-column container, or multicol container for short. the columns are anonymous boxes and described as column boxes in the specification. defining columns to create a multicol container you must use at least one of the column-* properties, these being column-count and column-width. the column-count property the column-co...
...lumn-width property the column-width property is used to set the optimal width for every column box. if you declare a column-width, the browser will work out how many columns of that width will fit into the multicol container and distribute any extra space equally between the columns. therefore, the column width should be seen as a minimum width, as column boxes are likely to be wider due to the
additional space. the column box will only shrink to be smaller than the declared column width in the case of a single column with less available width than the value of column-width. in the below example we use the column-width property with a value of 200px. we get as many 200 pixel columns as will fit the container, with the extra space shared equally. using column-count and column-width toge...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
rrent level 1 specification there are only two allowable values for column-span. the value none is the initial value and means the item does not span, remaining within a column. the value all means the item spans all of the columns. you cannot cause an item to span two out of three columns for example. ...
...use spanning carefully and test at various breakpoints to make sure you get the intended effect. ...
Using multi-column layouts - CSS: Cascading Style Sheets
e track of which line they were on. therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. unfortunately this is impossible to do with css and html without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting. this limitation is solved by
adding new css properties to extend the traditional block layout mode. using columns column count and width two css properties control whether and how many columns will appear: column-count and column-width. the column-count property sets the number of columns to a particular number. e.g., example 1 html <div id="col"> <p> lorem ipsum dolor sit amet, consectetur adipisicing elit, se...
... situations it is also useful to set the maximum height of the columns explicitly, and then lay out content starting at the first column and creating as many columns as necessary, possibly overflowing to the right. therefore, if the height is constrained, by setting the css height or max-height properties on a multi-column block, each column is allowed to grow to that height and no further before
adding new column. this mode is also much more efficient for layout. column gaps there is a gap between columns. the recommended default is 1em. this size can be changed by applying the column-gap property to the multi-column block: example 6 html <div id="column_gap"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliq...
CSS Display - CSS: Cascading Style Sheets
to-placement in grid layout box alignment in grid layout grids, logical values and writing modes css grid layout and accessibility css grid layout and progressive enhancement realizing common layouts using grids specifications specification status comment css display module level 3the definition of 'display' in that specification. ...
...ncement realizing common layouts using grids specifications specification status comment css display module level 3the definition of 'display' in that specification. candidate recommendation
added run-in, flow, flow-root, contents and multi-keyword 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. in
addition to the css display specification level 3, further specifications define the behavior of various values of display. ...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
of browsers, and in particular ie10 and 11, the flexbugs site is a helpful resource. you will see that many of the listed bugs apply to old browser versions and are fixed in current browsers. each of the bugs has a workaround listed — which can save you many hours of puzzling. if you want to include very old browsers with flexbox support then you can include the vendor prefixes in your css in
addition to the unprefixed version. this is becoming less and less of a requirement today as support is widespread. .wrapper { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } autoprefixer online is a useful way to see which prefixes are recommended, depending on how many versions you wish to go back with browser support. you can also check can i use for ...
...o equal height. any float behaviour does not apply. you can test the fallback behaviour by removing display: flex from the wrapper. display: inline-block once an inline-block item becomes a flex item, it is blockified and so behavior of display: inline-block like preserving white space between items no longer applies. remove display: flex to see the fallback behavior. you'll see white space
added between the items, which is what happens when using display: inine-block as it prefers white space like other inline items. display: table- the css table display properties are potentially very useful as a fallback, due to the fact that they allow design patterns such as full height columns and vertical centering and work back as far as internet explorer 8. if you use display: table-cell ...
Ordering Flex Items - CSS: Cascading Style Sheets
e document.” note: for some years firefox had a bug whereby it would attempt to follow the visual order and not the source order, making it behave differently to other browsers. this has now been fixed. you should always take the source order as the logical order of the document as all up-to-date user agents will be following the specification and doing so. in the live example below i have
added a focus style in order that as you tab from link to link you can see which is highlighted. if you change the order using flex-direction you can see how the tab order continues to follow the order that the items are listed in the source. in the same way that changing the value of flex-direction does not change the order in which items are navigated to, changing this value does not change pain...
...h is highlighted. if you change the order using flex-direction you can see how the tab order continues to follow the order that the items are listed in the source. in the same way that changing the value of flex-direction does not change the order in which items are navigated to, changing this value does not change paint order. it is a visual reversal of the items only. the order property in
addition to reversing the order in which flex items are visually displayed, you can target individual items and change where they appear in the visual order with the order property. the order property is designed to lay the items out in ordinal groups. what this means is that items are assigned an integer that represents their group. the items are then placed in the visual order according to that in...
In Flow and Out of Flow - CSS: Cascading Style Sheets
out of flow items create a new block formatting context (bfc) and therefore everything inside them can be seen as a mini layout, separate from the rest of the page. the root element therefore is out of flow, as the container for everything in our document, and establishes the block formatting context for the document. floated items in this example i have a div, and then two paragraphs. i’ve
added a background colour to the paragraphs, and then floated the div left. the div is now out of flow. as a float it is first laid out according to where it would be in normal flow, then taken out of flow and moved to the left as far as possible. you can see the background colour of the following paragraph running underneath, it is only the line boxes of that paragraph that have been shortened t...
...low and moved to the left as far as possible. you can see the background colour of the following paragraph running underneath, it is only the line boxes of that paragraph that have been shortened to cause the effect of wrapping content around the float. the box of our paragraph is still displaying according to the rules of normal flow. this is why, to make space around a floated item, you must
add a margin to the item, in order to push the line boxes away from it. you cannot apply anything to the following in-flow content to achieve that. absolute positioning giving an item position: absolute or position: fixed removes it from flow, and any space that it would have taken up is removed. in the next example i have three paragraph elements, the second element has position absolute, with off...
CSS Fonts - CSS: Cascading Style Sheets
type font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. this article will give you all you need to know to get you started using variable fonts. ...
...or every width, weight, or style. this article will give you all you need to know to get you started using variable fonts. specifications specification status comment css fonts module level 4 working draft
adds font-variation-settings (and related higher-level properties) and font-optical-sizing. ...
CSS Grid Layout - CSS: Cascading Style Sheets
c example the example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. items have been placed onto the grid using line-based placement. ...
... css grid layout candidate recommendation initial definition. ...
Stacking with floated blocks - CSS: Cascading Style Sheets
locks, in order of appearance in the html floating blocks descendant positioned elements, in order of appearance in the html actually, as you can see in the example below, the background and border of the non-positioned block (div #4) is completely unaffected by floating blocks, but the content is affected. this happens according to standard float behaviour. ...
... what no one told you about z-index). ...
Stacking context example 2 - CSS: Cascading Style Sheets
e html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head><style type="text/css"> div { font: 12px arial; } span.bold { font-weight: bold; } #div2 { z-index: 2; } #div3 { z-index: 1; } #div4 { z-index: 10; } #div1,#div3 { height: 80px; position: relative; border: 1px dashed #669966; background-color: #ccffcc; p
adding-left: 5px; } #div2 { opacity: 0.8; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #000099; background-color: #ddddff; text-al...
...} #div2 { opacity: 0.8; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #000099; background-color: #ddddff; text-align: left; p
adding-left: 10px; } </style></head> <body> <br /> <div id="div1"><br /> <span class="bold">div #1</span><br /> position: relative; <div id="div2"><br /> <span class="bold">div #2</span><br /> position: absolute;<br /> z-index: 2; </div> </div> <br /> <div id="div3"><br /> <span class="bold">div #3<...
Stacking context example 3 - CSS: Cascading Style Sheets
on all of them at once. ...
...t: bold; } div.lev1 { width: 250px; height: 70px; position: relative; border: 2px outset #669966; background-color: #ccffcc; p
adding-left: 5px; } #container1 { z-index: 1; position: absolute; top: 30px; left: 75px; } div.lev2 { opacity: 0.9; width: 200px; height: 60px; position: relative; border: 2px outset #990000; background-color: #ffdddd; p
adding-left: 5px; } #container2 { z-index: 1; position: absolute; top: 20px; left: 110px; } div.lev3 { z-index: 10; width: 100px; position: relative; border: 2px outset #000099; background-color: #ddddff; p
adding-left: 5px; } </style></head> <body> <br /> <div class="lev1"> <span class="bold">level #1</span> <div id="container1"> <div class="lev2"> ...
The stacking context - CSS: Cascading Style Sheets
z-index: 6;</code> </div> <h1>division element #3</h1> <code>position: absolute;<br/> z-index: 4;</code> <div id="div5"> <h1>division element #5</h1> <code>position: relative;<br/> z-index: 1;</code> </div> <div id="div6"> <h1>division element #6</h1> <code>position: absolute;<br/> z-index: 3;</code> </div> </div> css * { margin: 0; } html { p
adding: 20px; font: 12px/20px arial, sans-serif; } div { opacity: 0.7; position: relative; } h1 { font: inherit; font-weight: bold; } #div1, #div2 { border: 1px dashed #696; p
adding: 10px; background-color: #cfc; } #div1 { z-index: 5; margin-bottom: 190px; } #div2 { z-index: 2; } #div3 { z-index: 4; opacity: 1; position: absolute; top: 40px; left: 180px; width: 330px...
...opacity: 0.7; position: relative; } h1 { font: inherit; font-weight: bold; } #div1, #div2 { border: 1px dashed #696; p
adding: 10px; background-color: #cfc; } #div1 { z-index: 5; margin-bottom: 190px; } #div2 { z-index: 2; } #div3 { z-index: 4; opacity: 1; position: absolute; top: 40px; left: 180px; width: 330px; border: 1px dashed #900; background-color: #fdd; p
adding: 40px 20px 20px; } #div4, #div5 { border: 1px dashed #996; background-color: #ffc; } #div4 { z-index: 6; margin-bottom: 15px; p
adding: 25px 10px 5px; } #div5 { z-index: 1; margin-top: 15px; p
adding: 5px 10px; } #div6 { z-index: 3; position: absolute; top: 20px; left: 180px; width: 150px; height: 125px; border: 1px dashed #009; p
adding-top: 125px; background-co...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
firefox initially implemented an early version of the scroll snap specification, called scroll snap points. in firefox 68 the new version of the specification will be shipped and these old properties removed. in this article, we consider questions that might arise related to compatibility across browsers and versions of browsers when
adding support for scroll-snap to your web site or app. what should i do if i used the old firefox implementation? if you have only used the old firefox implementation of the specification, with the properties that are detailed in scroll snap points, you should update your code to use the new specification. this will ensure your scroll snapping works in all browsers which implement the specification, including firefox. if you do not do this your scroll snappi...
...mplementation as a fallback, or feel you want to support users of old firefox (or -webkit prefixed safari), then you can continue to use the old specification as outlined in the example below. in this initial example we have used the old specification alongside the current specification in order to make scroll snapping work in all browsers which support some form of scroll snapping. the example
adds the scroll-snap-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in firefox. we also
added the scroll-snap-type property twice, once with the y axis value needed for browsers that support the new spec, and once for firefox pre-68, which supports the property but without the y value. do i need to use both specs? scroll snapping is one of thos...
CSS selectors - CSS: Cascading Style Sheets
ation that is not contained in the document tree. example: a:visited will match all <a> elements that have been visited by the user. pseudo elements the :: pseudo represent entities that are not included in html. example: p::first-line will match the first line of all <p> elements. specifications specification status comment selectors level 4 working draft
added the || column combinator, grid structural selectors, logical combinators, location, time-demensional, resource state, linguistic and ui pseudo-classes, modifier for ascii case-sensitive and case-insensitive attribute value selection. selectors level 3 recommendation
added the ~ general sibling combinator and tree-structural pseudo-classes. made pseudo-elements use a :: double...
...n combinator, grid structural selectors, logical combinators, location, time-demensional, resource state, linguistic and ui pseudo-classes, modifier for ascii case-sensitive and case-insensitive attribute value selection. selectors level 3 recommendation
added the ~ general sibling combinator and tree-structural pseudo-classes. made pseudo-elements use a :: double-colon prefix.
additional attribute selectors css level 2 (revision 1) recommendation
added the > child and + adjacent sibling combinators.
added the universal and attribute selectors. css level 1 recommendation initial definition. see the pseudo-class and pseudo-element specification tables for details on those. ...
Using CSS transforms - CSS: Cascading Style Sheets
by default the perspective is centered on the viewer, which is not always adequate. changing the perspective origin this example shows cubes with popular perspective-origin values. html <section> <figure> <caption><code>pe...
... ...
Animatable CSS properties - CSS: Cascading Style Sheets
mask-size max-block-size max-height max-inline-size max-lines max-width min-block-size min-height min-inline-size min-width object-position offset offset-anchor offset-distance offset-path offset-position offset-rotate opacity order outline outline-color outline-offset outline-width p
adding p
adding-block-end p
adding-block-start p
adding-bottom p
adding-inline-end p
adding-inline-start p
adding-left p
adding-right p
adding-top perspective perspective-origin right rotate row-gap scale scroll-margin scroll-margin-block scroll-margin-block-end scroll-margin-block-start scroll-margin-bottom s...
...ding-top perspective perspective-origin right rotate row-gap scale scroll-margin scroll-margin-block scroll-margin-block-end scroll-margin-block-start scroll-margin-bottom scroll-margin-inline scroll-margin-inline-end scroll-margin-inline-start scroll-margin-left scroll-margin-right scroll-margin-top scroll-p
adding scroll-p
adding-block scroll-p
adding-block-end scroll-p
adding-block-start scroll-p
adding-bottom scroll-p
adding-inline scroll-p
adding-inline-end scroll-p
adding-inline-start scroll-p
adding-left scroll-p
adding-right scroll-p
adding-top scroll-snap-coordinate scroll-snap-destination scrollbar-color shape-image-threshold shape...
Column layouts - CSS: Cascading Style Sheets
r requirements. a continuous thread of content — multi-column layout if you create columns using multi-column layout your text will remain as a continuous stream filling each column in turn. the columns must all be the same size, and you are unable to target an individual column or the content of an individual column. you can control the gaps between columns with the column-gap property, and
add a rule between columns using column-rule. download this example use multicol when: you want your text to display in newspaper-like columns. you have a set of small items you want to break into columns. you do not need to target individual column boxes for styling. a single row of items with equal heights — flexbox flexbox can be used to break content into columns by setting flex-d...
...ot need to target individual column boxes for styling. a single row of items with equal heights — flexbox flexbox can be used to break content into columns by setting flex-direction to row, however flexbox targets the elements inside the flex container and will place each direct child into a new column. this is a different behavior to what you saw with multicol. there is currently no way to
add a rule between flex items, and browser support for the column-gap and row-gap properties is limited. therefore to create gaps between items use a margin. download this example flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-wrap property on the container to wrap. these new flex lines will distribute space along that line only — the i...
Recipe: Media objects - CSS: Cascading Style Sheets
as the image has a max-width of 100% applied, it scales down so that it continues to fit inside the column. by using grid-template-areas to achieve the layout, i can see the pattern in the css. i define my grid once we have a max-width of 500 pixels, so on smaller devices the media object stacks. an option for the pattern is to flip it to switch the image to the other side — this is done by
adding the media-flip class, which defines a flipped grid template causing the layout to be mirrored. when we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped. fallbacks there are a number of possible fallbacks for this pattern, depending on the browsers you wish to support. a good catch-all would be to float the...
...lass, which defines a flipped grid template causing the layout to be mirrored. when we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped. fallbacks there are a number of possible fallbacks for this pattern, depending on the browsers you wish to support. a good catch-all would be to float the image left, and to
add a clearfix to the box to ensure that it contained the floats. download this example once floated elements become grid items the float no longer applies so you don’t need to do anything special to clear the float. what you will need to do is remove any margins applied to the item, and any widths which we don’t need in a grid context (we have the gap property to control it in grids, and ...
Pagination - CSS: Cascading Style Sheets
can center the list inside using the justify-content property. the list itself also becomes a flex container to lay the items out as a row. to space the items out we will use a margin on the flex items. alternative methods once the column-gap property has implementation in browsers this could be used instead of margins to space out the items. ...
...lumn-gap property has implementation in browsers this could be used instead of margins to space out the items. .pagination { list-style: none; margin: 0; p
adding: 0; display: flex; column-gap: 2px; } accessibility concerns we want to ensure that a person using a screenreader understands what this navigation does, and where they will go when clicking a link. to help with this we have
added aria-label="pagination" on the <nav> element. we have also
added some
additional content that would be read by a screenreader but is hidden visually, and set the aria-hidden attribute on the paging arrows. the "see also" section at the end of this document has links to related accessibility topics. ...
Testing media queries programmatically - CSS: Cascading Style Sheets
ediaquerylist.matches) { /* the viewport is currently in portrait orientation */ } else { /* the viewport is not currently in portrait orientation, therefore landscape */ } receiving query notifications if you need to be aware of changes to the evaluated result of the query on an ongoing basis, it's more efficient to register a listener than to poll the query's result. to do this, call the
addlistener() method on the mediaquerylist object, with a callback function to invoke when the media query status changes (e.g., the media query test goes from true to false): // create the query list. const mediaquerylist = window.matchmedia("(orientation: portrait)"); // define a callback function for the event listener. function handleorientationchange(mql) { // ... } // run the orientation c...
...unction to invoke when the media query status changes (e.g., the media query test goes from true to false): // create the query list. const mediaquerylist = window.matchmedia("(orientation: portrait)"); // define a callback function for the event listener. function handleorientationchange(mql) { // ... } // run the orientation change handler once. handleorientationchange(mediaquerylist); //
add the callback function as a listener to the query list. mediaquerylist.
addlistener(handleorientationchange); this code creates the orientation-testing media query list, then
adds an event listener to it. after
adding the listener, we also call the listener directly. this makes our listener perform adjustments based on the current device orientation; otherwise, our code might assume the device is...
Media queries - CSS: Cascading Style Sheets
in css, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. ...
...ment's media attribute, they define the media to which that source should be applied. (this is only valid inside <picture> elements.) in the <style> element's media attribute, they define the media to which the style should be applied. media queries in javascript in javascript, you can use the window.matchmedia() method to test the window against a media query. you can also use mediaquerylist.
addlistener() to be notified whenever the state of a query changes. with this functionality, your site or app can respond to changes in the device configuration, orientation, or state. you can learn more about programmatically using media queries in testing media queries. reference at-rules @import @media guides using media queries introduces media queries, their syntax, and the operat...
align-items - CSS: Cascading Style Sheets
working draft update to late...
... working draft update to latest syntax definitions. css flexible box layout modulethe definition of 'align-items' in that spec...
background - CSS: Cascading Style Sheets
page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 formal definition initial valueas each of the properties of the shorthand:background-image: nonebackground-position: 0% 0%background-size: auto autobackground-repeat: repeatbackground-origin: p
adding-boxbackground-clip: border-boxbackground-attachment: scrollbackground-color: transparentapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesas each of the properties of the shorthand:background-position: refer to the size of the background positioning area minus size of background image; size refers to the width for horizontal offsets and to the hei...
...)<image-set()> = image-set( <image-set-option># )<element()> = element( <id-selector> )<paint()> = paint( <ident>, <declaration-value>? )<cross-fade()> = cross-f...
border-color - CSS: Cascading Style Sheets
css backgrounds and borders module level 3the definition of 'border-color' in that specification. candidate recommendation the transparent keyword has been...
... css backgrounds and borders module level 3the definition of 'border-color' in that specification. ...
border-image-repeat - CSS: Cascading Style Sheets
chieve the proper fit. formal definition initial valuestretchapplies toall elements, except internal table elements when border-collapse is collapse. ...
... candidate recommendation initial definition ...
border-image-width - CSS: Cascading Style Sheets
dth css property sets the width of an element's border image. 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. if this property's value is greater than the element's border-width, the border image will extend beyond the p
adding (and/or content) edge. syntax /* keyword value */ border-image-width: auto; /* <length> value */ border-image-width: 1rem; /* <percentage> value */ border-image-width: 25%; /* <number> value */ border-image-width: 3; /* vertical | horizontal */ border-image-width: 2em 3em; /* top | horizontal | bottom */ border-image-width: 5% 15% 10%; /* top | right | bottom | left */ border-image-wid...
...unt 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> css p { border: 20px solid; border-image: url("/static/external/21/214842819586a8dd293c17b38d0fd0e26430146a86dd04294a53ecaeeea7d0e2.png") 30 round; border-image-width: 16px; p
adding: 40px; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-image-width' in that specification. candidate recommendation initial definition ...
border-image - CSS: Cascading Style Sheets
or 27, for slicing the image into corner and edge regions. to center the border image on the edge of the element's background, we will make the outset values equal to half of the width values. finally, a repeat value of round will make the border slices fit evenly, i.e., without clipping or gaps. ...
... candidate recommendation initial definition initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-slice: 100%border-image-width: 1border-image-outset: ...
border-width - CSS: Cascading Style Sheets
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 specificati...
... 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. ...
break-after - CSS: Cascading Style Sheets
ement that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value). if any of the three concerned values is an avoid break value (avoid, avoid-page, avoid-region, or avoid-column), no such break will be applied at that point. once forced breaks have been applied, soft breaks may be
added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-after property is specified as one of the keyword values from the list below. values generic break values auto allows, but does not force, any break (page, column, or region) to be inserted right after the principal box. avoid avoids any break (page, column, or region) from being ins...
...cing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; } p { line-height: 1.5; break-after: column; } article { column-width: 200px; gap: 20px; } result specifications specification status comment css fragmentation module level 3the definition of 'break-after' in that specification. candidate recommendation
adds the recto and verso keywords. changes the media type of this property from paged to visual. defines the breaking algorithm with different kinds of breaks. css regions module level 1the definition of 'break-after' in that specification. working draft extends the property to handle region breaks.
adds the avoid-region and region keywords. css multi-column layout modulethe d...
break-before - CSS: Cascading Style Sheets
ement that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value). if any of the three concerned values is an avoid break value (avoid, avoid-page, avoid-region, or avoid-column), no such break will be applied at that point. once forced breaks have been applied, soft breaks may be
added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-before property is specified as one of the keyword values from the list below. values generic break values auto allows, but does not force, any break (page, column, or region) to be inserted right before the principal box. avoid avoids any break (page, column, or region) from being i...
...ng: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; break-before: column; } p { line-height: 1.5; } article { column-width: 200px; gap: 20px; } result specifications specification status comment css fragmentation module level 3the definition of 'break-before' in that specification. candidate recommendation
adds the recto and verso keywords. changes the media type of this property from paged to visual. defines the breaking algorithm with different kinds of breaks. css regions module level 1the definition of 'break-before' in that specification. working draft extends the property to handle region breaks.
adds the avoid-region and region keywords. css multi-column layout modulethe ...
break-inside - CSS: Cascading Style Sheets
lement that appears the latest in the flow is used. thus, the break-before value has precedence over the break-after value, which in turn has precedence over the break-inside value. if any of the three concerned values is an avoid break value (avoid, avoid-page, avoid-region, or avoid-column), no such break will be applied at that point. once forced breaks have been applied, soft breaks may be
added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-inside property is specified as one of the keyword values from the list below. values auto allows, but does not force, any break (page, column, or region) to be be inserted within the principal box. avoid avoids any break (page, column, or region) from being inserted within the princi...
... 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 prevent 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. ...
clamp() - CSS: Cascading Style Sheets
(most positive) expression value to which the value of the property will be assigned if the preferred value is greater than this upper bound. the expressions can be math functions (see calc() for more information), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <length>), or nested min() and max() functions. as math expressions, so you can use
addition, subtraction, multiplication and division without using the calc() function itself. you may also use parentheses to establish computation order when needed. you can use different units for each value in your expressions, and different units in any math function making up any of the arguments. notes math expressions involving percentages for widths and heights on table columns, table col...
...ntages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest max() and min() functions as expression values, in which case the inner ones are treated as simple parentheses. the expressions are full math expressions, so you can use direct
addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the
addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules. make sure to put a space on each side of the + and - operands. the operands in the expression may be any <length> syntax value. you can us...
color - CSS: Cascading Style Sheets
color: #ff0000; } p { color: rgb(255,0,0); } p { color: rgb(100%, 0%, 0%); } p { color: hsl(0, 100%, 50%); } /* 50% translucent */ p { color: #ff000080; } p { color: rgba(255, 0, 0, 0.5); } p { color: hsla(0, 100%, 50%, 0.5); } specifications specification status comment css color module level 4the definition of 'color' in that specification. working draft
adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them.
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 de...
...es in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them.
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. ...
Computed value - CSS: Cascading Style Sheets
nherit, initial, unset, and revert. 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. ...
...e 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. for example, if an element has specified values font-size: 16px and p
adding-top: 2em, then the computed value of p
adding-top is 32px (double the font size). however, for some properties (those where percentages are relative to something that may require layout to determine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values.
additionally, unitless numbers specified on the line-height property become the computed value, as specified. the relative ...
conic-gradient() - CSS: Cascading Style Sheets
starting point of the gradient or arc is north, or 12:00pm. the gradient is then rotated by the from angle. the colors of the gradient are determined by the angled color stops, their starting points, ending points, and, in between, and optional angled color-stop points. the transitions between colors can be altered with color hints between adjacent colors' color stops. customizing gradients by
adding more angled color-stop points on the gradient arc, you can create a highly customized transition between multiple colors. a color-stop's position can be explicitly defined by using an <angle>. if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the one that follows it. if you don't specify an angle for the first or last color stop, their...
...ge, yellow, green, blue); conic-gradient(red 0deg, orange 90deg, yellow 180deg, green 270deg, blue 360deg); by default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. you can move this color transition midpoint to any point between two color stops by
adding a color hint, indicating where the middle of the color transition should be. the following is solid red from the start to the 10% mark, transitions from red to blue over 80% of the turn, with the final 10% being solid blue. the midpoint of the red to blue gradient change, however, is at the 20% mark rather than the 50% mark as would have happened without the 80grad, or 20%, color hint. conic-...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
s true when working with grid layout. using display: grid will give you a block-level box, which creates a grid formatting context for the direct children. using display: inline-grid will create an inline-level box, which creates a grid formatting context for the children. the two-value syntax as you can see from the above explanation, the display property has gained considerable new powers. in
addition to indicating whether something is block-level or inline-level in relationship to other boxes on the page, it now also indicates the formatting context inside the box it is applied to. in order to better describe this behavior, the display property has been refactored to allow for two values — an outer and inner value — to be set on it, as well as the single values we are used to. this ...
...display: block flow-root therefore makes a lot of sense. you are creating a block formatting context, with a block-level box and children participating in normal flow. what about the matched pair display: inline flow-root? this is the new way of describing display: inline-block. the value display: inline-block has been around since the early days of css. the reason we tend to use it is to allow p
adding to push inline items away from an element, when creating navigation items for example, or when wanting to
add a background with p
adding to an inline element as in the example below. an element with display: inline-block however, will also contain floats. it contains everything inside the inline-level box. therefore display: inline-block does exactly what display: flow-root does, but with an...
<easing-function> - CSS: Cascading Style Sheets
instead, holding at both the 0% mark and the 100% mark, each for 1/n of the duration start is the equivalent of jump-start end is the equivalent of jump-end end is the default. steps( n, <direction> ) steps(2, jump-start) steps(2, start) steps(4, jump-end) steps(4, end) steps...
... animation: 1.5s infinite alternate; } @keyframes move-right { from { left: 10%; } to { left: 90%; } } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } javascript const selectelem = document.queryselector('select'); const startbtn = document.queryselector('button'); const divelem = document.queryselector('div > div'); startbtn.
addeventlistener('click', () => { if(startbtn.textcontent === 'start animation') { divelem.style.animationname = 'move-right'; startbtn.textcontent = 'stop animation'; divelem.style.animationtimingfunction = selectelem.value; } else { divelem.style.animationname = 'unset'; startbtn.textcontent = 'start animation'; } }); selectelem.
addeventlistener('change', () => { divele...
flex-basis - CSS: Cascading Style Sheets
roperty". 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 with relative lengths converted into absolute lengthsanimation typea length, percentage or calc(); formal syntax content | <'width'> examples setting flex item initial sizes html...
... <li class="flex flex1">1: flex-basis test</li> <li class="flex flex2">2: flex-basis test</li> <li class="flex flex3">3: flex-basis test</li> <li class="flex flex4">4: flex-basis test</li> <li class="flex flex5">5: flex-basis test</li> </ul> <ul class="container"> <li class="flex flex6">6: flex-basis test</li> </ul> css .container { font-family: arial, sans-serif; margin: 0; p
adding: 0; list-style-type: none; display: flex; flex-wrap: wrap; } .flex { background: #6ab6d8; p
adding: 10px; margin-bottom: 50px; border: 3px solid #2e86bb; color: white; font-size: 14px; text-align: center; position: relative; } .flex:after { position: absolute; z-index: 1; left: 0; top: 100%; margin-top: 10px; width: 100%; color: #333; font-size: 12px; } ...
flex - CSS: Cascading Style Sheets
to change this, set the item's min-width or mi...
...-container"> <div class="flex-item" id="flex">flex box (click to toggle raw box)</div> <div class="raw-item" id="raw">raw box</div> </div> css #flex-container { display: flex; flex-direction: row; } #flex-container > .flex-item { flex: auto; } #flex-container > .raw-item { width: 5rem; } var flex = document.getelementbyid("flex"); var raw = document.getelementbyid("raw"); flex.
addeventlistener("click", function() { raw.style.display = raw.style.display == "none" ? "block" : "none"; }); #flex-container { width: 100%; font-family: consolas, arial, sans-serif; } #flex-container > div { border: 1px solid #f00; p
adding: 1rem; } #flex-container > .raw-item { border: 1px solid #000; } result specifications specification status comment ...
float - CSS: Cascading Style Sheets
hen an element is floated, it is taken out of the normal flow of the document (though still remaining part of it). it is shifted to the left, or right, until it touches the edge of its containing box, or another floated element. in this example, there are three colored squares. two are floated left, and one is floated right. note that the second "left" square is placed to the right of the first.
additional squares would continue to stack to the right, until they filled the containing box, after which they would wrap to the next line. a floated element is at least as tall as it's tallest nested floated children. we gave the parent width: 100% and floated it to ensure it is tall enough to encompass it's floated children, and to make sure it takes up the width of the parent so we don't have to...
...es you may want to force an item to move below any floated elements. 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-weight - CSS: Cascading Style Sheets
low to work, you'll need a browser that supports the css fonts level 4 syntax in which font-weight can be any number between 1 and 1000. ...
... mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 fo...
font - CSS: Cascading Style Sheets
css level 1the definition of 'font' in that specification. recommendation initial definition. ...
...: " + cssfragment + "}"; document.body.appendchild(css); } setcss(); specifications specification status comment css fonts module level 3the definition of 'font' in that specification. candidate recommendation
added support for font-stretch values. css level 2 (revision 1)the definition of 'font-weight' in that specification. recommendation
added support for keywords. css level 1the definition of 'font' in that specification. recommendation initial definition. ...
image-orientation - CSS: Cascading Style Sheets
es */ image-orientation: inherit; image-orientation: initial; image-orientation: unset; /* obsolete values. obsolete since gecko 63 */ image-orientation: 90deg; /* rotate 90deg */ image-orientation: 90deg flip; /* rotate 90deg, and flip it horizontally */ image-orientation: flip; /* no rotation, only applies a horizontal flip */ syntax values none default initial value. will not apply any
additional image rotation; the image is oriented as encoded or as other css property values dictate. from-image the exif information contained in the image will be used to rotate the image appropriately. <angle> obsolete since gecko 63 the <angle> of rotation to apply to the image. it is rounded to the nearest 90deg (0.25turn). flip obsolete since gecko 63 the image is flipped horizontally (i...
... candidate recommendation initial definition. ...
justify-content - CSS: Cascading Style Sheets
baseline, self-start, self-end, start, end, l...
...ycontent = document.getelementbyid("justifycontent"); justifycontent.
addeventlistener("change", function (evt) { document.getelementbyid("container").style.justifycontent = evt.target.value; }); result specifications specification status comment css box alignment module level 3the definition of 'justify-content' in that specification. working draft
adds the [ first | last ]? baseline, self-start, self-end, start, end, left, right, unsafe | safe values. css flexible box layout modulethe definition of 'justify-content' in that specification. candidate recommendation initial definition ...
<length-percentage> - CSS: Cascading Style Sheets
ntation for <length> and <percentage> for details of the individual syntaxes allowed by this type. examples length-percentage examples the following simple example demonstrates several properties that use <length-percentage> values. ...
...idth: 20%; width: calc(100% - 200px); specifications specification status comment css values and units module level 4the definition of '<length-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<length-percentage>' in that specification. candidate recommendation defines <length-percentage>.
adds calc() ...
letter-spacing - CSS: Cascading Style Sheets
positive values of letter-spacing causes characters to spread farther apart, while negative values of letter-spacing bring characters closer together. 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. ...
...letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /* global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; values normal the normal letter spacing for the current font. unlike a value of 0, this keyword allows the user agent to alter the space between characters in order to justify text. <length> specifies extra inter-character space in
addition to the default space between characters. values may be negative, but there may be implementation-specific limits. user agents may not further increase or decrease the inter-character space in order to justify text. accessibility concerns a large positive or negative letter-spacing value will make the word(s) the styling is applied to unreadable. for text styled with a very large positive ...
list-style-type - CSS: Cascading Style Sheets
ecified string will be used as the item's marker. none no item marker is shown. disc a filled circle (default value) circle a hollow circle square a filled square decimal decimal numbers beginning with 1 cjk-decimal han decimal numbers e.g. 一, 二, 三, ..., 九八, 九九, 一〇〇 decimal-leading-zero decimal numbers p
added by initial zeros e.g. 01, 02, 03, … 98, 99 lower-roman lowercase roman numerals e.g. i, ii, iii, iv, v… upper-roman uppercase roman numerals e.g. i, ii, iii, iv, v… lower-greek lowercase classical greek alpha, beta, gamma… e.g. α, β, γ… lower-alpha lower-latin lowercase ascii letters e.g. a, b, c, … z lower-latin is unsup...
... -moz-ethiopic-halehame-ti-et example hangul -moz-hangul example example example hangul-consonant -moz-hangul-consonant example example example urdu -moz-urdu example accessibility concerns the voiceover screen reader has an issue where unordered lists with a list-style-type value of none applied to them will not be announced as a list. to
address this,
add a zero-width space as pseudo content before each list item to ensure the list is announced properly. this ensures the design is unaffected by the bug fix and that list items are not improperly described. ul { list-style: none; } ul li::before { content: "\200b"; } voiceover and list-style-type: none – unfettered thoughts mdn understanding wcag, guideline 1.3 explanatio...
mask-repeat - CSS: Cascading Style Sheets
pace is distributed evenly between the images. the mask-position property is ignored unless only one image can be displayed without clipping. the only case where clipping happens using space is when there isn't enough room to display one image. round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be
added. when the next image is
added, all of the current ones compress to allow room. example: an image with an original width of 260px, repeated three times, might stretch until each repetition is 300px wide, and then another image will be
added. they will then compress to 225px. no-repeat the image is not repeated (and hence the mask painting area will not necessarily be entirely cov...
...d"> </div> <select id="repetition"> <option value="repeat-x">repeat-x</option> <option value="repeat-y">repeat-y</option> <option value="repeat" selected>repeat</option> <option value="space">space</option> <option value="round">round</option> <option value="no-repeat">no-repeat</option> </select> javascript content var repetition = document.getelementbyid("repetition"); repetition.
addeventlistener("change", function (evt) { document.getelementbyid("masked").style.maskrepeat = evt.target.value; }); result multiple mask image support you can specify a different <repeat-style> for each mask image, separated by commas: .examplethree { mask-image: url('mask1.png'), url('mask2.png'); mask-repeat: repeat-x, repeat-y; } each image is matched with the corresponding repe...
mask-size - CSS: Cascading Style Sheets
ales the mask image to the specified length in the corresponding dimension. negative lengths are not allowed. <percentage> a <percentage> value scales the mask image in the corresponding dimension to the specified percentage of the mask positioning area, which is determined by the value of mask-origin. the mask positioning area is, by default, the area containing the content of the box and its p
adding; the area may also be changed to just the content or to the area containing borders, p
adding and content. negative percentages are not allowed. auto a keyword that scales the mask image in the corresponding directions in order to maintain its intrinsic proportion. contain a keyword that scales the image as large as possible and maintains image aspect ratio (image doesn't get squished). the...
... candidate recommendation initial definition ...
minmax() - CSS: Cascading Style Sheets
</div> <div> item with flexible width but a minimum of 200 pixels. </div> <div> inflexible item of 150 pixels width. </div> </div> result specifications specification status comment ...
... </div> <div> item with flexible width but a minimum of 200 pixels. </div> <div> inflexible item of 150 pixels width. </div> </div> result specifications specification status comment css grid layoutthe definition of 'minmax()' in that specifica...
offset-rotate - CSS: Cascading Style Sheets
the offset-rotate 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. ...
...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> if auto is followed by an <angle>, the computed 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. formal definition initial valueautoapplies totransformable elementsinheritednocomputed valueas specifiedanimation typeas <angle>, <basic-shape> or <path()> formal syntax [ auto | reverse ] | <angle> examples s...
paint() - CSS: Cascading Style Sheets
the paint() css function defines an <image> value generated with a paintworklet. syntax paint(workletname, parameters) where: workletname the name of the registered worklet. parameters optional
additional parameters to pass to the paintworklet examples you can pass
additional arguments via the css paint() function. in this example, we passed two arguments: whether the background-image on a group of list items is filled or just has a stroke outline, and the width of that outline: <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <...
...i> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> css.paintworklet.
addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); li { --boxcolor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowhighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxcolor: hsla(255, 90%, 60%, 1.0); background-imag...
place-content - CSS: Cascading Style Sheets
"safe">safe</option> <option value="unsafe">unsafe</option> </select><code>;</code> var update = function () { document.getelementbyid("container").style.placecontent = document.getelementbyid("aligncontentalignment").value + " " + document.getelementbyid("justifycontentalignment").value; } var aligncontentalignment = document.getelementbyid("aligncontentalignment"); aligncontentalignment.
addeventlistener("change", update); var justifycontentalignment = document.getelementbyid("justifycontentalignment"); justifycontentalignment.
addeventlistener("change", update); var writingm = document.getelementbyid("writingmode"); writingm.
addeventlistener("change", function (evt) { document.getelementbyid("container").style.writingmode = evt.target.value; }); var direction = document.getelem...
...; var justifycontentalignment = document.getelementbyid("justifycontentalignment"); justifycontentalignment.
addeventlistener("change", update); var writingm = document.getelementbyid("writingmode"); writingm.
addeventlistener("change", function (evt) { document.getelementbyid("container").style.writingmode = evt.target.value; }); var direction = document.getelementbyid("direction"); direction.
addeventlistener("change", function (evt) { document.getelementbyid("container").style.direction = evt.target.value; }); css #container { display: flex; height:240px; width: 240px; flex-wrap: wrap; background-color: #8c8c8c; writing-mode: horizontal-tb; /* can be changed in the live sample */ direction: ltr; /* can be changed in the live sample */ place-content: flex-end center...
pointer-events - CSS: Cascading Style Sheets
y (experimental for html). the element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. the values of the fill, stroke, and visibility 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 preventing 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 trigger...
...ough sequential keyboard navigation using the tab key. we would like to provide finer grained control (than just auto and none) in html for which parts of an element will cause it to "catch" pointer events, and when. to help us in deciding how pointer-events should be further extended for html, if you have any particular things that you would like to be able to do with this property, then please
add them to the use cases section of this wiki page (don't worry about keeping it tidy). formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | none | visiblepainted | visiblefill | visiblestroke | visible | painted | fill | stroke | all | inherit examples disabling pointer events on all images this example dis...
repeating-conic-gradient() - CSS: Cascading Style Sheets
nd-position. the gradient arc is part of the circumference of the gradient. 0 degress is north, or 12:00pm. the colors of the gradient are determined by the angled color stops, their starting points, ending points, and, in between, and optional angled color-stop points. the transitions between colors can be altered with color hints between adjacent colors' color stops. customizing gradients by
adding more angled color-stop points on the gradient arc, you can create a highly customized transition between multiple colors. a color-stop's position can be explicitly defined by using an <angle>. if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the one that follows it. like the non-repeating gradient counterpart, if you don't specify an ...
...low, green, blue 50%); repeating-conic-gradient(from -45deg, red 45deg, orange, yellow, green, blue 225deg) by default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. you can move this color transition midpoint to any point between two color stops by
adding a color hint, indicating where the middle of the color transition should be. if two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. while you can mix and match different angle units, don't. it makes css hard to read. accessibility concerns browsers do not provide any special information on backgro...
scroll-snap-type-x - CSS: Cascading Style Sheets
nap-type-x: initial; scroll-snap-type-x: unset; syntax values none when the visual viewport of this scroll container is scrolled horizontally, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled horizontally. that means it snaps on that point when the scroll action finished, if possible. ...
...at means it snaps on that point when the scroll action finished, if possible. if content is
added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled horizontally considering the user agent's scroll parameters. if content is
added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toscroll containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | mandatory | proximity specifications not part of any standard. ...
scroll-snap-type-y - CSS: Cascading Style Sheets
ll-snap-type-y: initial; scroll-snap-type-y: unset; syntax values none when the visual viewport of this scroll container is scrolled vertically, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled vertically. that means it snaps on that point when the scroll action finished, if possible. ...
...that means it snaps on that point when the scroll action finished, if possible. if content is
added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled vertically considering the user agent's scroll parameters. if content is
added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toscroll containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | mandatory | proximity specifications not part of any standard. ...
scroll-snap-type - CSS: Cascading Style Sheets
ps to snap positions in its inline axis only. both the scroll container snaps to snap positions in both of its axes independently (potentially snapping to different elements in each axis). mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled. that means it snaps on that point when the scroll action finished, if possible. ...
... scrolled. that means it snaps on that point when the scroll action finished, if possible. if content is
added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on that snap point. proximity the visual viewport of this scroll container may come to rest on a snap point if it isn't currently scrolled considering the user agent's scroll parameters. if content is
added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | [ x | y | block | inline | both ] [ mandatory | proximity ]? examples snapping in different axes html <div class="holster"> <div class="container...
text-decoration - CSS: Cascading Style Sheets
css level 2 (revision 1)the definition of 'tex...
... css level 2 (revision 1)the definition of 'text-decoration' in that specification. recommendation no significant changes. ...
text-justify - CSS: Cascading Style Sheets
turn justification on and off for some reason. auto the browser chooses the best type of justification for the current situation based on a balance between performance and quality, but also on what is most appropriate for the language of the text (e.g., english, cjk languages, etc.). this is the default justification used if text-justify is not set at all. inter-word the text is justified by
adding space between words (effectively varying word-spacing), which is most appropriate for languages that separate words using spaces, like english or korean. inter-character the text is justified by
adding space between characters (effectively varying letter-spacing), which is most appropriate for languages like japanese. distribute exhibits the same behaviour as inter-character; this value ...
...feugiat leo. cras eu elementum dui.</p> <p class="char"><code>text-justify: inter-character</code> —<br>lorem ipsum dolor sit amet, consectetur adipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. ...
text-overflow - CSS: Cascading Style Sheets
t the width of the line box. values lower than 0 are clipped to 0. values greater than the width of the line box are clipped to the width of the line box. ...
...text-overflow: ',' clip ,3456 1234567890 ,4321 1234567890 text-overflow: ',' ellipsis ,34… 1234567890 ,43… 1234567890 text-overflow: ',' '.' ,34. 1234567890 ,43. 1234567890 specifications specification status comment css overflow module level 4
added the values <string> and fade and the fade() function css overflow module level 3the definition of 'text-overflow' in that specification. working draft initial definition a previous version of this interface reached the candidate recommendation status. as some not-listed-at-risk features needed to be removed, the spec was demoted to the working draft level, explaining why b...
touch-action - CSS: Cascading Style Sheets
zooming gestures. none disable browser handling of all panning and zooming gestures. pan-x enable single-finger horizontal panning gestures. may be combined with pan-y, pan-up, pan-down and/or pinch-zoom. pan-y enable single-finger vertical panning gestures. may be combined with pan-x, pan-left, pan-right and/or pinch-zoom. manipulation enable panning and pinch zoom gestures, but disable
additional non-standard gestures such as double-tap to zoom. disabling 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 dir...
...cendants) that provides its own dragging and zooming behavior – such as a map or game surface. html <div id="map"></div> css #map { height: 400px; width: 400px; background: blue; touch-action: none; } result specifications specification status comment compatibility standardthe definition of 'touch-action' in that specification. living standard
added pinch-zoom property value. pointer events – level 3the definition of 'touch-action' in that specification. editor's draft
added pan-left, pan-right, pan-up, pan-down property values. pointer events – level 2the definition of 'touch-action' in that specification. recommendation latest recommendation. pointer eventsthe definition of 'touch-action' in tha...
unicode-bidi - CSS: Cascading Style Sheets
nition (dtd) designers. web designers and similar authors should not override it. /* keyword values */ unicode-bidi: normal; unicode-bidi: embed; unicode-bidi: isolate; unicode-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /* global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; syntax values normal the element does not offer an
additional level of embedding with respect to the bidirectional algorithm. for inline elements, implicit reordering works across element boundaries. embed if the element is inline, this value opens an
additional level of embedding with respect to the bidirectional algorithm. the direction of this embedding level is given by the direction property. bidi-override for inline elements this creates an...
... css level 2 (revision 1)the definition of 'unicode-bidi' in that specification. recommendation initial definition. ...
white-space - CSS: Cascading Style Sheets
et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ...
...ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate veli...
CSS: Cascading Style Sheets
ntial 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 previous 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 like, and how you can start using it to
add styling to html. css building blocks this module carries on where css first steps left off — now you've gained familiarity with the language and its syntax, and got some basic exp...
... box model and margin collapse the containing block stacking and block-formatting contexts initial, computed, used, and actual values css shorthand properties css flexible box layout css grid layout media queries animation cookbook the css layout cookbook aims to bring together recipes for common layout patterns, things you might need to implement in your sites. in
addition to providing code you can use as a starting point in your projects, these recipes highlight the different ways layout specifications can be used, and the choices you can make as a developer. tools for css development you can use the w3c css validation service to check if your css is valid. this is an invaluable debugging tool. firefox developer tools lets you view and edit a page's live...
Ajax - Developer guides
is to facilitate the sharing of data across different systems, particularly systems connected via the internet. parsing and serializing xml how to parse an xml document from a string, a file or via javascript and how to serialize xml documents to strings, javascript object trees (jxon) or files. xpath xpath stands for xml path language, it uses a non-xml syntax that provides a flexible way of
addressing (pointing to) different parts of an xml document. as well as this, it can also be used to test
addressed nodes within a document to determine whether they match a pattern or not. filereader api the filereader api lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using file or blob objects to specify the file or data to re...
...a buffers) stored on the user's computer, using file or blob objects to specify the file or data to read. file objects may be obtained from a filelist object returned as a result of a user selecting files using the <input> element, from a drag and drop operation's datatransfer object, or from the mozgetasfile() api on an htmlcanvaselement. html in xmlhttprequest the xmlhttprequest specification
adds html parsing support to xmlhttprequest, which originally supported only xml parsing. this feature allows web apps to obtain an html resource as a parsed dom using xmlhttprequest. view all... tools axios promise based http client, which uses xmlhttprequest internally. see also ajax: a new approach to web applications jesse james garrett, of adaptive path, wrote this article in febr...
Mouse gesture events - Developer guides
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. gecko 1.9.1
added support for several mozilla-specific dom events used to handle mouse gestures. these are special 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 wi...
...are about the end results of the rotate gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozrotategesturestart and mozrotategestureupdate events. the delta value is the cumulative change over the course of handling the entire sequence of rotate gesture events. event fields mouse gesture events have
additional fields providing information about the gesture. these are: direction the direction in which the swipe moved. delta the amount by which the gesture moved; for rotation, this value is in degrees. positive values are clockwise and negative values are counterclockwise. for magnification, this value is implementation-specific, but the value is positive for zooming in and negati...
Touch events (Mozilla experimental) - Developer guides
s removed in gecko 18.0 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15), when support for the standard touch events was implemented. the experimental touch events api described on this page was available from gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) to gecko/firefox 17. you should instead use the standard touch events api, supported since gecko/firefox 6 with multi-touch support
added in gecko/firefox 12. this api allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. although touch events were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time. event fields touch events were based upo...
...ser's finger on a touch screen, monitoring the raw touch events generated by the system. although touch events were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time. event fields touch events were based upon mouseevent, and thereby shared all mouse event fields. they included one
additional field. streamid a unique integer identifying the finger generating the event. when the moztouchdown event is built, a unique value is assigned to that finger. corresponding moztouchmove and moztouchup events for that finger will have the same streamid value. this lets you track each finger's movements on the touch screen independently. the stream id is unique until the mozto...
Using device orientation with 3D transforms - Developer guides
e screen coordinate system is inverted, such that translatey(100px) moves an element 100px down, so the rotatey value should be -gamma finally, the order of the three different rotations is very important to accurately convert an orientation to a 3d rotation: rotatez, then rotatex and then rotatey. here's a simple code snippet to sum it up: var elem = document.getelementbyid("view3d"); window.
addeventlistener("deviceorientation", 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. this is a...
...atez(" + ( 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. ...
Event developer guide - Developer guides
rything you need to know about events will go under here. docs creating and triggering eventsthis article demonstrates how to create and dispatch dom events. such events are commonly called synthetic events, as opposed to the events fired by the browser itself.dom on-event handlersthe web platform provides several ways to get notified of dom events. two common styles are: the generalized
addeventlistener() and a set of specific on-event handlers.media eventsvarious events are sent when handling media that are embedded in html documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.mouse gesture eventsgecko 1.9.1
added support for several mozilla-specific dom events used to handle mouse gestures. these are specia...
... ...
HTML5 - Developer guides
stent storage (aka dom storage) client-side session and persistent storage allows web applications to store structured data on the client side. indexeddb indexeddb is a web standard for the storage of significant amounts of structured data in the browser and for high performance searches on this data using indexes. using files from web applications support for the new html5 file api has been
added to gecko, making it possible for web applications to access local files selected by the user. this includes support for selecting multiple files using the <input> of type file html element's new multiple attribute. there also is filereader. multimedia using html5 audio and video the <audio> and <video> elements embed and allow the manipulation of new multimedia content. webrtc this tech...
...are supported via the border-radius property. animating your style using css transitions to animate between different states or using css animations to animate parts of the page without a triggering event, you can now control mobile elements on your page. typography improvement authors have better control to reach better typography. they can control text-overflow and hyphenation, but also can
add a shadow to it or control more precisely its decorations. custom typefaces can be downloaded and applied thanks to the new @font-face at-rule. new presentational layouts in order to improve the flexibility of designs, two new layouts have been
added: the css multi-column layouts and css flexible box layout. ...
A hybrid approach - Developer guides
ve a single url for each piece of content, so that the content can adapt its layout to the user’s browser. this is generally thought to be a good thing. instead of maintaining two completely different sites, we simply redirect users to pages for the content they care about. and since the design is responsive, you know that each page looks as good as possible on the user’s screen. we can also
address some of the performance problems with responsive design by incorporating server-side techniques. for example, an often-criticized point about responsive web design is that full-resolution images are sent to all devices, including phones that show the images scaled down anyway. one such technique for dealing with this issue uses server-side user-agent detection along with the wurfl device capa...
...out, not as a retrofit. similarly, because it uses user-agent detection, you will have to update your detection rules as time goes on. when it is right to choose this option combining server-side and client-side techniques is something that is always worth considering; there are so many options that one must just weigh the pros and cons of each individual technique employed. in many cases, the
added complexity of the hybrid approach is not even necessary. for example, you may not even need to adjust your content based on what actual device a user is using — just knowing whether a feature is present on their browser is often good enough. this is something you might be able to discern on the client-side using javascript feature detection from modernizr or detect it. it can’t hurt to dig...
Separate sites for mobile and desktop - Developer guides
-agent detection to route users on phones to a separate mobile site, typically at m.example.com. in a nutshell, this technique uses server-side logic to solve all three goals of mobile web development at once — if the user’s browser looks like it’s on a phone, you serve them mobile content, formatted for their phone and optimized for speed. conceptually simple, this is the easiest option to
add to an existing site, especially if you are using a cms or web application that supports templates. since only the mobile-specific content, styles, and scripts are sent to mobile users, this method also provides for the best performance out of any of the other options presented here. finally, it also allows for completely different user experiences on desktop and mobile — they’re two different...
...ced to use this approach is if you cannot, for whatever reason, modify your existing desktop site, and need to have a 100% separate mobile site. though it’s not ideal, at least you have this option. examples most of the major web applications you see in the wild have chosen this path, including facebook, youtube, digg, and flickr. in fact, mozilla picked this strategy for the mobile versions of
addons.mozilla.org (amo) and support.mozilla.org (sumo). if you’d like to see the source code behind an example of this approach in action, feel free to check out the github repository for amo or sumo. approaches to mobile web development see the following articles for background and other approaches to developing for mobile platforms. what is mobile-friendliness? responsive design a hybrid ...
Printing - Developer guides
r a better result. you want to adjust the user experience of printing, such as presenting a specially-formatted version of your content before printing begins. there may be other cases in which you want to manage the printing process, but these are some of the most common scenarios. this article provides tips and techniques for helping your web content print better. using a print style sheet
add the following to your <head> tag. <link href="/path/to/print.css" media="print" rel="stylesheet" /> using media queries to improve layout detecting print requests some browsers (including firefox 6 and later and internet explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. you can use this to adjust the user interface presented during pri...
...internet explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. you can use this to adjust the user interface presented during printing (such as by displaying or hiding user interface elements during the print process). note: you can also use window.onbeforeprint and window.onafterprint to assign handlers for these events, but using eventtarget.
addeventlistener() is preferred. examples here are some common examples. open and automatically close a popup window when finished if you want to be able to automatically close a popup window (for example, the printer-friendly version of a document) after the user prints its contents, you can use code like this: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; ...
The Web Open Font Format (WOFF) - Developer guides
woff (the web open font format) is a web font format developed by mozilla in concert with type supply, letterror, and other organizations. it uses a compressed version of the same table-based sfnt structure used by truetype, opentype, and open font format, but
adds metadata and private-use data structures, including predefined fields allowing foundries and vendors to provide license information if desired. there are three main benefits to using woff: the font data is compressed, so sites using woff will use less bandwidth and will load faster than if they used equivalent uncompressed truetype or opentype files. many font vendors that are unwilling to license their truetype or opentype format fonts for use on the web will license woff format fonts. this improves availability of fo...
...and woff2, they mostly differ in regard to the compression algorithm used. in @font-face they are identified by the 'woff' and respectively 'woff2' format descriptor. using woff you can use the @font-face css property to use woff fonts for text in web content. it works exactly like opentype and truetype format fonts do, except it will likely let your content download more efficiently due to the
addition of compression. tools for working with woff fonts tools for working with woff fonts are available. sfnt2woff and woff2sfnt convert between woff and opentype. specifications specification status comment woff file format 2.0 recommendation new compression algorithm woff file format 1.0 recommendation initial specification. ...
disabled - HTML: Hypertext Markup Language
ce between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a disabled field cannot have it's value changed, required does not have any effect on inputs with the disabled attribute also specified.
additionally, since the elements become immutable, most other attributes, such as pattern, have no effect, until the control is enabled. note: the required attribute is not permitted on inputs with the disabled attribute specified. usability browsers display disabled form controls greyed as disabled form controls are immutable, won't receive focus or any browsing events, like mouse clicks or foc...
...controls are disabled, many browsers will display them in a lighter, greyed-out color by default. here are examples of a disabled checkbox, radio button, <option> and <optgroup>, as well as some form controls that are disabled via the disabled attribute set on the ancestor <fieldset> element. the <option>s are disabled, but the <select> itself is not. we could have disable the entire <select> by
adding the attribute to that element rather than it's descendants. <fieldset> <legend>checkboxes</legend> <p><label> <input type="checkbox" name="chbox" value="regular"> regular </label></p> <p><label> <input type="checkbox" name="chbox" value="disabled" disabled> disabled </label></p> </fieldset> <fieldset> <legend>radio buttons</legend> <p><label> <input type="radio" na...
HTML attribute reference - HTML: Hypertext Markup Language
action <form> the uri of a program that processes the information submitted via the form. ...
...e the elements or adjust their behavior in various ways to meet the criteria the users want. attribute list attribute name elements description accept <form>, <input> list of types the server accepts, typically a file type. accept-charset <form> list of supported charsets. accesskey global attribute keyboard shortcut to activate or
add focus to the element. action <form> the uri of a program that processes the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> specifies the horizontal alignment of the element. allow <iframe> specifies a feature-policy for the iframe. a...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
hen trying to download the image data. starting the download the code that starts the download (say, when the user clicks a "download" button), looks like this: function startdownload() { let imageurl = "https://cdn.glitch.com/4c9ebeb9-8b9a-4adc-ad0a-238d9ae00bb5%2fmdn_logo-only_color.svg?1535749917189"; downloadedimg = new image; downloadedimg.crossorigin = "anonymous"; downloadedimg.
addeventlistener("load", imagereceived, false); downloadedimg.src = imageurl; } we're using a hard-coded url here (imageurl), but that could easily come from anywhere. to begin downloading the image, we create a new htmlimageelement object by using the image() constructor. the image is then configured to allow cross-origin downloading by setting its crossorigin attribute to "anonymous" (that is, a...
...e using a hard-coded url here (imageurl), but that could easily come from anywhere. to begin downloading the image, we create a new htmlimageelement object by using the image() constructor. the image is then configured to allow cross-origin downloading by setting its crossorigin attribute to "anonymous" (that is, allow non-authenticated downloading of the image cross-origin). an event listener is
added for the load event being fired on the image element, which means the image data has been received. finally, the image's src attribute is set to the url of the image to download; this triggers the download to begin. receiving and saving the image the code that handles the newly-downloaded image is found in the imagereceived() method: function imagereceived() { let canvas = document.createe...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
mbers, such as arabic, but is also relevant in english. default styling the purpose of this element is purely for the convenience of the author and all browsers display it inline (display: inline) by default, though its default styling varies from one browser to another: some browsers, like internet explorer, do not style it differently than a <span> element. opera, firefox, and some others
add a dotted underline to the content of the element. a few browsers not only
add a dotted underline, but also put it in small caps; to avoid this styling,
adding something like font-variant: none in the css takes care of this case. examples marking up an abbreviation semantically to mark up an abbreviation without providing an expansion or description, simply use <abbr> without any attributes, ...
... <abbr> without any attributes, as seen in this example. html <p>using <abbr>html</abbr> is fun and easy!</p> result styling abbreviations you can use css to set a custom style to be used for abbreviations, as seen in this simple example. html <p>using <abbr>css</abbr>, you can style your abbreviations!</p> css abbr { font-variant: all-small-caps; } result providing an expansion
adding a title attribute lets you provide an expansion or definition for the abbreviation or acronym. html <p>ashok's joke made me <abbr title="laugh out loud">lol</abbr> big time.</p> result defining an abbreviation you can use <abbr> in tandem with <dfn> to more formally define an abbreviation, as shown here. html <p><dfn id="html"><abbr title="hypertext markup language">html</abbr> </dfn>...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
ify the various <param> elements passed to the java applet. datasrc like datafld, this attribute is used for data binding under internet explorer 4. it indicates the id of the data source object that supplies the data that is bound to the <param> elements associated with the applet. height this attribute specifies the height, in pixels, that the applet needs. hspace this attribute specifies
additional horizontal space, in pixels, to be reserved on either side of the applet. mayscript in the netscape implementation, this attribute allows access to an applet by programs in a scripting language embedded in the document. name this attribute assigns a name to the applet so that it can be identified by other resources; particularly scripts. object this attribute specifies the url of a s...
...name to the applet so that it can be identified by other resources; particularly scripts. object this attribute specifies the url of a serialized representation of an applet. src as defined for internet explorer 4 and higher, this attribute specifies a url for an associated file for the applet. the meaning and use is unclear and not part of the html standard. vspace this attribute specifies
additional vertical space, in pixels, to be reserved above and below the applet. width this attribute specifies in pixels the width that the applet needs. example html <applet code="game.class" align="left" archive="game.zip" height="250" width="350"> <param name="difficulty" value="easy"> <b>sorry, you need java to play this game.</b> </applet> specifications specification ...
<article>: The Article Contents element - HTML: Hypertext Markup Language
rticle> element, possibly with one or more <section>s within. content categories flow content, sectioning content, palpable content permitted content flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. note that an <article> element must not be a descendant of an <
address> element. implicit aria role article permitted aria roles application, document, feed, main, none, presentation, region dom interface htmlelement attributes this element only includes the global attributes. usage notes each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element. ...
...entified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element. when an <article> element is nested, the inner element represents an article related to the outer element. for example, the comments of a blog post can be <article> elements nested in the <article> representing the 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">...
<body>: The Document Body element - HTML: Hypertext Markup Language
t. onbeforeunload function to call when the document is about to be unloaded. onblur function to call when the document loses focus. onerror function to call when the document fails to load properly. onfocus function to call when the document receives focus. onhashchange function to call when the fragment identifier part (starting with the hash ('#') character) of the document's current
address has changed. onlanguagechange function to call when the preferred languages changed. onload function to call when the document has finished loading. onmessage function to call when the document has received a message. onoffline function to call when network communication has failed. ononline function to call when network communication has been restored. onpopstate function to ca...
... html living standardthe definition of '<body>' in that specification. living standard changed the list of non-conforming features. html5the definition of '<body>' in that specification. recommendation obsoleted the formerly deprecated attributes. defined the behavior of the non-conforming and never standardized topmargin, leftmargin, rightmargin and bottommargin.
added the on* attributes. html 4.01 specificationthe definition of '<body>' in that specification. recommendation deprecated the alink, background, bgcolor, link, text and vlink attributes. ...
<br>: The Line Break 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. as you can see from the above example, a <br> element is included at each point where we want the text to break. the text after the <br> begins again at the start of the next line of the text block. ...
...and there is very little you can do to style it. you can set a margin on <br> elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice — you should use the line-height property that was designed for that purpose. examples simple br in the following example we use <br> elements to create line breaks between the different lines of a postal
address: mozilla<br> 331 e. evelyn avenue<br> mountain view, ca<br> 94041<br> usa<br> the result looks like so: accessibility concerns creating separate paragraphs of text using <br> is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. screen readers may announce the presence of the element, but not any content contained within <br>s. t...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
> </menu> <output aria-live="polite"></output> javascript var updatebutton = document.getelementbyid('updatedetails'); var favdialog = document.getelementbyid('favdialog'); var outputbox = document.queryselector('output'); var selectel = document.queryselector('select'); var confirmbtn = document.getelementbyid('confirmbtn'); // "update details" button opens the <dialog> modally updatebutton.
addeventlistener('click', function onopen() { if (typeof favdialog.showmodal === "function") { favdialog.showmodal(); } else { alert("the <dialog> api is not supported by this browser"); } }); // "favorite animal" input sets the value of the submit button selectel.
addeventlistener('change', function onselect(e) { confirmbtn.value = selectel.value; }); // "confirm" button of form trigg...
... living standard html 5.2the definition of '<dialog>' in that specification. recommend...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
> to determine what its embedded content is. this context shift can be confusing and time-consuming, especially for pages with multiple <iframe>s and/or if embeds contain interactive content like video or audio. specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. ...
...mmendation
added the referrerpolicy attribute. html living standardthe definition of '<iframe>' in that specification. living standard html5the definition of '<iframe>' in that specification. recommendation html 4.01 specificationthe definition of '<iframe>' in that specification. recommendation screen orientation api working draft
adds allow-orientation-lock to the sandbox attribute. ...
<input type="reset"> - HTML: Hypertext Markup Language
still, a <button> element. a simple reset button we'll begin by creating a simple reset button: <form> <div> <label for="example">type in some sample text</label> <input id="example" type="text"> </div> <div> <input type="reset" value="reset the form"> </div> </form> this renders like so: try entering some text into the text field, and then pressing the reset button.
adding a reset keyboard shortcut to
add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute. in this example, r is specified as the access key (you'll need to press r plus the particular modifier keys for your browser/os combination; see accesskey for a useful list of those). <form> <div> <label for...
...e above example is that there's no way for the user to know what the access key is! this is especially true since the modifiers are typically non-standard to avoid conflicts. when building a site, be sure to provide this information in a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are).
adding a tooltip to the button (using the title attribute) can also help, although it's not a complete solution for accessibility purposes. disabling and enabling a reset button to disable a reset button, simply specify the disabled global attribute on it, like so: <input type="reset" value="disabled" disabled> you can enable and disable buttons at run time by simply setting disabled to true or...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
he table of contents like this: <a name="z0" href="#z4">first section name</a> and the section header would be marked like this: <h2><a name="z4">first section name</a></h2>. this continues for the next three sections, z5, z6, and z7 (and table of contents entries named z1, z2, and z3), each automatically given anchors with these names. the user then saves and closes the document. next would then
add, within the header of the html document, a special tag, <nextid n="z8">, to inform where to continue its naming convention. imagine the web author opens the document for further editing. they want to
add a couple new sections after the second section, appending four more sections at the end. when opening the document, the next editor finds and reads this <nextid n="z8"> tag, and now knows to give...
..... whatever ... </p> <h2><a name="z17">eighth section heading</a></h1><p> ... whatever ... </p> <h2><a name="z18">ninth section heading</a></h1><p> ... whatever ... </p> <h2><a name="z19">tenth section heading</a></h1><p> ... whatever ... </p> </body> </html> they then forward a copy of this document to someone with a next editor, and they delete sections z7 and z19,
add ten more, z20 through z29, and then delete paragraphs z24 and z29. so then the nextid value is z30 when it's returned modified: <html> <head> <title> ... whatever ... </title> <link, meta, base, etc. as applicable for the head of this document> <nextid n="z30"> </head> <body> <a name="z0" href="#z4">first section heading</a> <a name="z1" href=...
<slot> - HTML: Hypertext Markup Language
he global attributes. name the slot's name. a named slot is a <slot> element with a name attribute. ...
... specifications specification status comments html living standardthe definition of '<slot>' in that specification. living standard domthe definition of 'slots' in that specification. living standard ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
lder browsers actually underline <strong>). each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the css font-weight property. the intended meaning or purpose of the enclosed text should be what determines which element you use. communicating meaning is what semantics are all about. <em> vs. <strong>
adding to the confusion is the fact that while html 4 defined <strong> as simply indicating a stronger emphasis, html 5 defines <strong> as representing "strong importance for its contents." this is an important distinction to make. while <em> is used to change the meaning of a sentence as spoken emphasis does ("i love carrots" vs. "i love carrots"), <strong> is used to give portions of a sentence a...
... living standard html5the definition of '<strong>' in that specification. recommendation html 4.01 specificationthe definition of '<strong>' in that specification. ...
<style>: The Style Information element - HTML: Hypertext Markup Language
</style> </head> <body> <p>this is my paragraph.</p> </body> </html> multiple style elements in this example we've included two <style> elements — notice how the conflicting declarations in the later <style> element override those in the earlier one, if they have equal specificity. ...
...olor: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> including a media query in this example we build on the previous one, including a media attribute on the second <style> element so it is only applied when the viewport is less than 500px in width. <!doctype html> <html> <head> <style> p { color: white; background-color: blue; p
adding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> technical summary content categories metadata content, and if the scoped attribute is present: flow content. permitted content text...
<template>: The Content Template element - HTML: Hypertext Markup Language
} the result is the original html table, with two new rows appended to it via javascript: table { background: #000; } table td { background: #fff; } avoiding documentfragment pitfall a documentfragment is not a valid target for various events, as such it is often preferable to clone or refer to the element...
...s within it. consider the following html and javascript: html <div id="container"></div> <template id="template"> <div>click me</div> </template> javascript const container = document.getelementbyid("container"); const template = document.getelementbyid("template"); function clickhandler(event) { alert("clicked a div"); } const firstclone = template.content.clonenode(true); firstclone.
addeventlistener("click", clickhandler); container.appendchild(firstclone); const secondclone = template.content.firstelementchild.clonenode(true); secondclone.
addeventlistener("click", clickhandler); container.appendchild(secondclone); result firstclone is a documentfragment instance, so while it gets appended inside the container as expected, clicking on it does not trigger the click event. seco...
title - HTML: Hypertext Markup Language
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. some typical uses: labeling <iframe> elements for assistive technology providing a programmatically associated label for an <input> element as a fallback for a real <label> labeling controls in data tables
additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. multiline titles the title attribute may contain several lines. each u+000a line feed (lf) character represents a line break. some caution must be taken, as this means the following renders across two lines: html <p>newlines in <code>title</code> should be taken into account, like <a...
...if a tooltip effect is desired, it is better to use a more accessible technique that can be accessed with the above browsing methods. 3.2.5.1. the title attribute | w3c html 5.2: 3. semantics, structure, and apis of html documents using the html title attribute – updated | the paciello group tooltips & toggletips - inclusive...
Inline elements - HTML: Hypertext Markup Language
and end of the inline element's influence.</div> in this example, the <div> block-level element contains some text. within that text is a <span> element, which is an inline element. ...
... changing element levels you can change the visual presentation of an el...
HTTP authentication - HTTP
thentication 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 .htpasswd file. the .htaccess file typically looks like this: authtype basic authname "access to the staging site" authuserfile /path/to/.
...rences 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 prevent access to .ht* files). al
addin:$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 file containing the encrypted user...
Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz' - HTTP
is error can also occur if the response includes more than one access-control-allow-origin header. if the service your code is accessing using a cors request is under your control, make sure that it's configured to include your origin in its access-control-allow-origin header, and that only one such header is included in responses. the header itself accepts a comma-delineated list of origins, so
adding a new origin is not difficult. for example, in apache,
add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, <files>, or <virtualhost> section). the configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. header set access-control-allow-origin 'origin-list' fo...
... in apache,
add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, <files>, or <virtualhost> section). the configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. ...
Compression in HTTP - HTTP
ssible with the required quality. there are numerous tools that are specialized for this. lossy compression algorithms are usually more efficient than loss-less ones. as compression works better on a specific kind of files, it usually provides nothing to compress them a second time. in fact, this is often counter productive as the cost of the overhead (algorithms usually need a dictionary that
add to the initial size) can be higher than the extra gain in compression resulting in a larger file. do not use the two following techniques for files in a compressed format. end-to-end compression for compression, end-to-end compression is where the largest performance improvements of web sites reside. end-to-end compression refers to a compression of the body of a message that is done by the se...
...e server and will last unchanged until it reaches the client. whatever the intermediate nodes are, they leave the body untouched. all modern browsers and servers do support it and the only thing to negotiate is the compression algorithm to use. these algorithm are optimized for text. in the 1990s, compression technology was advancing at a rapid pace and numerous successive algorithms have been
added to the set of possible choices. nowadays, only two are relevant: gzip, the most common one, and br the new challenger. to select the algorithm to use, browsers and servers use proactive content negotiation. the browser sends an accept-encoding header with the algorithm it supports and its order of precedence, the server picks one, uses it to compress the body of the response and uses the conte...
HTTP conditional requests - HTTP
d to two different versions of the resource, and the final document will be corrupted. to prevent 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 performance, and http has a specific header to avoid this scenario: if-range: this solution is more efficient, but slightly less flexible, as only one etag can be used in the condition. rarely is such
additional flexibility needed. avoiding the lost update problem with optimistic locking a common operation i...
... 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 previous. like any update of a resource, it is subject to a race condition if two clients try to perform at the similar times. to prevent 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 unsure if the server will be compliant, you need first to issue a head request to the resource to check this. conclusion conditional requests are a key feature of http, and allow...
Configuring servers for Ogg media - HTTP
ld be served with the video/ogg mime type. *.oga and *.ogg files containing only audio should be served with the audio/ogg mime type. if you don't know whether the ogg file contains audio or video, you can serve it with the mime type application/ogg, and the browser will treat it as a video file. most servers don't by default serve ogg media with the correct mime types, so you'll likely need to
add the appropriate configuration for this. for apache, you can
add the following to your configuration:
addtype audio/ogg .oga
addtype video/ogg .ogv
addtype application/ogg .ogg you can find specific information about possible media file types and the codecs used within them in our comprehensive guide to media types and formats on the web. in particular, the article on media container formats w...
...ia types and formats on the web. in particular, the article on media container formats will be especially helpful when configuring serers to host media properly. handle http 1.1 byte range requests correctly in order to support seeking and playing back regions of the media that aren't yet downloaded, gecko uses http 1.1 byte-range requests to retrieve the media from the seek target position. in
addition, gecko uses byte-range requests to seek to the end of the media (assuming you serve the content-length header) in order to determine the duration of the media. your server should accept the accept-ranges: bytes http header if it can accept byte-range requests. it must return 206: partial content to all byte range requests; otherwise, browsers can't be sure you actually support byte range re...
Connection management in HTTP/1.x - HTTP
proving this earlier model inefficient. two newer models were created in http/1.1. the persistent-connection model keeps connections opened between successive requests, reducing the time needed to open new connections. the http pipelining model goes one step further, by sending several successive requests without even waiting for an answer, reducing much of the latency in the network. http/2
adds
additional models for connection management. it's important point to note that connection management in http applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. the model used in connections between a client and its first proxy may differ from the model between a proxy and the destination server (or any intermediate proxies). the http headers involv...
..., dos attacks can be conducted. in such cases, using non-persistent connections, which are closed as soon as they are idle, can provide better performance. http/1.0 connections are not persistent by default. setting connection to anything other than close, usually retry-after, will make them persistent. in http/1.1, persistence is the default, and the header is no longer needed (but it is often
added as a defensive measure against cases requiring a fallback to http/1.0). http pipelining http pipelining is not activated by default in modern browsers: buggy proxies are still common and these lead to strange and erratic behaviors that web developers cannot foresee and diagnose easily. pipelining is complex to implement correctly: the size of the resource being transferred, the effective...
Accept-Language - HTTP
eir user interface. if the server cannot serve any matching language, it can theoretically send back a 406 (not acceptable) error code. but, for a better user experience, this is rarely done and more common way is to ignore the accept-language header in this case. header type request header forbidden header name no cors-safelisted request header yes, with the
additional restriction that values can only be 0-9, a-z, a-z, space or *,-.;=. syntax accept-language: <language> accept-language: * // multiple types, weighted with the quality value syntax: accept-language: fr-ch, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 directives <language> a language tag (which is sometimes referred to as a "locale identifier"). this consists of a 2-3 letter base la...
...ace or *,-.;=. syntax accept-language: <language> accept-language: * // multiple types, weighted with the quality value syntax: accept-language: fr-ch, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 directives <language> a language tag (which is sometimes referred to as a "locale identifier"). this consists of a 2-3 letter base language tag representing the language, optionally followed by
additional subtags separated by '-'. the most common extra information is the country or region variant (like 'en-us' or 'fr-ca') or the type of alphabet to use (like 'sr-latn'). other variants like the type of orthography ('de-de-1996') are usually not used in the context of this header. * any language; '*' is used as a wildcard. ;q= (q-factor weighting) any value placed in an order of prefere...
CSP: form-action - HTTP
2 directive type navigation directive default-src fallback no. not setting this allows anything. syntax one or more sources can be set for the form-action policy: content-security-policy: form-action <source>; content-security-policy: form-action <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...ine' are ignored. see script-src for an example. 'report-sample' requires a sample of the violating code to be included in the violation report. examples meta tag configuration <meta http-equiv="content-security-policy" content="form-action 'none'"> apache configuration <ifmodule mod_headers.c> header set content-security-policy "form-action 'none'; </ifmodule> nginx configuration
add_header content-security-policy "form-action 'none';" violation case using a <form> element with an action set to inline javascript will result in a csp violation. <meta http-equiv="content-security-policy" content="form-action 'none'"> <form action="javascript:alert('foo')" id="form1" method="post"> <input type="text" name="fieldname" value="fieldvalue"> <input type="submit" id="submit" v...
CSP: script-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the script-src policy: content-security-policy: script-src <source>; content-security-policy: script-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
...included in the violation report. examples violation case given this csp header: content-security-policy: script-src https://example.com/ the following script is blocked and won't be loaded or executed: <script src="https://not-example.com/js/library.js"></script> note that inline event handlers are blocked as well: <button id="btn" onclick="dosomething()"> you should replace them with
addeventlistener calls: document.getelementbyid("btn").
addeventlistener('click', dosomething); unsafe inline script 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 scripts and inline event handlers, 'unsafe-inline', a nonce-source or a ...
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. ...
...ferer on wikipedia 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 previous 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: refere...
Warning - HTTP
after validation. 1xx warn-codes describe the freshness or validation status of the response and will be deleted by a cache after deletion. 2xx warn-codes describe some aspect of the representation that is not rectified by a validation and won't be deleted by a cache after validation unless a full response is sent. <warn-agent> the name or pseudonym of the server or software
adding the warning header (might be "-" when the agent is unknown). <warn-text> advisory text describing 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 ...
... 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 warning arbitrary, non-specific warning 214 transformation applied
added by a proxy if it applies any transformation to the representation, such as changing the content-coding, media-type or the like. 299 miscellaneous persistent warning same as 199, but indicating a persistent warning examples warning: 110 anderson/1.3.37 "response is stale" date: wed, 21 oct 2015 07:28:00 gmt warning: 112 - "cache down" "wed, 21 oct 2015 07:28:00 gmt" spe...
Link prefetching FAQ - HTTP
l any background downloads complete. for example, if you load a bookmark group (which opens several tabs), any prefetch requests initiated by one of the bookmarked pages will not begin until all of the tabs finish loading. if you are using another application which uses the network, link prefetching in mozilla may compete for bandwidth with the other application. this is a problem that we hope to
address in the future by leveraging operating system services to monitor network idle time. are there any restrictions on what is prefetched? yes, only http:// (and, starting in gecko 1.9.1 https://) urls can be prefetched. other protocols (such as ftp) do not provide rich enough support for client side caching. will mozilla prefetch documents from a different host? yes. there is no same-origin r...
...requests? yes, we send the following header along with each prefetch request: x-moz: prefetch of course, this request header is not at all standardized, and it may change in future mozilla releases. chrome uses "x-purpose: prefetch" or "purpose: prefetch" header. is there a preference to disable link prefetching? yes, there is a hidden preference that you can set to disable link prefetching.
add this line to your prefs.js file located in your profile directory (or make the appropriate change via about:config): user_pref("network.prefetch-next", false); however, the theory is that if link prefetching needs to be disabled then there must be something wrong with the implementation. we would rather improve the implementation if it does not work correctly, than expect users to locate and t...
POST - HTTP
a post request is typically sent via an html form and results in a change on the server. ...
...t. text/plain when the post request is sent via a method other than an html form — like via an xmlhttprequest — the body can take any type. as described in the http 1.1 specification, post is designed to allow a uniform method to cover the following functions: annotation of existing resources posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
adding a new user through a signup modal; providing a block of data, such as the result of submitting a form, to a data-handling process; extending a database through an append operation. request has body yes successful response has body yes safe no idempotent no cacheable only if freshness information is included allowed in htm...
HTTP resources and specifications - HTTP
this page lists relevant resources about http. ...
... 6265 http state management mechanism defines cookies proposed standard draft spec cookie prefixes ietf draft draft spec same-site cookies ietf draft draft spec deprecate modification of 'secure' cookies from non-secure origins ietf draft rfc 2145 use and interpretation of http version numbers informational rfc 6585
additional http status codes proposed standard rfc 7538 the hypertext transfer protocol status code 308 (permanent redirect) proposed standard rfc 7725 an http status code to report legal obstacles on the standard track rfc 2397 the "data" url scheme proposed standard rfc 3986 uniform resource identifier (uri): generic syntax internet sta...
511 Network Authentication Required - HTTP
n network access. this status is not generated by origin servers, but by intercepting proxies that control access to the network. ...
...uthentication, acceptance of terms, or other user interaction before granting access (for example in an internet café or at an airport). ...
CSS Houdini
g developers to write code the browser can parse as css, thereby creating new css features without waiting for them to be implemented natively in browsers. advantages of houdini houdini enables faster parse times than using javascript .style for style changes. browsers parse the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts. in
addition, layout, paint, and composite processes are repeated for javascript style updates. houdini 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 method...
... 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.paintworklet.
addmodule('csscomponent.js'); </script> this
added module contains registerpaint() functions, which register completely configurable worklets. the css paint() function parameters include the name of the worklet, along with optional parameters. the worklet also has access to the element's custom properties: they don't need to be passed as function arguments. li { background-image: paint(mycompone...
Concurrency model and the event loop - JavaScript
run some other code in another thread. a downside of this model is that if a message takes too long to complete, the web application is unable to process user interactions like click or scroll. the browser mitigates this with the "a script is taking too long to run" dialog. a good practice to follow is to make message processing short and if possible cut down one message into several messages.
adding messages in web browsers, messages are
added anytime an event occurs and there is an event listener attached to it. if there is no listener, the event is lost. so a click on an element with a click event handler will
add a message—likewise with any other event. the function settimeout is called with 2 arguments: a message to
add to the queue, and a time value (optional; defaults to 0). the...
...; // "this is the start" // "this is just a message" // "this is the end" // "callback 1: this is a msg from call back" // "callback 2: this is a msg from call back" several runtimes communicating together a web worker or a cross-origin iframe has its own stack, heap, and message queue. two distinct runtimes can only communicate through sending messages via the postmessage method. this method
adds a message to the other runtime if the latter listens to message events. never blocking a very interesting property of the event loop model is that javascript, unlike a lot of other languages, never blocks. handling i/o is typically performed via events and callbacks, so when the application is waiting for an indexeddb query to return or an xhr request to return, it can still process other thin...
Control flow and error handling - JavaScript
ent_4_runs_if_condition_is_false; } it's unwise to use simple assignments in a conditional expression, because the assignment can be confused with equality when glancing over the code. for example, do not write code like this: // prone to being misread as "x == y" if (x = y) { /* statements here */ } if you need to use an assignment in a conditional expression, a common practice is to put
additional parentheses around the assignment, like this: if ((x = y)) { /* statements here */ } falsy values the following values evaluate to false (also known as falsy values): false undefined null 0 nan the empty string ("") all other values—including all objects—evaluate to true when passed to a conditional statement. caution: do not confuse the primitive boolean values true ...
... transfers to the catch block. try { throw 'myexception'; // generates an exception } catch (err) { // statements to handle any exceptions logmyerrors(err); // pass exception object to error handler } best practice: when logging errors to the console inside a catch block, using console.error() rather than console.log() is advised for debugging. it formats the message as an error, and
adds it to the list of error messages generated by the page. the finally block the finally block contains statements to be executed after the try and catch blocks execute.
additionally, the finally block executes before the code that follows the try…catch…finally statement. it is also important to note that the finally block will execute whether or not an exception is thrown. if an exception...
Meta programming - JavaScript
t: function(target, name) { return name in target? target[name] : 42 } } let p = new proxy({}, handler) p.a = 1 console.log(p.a, p.b) // 1, 42 the proxy object defines a target (an empty object here) and a handler object, in which a get trap is implemented. here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the number 42.
additional examples are available on the proxy reference page. terminology the following terms are used when talking about the functionality of proxies. handler placeholder object which contains traps. traps the methods that provide property access. (this is analogous to the concept of traps in operating systems.) target object which the proxy virtualizes. it is often used as storage backen...
...configurable if it does not exist as an own property of target or if it exists as a configurable own property of target. the result of object.getownpropertydescriptor(target) can be applied to target using object.defineproperty and will not throw an exception. handler.defineproperty() object.defineproperty() reflect.defineproperty() a property cannot be
added if target is not extensible. a property cannot be
added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of target. a property may not be non-configurable if a corresponding configurable property of target exists. if a property has a corresponding target object property, then object.defineproperty(target, prop, descriptor) will not t...
Numbers and dates - JavaScript
imal, 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. in
addition to being able to represent floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan (not-a-number). a more recent
addition to javascript is bigint which lets you represent integers that may be very large. there are caveats to using bigint, however; for example, you can't mix and match bigint and number values in the same operation, and you can't use t...
...cond. the next four statements build a string value based on the time. the first statement creates a variable temp, assigning it a value using a conditional expression; if hour is greater than 12, (hour - 12), otherwise simply hour, unless hour is 0, in which case it becomes 12. the next 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. « previousnext » ...
Character classes - JavaScript
028 or \u2029. for example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". inside a character set, the dot loses its special meaning and matches a literal dot. note that the m multiline flag doesn't change the dot behavior. so to match a pattern across multiple lines, the character set [^] can be used — it will match any character including newlines. es2018
added the s "dotall" flag, which allows the dot to also match line terminators. \d matches any digit (arabic numeral). equivalent to [0-9]. for example, /\d/ or /[0-9]/ matches "2" in "b2 is the suite number". \d matches any character that is not a digit (arabic numeral). equivalent to [^0-9]. for example, /\d/ or /[^0-9]/ matches "b" in "b2 is the suite numb...
...ith those characters. var nonenglishtext = "Приключения Алисы в Стране чудес"; var regexpbmpword = /([\u0000-\u0019\u0021-\uffff])+/gu; // bmp goes through u+0000 to u+ffff but space is u+0020 console.table(nonenglishtext.match(regexpbmpword)); [ 'Приключения', 'Алисы', 'в', 'Стране', 'чудес' ] note for mdn editors: please do not try to
add funny examples with emoji as those characters are not handled by the platform (kuma). specifications specification ecmascript latest draft (ecma-262)the definition of 'regexp: character classes' in that specification. ...
Memory Management - JavaScript
var d = new date(); // allocates a date object var e = document.createelement('div'); // allocates a dom element some methods allocate new values or objects: var s = 'azerty'; var s2 = s.substr(0, 3); // s2 is a new strin...
...d have their allocated memory reclaimed. limitation: releasing memory manually there are times when it would be convenient to manually decide when and what memory is released. in order to release the memory of an object, it needs to be made explicitly unreachable. as of 2019, it is not possible to explicitly or programmatically trigger garbage collection in javascript. node.js node.js offers
additional options and tools for configuring and debugging memory issues that may not be available for javascript executed within a browser environment. v8 engine flags the max amount of available heap memory can be increased with a flag: node --max-old-space-size=6000 index.js we can also expose the garbage collector for debugging memory issues using a flag and the chrome debugger: node --expos...
Private class fields - JavaScript
syntax class classwithprivatefield { #privatefield } class classwithprivatemethod { #privatemethod() { return 'hello world' } } class classwithprivatestaticfield { static #private_static_field } examples private static fields private fields are accessible on the class constructor from inside the class declaration itself. ...
...on of static variables being called by only static methods still holds. class classwithprivatestaticfield { static #private_static_field static publicstaticmethod() { classwithprivatestaticfield.#private_static_field = 42 return classwithprivatestaticfield.#private_static_field } } console.assert(classwithprivatestaticfield.publicstaticmethod() === 42) private static fields are
added to the class constructor at class evaluation time. there is a provenance restriction on private static fields. only the class which defines the private static field can access the field. this can lead to unexpected behaviour when using this. class baseclasswithprivatestaticfield { static #private_static_field static basepublicstaticmethod() { this.#private_static_field = 42 retu...
SyntaxError: invalid regular expression flag "x" - JavaScript
in any order, but there are only six of them in ecmascript. to include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new regexp('pattern', 'flags'); regular expression flags flag description g global search. i case-insensitive search. m multi-line search. s allow . to match newlines (
added in ecmascript 2018) u unicode; treat pattern as a sequence of unicode code points y perform a "sticky" search that matches starting at the current position in the target string. see sticky examples there are only six valid regular expression flags. /foo/bar; // syntaxerror: invalid regular expression flag "b" did you intend to create a regular expression? an ...
...y examples there are only six valid regular expression flags. /foo/bar; // syntaxerror: invalid regular expression flag "b" did you intend to create a regular expression? an expression containing two slashes is interpreted as a regular expression literal. let obj = { url: /docs/web }; // syntaxerror: invalid regular expression flag "w" or did you mean to create a string instead?
add single or double quotes to create a string literal. let obj = { url: '/docs/web' }; valid regular expression flags see the table above for the six valid regular expression flags that are allowed in javascript. /foo/g; /foo/gims; /foo/uy; ...
TypeError: X.prototype.y called on incompatible type - JavaScript
on incompatible target (or object)" occurs when a function (on a given object), is called with a this not corresponding to the type expected by the function. message typeerror: 'this' is not a set object (edge) typeerror: function.prototype.tostring called on incompatible object (firefox) typeerror: function.prototype.bind called on incompatible target (firefox) typeerror: method set.prototype.
add called on incompatible receiver undefined (chrome) typeerror: bind must be called on a function (chrome) error type typeerror what went wrong? when this error is thrown, a function (on a given object), is called with a this not corresponding to the type expected by the function. this issue can arise when using the function.prototype.call() or function.prototype.apply() methods, and providin...
...in this case, the object that stores the function won't be the this target of that function when it is called by the other function. to work-around this issue, you will either need to provide a lambda which is making the call, or use the function.prototype.bind() function to force the this argument to the expected object. examples invalid cases var myset = new set; ['bar', 'baz'].foreach(myset.
add); // myset.
add is a function, but "myset" is not captured as this. var myfun = function () { console.log(this); }; ['bar', 'baz'].foreach(myfun.bind); // myfun.bind is a function, but "myfun" is not captured as this. valid cases var myset = new set; ['bar', 'baz'].foreach(myset.
add.bind(myset)); // this works due to binding "myset" as this. var myfun = function () { console.log(this); }...
TypeError: can't access dead object - JavaScript
a dead object, is holding a strong (keep alive) reference to a dom element that persists even after it was destroyed in the dom. ...
...a dead object, is holding a strong (keep alive) reference to a dom element that persists even after it was destroyed in the dom. ...
TypeError: Reduce of empty array with no initial value - JavaScript
pen if there is a typo in a selector, or an unexpected number of elements in a list: var names = document.getelementsbyclassname("names"); var name_list = array.prototype.reduce.call(names, (acc, name) => acc + ", " + name); valid cases these problems can be solved in two different ways. ...
...blems can be solved in two different ways. one way is to actually provide an initialvalue as the neutral element of the operator, such as 0 for the
addition, 1 for a multiplication, or an empty string for a concatenation. var ints = [0, -1, -2, -3, -4, -5]; ints.filter(x => x > 0) // removes all elements .reduce((x, y) => x + y, 0) // the initial value is the neutral element of the
addition another way would be two to handle the empty case, either before calling reduce, or in the callback after
adding an unexpected dummy initial value. var names = document.getelementsbyclassname("names"); var name_list1 = ""; if (names1.length >= 1) name_list1 = array.prototype.reduce.call(names, (acc, name) => acc + ", " + name); // name_list1 == "" when names is empty. var name_list2 =...
Arrow function expressions - JavaScript
e. https://www.ecma-international.org/ecma-262/10.0/index.html#sec-strict-mode-code https://www.ecma-international.org/ecma-262/10.0/index.html#sec-arrow-function-definitions-runtime-semantics-evaluation correction: end invoked through call or apply since arrow functions do not have their own this, the methods call() and apply() can only pass in parameters. any this argument is ignored. ...
...ernational.org/ecma-262/10.0/index.html#sec-strict-mode-code https://www.ecma-international.org/ecma-262/10.0/index.html#sec-arrow-function-definitions-runtime-semantics-evaluation correction: end invoked through call or apply since arrow functions do not have their own this, the methods call() and apply() can only pass in parameters. any this argument is ignored. var
adder = { base: 1,
add: function(a) { var f = v => v + this.base; return f(a); },
addthrucall: function(a) { var f = v => v + this.base; var b = { base: 2 }; return f.call(b, a); } }; console.log(
adder.
add(1)); // this would log 2 console.log(
adder.
addthrucall(1)); // this would log 2 still no binding of arguments arrow functions do not have their own arguments object. t...
getter - JavaScript
const expr = 'foo'; const obj = { get [expr]() { return 'bar'; } }; console.log(obj.foo); // "bar" smart / self-overwriting / lazy getters getters give you a way to define a property of an object, but they do not calculate the property's value until it is accessed. a getter defers the cost of calculating the value until the value is needed. if it is never needed, you never pay the cost. an
additional optimization technique to lazify or delay the calculation of a property value and cache it for later access are smart (or "memoized") getters. the value is calculated the first time the getter is called, and is then cached so subsequent accesses return the cached value without recalculating it. this is useful in the following situations: if the calculation of a property value is expensi...
...etter for a property whose value you expect to change, because if the getter is lazy then it will not recalculate the value. note that getters are not “lazy” or “memozied” by nature; you must implement this technique if you desire this behavior. in the following example, the object has a getter as its own property. on getting the property, the property is removed from the object and re-
added, but implicitly as a data property this time. finally, the value gets returned. get notifier() { delete this.notifier; return this.notifier = document.getelementbyid('bookmarked-notification-anchor'); }, for firefox code, see also the xpcomutils.jsm code module, which defines the definelazygetter() function. get vs. defineproperty while using the get keyword and object.defineproperty() ...
Functions - JavaScript
uments.callee : the currently executing function. arguments.caller : the function that invoked the currently executing function. arguments.length: the number of arguments passed to the function. defining method functions getter and setter functions you can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that supports the
addition of new properties. the syntax for defining getters and setters uses the object literal syntax. get binds an object property to a function that will be called when that property is looked up. set binds an object property to a function to be called when there is an attempt to set that property. method definition syntax starting with ecmascript 2015, you are able to define own meth...
... shoulddefinezero is true, and only in the scope of the if-block. a safer way to define functions conditionally is to assign a function expression to a variable: var zero; if (shoulddefinezero) { zero = function() { console.log("this is zero."); }; } examples returning a formatted number the following function returns a string containing the formatted representation of a number p
added with leading zeros. // this function returns a string p
added with leading zeros function padzeros(num, totallen) { var numstr = num.tostring(); // initialize return value as string var numzeros = totallen - numstr.length; // calculate no. of zeros for (var i = 1; i <= numzeros; i++) { numstr = "0" + numstr; } return numstr; } the following statements call the...
Array.prototype.find() - JavaScript
parameter is provided to find, it will be used as the this value inside each invocation of the callback. if it is not provided, then undefined is used. the find method does not mutate the array on which it is called, but the function provided to callback can. if so, the elements processed by find are set before the first invocation of callback. ...
...e set before the first invocation of callback. therefore: callback will not visit any elements
added to the array after the call to find begins. if an existing, yet-unvisited element of the array is changed by callback, its value passed to the callback will be the value at the time find visits that element's index. elements that are deleted are still visited. polyfill this method has been
added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. however, you can polyfill array.prototype.find with the following snippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1. let o be ? toobject(this value). ...
Array.from() - JavaScript
ermediate array would necessarily have values truncated to fit into the appropriate type. the length property of the from() method is 1. in es2015, the class syntax allows sub-classing of both built-in and user-defined classes. as a result, static methods such as array.from() are "inherited" by subclasses of array, and create new instances of the subclass, not array. polyfill array.from() was
added to the ecma-262 standard in the 6th edition (es2015). as such, it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of array.from() in implementations that don't natively support it. polyfill notes: this algorithm is exactly as specified in ecma-262 6th edition (assuming object...
...u can work around this by inserting the following code at the beginning of your scripts, allowing use of array.from() in implementations that don't natively support it. polyfill notes: this algorithm is exactly as specified in ecma-262 6th edition (assuming object and typeerror have their original values and that callback.call() evaluates to the original value of function.prototype.call()). in
addition, since true iterables cannot be polyfilled, this implementation does not support generic iterables as defined in the 6th edition of ecma-262. // production steps of ecma-262, edition 6, 22.1.2.1 if (!array.from) { array.from = (function () { var symboliterator; try { symboliterator = symbol.iterator ? symbol.iterator : 'symbol...
Array.prototype.lastIndexOf() - JavaScript
rray is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will not be searched. return value the last index of the element in the array; -1 if not found. description lastindexof compares searchelement to elements of the array using strict equality (the same method used by the ===, or triple-equals, operator). polyfill lastindexof was
added to the ecma-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of lastindexof in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, number, ma...
...lues in an array. var numbers = [2, 5, 9, 2]; numbers.lastindexof(2); // 3 numbers.lastindexof(7); // -1 numbers.lastindexof(2, 3); // 3 numbers.lastindexof(2, 2); // 0 numbers.lastindexof(2, -2); // 0 numbers.lastindexof(2, -1); // 3 finding all the occurrences of an element the following example uses lastindexof to find all the indices of an element in a given array, using push to
add them to another array as they are found. var indices = []; var array = ['a', 'b', 'a', 'c', 'a', 'd']; var element = 'a'; var idx = array.lastindexof(element); while (idx != -1) { indices.push(idx); idx = (idx > 0 ? array.lastindexof(element, idx - 1) : -1); } console.log(indices); // [4, 2, 0] note that we have to handle the case idx == 0 separately here because the element will always b...
Array.prototype.splice() - JavaScript
the splice() method changes the contents of an array by removing or replacing existing elements and/or
adding new elements in place. 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 let arrdeleteditems = array.splice(start[, deletecount[, item1[, item2[, ...]]]]) parameters start the index at which to start changing the array. if greater than the length of the array, start will be set to the length of the array. in this case, no element will be deleted but the method will behave as an
adding function,
adding as many element as item[n*] provided. if negative, it will begin that many elements from the ...
... or greater than the number of elements left in the array, starting at start), then all the elements from start to the end of the array will be deleted. note: in ie8, it won't delete all when deletecount is omitted. if deletecount is 0 or negative, no elements are removed. in this case, you should specify at least one new element (see below). item1, item2, ... optional the elements to
add to the array, beginning from start. if you do not specify any elements, splice() will only remove elements from the array. return value an array containing the deleted elements. if only one element is removed, an array of one element is returned. if no elements are removed, an empty array is returned. description if the specified number of elements to insert differs from the number of elem...
Atomics - JavaScript
ure that predictable values are written and read, that operations are finished before the next operation starts and that operations are not interrupted. wait and notify the wait() and notify() methods are modeled on linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs. static methods atomics.
add()
adds the provided value to the existing value at the specified index of the array. returns the old value at that index. atomics.and() computes a bitwise and on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.compareexchange() stores a value at the specified index of the array, if it equals a value. returns the old value. ...
...lowed in the calling agent then it throws an error exception. (most browsers will not allow wait() on the browser's main thread.) atomics.xor() computes a bitwise xor on the value at the specified index of the array with the provided value. returns the old value at that index. ...
Date.prototype.toDateString() - JavaScript
"thu jan 01 1970". the source for this interactive example is stored in a github repository. ...
..."thu jan 01 1970". the source for this interactive example is stored in a github repository. ...
Date - JavaScript
...
...gmt+0000 (gmt) date.setfullyear(98) // sat feb 01 0098 00:00:00 gmt+0000 (bst) calculating elapsed time the following examples show how to determine the elapsed time between two javascript dates in milliseconds. due to the differing lengths of days (due to daylight saving changeover), months, and years, expressing elapsed time in units greater than hours, minutes, and seconds requires
addressing a number of issues, and should be thoroughly researched before being attempted. // using date objects let start = date.now() // the event to time goes here: dosomethingforalongtime() let end = date.now() let elapsed = end - start // elapsed time in milliseconds // using built-in methods let start = new date() // the event to time goes here: dosomethingforalongtime() let end = new date...
Intl.Locale.prototype.maximize() - JavaScript
ge, script, and region of the locale based on existing values. 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 locale.maximize() return value a locale instance whose basename property returns the result of the
add likely subtags algorithm executed against locale.basename. description sometimes, it is convenient to be able to identify the most likely locale language identifier subtags based on an incomplete langauage id. the
add likely subtags algorithm gives us this functionality. for instance, given the language id "en", the algorithm would return "en-latn-us", since english can only be written in the l...
...s of these subtags include locale.hourcycle, locale.calendar, and locale.numeric. examples using maximize let mylocale = new intl.locale("fr", {hourcycle: "h24", calendar: "gregory"}); console.log(mylocale.basename); // prints "fr" console.log(mylocale.tostring()); // prints "fr-u-ca-gregory-hc-h24" let mylocmaximized = mylocale.maximize(); // prints "fr-latn-fr". the "latn" and "fr" tags are
added, // since french is only written in the latin script and is most likely to be spoken in france. console.log(mylocmaximized.basename); // prints "fr-latn-fr-u-ca-gregory-hc-h24". // note that the extension tags (after "-u") remain unchanged. console.log(mylocmaximized.tostring()); specifications specification ecmascript internationalization api (ecma-402) ...
Map.prototype.set() - JavaScript
the set() method
adds or updates an element with a specified key and a value to a map 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 mymap.set(key, value) parameters key the key of the element to
add to the map object. value the value of the element to
add to the map object. return value the map object. ...
...ository. 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 mymap.set(key, value) parameters key the key of the element to
add to the map object. value the value of the element to
add to the map object. return value the map object. examples using set() let mymap = new map() //
add new elements to the map mymap.set('bar', 'foo') mymap.set(1, 'foobar') // update an element in the map mymap.set('bar', 'baz') using the set() with chaining since the set() method returns back the same map object, you can chain the method call like below: //
add new elements to the map with chaining. mymap.set('bar', 'foo') .set(1, 'foobar') .set(2, 'baz'); specifications ...
Map - JavaScript
size the number of items in a map is easily retrieved from its size property. the number of items in an object must be determined manually. iteration a map is an iterable, so it can be directly iterated. iterating over an object requires obtaining its keys in some fashion and iterating over them. performance performs better in scenarios involving frequent
additions and removals of key-value pairs. not optimized for frequent
additions and removals of key-value pairs. setting object properties setting object properties works for map objects as well, and can cause considerable confusion. therefore, this appears to work in a way: let wrongmap = new map() wrongmap['bla'] = 'blaa' wrongmap['bla2'] = 'blaaa2' console.log(wrongmap) ...
...f the generic object. the value of 'bla' is not stored in the map for queries. other operations on the data fail: wrongmap.has('bla') // false wrongmap.delete('bla') // false console.log(wrongmap) // map { bla: 'blaa', bla2: 'blaaa2' } the correct usage for storing data in the map is through the set(key, value) method. let contacts = new map() contacts.set('jessie', {phone: "213-555-1234",
address: "123 n 1st ave"}) contacts.has('jessie') // true contacts.get('hilary') // undefined contacts.set('hilary', {phone: "617-555-4321",
address: "321 s 2nd st"}) contacts.get('jessie') // {phone: "213-555-1234",
address: "123 n 1st ave"} contacts.delete('raymond') // false contacts.delete('jessie') // true console.log(contacts.size) // 1 constructor map() creates a new map object. stati...
NaN - JavaScript
g it. it is rather rare to use nan in a program. there are five different types of operations that return nan: number cannot be parsed (e.g. parseint("blabla") or number(undefined)) math operation where the result is not a real number (e.g. math.sqrt(-1)) operand of an argument is nan (e.g. 7 ** nan) indeterminate form (e.g. 0 * infinity) any operation that involves a string and is not an
addition operation (e.g. "foo"/3) examples testing against nan nan compares unequal (via ==, !=, ===, and !==) to any other value -- including to another nan value. use number.isnan() or isnan() to most clearly determine whether a value is nan. or perform a self-comparison: nan, and only nan, will compare unequal to itself. nan === nan; // false number.nan === nan; // false isnan(nan); ...
... let arr = [2, 4, nan, 12]; arr.indexof(nan); // -1 (false) arr.includes(nan); // true arr.findindex(n => number.isnan(n)); // 2 specifications specification ecmascript (ecma-262)the definition of 'nan' in that specification. ...
Number.prototype.toFixed() - JavaScript
l not cause a rangeerror. implementations are allowed to support larger and smaller values as chosen. typeerror if this method is invoked on an object that is not a number. description tofixed() returns a string representation of numobj that does not use exponential notation and has exactly digits digits after the decimal place. the number is rounded if necessary, and the fractional part is p
added with zeros if necessary so that it has the specified length. if the absolute value of numobj is greater or equal to 1e+21, this method simply calls number.prototype.tostring() and returns a string in exponential notation. warning: floating point numbers cannot represent all decimals precisely in binary. this can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . example...
...: floating point numbers cannot represent all decimals precisely in binary. this can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . examples using tofixed let numobj = 12345.6789 numobj.tofixed() // returns '12346': note rounding, no fractional part numobj.tofixed(1) // returns '12345.7': note rounding numobj.tofixed(6) // returns '12345.678900': note
added zeros (1.23e+20).tofixed(2) // returns '123000000000000000000.00' (1.23e-10).tofixed(2) // returns '0.00' 2.34.tofixed(1) // returns '2.3' 2.35.tofixed(1) // returns '2.4'. note it rounds up 2.55.tofixed(1) // returns '2.5'. note it rounds down - see warning above -2.34.tofixed(1) // returns -2.3 (due to operator precedence, negative number literals don't return a s...
Object.setPrototypeOf() - JavaScript
the object.setprototypeof() method sets the prototype (i.e., the internal [[prototype]] property) of a specified object to another object or null. warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, currently a very slow operation in every browser and javascript engine. ...
... altering inheritance are subtle and far-flung, and are not limited to simply the time spent in the object.setprototypeof(...) statement, but may extend to any code that has access to any object whose [[prototype]] has been altered. because this feature is a part of the language, it is still the burden on engine developers to implement that feature performantly (ideally). until engine developers
address this issue, if you are concerned about performance, you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). syntax object.setprototypeof(obj, prototype) parameters obj the object which is to have its prototype set. prototype the object's new prototype (an object or null). return value the specifie...
Object - JavaScript
te()). to do so, one must use the delete operator. constructor object() creates a new object object. it is a wrapper for the given value. static methods object.assign() copies the values of all enumerable own properties from one or more source objects to a target object. object.create() creates a new object with the specified prototype object and properties. object.defineproperty()
adds the named property described by a given descriptor to an object. object.defineproperties()
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.fro...
...boolean indicating if the internal ecmascript [[enumerable]] attribute is set. object.prototype.tolocalestring() calls tostring(). object.prototype.tostring() returns a string representation of the object. object.prototype.unwatch() removes a watchpoint from a property of the object. object.prototype.valueof() returns the primitive value of the specified object. object.prototype.watch()
adds a watchpoint to a property of the object. examples using object given undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(undefined) let o = new object(null) using object to create boolean objects the following examples store boolean objects in o: // equivalent to o = new boolean(true) let o = new object(true) ...
Reflect.isExtensible() - JavaScript
it is similar to object.isextensible(), 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.isextensible(target) parameters target the target object which to check if it is extensible. return value a boolean indicating whether or not the target is extensible. exceptions a typeerror, if target is not an object. ...
...nd us a pull request. syntax reflect.isextensible(target) parameters target the target object which to check if it is extensible. return value a boolean indicating whether or not the target is extensible. exceptions a typeerror, if target is not an object. 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.preventextensions(empty) reflect.isextensible(empty) // === false // sealed objects are by definition non-extensible. let sealed = object.
Reflect.preventExtensions() - JavaScript
it is similar to object.preventextensions(), 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.preventextensions(target) parameters target the target object on which to prevent extensions. return value a boolean indicating whether or not the target was successfully set to prevent extensions. ...
...a pull request. syntax reflect.preventextensions(target) parameters target the target object on which to prevent extensions. return value a boolean indicating whether or not the target was successfully set to prevent extensions. exceptions a typeerror, if target is not an object. description the reflect.preventextensions() method allows you to prevent new properties from ever being
added to an object (i.e., prevents future extensions to the object). it is similar to object.preventextensions(). examples using reflect.preventextensions() see also object.preventextensions(). // objects are extensible by default. let empty = {} reflect.isextensible(empty) // === true // ...but that can be changed. reflect.preventextensions(empty) reflect.isextensible(empty) // === false di...
Set() constructor - JavaScript
whether primitive values or object references. 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. ...
...ttps://github.com/mdn/interactive-examples and send us a pull request. syntax new set([iterable]) parameters iterable optional if an iterable object is passed, all of its elements will be
added to the new set. if you don't specify this parameter, or its value is null, the new set is empty. return value a new set object. examples using the set object let myset = new set() myset.
add(1) // set [ 1 ] myset.
add(5) // set [ 1, 5 ] myset.
add(5) // set [ 1, 5 ] myset.
add('some text') // set [ 1, 5, 'some text' ] let o = {a: 1, b: 2} myset.
add(o) specifications specification ecmascript (ecma-262)the definition of 'set constructor' in that specification. ...
Set.prototype.delete() - JavaScript
ory. 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 myset.delete(value); parameters value the value to remove from myset. return value returns true if value was successfully removed from myset; otherwise false. examples using the delete() method const myset = new set(); myset.
add('foo'); myset.delete('bar'); // returns false. no "bar" element found to be deleted. myset.delete('foo'); // returns true. successfully removed. myset.has('foo'); // returns false. the "foo" element is no longer present. let's checkout below how to delete an object from a set. const setobj = new set(); // create a new set. setobj.
add({x: 10, y: 20}); //
add object in the set. setobj.
...('foo'); myset.delete('bar'); // returns false. no "bar" element found to be deleted. myset.delete('foo'); // returns true. successfully removed. myset.has('foo'); // returns false. the "foo" element is no longer present. let's checkout below how to delete an object from a set. const setobj = new set(); // create a new set. setobj.
add({x: 10, y: 20}); //
add object in the set. setobj.
add({x: 20, y: 30}); //
add object in the set. // delete any point with `x > 10`. setobj.foreach(function(point){ if (point.x > 10){ setobj.delete(point) } }) specifications specification ecmascript (ecma-262)the definition of 'set.prototype.delete' in that specification. ...
Set.prototype.has() - JavaScript
request. syntax myset.has(value); parameters value the value to test for presence in the set object. return value returns true if an element with the specified value exists in the set object; otherwise false. note: technically speaking, has() uses the samevaluezero algorithm to determine whether the given element is found. ...
... if an element with the specified value exists in the set object; otherwise false. note: technically speaking, has() uses the samevaluezero algorithm to determine whether the given element is found. examples using the has method var myset = new set(); myset.
add('foo'); myset.has('foo'); // returns true myset.has('bar'); // returns false var set1 = new set(); var obj1 = {'key1': 1}; set1.
add(obj1); set1.has(obj1); // returns true set1.has({'key1': 1}); // returns false because they are different object references set1.
add({'key1': 1}); // now set1 contains 2 entries specifications specification ecmascript (ecma-262)the definition of 'set.prototype.has' in that specification. ...
String.prototype.padEnd() - JavaScript
if the value is lower than str.length, the current string will be returned as-is. ...
...he end of the current string. 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 str.padend(targetlength [, padstring]) parameters targetlength the length of the resulting string once the current str has been p
added. if the value is lower than str.length, the current string will be returned as-is. padstring optional the string to pad the current str with. if padstring is too long to stay within targetlength, it will be truncated: for left-to-right languages the left-most part and for right-to-left languages the right-most will be applied. the default value for this parameter is " " (u+0020). return val...
TypedArray - JavaScript
ecmascript 2015 defines a typedarray constructor that serves as the [[prototype]] of all typedarray constructors. this constructor is not directly exposed: there is no global %typedarray% or typedarray property. it is only directly accessible through object.getprototypeof(int8array) and similar. all typedarrays constructors inherit common properties from the %typedarray% constructor function.
additionally, all typed array prototypes (typedarray.prototype) have %typedarray%.prototype as their [[prototype]]. the %typedarray% constructor on its own is not particularly useful. calling it or using it in a new expression will throw a typeerror, except when used during object creation in js engines that support subclassing. there are at present no such engines, so %typedarray% is only useful ...
...creation in js engines that support subclassing. there are at present no such engines, so %typedarray% is only useful to polyfill functions or properties onto all typedarray constructors. when creating an instance of a typedarray (e.g. int8array), an array buffer is created internally in memory or, if an arraybuffer object is given as constructor argument, then this is used instead. the buffer
address is saved as an internal property of the instance and all the methods of %typedarray%.prototype, i.e. set value and get value etc., operate on that array buffer
address. typedarray objects type value range size in bytes description web idl type equivalent c type int8array -128 to 127 1 8-bit two's complement signed integer byte int8_t ...
WeakMap.prototype.set() - JavaScript
the set() method
adds a new element with a specified key and value to a weakmap 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 wm.set(key, value); parameters key required. must be object. the key of the element to
add to the weakmap object. value required. any value. the value of the element to
add to the weakmap object. return value the weakmap object. ...
...lone https://github.com/mdn/interactive-examples and send us a pull request. syntax wm.set(key, value); parameters key required. must be object. the key of the element to
add to the weakmap object. value required. any value. the value of the element to
add to the weakmap object. return value the weakmap object. examples using the set method var wm = new weakmap(); var obj = {}; //
add new elements to the weakmap wm.set(obj, 'foo').set(window, 'bar'); // chainable // update an element in the weakmap wm.set(obj, 'baz'); specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.set' in that specification. ...
typeof - JavaScript
rn 'object' typeof num; // it will return 'object' let func = new function(); typeof func; // it will return 'function' need for parentheses in syntax // parentheses can be used for determining the data type of expressions. let idata = 99; typeof idata + ' wisen'; // 'number wisen' typeof (idata + ' wisen'); // 'string' regular expressions callable regular expressions were a non-standard
addition in some browsers. typeof /s/ === 'function'; // chrome 1-12 non-conform to ecmascript 5.1 typeof /s/ === 'object'; // firefox 5+ conform to ecmascript 5.1 errors before ecmascript 2015, typeof was always guaranteed to return a string for any operand it was supplied with. even with undeclared identifiers, typeof will return 'undefined'. using typeof could never generate an error. but w...
... some browsers. typeof /s/ === 'function'; // chrome 1-12 non-conform to ecmascript 5.1 typeof /s/ === 'object'; // firefox 5+ conform to ecmascript 5.1 errors before ecmascript 2015, typeof was always guaranteed to return a string for any operand it was supplied with. even with undeclared identifiers, typeof will return 'undefined'. using typeof could never generate an error. but with the
addition of block-scoped let and statements/const using typeof on let and const variables (or using typeof on a class) in a block before they are declared will throw a referenceerror. block scoped variables are in a "temporal dead zone" from the start of the block until the initialization is processed, during which, it will throw an error if accessed. typeof undeclaredvariable === 'undefined'; type...
Expressions and operators - JavaScript
rmines the type of a given object. + the unary plus operator converts its operand to number type. - the unary negation operator converts its operand to number type and then negates it. ~ bitwise not operator. ! logical not operator. arithmetic operators arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. +
addition operator. - subtraction operator. / division operator. * multiplication operator. % remainder operator. ** exponentiation operator. relational operators a comparison operator compares its operands and returns a boolean value based on whether the comparison is true. in the in operator determines whether an object has a given property. instanceof the instanceof operator dete...
...onal (ternary) operator (condition ? iftrue : iffalse) the conditional operator returns one of two values based on the logical value of the condition. assignment operators an assignment operator assigns a value to its left operand based on the value of its right operand. = assignment operator. *= multiplication assignment. /= division assignment. %= remainder assignment. +=
addition assignment. -= subtraction assignment <<= left shift assignment. >>= right shift assignment. >>>= unsigned right shift assignment. &= bitwise and assignment. ^= bitwise xor assignment. |= bitwise or assignment. &&= logical and assignment. ||= logical or assignment. ??= logical nullish assignment. [a, b] = [1, 2] {a, b} = {a:1, b:2} destructuring assignment allows you...
for...of - JavaScript
onsole.log(value); } // 1 // 2 // 3 iterating over the arguments object you can iterate over the arguments object to examine all of the parameters passed into a javascript function: (function() { for (const argument of arguments) { console.log(argument); } })(1, 2, 3); // 1 // 2 // 3 iterating over a dom collection iterating over dom collections like nodelist: the following example
adds a read class to paragraphs that are direct descendants of an article: // note: this will only work in platforms that have // implemented nodelist.prototype[symbol.iterator] const articleparagraphs = document.queryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.
add('read'); } closing iterators in for...of loops, abrupt iteration termination can ...
...onst i of iterable) { console.log(i); // logs 3, 5, 7 } let us look into the above code step by step. object.prototype.objcustom = function() {}; array.prototype.arrcustom = function() {}; const iterable = [3, 5, 7]; iterable.foo = 'hello'; every object will inherit the objcustom property and every object that is an array will inherit the arrcustom property since these properties have been
added to object.prototype and array.prototype, respectively. the object iterable inherits the properties objcustom and arrcustom because of inheritance and the prototype chain. for (const i in iterable) { console.log(i); // logs 0, 1, 2, "foo", "arrcustom", "objcustom" } this loop logs only enumerable properties of the iterable object, in arbitrary order. it doesn't log array elements 3, 5, 7 or ...
switch - JavaScript
ent let message = 'hi'; even they're within their own separate case clauses case 'say_hello': and case 'say_hi':. ultimately, this is due to both let statements being interpreted as duplicate declarations of the same variable name within the same block scope. ...
...hello': and case 'say_hi':. ultimately, this is due to both let statements being interpreted as duplicate declarations of the same variable name within the same block scope. we can easily fix this by wrapping our case clauses with brackets: const action = 'say_hello'; switch (action) { case 'say_hello': { //
added brackets let message = 'hello'; console.log(message); break; } //
added brackets case 'say_hi': { //
added brackets let message = 'hi'; console.log(message); break; } //
added brackets default: { //
added brackets console.log('empty action received.'); break; } //
added brackets } this code will now output hello in the console as it should, without any errors at all. specifications specification ecmascript (ecma-...
throw - JavaScript
*/ const zipcode_invalid = -1; const zipcode_unknown_error = -2; function verifyzipcode(z) { try { z = new zipcode(z); } catch (e) { if (e instanceof zipcodeformatexception) { return zipcode_invalid; } else { return zipcode_unknown_error; } } return z; } a = verifyzipcode(95060); // returns 95060 b = v...
... return string(this.value) }; } else { throw new zipcodeformatexception(zip); } } function zipcodeformatexception(value) { this.value = value; this.message = 'does not conform to the expected format for a zip code'; this.tostring = function() { return this.value + this.message; }; } /* * this could be in a script that validates
address data * for us
addresses. */ const zipcode_invalid = -1; const zipcode_unknown_error = -2; function verifyzipcode(z) { try { z = new zipcode(z); } catch (e) { if (e instanceof zipcodeformatexception) { return zipcode_invalid; } else { return zipcode_unknown_error; } } return z; } a = verifyzipcode(95060); // returns 95060 b = verifyzipcode(9560); ...
var - JavaScript
g var are created before any code is executed in a process known as hoisting. their initial value is undefined. 'use strict'; console.log(x); // undefined (note: not referenceerror) console.log('still going...'); // still going... var x = 1; console.log(x); // 1 console.log('still going...'); // still going... in the global context, a variable declared using var is
added as a non-configurable property of the global object. this means its property descriptor cannot be changed and it cannot be deleted using delete. the corresponding name is also
added to a list on the internal [[varnames]] slot on the global environment record (which forms part of the global lexical environment). the list of names in [[varnames]] enables the runtime to distinguish between global ...
...te operator on a global variable. 'use strict'; var x = 1; globalthis.hasownproperty('x'); // true delete globalthis.x; // typeerror in strict mode. fails silently otherwise. delete x; // syntaxerror in strict mode. fails silently otherwise. note that in both nodejs commonjs modules and native ecmascript modules, top-level variable declarations are scoped to the module, and are not, therefore
added as properties to the global object. unqualified identifier assignments the global object sits at the top of the scope chain. when attempting to resolve a name to a value, the scope chain is searched. this means that properties on the global object are conveniently visible from every scope, without having to qualify the names with globalthis. or window. or global.. so you can just type: func...
with - JavaScript
use of the with statement is not recommended, as it may be the source of confusing bugs and compatibility issues. see the "ambiguity contra" paragraph in the "description" section below for details. the with statement extends the scope chain for a statement. syntax with (expression) statement expression
adds the given expression to the scope chain used when evaluating the statement. the parentheses around the expression are required. ...
...en evaluating the statement. the parentheses around the expression are required. statement any statement. to execute multiple statements, use a block statement ({ ... }) to group those statements. description javascript looks up an unqualified name by searching a scope chain associated with the execution context of the script or function containing that unqualified name. the 'with' statement
adds the given object to the head of this scope chain during the evaluation of its statement body. if an unqualified name used in the body matches a property in the scope chain, then the name is bound to the property and the object containing the property. otherwise a referenceerror is thrown. using with is not recommended, and is forbidden in ecmascript 5 strict mode. the recommended alternative is...
Transitioning to strict mode - JavaScript
ecmascript 5 introduced strict mode which is now implemented in all major browsers (including ie10). while making web browsers interpret code as strict is easy (just
add 'use strict'; at the top of your source code), transitioning an existing code base to strict mode requires a bit more work. this article aims at providing guidance for developers. gradual transition strict mode has been designed so that the transition to it can be made gradually. it is possible to change each file individually and even to transition code to strict mode down to the function granularity. ...
...ing code base to strict mode requires a bit more work. this article aims at providing guidance for developers. gradual transition strict mode has been designed so that the transition to it can be made gradually. it is possible to change each file individually and even to transition code to strict mode down to the function granularity. ...
<maction> - MathML
attributes actiontype the action which specifies what happens for this element. possible values are: statusline: if there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. ...
...on actiontype="tooltip"> expression message </maction>. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. selection the child element which is
addressed by the action. the default value is 1, which is the first child element. examples the following example uses the "toggle" actiontype: <math> <maction actiontype="toggle"> <mfrac> <mn>6</mn> <mn>8</mn> </mfrac> <mfrac> <mrow> <mn>3</mn> <mo>⋅</mo> <mn>2</mn> </mrow> <mrow> <mn>4</mn> <mo>⋅</mo> <mn>2</mn> </mr...
<math> - MathML
class, id, style provided for use with stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. ...
...<msup> <mi>a</mi> <mn>2</mn> </msup> <mo>+</mo> <msup> <mi>b</mi> <mn>2</mn> </msup> </mrow> <mo>=</mo> <msup> <mi>c</mi> <mn>2</mn> </msup> </mrow> </math> </body> </html> notes: xhtml documents with mathml must be served as application/xhtml+xml. you can achieve that easily by
adding the .xhtml extension to your local files. for apache servers you can configure your .htaccess file to map extensions to the correct mime type. since you notate your mathml in an xml document, also be sure you write a well-formed xml document. specifications specification status comment mathml 3.0the definition of 'the top-level math element' in that specification.
<mtable> - MathML
s environment. possible values are: axis (default): the vertical center of the table aligns on the environment's axis (typically the minus sign). baseline: the vertical center of the table aligns on the environment's baseline. bottom: the bottom of the table aligns on the environments baseline. center: see baseline. top: the top of the table aligns on the environments baseline. in
addition, values of the align attribute can end with a rownumber (e.g. align="center 3"). this allows you to align the specified row of the table rather than the whole table. a negative integer value counts rows from the bottom of the table. starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (fir...
...t to true. unimplemented equalcolumns a boolean value indicating whether to force all columns to have the same total height. false is default. unimplemented equalrows a boolean value indicating whether to force all rows to have the same total height. false is default. frame specifies borders of the entire table. possible values are: none (default), solid and dashed. framespacing specifies
additional space
added between the table and frame. groupalign unimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. unimplemented minlabelspacing a length value specifing the minimum space between a label and the adjacent ce...
MathML element reference - MathML
ts) <merror> (enclosed syntax error messages) f <mfenced> (parentheses) <mfrac> (fraction) g <mglyph> (displaying non-standard symbols) i <mi> (identifier) l <mlabeledtr> (labeled row in a table or a matrix) <mlongdiv> (long division notation) m <mmultiscripts> (prescripts and tensor indices) n <mn> (number) o <mo> (operator) <mover> (overscript) p <mp
added> (space around content) <mphantom> (invisible content with reserved space) r <mroot> (radical with specified index) <mrow> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> elements) <msline> (horizontal lines inside <mstack> element...
...ipt) <munderover> (underscript-overscript pair) other elements <semantics> (container for semantic annotations) <annotation> (data annotations) <annotation-xml> (xml annotations) mathml presentation elements by category top-level elements <math> token elements <mglyph> <mi> <mn> <mo> <ms> <mspace> <mtext> general layout <menclose> <merror> <mfenced> <mfrac> <mp
added> <mphantom> <mroot> <mrow> <msqrt> <mstyle> script and limit elements <mmultiscripts> <mover> <mprescripts> <msub> <msubsup> <msup> <munder> <munderover> <none> tabular math <maligngroup> <malignmark> <mlabeledtr> <mtable> <mtd> <mtr> elementary math <mlongdiv> <mscarries> <mscarry> <msgroup> <msline> <msrow> <mstack> uncategorized elements <maction> ...
MathML
ng mathml suggestions and tips for writing mathml, including suggested mathml editors and how to integrate their output into web content. view all... getting help from the community view mozilla forums... mailing list newsgroup rss feed matrix chat room wiki used by mozilla contributors w3c math home www-math w3.org mail archive tools w3c validator mathzilla firefox
add-on collection texzilla — javascript latex to mathml converter (live demo, firefox os webapp, firefox
add-on, using in a web page, js program etc) latexml - convert latex documents into html+mathml web pages web equation - turn handwritten equations into mathml or latex mathjax - cross-browser javascript display engine for mathematics. to force mathjax to use native mathml, try this mozilla ...
...-on collection texzilla — javascript latex to mathml converter (live demo, firefox os webapp, firefox
add-on, using in a web page, js program etc) latexml - convert latex documents into html+mathml web pages web equation - turn handwritten equations into mathml or latex mathjax - cross-browser javascript display engine for mathematics. to force mathjax to use native mathml, try this mozilla
add-on, this safari extension or this greasemonkey script. related topics css html svg ...
Guide to streaming audio and video - Web media technologies
in this guide, we'll examine the techniques used to stream audio and/or video media on the web, and how you can optimize your code, your media, your server, and the options you use while performing the streaming to bring out the best quality and performance possible. <<<...xxxxxx...>>> protocols in
addition to the configuration of the server and the streaming code, there are sometimes special protocols which can be used to optimize performance. https live streaming https live streaming (hls) is a protocol developed by apple and supported by safari on all of their platforms. hls may also be supported in other environments, although in some cases this support is conditional. for example, because many web sites' mobile-specific content assume that mobile browsers support hls, firefox for ...
...m occurring due to this assumption being incorrect. the desktop version of android, however, does not support hls. hls uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media. for example, hls lets the server stream a video with multiple audio streams which the user can choose from, in order to hear their own language.
additionally, forms of the stream can be provided which are optimized for different network conditions. in this way, live streams can be made flexible and highly performant. as of mid-2017, hls has been standardized as rfc 8217. ...
Using images in HTML - Web media technologies
the html <img> element lets you embed images into an html document, while the <picture> element enables responsive images. in this guide you'll find links to resources that deal with
adding images to websites. references these articles cover some of the html elements and css properties that are used to control how images are displayed on the web. html <img> the html <img> element is used to embed an image in a webpage. it supports a wide range of attributes that control how the image behaves and allows you to
add important information like alt text for people who don't see the image. <picture> the html <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. the browser consid...
...d. background-image the background-image css property sets one or more background images for an element. guides these articles provide guidance on selecting and configuring image types. image file type and format guide a guide to the various image file types commonly supported by web browsers including details about their individual use cases, capabilities, and compatibility factors.
additionally, this article provides guidance for selecting the best image file type for a given situation. mapping the width and height attributes of media container elements to their aspect-ratio this changes how browsers load images so their aspect ratios are calculated by the browser early on and can later be used to correct the display size of an image before it's loaded. other topics rel...
Animation performance and frame rate - Web Performance
sight into the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. if you want to play along, the demo website is here. it looks like this: it has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. there are a number of elements, and we've
added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. there's also a video version of this walkthrough: animating using margin leaving the "use margin" option set, start the animation, open the performance tool, and make a recording. you'll only need to record a few seconds. open up the first recording. exactly what you...
...ompressed view of the waterfall. the predominance of green is telling us that we're spending a lot of time painting. frame rate this is showing frame rate. average frame rate here is 46.67fps, well below the target of 60fps. worse, though, is that the frame rate is very jagged, with lots of dips into the twenties and teens. it's unlikely you'll see a smooth animation here, especially when you
add in user interaction. waterfall the rest of the recording shows the waterfall view. if you scroll through this, you'll see a pattern like this: this is showing us the rendering waterfall. in each animation frame, we recalculate styles for every element, then perform a single layout, then a repaint. you can see that paint especially is hurting performance here. in the screenshot above we've h...
Performance fundamentals - Web Performance
st of your app's look-and-feel, using a standardized syntax. css animations give you very granular control over your effects using keyframes, and you can even watch events fired during the animation process in order to handle other tasks that need to be performed at set points in the animation process. you can easily trigger these animations with the :hover, :focus, or :target, or by dynamically
adding and removing classes on parent elements. if you want to create animations on the fly or modify them in javascript, james long has written a simple library for that called css-animations.js. use css transforms instead of tweaking absolute positioning and fiddling with all that math yourself, use the transform css property to adjust the position, scale, and so forth of your content. the reaso...
...long has written a simple library for that called css-animations.js. use css transforms instead of tweaking absolute positioning and fiddling with all that math yourself, use the transform css property to adjust the position, scale, and so forth of your content. the reason is, once again, hardware acceleration. the browser can do these tasks on your gpu, letting the cpu handle other things. in
addition, transforms give you capabilities you might not otherwise have. not only can you translate elements in 2d space, but you can transform in three dimensions, skew and rotate, and so forth. paul irish has an in-depth analysis of the benefits of translate() from a performance point of view. in general, however, you have the same benefits you get from using css animations: you use the right tool ...
Recommended Web Performance Timings: How long is too long? - Web Performance
often touted as optimal for load, but what does that mean? a second should be considered a rule in the maximum amount of time to indicate to a user that the request for new content was made and will load, such as the browser displaying the page title and the background color of the page displaying. the first asset retrieved from a request is usually an html document, which then makes calls for
additional assets. as noted in the description of the critical rendering path, when received, browsers immediately start processing the html, rendering the content as it is received rather than waiting for
additional assets to load. yes, one second for loading is a goal, but it's something few sites achieve. expectations differ. a 'hello world' on the corporate network would be expected to load in m...
...itors will take a long time to come back if they ever do. in optimizing for performance, do set an ambitious first load goal, such as 5 seconds over the mobile 3g network and 1.5 seconds on an office t1 line, with even more ambitious page load goals for subsequent page loads, leveraging service workers and caching. there are different suggested times for initially loading the page versus loading
additional assets, responding to user interaction, and ensuring smooth animations: idling goal browsers are single threaded (though background threads are supported for web workers). this means that user interaction, painting, and script execution are all on the same thread. if the thread is busy doing complex javascript execution, the main thread will not be available to react to user input, such ...
Performance budgets - Web Performance
e 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 prevent regressions, but they can provide insights to forecast trends (i.e. on september, 50% of the budget was spent in a week).
additionally, it can uncover development needs (i.e. a large library with smaller alternatives is often picked to solve a common problem). how do i define a performance budget? a budget should include 2 levels: warning. error. the warning level allows you to be proactive and plan any tech debt, while not blocking development or deploys. the error level is an upper bound limit, where changes ...
...of the difference between development and production can be used as a goal towards better match the live environment. the lighthouse bot integrates with travis ci and can be used to gather lighthouse and webpage test metrics from a development url. the bot will pass or fail based on the provided minimum scores. how do i enforce a performance budget? the sooner that you can identify a potential
addition pushing the budget, the better you can analyze the current state of your site, and pinpoint optimizations or unnecessary code. however, you should have multiple budgets and be dynamic. they are meant to reflect your ongoing goals but allow risks and experiments. for example, you may introduce a feature that increases overall load time but attempts to increase user engagement. (i.e. how long...
Using dns-prefetch - Web Performance
dns-prefetch is an attempt to resolve domain names before resources get requested. this could be a file loaded later or link target a user tries to follow. why use dns-prefetch? when a browser requests a resource from a (third party) server, that cross-origin’s domain name must be resolved to an ip
address before the browser can issue the request. this process is known as dns resolution. while dns caching can help to reduce this latency, dns resolution can
add significant latency to requests. for websites that open connections to many third parties, this latency can significantly reduce loading performance. dns-prefetch helps developers mask dns resolution latency. the html <link> element offers this functionality by way of a rel attribute value of dns-prefetch. the cross-origin ...
...ins, preconnecting them all is counterproductive. the preconnect hint is best used for only the most critical connections. for the others, just use <link rel="dns-prefetch"> to save time on the first step — the dns lookup. the logic behind pairing these hints is because support for dns-prefetch is better than support for preconnect. browsers that don’t support preconnect will still get some
added benefit by falling back to dns-prefetch. because this is an html feature, it is very fault-tolerant. if a non-supporting browser encounters a dns-prefetch hint—or any other resource hint—your site won’t break. you just won’t receive the benefits it provides. some resources such as fonts are loaded in anonymous mode. in such cases you should set the crossorigin attribute with the precon...
Progressive loading - Progressive web apps (PWAs)
t's crucial and then manage other resources when needed. render-blocking resources bundling is a problem, because the browser has to load the html, css, and javascript before it can paint their rendered results onto the screen. during the few seconds between initial website access and completion of loading, the user sees a blank page, which is a bad experience. ...
...uring the few seconds between initial website access and completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example,
add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. we can also split css files and
add media types to them: <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="print.css" media="print"> this will tell the browser to load them only when the condition is met. in our js13kpwa demo app, the css is simple enough to leave it all in a single file with no specific rules as to how to load them. we could go even further and move everything from style.css to the <style> ...
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 previous results, accumulating with each iteration. this attribute said to the animation if the value is
added to the previous animated attribute's value on each iteration. ...
...r>, <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 previous 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 animation element does not repeat. this attribute will be ignored if the animation function is specified with only the to attribute. specifications specification status comment svg animations level 2the definition of 'accumulate' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the defi...
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 previously 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"> ...
... specifications specification status comment css transforms level 1the definition of 'surfacescale for <fespecularlighting>' in that specification. working draft defines the <transformation-list> value. scalable vector graphics (svg) 2the definition of 'gradien...
orient - SVG: Scalable Vector Graphics
auto-start-reverse if placed by marker-start, the marker is oriented 180° different from the orientation that would be used if auto where specified. for all other markers, auto-start-reverse means the same as...
...ordinate system. <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 ...
SVG Attribute reference - SVG: Scalable Vector Graphics
svg elements can be modified using attributes that specify details about exactly 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. ...
...nction 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, autoreverse, 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, ondragleave, ondragover, ondragstart, ondrop, ondura...
<animateMotion> - SVG: Scalable Vector Graphics
the svg <animatemotion> element let define how an element moves along a motion path. note: to reuse an existing path, it will be necessary to use an <mpath> element inside the <animatemotion> element instead of the path attribute. ...
... specifications specification status comment ...
<feComposite> - SVG: Scalable Vector Graphics
the arithmetic operation is useful for combining the output from the <fediffuselighting> and <fespecularlighting> filters with texture data. ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of '<fecomposite>' in that specification. recommendation initial definition ...
<feImage> - SVG: Scalable Vector Graphics
scalable vector graphics (svg) 1.1 (second edition)the definition of '<feimage>' in that specification. recommendation initial definition ...
... scalable vector graphics (svg) 1.1 (second edition)the definition of '<feimage>' in that specification. recommendation initial definition ...
<feSpecularLighting> - SVG: Scalable Vector Graphics
lighting> svg filter primitive lights a source graphic using the alpha channel as a bump map. the resulting image is an rgba image based on the light color. the lighting calculation follows the standard specular component of the phong lighting model. the resulting image depends on the light color, light position and surface geometry of the input bump map. ...
... image depends on the light color, light position and surface geometry of the input bump map. the result of the lighting calculation is
added. the filter primitive assumes that the viewer is at infinity in the z direction. this filter primitive produces an image which contains the specular reflection part of the lighting calculation. such a map is intended to be combined with a texture using the
add term of the arithmetic <fecomposite> method. multiple light sources can be simulated by
adding several of these light maps before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentexactly one light source element first and any number of descriptive elements in any order. attributes global attributes core attributes presentation attributes ...
<radialGradient> - SVG: Scalable Vector Graphics
table: yes fy this attribute defines the y coordinate of the start circle of the radial gradient. value type: <length> ; default value: same as cy; animatable: yes gradientunits this attribute defines the coordinate system for attributes x1, x2, y1, y2 value type: userspaceonuse|objectboundingbox ; default value: objectboundingbox; animatable: yes gradienttransform this attribute provides
additional transformation to the gradient coordinate system. value type: <transform-list> ; default value: identity transform; animatable: yes href this attribute defines a reference to another <lineargradient> element that will be used as a template. value type: <url> ; default value: none; animatable: yes r this attribute defines the radius of the end circle of the radial gradient. the gradie...
... recommendation initial definition ...
Example - SVG: Scalable Vector Graphics
example should work in firefox 1.5 and above. view the example <?xml version='1.0'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <title>a swarm of motes</title> <style type='text/css'> <![cdata[ label, input { width: 150px; display: block; float: left; margin-bottom: 10px; } label { text-align: right; width: 75px; p
adding-right: 20px; } br { clear: left; } ]]> </style> </head> <body onload='update()'> <svg:svg id='display' width='400' height='300'> <svg:circle id='cursor' cx='200' cy='150' r='7' fill='#0000ff' fill-opacity='0.5'/> </svg:svg> <p>a swarm of motes, governed by two simple principles. first, each mote tries to move towards the cursor, and second each mote tries to move a...
... = function() { // apply attraction to cursor. var attract = parseint( document.getelementbyid('attract_cursor').value ); var cursor = cursor(); this.applyforce(cursor, attract); // apply repulsion from average mote position. var repel = parseint( document.getelementbyid('repel_peer').value ); var average = averagemoteposition(); this.applyforce(average, -repel); //
add some randomness to the velocity. this.vx += rand(3)-1; this.vy += rand(3)-1; // put an upper limit on velocity. this.capvelocity(); // apply velocity. var old_x = this.x, old_y = this.y; this.x += this.vx; this.y += this.vy; this.capposition(); // draw it. if( this.elt === null ) { var svg = 'http://www.w3.org/2000/svg'; this.elt = document.createel...
SVG animation with SMIL - SVG: Scalable Vector Graphics
animations and web animations, the chrome developers have since suspended that deprecation. firefox 4 introduced support for animating svg using synchronized multimedia integration language (smil). smil allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path this is done
adding an svg element like <animate> inside the svg element to animate. below are examples for the four different ways. animating attributes of an element the following example animates the cx attribute of a circle. to do so, we
add an <animate> element inside the <circle> element. the important attributes for <animate> are: attributename the name of the attribute to animate. from the initial...
...ribute of a circle. to do so, we
add an <animate> element inside the <circle> element. the important attributes for <animate> are: attributename the name of the attribute to animate. from the initial value of the attribute. to the final value. dur the duration of the animation (for example, write '5s' for 5 seconds). if you want to animate more attributes inside the same element, just
add more <animate> elements. <svg width="300" height="100"> <title>attribute animation with smil</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"> <animate attributename="cx" from="0" to="500" dur="5s" repeatcount="indefinite" /> </circle> </svg> animating the t...
Filter effects - SVG: Scalable Vector Graphics
« previousnext » 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 previous operations (like blurring,
adding a lighting effect, etc). to apply your created filter on a graphic element,...
...d "sourcealpha", masks out the result of "specout" so that the result is not bigger than "sourcealpha" (the original source graphic), and overrides the result "specout". step 5 <fecomposite in="sourcegraphic" in2="specout" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litpaint"/> the second <fecomposite> takes in "sourcegraphic" and "specout",
adds the result of "specout" on top of "sourcegraphic", and stores the result in "litpaint". step 6 <femerge> <femergenode in="offsetblur"/> <femergenode in="litpaint"/> </femerge> finallly, <femerge> merges together "offsetblur", which is the drop shadow, and "litpaint", which is the original source graphic with a lighting effect. source graphic primitive 1 primitive 2 primitive 3...
SVG Filters Tutorial - SVG: Scalable Vector Graphics
filters act like layers. when creating them, try applying and testing the effect step by step. this element has different attributes that help us create the clipping region. between the filter tags, we can define the primitives that allow us to implement the desired effect. ...
..., is in this case input 'in'. the amount of blur to be applied is done using the stddeviation attribute. svg filter example <defs> <filter id="drop-shadow"> <fegaussianblur in="sourcealpha" stddeviation="3"/> </filter> </defs> <g id="ghost" style="filter: url(#drop-shadow);"/> <!--ghost drawing in here--> </g> this above example will not produced the desired output. instead we need to
add more filter primitives which will produce the desire rendering. by
adding feoffset and result, the effect layer is defined <result> attribute is a reference that can be use later. it is quite different to an xml id and only can be referenced within the actual filter. <feoffset> primitive has the blur result from the gaussian blur. <femerge> primitive contains the nodes <femergenode> taking as in...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
s have their colors set by css. when the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. ...
...like in the following example: var img = document.createelementns("http://www.w3.org/2000/svg", "image"); img.setattributens("http://www.w3.org/1999/xlink", "xlink:href", "move.png"); details the viewbox attribute establishes a logical coordinate system which the svg picture's coordinate...
SVG fonts - SVG: Scalable Vector Graphics
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. ...
...hildren <font-face-name> and <font-face-uri>. the above example states that if the renderer has a local font available named "super sans bold", it should use this instead. following <font-face-src> is a <missing-glyph> element. this defines what should be displayed if a certain glyph is not found in the font and if there are no fallback mechanisms. it also shows how glyphs are created: by simply
adding any graphical svg content inside. you can use literally any other svg elements in here, even <filter>, <a> or <script>. for simple glyphs, however, you can simply
add a d attribute — this defines a shape for the glyph exactly like how standard svg paths work. the actual glyphs are then defined by <glyph> elements. the most important attribute is unicode. it defines the unicode codepoint rep...
SVG: Scalable Vector Graphics
a text-based, open web standard for describing images that can be rendered cleanly at any size and are designed specifically to work well with other web standards including css, dom, javascript, and smil. svg is, essentially, to graphics what html is to text. svg images and their related behaviors are defined in xml text files, which means they can be searched, indexed, scripted, and compressed.
additionally, this means they can be created and edited with any text editor or with drawing software. compared to classic bitmapped image formats such as jpeg or png, svg-format vector images can be rendered at any size without loss of quality and can be easily localized by updating the text within them, without the need of a graphical editor to do so. with proper libraries, svg files can even be l...
...e mozilla svg project frequently asked questions regarding svg and mozilla svg as an image svg animation with smil svg art gallery animation and interactions like html, svg has a document model (dom) and events, and is accessible from javascript. this allows developers to create rich animations and interactive images. some real eye-candy svg at svg-wow.org firefox extension (grafox) to
add a subset of smil animation support interactive photos manipulation html transformations using svg's foreignobject mapping, charting, games & 3d experiments while a little svg can go a long way to enhanced web content, here are some examples of heavy svg usage. connect 4 jvectormap (interactive maps for data visualization) jointjs (javascript diagramming library) d3 ( javascript library...
Referer header: privacy and security concerns - Web security
however, there are more problematic uses such as tracking or stealing information, or even just side effects such as inadvertently leaking sensitive information. ...
...ther than get wherever 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 consider removing any third party content (e.g. social networking widgets embedded in <iframe>) from secure areas of your website, like password reset pages, payment forms, login areas, etc. you can also mitigate such risks using: the referrer-policy header on your server to control what information is sent through the referer header. again, a directive of no-referrer would o...
How to turn off form autocompletion - Web security
that the browser not remember the values for such fields, even if the browser's autocomplete feature is enabled. note that the wcag 2.1 success criterion 1.3.5: identify input purpose does not require that autocomplete/autofill actually work - merely that form fields that relate to specific personal user information are programmatically identified. this means that the criterion can be passed (by
adding the relevant autocomplete attributes to individual form fields) even when autocompletion for the form itself has been turned off. disabling autocompletion to disable autocompletion in forms, you can set the autocomplete attribute to "off": autocomplete="off" you can do this either for an entire form, or for specific input elements in a form: <form method="post" action="/form" autocomplete...
...ing autocomplete to off, then you have to change the name attribute of the input element. the autocomplete attribute and login fields modern browsers implement integrated password management: when the user enters a username and password for a site, the browser offers to remember it for the user. when the user visits the site again, the browser autofills the login fields with the stored values.
additionally, the browser enables the user to choose a master password that the browser will use to encrypt stored login details. even without a master password, in-browser password management is generally seen as a net gain for security. since users do not have to remember passwords that the browser stores for them, they are able to choose stronger passwords than they would otherwise. for this rea...
Subdomain takeovers - Web security
meone 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 the domain example.com. you want to
add a blog at blog.example.com, and you decide to use a hosting provider who maintains a blogging platform. (for "blog", you can substitute "e-commerce platform", "customer service platform", or any other "cloud-based" virtual hosting scenario.) the process you go through might look like this: you register the name "blog.example.com" with a domain registrar. you set up dns records to direct brows...
...imate claim to the domain name. work within your organization to make this part of the vendor qualification process. my subdomain has been taken over. what should i do? if you discover that a subdomain of your domain has been taken over, the first step, if possible, is to "cut power" by removing the dns entry for the subdomain. if your site has multiple layers of virtualization (e.g., a cdn in
addition to virtual hosting), you may need to examine each layer to see where exactly the attacker asserted their virtual host claim to take over your domain. learn more 'deep thoughts' on subdomain takeover vulnerabilities subdomain takeover: basics ...
Tutorials
css building blocks this module carries on where css first steps left off — now you've gained familiarity with the language and its syntax, and got some ba...
...eps css (cascading style sheets) is used to style and lay out 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 like, and how you can start using it to
add styling to html. css building blocks this module carries on where css first steps left off — now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, an...
Index - XPath
found 57 pages: # page tags and summary 1 xpath css selectors, dom, jxon, landing, path, xml, xpath, xslt xpath stands for xml path language. it uses a non-xml syntax to provide a flexible way of
addressing (pointing to) different parts of an xml document. it can also be used to test
addressed nodes within a document to determine whether they match a pattern or not. 2 axes transforming_xml_with_xslt, xpath, xpath_reference, xslt, xslt_reference for further information on using xpath expressions, please see the for further reading section at the end of transforming xml with xslt document. also see the 'axes' section in the xpath spec. 3 ancestor axe, xpath no summary! 4 ancestor-or-self axe, x...
...n returns a boolean value of true. 54 unparsed-entity-url xslt, xslt_reference the unparsed-entity-url() function returns the uri of the unparsed entity with the given name. this is non-xml data referenced in the dtd of the source document. 55 index index, reference, xpath, xslt found 57 pages: 56 introduction to using xpath in javascript
add-ons, dom, extensions, javascript, transforming_xml_with_xslt, web development, xml, xpath, xslt this document describes the interface for using xpath in javascript internally, in extensions, and from websites. mozilla implements a fair amount of the dom 3 xpath, which means that xpath expressions can be run against both html and xml documents. 57 xpath snippets example, snipp...
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
create a new xml document in memory var xmlref = document.implementation.createdocument("", "", null); // we want to move a part of the dom from an html document to an xml document. // importnode is used to clone the nodes we want to process via xslt - true makes it do a deep clone var mynode = document.getelementbyid("example"); var clonednode = xmlref.importnode(mynode, true); //
add the cloned dom into the xml document xmlref.appendchild(clonednode); once the stylesheet has been imported, xsltprocessor has to perform two methods for the actual transformation, namely xsltprocessor.transformtodocument() and xsltprocessor.transformtofragment(). xsltprocessor.transformtodocument() returns a full xml document while xsltprocessor.transformtofragment() returns a document fragme...
...he xml document xmlref.appendchild(clonednode); once the stylesheet has been imported, xsltprocessor has to perform two methods for the actual transformation, namely xsltprocessor.transformtodocument() and xsltprocessor.transformtofragment(). xsltprocessor.transformtodocument() returns a full xml document while xsltprocessor.transformtofragment() returns a document fragment that can be easily
added to an existing document. both take in the xml document as the first parameter that will be transformed. xsltprocessor.transformtofragment() requires a second parameter, namely the document object that will own the generated fragment. if the generated fragment will be inserted into the current html document, passing in document is enough. figure 2.1 : creating an xml document from a string 'xml...
WebAssembly Concepts - WebAssembly
rked well for us as javascript is powerful enough to solve most problems people have on the web today. we have run into performance problems, however, when trying to use javascript for more intensive use cases like 3d games, virtual and augmented reality, computer vision, image/video editing, and a number of other domains that demand native performance (see webassembly use cases for more ideas).
additionally, the cost of downloading, parsing, and compiling very large javascript applications can be prohibitive. mobile and other resource-constrained platforms can further amplify these performance bottlenecks. webassembly is a different language from javascript, but it is not intended as a replacement. instead, it is designed to complement and work alongside javascript, allowing web developers...
... javascript feature for efficiently generating high-performance functions. in the future, webassembly modules will be loadable just like es2015 modules (using <script type='module'>), meaning that javascript will be able to fetch, compile, and import a webassembly module as easily as an es2015 module. how do i use webassembly in my app? above we talked about the raw primitives that webassembly
adds to the web platform: a binary format for code and apis for loading and running this binary code. now let’s talk about how we can use these primitives in practice. the webassembly ecosystem is at a nascent stage; more tools will undoubtedly emerge going forward. right now, there are four main entry points: porting a c/c++ application with emscripten. writing or generating webassembly direc...
Navigator.mozNotification - Archive of obsolete content
n createnotification( in domstring title, in domstring description, in domstring iconurloptional ); parameters title the notification title. description the text to display in the notification. iconurl optional a url identifying the image to display in the notification. return value a new notification object. permissions when using notifications in an open web app, be sure to
add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage notes in firefox 22+, the instantiation of a new notification should be done with the notification object by calling new notification(title, options). nick desaulniers has written a notification shim to cover both newer and older implementations. ...
Builder - Archive of obsolete content
the
add-on builder tool was retired on april 1, 2014. the
add-on builder was a web-based development environment that allowed developers to create
add-ons using the sdk apis, but without needing to use the jpm command line tool. it was retired on april 1, 2014, and the "builder.
addons.mozilla.org" domain now redirects to this page. ...
Getting Started - Archive of obsolete content
learn how to contribute to the
add-on sdk. this page is now maintained alongside the sdk code itself: https://github.com/mozilla/gecko-dev/blob/master/
addon-sdk/source/contributing.md. ...
Private Properties - Archive of obsolete content
function to access the properties x and y, is if it has a reference to an instance of point and its internal namespace. keeping the namespace hidden from all functions, except members of point, effectively implements private properties. moreover, because members of point have a reference to the internal namespace, they can access private properties on other instances of point. namespaces in the
add-on sdk the
add-on sdk is built on top of xpcom, the interface between javascript and c++ code. since xpcom allows the user to do virtually anything, security is very important. among other things,
add-ons should not be able to access variables that are supposed to be private. the sdk uses namespaces internally to ensure this. as always with code that is heavily reused, the sdk defines a helper f...
Program ID - Archive of obsolete content
the program id is a unique identifier for your
add-on. when you package your
add-on for distribution using jpm xpi, it will become the id field in the
add-on's install manifest. the id is used for a variety of purposes. for example:
addons.mozilla.org uses it to distinguish between new
add-ons and updates to existing
add-ons, and the simple-storage module uses it to figure out which stored data belongs to which
add-on. when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the
add-on id. if the package.json does include an id field, and it does not cont...
XULBrowserWindow - Archive of obsolete content
f the implemented methods. you may also wish to refer to the implementation of xulbrowserwindow in browser/base/content/browser.js. method overview boolean hidechromeforlocation(in string alocation); attributes attribute type description incontentwhitelist string[] an array of url strings for which chrome is automatically hidden. defaults to about:
addons but extensions can append specific urls to the array. methods hidechromeforlocation determines whether or not browser chrome should be hidden for the specified location. by default, chrome is hidden for about:
addons and any other pages in the in content whitelist. you can augment the functionality of this method using chaining in order to hide chrome for other locations. see hiding br...
XML - Archive of obsolete content
it does a great job. using a combination of xul's ready-made widgets (e.g., menubar, scrollbar, progressmeter, and so on) and xul's incorporation of such standards as html4, dom1/2, and cascading stylesheets, you can design any interface that you can imagine, using any number of different features, tools, and methodologies. there are many times, for example, when you may use javascript tricks to
add extra behavior. but the necessary tradeoff for xul's flexibility is a lack of implicit functionality -- the lack ofintuition, you might say, that xul has in interpreting what it is you want. in order to provide flexibility to you as adesigner of interfaces, xul offers no flexibility to you as acoder. you must be very careful about your syntax, and in particular about these four cardinal rules of ...
XUL controls - Archive of obsolete content
oupbox element. groupbox reference related elements: caption <filefield> allows the user to select a file. <filefield/> filefield reference <image> an image specified by a url. <image src="start.png"/> more information about the image element. image reference <label>
adds a text label to a nearby control. <label control="volume" value="volume:"/> more information about the label element. label reference <listbox> the listbox is used to select an item from a list of labelled items. <listbox> <listitem label="chocolate"/> <listitem label="jelly beans"/> </listbox> more information about the list...
action - Archive of obsolete content
lign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
bbox - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
binding - Archive of obsolete content
align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
bindings - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
box - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
broadcaster - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
broadcasterset - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
column - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
columns - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
conditions - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
content - Archive of obsolete content
elements. uri type: ? used to specify the variable name for the content. when a rule is evaluated, it scans through each resource in the rdf datasource looking for a match. each resource is placed in the variable specified in the uri attribute in turn. then, the other rules are evaluated for a match. this attribute should always be present. ...
deck - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
dropmarker - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
grid - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
grippy - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
groupbox - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
hbox - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
listcol - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
listcols - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
member - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
menubar - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
menupopup - Archive of obsolete content
t has not yet been shown. this state will occur during the popupshowing event. hiding: the popup is about to be hidden. this state will occur during the popuphiding event. triggernode type: nsidomnode this read-only property holds the dom node that generated the event triggering the opening of the popup. the value is null if the popup isn't open. ...
notification - Archive of obsolete content
the value of the priority attribute. type type: string gets and sets the value of the type attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. ...
observes - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
page - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
panel - Archive of obsolete content
ossible: closed: the popup is closed and not visible. open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. this state will occur during the popupshowing event. hiding: the popup is about to be hidden. this state will occur during the popuphiding event. ...
param - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
popupset - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
preferences - Archive of obsolete content
changed (non-bubbling) event to the specified preference element. also executes code specified in onchanged attribute of the element. see also the description of change event of <preference>. void observe(in nsisupports asubject, in string atopic, in wstring adata); nsiobserver method used internally to react to changes to preferences listed as children of this element. ...
promptBox - Archive of obsolete content
the promptbox object represents the tab-modal prompts (or alerts) on a given tab. it's returned by the tabbrowser method gettabmodalpromptbox method. a tab may have multiple prompts on it; the tabmodalpromptshowing attribute on the tabbrowser will tell you how many prompts a given tab has. note: this is largely an implementation detail; if you're developing an
add-on, you shouldn't need to tinker with this. you should use the window.alert() method or the nsiprompt interface instead. see using tab-modal prompts for details. method overview nsidomelement appendprompt(args, onclosecallback); void removeprompt(nsidomelement aprompt); nodelist listprompts(nsidomelement aprompt); methods appendprompt() creates a new prompt,
adding it to the tab. nsidomelement appendprompt( args, onc...
query - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
queryset - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
resizer - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
row - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
rows - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
script - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
scrollbar - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
scrollcorner - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
separator - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
spacer - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
spinbuttons - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
splitter - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
stack - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
stringbundle - Archive of obsolete content
supplied array. alternatively, numbered indices of the format %n$s (e.g. %1$s, %2$s, etc.) can be used to specify the position of the corresponding parameter explicitly. if you need to handle substitutions involving plurals, take a look at localization and plurals. getstring( key ) return type: string returns the string with the given key name from the string bundle. ...
stringbundleset - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
tabbox - Archive of obsolete content
type: tab element a reference to the currently selected tab, which will always be one of the tab elements in the tabs element. assign a value to this property to modify the currently selected tab. tabs type: tabs element the tabs element contained within the tabbox. tabpanels type: tabpanels element the tabpanels element contained within the tabbox. ...
tabpanel - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
tabpanels - Archive of obsolete content
index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modify the selected panel. a select event will be sent when the selected panel is changed. ...
template - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
textnode - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
titlebar - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbargrippy - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbarseparator - Archive of obsolete content
align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbarspacer - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
toolbarspring - Archive of obsolete content
align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treecell - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treechildren - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treecols - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treeitem - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treerow - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
treeseparator - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
triple - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
vbox - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
where - Archive of obsolete content
ign, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods
addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserdata, hasattribute...
wizard - Archive of obsolete content
rent than pageindex, because pages are not necessarily navigated in order. title type: string the title that appears at the top of the wizard. this is overridden by the label attribute on the individual pages. wizardpages type: dom nodelist of wizardpage elements this property holds the list of wizardpage elements in the wizard. ...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
ndor/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 preview 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? here. i th...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
dor/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 preview 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? here. ...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
be installed 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!
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 for more information. where is the source code? ...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
e application will be installed 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!
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 for more information. where is the source code? here. where is the sdk? ...
XULRunner 1.9 Release Notes - Archive of obsolete content
ation will be installed 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!
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 for more information. where is the source code? here. where is the ...
XULRunner 2.0 Release Notes - Archive of obsolete content
e application will be installed 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!
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 for more information. where is the source code? here. where is the sdk? ...
Application Update - Archive of obsolete content
by default since we show a // upgrade start page instead! other apps may wish to show this ui, and supply // a whatsnewurl field in their brand.properties that contains a link to a page // which tells users what's new in this new update. pref("app.update.showinstalledui", false); // 0 = suppress prompting for incompatibilities if there are updates available // to newer versions of installed
addons that resolve them. // 1 = suppress prompting for incompatibilities only if there are versioninfo // updates available to installed
addons that resolve them, not newer // versions. pref("app.update.incompatible.mode", 0); update server follow the instructions here to setup an update server for your xulrunner application to query. i opted for the simpler approach of not using the up...
Tips for authoring fast-loading HTML pages - Learn web development
> see also: css flexible box layout and css grid layout specifications. minify and compress svg assets svg produced by most drawing applications often contains unnecessary metadata which can be removed. configure your servers, apply gzip compression for svg assets. minify and compress your images large images cause your page to take more time to load. consider compressing your images before
adding them to your page, using 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 ...
Using data attributes - Learn web development
effects without having to write your own display routines. see this screencast for an example using generated content and css transitions (jsbin example). data values are strings. number values must be quoted in the selector for the styling to take effect. issues do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. in
addition, search crawlers may not index data attributes' values. the main issues to consider are internet explorer support and performance. internet explorer 11+ provides support for the standard, but all earlier versions do not support dataset. to support ie 10 and under you need to access data attributes with getattribute() instead. also, the performance of reading data-attributes compared to stor...
Test your skills: Advanced HTML text - Learn web development
sment or further help section at the bottom of this page. advanced html text 1 in this task we want you to turn the provided animals and their definitions into a description list. 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. advanced html text 2 in this task we want you to
add some semantics to the provided html as follows: turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from accessibility. semantically mark up "html" and "css" as acronyms, providing expansions as tooltips. semantically associate machine-readable dates with the dates in the text. use subscript and superscript to provide correct semantics for t...
Test your skills: Links - Learn web development
trictly best practice, but we've done it here so that the pages don't open in the embedded <iframe>, getting rid of your example code in the process! 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. links 3 the following links link to an info page about narwhals, a support email
address, and a pdf factfile that is 4mb in size. in this task we want you to: take the existing paragraphs with poorly-written link text, and rewrite them so that they have good link text.
add a warning to any links that need a warning
added. note: the first and third links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page ...
Introduction to HTML - Learn web development
inks to custom favicons, and metadata (data about the html, such as who wrote it, and important keywords that describe the document). html text fundamentals one of html's main jobs is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. this article looks at how to use html to break up a block of text into a structure of headings and paragraphs,
add emphasis/importance to words, create lists, and more. creating hyperlinks hyperlinks are really important — they are what makes the web a web. this article shows the syntax required to make a link and discusses best practices for links. advanced text formatting there are many other elements in html for formatting text that we didn't get to in the html text fundamentals article. the elements...
Functions — reusable blocks of code - Learn web development
greeting(); </script> // first.js let name = 'chris'; function greeting() { alert('hello ' + name + ': welcome to our company.'); } // second.js let name = 'zaptec'; function greeting() { alert('our company is called ' + name + '.'); } both functions you want to call are called greeting(), but you can only ever access the first.js file's greeting() function (the second one is ignored). in
addition, attempting to declare the name variable a second time with the let keyword in the second.js file results in an error. note: you can see this example running live on github (see also the source code). keeping parts of your code locked away in functions avoids such problems, and is considered the best practice. it is a bit like a zoo. the lions, zebras, tigers, and penguins are kept in ...
Test your skills: Conditionals - Learn web development
used to store a reponse that will be printed to the output panel. we want you to create a conditional that checks whether season contains the string "summer", and if so assigns a string to response that gives the user an appropriate message about the season. if not, it should assign a generic string to response that tells the user we don't know what season it is. to finish off, you should then
add another test that checks whether season contains the string "winter", and again assigns an appropriate string to response. 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. conditionals 2 for this task you are given three variables: machineactive — contains an indicator of wh...
Test your skills: Loops - Learn web development
lts. isprime() — a function that, when passed a number, returns true if the number is a prime number, and false if not. you need 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 previous 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...
Test your skills: variables - Learn web development
initialize myname with a suitable value, on a separate line (you can use your actual name, or something else). declare a variable called myage and initialize it with a value, on the same line. 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. variables 2 in this task you need to
add a new line to correct the value stored in the existing myname variable to your own name. 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. variables 3 the final task for now — in this case you are provided with some existing code, which has two errors present in it. the results ...
JavaScript First Steps - Learn web development
on strings with built-in methods, such as finding the length of a text string, joining and splitting strings, substituting one character in a string for another, and more. arrays in the final article of this module, we'll look at arrays — a neat way of storing a list of data items under a single variable name. 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. assessments the following assessment will test your understanding of the javascript basics covered in the guides above. silly story generator in this assessment you'll be tasked with taking some of the knowledge you've picked up in this module's articles and applying it to creating a fun app that generates random silly stories. have f...
Test your skills: JSON - Learn web development
of kittens, and how many are male and female, in the kitteninfo variable. the values of these variables are then printed to the screen inside paragraphs. some hints/questions: the json data is provided as text inside the displaycatinfo() function. you'll need to parse it into json before you can get any data out of it. you'll probably want to use an outer loop to loop through the cats and
add their names to the motherinfo variable string, and an inner loop to loop through all the kittens,
add up the total of all/male/female kittens, and
add those details to the kitteninfo variable string. the last mother cat name should have an "and" before it, and a full stop after it. how do you make sure this can work, no matter how many cats are in the json? why are the para1.textcontent = mothe...
Web performance resources - Learn web development
ed. the following snippet includes an onload attribute, requiring javascript, so it is important to include a noscript tag with a traditional fallback. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> the downside with this approach is the flash of unstyled text (fout.) the simplist way to
address this is by inlining css that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. these styles will improve perceived performance as the css does not require a file request. <style type="text/css"> // insert your css here </style> javascript avoid javascript blocking by using the async or defer attributes, or link javascrip...
The business case for web performance - Learn web development
lied to a single file, a file type, all files loaded on a page, a specific metric, or a threshold over a period of time.the budget reflects reachable goals; whehter they are time, quantity, or rule based. definining and promoting a budget helps performance proponent advocates for good user experience against competing interests, such as marketing, sales, or even other developers that may want to
add videos, 3rd party scripts, or even frameworks. performance budgets help developer teams protect optimal performane for users while enabling the business to tap into new markets and deliver custom experiences. key performance indicators setting key performance indicators (kpi) as objectives can hiltie performance objectives that are also business objectives. kpis can be both a set of important b...
Multimedia: video - Learn web development
mpression algorithms that can make video look (bad) like an animated gif. while a 128 kb video may seem like it could provide a better user experience than a 10 mb download, a grainy gif-like video may reflect poorly on the brand or project. see caniuse.com for current browser support of video and other media types. video autoplay to ensure that a looping background video autoplays, you must
add several attributes to the video tag: autoplay, muted, and playsinline. <video autoplay="" loop="" muted="true" playsinline="" src="backgroundvideo.mp4"> while the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mobile browsers. playsinline is required for mobile safari, allowing videos to play without forcing fullscreen mode. r...
Server-side website programming first steps - Learn web development
r way through the modules in this section. guides introduction to the server side welcome to the mdn beginner's server-side programming course! in this first article, we look at server-side programming from a high level, answering questions such as "what is it?", "how does it differ from client-side programming?", and "why it is so useful?". after reading this article, you'll understand the
additional power available to websites through server-side coding. client-server overview now that you know the purpose and potential benefits of server-side programming, we're going to examine in detail what happens when a server receives a "dynamic request" from a browser. as most websites' server-side code handles requests and responses in a similar way, this will help you understand what you ne...
NSS 3.51.1 release notes
ewer. nss 3.51.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_51_1_rtm/src/ other releases are available in nss releases. notable changes in nss 3.51.1 bug 1617968 - update delegated credentials implementation to draft-07. bugs fixed in nss 3.51.1 bug 1619102 -
add workaround option to include both dtls and tls versions in dtls supported_versions. bug 1619056 - update readme: tls 1.3 is not experimental anymore. bug 1618739 - don't assert fuzzer behavior in ssl_parsesessionticket. bug 1618915 - fix ubsan issue in ssl_parsesessionticket. bug 1608245 - consistently handle null slot/session. bug 1608250 - broken fipstest handling of ki_len. bug 1617968 -...
NSS 3.56 release notes
s/releases/nss_3_56_rtm/src/ other releases are available in nss releases. notable changes in nss 3.56 nspr dependency updated to 4.28. the known issue where makefile builds failed to locate seccomon.h was fixed in bug 1653975. bugs fixed in nss 3.56 bug 1650702 - support sha-1 hw acceleration on armv8 bug 1656981 - use mpi comba and mulq optimizations on x86-64 macos. bug 1654142 -
add cpu feature detection for intel sha extension. bug 1648822 -
add stricter validation of dh keys in fips mode. bug 1656986 - properly detect arm64 during gyp build architecture detection. bug 1652729 -
add build flag to disable rc2 and relocate to lib/freebl/deprecated. bug 1656429 - correct rtt estimate used in 0-rtt anti-replay. bug 1588941 - send empty certificate message when scheme selec...
NSS Sample Code Utilities_1
pen noise file."); return secfailure; } do { count = pr_read(fd,buf,sizeof(buf)); if (count > 0) { pk11_randomupdate(buf,count); } } while (count > 0); pr_close(fd); return secsuccess; } /* * filesize */ long filesize(const char* filename) { struct stat stbuf; stat(filename, &stbuf); return stbuf.st_size; } /* * re
adderfromfile */ secstatus re
adderfromfile(secitem *der, const char *infilename, prbool ascii) { secstatus rv = secsuccess; prfiledesc *infile = null; infile = pr_open(infilename, pr_rdonly, 0); if (!infile) { pr_fprintf(pr_stderr, "failed to open file \"%s\" (%ld, %ld).\n", infilename, pr_geterror(), pr_getoserror()); rv = secfailure; ...
NSS Sample Code sample2
. * this code uses the simplest of the init functions, which does not * require a nss database to exist */ rv = nss_nodb_init("."); if (rv != secsuccess) { fprintf(stderr, "nss initialization failed (err %d)\n", pr_geterror()); goto out; } /* choose mechanism: ckm_des_cbc_pad, ckm_des3_ecb, ckm_des3_cbc..... * note that some mechanisms (*_pad) imply the p
adding is handled for you * by nss. if you choose something else, then data p
adding is the * application's responsibility */ ciphermech = ckm_des_cbc_pad; slot = pk11_getbestslot(ciphermech, null); /* slot = pk11_getinternalkeyslot(); is a simpler alternative but in * theory, it *may not* return the optimal slot for the operation. for * des ops, internal slot is typically the bes...
NSS Sample Code sample4
cert, self-signed, generates key-pair, prompts for key * # type, cert type etc * # answers for prompts: 5,9,n,y,-1,n,5,6,7,9,n * $ certutil -s -s "cn=test ca, o=bogus inc, l=mtn view, st=ca, c=us" \ * -n testca -t ctu,ctu,ctu -v 60 -x -d . -1 -2 -5 * * there are many ways to setup a public/private key to use - this * example shows one of them. * * this example does not do any p
adding. it simply encrypts/decrypts a block * of length equal to modulus length of the public/private key. */ #include "nss.h" #include "pk11pub.h" /* this callback is responsible for returning the password to the nss * key database. for example purposes, this function hardcodes the password. * in a real app, this function should obtain the password using secure means * such as prompting an ...
NSS Sample Code sample5
format /* example code to illustrate pki crypto ops (encrypt with public key, * decrypt with private key) * * no nss db needed. the public key & private key to use are * sourced from a base64-encoded der subjectpublickeyinfo structure, * and a base64-encoded der privatekeyinfo structure. * * there is no attempt to link the public & private key together * * this example does not do any p
adding. it simply encrypts/decrypts a block * of length equal to modulus length of the public/private key. */ #include "nss.h" #include "pk11pub.h" #define base64_encoded_subjectpublickeyinfo "mfwwdqyjkozihvcnaqebbqadswawsajbal3f6tic3jeysugo+a2fpu3w+epv/feix21dc86wynpftw4srftz2onuzyluzdhzdb+k//8dct3iaozuui3r2emcaweaaq==" #define base64_encoded_privatekeyinfo "miibvqibadanbgkqhkig9w0baqefaascat8...
NSS sources building testing
s in directory "lib", and the tools in directory "bin". in order to run the tools, you should set your system environment to use the libraries of your build from the "lib" directory, e.g., using the ld_library_path or dyld_library_path environment variable. running the nss test suite this is an important part of development work, in order to ensure your changes don't introduce regressions. when
adding new features to nss, tests for the new feature should be
added as well. you must build nss prior to running the tests. after the build on your computer has succeeded, before you can run the tests on your computer, it might be necessary to set
additional environment variables. the nss tests will start tcp/ip server tools on your computer, and in order for that to work, the nss test suite needs...
nss tech note2
4[805ef10]: ulcount = 2 1024[805ef10]: cka_token = ck_true [1] 1024[805ef10]: cka_label = localhost.nyc.rr.com [20] 1024[805ef10]: rv = 0x0 4. collect performance data. this mode is most useful in optimized builds. the number of calls to each pkcs #11 function will be counted, and the time spent in each function as well. a summary of performance data is dumped during nss shutdown. no
additional environment variables are required for this mode. if the environment variable nss_output_file is set, its value will be used as the path name of the file to which the final output will be written. otherwise, the output will be written to stdout. ...
nss tech note5
ot attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way. encrypt/decrypt include headers #include "nss.h" #include "pk11pub.h" make sure nss is initialized.the simplest init function, in case you don't need a nss database is nss_nodb_init(".") choose a cipher mechanism. note that some mechanisms (*_pad) imply the p
adding is handled for you by nss. if you choose something else, then data p
adding is the application's responsibility. you can find a list of cipher mechanisms in security/nss/lib/softoken/pkcs11.c - grep for ckf_en_de_. ck_mechanism_type ciphermech = ckm_des_cbc_pad <big>(for example)</big> choose a slot on which to to do the operation pk11slotinfo* slot = pk11_getbestslot(ciphermech, null...
nss tech note6
the new checksum file is called libsoftokn3.chk on unix/linux and softokn3.chk on windows. it must be put in the same directory as the nss libraries. the libsoftokn3.chk/softokn3.chk file contains a checksum for the softoken. when in fips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk. ...
nss tech note7
pk11_pubencryptpkcs1. pk11_pubencryptraw is the lowest level function. it takes a modulus size data and does a raw rsa operation on the data. it's used to support ssl2, which modifies the key encoding to include the ssl version number. pkcs #1 v1.5 block formatting question: in pkcs #1 v1.5 (section 8.1 encryption-block formatting) and v2.1 (section 7.2.1 encryption operation), pkcs1 v1.5 p
adding is described like this: 00 || 02 || ps || 00 || m but in pkcs #1 v2.0 (section 9.1.2.1 encoding operation, step 3) and on the w3c web site (http://www.w3.org/tr/xmlenc-core/#rsa-1_5), pkcs1 v1.5 p
adding is described like this: 02 || ps || 00 || m 00 at the beginning is missing. why? answer: the version without the initial 00 says : "ps is a string of strong pseudo-random o...
nss tech note8
ec.cache)(sid); for ssl3: sid->lastaccesstime = sid->creationtime = ssl_time(); sid->expirationtime = sid->creationtime + ssl3_sid_timeout; (*ss->sec.cache)(sid); the cache api was defined such that the caller must set creationtime properly, and may set expirationtime to the desired value or to zero. if zero, then the called cache function would compute the correct expiration time by
adding the chosen timeout (from one of those two global variables) to the sid's creationtime, giving the expirationtime. however, none of the callers relied on the ability of the respective cache functions to be able to compute the expiration time. all callers computed the expiration times explicitly, as shown above. the server side of the session cache code was largely rewritten for nss 3.4. the...
NSS Tools sslstrength
all the preferences are on, so it will use any preferences in your policy. the enabled ciphersuites will always be printed out before the connection is made. if you want to test out a particular cipher, there are two ways to affect which ciphers are available. firstly, you can set policy to be either domestic or export. this restricts the available ciphers to the same set used by communicator. in
addition to this, the ciphers command can be used to further restrict the ciphers available. the argument to the ciphers command is a string of characters, where each single character represents a cipher. you can obtain this list of character->cipher mappings by doing 'sslstrength ciphers'. for example, ciphers=bfi will turn on these cipher preferences and turn off all others. policy=export o...
PKCS11 module installation
this article covers the two methods for installing pkcs #11 modules into firefox. users can use the preferences dialog to install or remove pkcs #11 module. extensions can programmatically manage pkcs #11 modules using the nsipkcs11 programming interface. note: the information in this article is specific to firefox 3.5 and newer. older versions of firefox may support the window.pkcs11 property for installing pkcs #11 modules. ...
NSS PKCS11 Functions
syntax #include "secmod.h" extern secmodmodule *secmod_loadusermodule(char *modulespec, secmodmodule *parent, prbool recurse); parameters this function has the following parameters: modulespec is a pkcs #11 modulespec. parent is the moduledb that presented this module spec. for applications this value should be null. recurse is a boolean indicates whether or not the module should also launch
additional pkcs #11 modules. this is only applicable if the loaded module is actually a moduledb rather than a pkcs #11 module (see pkcs11_module_specs). returns the function returns one of these values: if successful, a pointer to a secmodmodule. caller owns the reference if unsuccessful, null. description secmod_loadusermodule loads a new pkcs #11 module into nss and connects it to the current n...
RTCAnswerOptions - Web APIs
roptions dictionary is used to provide optional settings when creating an sdp answer using rtcpeerconnection.createoffer() after receiving an offer from a remote peer. the createoffer() method's options parameter is of this type. properties this dictionary inherits properties from the rtcofferansweroptions dictionary, on which it's based. note: at this time, rtcansweroptions does not have any
additional properties defined beyond those included in rtcofferansweroptions. however, this is likely to change in the future, so the type has been defined in preparation for that eventuality. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcansweroptions' in that specification. candidate recommendation...
RTCConfiguration.bundlePolicy - Web APIs
guration = { bundlepolicy: policy }; rtcconfiguration.bundlepolicy = policy; value a domstring identifying the sdp bundling policy to use for the rtp streams used by the rtcpeerconnection. this string, which must be a member of the rtcbundlepolicy enumeration, has the following possible values: balanced the ice agent begins by creating one rtcdtlstransport to handle each type of content
added: one for audio, one for video, and one for the rtc data channel, if applicable. if the remote peer isn't bundle-aware, the ice agent chooses one audio track and one video track and those two tracks are each assigned to the corresponding rtcdtlstransport. all other tracks are ignored by the connection. this is the default, and most compatible, policy. max-compat the ice agent intially creates ...
RTCConfiguration.certificates - Web APIs
based on the algorithms it and the remote peer support, as determined during dtls handshake. if you don't provide certificates, new ones are generated automatically. one obvious benefit to providing your own is identity key continuity—if you use the same certificate for subsequent calls, the remote peer can tell you're the same caller. this also avoids the cost of generating new keys. <<<---
add link to information about identity --->>> examples specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcconfiguration.certificates' in that specification. candidate recommendation initial definition. ...
RTCConfiguration.iceTransportPolicy - Web APIs
tering 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 prevent 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 prevent 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 = { iceservers: [ { urls: [ "stun:stun.exam...
RTCDataChannel.bufferedAmount - Web APIs
implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. closing the data channel doesn't reset this count, even though the user agent purges the queued messages. however, even after closing the channel, attempts to send messages continue to
add to the bufferedamount value, even though the messages are neither sent nor buffered. whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. syntax var amou...
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
the number of bytes of buffered outgoing data that is considered "low." the default value is 0. when the number of buffered outgoing bytes, as indicated by the bufferedamount property, falls to or below this value, a bufferedamountlow event is fired. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. listeners may be
added with onbufferedamountlow or
addeventlistener(). the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. bufferedamountlow events are not fired after the data channel is closed. syntax var threshold = adatachannel.bu...
RTCDataChannel: bufferedamountlow event - Web APIs
e the data channel's buffer falls below the number of bytes specified by bufferedamountlowthreshold, which we have set to 65536. in other words, we'll try to keep at least 64kb of data in the buffer, reading 64kb at a time from the source. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel("sendfile"); let source = /* source data object */ dc.bufferedamountlowthreshold = 65536; pc.
addeventlistener("bufferedamountlow", ev => { if (source.position <= source.length) { dc.send(source.readfile(65536)); } }, false); after creating the rtcpeerconnection, this calls rtcpeerconnection.createdatachannel() to create the data channel. then a listener is created for bufferedamountlow to refill the incoming data buffer any time its contents fall below 65536 bytes. you can also se...
RTCDataChannel: close event - Web APIs
bubbles no cancelable no interface event event handler property rtcdatachannel.onclose examples this example sets up a handler for the close event for the rtcdatachannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started. dc.
addeventlistener("close", ev => { messageinputbox.disabled = true; sendbutton.disabled = true; connectbutton.disabled = false; disconnectbutton.disabled = true; }, false); all this code does in response to receiving the close event is to disable an input box and its "send" button, and to enable the button used to start a call (while disabling the one that ends a call). you can also use the...
RTCDataChannel.id - Web APIs
ly versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. syntax var id = adatachannel.id; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. while the label property doesn't have to be unique, this id number is guaranteed to be unique among all data channels.
additionally, known implementations of webrtc use the same id on both peers. a unique id makes it easier for your code to do its own out-of-band data channel-related signaling. this can be also useful for logging and debugging purposes. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); console.log("channel id: " + dc.id); specifications specificatio...
RTCDataChannel.onerror - Web APIs
tcdatachannel.onerror = function; value a function which the browser will call to handle the error event when it occurs on the data channel. this function receives as its only input an errorevent object describing the event which was received. 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. the error handler passes information about the error to a ui library's alert box function to present an error message to the user. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel("playercontrol"); dc.onerror = function(event) { myuilibrary.doalertbox({ 'network error', // alert title 'the error "' + event.message + '" occurred while handling ...
RTCDataChannel.onmessage - Web APIs
is represented by the messageevent interface. this event is sent to the channel when a message is received from the other peer. syntax rtcdatachannel.onmessage = function; value a function which the browser will call to handle the message event. the function receives as its sole input parameter a messageevent object describing the event. example this code snippet creates a peer connection,
adds a data channel to it, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents displayed inside it. the new elements are then attached to the end of the document. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel(); dc.onmessage = function(event) { var el = document.createelement("p"); var txtnode = document.createtextnode(even...
RTCDataChannel.onopen - Web APIs
is is a simple event which is sent when the data channel's underlying data transport—the link over which the rtcdatachannel's messages flow—is established or re-established. syntax rtcdatachannel.onopen = function; value a function which the browser will call to handle the open event. the function receives as its only input parameter the event itself, of type event. example this example
adds a new data channel to an existing rtcpeerconnection, mypeerconnection. it then establishes an open event handler which updates some user interface elements to prepare them for being used to send messages over the data channel. let dc = mypeerconnection.createdatachannel("message channel"); dc.onopen = function(event) { let messagebox = document.getelementbyid("messagebox"); let sendbutton ...
RTCDataChannel.send() - Web APIs
ata sent before connecting is buffered if possible (or an error occurs if it's not possible), and is also buffered if sent while the connection is closing or closed. different browsers have different limitations on the size of the message you can send. specifications exist to define how to automatically fragment large messages, but not all browsers implement them, and those that do have various
additional restrictions. this will get less complicated over time, but for now, if you have questions, see understanding message size limits in using webrtc data channels. syntax rtcdatachannel.send(data); parameters data the data to transmit across the connection. this may be a usvstring, a blob, an arraybuffer, or an arraybufferview. return value undefined. exceptions invalidstateer...
RTCDataChannel - Web APIs
each peer connection can have up to a theoretical maximum of 65,534 data channels (the actual limit may vary from browser to browser). to create a data channel and ask a remote peer to join you, call the rtcpeerconnection's createdatachannel() method. the peer being invited to exchange data receives a datachannel event (which has type rtcdatachannelevent) to let it know the data channel has been
added to the connection. propertiesalso inherits properties from: eventtargetbinarytype the property binarytype on the rtcdatachannel interface is a domstring which specifies the type of javascript object which should be used to represent binary data received on the rtcdatachannel. values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or ...
RTCErrorEvent - Web APIs
the webrtc api's rtcerrorevent interface represents an error sent to a webrtc object. it's based on the standard event interface, but
adds rtc-specific information describing the error, as shown below. constructor rtcerrorevent() creates and returns a new rtcerrorevent object. properties in
addition to the standard properties available on the event interface, rtcerrorevent also includes the following: error read only an rtcerror object specifying the error which occurred; this object includes the type of error that occurred, information about where the error occurred (such as which line number in the sdp or what sctp cause code was at issue). methods no
additional methods are provided beyond any found on the parent interface, event. description there are other data types us...
Developer guides
xploring 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 t...
HTML attribute: min - HTML: Hypertext Markup Language
mitted, the value defaults to 1. syntax for min values for other elements input type syntax example <meter> <number> <meter id="fuel" min="0" max="100" low="33" high="66" optimum="80" value="40"> at 40/100</meter> impact on step the value of min and step define what are valid values, even if the step attribute is not included, as step defaults to 0. we
add a big red border around invalid inputs: input:invalid { border: solid red 3px; } then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="mynumber" name="mynumber" type="number" min="7.2" value="8"> because step defaults to 1, valid values include 7.2, 8.2, 9.2, and so on. the value 8 is not valid. as we included an invalid value, s...
HTML attribute: minlength - HTML: Hypertext Markup Language
the input will fail constraint validation if the length of the text value of the field is less than minlength utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum length required and the current length. examples by
adding minlength="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> we can use pseudoclasses to style the element based on whether the value is valid. the value will be valid as long as it is either null (empty) or five or more characters long. lime i...
HTML attribute: required - HTML: Hypertext Markup Language
t) is required, but has no bearing on the optionality of the element. attribute interactions because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. usability when including the required attribute, provide a visible indication near the control informing the user that the input, select or textarea is required. in
addition, target required form controls with the :required pseudo-class, styling them in a way to indicate they are required. this improves usability for sited user. assistive technology should inform the user that the form control in mandatory based on the required attribute, but
adding aria-required="true" doesn't hurt, in case the browser / screen reader combination does not support required yet. ...
HTML attribute: size - HTML: Hypertext Markup Language
en it's the number of characters. this must be an integer value 0 or higher. if no size is specified, or an invalid value is specified, the input has no size declared, and the form control will be the default width based on the user agent. if css targets the element with properties impacting the width, css takes precedence. the size attribute has no impact on constraint validation. examples by
adding size on some input types, the width of the input can be controlled.
adding size on a select changes the height, definining how many options are visible in the closed state. <label for="fruit">enter a fruit</label> <input type="text" size="15" id="fruit"> <label for="vegetable">enter a vegetable</label> <input type="text" id="vegetable"> <select name="fruits" size="5"> <option>banana</optio...
HTML attribute: step - HTML: Hypertext Markup Language
nteger is valid, but floats, like 4.2, are not valid, as step defaults to 1. for 4.2 to be valid, step would have had to be set to any, 0.1, 0.2, or any the min value would have had to be a number ending in .2, such as <input type="number" min="-5.2"> min impact on step the value of min and step define what are valid values, even if the step attribute is not included, as step defaults to 0. we
add a big red border around invalid inputs: input:invalid { border: solid red 3px; } then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="mynumber" name="mynumber" type="number" step="2" min="1.2"> valid values include 1.2, 3.2, 5.2, 7.2, 9.2, 11.2, and so on. integers and even numbers follwed by .2 are not valid. as we included an ...
Block-level elements - HTML: Hypertext Markup Language
fications up to 4.01. in html5, this binary distinction is replaced with a more complex set of content categories. while the "inline" category roughly corresponds to the category of phrasing content, the "block-level" category doesn't directly correspond to any html5 content category, but "block-level" and "inline" elements combined together correspond to the flow content in html5. there are also
additional categories, e.g. interactive content. elements the following is a complete list of all html "block-level" elements (although "block-level" is not technically defined for elements that are new in html5). <
address> contact information. <article> article content. <aside> aside content. <blockquote> long ("block") quotation. <details> disclosure widget. <dialog> dialog box. <...
<acronym> - HTML: Hypertext Markup Language
s element. example <p>the <acronym title="world wide web">www</acronym> is only a component of the internet.</p> default styling though the purpose of this tag is purely for the convenience of the author, its default styling varies from one browser to another: some browsers, like internet explorer, do not style it differently than a <span> element. opera, firefox, chrome, and some others
add a dotted underline to the content of the element. a few browsers not only
add a dotted underline, but also put it in small caps; to avoid this styling,
adding something like font-variant: none in the css takes care of this case. it is therefore recommended that web authors either explicitly style this element, or accept some cross-browser variation. specifications specification s...
<area> - HTML: Hypertext Markup Language
html living standardthe definition of '<area>' in that specification. living standard html5the definition of '<area>' in that specification. recommendation html 4.01 specificationthe definition of '<area>' in that specification. recommendation ...
<aside>: The Aside element - HTML: Hypertext Markup Language
thub.com/mdn/interactive-examples and send us a pull request. content categories flow content, sectioning content, palpable content. permitted content flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. note that an <aside> element must not be a descendant of an <
address> element. implicit aria role complementary permitted aria roles feed, none, note, presentation, region, search dom interface htmlelement attributes this element only includes the global attributes. usage notes do not use the <aside> element to tag parenthesized text, as this kind of text is considered part of the main flow. examples using <as...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
uch special semantic information; use it only when no others fit. similarly, do not mark titles and headings using the <b> element. for this purpose, use the <h1> to <h6> tags. further, stylesheets can change the default style of these elements, with the result that they are not necessarily displayed in bold. it is a good practice to use the class attribute on the <b> element in order to convey
additional semantic information as needed (for example <b class="lead"> for the first sentence in a paragraph). this makes it easier to manage multiple use cases of <b> if your stylistic needs change, without the need to change all of its uses in the html. historically, the <b> element was meant to make text boldface. styling information has been deprecated since html4, so the meaning of the <b> ele...
<base>: The Document Base URL element - HTML: Hypertext Markup Language
specification status comment html living standardthe definition of '<base>' in that specification. living standard no change since last snapshot. html5the definition of '<base>' in that specification. recommendation specified the behavior of target html 4.01 specificationthe definition of '<base>' in that specification. recommendation
added the target attribute ...
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
values are: ltr: indicates that the text should go in a left-to-right direction. rtl: indicates that the text should go in a right-to-left direction. examples <!-- switch text direction --> <p>this text will go left to right.</p> <p><bdo dir="rtl">this text will go right to left.</bdo></p> result notes the html 4 specification did not specify events for this element; they were
added in xhtml. this is most likely an oversight. specifications specification status comment html living standardthe definition of '<bdo>' in that specification. living standard html5the definition of '<bdo>' in that specification. recommendation html 4.01 specificationthe definition of '<bdo>' in that specification. recommendation ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
4) firefox 32,767 pixels 32,767 pixels 472,907,776 pixels (i.e., 22,528 x 20,992) safari 32,767 pixels 32,767 pixels 268,435,456 pixels (i.e., 16,384 x 16,384) ie 8,192 pixels 8,192 pixels ? note: exceeding the maximum dimensions or area renders the canvas unusable — drawing commands will not work. examples html this code snippet
adds a canvas element to your html document. a fallback text is provided if a browser is unable to render the canvas, or if can't read a canvas. <canvas width="300" height="300"> an alternative text describing what your canvas displays. </canvas> javascript then in the javascript code, call htmlcanvaselement.getcontext() to get a drawing context and start drawing onto the canvas: const canvas ...
<col> - HTML: Hypertext Markup Language
table and b is the ordinal position of the column in the table. only after this selector the vertical-align property can be used. if the table does use a colspan attribute, the effect can be achieved by combining adequate css attribute selectors like [colspan=n], though this is not trivial. width this attribute specifies a default width for each column in the current column group. in
addition to the standard pixel and percentage values, this attribute might take the special form 0*, which means that the width of each column in the group should be the minimum width necessary to hold the column's contents. relative widths such as 0.5* also can be used. examples please see the <table> page for examples on <col>. specifications specification status comment ...
Content-Disposition - HTTP
age, or as the web page) or attachment (indicating it should be downloaded; most browsers presenting a 'save as' dialog, prefilled with the value of the filename parameters if present). content-disposition: inline content-disposition: attachment content-disposition: attachment; filename="filename.jpg" as a header for a multipart body the first parameter in the http context is always form-data.
additional parameters are case-insensitive and have arguments that use quoted-string syntax after the '=' sign. multiple parameters are separated by a semi-colon (';'). content-disposition: form-data content-disposition: form-data; name="fieldname" content-disposition: form-data; name="fieldname"; filename="filename.jpg" directives name is followed by a string containing the name of the html fi...
Content-Encoding - HTTP
press the media-type. when present, its value indicates which encodings were applied to the entity-body. it lets the client know how to decode in order to obtain the media-type referenced by the content-type header. the recommendation is to compress data as much as possible and therefore to use this field, but some types of resources, such as jpeg images, are already compressed. sometimes, using
additional compression doesn't reduce payload size and can even make the payload longer. header type entity header forbidden header name no syntax content-encoding: gzip content-encoding: compress content-encoding: deflate content-encoding: identity content-encoding: br // multiple, in the order in which they were applied content-encoding: gzip, identity content-enco...
Content-Language - HTTP
he default is that the content is intended for all language audiences. multiple language tags are also possible, as well as applying the content-language header to various media types and not only to textual documents. header type entity header forbidden header name no cors-safelisted response header yes cors-safelisted request header yes, with the
additional restriction that values can only be 0-9, a-z, a-z, space or *,-.;=. syntax content-language: de-de content-language: en-us content-language: de-de, en-ca directives language-tag multiple language tags are separated by comma. each language tag is a sequence of one or more case-insensitive subtags, each separated by a hyphen character ("-", %x2d). in most cases, a language tag ...
CSP: child-src - HTTP
tive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the child-src policy: content-security-policy: child-src <source>; content-security-policy: child-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: connect-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the connect-src policy: content-security-policy: connect-src <source>; content-security-policy: connect-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: font-src - HTTP
rective default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the font-src policy: content-security-policy: font-src <source>; content-security-policy: font-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: frame-ancestors - HTTP
me-ancestors <source> <source>; sources <source> can be one of the following: the frame-ancestors directive’s syntax is similar to a source list of other directives (e.g. default-src), but doesn't allow 'unsafe-eval' or 'unsafe-inline' for example. it will also not fall back to a default-src setting. only the sources listed below are allowed: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number, separated by spaces. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. single quotes surrounding the host are not allowed. examples: http://*.example.com: matches all attempts ...
CSP: frame-src - HTTP
this directive is absent, the user agent will look for the child-src directive (which falls back to the default-src directive). syntax one or more sources can be allowed for the frame-src policy: content-security-policy: frame-src <source>; content-security-policy: frame-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: img-src - HTTP
directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the img-src policy: content-security-policy: img-src <source>; content-security-policy: img-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: manifest-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the manifest-src policy: content-security-policy: manifest-src <source>; content-security-policy: manifest-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: media-src - HTTP
tive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the media-src policy: content-security-policy: media-src <source>; content-security-policy: media-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: navigate-to - HTTP
3 directive type navigation directive default-src fallback no. not setting this allows anything. syntax one or more sources can be set for the navigate-to policy: content-security-policy: navigate-to <source>; content-security-policy: navigate-to <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: object-src - HTTP
e default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the object-src policy: content-security-policy: object-src <source>; content-security-policy: object-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: prefetch-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the prefetch-src policy: content-security-policy: prefetch-src <source>; content-security-policy: prefetch-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
CSP: style-src - HTTP
tive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the style-src policy: content-security-policy: style-src <source>; content-security-policy: style-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip
address, as well as an optional url scheme and/or port number. the site's
address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme. m...
ReferenceError: assignment to undeclared variable "x" - JavaScript
reference page. errors about undeclared variable assignments occur in strict mode code only. in non-strict code, they are silently ignored. examples invalid cases in this case, the variable "bar" is an undeclared variable. function foo() { 'use strict'; bar = true; } foo(); // referenceerror: assignment to undeclared variable bar valid cases to make "bar" a declared variable, you can
add the var keyword in front of it. function foo() { 'use strict'; var bar = true; } foo(); ...
ReferenceError: reference to undefined property "x" - JavaScript
an object property which doesn't exist. there are two ways to access properties; see the property accessors reference page to learn more about them. examples invalid cases in this case, the property bar is an undefined property, so a referenceerror will occur. ...
SyntaxError: Unexpected token - JavaScript
t "x" error type syntaxerror what went wrong? a specific language construct was expected, but something else was provided. this might be a simple typo. examples expression expected for example, when chaining expressions, trailing commas are not allowed. ...
JavaScript error reference - JavaScript
each error is an object based upon the error object, and has a name and a message. errors displayed in the web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code. for a beginner's introductory tutorial on fixing javascript errors, see what went wrong? troubleshooting javascript. ...
arguments.callee - JavaScript
named function expressions, and for this reason you could not make a recursive function expression. for example, this syntax worked: function factorial (n) { return !(n > 1) ? 1 : factorial(n - 1) * n; } [1, 2, 3, 4, 5].map(factorial); but: [1, 2, 3, 4, 5].map(function(n) { return !(n > 1) ? 1 : /* what goes here? */ (n - 1) * n; }); did not. ...
arguments.length - JavaScript
the arguments.length property contains the number of arguments passed to the function. description the arguments.length property provides the number of arguments actually passed to a function. this can be more or less than the defined parameter's count (see function.length). examples using arguments.length in this example we define a function that can
add two or more numbers together. function
adder(base /*, n2, ... */) { base = number(base); for (var i = 1; i < arguments.length; i++) { base += number(arguments[i]); } return base; } note the difference between function.length and arguments.length specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification. ...
The arguments object - JavaScript
the list is to be unordered (bulleted), or "o" if the list is to be ordered (numbered). the function is defined as follows: function list(type) { var html = '<' + type + 'l><li>'; var args = array.prototype.slice.call(arguments, 1); html += args.join('</li><li>'); html += '</li></' + type + 'l>'; // end list return html; } you can pass any number of arguments to this function, and it
adds each argument as a list item to a list of the type indicated. for example: let listhtml = list('u', 'one', 'two', 'three'); /* listhtml is: "<ul><li>one</li><li>two</li><li>three</li></ul>" */ rest, default, and destructured parameters the arguments object can be used in conjunction with rest, default, and destructured parameters. function foo(...args) { return args; } foo(1, 2, 3); // ...
Rest parameters - JavaScript
ts object: rest parameters are only the ones that haven't been given a separate name (i.e. formally defined in function expression), while the arguments object contains all arguments passed to the function; the arguments object is not a real array, while rest parameters are array instances, meaning methods like sort, map, foreach or pop can be applied on it directly; the arguments object has
additional functionality specific to itself (like the callee property). from arguments to an array rest parameters have been introduced to reduce the boilerplate code that was induced by the arguments // before rest parameters, "arguments" could be converted to a normal array using: function f(a, b) { let normalarray = array.prototype.slice.call(arguments) // -- or -- let normalarray = []...
Array.prototype.reduce() - JavaScript
e // friends - an array of objects // where object field "books" is a list of favorite books let friends = [{ name: 'anna', books: ['bible', 'harry potter'], age: 21 }, { name: 'bob', books: ['war and peace', 'romeo and juliet'], age: 26 }, { name: 'alice', books: ['the lord of the rings', 'the shining'], age: 18 }] // allbooks - list which will contain all friends' books + //
additional list contained in initialvalue let allbooks = friends.reduce(function(accumulator, currentvalue) { return [...accumulator, ...currentvalue.books] }, ['alphabet']) // allbooks = [ // 'alphabet', 'bible', 'harry potter', 'war and peace', // 'romeo and juliet', 'the lord of the rings', // 'the shining' // ] remove duplicate items in an array note: if you are using an environment c...
Array.prototype.every() - JavaScript
begins. if existing elements of the array are changed, their value as passed to callback will be the value at the time every visits them. elements that are deleted are not visited. every acts like the "for all" quantifier in mathematics. in particular, for an empty array, it returns true. (it is vacuously true that all elements of the empty set satisfy any given condition.) polyfill every was
added to the ecma-262 standard in the 5th edition, and it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of every in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their origin...
Array.prototype.filter() - JavaScript
a function. filter() does not mutate the array on which it is called. the range of elements processed by filter() is set before the first invocation of callback. elements which are appended to the array (from callback) after the call to filter() begins will not be visited by callback. if existing elements of the array are deleted in the same way they will not be visited. polyfill filter() was
added to the ecma-262 standard in the 5th edition. therefore, it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of filter() in ecma-262 implementations which do not natively support it. this algorithm is exactly equivalent to the one specified in ecma-262, 5th edition, assuming that fn...
Array.prototype.flat() - JavaScript
for reference, please check: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 examples flattening nested arrays const arr1 = [1, 2, [3, 4]]; arr1.flat(); // [1, 2, 3, 4] const arr2 = [1, 2, [3, 4, [5, 6]]]; arr2.flat(); // [1, 2, 3, 4, [5, 6]] const arr3 = [1, 2, [3, 4, [5, 6]]]; arr3.flat(2); // [1, 2, 3, 4, ...
Array.prototype.forEach() - JavaScript
('a[' + index + '] = ' + element) } // notice that index 2 is skipped, since there is no item at // that position in the array... [2, 5, , 9].foreach(logarrayelements) // logs: // a[0] = 2 // a[1] = 5 // a[3] = 9 using thisarg the following (contrived) example updates an object's properties from each entry in the array: function counter() { this.sum = 0 this.count = 0 } counter.prototype.
add = function(array) { array.foreach((entry) => { this.sum += entry ++this.count }, this) // ^---- note } const obj = new counter() obj.
add([2, 5, 9]) obj.count // 3 obj.sum // 16 since the thisarg parameter (this) is provided to foreach(), it is passed to callback each time it's invoked. the callback uses it as its this value. note: if passing the callback function uses an arrow ...
Array.prototype.includes() - JavaScript
ot require this value to be an array object, so it can be applied to other kinds of objects (e.g. array-like objects). the example below illustrates includes() method called on the function's arguments object. (function() { console.log(array.prototype.includes.call(arguments, 'a')) // true console.log(array.prototype.includes.call(arguments, 'd')) // false })('a','b','c') please do not
add polyfills on reference articles. for more details and discussion, see https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.includes' in that specification. ...
Array.prototype.indexOf() - JavaScript
hen the whole array will be searched. default: 0 (entire array is searched). return value the first index of the element in the array; -1 if not found. description indexof() compares searchelement to elements of the array using strict equality (the same method used by the === or triple-equals operator). note: for the string method, see string.prototype.indexof(). polyfill indexof() was
added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers. you can work around this by utilizing the following code at the beginning of your scripts. this will allow you to use indexof() when there is still no native support. this algorithm matches the one specified in ecma-262, 5th edition, assuming typeerror and math.abs() have their original values. // this ...
Array.prototype.slice() - JavaScript
into the new array. both the original and new array refer to the same object. if a referenced object changes, the changes are visible to both the new and original arrays. for strings, numbers and booleans (not string, number and boolean objects), slice copies the values into the new array. changes to the string, number, or boolean in one array do not affect the other array. if a new element is
added to either array, the other array is not affected. examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slice(1, 3) // fruits contains ['banana', 'orange', 'lemon', 'apple', 'mango'] // citrus contains ['orange','lemon'] using slice> in the following example, slice creates a new array, newcar, from mycar. both incl...
Array.prototype.some() - JavaScript
ay after the call to some() begins will not be visited by callback. if an existing, unvisited element of the array is changed by callback, its value passed to the visiting callback will be the value at the time that some() visits that element's index. elements that are deleted are not visited. caution: calling this method on an empty array returns false for any condition! polyfill some() was
added to the ecma-262 standard in the 5th edition, and it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of some() in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their origina...
Array.prototype.unshift() - JavaScript
return value the new length property of the object upon which the method was called. description the unshift method inserts the given values to the beginning of an array-like object. unshift 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. ...
Array.prototype.values() - JavaScript
arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" for (let letter of iterator) { console.log(letter); } // undefined reason: when next().done=true or currentindex>length the for..of loop ends. see iteration protocols. value: there are no values stored in the array iterator object; instead it stores the
address of the array used in its creation and so depends on the values stored in that array. var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); console.log(iterator); // array iterator { } iterator.next().value; // "a" arr[1]='n'; iterator.next().value; // "n" if the values in the array changed the array iterator object values change too. todo: please write...
Atomics.load() - JavaScript
iguint64array. index the position in the typedarray to load from. return value the value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using load const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.
add(ta, 0, 12); atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.load' in that specification. ...
Date.prototype.setMonth() - JavaScript
ue returned from the getdate() method is used. if a parameter you specify is outside of the expected range, setmonth() attempts to update the date information in the date object accordingly. for example, if you use 15 for monthvalue, the year will be incremented by 1, and 3 will be used for month. the current day of month will have an impact on the behaviour of this method. conceptually it will
add the number of days given by the current day of the month to the 1st day of the new month specified as the parameter, to return the new date. for example, if the current value is 31st august 2016, calling setmonth with a value of 1 will return 2nd march 2016. this is because in 2016 february had 29 days. examples using setmonth() var thebigday = new date(); thebigday.setmonth(6); //watch out f...
Error.prototype.lineNumber - JavaScript
the linenumber property contains the line number in the file that raised this error. examples using linenumber var e = new error('could not parse input'); throw e; console.log(e.linenumber) // 2 alternative example using error event window.
addeventlistener('error', function(e) { console.log(e.linenumber); // 5 }); var e = new error('could not parse input'); throw e; this is not a standard feature and lacks widespread support. see the browser compatability table below. specifications not part of any standard. ...
Error.prototype.name - JavaScript
the name property represents a name for the type of error. the initial value is "error". description by default, error instances are given the name "error". the name property, in
addition to the message property, is used by the error.prototype.tostring() method to create a string representation of the error. examples throwing a custom error var e = new error('malformed input'); // e.name is 'error' e.name = 'parseerror'; throw e; // e.tostring() would return 'parseerror: malformed input' specifications specification ecmascript (ecma-262)the definition of 'error.prototype.name' in that specification. ...
Error - JavaScript
re consistent error handling code. see "what's a good way to extend error in javascript?" on stackoverflow for an in-depth discussion. es6 custom error class versions of babel prior to 7 can handle customerror class methods, but only when they are declared with object.defineproperty(). otherwise, old versions of babel and other transpilers will not correctly handle the following code without
additional configuration. some browsers include the customerror constructor in the stack trace when using es2015 classes. class customerror extends error { constructor(foo = 'bar', ...params) { // pass remaining arguments (including vendor specific ones) to parent constructor super(...params) // maintains proper stack trace for where our error was thrown (only available on v8) ...
Function() constructor - JavaScript
n constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. examples specifying arguments with the function constructor the following code creates a function object that takes two arguments. // example can be run directly in your javascript console // create a function that takes two arguments, and returns the sum of those arguments const
adder = new function('a', 'b', 'return a + b'); // call the function
adder(2, 6); // 8 the arguments "a" and "b" are formal argument names that are used in the function body, "return a + b". specifications specification ecmascript (ecma-262)the definition of 'function constructor' in that specification. ...
Function.prototype.apply() - JavaScript
note: many older browsers—including chrome <17 and internet explorer <9—don't accept array-like objects, and will throw an exception. examples using apply to append an array to another you can use push to append an element to an array. and, because push accepts a variable number of arguments, you can also push multiple elements at once. but, if you pass an array to push, it will actually
add that array as a single element, instead of
adding the elements individually. so you end up with an array inside an array. what if that is not what you want? concat does have the desired behaviour in this case, but it does not append to the existing array—it instead creates and returns a new array. but you wanted to append to the existing array... so what now? write a loop? surely not? apply ...
Function.prototype.call() - JavaScript
ce); this.category = 'food'; } function toy(name, price) { product.call(this, name, price); this.category = 'toy'; } const cheese = new food('feta', 5); const fun = new toy('robot', 40); using call to invoke an anonymous function in this example, we create an anonymous function and use call to invoke it on every object in an array. the main purpose of the anonymous function here is to
add a print function to every object, which is able to print the correct index of the object in the array. passing the object as this value is not strictly necessary, but is done for explanatory purpose. const animals = [ { species: 'lion', name: 'king' }, { species: 'whale', name: 'fail' } ]; for (let i = 0; i < animals.length; i++) { (function(i) { this.print = function() { con...
Intl.Locale.prototype.minimize() - 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 locale.minimize() return value a locale instance whose basename property returns the result of the remove likely subtags algorithm executed against locale.basename. ...
Intl.Locale.prototype.numberingSystem - JavaScript
traditio traditional numerals — may be algorithmic vaii vai digits wara warang citi digits wcho wancho digits examples setting the numberingsystem value via the locale string in the unicode locale string spec, the values that numberingsystem represents correspond to the key nu. nu is considered a locale string "extension subtag". these subtags
add additional data about the locale, and are
added to locale identifiers by first
adding the -u key. to set the numberingsystem value via the string argument to the locale constructor, first
add the -u extension key. next,
add the -nu extension key to indicate that you are
adding a value for numberingsystem. finally,
add the numberingsystem value to the string. let numberingsystemviastr = new intl.
Intl.Locale.prototype.region - JavaScript
guage conventions between those two countries. knowing the locale's region helps javascript programmers make sure that the content from their sites and applications is correctly displayed when viewed from different areas of the world. examples setting the region in the locale identifer string argument the region is the third part of a valid unicode language identifier string, and can be set by
adding it to the locale identifier string that is passed into the locale constructor. the region is a mandatory part of a let regionstr = new intl.locale("en-latn-us"); console.log(regionstr.region); // prints "us" setting the region via the configuration object the locale constructor takes a configuration object, which can be used to set the region subtag and property. let regionobj = new intl.
Intl.Locale.prototype.script - JavaScript
the language (which is necessary) is only written in a single script. there are exceptions to this rule, however, and it is important to indicate the script whenever possible, in order to have a complete unicode language identifier. examples setting the script in the locale identifer string argument the script is the second part of a valid unicode language identifier string, and can be set by
adding it to the locale identifier string that is passed into the locale constructor. note that the script is not a required part of a locale identifier. let scriptstr = new intl.locale("en-latn-us"); console.log(scriptstr.script); // prints "latn" setting the script via the configuration object the locale constructor takes a configuration object, which can be used to set the script subtag and pr...
Intl - JavaScript
nd implementations may not always be up to date, so be careful not to rely too much on tags being universally supported. bcp 47 also allows for extensions, each consisting of a single digit or letter (other than "x") and one or more two- to eight-letter or digit tags, all separated by hyphens. javascript internationalization functions use the "u" (unicode) extension, which can be used to request
additional customization of collator, numberformat, or datetimeformat objects. examples: "de-de-u-co-phonebk": use the phonebook variant of the german sort order, which interprets umlauted vowels as corresponding character pairs: ä → ae, ö → oe, ü → ue. "th-th-u-nu-thai": use thai digits (๐, ๑, ๒, ๓, ๔, ๕, ๖, ๗, ๘, ๙) in number formatting. "ja-jp-u-ca-japanese": use ...
JSON.stringify() - JavaScript
s a function, it takes two parameters: the key and the value being stringified. the object in which the key was found is provided as the replacer's this parameter. initially, the replacer function is called with an empty string as key representing the object being stringified. it is then called for each property on the object or array being stringified. it should return the value that should be
added to the json string, as follows: if you return a number, string, boolean, or null, the stringified version of that value is used as the property's value. if you return a function, symbol, or undefined, the property is not included in the output. if you return any other object, the object is recursively stringified, calling the replacer function on each property. note: you cannot use the ...
Map() constructor - JavaScript
the map() constructor creates map objects. syntax new map([iterable]) parameters iterable an array or other iterable object whose elements are key-value pairs. (for example, arrays with two elements, such as [[ 1, 'one' ],[ 2, 'two' ]].) each key-value pair is
added to the new map. examples creating a new map let mymap = new map([ [1, 'one'], [2, 'two'], [3, 'three'], ]) specifications specification ecmascript (ecma-262)the definition of 'map constructor' in that specification. ...
Map.prototype.forEach() - JavaScript
thisarg parameter is provided to foreach, it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. each value is visited once, except in the case when it was deleted and re-
added before foreach has finished. callback is not invoked for values deleted before being visited. new values
added before foreach has finished will be visited. foreach executes the callback function once for each element in the map object. it does not return a value. examples printing the contents of a map object the following code logs a line for each element in an map object: function logmap...
Math.hypot() - JavaScript
ast one of the arguments cannot be converted to a number, nan is returned. description calculating the hypotenuse of a right triangle, or the magnitude of a complex number, uses the formula math.sqrt(v1*v1 + v2*v2), where v1 and v2 are the lengths of the triangle's legs, or the complex number's real and complex components. the corresponding distance in 2 or more dimensions can be calculated by
adding more squares under the square root: math.sqrt(v1*v1 + v2*v2 + v3*v3 + v4*v4). this function makes this calculation easier and faster; you simply call math.hypot(v1, v2) , or math.hypot(v1, v2, v3, v4, ...). math.hypot also avoids overflow/underflow problems if the magnitude of your numbers is very large. the largest number you can represent in js is number.max_value, which is around 10308.
Math.log1p() - JavaScript
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 math.log1p(x) parameters x a number. return value the natural logarithm (base e) of 1 plus the given number. if the number is less than -1, nan is returned. description for very small values of x,
adding 1 can reduce or eliminate precision. the double floats used in js give you about 15 digits of precision. 1 + 1e-15 = 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 are rounded off. when you calculate log(1 + x), you should get an answer very close to x, if x is small (that's why these are called 'natural' logarithm...
Number - JavaScript
1)). number.min_value the smallest positive representable number—that is, the positive number closest to zero (without actually being zero). number.nan special "not a number" value. number.negative_infinity special value representing negative infinity. returned on overflow. number.positive_infinity special value representing infinity. returned on overflow. number.prototype allows the
addition of properties to the number object. static methods number.isnan() determine whether the passed value is nan. number.isfinite() determine whether the passed value is a finite number. number.isinteger() determine whether the passed value is an integer. number.issafeinteger() determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1). number.parsef...
Object.assign() - JavaScript
o a prototype if the merge sources contain getters. for copying property definitions (including their enumerability) into prototypes, use object.getownpropertydescriptor() and object.defineproperty() instead. both string and symbol properties are copied. in case of an error, for example if a property is non-writable, a typeerror is raised, and the target object is changed if any properties are
added before the error is raised. note: object.assign() does not throw on null or undefined sources. polyfill this polyfill doesn't support symbol properties, since es5 doesn't have symbols anyway: if (typeof object.assign !== 'function') { // must be writable: true, enumerable: false, configurable: true object.defineproperty(object, "assign", { value: function assign(target, varargs) {...
Object.prototype.constructor - JavaScript
umber(), 1, // remains unchanged new object(), {}, new regexp(), /(?:)/, new string(), 'test' // remains unchanged ] for (let i = 0; i < types.length; i++) { types[i].constructor = type types[i] = [types[i].constructor, types[i] instanceof type, types[i].tostring()] } console.log(types.join('\n')) this example displays the following output (comments
added for reference): function type() {},false, // new array() function type() {},false, // [] function type() {},false,false // new boolean() function boolean() { [native code] },false,true // true function type() {},false,mon sep 01 2014 16:03:...
Object.entries() - JavaScript
alue an array of the given object's own enumerable string-keyed property [key, value] pairs. description object.entries() returns an array whose elements are arrays corresponding to the enumerable string-keyed property [key, value] pairs found directly upon object. the ordering of the properties is the same as that given by looping over the property values of the object manually. ...
Object.fromEntries() - JavaScript
for more details, refer to: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 specifications specification ecmascript (ecma-262)the definition of 'object.fromentries' in that specification. ...
Object.isExtensible() - JavaScript
the object.isextensible() method determines if an object is extensible (whether it can have new properties
added to it). 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.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.preventextensions(), object.seal(), or object.free...
Object.keys() - JavaScript
operties are to be returned. return value an array of strings that represent all the enumerable properties of the given object. description object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. the ordering of the properties is the same as that given by looping over the properties of the object manually. ...
Object.prototype.__proto__ - JavaScript
for objects created using an object literal, this value is object.prototype. for objects created using array literals, this value is array.prototype. for functions, this value is function.prototype. for objects created using new fun, where fun is one of the built-in constructor functions provided by javascript (array, boolean, date, number, object, string, and so on — including new constructors
added as javascript evolves), this value is always fun.prototype. for objects created using new fun, where fun is a function defined in a script, this value is the value of fun.prototype. (that is, if the constructor didn't return an other object explicitly, or the fun.prototype has been reassigned since the instance was created.) the __proto__ setter allows the [[prototype]] of an object to be muta...
while - JavaScript
uates to true. to execute multiple statements within the loop, use a block statement ({ ... }) to group those statements. note: use the break statement to stop a loop before condition evaluates to true. examples using while the following while loop iterates as long as n is less than three. var n = 0; var x = 0; while (n < 3) { n++; x += n; } each iteration, the loop increments n and
adds it to x. therefore, x and n take on the following values: after 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. specifications specification ecmascript (ecma-262)the definition of 'while statement' in that spec...
Strict mode - JavaScript
ated as the result of eval. third, strict mode forbids deleting plain names. delete name in strict mode is a syntax error: 'use strict'; var x; delete x; // !!! syntax error eval('var y; delete y;'); // !!! syntax error making eval and arguments simpler strict mode makes arguments and eval less bizarrely magical. both involve a considerable amount of magical behavior in normal code: eval to
add or remove bindings and to change binding values, and arguments by its indexed properties aliasing named arguments. strict mode makes great strides toward treating eval and arguments as keywords, although full fixes will not come until a future edition of ecmascript. first, the names eval and arguments can't be bound or assigned in language syntax. all these attempts to do so are syntax errors: ...
Template literals (Template strings) - JavaScript
" raw strings the special raw property, available on the first argument to the tag function, allows you to access the raw strings as they were entered, without processing escape sequences. function tag(strings) { console.log(strings.raw[0]); } tag`string text line 1 \n string text line 2`; // logs "string text line 1 \n string text line 2" , // including the two characters '\' and 'n' in
addition, the string.raw() method exists to create raw strings—just like the default template function and string concatenation would create. let str = string.raw`hi\n${2+3}!`; // "hi\n5!" str.length; // 6 array.from(str).join(','); // "h,i,\,n,5,!" tagged templates and escape sequences es2016 behavior as of ecmascript 2016, tagged templates conform to the rules of the following escape seque...
JavaScript
ipt shell allows you to quickly test snippets of javascript code. learn javascript an excellent resource for aspiring web developers — learn javascript in an interactive environment, with short lessons and interactive tests, guided by automated assessment. the first 40 lessons are free, and the complete course is available for a small one-time payment. togetherjs collaboration made easy. by
adding togetherjs to your site, your users can help each other out on a website in real-time! stack overflow stack overflow questions tagged with "javascript". javascript versions and release notes browse javascript's feature history and implementation status. jsfiddle edit javascript, css, html and get live results. use external resources and collaborate with your team online. plunker plunke...
shortcuts - Web app manifests
type object mandatory no the shortcuts member defines an array of shortcuts or links to key tasks or pages within a web app. a user agent can use these values to assemble a context menu to be displayed by the operating system when a user engages with the web app's icon. when user invokes a shortcut, the user agent will navigate to the
address given by shortcut's url member. examples the following is a list of shortcuts a calendar app might have: "shortcuts" : [ { "name": "today's agenda", "url": "/today", "description": "list of events planned for today" }, { "name": "new event", "url": "/create/event" }, { "name": "new reminder", "url": "/create/reminder" } ] specification specification status comment...
<mfenced> - MathML
it has been removed from the latest mathml standard and modern browsers no longer support it. use the <mrow> and <mo> elements instead. attributes class, id, style provided for use with stylesheets. close a string for the closing delimiter. the default value is ")" and any white space is trimmed. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. ...
<mmultiscripts> - MathML
ript)* [ <mprescripts/> (presubscript presuperscript)* ] </mmultiscripts> after the base expression you can specify a postsubscript and a postsuperscript. prescripts are optional and are separated by the empty tag <mprescripts/> (only one <mprescripts /> element is allowed, otherwise you will get an duplicatemprescripts error in the error console and "invalid-markup" in your rendering). in
addition you are able to use <none/> as a placeholder for empty scripts (not for the base). see the examples section for a correct usage. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and h...
Web media technologies
the contents of an image. this can be used with media in many ways, including by setting a <canvas> element as the destination for video playback or camera capture so that you can capture and manipulate video frames. webgl webgl provides an opengl es compatible api on top of the existing canvas api, making it possible to do powerful 3d graphics on the web. through a canvas, this can be used to
add 3d imagery to media content. webxr webxr, which has replaced the now-obsolete webvr api, is a technology that provides support for creating virtual reality (vr) and augmented reality (ar) content. the mixed reality content can then be displayed on the device's screen or using goggles or a headset. ...
Critical rendering path - Web Performance
rotated or browser is otherwise resized. layout performance is impacted by the dom -- the greater the number of nodes, the longer layout takes. layout can become a bottleneck, leading to jank if required during scrolling or other animations. while a 20ms delay on load or orientation change may be fine, it will lead to jank on animation or scroll. any time the render tree is modified, such as by
added nodes, altered content, or updated box model styles on a node, layout occurs. to reduce the frequency and duration of layout events, batch updates and avoid animating box model properties. paint the last step is painting the pixels to the screen. once the render tree is created and layout occurs, the pixels can be painted to the screen. onload, the entire screen is painted. after that, only ...
Navigation and resource timings - Web Performance
is single document alone: for this resource alone, not for all the resources combined. however, the duration, load events and dom related timings have to do with the entire navigation, not this single asset. client-side web applications may seem faster than this one with transfer sizes under 10000 and decoded body sizes under 30000, but that doesn't mean javascript, css, or media assets aren't
adding bloat. checking compression ratios is important but ensure to also check duration and the time between when the domcontentloaded event ended and when the dom is complete, as running javascript on the main thread for long periods of time can lead to a non-responsive user interface. request time the api doesn't provide every measurement you may desire. for example, how long did the request tak...
Optimizing startup performance - Web Performance
nd turning them into raw texture data for later use by webgl), that's great to do in workers. when dealing with data supported by the browser (for example, decoding image data), use the decoders built into the browser or device rather than rolling your own or using one from the original codebase. the provided one is almost certainly significantly faster, and will reduce your app size to boot. in
addition, the browser may automatically parallelize these decoders. any data processing that can be done in parallel should be. don't do one chunk of data after another; do them all at once when possible! don't include scripts or stylesheets that don't participate in the critical path in your startup html file. load them only when needed. reduce the side of your javascript files. try to send the m...
Understanding latency - Web Performance
er the number of hostnames, the more dns lookups need to be done. connecting is the time it takes for a tcp handshake to complete. like dns, the greater the number of server connections needed, the more time is spend creating server connections. the tls handshake is how long it took to set up a secure connection. while a tls handshake does take longer to connect than an insecure connection, the
additional time needed for a secure connection is worth it. sending is the time taken to send the http request to the server. waiting is disk latency, the time it took for the server to complete its response. disk latency used to be the main area of performance concern. however server performance has improved as computer memory, or cpu, has improved. depending on the complexity of what is needed fr...
Privacy, permissions, and information security
ntify a specific person. as such, pii extends beyond the web to all aspects of life. for example, if a site leaks a list of users' names and zip codes online, a bad actor could almost certainly track down at least some percentage of those users by simply using the corresponding phone books. personally identification can include information like usernames, real names, passwords, phone numbers or
addresses (or even portions of them), information about medical history, social security numbers, driver licenses, or any other form of id or id number, credit card information, and so forth. it's a very broad range of information. whenever working with data, always stop and think: is there any way this can be used to even through many steps identify a specific person? privacy the concept of pr...
Web technology reference
of the page. introduction to html | learn html | html5 | developer guide | element reference | reference css — styling the web cascading style sheets are used to describe the appearance of web content. introduction to css | getting started with css | learn css | common css questions | reference javascript — dynamic client-side scripting the javascript programming language is used to
add interactivity and other dynamic features to web sites. learn javascript | developer guide | reference ...