Search completed in 1.53 seconds.
2437 results for "show":
Your results are loading. Please wait...
PaymentRequest.show() - Web APIs
the paymentrequest interface's show() method instructs the user agent to begin the process of showing and handling the user interface for the payment request to the user.
... for security reasons, the paymentrequest.show() method can't just be initiated at any time.
...once one paymentrequest's show() method has been called, any other call to show() will by rejected with an aborterror until the returned promise has been concluded, either by being fulfilled with a paymentresponse indicating the results of the payment request, or by being rejected with an error.
...And 17 more matches
NodeIterator.whatToShow - Web APIs
the nodeiterator.whattoshow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the nodeiterator.
... syntax var nodetypes = nodeiterator.whattoshow; the values that can be combined to form the bitmask are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes.
... nodefilter.show_attribute 2 shows attribute attr nodes.
...And 13 more matches
TreeWalker.whatToShow - Web APIs
the treewalker.whattoshow read-only property returns an unsigned long being a bitmask made of constants describing the types of node that must to be presented.
...the possible values are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes.
... nodefilter.show_attribute 2 shows attribute attr nodes.
...And 13 more matches
Window: pageshow event - Web APIs
the pageshow event is sent to a window when the browser displays the window's document due to navigation.
... this includes: initially loading the page navigating to the page from another page in the same window or tab restoring a frozen page on mobile oses returning to the page using the browser's forward or back buttons during the initial page load, the pageshow event fires after the load event.
... bubbles no cancelable no interface pagetransitionevent event handler property onpageshow examples this example sets up event handlers for events listed in the array events.
...And 4 more matches
HTMLDialogElement.showModal() - Web APIs
the showmodal() method of the htmldialogelement interface displays the dialog as a modal, over the top of any other dialogs that might be present.
... syntax dialoginstance.showmodal(); parameters none.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
...And 3 more matches
Window.showModalDialog() - Web APIs
the window.showmodaldialog() created and displayed a modal dialog box containing a specified html document.
... syntax returnval = window.showmodaldialog(uri[, arguments][, options]); returnval holds the returnvalue property as set by the document specified by uri.
... examples try out showmodaldialog().
...And 3 more matches
HTMLDialogElement.show() - Web APIs
the show() method of the htmldialogelement interface displays the dialog modelessly, i.e.
... syntax dialoginstance.show(); parameters none.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the show() method.
...And 2 more matches
ServiceWorkerRegistration.showNotification() - Web APIs
the shownotification() method of the serviceworkerregistration interface creates a notification on an active service worker.
... syntax ​serviceworkerregistration.shownotification(title, [options]); parameters title the title that must be shown within the notification options optional an object that allows configuring the notification.
... title: a domstring containing action text to be shown to the user.
...And 2 more matches
:placeholder-shown - CSS: Cascading Style Sheets
the :placeholder-shown css pseudo-class represents any <input> or <textarea> element that is currently displaying placeholder text.
... /* selects any element with an active placeholder */ :placeholder-shown { border: 2px solid silver; } syntax :placeholder-shown examples basic example this example applies special font and border styles when the placeholder is shown.
... html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way.
...And 2 more matches
mozbrowsershowmodalprompt
the mozbrowsershowmodalprompt event is fired when the content of a browser <iframe> calls the window.alert(), window.confirm(), or window.prompt() methods.
...for that event, it's always showmodalprompt.
... example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsershowmodalprompt", function( event ) { console.log("asking for prompt:" + json.stringify(event.detail)); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
javascript.options.showInConsole
the preference javascript.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console.
... type:boolean default value: false (true in debug builds) exists by default: yes application support:firefox 1.0 status: active introduction:2002-02-26 bugs: bug 125181 bug 337875 values false only errors and warnings from content code are shown.
... true (default) errors and warnings from both chrome and content are shown in the error console.
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
tutorial: show allocations per call path this page shows how to use the debugger api to show how many objects a web page allocates, sorted by the function call path that allocated them.
...this stops logging allocations, and displays a tree of allocations: an allocation plot, displayed in the console the numbers at the left edge of each line show the total number of objects allocated at that site or at sites called from there.
...indeed, this display shows that popup.xml and content.js, which are internal components of firefox, allocated more objects in the page's compartment than the page itself.
MSCandidateWindowShow - Web APIs
mscandidatewindowshow fires immediately after the input method editor (ime) candidate window is set to appear, but before it renders.
... syntax event property object.oncandidatewindowshow = handler; addeventlistener method object.addeventlistener("mscandidatewindowshow", handler, usecapture) parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event.
... example in ie11, developers can detect the opening of the ime candidate window by listening to mscandidatewindowshow event, then call getcandidatewindowclientrect() function to find out where the candidate window is and position the suggestion ui away from it: var context = document.getelementbyid("mysearchbox").msgetinputcontext(); context.addeventlistener("mscandidatewindowshow", candidatewindowshowhandler); function candidatewindowshowhandler(e) { var imerect = context.getcandidatewindowclientrect(); ...
xlink:show - SVG: Scalable Vector Graphics
the xlink:show attribute indicates how a linked resource should be opened and is meant for xlink-aware processors.
... embed this value specifies that instead of linking to the resource it will be loaded and shown within the document.
... specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'xlink:show' in that specification.
showcaret - Archive of obsolete content
« xul reference home showcaret type: boolean whether or not to cause a typing caret to be visible in the content area.
... examples <iframe id="content-body" src="http://www.mozilla.org/" showcaret="true"/> <browser src="http://www.mozilla.org" flex="1" showcaret="true"/> ...
showpopup - Archive of obsolete content
« xul reference home showpopup type: boolean note: applies to: thunderbird, seamonkeyif true, the popup will be shown.
... if false, the popup will not be shown, but the autocomplete results will still be available.
showPopup - Archive of obsolete content
« xul reference home showpopup( element, x, y, popuptype, anchor, align ) deprecated since gecko 1.9 return type: no return value deprecated in favor of openpopup and openpopupatscreen opens a popup element.
...this is what you might do to show a popup below a button, for example.
Element: show event - Web APIs
the show event is fired when a contextmenu event was fired on/bubbled to an element that has a contextmenu attribute.
... bubbles no cancelable no interface event event handler property onshow examples <div contextmenu="test"></div> <menu type="context" id="test"> <menuitem label="alert" onclick="alert('the alert label has been clicked')" /> </menu> <script> document.getelementbyid("test").addeventlistener("show", function(e){ alert("the context menu will be displayed"); }, false); </script> specifications specification status html5the definition of 'show event' in that specification.
Notification.onshow - Web APIs
the onshow property of the notification interface specifies an event listener to receive show events.
... syntax notification.onshow = function() { ...
onpopupshowing - Archive of obsolete content
« xul reference home onpopupshowing type: script code this event is sent to a popup just before it is opened.
onpopupshown - Archive of obsolete content
« xul reference home onpopupshown type: script code this event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.
showcommentcolumn - Archive of obsolete content
« xul reference home showcommentcolumn new in thunderbird 3requires seamonkey 2.0 type: boolean if true, a comment column appears in the popup.
showimagecolumn - Archive of obsolete content
« xul reference home showimagecolumn type: boolean if true, an image column appears in the popup.
tabmodalPromptShowing - Archive of obsolete content
« xul reference home tabmodalpromptshowing type: integer the number of tab modal prompts currently attached to the current tab.
textbox.showCommentColumn - Archive of obsolete content
« xul reference home showcommentcolumn obsolete since gecko 1.9.1 type: boolean if true, a comment column appears in the popup.
popupshowing - Archive of obsolete content
the popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible.
popupshown - Archive of obsolete content
the popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.
showOnlyTheseTabs - Archive of obsolete content
« xul reference home showonlythesetabs( atabs ) return type: no return value makes all tabs in the atabs array visible, and all other tabs hidden.
showPane - Archive of obsolete content
« xul reference home showpane( prefpane ) return type: no return value switch to a particular pane.
showCommentColumn - Archive of obsolete content
« xul reference showcommentcolumn type: boolean gets and sets the value of the showcommentcolumn (or showcommentcolumn) attribute.
showImageColumn - Archive of obsolete content
« xul reference showimagecolumn type: boolean gets and sets the value of the showimagecolumn attribute.
showPopup - Archive of obsolete content
« xul reference showpopup type: boolean gets and sets the value of the showpopup attribute.
PRAccessHow
this is the declaration for the enumeration praccesshow, used in the how parameter of pr_access: #include <prio.h> typedef enum praccesshow { pr_access_exists = 1, pr_access_write_ok = 2, pr_access_read_ok = 3 } praccesshow; see pr_access for what each of these values mean.
Index - Web APIs
WebAPIIndex
276 beforeinstallpromptevent.prompt() api, beforeinstallpromptevent, experimental, method, reference, prompt the prompt() method of the beforeinstallpromptevent interface allows a developer to show the install prompt at a time of their own choosing.
...if the calling script doesn't have permission to show popups, openwindow() will throw an invalidaccesserror.
... 647 comment api, dom, reference the comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view.
...And 46 more matches
panel - Archive of obsolete content
the screenshot below shows a panel whose content is built from the list of currently open tabs: panels are useful for presenting temporary interfaces to users in a way that is easier for users to ignore and dismiss than a modal dialog, since panels are hidden the moment users interact with parts of the application interface outside them.
... a panel's content is loaded as soon as it is created, before the panel is shown, and the content remains loaded when a panel is hidden, so it is possible to keep a panel around in the background, updating its content as appropriate in preparation for the next time it is shown.
... your add-on can receive notifications when a panel is shown or hidden by listening to its show and hide events.
...And 38 more matches
Index - Archive of obsolete content
we will show how to do each of these things using the built-in components object provided by xulrunner application such as firefox and thunderbird.
... 269 adding menus and submenus add-ons, codingscripting, macs, xul, apple the hello world example in the previous sections shows the two most common ways to add menus.
...the new design clearly shows what some experts have been saying: that standards-based design can be visually compelling and preserve the interface conventions we've come to expect from web pages.
...And 35 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
fixme: explain how setting this option and use next listings if we want to run firefox displaying none of its gui and only the contents of a certain xul file, we can launch firefox and set the option: -chrome file_url.xul another way, as shown in listing 1, is to use the window.opendialog() method, which can be used only within a xul window.
... window.opendialog('another.xul', '_blank','chrome,all,dialog=no'); listing 1: opening a window without the firefox gui xul as an xml application listing 2 shows an example of a gui definition file marked up in xul (a "xul document").
...as shown in listing 3, elements can be laid out horizontally using the hbox (horizontal box) element or vertically using the vbox (vertical box) element.
...And 30 more matches
Places utilities for JavaScript
organizer_folder_anno - this annotation is associated with a folder that should be shown in the library's left pane.
... organizer_query_anno - this annotation is used by the places organizer to decide what nodes should be shown in the left pane.
... string wrapnode(nsinavhistoryresultnode anode, string atype, nsiuri aoverrideuri); array unwrapnodes(string blob, string atype); nsitransaction maketransaction(string data, string type, nsinavhistoryresultnode container, int index, boolean copy); nsinavhistoryresult getfoldercontents(int afolderid, boolean aexcludeitems, boolean aexpandqueries); boolean showaddbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showminimaladdbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showaddlive...
...And 29 more matches
Menu - Archive of obsolete content
ArchiveMozillaJetpackUIMenu
context is an object describing the context in which the menu was shown.
... beforeshow function a function invoked just before the menu is shown.
... if the menu is a context menu, it is called as beforeshow(menu, context) and otherwise as beforeshow(menu).
...And 26 more matches
PopupEvents - Archive of obsolete content
popupshowing this event is fired on a menupopup, panel or tooltip just before it is made visible.
... popupshown this event is fired on a menupopup, panel or tooltip once it is visible on screen.
... the popupshowing event just before a popup is about to be displayed, a popupshowing event will fired on the popup.
...And 21 more matches
ui/sidebar - Archive of obsolete content
you specify its content using html, css, and javascript, and the user can show or hide it in the same way they can show or hide the built-in sidebars.
... usage creating, showing, and hiding sidebars you construct a sidebar object using the sidebar() constructor.
... once you've done that, you can show the sidebar by calling the sidebar's show() method.
...And 20 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
listing 1 shows how you can use xpconnect to acquire references to xpcom services and create new xpcom objects.
...you should now see the confirmation dialog shown in figure 1.
... editing prefs.js opening test.xul will produce the dialog shown in figure 1.
...And 20 more matches
Network request list - Firefox Developer Tools
the request list of the network monitor shows a list of all the network requests made in the course of loading the page.
... network request list by default, the network monitor shows a list of all the network requests made in the course of loading the page.
... image thumbnails if the request is for an image, hovering over its filename shows a preview of the image in a tooltip: security icons the network monitor displays an icon in the domain column: this gives you extra information about the security status of the request: icon meaning https weak https (for example, a weak cipher was used) failed https (for example, a certificate was invalid) http ...
...And 19 more matches
Migrating from Firebug - Firefox Developer Tools
it shows log information associated with a web page and allows you to execute javascript expressions via its command line.
...the difference is that they show the properties and methods within a side panel inside the web console.
... show network requests the console panel in firebug allows to log ajax requests (aka xmlhttprequests).
...And 18 more matches
Index - Archive of obsolete content
ArchiveMozillaXULIndex
4 accessibility/xul accessibility reference accessibility, xul this table is designed to show how to expose text properly for various xul element types.
... 239 onpageshow xul attributes, xul reference no summary!
... 243 onpopupshowing xul attributes, xul reference no summary!
...And 17 more matches
Console messages - Firefox Developer Tools
this is not shown by default: you can opt to see timestamps by selecting show timestamps in the console settings menu (gear icon in the console toolbar).
... message categories network network log messages are not shown by default.
... use the filtering feature to show them.
...And 17 more matches
Document.createTreeWalker() - Web APIs
syntax document.createtreewalker(root, whattoshow[, filter[, entityreferenceexpansion]]); parameters root a root node of this treewalker traversal.
... whattoshow optional a unsigned long representing a bitmask created by combining the constant properties of nodefilter.
...it defaults to 0xffffffff representing the show_all constant.
...And 16 more matches
Document.createNodeIterator() - Web APIs
syntax const nodeiterator = document.createnodeiterator(root[, whattoshow[, filter]]); values root the root node at which to begin the nodeiterator's traversal.
... whattoshow optional is an optional unsigned long representing a bitmask created by combining the constant properties of nodefilter.
...it defaults to 0xffffffff representing the show_all constant.
...And 15 more matches
ui/toolbar - Archive of obsolete content
showing and hiding toolbars by default, a toolbar is shown when it is created, although you can specify that a toolbar should be hidden initially by passing hidden:true as an option in its constructor.
... after that, though, you can't show or hide the toolbar programmatically.
... toolbars get a close button at the right-hand side, and users can show or hide the toolbar using the firefox "view/toolbars" menu, alongside built-in toolbars like the bookmarks toolbar.
...And 14 more matches
Debugging CSS - Learn web development
this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you to find out what is going on.
...the browser will also normalize all of the html, and the dom will also show any changes made by javascript.
...the html tree in your devtools shows exactly what the browser is rendering at any given time, so it gives you an insight into what is really going on.
...And 14 more matches
context-menu - Archive of obsolete content
for example, a good use of the menu would be to show an "edit image" item when the user right-clicks an image in the page.
... a bad use would be to show a submenu that listed all the user's tabs, since tabs aren't related to the page or the node the user clicked to open the menu.
... when you need more control over the context in which your menu items are shown, you can use content scripts.
...And 13 more matches
HTML text fundamentals - Learn web development
if you get stuck, press the show solution button to see the answer.
... my legs are made of cardboard and i am married to a fish.</textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector...
...('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); var htmlsolution = '<h1>my short story</h1>\n<p>i am a statistician and my name is trish.</p>\n<p>my legs are made of cardboard and i am married to a fish.</p>'; var solutionentry = htmlsolution; textarea.a...
...And 13 more matches
Third-party APIs - Learn web development
this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter.
...in this case we specify the coordinates of the center of the map, a map layer of type map to show (created using the mapquest.tilelayer() method), and the default zoom level.
...the server you are connecting to handles all the complicated stuff, like displaying the correct map tiles for the area being shown, etc.
...And 13 more matches
Handling common JavaScript problems - Learn web development
for a light introduction; you should also study examples like this one, which shows a typical pattern of saving a this scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct this scope.
...if we look at the source code, the relevant code section is this: function showheroes(jsonobj) { let heroes = jsonobj['members']; for(i = 0; i < heroes.length; i++) { ...
...this is supposed to be fetched from an external .json file using the following xmlhttprequest call: let requesturl = 'https://mdn.github.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.
...And 13 more matches
Index - Firefox Developer Tools
25 tutorial: set a breakpoint this page shows how you can try out the debugger api yourself using firefox’s scratchpad.
... 26 tutorial: show allocations per call path debugger, tools, tutorial this page shows how to use the debugger api to show how many objects a web page allocates, sorted by the function call path that allocated them.
...underneath the magnifying glass it shows the color value for the current pixel using whichever scheme you've selected in settings > inspector > default color unit: 34 index tools found 158 pages: 35 json viewer firefox includes a json viewer.
...And 13 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
true javascript.options.showinconsole (present in firefox 3.5+) outputs javascript errors to the error console.
...create folders and files in your work folder as shown in figure 4.
... create install manifest fill in the install.rdf file as shown in listing 1.
...And 12 more matches
2D maze game with device orientation - Game development
boot will take care of initializing a few settings, preloader will load all of the assets like graphics and audio, mainmenu is the menu with the start button, howto shows the "how to play" instructions and the game state lets you actually play the game.
... var ball = { _width: 320, _height: 480 }; ball.boot = function(game) {}; ball.boot.prototype = { preload: function() { this.load.image('preloaderbg', 'img/loading-bg.png'); this.load.image('preloaderbar', 'img/loading-bar.png'); }, create: function() { this.game.scale.scalemode = phaser.scalemanager.show_all; this.game.scale.pagealignhorizontally = true; this.game.scale.pagealignvertically = true; this.game.state.start('preloader'); } }; the main ball object is defined and we're adding two variables called _width and _height that are the width and the height of the game canvas — they will help us position the elements on the screen.
... we're loading two images first that will be used later in the preload state to show the progress of loading all the other assets.
...And 12 more matches
Network request details - Firefox Developer Tools
http response headers http request headers each section has a disclosure triangle to expand the section to show more information.
... request information the following information is shown only when the section is expanded: scheme: the scheme used in the url host: the server involved in the request filename: the full path to the file requested address: the ip address of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request.
...(see referrer-policy for a description of possible values) blocking: if the request is to a site that is associated with a known tracker, an icon and a message are shown; otherwise, this field is not shown.
...And 12 more matches
NodeIterator - Web APIs
syntax a nodeiterator can be created using the document.createnodeiterator() method, as follows: const nodeiterator = document.createnodeiterator(root, whattoshow, filter); properties this interface doesn't inherit any property.
... nodeiterator.whattoshow read only returns an unsigned long being a bitmask made of constants describing the types of node that must to be presented.
... the possible values are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes.
...And 12 more matches
TreeWalker - Web APIs
treewalker.whattoshow read only returns an unsigned long being a bitmask made of constants describing the types of node that must be presented.
...the possible values are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes.
... nodefilter.show_attribute 2 shows attribute attr nodes.
...And 12 more matches
Examples and demos from articles - Archive of obsolete content
determine if an element has been totally scrolled [html] this example shows how to determine whether a user has completely scrolled an element or not.
....[article] pure-css web gallery based on the :hover pseudoclass [zip] you can use the :hover pseudo-class in order to build an image gallery with full-size images shown only when mouse goes over previews.
... .[article] pure-css web gallery based on the :checked pseudoclass [zip] you can also use the :checked pseudo-class applied to hidden radioboxes in order to build, for example, an image gallery with full-size images shown only when mouse clicks on previews.
...And 11 more matches
What are browser developer tools? - Learn web development
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.
...three ways: keyboard: ctrl + shift + i, except internet explorer and edge: f12 macos: ⌘ + ⌥ + i menu bar: firefox: menu ➤ web developer ➤ toggle tools, or tools ➤ web developer ➤ toggle tools chrome: more tools ➤ developer tools safari: develop ➤ show web inspector.
... if you can't see the develop menu, go to safari ➤ preferences ➤ advanced, and check the show develop menu in menu bar checkbox.
...And 11 more matches
Getting started with HTML - Learn web development
if you get really stuck, press the show solution button to see the answer.
...</textarea> <div class="controls"> <input id="reset" type="button" value="reset" /> <input id="solution" type="button" value="show solution" /> </div> html { font-family: 'open sans light',helvetica,arial,sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'...
...); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); var htmlsolution = '<em>this is my text.</em>'; var solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', update...
...And 11 more matches
Making decisions in your code — conditionals - Learn web development
in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime.
...if you help me by going and doing the shopping, i'll give you some extra allowance so you can afford that toy you wanted." in javascript, we could represent this like so: let shoppingdone = false; if (shoppingdone === true) { let childsallowance = 10; } else { let childsallowance = 5; } this code as shown always results in the shoppingdone variable returning false, meaning disappointment for our poor child.
...we then use a conditional statement to show different text inside the paragraph depending on what the value of choice is.
...And 11 more matches
Following the Android Toasts Tutorial from a JNI Perspective
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 privileged javascript scope via the nativewindow object.
... the java code example above can be done with privileged javascript from firefox for android with the following code: window.nativewindow.toast.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.
...And 11 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
the following code shows blocks designated for internet explorer: .
... tooltips legacy browsers introduced tooltips into html by showing them on links and using the value of the alt attribute as a tooltip's content.
...modern browsers will use the title attribute to display tooltips, and mozilla only supports showing tooltips for that attribute and not the alt attribute.
...And 10 more matches
Client-side form validation - Learn web development
add a required attribute to your input, as shown below.
...entered numbers outside this range will show as invalid; users won't be able to use the increment/decrement arrows to move the value outside of this range.
...this means that floats, like 3.2, will also show as invalid.
...And 10 more matches
Eclipse CDT
to show a filterable list of open documents (similar to the way emacs gives you a list of open buffers), use cmd-e/ctrl-e.
...note that there are buttons to the right of the "open call hierarchy" tab that open to switch between "show callers" and "show callees".
...note that you can switch between "show the type hierarchy", "show the supertype hierarchy", and "show the subtype hierarchy" using the buttons to the right of the "type hierarchy" tab.
...And 10 more matches
nsIUpdatePrompt
toolkit/mozapps/update/nsiupdateservice.idlscriptable this interface describes an object that can be used to show various update-related notifications to the user.
... 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void checkforupdates(); void showupdateavailable(in nsiupdate update); void showupdatedownloaded(in nsiupdate update, [optional] in boolean background); void showupdateerror(in nsiupdate update); void showupdatehistory(in nsidomwindow parent); void showupdateinstalled(); methods checkforupdates() presents a user interface that checks for and displays the available updates.
...showupdateavailable() shows a message advising the user that an update is available to be downloaded and installed.
...And 10 more matches
Using the Payment Request API - Web APIs
ils() { // hardcoded for demo purposes: return { id: 'order-123', displayitems: [ { label: 'example item', amount: {currency: 'usd', value: '1.00'} } ], total: { label: 'total', amount: {currency: 'usd', value: '1.00'} } }; } starting the payment process once the paymentrequest object has been created, you call the paymentrequest.show() method on it to initiate the payment request.
... 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.
...made new paymentrequest(buildsupportedpaymentmethoddata(), {total: {label: 'stub', amount: {currency: 'usd', value: '0.01'}}}) .canmakepayment() .then(function(result) { if(result) { // real payment request var request = new paymentrequest(buildsupportedpaymentmethoddata(), checkoutobject); request.show().then(function(paymentresponse) { // here we would process the payment.
...And 10 more matches
calICalendarView - Archive of obsolete content
for instance, when the showdate method of the the calendar-multiday-view (an implementation of this interface) will sometimes show an entire week of dates, and sometimes show only the single date passed in.
... interface code [scriptable, uuid(3e567ccb-2ecf-4f59-b7ca-bf42b0fbf24a)] interface calicalendarview : nsisupports { attribute calicalendar displaycalender; attribute calicalendarviewcontroller controller; void showdate(in calidatetime adate); void setdaterange(in calidatetime astartdate, in calidatetime aenddate); readonly attribute calidatetime startdate; readonly attribute calidatetime enddate; readonly attribute boolean supportsdisjointdates; readonly attribute boolean hasdisjointdates; void setdatelist(in unsigned long acount, [array,size_is(acount)] in calidatetime adates); void getdate...
...as implemented here, it corresponds to the calendar containing all of the calievents and calitodos that shoud be shown in the view.
...And 9 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
password-based authentication figure 4 shows the basic steps involved in authenticating a client by means of a name and password.
... these are the steps shown in figure 4: in response to an authentication request from the server, the client displays a dialog box requesting the user's name and password for that server.
... as shown in the next section, one of the advantages of certificate-based authentication is that it can be used to replace the first three steps in figure 4 with a mechanism that allows the user to supply just one password (which is not sent across the network) and allows the administrator to control user authentication centrally.
...And 9 more matches
Index - Learn web development
at, accessibility, article, beginner, css, codingscripting, 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.
... 54 introducing asynchronous javascript beginner, codingscripting, guide, introducing, javascript, learn, promises, async, asynchronous, await, callbacks in this article we briefly recap the problems associated with synchronous javascript, and take a first look at some of the different asynchronous techniques you'll encounter, showing how they can help us solve such problems.
... 59 fetching data from the server api, article, beginner, codingscripting, fetch, json, javascript, learn, promises, server, xhr, xml, xmlhttprequest, data, request this article shows how to start working with both xhr and fetch to fetch data from the server.
...And 9 more matches
nsIPromptService
(button_title_yes *button_pos_0) +(button_title_no * button_pos_1) methods alert() alert shows an alert dialog with an ok button.
...alertcheck() shows an alert dialog with an ok button and a labeled checkbox.
...confirm() shows a dialog with ok and cancel buttons.
...And 9 more matches
Examine and edit CSS - Firefox Developer Tools
inactive rules (not shown): if a rule is inactive (e.g., padding on a :visited pseudo-element), it is colored gray, with an info icon that gives more information when clicked.
... filter rules containing this property: next to overridden declarations is an icon you can click to filter the rules list to show only those rules that include that property.
... to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser styles" under the developer tool settings panel.
...And 9 more matches
Event reference
pageshow a session history entry is being traversed to.
... storage events change (see non-standard events) storage update events checking downloading error noupdate obsolete updateready value change events broadcast checkboxstatechange hashchange input radiostatechange readystatechange valuechange uncategorized events invalid message message open show less common and non-standard events abortable fetch events event name fired when abort a dom request is aborted, i.e.
... svg events svgabort svgerror svgload svgresize svgscroll svgunload svgzoom database events abort blocked complete error success upgradeneeded versionchange script events afterscriptexecute beforescriptexecute menu events dommenuitemactive dommenuiteminactive window events close popup events popuphidden popuphiding popupshowing popupshown tab events visibilitychange battery events chargingchange chargingtimechange dischargingtimechange levelchange call events alerting busy callschanged cfstatechange connecting dialing disconnected disconnecting error held, holding incoming resuming statechange voicechange sensor events compassneedscalibration devicemotion deviceorientation orientationchange smartcard events icccardlockerror iccinfoc...
...And 9 more matches
Details of the object model - JavaScript
the employee example the remainder of this chapter uses the employee hierarchy shown in the following figure.
... this section shows how to use very simple (and comparatively inflexible) definitions to demonstrate how to get the inheritance to work.
...cript (using this may cause an error for the following examples) class employee { constructor() { this.name = ''; this.dept = 'general'; } } javascript ** (use this instead) function employee() { this.name = ''; this.dept = 'general'; } java public class employee { public string name = ""; public string dept = "general"; } the manager and workerbee definitions show the difference in how to specify the next object higher in the inheritance chain.
...And 9 more matches
Advanced text formatting - Learn web development
if you get really stuck, press the show solution button to see the answer.
...a light brown color.</textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.query...
...selector('.output'); const code = textarea.value; const userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); const htmlsolution = '<dl>\n <dt>bacon</dt>\n <dd>the glue that binds the world together.</dd>\n <dt>eggs</dt>\n <dd>the glue that binds the cake together.</dd>\n <dt>coffee</dt>\n <dd>the drink ...
...And 8 more matches
Graceful asynchronous programming with Promises - Learn web development
this article shows you how promises work, how you'll see them in use with web apis, and how to write your own.
...it then calls getusermedia(), asking for a stream that has both video and audio tracks, then once that's been obtained, sets up a video element to show the stream coming from the camera as a "self view," then takes each of the stream's tracks and adds them to the webrtc rtcpeerconnection representing a connection to another user.
... you could even do this, since the functions just pass their arguments directly, so there isn't any need for that extra layer of functions: choosetoppings().then(placeorder).then(collectorder).then(eatpizza).catch(failurecallback); this is not quite as easy to read, however, and this syntax might not be usable if your blocks are more complex than what we've shown here.
...And 8 more matches
Useful string methods - Learn web development
you could use this to find all instances of strings that don't contain the substring 'mozilla', or do, if you use the negation operator, as shown below.
... each example comes with a "reset" button, which you can use to reset the code if you make a mistake and can't get it working again, and a "show solution" button you can press to see a potential answer if you get really stuck.
... // your conditional test needs to go inside the parentheses // in the line below, replacing what's currently there if (greetings[i]) { let listitem = document.createelement('li'); listitem.textcontent = input; list.appendchild(listitem); } } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; l...
...And 8 more matches
Index
the signature is verified if it can be shown that the signature data block must have been produced by the owner of the public key (because only that owner has the associated private key).
... this program shows the following: 177 nss sample code sample_1_hashing examples, nss, security this is an example program that demonstrates how to compute the hash of a file and save it to another file.
... this code shows the following: 181 nss sample code sample2 no summary!
...And 8 more matches
DevTools API - Firefox Developer Tools
showtoolbox(target [, toolid [, hosttype [, hostoptions]]]) opens a toolbox for given target either by creating a new one or activating an existing one.
...if unspecified the previously active tool is shown.
... tooldefinition a tooldefinition object contains all the required information for a tool to be shown in the toolbox.
...And 8 more matches
Waterfall - Firefox Developer Tools
recorded operations, called markers, are shown as horizontal bars, laid out in a waterfall to reflect the serial nature of the browser's execution.
... new in firefox 46: if the gc event was caused by allocation pressure, a link appears, labeled "show allocation triggers".
...if this is inside a callback from a promise, this will also show the "async stack".
...And 8 more matches
TextTrack.mode - Web APIs
WebAPITextTrackmode
the texttrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing.
... safari additionally requires the default boolean attribute to be set to true when implementing your own video player controls in order for the subtitles cues to be shown.
... syntax var mode = texttrack.mode; texttrack.mode = "disabled" | "hidden" | "showing"; value a domstring which indicates the track's current mode.
...And 8 more matches
Listening to events in Firefox extensions - Archive of obsolete content
pageshow dispatched when a page is newly displayed.
... if the page contains scripts or other behaviors that fire during loading that you want to continue to execute every time the user navigates to the page, or if you want to know when a user has navigated to a cached page, use the new pageshow event.
... pageshow event this event works the same as the load event, except that it fires every time the page is loaded (whereas the load event doesn't fire in firefox 1.5 when the page is loaded from cache).
...And 7 more matches
MenuItems - Archive of obsolete content
if the checkbox is on, the toolbar is shown, whereas if the checkbox is off, the toolbar is not shown.
... <menu label="view" accesskey="v"> <menupopup> <menuitem label="show toolbar" accesskey="t" type="checkbox" checked="true"/> <menuitem label="show status bar" accesskey="s" type="checkbox"/> </menupopup> </menu> both menuitems are of the checkbox type.
... <script> function changetoolbarstate(event) { if (event.target.getattribute("checked") == "true") showtoolbar(); else hidetoolbar(); } </script> ...
...And 7 more matches
menupopup - Archive of obsolete content
attributes ignorekeys, left, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, top properties accessibletype, anchornode, popupboxobject, position, state, triggernode methods hidepopup, moveto, openpopup, openpopupatscreen, setconsumerollupevent, showpopup, sizeto examples the following example shows how a menupopup may be attached to a menulist.
... <menulist> <menupopup> <menuitem label="mozilla" value="http://mozilla.org"/> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net"/> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> the following example shows how a menupopup can be used as a context menu for an element.
... left type: integer overrides the horizontal position of the popup specified by the showpopup method.
...And 7 more matches
Images in HTML - Learn web development
in other words, what you lose if your image doesn't show up: decoration.
... it has a large head with long sharp teeth" width="400" height="341" title="a t-rex on display in the manchester university museum"> this gives us a tooltip on mouse hover, just like link titles: however, this is not recommended — title has a number of accessibility problems, mainly based around the fact that screen reader support is very unpredictable and most browsers won't show it unless you are hovering with a mouse (so e.g.
...if you get really stuck, press the show solution button to see an answer: playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%"> <img> </textarea> <div class="playable-buttons"> <input id="reset"...
...And 7 more matches
Responsive images - Learn web development
responsive image technologies were implemented recently to solve the problems indicated above by letting you offer the browser several image files, either all showing the same thing but containing different numbers of pixels (resolution switching), or different images suitable for different space allocations (art direction).
... in this section, we'll look at the two problems illustrated above and show how to solve them using html's responsive image features.
...example of this in our responsive.html example on github (see also the source code): <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="elva-fairy-800w.jpg" alt="elva dressed as a fairy"> the srcset and sizes attributes look complicated, but they're not too hard to understand if you format them as shown above, with a different part of the attribute value on each line.
...And 7 more matches
BloatView
bloatview is a tool that shows information about cumulative memory usage and leaks.
... xpcom_mem_leak_log this is similar to xpcom_mem_bloat_log, but restricts the log to only show data on leaks.
...a 736 259808 325312 489440 338560 1413120 141312 220800 -11040 94944 446016 nslinelayout 1100 2200 225500 402600 562100 1192400 0 0 0 0 0 nslocalfile 424 558832 19928 1696 1272 581728 72080 1272 424 -424 73352 the first set of columns, bytes allocated, shows the amount of memory allocated for the first log file (blank.txt), the difference between the first log file and the second (mozilla.txt), the difference between the second log file and the third (yahoo.txt), the difference between the third log file and the fourth (netscape.txt), and the total amount of memory allocated in the fourth log file.
...And 7 more matches
nsIAlertsService
implemented by: @mozilla.org/alerts-service;1 as a service: var alertsservice = components.classes["@mozilla.org/alerts-service;1"] .getservice(components.interfaces.nsialertsservice); method overview void showalertnotification(in astring imageurl, in astring title, in astring text, [optional] in boolean textclickable, [optional] in astring cookie, [optional] in nsiobserver alertlistener, [optional] in astring name, [optional] in astring dir, [optional] in astring lang, [optional] in astring data, [optional] in nsiprincipal principal,[optional] in boolean inprivatebrowsing); void closealert([op...
...tional] in astring name, [optional] in nsiprincipal principal); methods showalertnotification() displays a notification window.
... void showalertnotification( in astring imageurl, in astring title, in astring text, in boolean textclickable, optional in astring cookie, optional in nsiobserver alertlistener, optional in astring name, optional in astring dir, optional in astring lang, optional in astring data, optional in nsiprincipal principal, optional in boolean inprivatebrowsing, optional ); parameters imageurl a url identifying the image to display in the notification alert.
...And 7 more matches
nsIPrintingPrompt
defaults for platform service: showprintdialog - displays a native dialog showpagesetup() - displays a xul dialog showprogress() - displays a xul dialog summary for windows embedders: stated once again: there is no "fallback" native platform support in gfx for the displaying of the native print dialog.
...if an embedder implemented service returns ns_error_not_implemented for "showprintdialog" the toolkit will display the native print dialog.
... defaults for platform service: mac os x: showprintdialog - displays a native dialog showpagesetup() - displays a native dialog showprogress() - not implemented (provided by os) gtk: there are no native dialogs for gtk.
...And 7 more matches
Edit fonts - Firefox Developer Tools
note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available).
... select the fonts tab; the last of the tabs shown in the right-hand side of the css pane.
... fonts used the top section of the font editor shows the fonts used by the currently inspected element, grouped by font family.
...And 7 more matches
Object.create() - JavaScript
as shown above, all seems normal so far.
... however, when attempting to actually use these objects, their differences quickly become apparent: > "oco is: " + oco // shows "oco is: [object object]" > "ocn is: " + ocn // throws error: cannot convert object to primitive value testing just a few of the many most basic built-in functions shows the magnitude of the problem more clearly: > alert(oco) // shows [object object] > alert(ocn) // throws error: cannot convert object to primitive value > oco.tostring() // shows [object object] > ocn.tostring() // throws error: ocn.tostring is not a function > oco.valueof() // shows {} > ocn.valueof() // throws error: ocn.valueof is not a function > oco.hasownproperty("p") // shows "true" > ocn.hasownproperty("p") // throws error: ocn.hasownproperty is not a function > oco.constructor // show...
...s "object() { [native code] }" > ocn.constructor // shows "undefined" as said, these differences can make debugging even simple-seeming problems quickly go astray.
...And 7 more matches
Add to Home screen - Progressive web apps (PWAs)
tapping this will show a confirmation banner — pressing the big + add to home screen button completes the action, adding the app to the home screen.
... (note: in android 8 and higher, a system-level "add to home screen" permission dialog will be shown first.) if you have mobile chrome available, the experience is slightly different; upon loading our site, you'll see an install banner pop up asking whether you want to add this app to your home screen.
...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).
...And 7 more matches
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
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.
... request permission to show a notification, we have to request permission to do so first.
...And 7 more matches
Creating annotations - Archive of obsolete content
the click handler sends a message called show back to the main add-on code.
... the show message contains: the url for the page, the id attribute value, and the text content of the page element.
...s).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yellow'); $(matchedelement).bind('click.annotator', function(event) { event.stoppropagation(); event.preventdefault(); self.port.emit('show', [ document.location.tostring(), $(ancestor).attr("id"), $(matchedelement).text() ] ); }); }); conversely, the add-on resets the matched element on mouseout: $('*').mouseout(function() { resetmatchedelement(); }); save this code in a new file called selector.js in your add-on's data directory.
...And 6 more matches
Venkman Introduction - Archive of obsolete content
figure 6 shows the table of icon and file types.
... if a function has a breakpoint in it, a small red dot will show up in the function icon, as well as the parent's file icon.
...figure 9 shows which icons represent which data types.
...And 6 more matches
Extensions - Archive of obsolete content
an extension may modify the context menu to show additional items that either appear always, or appear only when certain content is selected.
... <popup id="contentareacontextmenu"> <menuitem id="thumbnail-show" label="view thumbnail" oncommand="thumbnails.view();"/> </popup> note that the popup element is used rather than the menupopup element as this is the element that firefox uses.
... showing and hiding context menu items to have a menuitem you have added be shown or hidden based on the context, you can use an event handler that listens for the popupshowing event.
...And 6 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
mplete, disabled, disablehistory, enablehistory, focused, forcecomplete, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, minresultsforpopup, nomatch, onchange, onerrorcommand, oninput, onsearchcomplete, ontextcommand, ontextentered, ontextrevert, ontextreverted, open, readonly, searchsessions, showcommentcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength...
..., maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selectionstart, 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 examples (example needed) attributes accesskey type: character this should be set to a character that is used as a shortcut key.
... maxrows type: integer the number of rows to show in the results list at a time.
...And 6 more matches
panel - Archive of obsolete content
ArchiveMozillaXULpanel
attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, 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.
... left type: integer overrides the horizontal position of the popup specified by the showpopup method.
... top the panel is shown in front of all other normal windows, including those of other applications.
...And 6 more matches
Adobe Flash - Archive of obsolete content
the example below shows a detection heuristic in action.
... accessing flash from javascript the simple example below shows how input into an html text box in a form field can be transferred to a flash animation (the grey text box below).
... example 2 shows the use of macromedia flash's setvariable method being invoked from javascript.
...And 6 more matches
Tiles and tilemaps overview - Game development
the below images shows a tile atlas of 8 x 4 tiles: using an atlas also has the advantage of naturally assigning every tile an index.
... visual grid: includes indices showing what type of tile should be placed on each position in the grid.
...in the first case, the tilemap is static — it doesn't need to be scrolled to be fully shown.
...And 6 more matches
CSS and JavaScript accessibility best practices - Learn web development
links hyperlinks — the way you get to new places on the web: <p>visit the <a href="https://www.mozilla.org">mozilla homepage</a>.</p> some very simple link styling is shown below: a { color: #ff0000; } a:hover, a:visited, a:focus { color: #a60000; text-decoration: none; } a:active { color: #000000; background-color: #a60000; } the standard link conventions are underlined and a different color (default: blue) in their standard state, another color variation when the link has previously been visited (default: purple), and yet another color when the link...
...the following image shows the highlight in both firefox (a dotted outline) and chrome (a blue outline): you can be creative with link styles, as long as you keep giving users feedback when they interact with the links.
... hiding things there are many instances where a visual design will require that not all content is shown at once.
...And 6 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
in the following sections we will show you how they can be used.
... the time display to show the number of seconds elapsed, rather than the actual time.
... 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.
...And 6 more matches
Looping code - Learn web development
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.
...if you get really stuck, press "show solution" to see a solution.
... <textarea id="code" class="playable-code" style="height: 300px;width: 95%"> let output = document.queryselector('.output'); output.innerhtml = ''; // let i = 10; // const para = document.createelement('p'); // para.textcontent = ; // output.appendchild(para); </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.valu...
...And 6 more matches
Gecko info for Windows accessibility vendors
it's also used in the root pane object to show when the state_busy flag changes from loading new content.
... event_show, event_hide and event_locationchange are fired for the caret object.
...event_show and event_hide may also be fired with the reorder event, for the child who's visibility changed.
...And 6 more matches
Displaying Places information using views
the built-in views if you need to show the contents of bookmarks or history in your extension or application, you may want to use the built-in places views, which are generic and will save you a lot of time writing basic functionality so that you can focus on building your extension or application.
...its value is the uri of a query, and the data shown in the view are the results of this query.
... the following table shows the mappings between these magic column id values and their corresponding nsinavhistoryresultnode properties: treecol id or anonid corresponding nsinavhistoryresultnode property title title url uri date time visitcount accesscount keyword * description * dateadded dateadded lastmodified l...
...And 6 more matches
A guide to searching crash reports
the columns show each group's rank, signature, size (both a count and a proportion of matching crash reports), and finally a list of bugs that have been marked as relating to this signature.
... grouping in the previous section we saw one example of grouping, in the "signature facet" tab that is shown by default.
... facets in the search form to do a search with non-signature grouping first click on the "more options..." text, which reveals the additional fields shown in the following screenshot.
...And 6 more matches
Using XPCOM Components
this chapter demonstrates how mozilla uses some of these xpcom objects, such as the cookiemanager, and shows how access to the weblock component will be defined.
...the cookie manager dialog shows user interface[cookie-manager-ui] that is presented to the user in mozilla for working with the cookiemanager component.
... the snippet in getting the cookiemanager component in javascript shows how the remove() method from the xpcom cookiemanager component can be called from javascript: getting the cookiemanager component in javascript // xpconnect to cookiemanager // get the cookie manager component in javascript var cmgr = components.classes["@mozilla.org/cookiemanager;1"] .getservice(); cmgr = cmgr.queryinterface(components.interfaces.nsicookiemanager); // ca...
...And 6 more matches
Main Windows
its main focus is on handling the folderpane, threadpane, and the message preview sections shown above.
... the rest is loaded from overlays: mailwindowoverlay.xul this is the red sections shown in the interface above (where?), including the toolbars, notification bars, and the status bar, but also includes most of the commands, keysets, and context menus of thunderbird, along with a whole lot of javascript.
... msghdrviewoverlay.xul shown in blue above (where?), this overlay consists of three boxes.
...And 6 more matches
Examine and edit HTML - Firefox Developer Tools
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.
... as you type, an autocomplete popup shows any class or id attributes that match the current search term: press up and down to cycle through suggestions, tab to choose the current suggestion, then enter to select the first node with that attribute.
... html tree the rest of the pane shows you the page's html as a tree (this ui is also called the markup view).
...And 6 more matches
Animating CSS properties - Firefox Developer Tools
one last step is not shown in this sequence: the page may be split into layers, which are painted independently and then combined in a process called "composition".
... transform opacity the css triggers website shows how much of the waterfall is triggered for each css property, with information for most css properties by browser engine.
...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.
...And 6 more matches
Animation performance and frame rate - Web Performance
one last step is not shown in this sequence: the page may be split into layers, which are painted independently and then combined in a process called "composition".
... transform opacity the css triggers website shows how much of the waterfall is triggered for each css property, with information for most css properties by browser engine.
...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.
...And 6 more matches
ContextMenus - Archive of obsolete content
hiding and showing menu items based on context when the context menu is opened, a popupshowing event will fire before the popup is displayed.
... in many cases, it may be easier to use a single context menu containing every possible item, and show and hide the necessary items when needed.
...to show an item, set its hidden property to false.
...And 5 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
the method 'showtitle' can be used to show or hide the label.
... xul: <box id="num" class="labeledbutton" title="number of things:" value="52"/> <button label="show" oncommand="document.getelementbyid('num').showtitle(true)"/> <button label="hide" oncommand="document.getelementbyid('num').showtitle(false)"/> xbl: <binding id="labeledbutton"> <content> <xul:label xbl:inherits="value=title"/> <xul:label xbl:inherits="value"/> </content> <implementation> <method name="showtitle"> <parameter name="state"/> <body> if (state) { document.getanonymousnodes(this)[0].setattribute("style", "visibility: visible"); } else { document.getanonymousnodes(this)[0].setattribute("style", "visib...
...each calls the 'showtitle' method.
...And 5 more matches
Numeric Controls - Archive of obsolete content
the decimalplaces attribute indicates how many decimal places to show.
... the default value is 0, which means show integers only.
... however a different value may be used to show decimal values.
...And 5 more matches
prefwindow - Archive of obsolete content
normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed.
... buttonalign, buttondir, buttonorient, buttonpack, buttons, defaultbutton, lastselected, onbeforeaccept, ondialogaccept, ondialogcancel, ondialogdisclosure, ondialoghelp, onload, onunload, title, type properties buttons, currentpane, defaultbutton, lastselected, preferencepanes, type methods acceptdialog, addpane, canceldialog, centerwindowonscreen, getbutton, opensubdialog, openwindow, showpane examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <prefwindow xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="saveoptions" label="backups"> <preferences> <preference id="pref-backup" name="myapp.mybackups" type="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" typ...
... disclosure: a button to show more information.
...And 5 more matches
tooltip - Archive of obsolete content
attributes crop, default, label, noautohide, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, page, position properties accessibletype, label, popupboxobject, position, state methods hidepopup, moveto, openpopup, openpopupatscreen, showpopup, sizeto examples <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <label value="click here to see more information"/> <label value="really!" style="color: red;"/> </tooltip> <vb...
... center the text will be cropped in the middle, showing both the start and end of the text normally.
... onpopupshowing type: script code this event is sent to a popup just before it is opened.
...And 5 more matches
Reference - Archive of obsolete content
they are there specifically to show the differences between the two versions.
...--maian 05:10, 22 september 2005 (pdt) if the examples are there specifically to show the differences between two versions of js, and if we have a section in the reference that is dedicated to discussing these differences, i would think that those samples should be included in that section of the reference.
...so while the examples do show what js 1.2 does, they incorrectly indicate that it's possible to switch to the 1.2 engine.
...And 5 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
for example, an image hosted on site1.com is shown directly on site2.com.
... 264 media (audio-visual presentation) audio, glossary, media, multimedia, video the term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, tv shows, or any other form of content that is presented over a period of time.
...specifications might also contain sections that are marked as non-normative or informative, which means those are provided there for the purpose of helping the reader understand the specifications better or to showcase an example or best practice, which need not be followed as a rule.
...And 5 more matches
Adding vector graphics to the Web - Learn web development
in this article we'll show you how to include one in your webpage.
... on the web, you'll work with two types of image — raster images, and vector images: raster images are defined using a grid of pixels — a raster image file contains information showing exactly where each pixel is to be placed, and exactly what color it should be.
...you can find this example live on our github repo as vector-versus-raster.html — it shows two seemingly identical images side by side, of a red star with a black drop shadow.
...And 5 more matches
Client-side storage - Learn web development
showing a user's choice of custom widgets, color scheme, or font size).
... use of cache and service workers is an advanced topic, and we won't be covering it in great detail in this article, although we will show a simple example in the offline asset storage section below.
... basic syntax let's show you how: first, go to our web storage blank template on github (open this in a new tab).
...And 5 more matches
Drawing graphics - Learn web development
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.
...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.
...And 5 more matches
Client-Server Overview - Learn web development
for example, the http request that is sent when you perform a search on mdn for the term "client server overview" will look a lot like the text shown below (it will not be identical because parts of the message depend on your browser/setup).
... the response the first part of the response for this request is shown below.
... the request the text below shows the http request made when a user submits new profile details on this site.
...And 5 more matches
Handling common HTML and CSS problems - Learn web development
to show you an example of how such plugins generally work: install atom (if you haven't got an up-to-date version already installed) — download it from the atom page linked above.
... note: html errors don't tend to show up so easily in dev tools, as the browser will try to correct badly-formed markup automatically; the w3c validator is the best way to find html errors — see validation above.
... as an example, in firefox the css inspector will show css declarations that aren't applied crossed out, with a warning triangle.
...And 5 more matches
Profiling with the Firefox Profiler
call tree the call tree shows the samples organized by 'running time' which will show the data by wall clock time.
... clicking the "javascript only" option will only show javascript code in the call tree.
... custom annotations in bug 1334218 an annotation was added to presshell::paint to show the url of the document being painted.
...And 5 more matches
about:memory
if you select the "verbose" checkbox before measuring, all trees will be shown fully expanded and no artificial nodes will be inserted.
... some add-on memory usage is identified, as the following example shows.
... all javascript memory usage for an add-on is measured separately and shown in this sub-tree.
...And 5 more matches
Hacking Tips
│ auto funcptr = js_data_to_func_ptr(exportfuncptr, codebase() + func.entryoffset()); │ if (!call_generated_2(funcptr, exportargs.begin(), &tlsdata_)) │ return false; after it's set, x/64i funcptr will show you the trampoline code.
... using the tracelogger (js shell / browser) create graphs showing time spent in which engine and which function like this.
...this will remove entries that took only a minor time (=entries that will only show up with les than 1px).
...And 5 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
a webvtt file (.vtt) contains cues, which can be either a single line or multiple lines, as shown below: webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen.
... 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.
... we finish the first line with a second time, which is the ending time for showing the associated text.
...And 5 more matches
Inputs and input sources - Web APIs
a full webxr experience isn't just about showing the user a wholly virtual scene or augmenting reality by adding to or altering the world around them.
...it describes the technique used to determine the targeting ray and how it should be shown to the user if presented visually.
... this is shown in the diagram below, in which the controller is located down and to the left of the world space's origin, with the controller also moved to be closer to us than the origin.
...And 5 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
WebHTMLElementvideo
the above example shows simple usage of the <video> element.
... in a similar manner to the <img> element, we include a path to the media we want to display inside the src attribute; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc.
... the content inside the opening and closing <video></video> tags is shown as a fallback in browsers that don't support the element.
...And 5 more matches
Closures - JavaScript
<p id="help">helpful notes will appear here</p> <p>e-mail: <input type="text" id="email" name="email"></p> <p>name: <input type="text" id="name" name="name"></p> <p>age: <input type="text" id="age" name="age"></p> function showhelp(help) { document.getelementbyid('help').innerhtml = help; } function setuphelp() { var helptext = [ {'id': 'email', 'help': 'your e-mail address'}, {'id': 'name', 'help': 'your full name'}, {'id': 'age', 'help': 'your age (you must be over 16)'} ]; for (var i = 0; i < helptext.length; i++) { var item = helptext[i]; document.getelementbyid(item.id).onfocus...
... = function() { showhelp(item.help); } } } setuphelp(); try running the code in jsfiddle.
...the loop cycles through these definitions, hooking up an onfocus event to each one that shows the associated help method.
...And 5 more matches
OpenClose - Archive of obsolete content
as with other ways of opening a menu, the popupshowing event will be fired to provide an opportunity to customize the commands that appear on the menu.
...if you do want to open a submenu, open the parent menu first, and then open the child menu in a popupshown event listener.
... see the popupshown event for an example of how to do this.
...And 4 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
tepopup, autocompletesearch, autocompletesearchparam, completedefaultindex, completeselectedindex,crop, disableautocomplete, disabled, disablekeynavigation, enablehistory, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, nomatch, onchange, oninput, onsearchcomplete, ontextentered, ontextreverted, open, readonly,showcommentcolumn, showimagecolumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, maxlength, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchpara...
...m, selectionend, selectionstart, 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.
... maxrows type: integer the number of rows to show in the results list at a time.
...And 4 more matches
XBL Example - Archive of obsolete content
a slideshow element let's construct a full example of an xbl element.
...we'll call this a slideshow element.
... content of the slideshow first, let's determine what elements need to go in the xbl content.
...And 4 more matches
Windows Media in Netscape - Archive of obsolete content
example 1: client-side detection scripts browser architecture supports: netscapeplugin windows media player installed: true windows media scriptable: false windows media version: pluginversion a complete source code listing showing how that detection was done can be found here (devedge-temp).
...here is a code snippet that shows this: var player; try { if (window.activexobject) { player = new activexobject("mediaplayer.mediaplayer.1"); } else if (window.geckoactivexobject) { player = new geckoactivexobject("mediaplayer.mediaplayer.1"); } else { // plugin code using navigator.mimetypes player = navigator.mimetypes["application/x-mplayer2"].enabledplugin; } } catch(e) { // handle error -- no wm...
... 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="autostart" 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.
...And 4 more matches
Desktop gamepad controls - Game development
window.addeventlistener("gamepadconnected", gamepadhandler); it's executed once, so we can create some variables we will need later on for storing the controller info and the pressed buttons: var controller = {}; var buttonspressed = []; function gamepadhandler(e) { controller = e.gamepad; output.innerhtml = "gamepad: " + controller.id; } the second line in the gamepadhandler function shows up on the screen when the device is connected: we can also show the id of the device — in the case above we're using the xbox 360 wireless controller.
...to indicate that the gamepad controller is active we can show the user some custom text on the game's main menu screen.
...press y for controls'; var textgamepad = this.add.text(message, ...); textgamepad.visible = false; } in the update() function, which is executed every frame, we can wait until the controller is actually connected, so the proper text can be shown.
...And 4 more matches
Accessible multimedia - Learn web development
this article shows how.
...for more information on how to add more complex features to video/audio players, including flash fallbacks for older browsers, see: audio and video delivery video player styling basics creating a cross-browser video player we've also created an advanced example to show how you could create an object-oriented system that finds every video and audio player on the page (no matter how many there are) and adds our custom controls to it.
....) > show transcript.
...And 4 more matches
WAI-ARIA basics - Learn web development
here we'll show how to use it at a basic level to improve accessiblity.
... the improved semantics of the search form have shown what is made possible when aria goes beyond the semantics available in html5.
...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.
...And 4 more matches
Debugging HTML - Learn web development
for example, the following shows an error reported when trying to compile a simple program written in the rust language.
...html is not compiled into a different form before the browser parses it and shows the result (it is interpreted, not compiled).
...well, generally when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the program not to run, like the rust error shown above.
...And 4 more matches
From object to iframe — other embedding technologies - Learn web development
if you get really stuck, press the show solution button to see an answer.
...h2> <div class="output" style="min-height: 250px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="width: 95%;min-height: 100px;"> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.query...
...selector('.output'); let code = textarea.value; let userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = htmlsolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); const htmlsolution = '<iframe width="420" height="315" src="https://www.youtube.com/embed/qh2-tgulwu4" frameborder="0" allowfullscreen>\n</iframe>\n\n<iframe src="https://www.google.com/maps/embed?pb...
...And 4 more matches
Arrays - Learn web development
i <= 0; i++) { // number 2 // number 3 // number 4 // number 5 let itemtext = 0; const listitem = document.createelement('li'); listitem.textcontent = itemtext; list.appendchild(listitem); } totalbox.textcontent = 'total: $' + total.tofixed(2); </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry ...
...= jssolution; solution.value = 'show solution'; updatecode(); }); solution.addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); const jssolution = 'const list = document.queryselector(\'.output ul\');\nconst totalbox = document.queryselector(\'.output p\');\nlet total = 0;\nlist.innerhtml = \'\';\ntotalbox.textcontent = \'\';\n\nlet products = [\'underpants:6.99\',\n \'socks:5.99\',\n \'t-shirt:14.99\',\n \'trousers:31.99\',\n \'shoes:23.99\'];\n\nfor(let i = 0; i < products.length; i++) {\n let subarray = products[i].split(\':\');\n let name = subarray[0];\n let price = numbe...
...rea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; bac...
...And 4 more matches
Server-side web frameworks - Learn web development
previous overview: first steps next the previous article showed you what the communication between web clients and servers looks like, the nature of http requests and responses, and what a server-side web application needs to do in order to respond to requests from a web browser.
... the example below shows how this works in the django (python) web framework.
... the first code snippet below shows a very simple django model for a team object.
...And 4 more matches
Working with Svelte stores - Learn web development
in this article we will show another way to handle state management in svelte — stores.
... objective: learn how to use svelte stores using stores we will create an alert component that shows notifications on screen, which can receive messages from any component.
... creating the alert component to show how to work with stores, we will create an alert component.
...And 4 more matches
Introduction to automated testing - Learn web development
if you get errors, check that you've added all the dependencies and the tests as shown above; also try commenting out the html/css/javascript code sections and then rerunning gulp to see if you can isolate what the problem is.
... in the next screen, type in the url of a page you want to test (use http://mdn.github.io/learning-area/javascript/building-blocks/events/show-video-box-fixed.html, for example), then choose a browser/os combination you want to test by using the different buttons and lists.
...clicking on one of these entries shows more data for the session.
...And 4 more matches
Setting up your own test automation environment - Learn web development
objective: to show how to set up a selenium testing environment locally and run tests with it, and how to integrate it with tools like lambdatest, sauce labs, and browserstack.
... to set your path variable on mac os x/most linux systems: open your .bash_profile (or .bashrc) file (if you can't see hidden files, you'll need to display them, see show/hide hidden files in mac os x or show hidden folders in ubuntu).
... note: saucelabs-sample-test-frameworks contains several useful examples showing how to set up different combinations of test/assertion tools.
...And 4 more matches
PopupNotifications.jsm
method overview void locationchange(); notification getnotification(id, browser); void remove(notification); notification show(browser, id, message, anchorid, mainaction, secondaryactions, options); properties attribute type description ispanelopen boolean returns true if the notification panel is currently visible, false if it is not.
... show() adds a new popup notification, displaying it to the user.
... notification show( browser, id, message, anchorid, mainaction, secondaryactions, options ); parameters browser the xul <xul:browser> element with which the notification is associated.
...And 4 more matches
Application Translation with Mercurial
paste the following content into the file: [ui] username = firstname lastname <mynick@example.com> merge = internal:merge [alias] qexport = export -g -r qtip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded.
... the first line shows the locale for which the texts are being translated (in this example: de - german).
... you installed scrapbook earlier, now open it in firefox either by calling it from the firefox menu bar (press the alt key to show it if necessary) using "view" > "sidebar" > "scrapbook" or by clicking its toolbar button which you likely have to add by toolbar customization if you didn't do this before.
...And 4 more matches
Gecko Profiler FAQ
the gecko profiler currently doesn’t have the ability to show you information about line numbers, neither for js code nor for native code.
... 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.
... how do we profile "leaks" that show up after running firefox for > 40 mins?
...And 4 more matches
nsIAuthInformation
domain astring the initial value should be used to prefill the dialog or be shown in some other way to the user.
... password astring the initial value should be used to prefill the dialog or be shown in some other way to the user.
... the password should not be shown in clear.
...And 4 more matches
nsIFilePicker
an instance, use: var filepicker = components.classes["@mozilla.org/filepicker;1"] .createinstance(components.interfaces.nsifilepicker); method overview void appendfilter(in astring title, in astring filter); void appendfilters(in long filtermask); void init(in nsidomwindow parent, in astring title, in short mode); void open(in nsifilepickershowncallback afilepickershowncallback); short show(); obsolete since gecko 57.0 attributes attribute type description addtorecentdocs boolean if true, the file is added to the operating system's "recent documents" list (if the operating system has one; nothing happens if there is no such concept on the user's platform).
...this should be set before calling open() or show().
...this should be set this before calling open() or show() to specify a starting point.
...And 4 more matches
Activity Manager examples
showing a user-defined activity in the activity manager window the following sample will show a process and an event for junk processing in the activity manager window.
...e // localization is omitted, initiator is not provided process.init("processing folder: " + folder.prettiestname, null); // note that we don't define a custom icon, default process icon // will be used process.contexttype = "account"; // group this activity by account process.contextobj = folder.server; // account in question gactivitymanager.addactivity(process); // step 2: showing some progress let percent = 50; process.setprogress(percent, "junk processing 25 of 50 messages", 25, 50); // step 3: removing the process and adding an event using process' attributes process.state = components.interfaces.nsiactivityprocess.state_completed; gactivitymanager.removeactivity(process.id); let event = components.classes["@mozilla.org/activity-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 process.
...And 4 more matches
Accessibility Inspector - Firefox Developer Tools
right-click an item in the html pane of the page inspector, and choose show accessibility properties in the context menu.
...the json viewer can also show you the raw json data on a separate tab in the viewer.
...the available menu items include: none — don't show the possible list of issues all issues — check for all types of issues contrast — check for issues with visual contrast keyboard — check for issues with navigating via a keyboard text labels — check for issues with missing text labels when you one of the menu items, firefox scans your document for the type of issues you selected.
...And 4 more matches
Aggregate view - Firefox Developer Tools
the "total count" column shows you the number of objects of each category that are currently allocated.
... the "total bytes" column shows you the number of bytes occupied by objects in each category, and that number as a percentage of the whole heap size for that tab.
...if you select an item, you'll see the retaining paths panel for that item: call stack the call stack shows you exactly where in your code you are making heap allocations.
...And 4 more matches
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
note: the examples shown in the screenshots appearing in this article are jen simmons' futurismo and variations on a grid experiments, and a live named grid area example from rachel andrew.
... clicking the icon toggles the display of a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: the overlay is still shown when you select other elements, so you can edit related css properties and see how the grid is affected.
... grid display settings: display line numbers: turn the line numbers shown for each grid overlay on and off (on by default).
...And 4 more matches
UI Tour - Firefox Developer Tools
the following image shows the 2-pane layout: in 2-pane mode, the inspector includes the html pane, and the css pane, which can contain one of six tools: rules view layout view computed view changes view compatibility view (firefox developer edition 77 and later) fonts view animations view the following image shows the 3-pane mode (available from firefox 62 onwards) which moves the css rules view into a sepa...
...the following image shows 3-pane mode: as you can see, the css pane has moved into the center of the inspector.
...if the page includes any sections using either the flexbox display model or css grids, this view shows the flexbox or grid settings used on the page.
...And 4 more matches
Storage Inspector - Firefox Developer Tools
for example, clicking on an origin which is a child of the cookies storage type will show all the cookies belonging to that domain.
...you can hide and show columns by context-clicking on the table header and selecting the columns you want to see: search there's a search box at the top of the table widget: this filters the table to show only items which match the search term.
... add and refresh storage you'll also have buttons available to add a new storage entry or refresh the view of the currently viewed storage type where applicable (you can't add new entries to indexeddb or cache): sidebar when you select any row in the storage table widget, the sidebar is shown with details about that row.
...And 4 more matches
HTMLImageElement.alt - Web APIs
these are shown in the examples below.
...this is shown in the example below.
... html in the html for this example, shown below, the <img> element includes the alt property, which will prevent the image from having any alternate text, since it's simply a decorational detail.
...And 4 more matches
Using the Notifications API - Web APIs
denied the user has explicitly declined permission to show notifications.
...ions</button> clicking this calls the asknotificationpermission() function: function asknotificationpermission() { // function to actually ask the permissions function handlepermission(permission) { // whatever the user answers, we make sure chrome stores the information if(!('permission' in notification)) { notification.permission = permission; } // set the button to shown or hidden, depending on what the user answers if(notification.permission === 'denied' || notification.permission === 'default') { notificationbtn.style.display = 'block'; } else { notificationbtn.style.display = 'none'; } } // let's check if the browser supports notifications if (!('notification' in window)) { console.log("this browser does not support notifica...
...inside here we explicitly set the notification.permission value (some old versions of chrome failed to do this automatically), and show or hide the button depending on what the user chose in the permission dialog.
...And 4 more matches
Streams API - Web APIs
this is something browsers do anyway when receiving assets to be shown on webpages — videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded.
...the examples are as follows: simple stream pump: this example shows how to consume a readablestream and pass its data to another.
... grayscale a png: this example shows how a readablestream of a png can be turned into grayscale.
...And 4 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
in this guide we show how use webgl to simulate camera movements without having a camera to move.
...note: most diagrams used in this article to show how the camera moves while performing standard movements was taken from an article on the filmmakeriq web site; namely, from this image which is found all over the web, however, and though we assume these are under a permissive license due to their frequent reuse, ownership is not certain.
... in mapping applications, the camera may either be placed directly over the scene, or might use various angles to show perspective.
...And 4 more matches
Window - Web APIs
WebAPIWindow
window.dialogarguments read only gets the arguments passed to the window (if it's a dialog box) at the time window.showmodaldialog() was called.
... window.returnvalue the return value to be returned to the function that called window.showmodaldialog() to display the window as a modal dialog.
... window.showmodaldialog() displays a modal dialog.
...And 4 more matches
Synchronous and asynchronous requests - Web APIs
*/) { var xhr = new xmlhttprequest(); xhr.callback = callback; xhr.arguments = array.prototype.slice.call(arguments, 2); xhr.onload = xhrsuccess; xhr.onerror = xhrerror; xhr.open("get", url, true); xhr.send(null); } usage: function showmessage(message) { console.log(message + this.responsetext); } loadfile("message.txt", showmessage, "new message!\n\n"); the signature of the utility function loadfile declares (i) a target url to read (via an http get request), (ii) a function to execute on successful completion of the xhr operation, and (iii) an arbitrary list of additional arguments that are passed through the xhr object...
...it, in turn, invokes the callback function specified in the invocation of the loadfile function (in this case, the function showmessage) which has been assigned to a property of the xhr object (line 11).
...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.
...And 4 more matches
An overview of accessible web applications and widgets - Accessibility
presentational changes dynamic presentational changes include using css to change the appearance of content (such as a red border around invalid data, or changing the background color of a checked checkbox), as well as showing or hiding content.
... visibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value.
...the example shows a simple web form with tooltips containing instructions associated with the entry fields.
...And 4 more matches
OpenType font features guide - CSS: Cascading Style Sheets
they are all defined and shown here, but many will only work using the lower-level font-feature-settings property.
... note: the examples below show the properties and some example combinations, along with the lower-level syntax equivalents.
...the typefaces shown are playfair display, source serif pro, ibm plex serif, dancing script, and kokoro (all available and free to use, most are on google fonts and other services).
...And 4 more matches
tabs - Archive of obsolete content
te', function () { console.log('active: ' + tabs.activetab.url); }); track a single tab given a tab, you can register event listeners to be notified when the tab is closed, activated or deactivated, or when the page hosted by the tab is loaded or retrieved from the "back-forward cache": var tabs = require("sdk/tabs"); function onopen(tab) { console.log(tab.url + " is open"); tab.on("pageshow", logshow); tab.on("activate", logactivate); tab.on("deactivate", logdeactivate); tab.on("close", logclose); } function logshow(tab) { console.log(tab.url + " is loaded"); } function logactivate(tab) { console.log(tab.url + " is activated"); } function logdeactivate(tab) { console.log(tab.url + " is deactivated"); } function logclose(tab) { console.log(tab.url + " is closed"); }...
... onpageshow function a callback function that will be registered for the 'pageshow' event.
... pageshow the pageshow event is emitted when the page for a tab's content is loaded.
...And 3 more matches
widget - Archive of obsolete content
("sdk/self").data; require("sdk/widget").widget({ id: "my-widget", label: "my widget", contenturl: data.url("my-content.html") }); this widget contains an entire web page: require("sdk/widget").widget({ id: "hello-display", label: "my hello widget", content: "hello!", width: 50 }); widgets are quite small by default, so this example used the width property to grow it in order to show all the text.
... to show the difference, convert the player add-on above to use normal page scripts instead of content scripts.
...if you assign the panel to the widget after construction, the panel can still be shown but will not be anchored to the widget: data = require("sdk/self").data var clockpanel = require("sdk/panel").panel({ width:215, height:160, contenturl: data.url("clock.html") }); widget = require("sdk/widget").widget({ id: "open-clock-btn", label: "clock", contenturl: data.url("history.png") }); widget.panel = clockpanel; // will not be anchored widget.panel.show(); also, if y...
...And 3 more matches
Displaying annotations - Archive of obsolete content
if it finds any it binds functions to that element's mouseenter and mouseleave events to send messages to the main module, asking it to show or hide the annotation.
... the complete content script is here: self.on('message', function onmessage(annotations) { annotations.foreach( function(annotation) { if(annotation.url == document.location.tostring()) { createanchor(annotation); } }); $('.annotated').css('border', 'solid 3px yellow'); $('.annotated').bind('mouseenter', function(event) { self.port.emit('show', $(this).attr('annotation')); event.stoppropagation(); event.preventdefault(); }); $('.annotated').bind('mouseleave', function() { self.port.emit('hide'); }); }); function createanchor(annotation) { annotationanchorancestor = $('#' + annotation.ancestorid); annotationanchor = $(annotationanchorancestor).parent().find( ':contains(' + annotation.anchort...
...the main function, add the code to create the matcher: var matcher = pagemod.pagemod({ include: ['*'], contentscriptwhen: 'ready', contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('matcher.js')], onattach: function(worker) { if(simplestorage.storage.annotations) { worker.postmessage(simplestorage.storage.annotations); } worker.port.on('show', function(data) { annotation.content = data; annotation.show(); }); worker.port.on('hide', function() { annotation.content = null; annotation.hide(); }); worker.on('detach', function () { detachworker(this, matchers); }); matchers.push(worker); } }); when a new page is loaded the function assigned to onattach is called.
...And 3 more matches
Display a Popup - Archive of obsolete content
var text_entry = require("sdk/panel").panel({ contenturl: data.url("text-entry.html"), contentscriptfile: data.url("get-text.js") }); // create a button require("sdk/ui/button/action").actionbutton({ id: "show-panel", label: "show panel", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); // show the panel when the user clicks the button.
... function handleclick(state) { text_entry.show(); } // when the panel is displayed it generated an event called // "show": we will listen for that event and when it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display.
... text_entry.on("show", function() { text_entry.port.emit("show"); }); // listen for messages called "text-entered" coming from // the content script.
...And 3 more matches
Adding menus and submenus - Archive of obsolete content
« previousnext » the hello world example in the previous sections shows the two most common ways to add menus.
...choolchrome.greetingdialog.greetinglong(event);" /> <menuseparator /> <menuitem label="&xulschoolhello.greet.custom.label;" oncommand="xulschoolchrome.greetingdialog.greetingcustom(event);" /> </menupopup> </menu> </menubar> </toolbox> this code displays a simple menu with options for 3 different types of greetings, a menuseparator, and finally an option to show a custom greeting.
...instead of setting the menupopup directly in the xul, you can use the onpopupshowing event to fill the children when the popup is about to be displayed.
...And 3 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
but as the internet matures, this model has begun to show its age and its limitations.
...the second example shows a tabbed menu that dynamically loads news headlines into the current web page.
...but the real showcase for new browser features and web standards like html 4.0 and dom level 2, and xml are models like inner-browsing, where these technologies can begin to be used in the way that they were envisioned.
...And 3 more matches
Bookmark Keywords - Archive of obsolete content
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.
...you should end up with the result shown in figure 4, without the red highlighting.
...And 3 more matches
XUL Events - Archive of obsolete content
<menu> or a <menuitem> has been hovered or highlighted.dommenuiteminactivethe dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.popuphiddenthe popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden.popuphidingthe popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden.popupshowingthe popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible.
... the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <progress> for example, has changed.
...this handler is usually used to dynamically set the commands on a menu when the user requests to display it, or you can use popupshowing event.
...And 3 more matches
Adding Event Handlers - Archive of obsolete content
next, we will show how to add scripts to it.
... by default the javascript console only shows errors from web content.
... to show errors in chrome javascript, it is necessary to change the preference javascript.options.showinconsole to true.
...And 3 more matches
Scratchpad - Archive of obsolete content
the featured video tutorial shows a case of using scratchpad with a page run by a local web server.
...you'll see the autocomplete box, as shown below: the icon next to each suggestion indicates the type, and the currently highlighted suggestion gets a popup with more information.
... inline documentation to show the inline documentation popup, press ctrl + shift + space when the cursor is on an identifier.
...And 3 more matches
Game monetization - Game development
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.
... there are many companies offering advert systems — you sign up and allow them to show adverts in exchange for a percentage of the earnings.
...they offer easy to implement systems to show the adverts in your games and split the earnings with you.
...And 3 more matches
Fetching data from the server - Learn web development
request.send(); one problem with the example as it stands is that it won't show any of the poem when it first loads.
... to fix this, add the following two lines at the bottom of your code (just above the closing </script> tag) to load verse 1 by default, and make sure the <select> element always shows the correct value: updatedisplay('verse 1'); versechoose.value = 'verse 1'; serving your example from a server modern browsers will not run xhr requests if you just run the example from a local file.
... a more complex example to round off the article, we'll look at a slightly more complex example that shows some more interesting uses of fetch.
...And 3 more matches
A first splash into JavaScript - Learn web development
example — guess the number game in this article we'll show you how to build up the simple game you can see below: top hidden code <!doctype html> <html> <head> <meta charset="utf-8"> <title>number guessing game</title> <style> html { font-family: sans-serif; } body { width: 50%; max-width: 800px; min-width: 480px; margin: 0 auto; } .lastr...
...then we can try typing in the examples shown below — type in each one from the "example" columns exactly as shown, pressing return/enter after each one, and see what results they return.
... line 6 appends the current userguess value onto the end of the guesses paragraph, plus a blank space so there will be a space between each guess shown.
...And 3 more matches
What is JavaScript? - Learn web development
dynamic versus static code the word dynamic is used to describe both client-side javascript, and server-side languages — it refers to the ability to update the display of a web page/app to show different things in different circumstances, generating new content as required.
...creating a new html table, filling it with data requested from the server, then displaying the table in a web page shown to the user.
... a web page with no dynamically updating content is referred to as static — it just shows the same content all the time.
...And 3 more matches
Componentizing our React app - Learn web development
in this article we will show you a sensible way to break our app up into components.
... objective: to show a sensible way of breaking our todo list app into components.
... </label> </div> <div classname="btn-group"> <button type="button" classname="btn"> edit <span classname="visually-hidden">{props.name}</span> </button> <button type="button" classname="btn btn__danger"> delete <span classname="visually-hidden">{props.name}</span> </button> </div> </li> ); } now your browser should show three unique tasks.
...And 3 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
let's start by showing a status message.
...when a todo item's delete button is pressed, the relevant todo is removed from the todos array, and the ui updates to no longer show it.
...update it like this: <div class="filters btn-group stack-exception"> <button class="btn toggle-btn" class:btn__primary={filter === 'all'} aria-pressed={filter === 'all'} on:click={()=> filter = 'all'} > <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" class:btn__primary={filter === 'active'} aria-pressed={filter === 'active'} on:click={()=> filter = 'active'} > <span class="visually-hidden">show</span> <span>active</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" class...
...And 3 more matches
Mozilla’s UAAG evaluation report
(p2) g menus indicate accesskey and accelerator configurations accelerators not show in button tooltips guideline 8.
...(p2) p can turn off scripting, but then no event processing is available 9.6 show event handlers.
...(p1) vg provides a focus outline box highlights follow graphical rendering conventions for windows does not highlight selected images we do not have the ability to show a border around the text selection we have the following focus appearance prefs that are not exposed in the ui, but can be manually inserted in the user's prefs.js file: setboolpref("browser.display.use_focus_colors", usefocuscolors); /* true or false */ setcharpref("browser.display.focus_background_color", colorstring); /* for example #ffeedd or the name of a color */ setcharpref...
...And 3 more matches
Accessible Toolkit Checklist
dynamically added items must not corrupt the tab cycle or make it disorderly tab cycle must be identical backwards and forwards the f6 and shift+f6 key combinations should cycle through panes in a window making focus visible on any widget, and focus must always be visible shift+f10 or context menu key should work like right click on focused item, and context menu should show just under and to the right of the current focus.
...this can be supported through spi_getkeyboardcues and spi_getmenuunderlines simple widgets buttons tab, arrow, unmodified letter mnemonics require and support text labels for buttons with images, can be same as tooltip space key activates button enter key activates focused button (thus current button, not default button shows dark border when a different button is focused) when button has a popup available by clicking on it, the enter key or space bar should also activate the popup toolbars and toolbar buttons are not focusable, but we should expose the tooltip.
...ability to define in xml enter key fires it, but not when another widget has focus that needs the enter key layout engine - drawing dark border dynamically when the currently focused widget does not need the enter key events - making keystrokes do the right thing msaa support (default state) links enter key activates link (thus default button no longer shows dark border when link is focused) msaa support, including linked and traversed states, and accessible value that holds destination url text fields - single and multiple line it's probably best to use native widgets for these, otherwise accessibility support will be quite difficult tab should always focus the next item, not insert a tab, unless there's a really go...
...And 3 more matches
PromiseWorker.jsm
here is a simple demo showing how to transfer the second argument to a worker: github:: promiseworker transfer data line 23.
... the command outline below this shows how to do the same with meta syntax.
... this example shows how to transfer a single value, which is an arraybuffer.
...And 3 more matches
Activity Monitor, Battery Status Menu and top
activity monitor this is a built-in os x tool that shows real-time process measurements.
...they can all be customized to show any of the available measurements (by right-clicking on the column strip) but only the "energy" tab groups child processes with parent processes, which is useful, so it's the best one to use.
... the following screenshot shows a customized "energy" tab.
...And 3 more matches
TimerFirings logging
the following sample shows the basics of this output.
... the above example shows only timers from c++ within gecko.
... there are also timers for settimer or setinterval calls in javascript code, as the following sample shows.
...And 3 more matches
powermetrics
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.
... --show-process-gpu tells it to show per-process gpu measurements.
...And 3 more matches
Gecko Roles
role_progressbar represents a progress bar, dynamically showing the user the percent complete of an operation in progress.
...may use the directory pane to show the contents of a directory.
... role_password_text a text object uses for passwords, or other places where the text content is not shown visibly to the user.
...And 3 more matches
Accessing the Windows Registry Using XPCOM
this article will show you how to use the available interfaces in several mozilla products.
... a simple example here's a simple example showing how to read your windows productid: 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", wrk.access_read); var id = wrk.readstringvalue("productid"); wrk.close(); this example, while simple, shows s...
...you can read the interface documentation for a full explanation, but we will show only the three most commonly used modes here: access_read — for reading values, enumerating keys, and receiving notifications access_write — for setting values and creating sub keys access_all — access for all operations in addition to open() and create(), there are the openchild() and createchild() methods.
...And 3 more matches
inIDOMUtils
.inidomutils); method overview void addpseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); void clearpseudoclasslocks(in nsidomelement aelement); [implicit_jscontext] jsval colornametorgb(in domstring acolorname); nsiarray getbindingurls(in nsidomelement aelement); nsidomnodelist getchildrenfornode(in nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long long getcontentstate(in nsidomelement aelement); void getcsspropertynames([optional] in unsigned long aflags, [optional] out unsigned long acount, [retval, array, size_is(acount)] out wstring aprops); nsisupportsarray getcssstylerules(in nsidomelement aelement, [optional] in domstring apseudo); nsidomnode getparentfornode(in...
... nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long getruleline(in nsidomcssstylerule arule); unsigned long getrulecolumn(in nsidomcssstylerule arule); unsigned long getselectorcount(in nsidomcssstylerule arule); astring getselectortext(in nsidomcssstylerule arule, in unsigned long aselectorindex); unsigned long long getspecificity(in nsidomcssstylerule arule, in unsigned long aselectorindex); nsidomfontfacelist getusedfontfaces(in nsidomrange arange); bool haspseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); boolean isignorablewhitespace(in nsidomcharacterdata adatanode); bool isinheritedproperty(in astring apropertyname); void parsestylesheet(in nsidomcssstyleshe...
... nsidomnodelist getchildrenfornode( in nsidomnode anode, in boolean ashowinganonymouscontent ); parameters anode a dom node for which to retrieve the style nodes.
...And 3 more matches
nsIAccessibleRole
role_progressbar 48 represents a progress bar, dynamically showing the user the percent complete of an operation in progress.
...may use the directory pane to show the contents of a directory.
... role_password_text 82 a text object uses for passwords, or other places where the text content is not shown visibly to the user.
...And 3 more matches
Address Book examples
note that * this does not make acard's photo appear in the contact editor - * this is left to the onshow function.
... * * onshow: function(acard, adocument, atargetid): * called when the editor wants to show this photo type.
... * the onshow method should take the input fields in the document, * and render the requested photo in the img tag with id * atargetid.
...And 3 more matches
Index
address book examples show how to perform various tasks and provide code snippets.
... 13 autoconfig: how to create a configuration file autoconfiguration, thunderbird authoritative definition 14 autoconfiguration in thunderbird moved to autoconfiguration 15 buddy icons in mail seth spitzer mozilla is now able to show icons in the message header area and the addressbook card pane.
... for the message pane, the icon we will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for sender email address>.gif when trying to determine the screenname for the sender, we search the addressbook that we are using for collection.
...And 3 more matches
Demo Addon
it shows how to achieve various goals in a working live example, such as working with gloda.
...afterwards, just click that button to show the demo overview.
...only the interesting parts are shown, it's recommended that you download the add-on and have a look at its files.
...And 3 more matches
about:debugging (before Firefox 68) - Firefox Developer Tools
whether or not system add-ons appear in the list on this page depends on the setting of the devtools.aboutdebugging.showsystemaddons preference.
... before firefox 48 if you change files that are loaded on demand, like content scripts or popups, then changes you make are picked up automatically, and you'll see them the next time the content script is loaded or the popup is shown.
... firefox 48 onwards from firefox 48 onwards: as before: if you change files that are loaded on demand, like content scripts or popups, then changes you make are picked up automatically, and you'll see them the next time the content script is loaded or the popup is shown.
...And 3 more matches
about:debugging - Firefox Developer Tools
your device should show a popup to authorize your computer to connect to it — accept this and then click the refresh devices button again.
...when you do, it is added to the network locations list along with the devices, as shown below: this firefox the this firefox tab combines the features of extensions, tabs, and workers into a single tab with the following sections: temporary extensions displays a list of the extensions that you have loaded using the load temporary add-on button.
... whether internal extensions appear in the list on this page depends on the setting of the devtools.aboutdebugging.showhiddenaddons preference.
...And 3 more matches
AddressErrors - Web APIs
examples snippet: limiting destination countries this first example is just a snippet showing an implementation of the event handler for the shippingaddresschange event which checks to be sure the chosen address is located within one of a limited number of countries.
... request.onshippingaddresschange = handleaddresschange; // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
...And 3 more matches
HTML Drag and Drop API - Web APIs
identify what is draggable making an element draggable requires adding the draggable attribute and the ondragstart global event handler, as shown in the following code sample: <script> function dragstart_handler(ev) { // add the target element's id to the data transfer object ev.datatransfer.setdata("text/plain", ev.target.id); } window.addeventlistener('domcontentloaded', () => { // get the element by id const element = document.getelementbyid("p1"); // add the ondragstart event listener element.addeventli...
...the setdata() method is used to add an item to the drag data, as shown in the following example.
...however, an application may define a custom image with the setdragimage() method, as shown in the following example.
...And 3 more matches
PaymentResponse.retry() - Web APIs
typically you will use this by calling show(), then entering a loop or recursive function that checks the paymentresponse for errors or other reasons to retry the payment request.
... see the example below for a thorough example, but the basic concept, in outline form, is: create a new paymentrequest (new paymentrequest()) display the payment request (paymentrequest.show() if show() resolves, the returned paymentresponse describes the requested payment and the options chosen by the user.
... if show() is rejected, the payment request failed, usually because either there's already one being processed, because the user agent doesn't support any of the specified payment methods, or because of a security issue.
...And 3 more matches
Using the User Timing API - Web APIs
this document shows how to create mark and measure performance entry types and how to use user timing methods (which are extensions of the performance interface) to retrieve and remove entries from the browser's performance timeline.
...the method takes one argument, the name of the mark, as shown in the following example.
...the following examples shows how to use each of these methods (performance.getentries(), performance.getentriesbytype(entrytype), and performance.getentriesbyname(name, entrytype) ) to retrieve one or more marks.
...And 3 more matches
Using DTMF with WebRTC - Web APIs
a <div> to receive and display log text to show status information.
...these will be initialized when the call starts up, in our connectanddial() function, as shown in starting the connection process below.
...this will be obtained while setting up the connection, in the gotstream() function shown in adding the audio to the connection.
...And 3 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
some screen readers can even show information on a refreshable braille display.
...the accessible event watcher shows what accessible events are being generated by a given piece of software.
... the accessible explorer and inspect object tools show the tree of data nodes the accessible object is exposing through com, and what the screen boundaries of each object are.
...And 3 more matches
Consistent list indentation - CSS: Cascading Style Sheets
it hangs alone in the void, simple and unadorned, as shown in figure 1.
...if we add two more list items, we get a result like that shown in figure 2.
...since that parent has no padding or margins yet, we get the situation shown in figure 3.
...And 3 more matches
<input type="image"> - HTML: Hypertext Markup Language
WebHTMLElementinputimage
additional attributes in addition to the attributes shared by all <input> elements, image button inputs support the following attributes: attribute description alt alternate string to display when the image can't be shown formaction the url to which to submit the data formenctype the encoding method to use when submitting the form data formmethod the http method to use when submitting the form formnovalidate a boolean which, if present, indicates that the form shouldn't be validated before submission formtarget a string indicating a browsing context from...
... where to load the results of submitting the form height the height, in css pixels, at which to draw the image src the url from which to load the image width the width, in css pixels, at which to draw the image alt the alt attribute provides an alternate string to use as the button's label if the image cannot be shown (due to error, a user agent that cannot or is configured not to show images, or if the user is using a screen reading device).
... for example, if you have a graphical button that shows an image with an icon and/or image text "login now", you should also set the alt attribute to something like login now.
...And 3 more matches
Paths - SVG: Scalable Vector Graphics
WebSVGTutorialPaths
note, though, that it wouldn't show up if a path was just drawn normally.
... an example of this syntax is shown below, and in the figure to the left the specified control points are shown in red, and the inferred control point in blue.
...this is best explained with an example: <svg width="320" height="320" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 315 l 110 215 a 30 50 0 0 1 162.55 162.45 l 172.55 152.45 a 30 50 -45 0 1 215.1 109.9 l 315 10" stroke="black" fill="green" stroke-width="2" fill-opacity="0.5"/> </svg> the example shows a <path> element that goes diagonally across the page.
...And 3 more matches
Classes and Inheritance - Archive of obsolete content
we will show how to define classes using constructors, and how to use prototypes to efficiently define member functions on each instance.
...we will show how to make inheritance work correctly with respect to constructors, prototypes, and the instanceof operator, and how to override methods in subclasses.
...the last section shows how to work with the class constructor.
...And 2 more matches
Modules - Archive of obsolete content
we will show how to do each of these things using the built-in components object provided by xulrunner application such as firefox and thunderbird.
...we will show how sandboxes and compartments can be used to improve security in our module system.
...we show how to create your own custom loaders, using the loader constructor provided by the sdk.
...And 2 more matches
Storing annotations - Archive of obsolete content
tor, we create and store the new annotation: var annotationeditor = panels.panel({ width: 220, height: 220, contenturl: data.url('editor/annotation-editor.html'), contentscriptfile: data.url('editor/annotation-editor.js'), onmessage: function(annotationtext) { if (annotationtext) handlenewannotation(annotationtext, this.annotationanchor); annotationeditor.hide(); }, onshow: function() { this.postmessage('focus'); } }); listing stored annotations to prove that this works, let's implement the part of the add-on that displays all the previously entered annotations.
... this is implemented as a panel that's shown in response to the widget's right-click message.
... var annotationlist = panels.panel({ width: 420, height: 200, contenturl: data.url('list/annotation-list.html'), contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('list/annotation-list.js')], contentscriptwhen: 'ready', onshow: function() { this.postmessage(simplestorage.storage.annotations); }, onmessage: function(message) { require('sdk/tabs').open(message); } }); since this panel's content script uses jquery we will pass that in too: again, make sure the name of it matches the version of jquery you downloaded.
...And 2 more matches
Creating Reusable Modules - Archive of obsolete content
= require("chrome"); function promptforfile() { const nsifilepicker = ci.nsifilepicker; var fp = cc["@mozilla.org/filepicker;1"] .createinstance(nsifilepicker); var window = require("sdk/window/utils").getmostrecentbrowserwindow(); fp.init(window, "select a file", nsifilepicker.modeopen); fp.appendfilters(nsifilepicker.filterall | nsifilepicker.filtertext); var rv = fp.show(); if (rv == nsifilepicker.returnok || rv == nsifilepicker.returnreplace) { var file = fp.file; // get the path as string.
...join(""); return s; } function promptforfile() { var window = require("sdk/window/utils").getmostrecentbrowserwindow(); const nsifilepicker = ci.nsifilepicker; var fp = cc["@mozilla.org/filepicker;1"] .createinstance(nsifilepicker); fp.init(window, "select a file", nsifilepicker.modeopen); fp.appendfilters(nsifilepicker.filterall | nsifilepicker.filtertext); var rv = fp.show(); if (rv == nsifilepicker.returnok || rv == nsifilepicker.returnreplace) { var file = fp.file; // get the path as string.
... } return path; } require("sdk/ui/button/action").actionbutton({ id: "show-panel", label: "show panel", icon: { "16": "./icon-16.png" }, onclick: function() { console.log(md5file(promptforfile())); } }); this works , but index.js is now getting longer and its logic is harder to understand.
...And 2 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
parameters are as shown in table 1.
...when you run it, you should see a red bar, showing that it failed.
...you should see a green bar showing that the test succeeded.
...And 2 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
first a basic line box containing text, shown in figure 3.
...figure 4 shows what happens when we add an image to the mix.
... the thin red line shows that the single-pixel spacer gif is now only making the cell one pixel tall, as the designer intended.
...And 2 more matches
Simple Storage - Archive of obsolete content
istently stores some data: jetpack.future.import("storage.simple");var mystorage = jetpack.storage.simple;mystorage.fribblefrops = [1, 3, 3, 7];mystorage.heimelfarbs = { bar: "baz" }; and this code -- pretend it's in the same jetpack as the code above -- simply uses that data: mystorage.fribblefrops.foreach(function (elt) console.log(elt));var bar = mystorage.heimelfarbs.bar;jetpack.notifications.show(bar.baz); that's all there is to it!
...all notes are shown in the tools menu.
... if there are no notes, we'll show a// disabled "(empty)" menuitem.function updatejetpackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ?
...And 2 more matches
Simple Storage - Archive of obsolete content
ly stores some data: jetpack.future.import("storage.simple"); var mystorage = jetpack.storage.simple; mystorage.fribblefrops = [1, 3, 3, 7]; mystorage.heimelfarbs = { bar: "baz" }; and this code -- pretend it's in the same jetpack as the code above -- simply uses that data: mystorage.fribblefrops.foreach(function (elt) console.log(elt)); var bar = mystorage.heimelfarbs.bar; jetpack.notifications.show(bar.baz); that's all there is to it!
...all notes are shown in the tools menu.
... if there are no notes, we'll show a // disabled "(empty)" menuitem.
...And 2 more matches
More Button Features - Archive of obsolete content
an example is shown below.
...example 3 : source view <button label="left" image="happy.png"/> <button label="right" image="happy.png" dir="reverse"/> <button label="above" image="happy.png" orient="vertical"/> <button label="below" image="happy.png" orient="vertical" dir="reverse"/> the example here shows all four types of alignment of buttons.
...the image to the right shows the difference.
...And 2 more matches
toolbar - Archive of obsolete content
when set to false, the default, the grippy will be shown.
... icons show only icons.
... text show only text.
...And 2 more matches
Application Update - Archive of obsolete content
application settings you will need to configure the following settings in your application: branding the update process uses branding information, setup branding for your application as described here: xulrunner tips icons the updater process for linux systems requires updater.png to be in your <application folder>/icons/, see https://bugzilla.mozilla.org/show_bug.cgi?id=706846 preferences // whether or not app updates are enabled pref("app.update.enabled", true); // this preference turns on app.update.mode and allows automatic download and // install to take place.
...) default=1 day pref("app.update.nagtimer.download", 86400); // interval: time before prompting the user to restart to install the latest // download (in seconds) default=30 minutes pref("app.update.nagtimer.restart", 1800); // interval: when all registered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // whether or not we show a dialog box informing the user that the update was // successfully applied.
... this is off in firefox by default since we show a // upgrade start page instead!
...And 2 more matches
2006-10-13 - Archive of obsolete content
discussions everyone and his goldfish thinks bug 300198 should be fixed large response to the discussion about the bug: https://bugzilla.mozilla.org/show_bug.cgi?id=300198, regarding middle clicking on a tab.
... user questions about a open/saveas bug that already exisits: https://bugzilla.mozilla.org/show_bug.cgi?id=347230 installer for 2.0rc2 ehume gives the developers a thumbs up for the new installer for 2.0rc2 having a textfield where you can type in the installation directory.
... firefox browser problem: width:30ex does not respect font discussion about a font rendering problem with firefox print on the firefox context menu user would like discussion about why the bug https://bugzilla.mozilla.org/show_bug.cgi?id=204519 is a wontfix.
...And 2 more matches
What is RSS - Archive of obsolete content
blow.example.net/log/19</link> </item> <item> <title>black cat spotted</title> <guid>http://joe-blow.example.net/log/18</guid> <pubdate>fri, 13 may 2005 13:13:13 -0500</pubdate> <link>http://joe-blow.example.net/log/18</link> </item> </channel> </rss> those who create internet radio use rss to allow users to access their shows.
... those who create internet television use rss to allow users to access their shows.
... for example: <?xml version="1.0"?> <rss version="2.0"> <channel> <title>kate's iptv show</title> <description>watch it or else!
...And 2 more matches
Square tilemaps implementation: Scrolling maps - Game development
the camera the camera is an object that holds information about which section of the game world or level is currently being shown.
...static maps: partial tiles might be shown.
... todo: show a diagram here explaining this.
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically.
...the following screenshot shows our controls being listed by voiceover on mac.
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically.
...the following screenshot shows our controls being listed by voiceover on mac.
...And 2 more matches
Practical positioning examples - Learn web development
this article shows how to build some real world examples to illustrate what kinds of things you can do with positioning.
... 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.
... a sliding hidden panel the final example we'll present here is a panel that slides on and off the screen at the press of an icon — as mentioned earlier, this is popular for situations like mobile layouts, where the available screen spaces is small, so you don't want to use up most of it by showing a menu or info panel instead of the useful content.
...And 2 more matches
Responsive design - Learn web development
for example, it might be nice to have a square image for mobile, but show the same scene as a landscape image on desktop.
... or, acknowledging the smaller size of an image on mobile you might want to show a different image altogether, one which is more easily understood at a small screen size.
... as this approach to typography shows, you do not need to restrict media queries to only changing the layout of the page.
...And 2 more matches
UI pseudo-classes - Learn web development
note: this also shows how you can combine a pseudo-class and pseudo-element if required.
...because the :out-of-range rule appears later in the source code than the :required rule, the cascade rules come into play, and the out of range message is shown.
... this works quite nicely — when the page first loads, "required" is shown, along with a red cross and border.
...And 2 more matches
Making asynchronous programming easier with async and await - Learn web development
this example expands on the first version of the code we showed above: async function myfetch() { try { let response = await fetch('coffee.jpg'); if (!response.ok) { throw new error(`http error!
...it response.blob(); let objecturl = url.createobjecturl(myblob); let image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); } } catch(e) { console.log(e); } } myfetch(); the catch() {} block is passed an error object, which we've called e; we can now log that to the console, and it will give us a detailed error message showing where in the code the error was thrown.
... if you wanted to use the second (refactored) version of the code that we showed above, you would be better off just continuing the hybrid approach and chaining a .catch() block onto the end of the .then() call, like this: async function myfetch() { let response = await fetch('coffee.jpg'); if (!response.ok) { throw new error(`http error!
...And 2 more matches
Video and Audio APIs - Learn web development
this article shows you how to do common tasks such as creating custom playback controls.
...as we showed in video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video.
... each <button> has a class name, a data-icon attribute for defining what icon should be shown on each button (we'll show how this works in the below section), and an aria-label attribute to provide an understandable description of each button, since we're not providing a human-readable label inside the tags.
...And 2 more matches
Inheritance in JavaScript - Learn web development
previous overview: objects next with most of the gory details of oojs now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes.
...in this section we'll convert the person and teacher examples from prototypal inheritance to classes, to show you how it's done.
...at this point: to show the current value of the _subject property of the snape object we can use the snape.subject getter method.
...And 2 more matches
Introduction to the server side - Learn web development
static sites the diagram below shows a basic web server architecture for a static site (a static site is one that returns the same hard-coded content from the server whenever a particular resource is requested).
... the diagram below shows a simple architecture for a dynamic website.
... requests for dynamic resources are instead forwarded (2) to server-side code (shown in the diagram as a web application).
...And 2 more matches
Routing in Ember - Learn web development
but now we need a way to differentiate between each of these routes, so that they show what they are supposed to show.
...ute extends route { @service('todo-data') todos; model() { let todos = this.todos; return { get alltodos() { return todos.all; } } } } we can now update the todomvc/app/templates/index.hbs file so that when it includes the <todolist /> component, it does so explicitly with the available model, calling its alltodos() getter to make sure all of the todos are shown.
...('todo-data') todos; model() { let todos = this.todos; return { get completedtodos() { return todos.completed; } } } } we can now update the 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.
...And 2 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
we want the default filter to be all because all of our tasks should be shown initially: const [filter, setfilter] = usestate('all'); defining our filters our goal right now is two-fold: each filter should have a unique name.
... at the top of app.js, beneath our imports but above our app() function, let's add an object called filter_map: const filter_map = { all: () => true, active: task => !task.completed, completed: task => task.completed }; the values of filter_map are functions that we will use to filter the tasks data array: the all filter shows all tasks, so we return true for all tasks.
... the active filter shows tasks whose completed prop is false.
...And 2 more matches
Componentizing our Svelte app - Learn web development
add the following content into the file: <script> export let filter = 'all' </script> <div class="filters btn-group stack-exception"> <button class="btn toggle-btn" class:btn__primary={filter === 'all'} aria-pressed={filter === 'all'} on:click={()=> filter = 'all'} > <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" class:btn__primary={filter === 'active'} aria-pressed={filter === 'active'} on:click={()=> filter = 'active'} > <span class="visually-hidden">show</span> <span>active</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" class...
...:btn__primary={filter === 'completed'} aria-pressed={filter === 'completed'} on:click={()=> filter = 'completed'} > <span class="visually-hidden">show</span> <span>completed</span> <span class="visually-hidden">tasks</span> </button> </div> back in our todos.svelte component, we want to make use of our filterbutton component.
...when entering editing mode we'll show an <input> field to allow us to edit the current todo name, with two buttons to confirm or cancel our changes.
...And 2 more matches
Implementing feature detection - Learn web development
therefore, you can detect whether the browser supports geolocation or not by using something like the following: if ("geolocation" in navigator) { navigator.geolocation.getcurrentposition(function(position) { // show the location on a map, perhaps using the google maps api }); } else { // give the user a choice of static maps instead perhaps } it is probably better to use an established feature detection library however, rather than writing your own all the time.
...the example shown is a way of detecting html5 canvas support.
... update your <link> element in your html so it points to the correct css file (you should also update your <title> element to something more suitable!): <link href="modernizr-css.css" rel="stylesheet"> above this <link> element, add a <script> element to apply the modernizr library to the page, as shown below.
...And 2 more matches
L10n Checks
you pass both paths to the files, e.g.: check-l10n-completeness -i file en-us.dtd my.dtd the output the output of l10n checks shows the missing and obsolete strings in a pseudo-diff format.
... ab-cd browser chrome/browser browser.dtd +backforwardmenu.tooltip +fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name.
... the file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper.
...And 2 more matches
Mozilla Web Developer FAQ
when the alternative text is shown in a tooltip, some authors write bad alt texts, because they intend the text as auxiliary tooltip text and not as a replacement for the image.
... (‘bad’ in the sense that the textual alternative is less useful for people who don’t see the image.) when the alternative text is shown in a tooltip, other authors don’t want to supply textual alternatives at all, because they don’t want tooltips to appear.
... (again, making things harder for people who don’t see the image.) there is another attribute that mozilla shows as a tooltip: title.
...And 2 more matches
Localization Use Cases
in all presented examples, we try to show the existing code, explain the problem from the localizers' or developers' perspective, and suggest a solution.
...first, there is devicestoragehelper.showformatedsize (sic): function showformatedsize(element, l10nid, size) { if (size === undefined || isnan(size)) { element.textcontent = ''; return; } // kb - 3 kb (nearest ones), mb, gb - 1.2 mb (nearest tenth) var fixeddigits = (size < 1024 * 1024) ?
...treadablefilesize(size, fixeddigits); var _ = navigator.mozl10n.get; element.textcontent = _(l10nid, { size: sizeinfo.size, unit: _('byteunit-' + sizeinfo.unit) }); } the function is used like so: // application storage updateappfreespace: function storage_updateappfreespace() { var self = this; this.getfreespace(this.appstorage, function(freespace) { devicestoragehelper.showformatedsize(self.appstoragedesc, 'availablesize', freespace); }); }, problem definition for all values of freespace, the following string is enough to construct a grammatically-correct sentence in english: availablesize = {{$size}} {{$unit}} available however, other languages might need to pluralize this string with different forms of the available adjective.
...And 2 more matches
NSS Sample Code Sample1
this program shows the following: rsa key pair generation naming rsa key pairs looking up a previously generated key pair by name creating aes and mac keys (or encryption and mac keys in general) wrapping symmetric keys using your own rsa key pair so that they can be stored on disk or in a database.
... as an alternative to token symmetric keys as a way to store large numbers of symmetric keys wrapping symmetric keys using an rsa key from another server unwrapping keys using your own rsa key pair the main part of the program shows a typical sequence of events for two servers that are trying to extablish a shared key pair.
...sample code #include <iostream.h> #include "pk11pub.h" #include "keyhi.h" #include "nss.h" // key management for keys share among multiple hosts // // this example shows how to use nss functions to create and // distribute keys that need to be shared among multiple servers // or hosts.
...And 2 more matches
XForms Accessibility
instance node states are mapped to accessibility state constants declared in nsiaccessiblestates interface like it shown below: relevant - state_unavailable readonly - state_readonly required - state_required invalid - state_invalid out of range - state_invalid attributes redefines datatype aria attribute.
... input a key xforms element to show and change the instance data to which it is bound (see the spec, the docs).
... textarea serves to show/change multiline text (see the spec, the docs).
...And 2 more matches
An Overview of XPCOM
nsisupports, shown below, supplies the basic functionality for dealing with interface discovery and reference counting.
...the nsisupports interface is shown below: the nsisupports interface class sample: public nsisupports { private: nsrefcnt mrefcnt; public: sample(); virtual ~sample(); ns_imethod queryinterface(const nsiid &aiid, void **aresult); ns_imethod_(nsrefcnt) addref(void); ns_imethod_(nsrefcnt) release(void); }; the various types used in the interface are described in the xpcom types section below.
... a complete (if spare) implementation of the nsisupports interface is shown below.
...And 2 more matches
Starting WebLock
the observer interfaces the above figure shows the observer service maintaining a list of all registered nsiobserver objects.
... the next section shows the interface of the weblock component, iweblock, in xpidl.
...this kind of implementation does not exist, but this expandability shows some of the flexibility that interface-based programming can provide.
...And 2 more matches
nsIDOMNSHTMLDocument
inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void captureevents(in long eventflags); void clear(); boolean execcommand(in domstring commandid, in boolean doshowui, in domstring value); boolean execcommandshowhelp(in domstring commandid); obsolete since gecko 14.0 domstring getselection(); nsidomdocument open(in acstring acontenttype, in boolean areplace); boolean querycommandenabled(in domstring commandid); boolean querycommandindeterm(in domstring commandid); boolean querycommandstate(in domstring co...
...execcommand() boolean execcommand( in domstring commandid, in boolean doshowui, in domstring value ); parameters commandid the name of the command to execute.
... doshowui this is not implemented in gecko.
...And 2 more matches
nsIMacDockSupport
cksupport); var win = services.wm.getmostrecentwindow('navigator:browser'); var macmenu = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menupopup'); macmenu.setattribute('id', 'mymacmenu'); var macmenuitem = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem'); macmenuitem.setattribute('label', 'show most recent window'); macmenuitem.setattribute('id', 'mymacmenuitem'); macmenuitem.addeventlistener('command', function(){ var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksupport); docksupport.activateapplication(true); services.wm.getmostrecentwindow(null).focus() }) macmenu.appendchild(macmenuitem); var mainpopupset = win.document.getelementbyid('mainp...
...appendchild(macmenu); let dockmenuelement = macmenu; //document.getelementbyid("menu_mac_dockmenu");66 let nativemenu = cc["@mozilla.org/widget/standalonenativemenu;1"].createinstance(ci.nsistandalonenativemenu); console.log('dockmenuelement:', dockmenuelement); nativemenu.init(dockmenuelement); docksupport.dockmenu = nativemenu; this replaces the default menu with this one menuitem that says "show most recent window".
...the result of this code is shown below.
...And 2 more matches
nsIWebBrowserChrome
inherits from: nsisupports last changed in gecko 0.9.6 method overview void destroybrowserwindow(); void exitmodaleventloop(in nsresult astatus); boolean iswindowmodal(); void setstatus(in unsigned long statustype, in wstring status); void showasmodal(); void sizebrowserto(in long acx, in long acy); attributes attribute type description chromeflags unsigned long the chrome flags for this browser chrome.
... the implementation should reflect the value of this attribute by hiding or showing its chrome appropriately.
...void exitmodaleventloop( in nsresult astatus ); parameters astatus the result code to return from showasmodal().
...And 2 more matches
WebIDL bindings
this will produce two files in dom/bindings in your objdir: myinterface-example.h and myinterface-example.cpp, which show a basic implementation of the interface using a class that inherits from nsisupports and has a wrapper cache.
...this means that accessing a content global via xrays will show [chromeonly] interface objects on it.
... see https://bugzilla.mozilla.org/show_bug.cgi?id=1333117 for details.
...And 2 more matches
UI Tour - Firefox Developer Tools
the name of the selected directory is shown at the top of the source list pane; clicking this name reverts the pane to showing all source items.
... outline view the outline view shows a tree for navigating the currently open file.
... source pane this shows the javascript file currently loaded.
...And 2 more matches
Memory - Firefox Developer Tools
it then provides a number of views of the heap that can show you which objects account for memory usage and exactly where in your code you are allocating memory.
... once you've taken a snapshot, there are three main views the memory tool provides: the tree map view shows memory usage as a treemap.
... the aggregate view shows memory usage as a table of allocated types.
...And 2 more matches
Allocations - Firefox Developer Tools
the allocations view in the performance tool shows you which functions in your page are allocating the most memory over the course of the profile.
... it includes the following columns: self count: the number of allocation-samples that were taken in this function (also shown as a percentage of the total) self bytes: the total number of bytes allocated in the allocation-samples in this function (also shown as a percentage of the total) rows are sorted by the "self bytes" column.
... gc events are shown as red markers in the waterfall view, and are a big red flag for responsiveness, sometimes running for hundreds of milliseconds: if you're seeing gc events in your site's performance profile, what can you do?
...And 2 more matches
Flame Chart - Firefox Developer Tools
the flame chart shows you the state of the javascript stack for your code at every millisecond during the performance profile.
... but while the call tree organizes this data to show you where your program is spending most time in aggregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing.
... essentially it shows you the state of the call stack at any given point during the recording.
...And 2 more matches
Settings - Firefox Developer Tools
show split console adds a section at the bottom of the tools showing the console.
...the "select element" button is now always shown.
... if common preferences is not included in the settings, web console logs can be persisted by using the 'about:config' url in browser address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true inspector show browser styles a setting to control whether styles applied by the browser (user-agent styles) should be displayed in the inspector's rules view.
...And 2 more matches
Examples of web and XML development using the DOM - Web APIs
example 1: height and width the following example shows the use of the height and width properties alongside images of varying dimensions: <!doctype html> <html lang="en"> <head> <title>width/height example</title> <script> function init() { var arrimages = new array(3); arrimages[0] = document.getelementbyid("image1"); arrimages[1] = document.getelementbyid("image2"); arrimages[2] = document.getelementbyid("image3"); var objoutput = document.getelementbyid("output"); var strhtml = "<ul>"; for (var i = 0; i < arrimages.length; i++) { strhtml += "<li>image" + ...
... getcomputedstyle() returns a computedcssstyledeclaration object, whose individual style properties can be referenced with this object's getpropertyvalue() method, as the following example document shows.
...it also shows a useful technique of using a for..in loop to iterate over the properties of an object to get their values.
...And 2 more matches
Using files from web applications - Web APIs
example: showing file(s) size the following example shows a possible use of the size property: <!doctype html> <html> <head> <meta charset="utf-8"> <title>file(s) size</title> </head> <body> <form name="uploadform"> <div> <input id="uploadinput" type="file" name="myfiles" multiple> selected files: <span id="filenum">0</span>; total size: <span id="filesize">0</span> </div> ...
...you need to provide a visual cue for the focus status of the hidden input field on its label, be it an outline as shown above, or background-color or box-shadow.
... (as of time of writing, firefox doesn’t show this visual cue for <input type="file"> elements.) selecting files using drag and drop you can also let the user drag and drop files into your web application.
...And 2 more matches
HTMLDialogElement.open - Web APIs
true means it is set, and therefore the dialog is shown.
... false means it not set, and therefore the dialog is not shown.
... the property is now read only — it is possible to set the value to programmatically show or hide the dialog.
...And 2 more matches
Capabilities, constraints, and settings - Web APIs
getting the constraints in effect if at any time you need to fetch the set of constraints that are currently applied to the media, you can get that information by calling mediastreamtrack.getconstraints(), as shown in the example below.
... the html and css for this example are pretty simple, and aren't shown here.
...the actual settings the browser selected and is using are shown in the boxes on the right.
...And 2 more matches
Fundamentals of WebXR - Web APIs
this includes both managing the process of rendering the views needed to simulate the 3d experience and the ability to sense the movement of the headset or other motion sensing apparatus to provide the needed data to let you update the imagery shown to the user based on that movement.
... the drawing shown here demonstrates the concept of fov.
... diagram showing the movements possible with 3 degree of freedom hardware: yaw, roll, and pitch.
...And 2 more matches
window.location - Web APIs
WebAPIWindowlocation
location.reload(true); example #3 consider the following example, which will reload the page by using the replace() method to insert the value of location.pathname into the hash: function reloadpagewithhash() { var initialpage = location.pathname; location.replace('http://example.com/#' + initialpage); } example #4: display the properties of the current url in an alert dialog: function showloc() { var olocation = location, alog = ["property (typeof): value", "location (" + (typeof olocation) + "): " + olocation ]; for (var sprop in olocation){ alog.push(sprop + " (" + (typeof olocation[sprop]) + "): " + (olocation[sprop] || "n/a")); } alert(alog.join("\n")); } // in html: <button onclick="showloc();">show location properties</button> example #5: send a string of data to...
... example #6: using bookmarks without changing the hash property: <!doctype html> <html> <head> <meta charset="utf-8"/> <title>mdn example</title> <script> function shownode (onode) { document.documentelement.scrolltop = onode.offsettop; document.documentelement.scrollleft = onode.offsetleft; } function showbookmark (sbookmark, busehash) { if (arguments.length === 1 || busehash) { location.hash = sbookmark; return; } var obookmark = document.queryselector(sbookmark); if (obookmark) { shownode(obookmark); } } </script> <style> span.intlink { cursor:...
...praesent bibendum condimentum feugiat.</p> <p id="mybookmark1">[&nbsp;<span class="intlink" onclick="showbookmark('#mybookmark2');">go to bookmark #2</span>&nbsp;]</p> <p>vivamus blandit massa ut metus mattis in fringilla lectus imperdiet.
...And 2 more matches
Text labels and names - Accessibility
examples the following example show a simple image map (taken from h24: providing text alternatives for the area elements of image maps): <img src="welcome.gif" usemap="#map1" alt="areas in the library.
... examples the following example shows a simple dialog box, defined as such using role="dialog" and labelled using aria-labelledby.
...a descriptive title helps users of assistive technology understand what the element is showing.
...And 2 more matches
Border-image generator - CSS: Cascading Style Sheets
gin: 10px 0; } #toggle-gallery { width: 30px; height: 25px; margin: 10px; color: #fff; background-image: url('https://mdn.mozillademos.org/files/6005/arrow-up-white.png'); background-repeat: no-repeat; background-position: top 4px center; background-color: #888888 !important; border-radius: 2px; float: left; } #toggle-gallery:hover { cursor: pointer; } #toggle-gallery[data-action='show'] { background-image: url('https://mdn.mozillademos.org/files/6001/arrow-down-white.png'); background-color: #888888 !important; } #toggle-gallery[data-action='hide'] { background-image: url('https://mdn.mozillademos.org/files/6005/arrow-up-white.png'); } .button { width: 100px; height: 25px; margin: 10px; color: #fff; text-align: center; font-size: 12px; line-height: 25px; backgroun...
...function getscale() { return scale/100; }; var togglegallery = function togglegallery() { var gallery = getelembyid('image-gallery'); var button = getelembyid('toggle-gallery'); var state = 1; button.addeventlistener('click', function() { state = 1 ^ state; if (state === 0) { gallery.setattribute('data-collapsed', 'true'); button.setattribute('data-action', 'show'); } else { gallery.removeattribute('data-collapsed'); button.setattribute('data-action', 'hide'); } }); }; var init = function init() { var gallery = getelembyid('image-gallery'); var browse = getelembyid('load-image'); var remote = getelembyid('remote-url'); var load_remote = getelembyid('load-remote'); remote.addeventlistener('change', function(){ ...
...dermanager.setprecision('unit-step', value); inputslidermanager.setstep('unit-step', step_option[value]); inputslidermanager.setmin('unit-step', step_option[value]); if (unit_topic) inputslidermanager.setprecision(unit_topic, value); }; var updateunitsettings = function updateunitsettings(value) { if (unit_topic) inputslidermanager.setstep(unit_topic, value); }; var show = function show(e) { var topic = e.target.getattribute('data-topic'); var precision = inputslidermanager.getprecision(topic); var step = inputslidermanager.getstep(topic); unit_topic = topic; title.textcontent = topic; panel.setattribute('data-active', 'true'); panel.style.top = e.target.offsettop - 40 + 'px'; panel.style.left = e.target.offsetleft + 30 + 'px'; input...
...And 2 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
WebHTMLElementaudio
the above example shows simple usage of the <audio> element.
... in a similar manner to the <img> element, we include a path to the media we want to embed inside the src attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc.
... the content inside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element.
...And 2 more matches
<base>: The Document Base URL element - HTML: Hypertext Markup Language
WebHTMLElementbase
target a keyword or author-defined name of the default browsing context to show the results of navigation from <a>, <area>, or <form> elements without explicit target attributes.
... the following keywords have special meanings: _self (default): show the result in the current browsing context.
... _blank: show the result in a new, unnamed browsing context.
...And 2 more matches
<input type="radio"> - HTML: Hypertext Markup Language
WebHTMLElementinputradio
they are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below.
...the value is never shown to the user by their user agent.
... selecting a radio button by default to make a radio button selected by default, you simply include checked attribute, as shown in this revised version of the previous example: <form> <p>please select your preferred contact method:</p> <div> <input type="radio" id="contactchoice1" name="contact" value="email" checked> <label for="contactchoice1">email</label> <input type="radio" id="contactchoice2" name="contact" value="phone"> <label for="contactchoice2">phone</label> <input type="ra...
...And 2 more matches
Object.defineProperty() - JavaScript
normal property addition through assignment creates properties which show up during property enumeration (for...in loop or object.keys method), whose values may be changed, and which may be deleted.
... enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object.
...for non-symbols properties it also defines whether it shows up in a for...in loop and object.keys() or not.
...And 2 more matches
Promise - JavaScript
for the nesting shown above, suppose the .then() associated with "promise b" returns a nextvalue of "promise x".
..." + successmessage) }); example with diverse situations this example shows diverse techniques for using promise capabilities, and diverse situations that can occur.
... 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.
...And 2 more matches
Forms related code snippets - Archive of obsolete content
autogrowing <textarea> this example shows how to make a textarea really autogrowing during a typing.
... insert some custom text in a <textarea> this example shows how to insert some html tags or smiles or any custom text in a textarea.
... image preview before upload the filereader.prototype.readasdataurl() method can be useful, for example, to get a preview of an image before uploading it.[article] this example shows how to use it in this way.
... filter the digitation into a form field this example shows the use of the onkeypress event during a digitation into a form field in order to match some rules.
Install Manifests - Archive of obsolete content
link in the extension's context menu will show this dialog, rather than the default.
...if this property is specified, when the extension is selected in the extensions list, the options button is enabled and will show this.
... hidden firefox 1.0 - 3.5 a boolean value that when true makes the add-on not show up in the add-ons list, provided the add-on is installed in a restricted access area (so it does not work for add-ons installed in the profile).
...if the add-on specified by the <em:id> tag is not installed or has an incompatible version, the extension manager will disable your extension and show the message "requires additional items".
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
listing 1: xml syntax <elementname someattribute="somevalue"> content </elementname> as shown in listing 1, xml uses elements, which consist of an opening tag, a closing tag, and content.
...as shown in listing 1, it has an extremely simple syntax.
... javascript is a prototype-based object-oriented language, and as shown in listing 3, also permits independent class definitions.
...listing 4 shows an example that deletes the second child element of the element with the "toolbar" id, adds a new button element as a substitute, and sets a label attribute.
User Notifications and Alerts - Archive of obsolete content
the "remember password" prompt is the one that shows up the most often.
...the notification shows up again when you come back to the tab that displayed it.
...on the other hand, alerts are displayed only temporarily using the alerts service is similar to using notification boxes: let alertsservice = cc["@mozilla.org/alerts-service;1"].getservice(ci.nsialertsservice); let title = this._bundle.getstring("xulschoolhello.greeting.title"); let message = this._bundle.getstring("xulschoolhello.greeting.label"); alertsservice.showalertnotification( "chrome://xulschoolhello/skin/hello-notification.png", title, message, true, "", this, "xulschool hello message"); we pass this as an argument, assuming that this is an object that implements nsiobserver.
... because of the inconsistent support and temporary nature of these alerts, we don't recommend using this service to show information the user needs to know and can't get in any other way.
JXON - Archive of obsolete content
in this article we will show how to convert a parsed xml document (i.e.
...becomes { "while": true, wend: false, "only-if": null } within a string, closing elements "</" are escaped as "<\/" <root><![cdata[<script>alert("yes");</script>]]></root> becomes { script: "<script>alert(\"yes\")<\/script>" } dates are created as new date objects <root>2006-12-25</root> becomes new date(2006, 12 - 1, 25) attributes and comments are shown as comments (for testing purposes): <!--testing--><root><test version="1.0">123</test></root> becomes /* testing */ { test /* @version = "1.0" */ : 123} a bit of indentation is done, to keep things legible note: our algorithms comply with the point 3 (but without month decrease).
... the following table shows the corresponding conversion patterns between xml and json according to the third algorithm.
...xt": "hello world!" } you must just create an xml document with the following structure: <myboolean>true</myboolean> <myarray>cinema</myarray> <myarray>hot dogs</myarray> <myarray>false</myarray> <myobject> <nickname>jack</nickname> <registration_date>dec 25, 1995</registration_date> <privileged_user /> </myobject> <mynumber>99</mynumber> <mytext>hello world!</mytext> this example also shows how the ideal jxon document is an xml document designed specifically to be converted in json format, though our algorithms work fine with any kind of xml document.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
my tests were on windows vista, and i noticed at least one difference, it is that paths changed; now the profile is in (for my procacci user sample): c:\users\procacci\appdata\roaming\thunderbird\profiles\v6we4uku.default start in debug mode in comand line interface: debug with displayerror() here's the result, i used the displayerror() method ( not the best way :-( see bug 206294 ) to show environment and ldap variables in order to check that it worked fine.
... the displayerror() function does not work properly in thunderbird 3.1: see https://bugzilla.mozilla.org/show_bu...?id=502597#c34 a usable workaround is placing the following code at the top of your autoconfig script: // enable logging.
...function displayerror(title, msg) { log.debug(title + ": " + msg); alerts.showalertnotification("chrome://branding/content/icon48.png", title, msg); } firefox it's the same principles as for firefox as it was described above for thunderbir.
... getldapattributes("ldap2.int-evry.fr","ou=people,dc=int-evry,dc=fr","uid=" + env_user,"uid,cn,mail,labeleduri"); // close the try, and call the catch() } catch(e) {displayerror("lockedpref", e);} debug if you set a username and the mozilla_debug variable ($export mozilla_debug=1; export user=procacci), then the displayerror() will show you this popup: that's a popup titled as "error", but it's just a debug tool for me as i didn't find any other way to popup information.
HostWindow - Archive of obsolete content
the window does have some ui components (as shown in the screenshot below).
... prism can be configured to show or hide several of the ui components.
...the splitter itself cannot be hidden as it is the only ui to show a collapsed sidebar.
...command menu - a popup menu showing several prism-specific commands.
Menus - Archive of obsolete content
menu tag overview the following shows a simple menu example, containing a menubar with a single menu labeled 'file'.
...the example below shows a menubar with three menus.
...the following shows a simple help menu.
... if you wish to have slight differences between each window, one possibility is to show or hide menu items in a load event listener.
Positioning - Archive of obsolete content
there are several possible values for the position attribute, described here, along with images which show how a popup would be aligned in each case.
... valid values for the anchor alignment (ie, the first word) are shown below anchor alignment values topleft the popup will be aligned with the upper-left corner of the anchor.
... valid values for the popup alignment (ie, the second word) are shown below popup alignment values topleft the top-left corner of the popup will be aligned with the specified corner or edge of the anchor element.
... the following table shows the valid values, corresponding explicit (ie, 2 word) alignment values and an example of the alignment.
Filtering - Archive of obsolete content
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 content gets rebuilt with the desired filter applied.
... add the type to the two countries in the datasource, as well as ensure that the namespace is declared on the root rdf tag: <nso:country about="http://www.daml.org/2001/09/countries/iso#it" dc:title="italy"/> <nso:country about="http://www.daml.org/2001/09/countries/iso#nl" dc:title="netherlands"/> the type of these two resources, when expanded with the namespace (not shown here), will be 'http://www.daml.org/2001/09/countries/country-ont#country'.
...the complete example shows this working.
Document Object Model - Archive of obsolete content
also, we'll add an id attribute so that we can refer to it in a script to show and hide it.
... while we're at it, let's also hide the splitter and results tree as we only need to show them after a search is performed.
...if you haven't done this, do that now, as shown below.
... the following example shows how to iterate over the children of the root node: var childnodes = document.documentelement.childnodes; for (var i = 0; i < childnodes.length; i++) { var child = childnodes[i]; // do something with child } the childnodes variable will hold the children of the document root element.
XUL accessibility guidelines - Archive of obsolete content
the following example shows a javascript function that can be called before destroying an element to check for focus and move it if necessary.
...instead, use the text of a label enclosed in the label tags, and do not use the value attribute, as shown below for the password field.
...for example, the first item in the privacy panel in the firefox option dialog (discussed and shown above) is [checkbox] remember visited pages for the last [textbox] days.
...the correct label for textbox is actually the same, but we don't want assistive technologies to read or show it twice.
XUL controls - Archive of obsolete content
<checkbox label="show toolbar labels" checked="true"/> more information about the checkbox element.
... <colorpicker color="#ff0000"/> colorpicker reference <colorpicker type="button"> a specialized type of color picker which shows only a button.
... textbox reference <textbox type="autocomplete"> a textbox that provides a dropdown showing matches that would complete what the user types.
... <toolbarbutton type="menu" label="show"> <menupopup> <menuitem label="toolbars"/> <menuitem label="status bar"/> </menupopup> </toolbarbutton> more information about this type of menu toolbarbutton element.
browser - Archive of obsolete content
attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disablesecurity, droppedlinkhandler, homepage, showcaret, src, type properties accessibletype, cangoback, cangoforward, contentdocument, contentprincipal, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, webprogress methods addprogresslistener, goback, goforwa...
...rd, gohome, gotoindex, loaduri, loaduriwithflags, reload, reloadwithflags, removeprogresslistener, stop, swapdocshells examples <!-- shows mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox> attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
... showcaret type: boolean whether or not to cause a typing caret to be visible in the content area.
...during the swap, pagehide and pageshow events are fired on both browsers.
dialog - Archive of obsolete content
disclosure: a button to show more information.
... warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply.
...the cancel button might be shown as an additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os).
... disclosure: a button to show more information.
tabbrowser - Archive of obsolete content
attributes autocompleteenabled, autocompletepopup, autoscroll, contentcontextmenu, contenttooltip, handlectrlpageupdown, onbookmarkgroup, onnewtab, tabmodalpromptshowing properties browsers, cangoback, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, securityui, selectedbrowser, selectedtab, sessionhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webprogress methods addprogresslistener, addtab, addtabsprogressl...
...on, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loadonetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadalltabs, reloadtab, reloadwithflags, removealltabsbut, removecurrenttab, removeprogresslistener, removetab, removetabsprogresslistener,replacegroup, selecttabatindex, seticon, showonlythesetabs, stop, unpintab attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
... tabmodalpromptshowing type: integer the number of tab modal prompts currently attached to the current tab.
... showonlythesetabs( atabs ) return type: no return value makes all tabs in the atabs array visible, and all other tabs hidden.
Getting started with XULRunner - Archive of obsolete content
*/ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); xulrunner specific preferences include: toolkit.defaultchromeuri specifies the default window to open when the application is launched.
... main.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="my app" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://myapp/content/main.js"/> <caption label="hello world"/> <separator/> <button label="more >>" oncommand="showmore();"/> <separator/> <description id="more-text" hidden="true">this is a simple xulrunner application.
...most xul applications will include some external javascript, so the sample application does too, just to show how to include it into the xul file.
... main.js: function showmore() { document.getelementbyid("more-text").hidden = false; } for more information about xul see: xul.
Encryption and Decryption - Archive of obsolete content
with most symmetric algorithms, the same key is used for both encryption and decryption, as shown in figure 1.
...figure 2 shows a simplified view of the way public-key encryption works.
... the scheme shown in figure 2 lets you freely distribute a public key, and only you will be able to read data encrypted using this key.
... as it happens, the reverse of the scheme shown in figure 2 also works: data encrypted with your private key can be decrypted only with your public key.
Settings - Archive of obsolete content
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 original sources enabling this option will make the debugger use source maps, if they are available, to display the original source for code which has been combined, minified, or even compiled to javascript from a language like coffeescript.
-ms-filter - Archive of obsolete content
examples the following example shows how to use the -ms-filter attribute in internet explorer 8.
... code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_8.htm -ms-filter: 'progid:dximagetransform.microsoft.motionblur(strength=50), progid:dximagetransform.microsoft.basicimage(mirror=1)'; the following example shows how to use an inline style sheet to set the filter on an image.
... code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_h.htm <img style="filter:progid:dximagetransform.microsoft.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.
...use commas (,) to separate multiple values, as shown in the examples section.
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
sample output is shown in listing 2.
...listing 6 shows the beginning of our application which takes advantage of some of these concepts.
...the completed user interface is shown in figure 1.
...listing 8 shows the two functions used to handle the comment submission process.
XForms Custom Controls - Archive of obsolete content
we will also show you how to create custom controls that work with the xforms model and are automatically updated just like xforms controls.
...for example, you might want to render images that are held inside an instance document or you would like to show a disabled trigger when its bound node becomes irrelevant rather than having it not display (the current default behavior).
...here is a snippet from our .css file to show the type of css rule we would use to make such a determination.
...the following list shows where the base bindings for our xforms controls are defined: xforms.xml - contains the base bindings for output, label, trigger, submit, case, message, hint, help, alert, upload and repeat xforms controls.
Mozilla XForms User Interface - Archive of obsolete content
input a key xforms element to show and change the instance data to which it is bound.
...textarea serves to show/change multiline text (see the spec).
... output serves to show the instance data that the element is bound to in a read-only manner (see the spec).
...alert this message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec).
Index - Game development
14 bounding volume collision detection with three.js 3d, games, javascript, webgl, bounding boxes, collision detection, three.js this article shows how to implement collision detection between bounding boxes and spheres using the three.js library.
...in this series of articles we will show you how you can approach building a game that can be played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads.
...this article explains more about this, and shows you how to use libraries to implement data channels in your game.
... 71 touch event horizon needscontent, needsexample this tutorial shows how to use touch events to create a game on a <canvas>.
Extra lives - Game development
new variables add the following new variables below the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives.
... the lifelosttext will be shown only when the life is lost, so its visibility is initially set to false.
...instead of executing an anonymous function and showing the alert right away : ball.events.onoutofbounds.add(function(){ alert('game over!'); location.reload(); }, this); we will assign a new function called ballleavescreen; delete the previous event handler (shown above) and replace it with the following line: ball.events.onoutofbounds.add(ballleavescreen, this); we want to decrease the number of lives every time the ball leaves the ...
... when the number of available lives reaches zero, the game is over and the game over alert message will be shown.
Styling links - Learn web development
in this article we'll build on this knowledge, showing you best practices for styling links.
...if you get really stuck, press the show solution button to insert the example we showed above.
...g: 10px;border: 1px solid #0095dd;">a { } a:link { } a:visited { } a:focus { } a:hover { } a:active { }</textarea> <h2>output</h2> <div class="output" style="width: 90%;height: 10em;padding: 10px;border: 1px solid #0095dd;"></div> <div class="controls"> <input id="reset" type="button" value="reset" style="margin: 10px 10px 0 0;"> <input id="solution" type="button" value="show solution" style="margin: 10px 0 0 10px;"> </div> </div> var htmlinput = document.queryselector(".html-input"); var cssinput = document.queryselector(".css-input"); var reset = document.getelementbyid("reset"); var htmlcode = htmlinput.value; var csscode = cssinput.value; var output = document.queryselector(".output"); var solution = document.getelementbyid("solution"); var styleelem = docume...
... we also use background-size to specify the size we want the background image to be shown at — it is useful to have a larger icon and then resize it like this as needed for responsive web design purposes.
Advanced form styling - Learn web development
the following live example shows you what they look like in your system — default on the left, and with the above css applied on the right (find it here also if you want to test it on other systems).
...; } different browsers handle this in many different, often ugly ways: browser rendering firefox 71 (macos) firefox 57 (windows 10) chrome 77 (macos), safari 13, opera chrome 63 (windows 10) internet explorer 11 (windows 10) edge 16 (windows 10) using appearence: none on radios/checkboxes as we showed before, you can remove the default appearance of a checkbox or radio button altogether with appearance:none; let's take this example html: <form> <fieldset> <legend>fruit preferences</legend> <p> <label> <input type="checkbox" name="fruit-1" value="cherry"> i like cherry </label> </p> <p> <label> <input type="checkbox" name="fruit-2"...
... take the following example, which shows a number of the "ugly" form features in action: this example has the following css applied to it: body { font-family: 'josefin sans', sans-serif; margin: 20px auto; max-width: 400px; } form > div { margin-bottom: 20px; } select { -webkit-appearance: none; appearance: none; } .select-wrapper { position: relative; } .select-wrapper::after { content: "▼"; font-size: 1rem...
...however, in the case of the number type the data being collected is simpler, and it is easy to just use a text input type instead if desired (or tel if you want mobile browsers to show the numeric keypad).
Basic native form controls - Learn web development
the following screenshot shows default, focused and disabled text input types in firefox 71 and safari on macos and in chrome 79 and edge 18 on windows 10.
... the following screenshots show default, focused and disabled checkboxes in firefox 71 and safari 13 on macos and chrome 79 and edge 18 on windows 10: note: any checkboxes and radio buttons with the checked attribute on load match the :default pseudo class, even if they are no longer checked.
...abel for="soup">soup</label> <input type="radio" id="soup" name="meal" value="soup" checked> </li> <li> <label for="curry">curry</label> <input type="radio" id="curry" name="meal" value="curry"> </li> <li> <label for="pizza">pizza</label> <input type="radio" id="pizza" name="meal" value="pizza"> </li> </ul> </fieldset> the following screenshots show unchecked and checked radio buttons, radio buttons that have focus, and disabled unchecked and checked radio buttons — on firefox 71 and safari 13 on macos and chrome 79 and edge 18 on windows 10.
... the following examples show default, focused, and disabled button input types — in firefox 71 and safari 13 on macos and chrome 79 and edge 18 on windows 10.
Other form controls - Learn web development
the following screenshots show default, focused, and disabled <textarea> elements in firefox 71 and safari 13 on macos, and edge 18, yandex 14, firefox 71 and chrome 79 on windows 10.
...so value attributes are not needed, but you might find a reason to want to send a shortened or different value to the server than what is visually shown in the select box.
... the following screenshot shows the datalist fallback as rendered in safari 6: if you use this fallback, ensure the data for both the <input> and the <select> are collected server-side.
...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.
Styling web forms - Learn web development
the screenshots below show the difference.
...to give the same size to several different widgets, you can use the box-sizing property along with some consistent values for other properties: input, textarea, select, button { width : 150px; padding: 0; margin: 0; box-sizing: border-box; } in the screenshot below, the left column shows the default rendering of an <input type="radio">, <input type="checkbox">, <input type="range">, <input type="text">, <input type="date"> input, <select>, <textarea>,<input type="submit">, and <button>.
... the right column on the other hand shows the same elements with our above rule applied to them.
...add all the code blocks shown below inside the <style> element, one after another.
HTML basics - Learn web development
if they overlap as shown above, then your web browser will try to make the best guess at what you were trying to say, which can lead to unexpected results.
...this element acts as a container for all the stuff you want to include on the html page that isn't the content you are showing to your page's viewers.
...this contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else.
... wrap the text in an <a> element, as shown below: <a>mozilla manifesto</a> give the <a> element an href attribute, as shown below: <a href="">mozilla manifesto</a> fill in the value of this attribute with the web address that you want the link to link to: <a href="https://www.mozilla.org/about/manifesto/">mozilla manifesto</a> you might get unexpected results if you omit the https:// or http:// part, called the protocol, ...
Introduction to events - Learn web development
the earliest method of registering event handlers found on the web involved event handler html attributes (or inline event handlers) like the one shown above — the attribute value is literally the javascript code you want to run when the event occurs.
...let's look at an example to make this easier — open up the show-video-box.html example in a new tab (and the source code in another tab.) it is also available live below: this is a pretty simple example that shows and hides a <div> with a <video> element inside it: <button>display video</button> <div class="hidden"> <video> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't ...
...here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> </div> when the <button> is selected, the video is displayed, by changing the class attribute on the <div> from hidden to showing (the example's css contains these two classes, which position 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>.
... we can, therefore, fix our current problem by changing the second handler function in the previous code block to this: video.onclick = function(e) { e.stoppropagation(); video.play(); }; you can try making a local copy of the show-video-box.html source code and fixing it yourself, or looking at the fixed result in show-video-box-fixed.html (also see the source code here).
Working with JSON - Learn web development
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.
...add the following code below your previous code: request.onload = function() { const superheroes = request.response; populateheader(superheroes); showheroes(superheroes); } here we are storing the response to our request (available in the response property) in a variable called superheroes; this variable now contains the javascript object based on the json!
... creating the hero information cards next, add the following function at the bottom of the code, which creates and displays the superhero cards: function showheroes(jsonobj) { const heroes = jsonobj['members']; for (let i = 0; i < heroes.length; i++) { const myarticle = document.createelement('article'); const myh2 = document.createelement('h2'); const mypara1 = document.createelement('p'); const mypara2 = document.createelement('p'); const mypara3 = document.createelement('p'); const mylist = document.createelement('ul'); ...
...request.send(); request.onload = function() { const superheroestext = request.response; // get the string from the response const superheroes = json.parse(superheroestext); // convert it to an object populateheader(superheroes); showheroes(superheroes); } as you might guess, stringify() works the opposite way.
Understanding client-side JavaScript frameworks - Learn web development
in this article, we will show you a sensible way to break our app up into components.
...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.
...working with svelte stores in this article we will show another way to handle state management in svelte — stores.
...three of them are very popular and well-established — react/reactdom, ember, and vue — whereas svelte is a comparative newcomer that shows a lot of promise and has gained a lot of recent popularity.
Handling common accessibility problems - Learn web development
safari: select develop > disable styles from the main menu (to enable the develop menu, choose safari > preferences > advanced > show develop menu in menu bar).
... another tip — as shown in our example, you can control how your focusable elements look when focused, using the :focus pseudo-class.
... hiding content there are many instances where a visual design will require that not all content is shown at once.
... for example, in our tabbed info box example (see source code) we have three panels of information, but we are positioning them on top of one another and providing tabs that can be clicked to show each one (it is also keyboard accessible — you can alternatively use tab and enter/return to select them).
Command line crash course - Learn web development
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.
... for example, give this a go and see what you get: ls -l in the case of ls, the -l (dash ell) option gives you a listing with one file or directory on each line, and a lot more information shown.
... below is a screenshot with a “vanilla” macos terminal at the top, and a customised terminal with some extra icons and colors to keep it looking lively — both showing the results of running ls -l: note: to find out exactly what options each command has available, you can look at its man page.
... try running this: curl /docs/web/api/fetch -l -i | grep location | awk '{ print "https://developer.mozilla.org" $2 }' your final output should look something like this: /docs/web/api/fetch /docs/web/api/globalfetch/globalfetch.fetch() /docs/web/api/globalfetch/fetch /docs/web/api/windoworworkerglobalscope/fetch by combining these commands we've customised the output to show the full urls that the mozilla server is redirecting through when we request the /docs/web/api/fetch url.
Package management basics - Learn web development
let's say we want to show human-readable relative dates, such as "2 hours ago", "4 days ago" and so on.
... where npm is shown in the examples below, pnpm can be swapped in and the command will work.
... initialise a new project npm init yarn init as shown above, this will prompt and walk you through a series of questions to describe your project (name, license, description and so on) then generate a package.json for you that contains meta information about your project and its dependencies.
... checking on a dependency npm ls date-fns yarn why date-fns this command will show what version of a dependency is installed and how it came to be included in your project.
Debugging Frame Reflow
0 a=0,0 c=1500,uc cnt=884 col 02d7c0d8 d=0,0 colg 02d7bfb0 d=0,0 tbl 02d7b7ec d=1500,390 tblo 02d7b5f0 d=1500,390 text 02d7c130 r=0 a=8940,uc c=uc,uc cnt=885 text 02d7c130 d=0,0 block 02d7b210 d=8940,390 area 02d7afe4 d=9180,630 canvas 00b97c6c d=9180,4470 scroll 00b97ee0 d=9180,4470 scroll 00b97ee0 d=9180,4470 vp 00b97c30 d=9180,4470 the first line shows the reflow of the viewport (vp).
...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.
...element size only once and it reports now: block 02d7bcf8 d=1410,300 the block shows the same address as the previous one.
...sometimes the log is clearer if only the main frames are shown.
Debugging Table Reflow
anager verify-lines damage-repair lame-paint-metrics lame-reflow-metrics disable-resize-opt these options can be combined with a comma separated list messages generated by the reflow switch: block(div)(1)@00be5ac4: reflowing dirty lines computedwidth=9000 computedheight=1500 this message is generated inside of nsresult nsblockframe::reflowdirtylines(nsblockreflowstate& astate) it first shows the block id and address and then the computed width and height from the htmlreflowstate.
... debug_table_strategy editor's note: the following examples are not shown correctly due to the wiki's technical constraint.
...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 pointers: col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 this is followed by the information which width has been set for each column.
...leaving assignnonpctcolwidths shows that already to all columns a width of 360 twips has been assigned assignnonpctcolwidths ex ***start table dump*** mcolwidths=360 360 360 360 col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **start col dump** colindex=0 isanonymous=0 constraint=0 widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **end col dump** **start col dump** colindex=1 isanonymous=0 constraint=0 widths=360...
Debugging on Windows
if you want to debug a content process, you can hover on the tab of page you want to debug, which would show the pid.
..."executable for debug session:" should show the executable you are debugging.
..."program arguments:" should show the options.
... for example, to print curent javascript stack to stdout, evaluate this in quickwatch window: {,,xul}dumpjsstack() note: visual c++ will show you something in the quick watch window, but not the stack, you have to look in the os console for the output.
Eclipse CDT Manual Setup
if you want line numbers, tick "show line numbers".
... if you want a column marker to mark the 80th column to help with formatting code to mozilla's 80 character line limit, tick "show print margin" and set the value to 80.
... 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).
...(this directory doesn't show in the project explorer tab, but eclipse still indexes it without this filter!) if you have secondary object directories (object directories that are not your only/the primary object directory) for the source tree and those directories are inside the source tree (or if you might have such object directories in future), then add an "exclude all", regular expression filter for folders with a proje...
Multiple Firefox profiles
when the properties dialog box pops up, you should see a "target" text field that you can edit, and it should show the current file path.
... when the properties dialog box pops up, you should see a "target" text field that you can edit, and it should show the current file path.
...once you get to the point of adding a new item, you can have the profile dialog show up every time or set the launcher to launch a specific profile.
...leave off the profile name if you want the profile selector to show up every time you launch.
How to implement a custom autocomplete search component
illa.org/autocomplete/search;1?name=simple-autocomplete {6224daa1-71x2-4d1a-ad90-01ca1c08e323} you need to add the following method: getlabelat: function(index) { return this._results[index]; } to simpleautocompleteresult use this newly available component in a xul file like this: <textbox id="text1" type="autocomplete" autocompletesearch="simple-autocomplete" showcommentcolumn="true" autocompletesearchparam='[{"value":"mark","comment":"cool dude"},{"value":"mary","comment":"nice lady"},{"value":"jimmy","comment":"very uncool guy"},{"value":"jimbo","comment":null}]' /> the component uses the autocompletesearchparam attribute or searchparam property to allow the developer to define a set of data to use for autocompletion.
...be sure to include it if you use the showcommentcolumn="true" textbox attribute.
... in case you do not like the standard tree layout of the autocomplete popup, you can also trigger the use of a richlistbox by linking a panel with the type attribute set to "autocomplete-richlistbox" like this: <panel id="richpopup" type="autocomplete-richlistbox" /> <textbox id="text1" type="autocomplete" autocompletesearch="simple-autocomplete" showcommentcolumn="true" autocompletepopup="richpopup" autocompletesearchparam='[{"value":"mark","comment":"cool dude"},{"value":"mary","comment":"nice lady"},{"value":"jimmy","comment":"very uncool guy"},{"value":"jimbo","comment":null}]' /> how to solve autocomplete panel focus problems in some situations there may be problems with the display of the autocomplete panel (this is the panel where the autocomplete results/suggestion...
...this can happen when using an autcomplete panel in a panel (for example if an autcomplete textbox is set in a panel that shows and hides).
CustomizableUI.jsm
manage the areas in which these widgets are shown.
...the view can be shown as its own panel when such a widget is in the toolbar, or as a sliding 'subview' of the menu panel when such a widget is in the menu panel.
...this matters because of course xul-provided widgets could be available in some windows but not others, and likewise api-provided widgets might not exist in a private window (because of the showinprivatebrowsing property).
...it when removing the widget sss.loadandregistersheet(cssuri, sss.author_sheet); /**************/ // when you want to remove this widget run this code: // sss.unregistersheet(cssuri, sss.author_sheet); //remove the style sheet we applied // customizableui.destroywidget('id_of_my_widget_within_customizableui_and_dom'); //remove the widget /**************/ createwidget - custom type - simple this shows a simple example of how to make a widget with type custom.
Interfacing with the Add-on Repository
for example: searchfailed: function() { this.shownotification("i have no recommendations for you right now!", "oh noes!", null); }, here, we call a shownotification() method with some parameters that we'll look at shortly when we get to our shownotification() method below.
... for example: searchsucceeded: function(addons, addoncount, totalresults) { var num = math.floor(math.random() * addoncount); this.shownotification("would you like to try the " + addons[num].name + " addon?", "install", addons[num].install); }, this routine randomly selects one of the returned add-ons, then calls the previously mentioned shownotification() routine, passing in as parameters a prompt including the name of the returned add-on, a label for the button to show in the notification ("install"), and the addoni...
... installing the add-on the shownotification() routine displays a notification box offering to install the recommended add-on, if one was found, or reports an error if the search failed: shownotification: function(prompt, button, installobj) { this.install = installobj; var box = popupnotifications.show(gbrowser.selectedbrowser, "sample-popup", prompt, null, /* anchor id */ { label: button, accesskey: "i", callback: function() { if (popupnotifications.install) { popupnotifications.install.install(); } else { popupnotifications.remove(box); } } }, ...
... this doesn't display any ui showing that the install is taking place; however, if you go to the add-on manager panel, you'll see the pending install listed among your add-ons.
source-editor.jsm
tor.defaults.contextmenu "sourceeditorcontextmenu" sourceeditor.defaults.expandtab true sourceeditor.defaults.highlightcurrentline true sourceeditor.defaults.initialtext "" sourceeditor.defaults.keys null sourceeditor.defaults.mode sourceeditor.modes.text sourceeditor.defaults.readonly false sourceeditor.defaults.showannotationruler false sourceeditor.defaults.showlinenumbers false sourceeditor.defaults.showoverviewruler false sourceeditor.defaults.tabsize 4 sourceeditor.defaults.theme sourceeditor.themes.mozilla sourceeditor.defaults.undolimit 200 event name constants these constants provide the names of the editor events for which you c...
... showannotationruler boolean a boolean value indicating whether or not to display the annotations gutter/ruler.
... showlinenumbers boolean a boolean value indicating whether or not the line numbers gutter should be displayed.
... showoverviewruler boolean a boolean value indicating whether or not to show the overview gutter/ruler.
Creating localizable web applications
consider the following example: a filmreel-like slideshow showcasing highlighted features of the product or featured designs.
... for right-to-left languages, the slideshow should go from right to left as well, making the last element in the html the first one to be displayed.
... <?php if($showwearthis) { ?> $(".try-button").personasbutton({ 'haspersonas':'<span><?= _("wear this");?></span><span>&nbsp;</span>', 'hasfirefox':'<span><?= _("get personas now!");?></span><span>&nbsp;</span>', 'nofirefox':'<span><?= _("get personas with firefox");?></span><span>&nbsp;</span>' }); <?php } ?> images don't put text or numbers in the images just don't do that.
...the following example shows how to achieve this with css.
Intel Power Gadget
the main strengths of this tool are (a) it works on windows, unlike most other power-related tools, and (b) it shows this data in graph form, which is occasionally useful.
... the three panes display the following information: power: shows power estimates for the package and the cores ("ia").
... frequency: shows operating frequency measurements for the cores ("ia") and the gpu ("gt").
... temperature: shows the package temperature.
Memory Profiler
timeline view this view shows the allocation event across the period of time.
... it shows the overall memory usage history.
... rank-list view and tree view the rank-list view shows top functions that are most memory eager.
... the tree view shows functions as call trees.
NSS 3.14.2 release notes
if so, nss uses the optimized code path, reducing the cpu cycles per byte to 1/20 of what was required before the patch (https://bugzilla.mozilla.org/show_bug.cgi?id=805604 and https://crypto.stanford.edu/realworldcrypto/slides/gueron.pdf).
...(https://bugzilla.mozilla.org/show_bug.cgi?id=540986) sqlite has been updated to 3.7.15.
... note: please apply the patch in https://bugzilla.mozilla.org/show_bug.cgi?id=837799 if you build nss with the system sqlite library and your system sqlite library is older than 3.7.15.
...(https://bugzilla.mozilla.org/show_bug.cgi?id=816853) bug 772144 - basic support for running nss test suites on android devices.this is currently limited to running tests from a linux host machine using an ssh connection.
nss tech note5
also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way.
...you can get the best slot given a wrap mechanism (as shown above), or get the best wrap mechanism given a slot using:</big> ck_mechanism_type wrapmech = pk11_getbestwrapmechanism(slot) prepare the wrapping key if using a raw key /* turn the raw key into a secitem */ secitem keyitem; keyitem.data = /* ptr to an array of key bytes */ keyitem.len = /* length of the array of key bytes */ /* t...
...you can get the best slot given a wrap mechanism (as shown above), or get the best wrap mechanism given a slot using:</big> ck_mechanism_type wrapmech = pk11_getbestwrapmechanism(slot) prepare the wrapping key if using a raw key /* turn the raw key into a secitem */ secitem keyitem; keyitem.data = /* ptr to an array of key bytes */ keyitem.len = /* length of the array of key bytes */ /* t...
...you can get the best slot given a wrap mechanism (as shown above), or get the best wrap mechanism given a slot using:</big> ck_mechanism_type wrapmech = pk11_getbestwrapmechanism(slot) prepare the wrapping key seckeypublickey *wrappingpubkey prepare the to-be-wrapped key if using a raw key /* turn the raw key into a secitem */ secitem keyitem; keyitem.data = /* ptr to an array of key bytes */...
Shell global objects
all disassembly functions take these options as leading string arguments: -r disassemble recursively -l show line numbers -s omit source notes dis([fun/code]) disassemble functions into bytecodes.
... notes([fun]) show source notes for functions.
... stackdump(showargs, showlocals, showthisprops) tries to print a lot of information about the current stack.
...takes an optional options object, which may contain any or all of the boolean properties options.args - show arguments to each function options.locals - show local variables in each frame options.thisprops - show the properties of the this object of each frame bytesize(value) return the size in bytes occupied by value, or undefined if value is not allocated in memory.
WebReplayRoadmap
these messages will show up on the timeline and can be seeked to in the same way as other console messages.
... bookmarks (not yet implemented) it would be nice to be able to bookmark points in the recording so that they show up on the timeline and can be seeked to later.
... while the supported features will grow over time, the ui needs to be improved so that features which aren't supported are not shown or are shown in a disabled state.
... if the debugger could perform this analysis then it could show this information to developers and help them understand the app even when they are not actively debugging a particular recording.
Using XPCOM Utilities to Make Things Easier
weblock2.cpp the listing below shows the generic module code from weblock1.cpp using the macros described in this chapter: weblock2.cpp #include "nsigenericfactory.h" #include "nsisupportsutils.h" #define sample_cid \ { 0x777f7150, 0x4a2b, 0x4301, \ { 0xad, 0x10, 0x5e, 0xab, 0x25, 0xb3, 0x22, 0xaa}} class sample: public nsisupports { public: sample(); virtual ~sample(); ns_decl_isupports }; sample::sample() { ...
... using strings explaining how all the string classes work is outside the scope of this book, but we can show you how to use strings in the weblock component.
...this first example shows an nsembedcstring being used to pass an nsacstring to a method that's not expected to modify the string.
...although we haven't formally introduced these two interfaces, the next code sample shows how simple it is to switch between these two interfaces: someclass::dosomething(nsifile* afile) { if (!afile) return ns_error_null_pointer; nsresult rv; nscomptr<nsilocalfile> localfile = do_queryinterface(afile, &rv); // ...
nsIAuthPrompt2
a single prompt will be shown; then the callbacks for all the coalesced prompts will be notified with the resulting authentication information.
...it must not throw when the prompt could already be potentially shown to the user.
...this way we prevent multiple dialogs shown to the user because consumer may fall back to synchronous prompt on synchronous failure of this method.
...implementations will commonly show a dialog with a username and password field, depending on flags also a domain field.
nsIFocusManager
void windowshown(in nsidomwindow awindow, in prbool aneedsfocus); native code only!
... flag_showring 0x100000 always show the focus ring or other indicator of focus, regardless of other state.
...void windowraised( in nsidomwindow awindow ); parameters awindow native code only!windowshown called when a new document in a window is shown.
... void windowshown( in nsidomwindow awindow, in prbool aneedsfocus ); parameters awindow aneedsfocus if true, then focus events are expected to be fired on the window if this window is in the focused window chain.
nsISelectionController
a disabled caret will never show up.
... setcaretvisibilityduringselection() show the caret even in selections.
...use this function to show the caret even in selections.
... void setcaretvisibilityduringselection( in boolean visibility ); parameters visibility pr_true to show the caret in selections.
nsIUpdate
if this is specified, the user is shown the license file after they choose to install the update, and they must agree to it before the download begins.
... showneverforversion boolean whether to show the "no thanks" button in the update prompt.
... showprompt boolean whether to show the update prompt which requires user confirmation when an update is found during a background update check.
... showsurvey boolean whether to show the survey link in the update prompt.
Buddy icons in mail
seth spitzer mozilla is now able to show icons in the message header area and the addressbook card pane.
... for the message pane, the icon we will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for sender email address>.gif when trying to determine the screenname for the sender, we search the addressbook that we are using for collection.
... (see this document for info about that.) for the addressbook card pane, the icon will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for card>.gif if aim.session.screenname is not set, the icon will not appear.
... we do not show any buddy icon if you are in "collapsed" header mode.
Using popup notifications
then you can create the popup notification at the appropriate time like this: popupnotifications.show(gbrowser.selectedbrowser, "sample-popup", "this is a sample popup notification.", null, /* anchor id */ { label: "do something", accesskey: "d", callback: function() { alert("doing something awesome!"); } }, null /* secondary action */ ); in this case, we aren't providing any secondary actions; ...
...you can use this to style the icon, like this: .popup-notification-icon[popupid="sample-popup"] { list-style-image: url("chrome://popupnotifications/skin/mozlogo.png"); } with this css in place, the result is the look we want: adding secondary options to provide options in the drop-down menu, add an array of notification actions to the call to the show() method, like this: popupnotifications.show(gbrowser.selectedbrowser, "sample-popup", "this is a sample popup notification.", null, /* anchor id */ { label: "do something", accesskey: "d", callback: function() { alert("doing something awesome!"); } }, [ { label: "first secondary opt...
... implementing a timeout function for the popup notification you can use a timeout to make your notification automatically disappear after some amount of time, by calling notification.remove() as shown below.
... components.utils.import('resource://gre/modules/popupnotifications.jsm'); var notify = new popupnotifications(gbrowser, document.getelementbyid("notification-popup"), document.getelementbyid("notification-popup-box")); var notification = notify.show( // browser gbrowser.selectedbrowser, // popup id "pdes-popup", // message "hi, there!, i'm gonna show you something today!!", // anchor id null, // main action { label: "click here", accesskey: "d", callback: function() { // you can call your function here } }, // secondary action null, // options { // alternative way to set the popup icon popupiconurl: "chrome://popupnotifications/skin/mozlogo.png" } ); settimeout(function(){ notification.remove(); }, 900); // time in milli...
Working with data
example: cast an array this example shows how to cast an array of a certain type to another type.
... if you need a utf-16 string, you can do this: var myutf16string = ctypes.jschar.array()("original string."); note: at this time, there's no way to specify a particular encoding; you may only retrieve the string in utf-8 or utf-16 as shown above.
... as review, making a null-terminated string happens like this: var cstr_nullterminated = ctypes.jschar.array()('rawr'); console.log(cstr_nullterminated); // outputs to browserconsole: `cdata { length: 5 }` console.log(cstr_nullterminated.tostring()); // outputs to browser console: `"ctypes.char16_t.array(5)(["r", "a", "w", "r", "\x00"])"` the console.log shows that the length is greater then the length of "rawr" which is 4, doing a .tostring on it shows there is a null terminator of \x00 on the end.
...es.default_abi, ctypes.void_t, ctypes.char.array() /*same as ctypes.char.ptr*/); somecfunction(myarray); second example: var mystruct = ctypes.structtype('foo', [{bar: ctypes.bool}]); var mystructarraytype = mystruct.array(5); var myarray = mystructarraytype(); var somecfunction = library.declare("somecfunction", ctypes.default_abi, ctypes.void_t, mystruct.ptr); somecfunction(myarray); this shows how to pass a buffer containing 5 elements of mystruct, the elements in myarray are not pointers.
Dominators view - Firefox Developer Tools
it looks something like this: the dominators view consists of two panels: the dominators tree panel shows you which nodes in the snapshot are retaining the most memory the retaining paths panel (new in firefox 47) shows the 5 shortest retaining paths for a single node.
... the retaining paths panel shows you, for a given node, the 5 shortest paths back from this node to a gc root.
...if you suspect that an object is being leaked, this will show you exactly which objects are holding a reference to it.
... this means that the object does not dominate the array, and is therefore not shown in the dominators tree view.
Work with animations - Firefox Developer Tools
starting in firefox 48, it will show animations applied to the ::before and ::after pseudo-elements.
... 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.
... animation bars each animation or transition is shown as a horizontal bar laid across the timeline.
... if the animation or transition had a delay, this is shown as a cross-hatched portion of the bar.
Call Tree - Firefox Developer Tools
the screenshot below shows the output of a program that compares three sorting algorithms - bubble sort, selection sort, and quicksort.
... we've zoomed into the part of the recording that shows a long javascript marker: the call tree presents the results in a table.
...if your site is making the browser work hard, this might not show up as samples recorded in your code, but it is still your problem.
...if you want to see the details, check "show gecko platform data" in the settings.
Shader Editor - Firefox Developer Tools
here's another screencast, showing how you can use the shader editor for complex applications (in this case, the unreal engine demo): opening the shader editor the shader editor is disabled by default.
...this is useful for focusing on certain shaders or hiding overlapping geometry: if you click the entry, its vertex and fragment shaders are shown in the other two panes, and you can edit them.
... editing shaders the middle and right hand panes show the vertex and fragment shaders for the currently selected program.
...for example, you can modify the colors: the editor highlights syntax errors in your code: if you hover over the cross shown next to a line containing an error, you'll see more details about the problem: ...
Tips - Firefox Developer Tools
(there are more than the default tools!) page inspector in the markup view: press h with a node selected to hide/show it.
... right-click any property and select "show mdn docs" to view the mdn docs for this property.
... check "enable timestamps" in the settings to show timestamps besides the logged messages.
... click the options button in the style sheet pane and click "show original sources" to toggle the display of css preprocessor files.
BasicCardRequest - Web APIs
// call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... }) .catch(function(err) { // do something with the error from request.show().
...} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.billingAddress - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardNumber - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardSecurityCode - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardholderName - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryMonth - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryYear - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show().
... }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse - Web APIs
// call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... }) .catch(function(err) { // do something with the error from request.show().
...} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
Constraint validation API - Web APIs
this will be displayed in the ui if the element is the only form control with a validity problem; if a custom error message is set using setcustomvalidity(), this will be shown.
... setcustomvalidity(message) sets a custom error message string to be shown to the user upon submitting the form, explaining why the value is not valid — when a message is set, the validity state is set to invalid.
...in this case the custom error message is cleared, the element is considered valid, and no message is shown.
... as a result, if the input value is invalid when the submit button is pressed, one of the custom error messages will be shown.
HTMLDialogElement - Web APIs
htmldialogelement.show() displays the dialog modelessly, i.e.
... htmldialogelement.showmodal() displays the dialog as a modal, over the top of any other dialogs that might be present.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the htmldialogelement.showmodal() function.
...cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script> note: you can find this example on github as htmldialogelement-basic (see it live also).
IDBCursor - Web APIs
WebAPIIDBCursor
(bug 891944) next : "next" : the cursor shows all records, including duplicates.
... nextunique : "nextunique" : the cursor shows all records, excluding duplicates.
... prev : "prev" : the cursor shows all records, including duplicates.
... prevunique : "prevunique" : the cursor shows all records, excluding duplicates.
PaymentRequest.PaymentRequest() - Web APIs
examples the following example shows minimal functionality and focuses instead on showing the complete context of instantiating a paymentrequest object.
... // call show() to trigger the browser's payment flow.
... request.show().then(function(instrumentresponse) { // do something with the response from the ui.
... }) .catch(function(err) { // do something with the error from request.show().
PaymentRequest.canMakePayment() - Web APIs
you can call this before calling show() to provide a streamlined user experience when the user's browser can't handle any of the payment methods you accept.
... if (await supportsapplepay) { // show apple pay logo, for instance return; } // otherwise...
... let's see if we can use basic card const supportsbasiccard = await new paymentrequest( [{ supportedmethods: "basic-card" }], details ).canmakepayment(); if (supportsbasiccard) { // show basic card support return; } // otherwise, make payments using html form element } specifications specification status comment payment request apithe definition of 'canmakepayment()' in that specification.
... see also paymentrequest.show() ...
Using Performance Timeline - Web APIs
the following example show the usage of these methods getentries(), getentriesbyname() and getentriesbytype().
...the following example shows the use of these properties.
...the following examples show the use of this method.
... the following example shows how to register two observers: the first one registers for several event types and the second observer only registers for one event type.
Web Push API Notifications best practices - Web APIs
it shows right up on your desktop even when the website is shut.
... in mobile, it shows up in the notification tray, just like app push notifications, even when the browser is not running.” — an unnamed marketing site positive uses of push but there’s a bright and useful side to push notifications, too.
... building trust some studies have shown that as many as 60% of push notifications are blocked.
...you can build trust by having a well-designed website that provides good content that shows respect for the user, and a clear value to accepting push notifications.
Using the Screen Capture API - Web APIs
starting screen capture: async/await style async function 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.
...the examples below show a few ways to make use of the stream.
... function stopcapture(evt) { let tracks = videoelem.srcobject.gettracks(); tracks.foreach(track => track.stop()); videoelem.srcobject = null; } dumping configuration information for informational purposes, the startcapture() method shown above calls a method named dumpoptions(), which outputs the current track settings as well as the constraints that were placed upon the stream when it was created.
... <p>this example shows you the contents of the selected part of your display.
Sensor APIs - Web APIs
the examples below show three methods for detecting sensor apis.
...the only time anything is shown to the user is when permissions need to be requested and when the sensor type isn't supported by the device.
...this is not something that would ever be shown to a user.
...a brief example, shown below, requests permission before attempting to use the sensor.
Using Service Workers - Web APIs
the below graphic shows a summary of the available service worker events: promises promises are a great mechanism for running async operations, with success dependant on one another.
... note: one great thing about service workers is that if you use feature detection like we’ve shown above, browsers that don’t support service workers can just use your app online in the normal expected fashion.
...in this case, we are just returning a simple text string: new response('hello from your friendly neighbourhood service worker!'); this more complex response below shows that you can optionally pass a set of headers in with your response, emulating standard http response headers.
... self.addeventlistener('activate', (event) => { var cachekeeplist = ['v2']; event.waituntil( caches.keys().then((keylist) => { return promise.all(keylist.map((key) => { if (cachekeeplist.indexof(key) === -1) { return caches.delete(key); } })); }) ); }); developer tools chrome has chrome://inspect/#service-workers, which shows current service worker activity and storage on a device, and chrome://serviceworker-internals, which shows more detail and allows you to start/stop/debug the worker process.
Geometry and reference spaces in WebXR - Web APIs
the following code snippet shows two simple functions, degreestoradians() and radianstodegrees(), which convert back and forth between the two units for measuring angles.
... 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 currently available reference space types, which are defined by the xrreferencespacetype enumeration, are shown below.
... as the callback is repeatedly called with increasing time values, the callback generates a sequence of frames which are presented using the xr hardware, thereby showing a 3d scene to the user.
Privileged features - Web APIs
on windows platforms, a dependent window does not show on the task bar.
... the dependent feature is currently under revision to be removed (bug 214867) in msie 6, the nearest equivalent to this feature is the showmodelessdialog() method.
... note: as of gecko 1.9, the internet explorer equivalent to this feature is the window.showmodaldialog() method.
...note also that starting in gecko 2.0, you can use window.showmodaldialog() without universalbrowserwrite privileges.
ARIA Test Cases - Accessibility
however, where things don't work we may test with nightly builds if they are available, in order to show what is already fixed in upcoming releases.
... screen magnifier should show the focused button or emulate any other standard behavior found in notification dialogs in windows or respective operating systems.
...era safari jaws 9 - - n/a n/a jaws 10 pass fail - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - drag and drop tic tac toe slide show expected at behavior: (mz) once focusing or arrowing onto the draggable item, screen reader should indicate that item can be an object that can be dragged.
...however, if there is no perf issues they can show the new content simply when the tab gets focus.
Basic form hints - Accessibility
the example below shows a simple form with labels.
... the example below shows a radio button group implemented using an unordered list.
... the example below shows a <button> element that is described by a sentence in a separate <div> element.
... the example below shows a simple form with three fields.
Understandable - Accessibility
what page to show, when to advance to the next photo in the gallery...) if you need to have something like a carousel on a page, provide an option to stop it automatically advancing.
...when an error is detected, an intuitive error message should be shown next to the form input that is at fault to help the user correct their inputs.
... confirm and correct — where appropriate, after filling in a series of form fields to perform a task (such as buying a product), the user should be shown a confirmation screen where they can review their inputs and correct anything that doesn't look right.
...providing a dedicated link to a help page or service on each page, providing examples showing what successful completion should look like.
Coordinate systems - CSS: Cascading Style Sheets
let inner = document.queryselector(".inner"); let log = document.queryselector(".log"); function setcoords(e, type) { let idx = type + "x"; let idy = type + "y"; document.getelementbyid(idx).innertext = e[idx]; document.getelementbyid(idy).innertext = e[idy]; } a reference to the <div> inside the inner box which contains the paragraphs that will show the coordinate information is fetched into log.
... handling the mouse events setcoords() is called by the event handler for the various mouse events, named update(); this is shown below.
...the class "outer" is used for the containing box, which is intentionally too wide to show in the mdn window, to allow you to scroll it horizontally.
... the "inner" box is the one that we track events in and in which we show the mouse coordinates.
Box-shadow generator - CSS: Cascading Style Sheets
ayer(); if (type === 'layer') active.stack.setactivelayer(node); if (type === 'delete') active.stack.deletelayer(node.parentnode); if (type === 'move-up') active.stack.movelayer(1); if (type === 'move-down') active.stack.movelayer(-1); } var setactivestack = function setactivestack(stackobj) { active.stack.hide(); active.stack = stackobj; active.stack.show(); } /* * stack object */ var stack = function stack(subject) { var s = document.createelement('div'); var title = document.createelement('div'); var stack = document.createelement('div'); s.classname = 'container'; stack.classname = 'stack'; title.classname = 'title'; title.textcontent = subject.getattribute('data-title'); s.appendchild(title); s.appendch...
...x = this.order.indexof(shadowid); this.stack.removechild(this.stack.children[index]); this.order.splice(index, 1); this.count--; tool.deleteshadow(index); if (index > this.layerid) return; if (index == this.layerid) { if (this.count >= 1) { this.layerid = 0; this.setactivelayer(this.stack.children[0], true); } else { this.layer = null; this.show(); } } if (index < this.layerid) { this.layerid--; tool.setactiveshadow(this.layerid, true); } } stack.prototype.setactivelayer = function setactivelayer(node) { elements.shadow_properties.style.display = 'block'; elements.element_properties.style.display = 'none'; if (this.layer) this.layer.removeattribute('data-active'); this.layer = node; this.l...
...prototype.unsetactivelayer = function unsetactivelayer() { if (this.layer) this.layer.removeattribute('data-active'); this.layer = null; this.layerid = 0; } stack.prototype.hide = function hide() { this.unsetactivelayer(); this.subject.removeattribute('data-active'); var style = this.container.style; style.left = '100%'; style.zindex = '0'; } stack.prototype.show = function show() { elements.shadow_properties.style.display = 'none'; elements.element_properties.style.display = 'block'; if (this.id === 'element') { elements.zindex.style.display = 'none'; elements.transform_rotate.style.display = 'none'; } else { elements.zindex.style.display = 'block'; elements.transform_rotate.style.display = 'block'; } this.subject.s...
...('transform_rotate'); elements.zindex = getelembyid('z-index'); elem = document.queryselectorall('#layer_menu [data-type="subject"]'); size = elem.length; for (var i = 0; i < size; i++) { var s = new stack(elem[i]); stacks[elem[i].id] = s; container.appendchild(s.container); tool.addcssclass(elem[i].id); } active.stack = stacks['element']; stacks['element'].show(); layermanager.addeventlistener("click", mouseevents); layermenu.addeventlistener("click", mouseevents); buttonmanager.subscribe("before", function(value) { if (value === false && active.stack === stacks['before']) setactivestack(stacks['element']) if (value === true && active.stack !== stacks['before']) setactivestack(stacks['before']) }); buttonmanager.subsc...
Variable fonts guide - CSS: Cascading Style Sheets
you can use these four-letter tags in css to specify a point along that axis of variation, as will be show in the code examples below.
...conversely, when a much larger size was being used (like 48 or 60px), there might be much greater variation in thick and thin stroke weights, showing the typeface design more in line with the original intent.
... h1 { font-family: some-non-variable-font-family; } @supports (font-variation-settings: 'wdth' 115) { h1 { font-family: some-variable-font-family; } } sample pages the following example pages show two different ways to structure your css.
...the second example uses css custom properties to set values for a font-variation-settings string, and shows how you can more easily update single variable values by overriding a single variable rather than rewriting the whole string.
<area> - HTML: Hypertext Markup Language
WebHTMLElementarea
the following keywords have special meanings: _self (default): show the resource in the current browsing context.
... _blank: show the resource in a new, unnamed browsing context.
... _parent: show the resource in the parent browsing context of the current one, if the current page is inside a frame.
... _top: show the resource in the topmost browsing context (the browsing context that is an ancestor of the current one and has no parent).
<input type="date"> - HTML: Hypertext Markup Language
WebHTMLElementinputdate
we had to put the icon on a <span> next to the input, not on the input itself, because in chrome at least the input's generated content is placed inside the form control, and can't be styled or shown effectively.
...if <input type="date"> isn't supported, we hide the native picker and show the fallback (<select>) instead.
...ide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'date'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the days and years dynamically // (the months are always the same, therefore hardcoded) populatedays(monthselect.value); populateyears(); } function populatedays(month) { // delete the current set of <option> elements out of the // day <s...
...february), // this part of the code ensures that the highest day available // is selected, rather than showing a blank dayselect if(dayselect.value === "") { dayselect.value = previousday - 1; } if(dayselect.value === "") { dayselect.value = previousday - 2; } if(dayselect.value === "") { dayselect.value = previousday - 3; } } } function populateyears() { // get this year as a number var date = new date(); var year = date.getfullyear(); // make th...
<input type="datetime-local"> - HTML: Hypertext Markup Language
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
...if <input type="datetime-local"> is not supported, we hide the native picker and show the fallback picker ui (<select>) instead.
...ly fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new datetime-local input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'datetime-local'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the days and years dynamically // (the months are always the same, therefore hardcoded) populatedays(monthselect.value); populateyears(); populatehours(); populateminutes(); } function populatedays(month) { // delete the current set of ...
...february), // this part of the code ensures that the highest day available // is selected, rather than showing a blank dayselect if(dayselect.value === "") { dayselect.value = previousday - 1; } if(dayselect.value === "") { dayselect.value = previousday - 2; } if(dayselect.value === "") { dayselect.value = previousday - 3; } } } function populateyears() { // get this year as a number var date = new date(); var year = date.getfullyear(); // make th...
<input type="file"> - HTML: Hypertext Markup Language
WebHTMLElementinputfile
including the multiple attribute, as shown above, specifies that multiple files can be chosen at once.
... notes you cannot set the value of a file picker from a script — doing something like the following has no effect: const input = document.queryselector("input[type=file]"); input.value = "foo"; when a file is chosen using an <input type="file">, the real path to the source file is not shown in the input's value attribute for obvious security reasons.
... instead, the filename is shown, with c:\fakepath\ appended to the beginning of it.
... examples in this example, we'll present a slightly more advanced file chooser that takes advantage of the file information available in the htmlinputelement.files property, as well as showing off a few clever tricks.
<input type="month"> - HTML: Hypertext Markup Language
WebHTMLElementinputmonth
for those of you using a browser that doesn't support month, the screenshot below shows what it looks like in chrome and opera.
...we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
...if <input type="month"> is not supported, we hide the native picker and show the fallback picker ui instead.
...de fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'month'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the years dynamically // (the months are always the same, therefore hardcoded) populateyears(); } function populateyears() { // get the current year as a number var date = new date(); var year = date.getfullyear(); // make this year, a...
<input type="search"> - HTML: Hypertext Markup Language
WebHTMLElementinputsearch
the first thing to note is that some browsers show a cross icon that can be clicked on to remove the search term instantly if desired.
...v> </form> you can see how the placeholder is rendered below: search form labels and accessibility one problem with search forms is their accessibility; a common design practice is not to provide a label for the search field (although there might be a magnifying glass icon or similar), as the purpose of a search form is normally fairly obvious for sighted users due to placement (this example shows a typical pattern).
...pan class="validity"></span> </div> </form> input { margin-right: 10px; } input:invalid ~ span:after { content: '✖'; padding-left: 5px; position: absolute; } input:valid ~ span:after { content: '✓'; padding-left: 5px; position: absolute; } this renders like so: in addition, if you try to submit the form with no search term entered into it, the browser will show a message.
... the following example is from firefox: different messages will be shown when you try to submit the form with different types of invalid data contained inside the inputs; see the below examples.
<input type="time"> - HTML: Hypertext Markup Language
WebHTMLElementinputtime
if you specify a value of less than 60 seconds (1 minute), the time input will show a seconds input area alongside the hours and minutes: <form> <label for="appt-time">choose an appointment time: </label> <input id="appt-time" type="time" name="appt-time" step="2"> </form> in chrome and opera, which are the only browsers to show up/down iteration arrows, clicking the arrows changes the seconds value by two seconds, but doesn't affect the hours or minutes.
...we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
...if <input type="time"> is not supported, we hide the native picker and show the fallback picker ui (<select>s) instead.
...ide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'time'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the hours and minutes dynamically populatehours(); populateminutes(); } function populatehours() { // populate the hours <select> with the 6 open hours of the day for(var i = 12; i <= 18; i++) { var option = document.createelement('opti...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
WebHTMLElementinput
specifies how much of the input is shown.
... :placeholder-shown element that is currently displaying placeholder text, including <input> and <textarea> elements with the placeholder attribute present that has, as of yet, no value.
...the placeholder is used to show an example input, not an explanation or prompt.
... as a result, if the input value is invalid when the submit button is pressed, one of the custom error messages will be shown.
<select>: The HTML Select element - HTML: Hypertext Markup Language
WebHTMLElementselect
the above example shows typical <select> usage.
... the <select> element has some unique attributes you can use to control it, such as multiple to specify whether multiple options can be selected, and size to specify how many options should be shown at once.
...when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
... <!-- the second value will be selected initially --> <select name="choice"> <option value="first">first value</option> <option value="second" selected>second value</option> <option value="third">third value</option> </select> advanced select with multiple features the follow example is more complex, showing off more features you can use on a <select> element: <label>please choose one or more pets: <select name="pets" multiple size="4"> <optgroup label="4-legged pets"> <option value="dog">dog</option> <option value="cat">cat</option> <option value="hamster" disabled>hamster</option> </optgroup> <optgroup label="flying pets"> <option value="parrot">parrot</opt...
<textarea> - HTML: Hypertext Markup Language
WebHTMLElementtextarea
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.
...for example, to give your textarea a different border depending on whether it is valid or invalid: textarea:invalid { border: 2px dashed red; } textarea:valid { border: 2px solid lime; } examples basic example the following example show a very simple textarea, with a set numbers of rows and columns and some default content.
... <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.
... disabled and readonly this example shows two <textarea>s — one of which is disabled, and one of which is readonly.
HTML documentation index - HTML: Hypertext Markup Language
WebHTMLIndex
178 <progress>: the progress indicator element element, html, html forms, html5, reference, web the html <progress> element displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
...ruby annotations are for showing pronunciation of east asian characters.
... 211 <title>: the document title element element, html, html document metadata, html:metadata content, page name, page title, reference, tab name, tab title, title, web, window name, window title the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab.
... 218 <video>: the video embed element element, html, html video, html video player, html embedded content, html5, media, movie playback, movies, multimedia, playing movies, playing video, reference, showing video, video, web the html video element (<video>) embeds a media player which supports video playback into the document.
Expressions and operators - JavaScript
the following code shows examples of the && (logical and) operator.
... var a1 = true && true; // t && t returns true var a2 = true && false; // t && f returns false var a3 = false && true; // f && t returns false var a4 = false && (3 == 4); // f && f returns false var a5 = 'cat' && 'dog'; // t && t returns dog var a6 = false && 'cat'; // f && t returns false var a7 = 'cat' && false; // t && f returns false the following code shows examples of the || (logical or) operator.
... var o1 = true || true; // t || t returns true var o2 = false || true; // f || t returns true var o3 = true || false; // t || f returns true var o4 = false || (3 == 4); // f || f returns false var o5 = 'cat' || 'dog'; // t || t returns cat var o6 = false || 'cat'; // f || t returns cat var o7 = 'cat' || false; // t || f returns cat the following code shows examples of the !
... the following examples show some uses of the in operator.
Functions - JavaScript
a non-primitive value, such as array or a user-defined object) as a parameter and the function changes the object's properties, that change is visible outside the function, as shown in the following example: function myfunc(theobject) { theobject.make = 'toyota'; } var mycar = {make: 'honda', model: 'accord', year: 1998}; var x, y; x = mycar.make; // x gets the value "honda" myfunc(mycar); y = mycar.make; // y gets the value "toyota" // (the make property was changed by the function) function expressions while the function declaration above is synta...
...the following example shows a map function that should receive a function as first argument and an array as second argument.
...the show_props() function (defined in working with objects) is an example of a function that takes an object as an argument.
... the following example shows nested functions: function addsquares(a, b) { function square(x) { return x * x; } return square(a) + square(b); } a = addsquares(2, 3); // returns 13 b = addsquares(3, 4); // returns 25 c = addsquares(4, 5); // returns 41 since the inner function forms a closure, you can call the outer function and specify arguments for both the outer and inner function: function outside(x) { fu...
this - JavaScript
function f1() { return this; } // in a browser: f1() === window; // true // in node: f1() === globalthis; // true in strict mode, however, if the value of this is not set when entering an execution context, it remains as undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() === undefined; // true in the second example, this should be undefined, because f2 was called directly and not as a method or property of an object (e.g.
... // add bluify as a click listener so when the // element is clicked on, it turns blue for (var i = 0; i < elements.length; i++) { elements[i].addeventlistener('click', bluify, false); } in an inline event handler when the code is called from an inline on-event handler, its this is set to the dom element on which the listener is placed: <button onclick="alert(this.tagname.tolowercase());"> show this </button> the above alert shows button.
... note however that only the outer code has its this set this way: <button onclick="alert((function() { return this; })());"> show inner this </button> in this case, the inner function's this isn't set so it returns the global/window object (i.e.
...to achieve this, bind the class methods in the constructor: class car { constructor() { // bind saybye but not sayhi to show the difference this.saybye = this.saybye.bind(this); } sayhi() { console.log(`hello from ${this.name}`); } saybye() { console.log(`bye from ${this.name}`); } get name() { return 'ferrari'; } } class bird { get name() { return 'tweety'; } } const car = new car(); const bird = new bird(); // the value of 'this' in methods depends on their caller car.sayhi();...
Codecs used by WebRTC - Web media technologies
supported audio codecs the audio codecs which rfc 7874 mandates that all webrtc-compatible browsers must support are shown in the table below.
... bit rate recommendations given a 20 millisecond frame size, the following table shows the recommended bit rates for various forms of media.
... note: the two methods for obtaining lists of codecs shown here use different output types in their codec lists.
... default codecs unless otherwise specified, the default—or, more accurately, preferred—codecs requested by each browser's implementation of webrtc are shown in the table below.
Installing and uninstalling web apps - Progressive web apps (PWAs)
tapping this will show a confirmation banner—pressing the banner's big "+ add to home screen" button completes the action, adding the app to the home screen.
... note that in android 8 and higher, a system-level "add to home screen" permission dialog will be shown first.
... tapping that icon should then take you to the same confirmation banner shown in firefox above.
... the installed web application regardless of which browser and device you're using, when you choose to add the app to your home screen or app launcher, it'll show up there looking just like any application.
How to make PWAs installable - Progressive web apps (PWAs)
short_name: short name to be shown on the home screen.
... after the user indicates they wish to proceed with installation, the install banner is shown.
... if the user clicks the button, there is a final step showing what the app will look like, and letting the user choose if they definitely want to add the app.
... splash screen in some browsers, a splash screen is also generated from the information in the manifest, which is shown when the pwa is launched and while it's being loaded started up.
SVG documentation index - SVG: Scalable Vector Graphics
WebSVGIndex
258 xlink:show deprecated, svg, svg attribute the xlink:show attribute indicates how a linked resource should be opened and is meant for xlink-aware processors.
... 278 introduction beginner, guide, needsbeginnerupdate, needsupdate, svg, svg:tutorial, tutorial svg is an xml language, similar to xhtml, which can be used to draw vector graphics, such as the ones shown to the right.
... 284 svg in html introduction intermediate, needsupdate, svg this article and its associated example shows how to use inline svg to provide a background picture for a form.
... it shows how javascript and css can be used to manipulate the picture in the same way you would script regular html.
passwords - Archive of obsolete content
so if you pass in an empty set of properties, all stored credentials are returned: function show_all_passwords() { require("sdk/passwords").search({ oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } if you pass it a single property, only credentials matching that property are returned: function show_passwords_for_joe() { r...
...equire("sdk/passwords").search({ username: "joe", oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } if you pass more than one property, returned credentials must match all of them: function show_google_password_for_joe() { require("sdk/passwords").search({ username: "joe", url: "https://www.google.com", oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } to retrieve only credentials associated with your add-on, use the url property, initialized from sel...
...f.uri: function show_my_addon_passwords() { require("sdk/passwords").search({ url: require("sdk/self").uri, oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } parameters options : object required options: name type oncomplete function the callback function that is called once the function completes successfully.
remote/parent - Archive of obsolete content
examples property retrieval this first example shows fetching a simple property from every existing and future process.
...js const { frames } = require("sdk/remote/child"); // listeners receive the frame the event was for as the first argument frames.port.on("changelocation", (frame, ref) => { frame.content.location += "#" + ref; }); // main.js const { frames, remoterequire } = require("sdk/remote/parent"); remoterequire("./remote.js", module); frames.port.emit("changelocation", "foo"); tab information this shows sending a message when a tab loads; this is similar to how the sdk/tabs module currently works.
... // remote.js const { frames } = require("sdk/remote/child"); frames.addeventlistener("pageshow", function() { // `this` is bound to the frame the event came from let frame = this; frame.port.emit("pageshow"); }, true); // main.js const { frames, remoterequire } = 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.
ui/button/toggle - Archive of obsolete content
attaching panels to buttons you can attach panels to buttons by passing the button as the position option to the panel's show() method or the panel's constructor: var { togglebutton } = require('sdk/ui/button/toggle'); var panels = require("sdk/panel"); var self = require("sdk/self"); var button = togglebutton({ id: "my-button", label: "my button", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onchange: handlechange }); var panel = panels.panel({ contenturl: se...
...lf.data.url("panel.html"), onhide: handlehide }); function handlechange(state) { if (state.checked) { panel.show({ position: button }); } } function handlehide() { button.state('window', {checked: false}); } disabling buttons you can disable a button by setting its disabled property to true.
...ate: browser: label = "my default" w1 t1 > displays "my default" t2 > displays "my default" w2 t3 > displays "my default" t4 > displays "my default" if you then set a label specific to t3 as "my t3 label", then set a label state specific to w2 as "my w2 label", then the button displayed when t3 is the active tab will still show "my t3 label", but the button displayed when t4 is the active tab will show "my w2 label": browser: label = "my default" w1 t1 > displays "my default" t2 > displays "my default" w2 t3 > displays "my t3 label" t4 > displays "my w2 label" setting the properties on the button instance sets the button's global state: button.l...
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.
... version description entry point (which maps to "main" in package.json) author engines (supported applications) license most of these fields have a default, which is shown in brackets after the question.
... once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it.
Bootstrapped extensions - Archive of obsolete content
for example if you had a subfolder of en-us in locale folder your chrome.manifest file will have to contain: locale name_of_your_addon en-us locale/ here is an example: github :: l10n-properties - on startup of this add-on it will show a prompt saying usa or great britain, which ever it deems closest to your locale.
...here is an example showing how to use a localized html page as an options page: github :: l10n-html-options.
... edward lee shows off some helpful coding patterns and examples you can use in your bootstrapped add-on.
HTML in XUL for rich tooltips - Archive of obsolete content
lor='green'>green foo</font>") }, onmousetooltip: function(event) { //get the html tooltip string assigned to the element that the mouse is over (which will soon launch the tooltip) var txt = event.target.getattribute("tooltiphtml"); // get the html div element that is inside the custom xul tooltip var div = document.getelementbyid("myhtmltipdiv"); //clear the html div element of any prior shown custom html while(div.firstchild) div.removechild(div.firstchild); //safely convert html string to a simple dom object, stripping it of javascript and more complex tags var injecthtml = components.classes["@mozilla.org/feed-unescapehtml;1"] .getservice(components.interfaces.nsiscriptableunescapehtml) .parsefragment(txt, false, null, div); //attach the dom object to the html div element div.ap...
...that tooltip is empty now, but we will use the mouseover event to dynamically populate the tooltip (which is about to be shown) with a different message for each menuitem.
... this is done by calling the onmousetooltip function, which will take the tooltiphtml attribute of the element that is being hovered over and safely convert that into dom and inject it into the tooltip that will soon be shown.
Rosetta - Archive of obsolete content
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 previous example shows a possible solution for all these cases, from the simplest to the hardest one.
Extension Versioning, Update and Compatibility - Archive of obsolete content
gwymgscfanakpn40pjfowt ub2hvdg8+oxmcif8d/9evwm8eh/ixuxyzlmrzts3o5tv9eway5ubctqdf1wgtsgk jrgzow1fitkzi7w0//c8ekdmlatguegfns2iltd5p/0kh/hf1rpc1wuqeqkcd4+l bcvq13ad</em:signature> </rdf:description> </rdf:rdf> some people prefer this alternate format (note that much of the information has been trimmed from this example for brevity in order to show the basic structure): <?xml version="1.0" encoding="utf-8"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <!-- this description resource includes all the update and compatibility information for a single add-on with the id foobar@developer.mozilla.org.
...the user then can click the show information button, and will see the information, on the right hand side.
...2887eda35b4ad2e3a0b60120ca271ce6e64ad2e3a0b60120ca271ce6e6</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.
Multiple item extension packaging - Archive of obsolete content
the basic structure is shown below: /install.rdf install manifest /extension1.xpi extension /extension2.xpi extension /theme1.jar theme /theme2.jar theme ...
...the xml namespace xmlns:nc="http://home.netscape.com/nc-rdf#" must also be declared in your install.rdf as shown below.
... for the firefox and thunderbird 2.0 extension manager you can use the above syntax or <em:type>32</em:type> as shown below.
Adding sidebars - Archive of obsolete content
trees the bookmarks and history sidebars in firefox use the « xul reference « element to show their content.
... trees are another strong option when you need to show a great amount of information in a compact presentation.
... with a tree you can show a rather small amount of root nodes, giving the user the possibility to expand whichever ones are needed.
XUL user interfaces - Archive of obsolete content
etelementbyid("status") settoday(); } // called by clear button function cleardate() { datebox.value = "" refresh() } // called by today button function settoday() { var d = new date() datebox.value = (d.getmonth() + 1) + "/" + d.getdate() + "/" + d.getfullyear() refresh() } // called by date textbox function refresh() { var d = datebox.value var thedate = null showstatus(null) if (d != "") { try { var a = d.split("/") var thedate = new date(a[2], a[0] - 1, a[1]) showstatus(thedate) } catch (ex) {} } setday(thedate) } // internal function setday(adate) { if (currentday) currentday.setattribute("disabled", "true") if (adate == null) currentday = null else { var d = adate.getday() currentday = daybox.fir...
...stchild while (d-- > 0) currentday = currentday.nextsibling currentday.removeattribute("disabled") } datebox.focus(); } function showstatus(adate) { if (adate == null) { status.removeattribute("warning") status.setattribute("label", "") } else if (adate === false || isnan(adate.gettime())) { status.setattribute("warning", "true") status.setattribute("label", "date is not valid") } else { status.removeattribute("warning") status.setattribute("label", adate.tolocaledatestring()) } } to see the result exactly as intended, use the default theme in your browser.
...this wiki does not support xul and javascript in pages, so it is not possible to show the demonstration here.
MMgc - Archive of obsolete content
memory profiler mmgc's memory profiler can display the state of your application's heap, showing the different classes of object in memory, along with object counts, byte counts, and percentage of total memory.
...gc allocations are shown in the unmanaged vs.
...this has been shown to cut the finalize/sweep pause in half (which happens back to back atomically).
Working with BFCache - Archive of obsolete content
q: and to detect this we use pagehide/pageshow, correct?
...the pagehide event tells you whether the page is going into bfcache; the pageshow tells you whether it's coming from bfcache.
...q: hmm, so what event tells me “you'll never get a pageshow so you can drop the megabytes of info you've saved in firebug side table for that page?” a: an observer notification with the topic "inner-window-destroyed" whose subject is an nsisupportspruint64 containing the window id of the inner window being destroyed.
Download Manager preferences - Archive of obsolete content
browser.download.manager.showalertinterval the minimum number of milliseconds that must elapse between download complete alerts; if two downloads complete within this amount of time, only one alert is displayed.
... browser.download.manager.showalertoncomplete a boolean value that indicates whether or not an alert should be shown when downloads complete.
... browser.download.manager.showwhenstarting a boolean value that indicates whether or not to show the downloads window when a download begins.
Frequently Asked Questions - Archive of obsolete content
why does mozilla show source code/gibberish instead of svg?
... why does mozilla show an "xml parsing error" message instead of svg?
...mozilla will show this message when there's an xml well formedness error in the file it tried to load.
Creating XPI Installer Modules - Archive of obsolete content
one way of another, the chrome registry is shown the contents.rdf files; the contents.rdf files in turn point to new resources, and the resources are then registered with mozilla and accessible to the user.
...one of the buttons, labeled "show aphids", displays an alert dialog by calling a function defined in the javascript file barley.js.
...rley window" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul" width="175" height="375" x="20" y="20" persist="width height x y" orient="vertical" autostretch="always"> <script src="barley.js"/> <image src="barley.gif" /> <box orient="horizontal" autostretch="never"> <button label="barley corn" /> <button label="show aphids" oncommand="bar();" /> </box> </window> the other files that the window imports are defined in dark blue.
buttons - Archive of obsolete content
disclosure: a button to show more information.
...warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply.
...the cancel button might be shown as an additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os).
toolbar.mode - Archive of obsolete content
icons show only icons.
... text show only text.
... full show both.
MenuModification - Archive of obsolete content
<script> function addsubmenu() { var popup = document.getelementbyid("file-popup"); var newmenu = document.createelement("menu"); popup.appendchild(newmenu); newmenu.label = "new"; newmenu.appenditem("document", "doc"); newmenu.appenditem("image", "image"); } </script> <menu label="file" onpopupshowing="addsubmenu()"> <menupopup id="file-popup"/> </menu>.
...also, need replace newmenu.label= "new" by newmenu.setattribute("label", "new"); (all when creating from bootstrap.js in a bootstrapped addon) the addsubmenu function is called during the popupshowing event, which will be fired when an attempt to open the menu is made.
...the following shows how the addsubmenu function above might be rewritten to handle this case.
Panels - Archive of obsolete content
if you want to set the focus to an element by default when a panel is opened, adjust the focus within a popupshown event handler.
... for instance, to have the textbox initially focused in the example above: <panel id="search-panel" onpopupshown="document.getelementbyid('search').focus()"> to disable the adjusting of focus when a panel is opened, set the noautofocus attribute to true: <panel noautofocus="true"> this will cause the focus to remain on the element within the main window that has focus when the panel is opened.
... 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.
Tooltips - Archive of obsolete content
this can be accomplished by using a popupshowing event listener and adjusting the tooltip as needed.
... the popupshowing event will be fired on the tooltip element just before the tooltip appears.
... for example: <tooltip id="iconic" onpopupshowing="this.lastchild.value = document.tooltipnode.label;"/> the document.tooltipnode property of the document holds the element that the mouse is hovering over.
Multiple Queries - Archive of obsolete content
when used together in this example, the results are combined and only three results are shown.
...however, the example shows that only content for three results are generated.
... <hbox id="photoslist" datasources="template-guide-photos3.rdf" ref="http://www.xulplanet.com/rdf/myphotos" xmlns:dc="http://purl.org/dc/elements/1.1/"> <template dc:title="canal"> <button uri="rdf:*" image="rdf:*" label="view" orient="vertical"/> </template> </hbox> this example shows only a single photo since a condition is used to filter out the other two photos.
Multiple Rule Example - Archive of obsolete content
the next example shows how we can do this.
...there is no reason for this -- it is only used in this example to show that there is no connection between the variables used in the two rules.
...the result would be that the palace photo would not show this information.
Simple Query Syntax - Archive of obsolete content
in the simple syntax, the builder will use the default query shown above, although the variable names are randomly generated.
...the filtering isn't shown in this example.
...-guide-photos4.rdf" ref="http://www.xulplanet.com/rdf/myphotos" xmlns:r="http://www.xulplanet.com/rdf/"> <template> <rule r:country="http://www.daml.org/2001/09/countries/iso#it"> <vbox class="box-padded" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </rule> </template> </hbox> this example shows how a single attribute may be used to filter for only those results that have a country set to 'http://www.daml.org/2001/09/countries/iso#it'.
Adding Buttons - Archive of obsolete content
the example code below shows how to do this.
...the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </window> you'll notice that the cancel ...
...if you open the file in mozilla, you should get something like the image shown here.
Adding Labels and Images - Archive of obsolete content
an example is shown below: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed.
...the example below shows this: <image src="images/banner.jpg"/> although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url.
... a later section will describe how to use style sheets, but an example will be shown here for completeness.
Adding Properties to XBL-defined Elements - Archive of obsolete content
xul: <box id="random-box" class="randomizer"/> <button label="generate" oncommand="document.getelementbyid('random-box').number=math.random();"/> <button label="show" oncommand="alert(document.getelementbyid('random-box').number)"/> xbl: <binding id="randomizer"> <implementation> <field name="number"/> </implementation> </binding> a number field has been defined in the binding, which stores the random number.
...the example below shows this: <property name="number"> <getter> return this.getattribute('number'); </getter> <setter> var v = parseint(val,10); if (!isnan(v)) { this.setattribute('number', '' + v); } </setter> </property> the property in this example will only be able to hold integer values.
... the next section shows how to add methods to xbl-defined elements.
Box Objects - Archive of obsolete content
the following example shows this.
...example 2 : source view <script> function showpositionandsize() { var labelbox = document.getelementbyid('thelabel').boxobject; alert("position is (" + labelbox.x + "," + labelbox.y + ") and size is (" + labelbox.width + "," + labelbox.height + ")"); } </script> <button label="hide" oncommand="document.getelementbyid('thelabel').hidden = true;"/> <button label="show" oncommand="document.getelementbyid('th...
...elabel').hidden = false;"/> <button label="collapse" oncommand="document.getelementbyid('thelabel').collapsed = true;"/> <button label="uncollapse" oncommand="document.getelementbyid('thelabel').collapsed = false;"/> <button label="show position/size" oncommand="showpositionandsize();"/> <label id="thelabel" value="i am a label"/> note that if you hide and collapse the label, it will be treated as hidden.
Broadcasters and Observers - Archive of obsolete content
the simplest broadcaster is shown below.
...an example is shown below: example 2 : source view <broadcasterset> <broadcaster id="isoffline" label="offline" accesskey="f"/> </broadcasterset> <button id="offline_button"> <observes element="isoffline" attribute="label"/> </button> two attributes have been added to the observes element.
...an example is shown below.
Creating a Window - Archive of obsolete content
in fact, there will not be shown any window at all.
...add the xul template shown at the top of this page to the file and save it.
... troubleshooting if the xul window fails to show up on the desktop but has an icon on the desktop tool bar, check the xml-stylesheet declaration.
Creating a Wizard - Archive of obsolete content
a third option is to use the onpagehide and onpageshow attributes on the wizardpage element.
... these methods will be called when the page is hidden or shown, regardless of which button was pressed (except when cancel is pressed -- you need to use onwizardcancel to check for this.) these three methods should provide enough flexibility to handle navigation as you need to.
... pageshow wizardpage called on the page that the user is entering.
Element Positioning - Archive of obsolete content
an example is shown below: example 1: source view <button label="ok" width="100" height="40"/> however, it is not recommended that you do this.
...also, a minimum width of 15 ems has been set so that the text box will always show at least 15 characters.
...the following shows this attribute in use: example 6: source view <button label="push me please!" crop="right" flex="1"/> notice how the text on the button has had the right side of it cropped after the window is made smaller.
Input Controls - Archive of obsolete content
the following example shows some textboxes: example 1 : source view <label control="some-text" value="enter some text"/> <textbox id="some-text"/> <label control="some-password" value="enter a password"/> <textbox id="some-password" type="password" maxlength="8"/> multiline textbox the textbox examples above will create text inputs that can only be used for entering one line of text.
...if you open this window, you will see something much like that shown in the image.
...the example below shows some simple checkboxes and radio buttons.
More Event Handlers - Archive of obsolete content
example 1 : source view <vbox oncommand="alert(event.currenttarget.tagname);"> <button label="ok"/> <checkbox label="show images"/> </vbox> stop event propagation once you handle an event, regardless of where in the propagation the event is, you will likely want to stop the event from being sent to further elements, essentially stopping the capturing or bubbling phases from continuing.
...for example, the 'popupshowing' event is sent to a popup just before it is displayed.
...example 3 : source view <button label="types" type="menu"> <menupopup onpopupshowing="event.preventdefault();"> <menuitem label="glass"/> <menuitem label="plastic"/> </menupopup> </button> alternatively, for attribute event listeners, you can just return false from the code.
Simple Menu Bars - Archive of obsolete content
this letter is typically shown underlined on the menu title.
...the image here shows what the earlier example would look like without the menu bar.
...this letter is typically shown underlined on the menu title.
Splitters - Archive of obsolete content
this image shows the 4 panels with the splitter in a collapsed state.
... this image shows the 4 panels with the splitter resized to the right.
...as the images below show, when the grippy is clicked, the iframe is collapsed and the buttons shuffle up.
Trees - Archive of obsolete content
ArchiveMozillaXULTutorialTrees
a drop-down menu will appear in the upper-right corner of the tree, which the user may use to show and hide individual columns.
...the button in the upper right corner can be used to hide and show the columns.
... make sure that you set an id attribute on each column or the hiding and showing of columns will not work in all versions of mozilla.
Trees and Templates - Archive of obsolete content
this example shows why the uri attribute becomes useful.
...as the tree builder is used and not the content builder, the structure of the elements in the above example must be as shown, with the treechildren element inside the rule.
...the following example shows a sample column: <treecol id="date" label="date" flex="1" persist="width ordinal hidden sortactive sortdirection" sort="rdf:http://home.netscape.com/web-rdf#lastmodifieddate"/> more details about the persist attribute will be described in the later section.
XPCOM Examples - Archive of obsolete content
the code below shows how to get a component which implements it: var wmdata = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"].getservice(); wmdata.queryinterface(components.interfaces.nsiwindowdatasource); this code retrieves a window mediator data source component.
... the example below shows how we might do this: <toolbox> <menubar id="windowlist-menubar"> <menu label="window" oncommand="switchfocus(event.target);"> <menupopup id="window-menu" datasources="rdf:window-mediator" ref="nc:windowmediatorroot"> <template> <rule> <menuitem uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </rule> </template> </menupopup> </menu> </menubar> <...
... .getservice(components.interfaces.nsicookiemanager); var iter = cookiemanager.enumerator; while (iter.hasmoreelements()){ var cookie = iter.getnext(); if (cookie instanceof components.interfaces.nsicookie){ if (cookie.host == "www.mozillazine.org") menu.appenditem(cookie.name,cookie.value); } } } </script> <hbox> <menulist id="cookiemenu" onpopupshowing="getcookies();"/> </hbox> the getcookies() function will be called whenever the menu is opened, as indicated by the onpopupshowing attribute on the menulist.
XPCOM Interfaces - Archive of obsolete content
the table below shows some of the properties and methods of the nsilocalfile interface.
...the example below shows how to copy a file.
...an example is shown below: var bmarks = components.classes["@mozilla.org/browser/bookmarks-service;1"].getservice(); bmarks.queryinterface(components.interfaces.nsibookmarksservice); bmarks.addbookmarkimmediately("http://www.mozilla.org","mozilla",0,null); first, the component "@mozilla.org/browser/bookmarks-service;1" is retrieved and its service is placed in the variable bmarks.
Using Remote XUL - Archive of obsolete content
[optionally show what this looks like] the value of the flex attribute determines the extent to which the element will stretch relative to other flexible elements.
... an element with a flex of "2" is twice as flexible as an element with a flex of "1", so the first element might show up as twice as wide as the second.
... value="https://www.mozilla.org/bugs/" /> <menuitem label="bug writing" value="https://www.mozilla.org/quality/bug-writing-guidelines.html" /> </menupopup> </menu> <menu label="tools"> <menupopup> <menuitem label="view source" value="https://lxr.mozilla.org/seamonkey/" /> <menuitem label="tree status" value="https://tinderbox.mozilla.org/showbuilds.cgi?tree=seamonkey" /> <menuitem label="new checkins" value="https://bonsai.mozilla.org/cvsquery.cgi?treeid=default&amp;..." /> <menuitem label="submit a bug" value="https://bugzilla.mozilla.org/" /> </menupopup> </menu> <button label="faq" value="https://www.mozilla.org/faq.html" /> <button label="search" value="https...
Debugging a XULRunner Application - Archive of obsolete content
/* debugging prefs */ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); don't forget to change these preferences back to their defaults when you've finished debugging; leaving them as-is can significantly harm performance and usability.
...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 set.
Digital Signatures - Archive of obsolete content
figure 1 shows a simplified view of the way a digital signature can be used to validate the integrity of signed data.
... figure 1 shows two items transferred to the recipient of some signed data: the original data and the digital signature, which is basically a one-way hash (of the original data) that has been encrypted with the signer's private key.
...(information about the hashing algorithm used is sent with the digital signature, although this isn't shown in the figure.) finally, the receiving software compares the new hash against the original hash.
Browser Detection and Cross Browser Support - Archive of obsolete content
although you can use object detection as just another means of distinguishing between vendor/version the technique shows it's true power when used to detect features rather than browsers.
...in our example, branch 2.2.0 was created before 2.12.36 however comparing these values as strings shows '2.2.0' > '2.12.36'.
...width) == 'number') { // gecko 1.0 (netscape 7) and internet explorer 5+ width = windowref.document.body.clientwidth; } else if (typeof(windowref.innerwidth) == 'number') { // navigator 4.x, netscape 6.x, compuserve 7 and opera width = windowref.innerwidth; } example 2 - object based feature detection cross browser support this example also illustrates the use of feature detection and shows the complications that can arise from the non standard implementations in other browsers.
::-ms-fill - Archive of obsolete content
by setting animation-name on ::-ms-fill, you can change the animation, as shown in this table: value description none turns off the animation so that no dots are displayed.
... -ms-bar shows animated dots that flow in a bar pattern.
... -ms-ring shows animated dots that flow in a ring pattern.
Error.stackTraceLimit - Archive of obsolete content
if the stacktracelimit property is set to 0 at the time an error is thrown, no stack trace is shown.
...if the stacktracelimit is set to infinity, the entire stack is shown.
... example the following example shows how to set and then get the stack trace limit.
LiveConnect Overview - Archive of obsolete content
// javascript 1.3 var theclass = java.lang.class.forname("java.lang.string"); var thearray = java.lang.reflect.array.newinstance(theclass, 5); in javascript 1.4 and later, you can pass a javaclass object directly to a method, as shown in the following example: // javascript 1.4 var thearray = java.lang.reflect.array.newinstance(java.lang.string, 5); arguments of type char in javascript 1.4 and later, you can pass a one-character string to a java method which requires an argument of type char.
...as shown in the following code, the javadog constructor takes the javascript object jsdog, which is defined as type jsobject, as an argument: import netscape.javascript.*; public class javadog{ public string dogbreed; public string dogcolor; public string dogsex; // define the class constructor public javadog(jsobject jsdog){ // use try...catch to handle jsexceptions here ...
...instead, convert the wrapper to a javascript string by appending the empty string to it, as shown here: var javastring = javaobj.methodthatreturnsastring(); var javascriptstring = javastring + ""; ...
RFE to the Custom Controls - Archive of obsolete content
output that shows the dom if output contains cdata section or text node and its data is any mozilla known language like xhtml/xul/svg then output should parse and display it (see bug 316817).
... output should show data in current locale format the bug 331585 address the issue.
... input that shows/modifies the dom like the request above for output.
XForms Input Element - Archive of obsolete content
introduction this element is an important and oft-used xforms element to show and change the instance data to which this xforms control is bound (see the spec).
... mozilla extensions labelposition - only for boolean types: show the label before or after the checkbox (see below) type restrictions the input element can be bound to a node containing simple content of any data type except xsd:base64binary, xsd:hexbinray or any data type derived from these.
...before shows the label first, then the checkbox, after shows the checkbox, than the label.
Archive of obsolete content
the new design clearly shows what some experts have been saying: that standards-based design can be visually compelling and preserve the interface conventions we've come to expect from web pages.
... updating an extension to support multiple mozilla applications this article shows how to take an existing extension and update it so that it can be used in additional mozilla applications.
...due to a limitation of the present implementation of nspr io on nt, programs must follow the following guideline: using ssh to connect to cvs using web standards in your web pages using workers in extensions this article shows you how to use worker threads in extensions to perform tasks in the background without blocking the user interface.
Bounding volume collision detection with THREE.js - Game development
this article shows how to implement collision detection between bounding boxes and spheres using the three.js library.
...this results in a new box mesh representing the bounding box, which shows the bounding box's shape, and can passed to the previously seen setfromobject method in order to have a bounding box matching the mesh.
...the first one showcases point vs.
Building up a basic demo with the PlayCanvas engine - Game development
we also rotate the box a bit to show that it's actually a 3d cube and not a square.
...it is also rotated around the x axis to show it's actually a 3d shape.
...to show actual animation, we need to make changes to these values inside the rendering loop, so they are updated on every frame.
Desktop mouse and keyboard controls - Game development
that way, if you already implemented the buttons as shown in the mobile touch controls article, it will work out of the box on the desktop too: var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); the button will be placed ten pixels from the top left corner of the screen, use the logo-enclave image, and will execute the clickenclave() function when clicked.
...when showing the how to play screen where the various ways to control the ship in the game are shown, instead of showing them all to everyone, we can detect whether the game is launched on desktop or mobile and just show the appropriate controls for the device: if(this.game.device.desktop) { movetext = 'arrow keys or wasd to move'; shoottext = 'x or space to shoot'; } else { movetext = 'tap an...
...d hold to move'; shoottext = '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.
Implementing game control mechanisms - Game development
in this series of articles we will show you how you can approach building a game that can be played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads.
... 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.
... unconventional controls — the final article showcases some unconventional control mechanisms, from the experimental to the slightly crazy, which you might not believe could be used to play the game.
Mobile accessibility - Learn web development
now turn two fingers around the screen like a dial to show the rotor and move between its options.
...op; 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.ontouchstart = 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 mechanisms at implementing game control mechanisms.
What is accessibility? - Learn web development
on the other hand, if you are working on a gallery website showing interesting 3d art, it would be unreasonable to expect every piece of art to be perfectly accessible to visually impaired people, given that it is an entirely visual medium.
... to show that you care and have thought about accessibility, publish an accessibility statement on your site that details what your policy is toward accessibility, and what steps you have taken toward making the site accessible.
... summary this article should have given you a useful high-level overview of accessibility, shown you why it's important, and looked at how you can fit it into your workflow.
Advanced styling effects - Learn web development
blend modes css blend modes allow us to add blend modes to elements that specify a blending effect when two elements overlap — the final color shown for each pixel will be the result of a combination of the original pixel color, and that of the pixel in the layer underneath it.
...first, background-blend-mode — here we'll show a couple of simple <div>s, so you can compare the original with the blended version: <div> </div> <div class="multiply"> </div> now some css — we are adding to the <div> one background image and a green background color: div { width: 250px; height: 130px; padding: 10px; margin: 10px; display: inline-block; background: url(https://mdn.mozillademos.org/files/13090/colorful-heart.pn...
...here we'll present the same two <div>s, but each one is now sat on top of a simple <div> with a purple background, to show how the elements will blend together: <article> no mix blend mode <div> </div> <div> </div> </article> <article> multiply mix <div class="multiply-mix"> </div> <div> </div> </article> here's the css we'll style this with: article { width: 280px; height: 180px; margin: 10px; position: relative; display: inline-block; } div { width: 250px; height: 130px; padding: 10px;...
Handling different text directions - Learn web development
this figure shows the two dimensions when in a horizontal writing mode.
... this figure shows the two dimensions in a vertical writing mode.
...you could replace left with inline-start as shown in the example below.
Introduction to CSS layout - Learn web development
this is useful for creating complex layout effects such as tabbed boxes where different content panels sit on top of one another and are shown and hidden as desired, or information panels that sit off screen by default, but can be made to slide on screen using a control button.
... simple positioning example to provide familiarity with these page layout techniques, we'll show you a couple of quick examples.
... the example below shows one such use; using css tables for layout should be considered a legacy method at this point, for those situations where you have very old browsers without support for flexbox or grid.
Web fonts - Learn web development
we'll show you below how to generate the required code.
... in the resulting screen, you first need to copy the line of html code shown and paste it into the head of your html file.
...@font-face tip: define font-weight and font-style to keep your css simple by roger johansson shows what to do in more detail.
How to build custom form controls - Learn web development
here is the result we want to achieve: this screenshot shows the three main states of our control: the normal state (on the left); the active state (in the middle) and the open state (on the right).
... state for this specific control select.classlist.add('active'); } // this function will be used each time the user wants to open/closed the list of options // it takes one parameter: // select : the dom node with the list to toggle function toggleoptlist(select) { // the list is kept from the control var optlist = select.queryselector('.optlist'); // we change the class of the list to show/hide it optlist.classlist.toggle('hidden'); } // this function will be used each time we need to highlight an option // it takes two parameters: // select : the dom node with the `select` class containing the option to highlight // option : the dom node with the `option` class to highlight function highlightoption(select, option) { // we get the list of all option available for our custom s...
...ut type="radio" name="fruit" value="strawberry" id="fruitstrawberry"><label for="fruitstrawberry">strawberry</label></li> <li><input type="radio" name="fruit" value="apple" id="fruitapple"><label for="fruitapple">apple</label></li> </ul> </fieldset> we'll do a little styling of the radio button list (not the legend/fieldset) to make it look somewhat like the earlier example, just to show that it can be done: .styledselect { display: inline-block; padding: 0; } .styledselect li { list-style-type: none; padding: 0; display: flex; } .styledselect [type=radio] { position: absolute; left: -100vw; top: -100vh; } .styledselect label { margin: 0; line-height: 2; padding: 0 0 0 4px; } .styledselect:not(:focus-within) input:not(:checked) + label { height: 0; outl...
Sending form data - Learn web development
as an example, your form data will be shown as follows in the chrome network tab.
... select "network" select "all" select "foo.com" in the "name" tab select "headers" you can then get the form data, as shown in the image below.
... example: python this example shows how you would use python to do the same thing — display the submitted data on a web page.
Introduction to HTML - Learn web development
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.
...this article shows the syntax required to make a link and discusses best practices for links.
HTML table basics - Learn web development
LearnHTMLTablesBasics
adding headers with <th> elements now let's turn our attention to table headers — special cells that go at the start of a row or column and define the type of data that row or column contains (as an example, see the "person" and "age" cells in the first example shown in this article).
...take the following simple example, which shows the names of common animals.
... in some cases, we want to show the names of the males and females next to the animal name.
Introducing asynchronous JavaScript - Learn web development
previous overview: asynchronous next in this article we briefly recap the problems associated with synchronous javascript, and take a first look at some of the different asynchronous techniques you'll encounter, showing how they can help us solve such problems.
... the nature of asynchronous code let's explore an example that further illustrates the nature of async code, showing what can happen when we are not fully aware of code execution order and the problems of trying to treat asynchronous code like synchronous code.
... it worked :) if this confuses you, then consider the following smaller example: console.log("registering click handler"); button.addeventlistener('click', () => { console.log("get click"); }); console.log("all done"); this is very similar in behavior — the first and third console.log() messages will be shown immediately, but the second one is blocked from running until someone clicks the mouse button.
Object prototypes - Learn web development
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!
...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.
... revisiting create() earlier on we showed how the object.create() method can be used to create a new object instance.
Perceived performance - Learn web development
even if an operation is going to take a long time (because of latency or or inavailability of the main thread), it is possible to keep the user engaged while they wait by showing a loading spinner, or a series of useful hints and tips (or jokes, or whatever else you think might be appropriate).
... such an approach is much better than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up.
...in other words, first download everything you're going to actually show, but only the stuff you are actually using, then download the rest.
Server-side website programming first steps - Learn web development
server-side web frameworks the last article showed you what a server-side web application needs to do in order to respond to requests from a web browser.
... now we show how web frameworks can simplify these tasks, and help you choose the right framework for your first server-side web application.
... assessments this "first steps" module doesn't have any assessment because we haven't yet shown you any code.
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.
...omponents/footer.js file and update it to the following: import component from '@glimmer/component'; import { inject as service } from '@ember/service'; export default class footercomponent extends component { @service('todo-data') todos; } now we need to go back to our todo-data.js file and add some functionality that will allow us to return the number of incomplete todos (useful for showing how many are left), and clear the completed todos out of the list (which is what the “clear completed” functionality needs).
...m '@ember/service'; export default class todocomponent extends component { @service('todo-data') todos; } next, go back again to our todo-data.js service file and add the following action just below the previous ones, which will allow us to toggle a completion state for each todo: @action togglecompletion(todo) { todo.iscompleted = !todo.iscompleted; } updating the template to show completed state finally, we will edit the todo.hbs template such that the checkbox's value is now bound to the iscompleted property on the todo, and so that on change, the togglecompletion() method on the todo service is invoked.
Ember app structure and componentization - Learn web development
enter the following command into your terminal: ember generate component header these will generate some new files, as shown in the resulting terminal output: installing component create app/components/header.hbs skip app/components/header.js tip to add a class, run `ember generate component-class header` installing component-test create tests/integration/components/header-test.js header.hbs is the template file where we’ll include the html structure for just that component.
... note: the header.js file (shown as skipped) is for connection to a backing glimmer component class, which we don't need for now, as they are for adding interactivity and state manipulation.
...we'll look at showing different todo items in the next article!
React interactivity: Events and state - Learn web development
it should end up looking something like this: function handlesubmit(e) { e.preventdefault(); alert('hello, world!'); } to use this function, add an onsubmit attribute to the <form> element, and set its value to the handlesubmit function: <form onsubmit={handlesubmit}> now if you head back to your browser and click on the "add" button, your browser will show you an alert dialog with the words "hello, world!" — or whatever you chose to write there.
...update it as follows: function handlesubmit(e) { e.preventdefault(); props.addtask("say hello!"); } clicking on the "add" button in your browser will prove that the addtask() callback function works, but it'd be nice if we could get the alert to show us what we're typing in our input field!
...change the console.log() to setname(), as shown below: function handlechange(e) { setname(e.target.value); } now we need to change our handlesubmit() function so that it calls props.addtask with name as an argument — remember our callback prop?
Beginning our React todo list - Learn web development
nput" classname="input input__lg" name="text" autocomplete="off" /> <button type="submit" classname="btn btn__primary btn__lg"> add </button> </form> <div classname="filters btn-group stack-exception"> <button type="button" classname="btn toggle-btn" aria-pressed="true"> <span classname="visually-hidden">show </span> <span>all</span> <span classname="visually-hidden"> tasks</span> </button> <button type="button" classname="btn toggle-btn" aria-pressed="false"> <span classname="visually-hidden">show </span> <span>active</span> <span classname="visually-hidden"> tasks</span> </button> <button type="button" classname="btn t...
...oggle-btn" aria-pressed="false"> <span classname="visually-hidden">show </span> <span>completed</span> <span classname="visually-hidden"> tasks</span> </button> </div> <h2 id="list-heading"> 3 tasks remaining </h2> <ul role="list" classname="todo-list stack-large stack-exception" aria-labelledby="list-heading" > <li classname="todo stack-small"> <div classname="c-cb"> <input id="todo-0" type="checkbox" defaultchecked={true} /> <label classname="todo-label" htmlfor="todo-0"> eat </label> </div> <div classname="btn-group"> <button type="button" classname="btn"> edit <span classname="vi...
...for example: <button type="button" classname="btn toggle-btn" aria-pressed="true"> <span classname="visually-hidden">show </span> <span>all</span> <span classname="visually-hidden"> tasks</span> </button> here, aria-pressed tells assistive technology (like screen readers) that the button can be in one of two states: pressed or unpressed.
Starting our Svelte Todo list app - Learn web development
</label> </h2> <input type="text" id="todo-0" autocomplete="off" class="input input__lg" /> <button type="submit" disabled="" class="btn btn__primary btn__lg"> add </button> </form> <!-- filter --> <div class="filters btn-group stack-exception"> <button class="btn toggle-btn" aria-pressed="true"> <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" aria-pressed="false"> <span class="visually-hidden">show</span> <span>active</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" aria-pressed="false"> <span class="visually-hidden">show</span> <...
... a label showing the total number of tasks and the completed tasks.
...for example: <button class="btn toggle-btn" aria-pressed="true"> <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> here, aria-pressed tells assistive technology (like screen readers) that the button can be in one of two states: pressed or unpressed.
TypeScript support in Svelte - Learn web development
in this section we'll show you how to setup a svelte project with typescript support to give it a try.
...ng: <!-- components/filterbutton.svelte --> <script lang='ts'> import { filter } from '../types/filter.enum' export let filter: filter = filter.all </script> <div class="filters btn-group stack-exception"> <button class="btn toggle-btn" class:btn__primary={filter === filter.all} aria-pressed={filter === filter.all} on:click={()=> filter = filter.all} > <span class="visually-hidden">show</span> <span>all</span> <span class="visually-hidden">tasks</span> </button> <button class="btn toggle-btn" class:btn__primary={filter === filter.active} aria-pressed={filter === filter.active} on:click={()=> filter = filter.active} > <span class="visually-hidden">show</span> <span>active</span> <span class="visually-hidden">tasks</span> </button> <button class="btn to...
...ggle-btn" class:btn__primary={filter === filter.completed} aria-pressed={filter === filter.completed} on:click={()=> filter = filter.completed} > <span class="visually-hidden">show</span> <span>completed</span> <span class="visually-hidden">tasks</span> </button> </div> here we are just importing the filter enum, and using it instead of the string values we used previously.
Vue conditional rendering: editing existing todos - Learn web development
update your todoitem’s template as shown below.
... result: itemedited() method is invoked, which emits the item-edited event (which is then listened for inside app.vue, see above), and sets this.isediting back to false, so that the edit form is no longer shown on re-render.
... result: editcancelled() method is invoked, which sets this.isediting back to false, so that the edit form is no longer shown on re-render.
Deploying our app - Learn web development
we push the code to github, deploy it using netlify, and even show you how to add a simple test into the process.
... you should now be able to run the following command in the root of your project directory to run the production build step (first quit the running process with ctrl + c if you need to): npm run build this should give you an output like the following, showing you the production files that were created, how big they are, and how long they took to build: dist/src.99d8a31a.js.map 446.15 kb 63ms dist/src.99d8a31a.js 172.51 kb 5.55s dist/stars.7f1dd035.svg 6.31 kb 145ms dist/asteriod2.3ead4904.svg 3.51 kb 155ms dist/asteriod1.698d75e9.svg 2.9 kb 153ms dist/src.84f2edd1.css.map 2.57 kb 3m...
...i'll show you how to add an initial test to your project and how to use the test to prevent or to allow the project deployment to happen.
Mozilla's Section 508 Compliance
incomplete, we show focus but need to expose it programmatically by supporting carbon/cocoa accessibility.
...with showsounds enabled in operating system.
...with showsounds enabled in operating system.
A bird's-eye view of the Mozilla framework
it examines what happens when the user performs a simple user interface (ui) action such as clicking a link in the contents panel of the help viewer window shown below.
...figure 2 shows this structure.
... inside an xpcom component figure 3 shows a more detailed view of an xpcom component.
Command line options
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.
... -showdate date show your schedule of the given date.
... sunbird -showdate 08/04/2008 -subscribe url or -url url subscribe to the given url.
Creating reftest-based unit tests
if one has software that multiplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4.
...experiments with this have shown it to be not as easy as one would hope.
... reftests and preferences in order to use preferences that are not listed in the browser's built-in preferences files such as all.js (in other words, preferences that will not show up in about:config) it is necessary to add the preference to testing/profiles/reftest/user.js.
Debugging on Mac OS X
at this point you can run the application from xcode, and when you pause or hit breakpoints it should show open the correct source file at the correct line.
... running a debug session make sure breakpoints are active (which implies running under the debugger) by opening the product menu and selecting "debug / activate breakpoints" (also shown by the "breakpoints" button in the top right section of the main window).
...the information area at the top of the window will show "waiting for plugin-container to launch" from a command line, run your build of firefox.
How Mozilla's build system works
to view information about the tiers, you can execute the following special make targets: command effect make echo-tiers show the final list of tiers.
... make echo-dirs show the list of non-static source directories to iterate over, as determined by the tier list.
... make echo-variable-static_dirs show the list of static source directories to iterate over, as determined by the tier list.
API-provided widgets
viewid only useful for views (and required there): the id of the that should be shown when clicking the widget.
... showinprivatebrowsing whether to show the widget in private browsing mode (optional, default: true) event handlers you can also define several event handlers which will be called at various stages in a widget's lifetime: event handler name description onbuild(adoc) only useful for custom widgets (and required there); a function that will be invoked with the document...
... onviewshowing(aevt) only useful for views; a function that will be invoked when a user shows your view.
Download
method overview promise start(); promise launch(); promise showcontainingdirectory(); promise cancel(); promise removepartialdata(); promise whensucceeded(); promise finalize([optional] boolean aremovepartialdata); properties attribute type description canceled read only boolean indicates that the download has been canceled.
... showcontainingdirectory() shows the folder containing the target file, or where the target file will be saved.
... promise showcontainingdirectory(); parameters none.
JNI.jsm
= intarray.new(5); // object { js#obj: cdata, length: 5 } ia.get(0); // 0 ia.get(1); // 0 ia.get(2); // 0 ia.get(3); // 0 ia.get(4); // 0 ia.set(2, 10); // void ia.get(2); // 10 ia.setelements(3, [50, 75]); // void ia.get(0); // 0 ia.get(1); // 0 ia.get(2); // 10 ia.get(3); // 50 ia.get(4); // 75 } finally { if (my_jenv) { jni.unloadclasses(my_jenv); } } casting this example shows how to cast, the casting happens at jni.classes.android.view.windowmanager.__cast__(wm) below: function main() { var my_jenv; try { my_jenv = jni.getforthread(); var sig = { windowmanager: 'landroid/view/windowmanager;', windowmanager_layoutparams: 'landroid/view/windowmanager$layoutparams;', viewgroup_layoutparams: 'landroid/view/vie...
...aparamsarr.join('') : '') + ')' + aret; } function fullyqualifiednameofclass(aclass) { // aclass is a string with l and ; arround it return aclass.substr(1, aclass - 2); } examples read java strings this example shows how to read java strings as javascript strings.
...this shows how to get the paths to the "pictures" folder: components.utils.import("resource://gre/modules/jni.jsm"); components.utils.import("resource://gre/modules/osfile.jsm"); // because we use os.path.join in this example var my_jenv = null; try { my_jenv = jni.getforthread(); var sig = { environment: 'landroid/os/environment;', string: 'ljava/lang/string;', file: 'ljava/io/file;' }; var environment = jni.loadclass(my_jenv, sig.environment.substr(1, sig.environment.length - 2), { static_fields: [ { name: 'directory_pictures', sig: sig.string } ], static_methods: [ { name:'getexternalst...
NSS API Guidelines
the nss apis are layered, as shown in this diagram: the boxes in the gray section, towards the center, are exported only through pkcs #11.
... experience shows that users of the security library expect arenas to be threadsafe, so we added locking, and other useful changes.
...example code should be included in the documentation, to show how to safely use these data objects.
NSS tools : certutil
ids are displayed in hexadecimal ("0x" is not shown).
...use the -h option to show the complete list of arguments for each command option.
...mozilla nss bug 836477 https://bugzilla.mozilla.org/show_bug.cgi?id=836477 ...
NSS Tools ssltap
the following examples show the output from commonly used combinations of options.
... example 1 the s and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format.
...both formats are shown for each record.
compare-locales
options to get a brief list of available options, use the --help flag: $ compare-locales --help the output the output of compare-locales shows the missing and obsolete strings in a pseudo-diff format.
... ab-cd browser chrome/browser browser.dtd +backforwardmenu.tooltip +fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name.
... the file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper.
Redis Tips
here's a stupid node script to show how this works: #!/usr/bin/env node var r = require('redis').createclient(); r.multi() .set("foo", 42) .set("bar", "ice cream") .set("baz", 6.28) .get("foo") .get("bar") .get("baz") .exec(function(err, resultlist) { console.log(json.stringify(resultlist, null, 2)); r.end(); // terminate the redis connection; node can quit }); when run, this prints: [ "ok", "ok", ...
... here's an example, again using two separate redis clis, to show how it works.
... i'll show this in the node console, to illustrate how the optional parameters are done.
Places Developer Guide
the example below shows how to enumerate a bookmark folder's contents, and how to access the properties of the items themselves.
...the example below shows how to search through all bookmarks, and to iterate over the results.
...the example below shows how to search through browser history, and to iterate over the results.
Index
MozillaTechXPCOMIndex
this article will show you how to use the available interfaces in several mozilla products.
...furthermore we show the new panel only for imap accounts...
...for example, to request the 'show all threads' view use the constant: 1268 nsstaticmoduleinfo this data structure is used by ns_initxpcom3 to specify static xpcom modules.
nsIAppShellService
nsixulwindow createtoplevelwindow( in nsixulwindow aparent, in nsiuri aurl, in boolean ashowwindow, in boolean aloaddefaultpage, in pruint32 achromemask, in long ainitialwidth, in long ainitialheight, in nsiappshell aappshell ); parameters aparent the parent window.
... ashowwindow obsolete since gecko 1.8 the window remains invisible if pr_false.
...these windows are generally shown in the windows taskbar, and the application knows it can not quit until it is out of registered windows.
nsICategoryManager
examples print out a list of all categories this snippet shows how to print out a list of all categories in c++.
...hasmore) && hasmore) { nscomptr<nsisupports> elem; cats->getnext(getter_addrefs(elem)); nscomptr<nsisupportscstring> category = do_queryinterface(elem, &rv); if (ns_failed(rv)) break; nsembedcstring categoryname; rv = category->getdata(categoryname); if (ns_failed(rv)) break; printf("%s\n", categoryname.get()); } return ns_ok; } this snippet shows how to print out a list of all categories in javascript.
...rymanager.enumeratecategory("app-startup"); var entries = []; while (enumerator.hasmoreelements()) { var item = enumerator.getnext(); var entry = item.queryinterface(components.interfaces.nsisupportscstring) entries.push(entry.tostring()); } entries.sort(); var entriesstring = entries.join("\n"); dump(entriesstring + "\n"); disable currently loaded plugins by type this snippet here shows how to disable plugins that are currently loaded for the file type of pdf.
nsIConsoleService
if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the script.
...if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the script.
...you may pass null if you are lazy; this will prevent the source line showing in the error console.
nsICryptoHash
the following example shows how to compute the sha256 hash of a file: // hardcoded here for convenience var path = "c:\\windows\\notepad.exe"; var f = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); f.initwithpath(path); var istream = components.classes["@mozilla.org/network/file-input-stream;1"] .createinstance(components.inter...
...this example, while simple, shows most of the functionality of the interface.
... the example below shows how to convert a string to bytes in the utf-8 encoding, and then compute the sha256 hash of it.
nsIDownloadManagerUI
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void getattention(); void show([optional] in nsiinterfacerequestor awindowcontext, [optional] in unsigned long aid, [optional] in short areason); attributes attribute type description visible boolean true if the download manager ui is visible; otherwise false.
... show() shows the download manager's user interface to the user.
... void show( in nsiinterfacerequestor awindowcontext, optional in unsigned long aid, optional in short areason optional ); parameters awindowcontext optional the parent window context to show the user interface.
Building an Account Manager Extension
furthermore we show the new panel only for imap accounts...
... components.utils.import("resource://gre/modules/xpcomutils.jsm"); //class constructor function devmoaccountmanagerextension() {}; // class definition devmoaccountmanagerextension.prototype = { name : "devmo-account", chromepackagename : "example@mozilla.org", showpanel: function(server) { //this panel is only shown for imap accounts...
....mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="parent.onpanelloaded('am-devmo-account.xul');"> <script type="application/javascript" src="chrome://messenger/content/accountmanager.js"/> <script type="application/javascript" src="chrome://example@mozilla.org/content/am-devmo-account.js"/> <dialogheader title="devmo example panel"/> <description> this panel is only shown in imap accounts...
nsIMsgAccountManagerExtension
inherits from: nsisupports method overview boolean showpanel(in nsimsgincomingserver server); attributes attribute type description name acstring name of the account manager extension.
... methods showpanel() before displaying a panel in the account manager this method is triggered.
... boolean showpanel( in nsimsgincomingserver server ); parameters server the account for which the panel should be displayed.
nsIMsgDBView
viewnavigate() change the view to show a particular message.
... void loadmessagebyurl(in string aurl); parameters aurl the url of the message reloadmessage() reload the currently shown message.
... void reloadmessage(); reloadmessagewithallparts() reload the currently shown message with fetchcompletemessage set to true.
nsIScriptError
you may pass null if you are lazy; that will prevent showing the source line in javascript console.
...you may pass null if you are lazy; that will prevent showing the source line in javascript console.
...you may pass null if you are lazy; that will prevent showing the source line in javascript console.
nsIXULWindow
void assumechromeflagsarefrozen(); void center(in nsixulwindow arelative, in boolean ascreen, in boolean aalert); nsixulwindow createnewwindow(in print32 achromeflags, in nsiappshell aappshell); nsidocshelltreeitem getcontentshellbyid(in wstring id); void removechildwindow(in nsixulwindow achild); void showmodal(); attributes attribute type description chromeflags pruint32 chromeflags are from nsiwebbrowserchrome.
... showmodal() shows the window as a modal window.
... void showmodal(); parameters none.
nsPIPromptService
this is the system sound name which should be played when the dialog is shown.
...if this is not 0, the all buttons are disabled when the dialog is shown.
...this is the sound event id which should be played when the dialog is shown.
Reference Manual
foo3 = dont_addref(rawfoo3ptr); // the annotations described in the table apply to both forms of constructor, // and to plain-old assignment any of the annotations shown in the table can appear in all the positions demonstrated with dont_addref.
...nscomptr<t> = t*, nscomptr<t> = dont_queryinterface( t* ) the default behavior, shown in the table as t*, is to addref the new value, but not to call queryinterface against it.
... // you _must_ handle this case with the two step solution shown above.
Xray vision
xray vision helps javascript running in a privileged security context safely access objects created by less privileged code, by showing the caller only the native version of the objects.
...so when chrome code accesses content objects, it sees them with xray vision: // chrome code var transfer = gbrowser.contentwindow.confirm("transfer all my money?"); // calls the native implementation note that using window.confirm() would be a terrible way to implement a security policy, and is only shown here to illustrate how xray vision works.
...le: true,' + ' configurable: true,' + ' get: function() { return "wait, is this really a getter?"; }' + '});'; var sandbox = components.utils.sandbox("https://example.org/"); components.utils.evalinsandbox(sandboxscript, sandbox); // 1) trying to access properties in the prototype that have been redefined // (non-own properties) will show the original 'native' version // note that functions are not included in the output console.log("1) property redefined in the prototype:"); console.log(sandbox.me.tosource()); // -> "({firstname:"joe", address:{street:"main street"}, lastname:"smith"})" // 2) trying to access properties on the object that shadow properties // on the prototype will show the original 'native' version console.log("...
Theme Packaging
this document describes only how themes are packaged in order to be shown in firefox's themes window.
... preview.png is a preview image which will show when double-clicked on a theme in the appearance section of the add-ons manager.
...48x48) png (may contain alpha transparency) which will show up in the appearance section of the add-ons manager.
Using tab-modal prompts
even if you set it to the browser window ("var thewindow = window") the modal alert will be shown in the current tab.
...ozilla.org/prompter;1'].getservice(components.interfaces.nsipromptfactory); var prompt = promptfact.getprompt(window, components.interfaces.nsiprompt); var promptbag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); promptbag.setpropertyasbool('allowtabmodal', true); var check = {value: false}; //initial state of checkbox, however if no text is supplied the checkbox is not shown var input = {value: 'pre filled value'}; var ok = prompt.prompt.apply(null, ['title - but not shown in tab modal', 'text goes here', input, 'check text, if no text, checkbox is not shown', check]); //this here is just an alert, showing the values of the prompt prompt.alert.apply(null, ['title not shown in modal', 'user clicked ok: ' + ok + '\n' + 'checked: ' + check.value + '\ninput value: ' + ...
...input.value]); note: because the prompts are shown in a tab, if the tab is closed while the prompt is open it will throw an exception.
Zombie compartments
for example, if i open https://bugzilla.mozilla.org/show_bug.cgi?id=668871 in one tab, then compartment(https://bugzilla.mozilla.org/show_bug.cgi?id=668871) will show up in about:memory.
... if i then open https://bugzilla.mozilla.org/show_bug.cgi?id=700547 and close the first tab, the same compartment will continue to be used.
... the more you exercise the add-on, the more thorough the testing will be, but in practice a lot of problems show up quickly.
Drawing and Event Handling - Plugins
because the drag manager calls both handlers no matter where the cursor is, the browser does not show the drag highlight when the cursor is over an instance rectangle.
...the plug-in can then show the drag highlight and handle drops when they occur within the instance rectangle.
... this code shows the specific data passed through this method for each platform: #ifdef xp_mac typedef eventrecord npevent; #elif defined(xp_win) typedef struct _npevent { int16 event; int16 wparam; int32 lparam; } npevent; #elif defined(xp_unix) typedef xevent npevent; #else typedef void npevent; #endif /* xp_mac */ int16 npp_handleevent(npp instance, npevent* event); on mac os, when npp_...
Initialization and Destruction - Plugins
for an example that shows the use of both the np_initialize and np_shutdown methods, see initialize and shutdown example.
...the example shows the use of the optional save parameter of npp_destroy and saved parameter of npp_new.
... void np_shutdown(void); for an example that shows both the np_initialize and np_shutdown methods, see initialize and shutdown example.
Plug-in Basics - Plugins
plug-ins like these are now available: multimedia viewers such as adobe flash and adobe acrobat utilities that provide object embedding and compression/decompression services applications that range from personal information managers to games the range of possibilities for using plug-in technology seems boundless, as shown by the growing numbers of independent software vendors who are creating new and innovative plug-ins.
... var plugin = mimetype.enabledplugin; if (plugin) { // yes, so show the data in-line document.writeln("here\'s a movie: <object data='mymovie.swf' height='100' width='100'></object>"); } else { // no, so provide a link to the data document.writeln("<a href='mymovie.swf'>click here</a> to see a movie."); } } else { // no, so tell them so document.writeln("sorry, can't show you this movie."); } overview of plug-in structure this sec...
... the following example shows an embed element nested within an object element, which is necessary for browsers that do not support the embed element.
Introduction to DOM Inspector - Firefox Developer Tools
the following descriptions provide an overview of what these viewers are about: the dom nodes viewer shows attributes of nodes that can take them, or the text content of text nodes, comments, and processing instructions.
... the css rules viewer shows the css rules that are applied to the node.
...her powerful interactive feature of the dom inspector is that when you have the dom inspector open and have enabled this functionality by choosing edit > select element by click or by clicking the little magnifying glass icon in the upper left portion of the dom inspector application, you can click anywhere in a loaded web page or the the inspect chrome document, and the element you click will be shown in the document pane in the dom nodes viewer and information displayed in the object pane.
Debugging service workers - Firefox Developer Tools
when you open the application panel’s service workers view on a page that doesn't have a service worker registered, you'll get the following output shown: this gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered!
... note: there is currently a bug whereby the network monitor cannot show network requests from a service worker running in a different process to the application (bug 1432311).
... finding registered service workers on other domains as mentioned above, the service worker view of the application panel shows all the service workers registered on the current domain.
Browser Console - Firefox Developer Tools
beginning with firefox 68, the browser console allows you to show or hide messages from the content process (i.e.
... the messages from scripts in all the opened pages) by setting or clearing the checkbox labeled show content messages.
... the following image shows the browser console focused on the same page as above after clicking on the show content messages checkbox.
Examine, modify, and watch variables - Firefox Developer Tools
each object can be expanded, using a disclosure triangle, to show its properties.
... if a variable exists in the source but has been optimized away by the javascript engine, then it is shown in the variables view, but is given the value (optimized away), and is not editable.
...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.
Set event listener breakpoints - Firefox Developer Tools
there's an issue here — the console is showing that the keypress event is being fired somewhere inside jquery.
... instead, it’d be far more useful if we showed where in our own app code is calling the jquery that fired the event.
... now the logs will show where in your app jquery was called, rather than where in jquery the event was fired: filter by event type also added to firefox 71 is a new filter by event type...
Debugger-API - Firefox Developer Tools
here is a javascript program in the process of running a timer callback function: a running javascript program and its debugger shadows this diagram shows the various types of shadow objects that make up the debugger api (which all follow some general conventions): a debugger.object represents a debuggee object, offering a reflection-oriented api that protects the debugger from accidentally invoking getters, setters, proxy traps, and so on.
... examples here are some things you can try out yourself that show off some of debugger’s features: setting a breakpoint in a page, running a handler function when it is hit that evaluates an expression in the page’s context.
... showing how many objects different call paths allocate.
All keyboard shortcuts - Firefox Developer Tools
enter return enter step forward through the attributes of a node tab tab tab step backward through the attributes of a node shift + tab shift + tab shift + tab (when an attribute is selected) start editing the attribute enter return enter hide/show the selected node h h h focus on the search box in the html pane ctrl + f cmd + f ctrl + f edit as html f2 f2 f2 stop editing html f2 / ctrl +enter f2 / cmd + return f2 / ctrl + enter copy the selected node's outer html ctrl + c cmd + c ctrl + c scroll the selected node into view s s s find...
... show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter or space open mdn reference page about current property (computed view only, when a property is selected) f1 f1 f1 open current css file in style editor (computed view only, when more information is shown for a property and a css f...
...ad code ctrl + shift + r cmd + shift + r ctrl + shift + r save the pad ctrl + s cmd + s ctrl + s open an existing pad ctrl + o cmd + o ctrl + o create a new pad ctrl + n cmd + n ctrl + n close scratchpad ctrl + w cmd + w ctrl + w pretty print the code in scratchpad ctrl + p cmd + p ctrl + p show autocomplete suggestions ctrl + space ctrl + space ctrl + space show inline documentation ctrl + shift + space ctrl + shift + space ctrl + shift + space eyedropper command windows macos linux select the current color enter return enter dismiss the eyedropper esc esc esc move by 1 pixel arrow key...
Inspecting web sockets - Firefox Developer Tools
the live-updated table shows data for sent (green arrow) and received (red arrow) frames.
... 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 are visible by default, but you can customize the interface to see more columns by choosing which ones to show from the context menu that is opened by right-clicking in the table header.
... expanding each message selecting a message in the list shows a preview of the data being sent in that message, at the bottom of the response pane.
Performance Analysis - Firefox Developer Tools
the network monitor includes a performance analysis tool, to help show you how long the browser takes to download the different parts of your site.
...the tables group resources by type, and show the total size of each resource and the total time it took to load them.
... the accompanying pie chart shows the relative size of each resource type.
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
in the html pane in the html pane, an element laid out with flexbox has the word flex next to it as shown in the following image: click the word flex in the html pane to keep the overlay visible when you move the mouse away from the container.
... clicking the icon toggles the display of an overlay on the page, which appears over the selected flex container that displays an outline around each flex item: the overlay will still be shown when you select other elements from the inspector panel, so you can edit related css properties and see how the flex items are affected by your changes.
... if you click on the item, the display shifts to show details about that element: this view shows information about the calculations for the size of the selected flex item: a diagram visualizing the sizing of the flex item content size - the size of the component without any restraints imposed on it by its parent flexibility - how much a flex item grew or shrunk based on its flex-grow value when there is extra free space or its flex-shrink v...
Intensive JavaScript - Firefox Developer Tools
the bottom half, which is correlated with the timeline summary in time, shows frame rate.
...by switching to the flame chart view we can find out: this shows us the js call stack at this point in the execution.
...instead of a single solid orange block, each button-press shows up as a long sequence of very short orange blocks.
UI Tour - Firefox Developer Tools
for example, in the screenshot below a long-running paint operation (shown as a green bar in the waterfall overview) corresponds to a drop in the frame rate: zooming in you can use the overview to select a slice of the recording to examine in more detail.
...in the screenshot below we've selected that drop in the frame rate, and can see the long-running paint operation in more detail: details pane the details pane shows whichever tool is currently selected.
... the allocations view is like the call tree view, but for allocations: it shows you which functions in your page are allocating the most memory over the course of the profile.
Web Audio Editor - Firefox Developer Tools
if, instead, you've connected a node to an audioparam in another node, then the connection is shown as a dashed line between the nodes, and is labeled with the name of the audioparam: inspecting and modifying audionodes if you click on a node, it's highlighted and you get a node inspector on the right hand side.
... in the pane that shows you the node's details, there's an on/off button: click it, and the graph will be modified to bypass this node, so it will no longer have any effect.
... nodes that are bypassed are shown with a hatched background: ...
AbstractRange - Web APIs
ned on the way to the forum...</p> <aside class="callout"> <h2>aside</h2> <p>an interesting aside to share with you...</p> </aside> </section> </article> <pre id="log"></pre> </div> after loading the html and constructing the dom representation of the document, the resulting dom tree looks like this: in this diagram, the nodes representing html elements are shown in green.
... eah row beneath them shows the next layer of depth into the dom tree.
... blue nodes are text nodes, containing the text that gets shown onscreen.
Background Tasks API - Web APIs
the css is not shown, since it's not particularly crucial to understanding this functionality.
...issions...</div> <progress id="progress" value="0"></progress> <div class="button" id="startbutton"> start </div> <div class="label counter"> task <span id="currenttasknumber">0</span> of <span id="totaltaskcount">0</span> </div> </div> <div class="logbox"> <div class="logheader"> log </div> <div id="log"> </div> </div> the progress box uses a <progress> element to show the progress, along with a label with sections that are changed to present numeric information about the progress.
... progressbarelem is the <progress> element showing the percentage of the tasks processed so far.
Clients.openWindow() - Web APIs
if the calling script doesn't have permission to show popups, openwindow() will throw an invalidaccesserror.
... in firefox, the method is allowed to show popups only when called as the result of a notification click event.
... examples // send notification to os if applicable if (self.notification.permission === 'granted') { const notificationobject = { body: 'click here to view your messages.', data: { url: self.location.origin + '/some/path' }, // data: { url: 'http://example.com' }, }; self.registration.shownotification('you\'ve got messages!', notificationobject); } // notification click event listener self.addeventlistener('notificationclick', e => { // close the notification popout e.notification.close(); // get all the window clients e.waituntil(clients.matchall({ type: 'window' }).then(clientsarr => { // if a window tab matching the targeted url already exists, focus that; const...
EventTarget.addEventListener() - Web APIs
just add a getter for that option using code similar to what is shown above.
...this is shown in the following example: <script> function logid() { console.log(this.id); } </script> <table id="my_table" onclick="logid();"><!-- when called, `this` will refer to the global object --> ...
... you can override this behavior by explicitly setting the value of passive to false, as shown here: /* feature detection */ let passiveifsupported = false; try { window.addeventlistener("test", null, object.defineproperty( {}, "passive", { get: function() { passiveifsupported = { passive: false }; } } ) ); } catch(err) {} window.addeventlistener('scroll', function(event) { /* do something */ // can't use event.preventdefault(); }, passiv...
Ajax navigation example - Web APIs
"</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>first_page.php</strong>.</p> <div id="ajax-content"> <?php } ?> <p>this is the content of <strong>first_page.php</strong>.</p> <?php if ($as_json) { echo json_encode(array("page" => $page_title, "content" => ob_get_clean())); } else { ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>first_page.p...
..."</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>second_page.php</strong>.</p> <div id="ajax-content"> <?php } ?> <p>this is the content of <strong>second_page.php</strong>.</p> <?php if ($as_json) { echo json_encode(array("page" => $page_title, "content" => ob_get_clean())); } else { ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>second_pag...
..."</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p> <div id="ajax-content"> <?php echo $page_content; ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p> <?php include "include/after_content.php"; echo "</body>\n</html>"; } ?> css/style.css: #ajax-loader { position: fixed; display:...
Checking when a deadline is due - Web APIs
// update the display of data to show the newly added item, by running displaydata() again.
... displaydata(); }; last of all, we run the displaydata() function, which updates the display of data in the app to show the new task that was just entered.
...we want all the values to match before we show the user some kind of notification to tell them their deadline is up.
Using IndexedDB - Web APIs
the following table shows the different ways the keys are supplied: key path (keypath) key generator (autoincrement) description no no this object store can hold any kind of value, even primitive values like numbers and strings.
...if you're trying to modify an existing entry, or you don't care if one exists already, you can use the put() function, as shown below in the updating an entry in the database section.
... cursor.continue(); } }; if you just want to specify a change of direction but not constrain the results shown, you can just pass in null as the first argument: objectstore.opencursor(null, "prev").onsuccess = function(event) { var cursor = event.target.result; if (cursor) { // do something with the entries.
KeyboardEvent: code values - Web APIs
the following tables show what code values are used for each native scancode or virtual keycode on major platforms.
...these tables show those variations when known.
... code values code values on windows this table shows the windows scan codes representing keys and the keyboardevent.code values which correspond to those hardware keys.
Using the MediaStream Recording API - Web APIs
checkbox hack for showing/hiding this is fairly well documented already, but we thought we'd give a mention to the checkbox hack, which abuses the fact that you can click on the <label> of a checkbox to toggle it checked/unchecked.
... in web dictaphone this powers the information screen, which is shown/hidden by clicking the question mark icon in the top right hand corner.
... checkbox, because we don't want it cluttering up our ui: input[type=checkbox] { position: absolute; top: -100px; } next, we style the information screen (wrapped in an <aside> element) how we want it, give it fixed position so that it doesn't appear in the layout flow and affect the main ui, transform it to the position we want it to sit in by default, and give it a transition for smooth showing/hiding: aside { position: fixed; top: 0; left: 0; text-shadow: 1px 1px 1px black; width: 100%; height: 100%; transform: translatex(100%); transition: 0.6s all; background-color: #999; background-image: linear-gradient(to top right, rgba(0,0,0,0), rgba(0,0,0,0.5)); } last, we write a rule to say that when the checkbox is checked (when we click/focus the label), ...
Media Session API - Web APIs
the platform can show this metadata in media centers, notifications, device lockscreens, etc.
... examples the following example shows feature detection for the media session api.
... audio.play() .then(_ => { /* set up media session controls, as shown above.
NotificationAction - Web APIs
these buttons' appearance and specific functionality vary across platforms but generally they provide a way to asynchronously show actions to the user in a notification.
... here a service worker shows a notification with a single "archive" action, allowing users to perform this common task from the notification without having to open the website.
... self.registration.shownotification("new mail from alice", { actions: [ { action: 'archive', title: 'archive' } ] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'archive') { // archive action was clicked archiveemail(); } else { // main body of notification was clicked clients.openwindow('/inbox'); } }, false); specifications specification status comment notifications api living standard living standard ...
Page Visibility API - Web APIs
a site has an image carousel that shouldn't advance to the next slide unless the user is viewing the page an application showing a dashboard of information doesn't want to poll the server for updates when the page isn't visible a page wants to detect when it is being prerendered so it can keep accurate count of page views a site wants to switch off sounds when a device is in standby mode (user pushes power button to turn screen off) developers have historically used imperfect proxies to detect this.
... "visibilitychange"; } else if (typeof document.mshidden !== "undefined") { hidden = "mshidden"; visibilitychange = "msvisibilitychange"; } else if (typeof document.webkithidden !== "undefined") { hidden = "webkithidden"; visibilitychange = "webkitvisibilitychange"; } var videoelement = document.getelementbyid("videoelement"); // if the page is hidden, pause the video; // if the page is shown, play the video function handlevisibilitychange() { if (document[hidden]) { videoelement.pause(); } else { videoelement.play(); } } // warn if the browser doesn't support addeventlistener or the page visibility api if (typeof document.addeventlistener === "undefined" || hidden === undefined) { console.log("this demo requires a browser, such as google chrome or firefox, that supp...
... // this shows the paused videoelement.addeventlistener("pause", function(){ document.title = 'paused'; }, false); // when the video plays, set the title.
PaintWorklet - Web APIs
examples the following three examples go together to show creating, loading, and using a paintworklet.
... create a paintworklet the following shows an example worklet module.
... <script> if ('paintworklet' in css) { css.paintworklet.addmodule('checkerboard.js'); } </script> use a paintworklet this example shows how to use a paintworklet in a stylesheet, including the simplest way to provide a fallback if paintworklet isn't supported.
PaymentAddress - Web APIs
// call show() to trigger the browser's payment flow.
... const response = await request.show(); // process payment.
..."success" : "failure"; await response.complete(result); } dopaymentrequest(); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
PaymentRequest.prototype.id - Web APIs
WebAPIPaymentRequestid
example this example shows how to give a paymentrequest instance a custom id.
... const details = { id: "super-store-order-123-12312", total: { label: "total due", amount: { currency: "usd", value: "65.00" }, }, }; const request = new paymentrequest(methoddata, details); console.log(request.id); // super-store-order-123-12312 the id is then also available in the paymentresponse returned from the show() method, but under the requestid attribute.
... const response = await request.show(); console.log(response.requestid === request.id); // and in serialized form too const json = response.tojson(); console.log(json.requestid,response.requestid, request.id); syntax var id = paymentrequest.id value a domstring.
PaymentRequest.onpaymentmethodchange - Web APIs
to make sure you receive the event, you should add event listeners to paymentrequest object after instantiation, but before you call show().
... examples an example payment method change handler is shown below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "store": // do apple pay specific handling for store card...
... ev.updatewith(newstuff); }; const response = await request.show(); specifications specification status comment payment request apithe definition of 'onpaymentmethodchange' in that specification.
PaymentRequest - Web APIs
methods paymentrequest.canmakepayment() secure context indicates whether the paymentrequest object can make a payment before calling show().
... paymentrequest.show() secure context causes the user agent to begin the user interaction for the payment request.
... paymentrequest.abort() secure context causes the user agent to end the payment request and to remove any user interface that might be shown.
PaymentResponse.complete() - Web APIs
this method must be called after the user accepts the payment request and the promise returned by the paymentrequest.show() method is resolved.
... exceptions aborterror the document in which the payment request is taking place became inactive while the user interface was shown.
...var payment = new paymentrequest(supportedinstruments, details, options); payment.show().then(function(paymentresponse) { var fetchoptions = { method: 'post', credentials: include, body: json.stringify(paymentresponse) }; var serverpaymentrequest = new request('secure/payment/endpoint'); fetch(serverpaymentrequest, fetchoptions).then( response => { if (response.status < 400) { paymentresponse.complete("success"); } else { paymentresponse.comp...
Performance Timeline - Web APIs
performance interface extensions: as shown in the performance interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices.
... performanceentry: as shown in the performanceentry interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices.
... performance observers : as shown in the performanceobserver interface's browser compatibility table, this interface has no shipping implementations.
Using Pointer Events - Web APIs
</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).
...we're using a 4-pixel wide line, so a 4 pixel radius circle will show up neatly.
... function ongoingtouchindexbyid(idtofind) { for (var i = 0; i < ongoingtouches.length; i++) { var id = ongoingtouches[i].identifier; if (id == idtofind) { return i; } } return -1; // not found } showing what's going on function log(msg) { var p = document.getelementbyid('log'); p.innerhtml = msg + "\n" + p.innerhtml; } specifications specification status comment pointer events – level 2the definition of 'pointerevent' in that specification.
Using readable streams - Web APIs
as our simple stream pump example shows (see it live also), exposing it is a matter of just accessing the body property of the response: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) this provides us with a readablestream object.
... const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement('li'); listitem.textcontent = string; list1.appendchild(listitem); }, 1000); button.addeventlistener('click', function() { clearinterval(interval); readstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is c...
...current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } closing and cancelling streams we’ve already shown examples of using readablestreamdefaultcontroller.close() to close a reader.
Touch events - Web APIs
</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.
... after that, we iterate over all the touch objects in the list, pushing them onto an array of active touchpoints and drawing the start point for the draw as a small circle; we're using a 4-pixel wide line, so a 4-pixel radius circle will show up neatly.
... function ongoingtouchindexbyid(idtofind) { for (var i = 0; i < ongoingtouches.length; i++) { var id = ongoingtouches[i].identifier; if (id == idtofind) { return i; } } return -1; // not found } showing what's going on function log(msg) { var p = document.getelementbyid('log'); p.innerhtml = msg + "\n" + p.innerhtml; } if your browser supports it, you can see it live.
WebGL tutorial - Web APIs
animating objects with webgl shows how to rotate and translate objects to create simple animations.
... creating 3d objects using webgl shows how to create and animate a 3d object (in this case, a cube).
... animating textures in webgl shows how to animate textures; in this case, by mapping an ogg video onto the faces of a rotating cube.
WebGL model view projection - Web APIs
function cartesiantohomogeneous(point) let x = point[0]; let y = point[1]; let z = point[2]; return [x, y, z, 1]; } function homogeneoustocartesian(point) { let x = point[0]; let y = point[1]; let z = point[2]; let w = point[3]; return [x/w, y/w, z/w]; } as previously mentioned and shown in the functions above, the w component divides the x, y, and z components.
...the locations for the uniforms are saved in the locations object shown below: this.locations.model = gl.getuniformlocation(webglprogram, 'model'); and finally the uniform is set to that location.
...idth / window.innerheight; var nearclippingplanedistance = 1; var farclippingplanedistance = 50; this.transforms.projection = mdn.perspectivematrix( fieldofviewinradians, aspectratio, nearclippingplanedistance, farclippingplanedistance ); }; the shader code is identical to the previous example: gl_position = projection * model * vec4(position, 1.0); additionally (not shown), the position and scale matrices of the model have been changed to take it out of clip space and into the larger coordinate system.
Signaling and video calling - Web APIs
starting negotiation once the caller has created its rtcpeerconnection, created a media stream, and added its tracks to the connection as shown in starting a call, the browser will deliver a negotiationneeded event to the rtcpeerconnection to indicate that it's ready to begin negotiation with the other peer.
... ending the call the closevideocall() function, shown below, is responsible for stopping the streams, cleaning up, and disposing of the rtcpeerconnection object: function closevideocall() { var remotevideo = document.getelementbyid("received_video"); var localvideo = document.getelementbyid("local_video"); if (mypeerconnection) { mypeerconnection.ontrack = null; mypeerconnection.onremovetrack = null; mypeerconnection.onremovestr...
...open the web console on both devices and look at the logged output—although you don't see it in the code as shown above, the code on the server (and on github) has a lot of console output so you can see the signaling and connection processes at work.
Movement, orientation, and motion: A WebXR example - Web APIs
this example demonstrates this by showing the canvas on the screen, even when presenting a scene as an immersive display using an xr device.
... the last four variables declared are storage for references to the <div> elements into which we'll output the matrices when we want to show them to the user.
... drawing a frame our callback for xrsession.requestanimationframe() is implemented in the drawframe() function shown below.
Using the Web Speech API - Web APIs
demo to show simple usage of web speech recognition, we've written a demo called speech color changer.
...the foreach() method is used to output colored indicators showing what colors to try saying.
... demo to show simple usage of web speech synthesis, we've provided a demo called speak easy synthesis.
Using the aria-invalid attribute - Accessibility
examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event.
... the snippet below shows a very simple validation function, which only checks for the presence of a particular character (in the real world, validation will likely be more sophisticated): function checkvalidity(aid, asearchterm, amsg){ var elem = document.getelementbyid(aid); var invalid = (elem.value.indexof(asearchterm) < 0); if (invalid) { elem.setattribute("aria-invalid", "true"); update...
...alert(amsg); } else { elem.setattribute("aria-invalid", "false"); updatealert(); } } the snippet below shows the alert functions, which add (or remove) the error message: function updatealert(msg) { var oldalert = document.getelementbyid("alert"); if (oldalert) { document.body.removechild(oldalert); } if (msg) { var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var content = document.createtextnode(msg); newalert.appendchild(content); document.body.appendchild(newalert); } } note that the alert has the aria role attribute set to "alert." working examples: alert role example (uses the aria-invalid attribute) notes ...
ARIA: dialog role - Accessibility
this approach is shown in the code snippet below: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> keep in mind that a dialog's title and description text do not have to be focusable...
...in other words, the main application ui or page content is considered to be temporarily disabled as long as the modal dialog is showing.
... for non-modal dialogs it is still possible to interact with content outside of the dialog while the dialog is showing.
ARIA: heading role - Accessibility
examples the following shows a typical page structure.
... <div id="container"> <div role="heading" aria-level="1">the main page heading</div> <p>this article is about showing a page structure.</p> <div role="heading" aria-level="2">introduction</div> <p>an introductory text.</p> <div role="heading" aria-level="2">chapter 1</div> <p>text</p> <div role="heading" aria-level="3">chapter 1.1</div> <p>more text in a sub section.</p> ...</div> however, instead, you should do: <div id="container"> <h1>the main page heading</h1> <p>this article is about showing a page structure.</p> <h2>introduction</h2> <p>an introductory text.</p> <h2>chapter 1</h2> <p>text</p> <h3>chapter 1.1</h3> <p>more text in a sub section.</p> ...</div> accessibility concerns if you must use the heading role and aria-level attribute, do not go over level 6 so that you are consis...
... best practices the best way to use this role is to not use it at all, and instead use the native heading tags <h1> through <h6> as shown in the example above.
Operable - Accessibility
2.2.2 pausing, stopping, hiding (a) for moving/blinking content that starts automatically, lasts longer than 5 seconds, and is shown alongside other content, controls should be provided to pause, stop, or hide it.
... for auto-updating information that starts automatically and is shown alongside other content, controls should be provided to pause, stop, or hide it, or to control the frequency of updates.
... 2.4.7 visible focus for focusable elements (aa) when tabbing through focusable elements such as links or form inputs, there should be a visual indicator to show you which element currently has focus.
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
the following example shows blocks using horizontal-tb.
... the value vertical-rl gives you a right-to-left block flow direction with a vertical inline direction, as shown in the next example.
...this is shown in the next example where the box which displays as horizontal-tb contains a float which is contained due to its parent establishing a new bfc.
backface-visibility - CSS: Cascading Style Sheets
formal definition initial valuevisibleapplies totransformable elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax visible | hidden examples cube with transparent and opaque faces this example shows a cube with transparent faces, and one with opaque faces.
... html <table> <tr> <th><code>backface-visibility: visible;</code></th> <th><code>backface-visibility: hidden;</code></th> </tr> <tr> <td> <div class="container"> <div class="cube showbf"> <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</div> </div> </div> <p> since all faces are partially transparent, the back faces (2, 4, 5) are visible through the front faces (1, 3, 6).
... </p> </td> </tr> </table> css /* classes that will show or hide the three back faces of the "cube" */ .showbf div { backface-visibility: visible; } .hidebf div { backface-visibility: hidden; } /* define the container div, the cube div, and a generic face */ .container { width: 150px; height: 150px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; perspective: 550px; perspective-origin: 150% 150%; tr...
empty-cells - CSS: Cascading Style Sheets
syntax /* keyword values */ empty-cells: show; empty-cells: hide; /* global values */ empty-cells: inherit; empty-cells: initial; empty-cells: unset; the empty-cells property is specified as one of the keyword values listed below.
... values show borders and backgrounds are drawn like in normal cells.
... formal definition initial valueshowapplies totable-cell elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax show | hide example showing and hiding empty table cells html <table class="table_1"> <tr> <td>moe</td> <td>larry</td> </tr> <tr> <td>curly</td> <td></td> </tr> </table> <br> <table class="table_2"> <tr> <td>moe</td> <td>larry</td> </tr> <tr> <td>curly</td> <td></td> </tr> </table> css .table_1 { empty-cells: show; } .table_2 { empty-cells: hide; } td, th { border: 1px solid gray; padding: 0.5rem; } result specifications specification status comment css level 2 (revision 1)the definition of 'empty-cells' in that...
writing-mode - CSS: Cascading Style Sheets
formal definition initial valuehorizontal-tbapplies toall elements except table row groups, table column groups, table rows, and table columnsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr examples using multiple writing modes this example demonstrates all of the writing modes, showing each with text in various languages.
... html the html is a <table> with each writing mode in a row with a column showing text in various scripts using that writing mode.
...writing-mode: vertical-rl; -webkit-writing-mode: vertical-rl; -ms-writing-mode: vertical-rl; } .example.text4 span, .example.text4 { writing-mode: sideways-lr; -webkit-writing-mode: sideways-lr; -ms-writing-mode: sideways-lr; } .example.text5 span, .example.text5 { writing-mode: sideways-rl; -webkit-writing-mode: sideways-rl; -ms-writing-mode: sideways-rl; } result this image shows what the output should look like, in case your browser's support for writing-mode is incomplete: specifications specification status comment css writing modes level 4the definition of 'writing-mode' in that specification.
WAI ARIA Live Regions/API Support - Developer guides
atk/at-spi event iaccessible2 event object about to be hidden or removed children_changed::remove (fired on the parent, with event data pointing to the child index of the accessible object to be removed) event_object_hide* (fired on the actual accessible object about to go away) object shown or inserted children_changed::add (fired on the parent, with event data pointing to the child index of the inserted accessible object) event_object_show* (fired on the actual new accessible object) object replaced with different object (this happens especially if an object's interfaces or role changes) children_changed::remove followed immediately by children_change::add eve...
...nt_object_hide followed immediately by event_object_show text removed text_changed::delete ia2_event_text_removed (use iaccessibletext::get_oldtext to retrieve the offsets and removed text) text inserted text_changed::insert ia2_event_text_inserted (use iaccessibletext::get_newtext to retrieve the offsets and inserted text) text replaced text_changed::delete followed immediately by text_changed::insert ia2_event_text_removed followed immediately by ia2_event_text_inserted * we do not use msaa's create/destroy at the request of screen reader vendors, who avoid those events because they cause crashes on some important system -- show/hide are the equivalent of those events.
...this information is available only for event_show, event_hide, ia2_event_text_inserted and ia2_event_text_removed.
Adding captions and subtitles to HTML5 video - Developer guides
this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element.
...etattribute('data-state', 'inactive'); }); // find the language to activate var lang = this.getattribute('lang'); for (var i = 0; i < video.texttracks.length; i++) { // for the 'subtitles-off' button, the first condition will never match so all will subtitles be turned off if (video.texttracks[i].language == lang) { video.texttracks[i].mode = 'showing'; this.setattribute('data-state', 'active'); } else { video.texttracks[i].mode = 'hidden'; } } subtitlesmenu.style.display = 'none'; }); subtitlemenubuttons.push(button); return listitem; } this function builds the required <li> and <button> elements, and returns them so they can be added to the subtitles menu list.
...this is done by simply setting the required subtlte's mode attribute to showing, and setting the others to hidden.
Video player styling basics - Developer guides
html markup there are a few changes that were made to the html markup shown in the previous article.
... styling the resultant video player style used here is rather basic — this is intentional, as the purpose is to show how such a video player could be styled and be made responsive.
... control visibility the first change is simple: the data-state for showing the video controls when javascript is available to the browser now needs to be set: // display the user defined video controls videocontrols.setattribute('data-state', 'visible'); progress bar support a check also needs to be made to set up the "fake" progress bar if the browser doesn't support the <progress> element: var supportsprogress = (document.createelement('progress').max !== undef...
Audio and video manipulation - Developer guides
in this case, we'll show both the source video and the output greyscale frames.
... ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames.
...(var i = 0; i < l; i++) { var grey = (frame.data[i * 4 + 0] + frame.data[i * 4 + 1] + frame.data[i * 4 + 2]) / 3; frame.data[i * 4 + 0] = grey; frame.data[i * 4 + 1] = grey; frame.data[i * 4 + 2] = grey; } this.ctx1.putimagedata(frame, 0, 0); return; } }; once the page has loaded you can call processor.doload() result this is a pretty simple example showing how to manipulate video frames using a canvas.
Making content editable - Developer guides
you can enable them by setting the preferences shown below using about:config: user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.sites", "https://www.mozilla.org"); user_pref("capability.policy.allowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <h...
...eftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextnode(odoc.innerhtml); odoc.innerhtml = ""; var opre = document.createelement("pre"); odoc.contenteditable = false; opre.id = "sourcetext"; opre.contenteditable = true; opre.appendchild(ocontent); odoc.appendchild(opre); ...
...meakqubgsuspvbsyfjjvds6njlb0khr4akbcmfscgbqaocwjf5gwquvyksfbwze+awibv0ghfog2ewidchjwriqo9e2fx4xd5r+b0ddaenbxbhbhn2dgwdaqfjjyvhcqyrfgoidgiqjawtcqmriwwmfgicnvcaaamoak+blaortluyt7i5uiuhads=" /> </div> <div id="textbox" contenteditable="true"><p>lorem ipsum</p></div> <p id="editmode"><input type="checkbox" name="switchmode" id="switchbox" onchange="setdocmode(this.checked);" /> <label for="switchbox">show html</label></p> <p><input type="submit" value="send" /></p> </form> </body> </html> note: if you want to see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example.
HTML attribute: pattern - HTML: Hypertext Markup Language
some browsers show a tooltip with title contents, improving usability for sighted users.
...some browsers show a tooltip when an element with a title is hovered, but that leaves out keyboard-only and touch-only users.
... while titles are used by some browsers to populate error messaging, because browsers sometimes also show the title as text on hover, it therefore shows in non-error situations, so be careful not to word titles as if an error has occurred.
HTML attribute reference - HTML: Hypertext Markup Language
controls <audio>, <video> indicates whether the browser should show playback controls to the user.
... open <details> indicates whether the details will be shown on page load.
... poster <video> a url indicating a poster frame to show until the user plays or seeks.
<dialog>: The Dialog element - HTML: Hypertext Markup Language
WebHTMLElementdialog
when the open attribute is not set, the dialog shouldn't be shown to the user.
... the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal().
...atebutton = document.getelementbyid('updatedetails'); var favdialog = document.getelementbyid('favdialog'); var outputbox = document.queryselector('output'); var selectel = document.queryselector('select'); var confirmbtn = document.getelementbyid('confirmbtn'); // "update details" button opens the <dialog> modally updatebutton.addeventlistener('click', function onopen() { if (typeof favdialog.showmodal === "function") { favdialog.showmodal(); } else { alert("the <dialog> api is not supported by this browser"); } }); // "favorite animal" input sets the value of the submit button selectel.addeventlistener('change', function onselect(e) { confirmbtn.value = selectel.value; }); // "confirm" button of form triggers "close" on dialog because of [method="dialog"] favdialog.addeventl...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
WebHTMLElementfieldset
as the example above shows, the <fieldset> element provides a grouping for a part of an html form, with a nested <legend> element providing a caption for the <fieldset>.
... examples simple fieldset this example shows a really simple <fieldset> example, with a <legend>, and a single control inside it.
... <form action="#"> <fieldset> <legend>simple fieldset</legend> <input type="radio" id="radio"> <label for="radio">spirit of radio</label> </fieldset> </form> disabled fieldset this example shows a disabled <fieldset> with two controls inside it.
<hgroup> - HTML: Hypertext Markup Language
WebHTMLElementhgroup
there are a variety of ways an <hgroup> might be shown in a rendered outline; for example: an <hgroup> might be shown in a rendered outline in with a colon character and space (“: ”) or other such punctuation after the primary heading and before the first secondary heading (and with the same or similar punctuation before any other secondary headings an <hgroup> might be shown in a rendered outline in with the primary heading followed by pare...
...<body> <hgroup id="document-title"> <h1>html</h1> <h2>living standard — last updated 12 august 2016</h2> </hgroup> <p>some intro to the document.</p> <h2>table of contents</h2> <ol id=toc>...</ol> <h2>first section</h2> <p>some intro to the first section.</p> </body> a rendered outline for that document might look like the following: that is, the rendered outline might show the primary title, html, followed by a colon and space, followed by the secondary title, living standard — last updated 12 august 2016.
... or, the rendered outline for that document might instead look like the following: that is, the rendered outline might show the primary title, html, followed by the secondary title shown in parentheses: (living standard — last updated 12 august 2016).
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
WebHTMLElementiframe
allow-popups: allows popups (such as window.open(), target="_blank", or showmodaldialog()).
... yes: always show a scrollbar.
... no: never show a scrollbar.
<input type="tel"> - HTML: Hypertext Markup Language
WebHTMLElementinputtel
then, as the user types, the list is adjusted to show only filtered matching values.
... each input has a placeholder attribute to show a hint to sighted users about what to enter into it, a pattern to enforce a specific number of characters for the desired section, and an aria-label attribute to contain a hint to be read out to screenreader users about what to enter into it.
...; inputelems[1].placeholder = "first part"; inputelems[1].pattern = "[0-9]{2,4}"; inputelems[1].setattribute("aria-label","first part of number"); inputelems[2].placeholder = "second part"; inputelems[2].pattern = "[0-9]{4}"; inputelems[2].setattribute("aria-label","second part of number"); } } the example looks like this: this is an interesting idea, which goes to show a potential solution to the problem of dealing with international phone numbers.
<input type="week"> - HTML: Hypertext Markup Language
WebHTMLElementinputweek
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
...if <input type="week"> is not supported, we hide the native picker and show the fallback picker ui (<select>s) instead.
...ide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'week'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the weeks dynamically populateweeks(); } function populateweeks() { // populate the week select with 52 weeks for(var i = 1; i <= 52; i++) { var option = document.createelement('option'); option.textcontent = (i < 10) ?
<tbody>: The Table Body element - HTML: Hypertext Markup Language
WebHTMLElementtbody
examples below are some examples showing the use of the <tbody> element.
... html the table's html is shown here.
...th> </tr> </thead> <tbody> <tr> <td>3741255</td> <td>jones, martha</td> <td>computer science</td> </tr> <tr> <td>3971244</td> <td>nim, victor</td> <td>russian literature</td> </tr> <tr> <td>4100332</td> <td>petrov, alexandra</td> <td>astrophysics</td> </tr> </tbody> </table> css the css to style our table is shown next.
HTML elements reference - HTML: Hypertext Markup Language
WebHTMLElement
<title> the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab.
...ruby annotations are for showing pronunciation of east asian characters.
... <progress> the html <progress> element displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
Cross-Origin Resource Sharing (CORS) - HTTP
WebHTTPCORS
he server responds: get /resources/public-data/ http/1.1 host: bar.other user-agent: mozilla/5.0 (macintosh; intel mac os x 10.14; rv:71.0) gecko/20100101 firefox/71.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip,deflate connection: keep-alive origin: https://foo.example the request header of note is origin, which shows that the invocation is coming from https://foo.example.
...the use of the origin header and of access-control-allow-origin show the access control protocol in its simplest use.
...content on foo.example might contain javascript like this: const invocation = new xmlhttprequest(); const url = 'http://bar.other/resources/credentialed-content/'; function callotherdomain() { if (invocation) { invocation.open('get', url, true); invocation.withcredentials = true; invocation.onreadystatechange = handler; invocation.send(); } } line 7 shows the flag on xmlhttprequest that has to be set in order to make the invocation with cookies, namely the withcredentials boolean value.
HTTP Index - HTTP
WebHTTPIndex
this page shows an introduction to the http framework for authentication and shows how to restrict access to your server using the http "basic" schema.
... 134 feature-policy: layout-animations directive, feature-policy, http, reference, layout-animations the http feature-policy header layout-animations directive controls whether the current document is allowed to show layout animations.
... 263 502 bad gateway http, server error, status code the information shown below has been pulled from mdn's github (https://github.com/mdn/browser-compat-data).
A re-introduction to JavaScript (JS tutorial) - JavaScript
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.
...you can use named iifes (immediately invoked function expressions) as shown below: var charsinbody = (function counter(elm) { if (elm.nodetype == 3) { // text_node return elm.nodevalue.length; } var count = 0; for (var i = 0, child; child = elm.childnodes[i]; i++) { count += counter(child); } return count; })(document.body); the name provided to a function expression as above is only available to the function's own scope.
...the name also shows up in the debugger and some stack traces, which can save you time when debugging.
Regular expressions - JavaScript
(see different behaviors for further info about the different behaviors.) if you want to construct the regular expression from a string, yet another alternative is this script: var myre = new regexp('d(b+)d', 'g'); var myarray = myre.exec('cdbbdbsbz'); with these scripts, the match succeeds and returns the array and updates the properties shown in the following table.
... 'd(b+)d' as shown in the second form of this example, you can use a regular expression created with an object initializer without assigning it to a variable.
...if the number is valid (matches the character sequence specified by the regular expression), the script shows a message thanking the user and confirming the number.
Working with objects - JavaScript
to illustrate how this works, the following function displays the properties of the object when you pass the object and the object's name as arguments to the function: function showprops(obj, objname) { var result = ``; for (var i in obj) { // obj.hasownproperty() is used to filter out properties from the object's prototype chain if (obj.hasownproperty(i)) { result += `${objname}.${i} = ${obj[i]}\n`; } } return result; } so, the function call showprops(mycar, "mycar") would return the following: mycar.make = ford mycar.model = mustang mycar.year ...
...as shown below.
...the following code shows how to remove a property.
Inheritance and the prototype chain - JavaScript
an inherited function acts just as any other property, including property shadowing as shown above (in this case, a form of method overriding).
...tructor: ƒ dosomething(), __proto__: { constructor: ƒ object(), hasownproperty: ƒ hasownproperty(), isprototypeof: ƒ isprototypeof(), propertyisenumerable: ƒ propertyisenumerable(), tolocalestring: ƒ tolocalestring(), tostring: ƒ tostring(), valueof: ƒ valueof() } } we can add properties to the prototype of dosomething(), as shown below.
...ect.create and new operator using object.create of another object demonstrates prototypical inheritance with the delete operation: var a = {a: 1}; var b = object.create(a); console.log(a.a); // print 1 console.log(b.a); // print 1 b.a=5; console.log(a.a); // print 1 console.log(b.a); // print 5 delete b.a; console.log(a.a); // print 1 console.log(b.a); // print 1(b.a value 5 is deleted but it showing value from its prototype chain) delete a.a; console.log(a.a); // print undefined console.log(b.a); // print undefined the new operator has a shorter chain in this example: function graph() { this.vertices = [4,4]; } var g = new graph(); console.log(g.vertices); // print [4,4] g.vertices = 25; console.log(g.vertices); // print 25 delete g.vertices; console.log(g.vertices); // print undefin...
Functions - JavaScript
however, object references are values, too, and they are special: if the function changes the referred object's properties, that change is visible outside the function, as shown in the following example: /* declare the function 'myfunc' */ function myfunc(theobject) { theobject.brand = "toyota"; } /* * declare variable 'mycar'; * create and initialize a new object; * assign reference to it to 'mycar' */ var mycar = { brand: "honda", model: "accord", year: 1998 }; /* logs 'honda' */ console.log(mycar.brand); /* pass object reference to the function */ myf...
... as the 4th example shows, the function name can be different from the variable the function is assigned to.
...however, in the spidermonkey javascript engine, the serialized form of the function shows as if it has the name "anonymous".
Object.prototype.constructor - JavaScript
function tree(name) { this.name = name } let thetree = new tree('redwood') console.log('thetree.constructor is ' + thetree.constructor) this example displays the following output: thetree.constructor is function tree(name) { this.name = name } changing the constructor of an object the following example shows how to modify the constructor value of generic objects.
... this example shows that it is not always safe to rely on the constructor property of an object.
...*/ } function createdconstructor() { parent.call(this) } createdconstructor.prototype = object.create(parent.prototype) createdconstructor.prototype.create = function create() { return new this.constructor() } new createdconstructor().create().create() // typeerror undefined is not a function since constructor === parent in the example above the exception will be shown since the constructor links to parent.
Web video codec guide - Web media technologies
as a result, the video's contents show a "layered" look, where instead of smooth gradients and transitions, the transitions from color to color are abrupt, causing strips of color to appear.
... the photo above shows mosquito noise in a number of places, including in the sky surrounding the bridge.
... in the upper-right corner, an inset shows a close-up of a portion of the image that exhibits mosquito noise.
Progressive web apps (PWAs)
core pwa guides the following guides show you what need to do to implement a pwa, by examining a simple example and showing you how all the pieces work.
... introduction to progressive web apps progressive web app structure making pwas work offline with service workers how to make pwas installable how to make pwas re-engageable using notifications and push progressive loading technology guides client-side storage — a lengthy guide showing how and when to use web storage, indexeddb, and service workers.
... the service worker cookbook — a series of excellent service worker/push recipes, showing how to implement an offline app, but also much more.
SVG Attribute reference - SVG: Scalable Vector Graphics
WebSVGAttribute
on underline-thickness unicode unicode-bidi unicode-range units-per-em v v-alphabetic v-hanging v-ideographic v-mathematical values vector-effect version vert-adv-y vert-origin-x vert-origin-y viewbox viewtarget visibility w width widths word-spacing writing-mode x x x-height x1 x2 xchannelselector xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space y y y1 y2 ychannelselector z z zoomandpan svg attributes by category generic attributes core attributes id, lang, tabindex, xml:base, xml:lang, xml:space style attributes class, style conditional processing attributes externalresourcesrequired, requiredextensions, requiredfeatures, systemlanguage.
... xlink attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate presentation attributes note that all svg presentation attributes can be used as css properties.
...dragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting graphical event attributes onactivate, onfocusin, onfocusout ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
erted that is already in another list implementation status unknown crossorigin attribute for <image> and <script> elements not implemented yet (at least for <image>; bug 1240357) rendering model change notes svg root and <foreignobject> not overflow:hidden in ua style sheet implementation status unknown allow overflow: auto; to clip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements implementation status unknown basic data types and interfaces change notes dommatrix or dommatrixreadonly instead of svgmatrix implementation status unknown domrect or domrectreadonly instead of svgrect implementation status unknown...
...status unknown mutation events removed implementation status unknown svgzoomevent removed implementation status unknown <cursor> element deprecated implementation status unknown linking change notes link svg resources with fragment identifiers implementation status unknown xlink:type, xlink:role, xlink:arcrole, xlink:show, and xlink:actuate attributes removed implementation status unknown xlink:href attribute deprecated in favor of href implemented (bug 1245751) xlink:title attribute deprecated in favor of child <title> implementation status unknown spaces in svg view fragments implementation status unknown pixel: and percent: spatial media fragments implementatio...
...n status unknown linking to <view> elements does not cause implicit box transformation to show nearest ancestor <svg> element implementation status unknown unspecified svg view fragment parameters don't cause corresponding attributes to be reset to initial values implementation status unknown viewtarget attribute of <view> and corresponding svg view fragment parameter removed implementation status unknown fragment-only urls are always same-document implementation status unknown additional attributes on <a> implemented (bug 1451823) scripting change notes contentscripttype removed implementation status unknown animationevents.onload removed implementation status unknown fonts ...
Web Components
tutorials using custom elements a guide showing how to use the features of custom elements to create simple web components, as well as looking into lifecycle callbacks and some other more advanced features.
... using shadow dom a guide that looks at shadow dom fundamentals, showing how to attach a shadow dom to an element, add to the shadow dom tree, style it, and more.
... using templates and slots a guide showing how to define a reusable html structure using <template> and <slot> elements, and then use that structure inside your web components.
Cross-domain Content Scripts - Archive of obsolete content
the "main.js": creates a panel whose content is supplied by "panel.html" and adds a content script "panel-script.js" to it sends the panel a "show" message when it is shown adds a button which shows the panel when it is clicked // main.js var data = require("sdk/self").data; var forecast_panel = require("sdk/panel").panel({ height: 50, contenturl: data.url("panel.html"), contentscriptfile: data.url("panel-script.js") }); forecast_panel.on("show", function(){ forecast_panel.port.emit("show"); }); require("sdk/ui/button/action")...
....actionbutton({ id: "get-forecast", label: "get the forecast", icon: "./icon-16.png", onclick: function() { forecast_panel.show(); } }); the "panel.html" just includes a <div> block for the forecast: <!doctype html> <!-- panel.html --> <html> <head></head> <body> <div id="forecast_summary"></div> </body> </html> the "panel-script.js" uses xmlhttprequest to fetch the latest forecast: // panel-script.js var url = "http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/json/500?key=your-api-key"; self.port.on("show", function () { var request = new xmlhttprequest(); request.open("get", url, true); request.onload = function () { var jsonresponse = json.parse(request.responsetext); var summary = getsummary(jsonresponse); var eleme...
Interacting with page scripts - Archive of obsolete content
expose objects to page scripts until firefox 30, you could use unsafewindow to perform the reverse procedure, and make objects defined in content scripts available to page scripts: // content-script.js unsafewindow.contentscriptobject = {"greeting" : "hello from add-on"}; // page-script.js var button = document.getelementbyid("show-content-script-var"); button.addeventlistener("click", function() { // access object defined by content script console.log(window.contentscriptobject.greeting); // "hello from add-on" }, false); after firefox 30, you can still do this for primitive values, but can no longer do it for objects.
... before firefox 30 here's an example showing how to use custom dom events to send a message from a content script to a page script, before firefox 30.
Communicating using "port" - Archive of obsolete content
so to receive messages from a content script associated with a panel you use panel.port.on(): var panel = require("sdk/panel").panel({ contentscript: "self.port.emit('showing', 'panel is showing');" }); panel.port.on("showing", function(text) { console.log(text); }); panel.show(); conversely, to emit user-defined messages from your add-on you can just call panel.port.emit(): var panel = require("sdk/panel").panel({ contentscript: "self.port.on('alert', function(text) {" + " console.log(text);" + "});" }); panel.show(); p...
...anel.port.emit("alert", "panel is showing"); the panel and page-worker objects only host a single page at a time, so each distinct page object only needs a single channel of communication to its content scripts.
Porting the Library Detector - Archive of obsolete content
implementing the user interface showing the library array the widget module is a natural fit for displaying the library list.
...ibraries = []; } widgetview.content = buildwidgetviewcontent(tab.libraries); widgetview.width = tab.libraries.length * icon_width; } main.js will use the tabs module to update the widget's content when necessary (for example, when the user switches between tabs): tabs.on('activate', function(tab) { updatewidgetview(tab); }); tabs.on('ready', function(tab) { tab.libraries = []; }); showing the library detail the xul library detector displayed the detailed information about each library on mouseover in a tooltip: we can't do this using a widget, so instead will use a panel.
hotkeys - Archive of obsolete content
for example, this add-on defines two hotkey combinations, to show and hide a panel: // define keyboard shortcuts for showing and hiding a custom panel.
... var { hotkey } = require("sdk/hotkeys"); var showhotkey = hotkey({ combo: "accel-shift-o", onpress: function() { showmypanel(); } }); var hidehotkey = hotkey({ combo: "accel-alt-shift-o", onpress: function() { hidemypanel(); } }); choosing hotkeys hotkeys should be chosen with care.
self - Archive of obsolete content
the url can be passed to a content frame constructor, such as the panel: var self = require("sdk/self"); var mypanel = require("sdk/panel").panel({ contenturl: self.data.url("myfile.html") }); mypanel.show(); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html").
... so you can rewrite the above code like this: var mypanel = require("sdk/panel").panel({ contenturl: "./myfile.html" }); mypanel.show(); parameters name : string the filename to be read, relative to the package's data directory.
core/promise - Archive of obsolete content
or) callback(error); else combine(b, c, callback); }); } this style also makes doing things in sequence hard: widget.on('click', function onclick() { promptuserfortwitterhandle(function continuewith(error, handle) { if (error) return ui.displayerror(error); twitter.gettweetsfor(handle, funtion continuewith(error, tweets) { if (error) return ui.displayerror(error); ui.showtweets(tweets); }); }); }); doing things in parallel is even harder: var tweets, answers, checkins; twitter.gettweetsfor(user, function continuewith(result) { tweets = result; somethingfinished(); }); stackoverflow.getanswersfor(question, function continuewith(result) { answers = result; somethingfinished(); }); foursquare.getcheckinsby(user, function continuewith(result) { che...
...ckins=result; somethingfinished(); }); var finished = 0; function somethingfinished() { if (++finished === 3) ui.show(tweets, answers, checkins); } this also makes error handling quite an adventure.
Creating Event Targets - Archive of obsolete content
for example, you can listen to the tabs module's ready event or the panel object's show event.
...for example, you can listen to the panel object's show event either by calling: mypanel.on("show", listenerfunction); or by passing the onshow option to panel's constructor: var mypanel = require("sdk/panel").panel({ onshow: listenerfunction, contenturl: "https://en.wikipedia.org/w/index.php" }); if your class inherits from eventtarget, options like this are automatically handled for you.
Getting Started (jpm) - Archive of obsolete content
once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it.
...after installation they'll show up disabled in the list of installed add-ons, noting the missing signature.
Using third-party modules (jpm) - Archive of obsolete content
to show the menu bar, click on the open menu icon and select "customize".
... then, under show / hide toolbars, enable the menu bar.
File I/O - Archive of obsolete content
an example below shows how you should save a path in user prefs.
... storing nsifile in preferences the following two snippets show the right way to store a file path in user preferences (more about preferences in mozilla): absolute path (nsifile) to store an arbitrary path in user preferences, use this code: // |file| is nsilocalfile.
Sidebar - Archive of obsolete content
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.
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
this can be a guid, but the format shown above is prettier and, let's face it, a lot easier to remember.
...here's an example, showing just the advanced/ subbranch of the myextension/ directory: advanced/ build/ intricate/ public/ src/ multifarious/ public/ src/ content/ locale/ en-us/ ...other locales.../ skin/ classic/ ...other skins.../ as you can see, we've split advanced/ into two submodules: intricate/ and multifarious/...
Enhanced Extension Installation - Archive of obsolete content
if an extension is installed at two different install locations, the one with the higher importance is what is shown in this file.
... extension authors installing into restricted install locations can specify that their item does not show up in the extensions ui by using the <em:hidden>true<em:hidden> property in their install manifests.
Installing Extensions and Themes From Web Pages - Archive of obsolete content
the href attribute contains a direct link to the extension xpi file, this is what will show in the location bar when the link is moused over.
...well, xpi is a mozilla-specific extension and so we can have special handling for it, but jar is not - not all .jar files are firefox themes, so if you click on a .jar link you'll be shown the save as decision dialog.
Interaction between privileged and non-privileged pages - Archive of obsolete content
l name characters only): "it is also strongly recommended that third parties adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events.") in the case where your extension's overlay does not interact directly with browser.xul, such as in a sidebar, it might be easier to add the event listener to the top-level document directly as shown below (also see: accessing the elements of the top-level document from a child window).
...we need a new event trigger in the web page and some code to show the event message actually arrived.
Observer Notifications - Archive of obsolete content
this example code shows you what an implementation of the nsiobserver interface looks like: let testobserver = { observe : function(asubject, atopic, adata) { if (atopic == "xulschoolhello-test-topic") { window.alert("data received: " + adata); } } } in order for this observer to work, you need to use the observer service that provides methods for you to add, remove, notify and enumerate observe...
...if there are 2 firefox windows open, the observer will be notified in both and the alerts will show up on both.
The Box Model - Archive of obsolete content
most of the examples shown in the rest of this section were generated using the xul box alignment example.
...if the line of text is longer than its container will allow, the text will be cut, showing "..." in the place where it was cut.
XPCOM Objects - Archive of obsolete content
it shows the relationships between components and interfaces, but it's more of a source browser than a documentation reference.
...keeps track of how many times the * hello world message has been shown.
Setting up an extension development environment - Archive of obsolete content
maxversion needs to be set in install.rdf javascript.options.showinconsole = true.
...with this, javascript.options.showinconsole is also set to true by default.
Tabbed browser - Archive of obsolete content
d, false); // when no longer needed container.removeeventlistener("tabattrmodified", exampletabattrmodified, false); notification when a tab is pinned or unpinned requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) starting in gecko 2.0, tabs can be "pinned"; that is, they become special application tabs ("app tabs"), which are pinned to the beginning of the tab bar, and show only the favicon.
...allbacks) return null; var domwin = notificationcallbacks.getinterface(components.interfaces.nsidomwindow); return gbrowser.getbrowserfordocument(domwin.top.document); } catch (e) { dump(e + "\n"); return null; } } getting the browser that fires the http-on-modify-request notification (example code updated for loadcontext) here an example of the previous section is shown.
Source Navigator - Archive of obsolete content
this shows the "auto-create project" dialog: which allows you to decide your filename of the project file (which ends in .proj) and your source directory/directories that you want to import into the project.
... this shows the "source-navigator projects" dialog.
Using XML Data Islands in Mozilla - Archive of obsolete content
ame> <price>2.48</price> </lineitem> </purchaseorder> </script> the xml source text can then be retrieved like this: var ordersource = document.getelementbyid("purchase-order").textcontent; the xml source text can be parsed into a dom tree using the domparser api: var parser = new domparser(); var doc = parser.parsefromstring(ordersource, "application/xml"); the html5 data block-based way shown here works in firefox, opera, webkit-based browsers such as chrome and safari, and ie9 while ie's xml data islands work only in ie.
...the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> demo did not run </body> </html> the xml source text can be parsed into a dom tree using the domparser api: var parser = new domparser(); var doc = parser.parsefromstring(ordersource, "application/xml"); the html5 data block-based way shown here works in firefox, opera, webkit-based browsers such as chrome and safari, and ie9 while ie's xml data islands work only in ie.
Making it into a static overlay - Archive of obsolete content
now that we have a working mozilla extension that shows tinderbox status, we need to make it distributable to other users.
...when navigator.xul is rendering into the browser's application interface, this causes any attributes or child elements of the statusbar element in the overlay file to be added to the interface's dom and thus show up in the interface as if they were defined on the same element in navigator.xul.
Using microformats - Archive of obsolete content
showhidden if true, hidden microformats are added; otherwise they're left out.
... showhidden if true, hidden microformats are added; otherwise they're left out.
Creating a Help Content Pack - Archive of obsolete content
nc:emptysearchtext specifies the text that is shown when a search through help returns no results.
... nc:emptysearchlink specifies what uri should be shown when the pseudo-result "no results found" is accessed.
Hidden prefs - Archive of obsolete content
mail composition "other header" pref ("mail.compose.other.header") the format for this a comma delimited list of mail headers, like "approved,x-no-archive" an example for your prefs.js would be: user_pref("mail.compose.other.header", "approved"); this will cause "approved" to show up in the compose window address picker, under to:, cc:, bcc:, newsgroup:, etc.
...| mail & newsgroups | addressing" "other compose header" pref from mailnews.js: // you can specify a comma delimited list of optional headers // this will show up in the address picker in the compose window // examples: "x-face" or "approved" pref("mail.compose.other.header", "approved,x-no-archive"); ...
Basics - Archive of obsolete content
methods show(titlestringbodystringiconstring)draws a notification box.
... titlethe head of the notification message.string bodythe messagestringfalse iconthe url of an .ico file.string jetpack.notifications.show("hello world");var mybody = " my first message body on jetpack";var myicon = "http://www.mozilla.com/favicon.ico";jetpack.notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); class tabs in this class you can find information about the tabs in your firefox window.
Notifications - Archive of obsolete content
methods show(titlestring, [body as string] iconstring)draws a notification box.
... titlethe head of the notification message.string bodythe message itself.stringfalse iconthe url of an .ico file.string jetpack.notifications.show("hello world"); var mybody = " my first message body on jetpack"; var myicon = "http://www.mozilla.com/favicon.ico"; jetpack.notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); ...
How to Write and Land Nanojit Patches - Archive of obsolete content
repository: http://hg.mozilla.org/projects/nanojit-central (or clone ssh://hg.mozilla.org/projects/nanojit-central if you want to actually commit changes) tinderbox: http://tinderbox.mozilla.org/showbuilds.cgi?tree=nanojit commit log: http://hg.mozilla.org/projects/nanojit-central/shortlog/ irc channel: irc.mozilla.org #nanojit procedure the first thing to understand is that there are now three copies of nanojit in public mozilla.com repositories: one in nanojit-central, one in tracemonkey, one in tamarin-redux.
... see https://bugzilla.mozilla.org/show_bug.cgi?id=529900 for an example.
Supporting private browsing mode - Archive of obsolete content
simply instantiate the helper, then you can use its inprivatebrowsing flag to detect whether or not private browsing is currently enabled, as shown here: var listener = new privatebrowsinglistener(); if (listener.inprivatebrowsing) { // we are in private browsing mode!
...} in addition, you can install watcher functions to be called when private browsing turns on and off, as shown in the following example.
Table Cellmap - Archive of obsolete content
0x00020000 // the col span is 0 #define overlap 0x00040000 // there is a row span and col span but no by same cell #define col_span_offset 0xfff80000 // the col offset to the data containing the original cell #define row_span_shift 3 // num bits to shift to get right justified row span #define col_span_shift 19 // num bits to shift to get right justified col span showing that there is a span, this span is a colspan and the colspan origin is one cell away.
... this shows that the maximum handled row- or colspan value for a cell is 0xfff8 >> 3 = 8191.
Table Layout Strategy - Archive of obsolete content
the functionality is distributed over a large number of subroutines as shown in the chart below.
... special cases note: the following examples are not shown correctly due to technical constraints on wiki content.
Running Tamarin performance tests - Archive of obsolete content
results from the two shells will be shown side to side and the percent speedup will be shown.
... --notime do not generate timestamps (cleaner diffs) -f --forcerebuild force rebuild all test files -c --config sets the config string [default os-tvm] -q --quiet display minimum output during testrun -l --log also log all output to given logfile --summaryonly only display final summary --rebuildtests rebuild the tests only - do not run against vm --showtimes shows the time for each test --ascargs args to pass to asc on rebuild of test files --vmargs args to pass to vm --timeout max time to run all tests --testtimeout max time to let a test run, in sec (default -1 = never timeout) --html also create an html output file --notimecheck do not recompile .abc if timestamp is older than .as ...
Tamarin build documentation - Archive of obsolete content
preparing your eclipse workspace and perspective open the c/c++ perspective open the 'c/c++ projects' view (window >> show view >> c/c++ projects) add view filter 'non-c elements' (in the top-right of the 'c/c++ projects' view, click the down-arrow, click 'filters...', check 'non-c elements') increase the threshold for 'editor scalability mode' to 20000 lines.
... $ java -jar lib/asc.jar # shows usage you may also download the latest asc.jar from ftp://ftp.mozilla.org/pub/js/tamarin...latest/asc.jar .
Tamarin Build System Documentation - Archive of obsolete content
the page is divided into the phase table at the top and the waterfall table below the phase table shows all phases at the top of the page, each slave is shown as a box with a red,green, or yellow color: red means failed, green passed, and yellow has warnings.
...compile, smoke, or test to show the build slaves from the most recent phase run or click on an individual box to display the test result below the phase table the waterfall displays each buildstep and result the left side contains the time column and the user/revision link to represent the revision triggering a build, mouse over the user to see the revision and submission notes each buildstep run on a slave is a box with color indicating status, red is failed, green passed, yellow has warnings click the stdio link to see the output click on the build yellow box at the bottom of a set of buildsteps to see the result of all of the buildsteps for a build and the time each buildstep took scroll down to see previous builds triggered at...
Using gdb on wimpy computers - Archive of obsolete content
type "show copying" to see the conditions.
...type "show warranty" for details.
Venkman Internals - Archive of obsolete content
this method is set into jsdiscripthook.onscriptcreated venkman-views.js views are the panels shown within the venkman window.
... for example, the "open windows" view shows the browser's windows.
confirm - Archive of obsolete content
the following examples show the result of calling confirm() with three buttons 0='a', 1='b' and 2='c'.
... acheckstate an object with a boolean value property representing the state of the checkbox: when the dialog box is shown, its checkbox will be checked when this object's value is true.
Properties - Archive of obsolete content
parts of this page show the use of the xpinstall api.
...note, even if triggered using relative urls this will show the full url (after qualification).
Learn XPI Installer Scripting by Example - Archive of obsolete content
parts of this page show the use of the xpinstall api.
... var xpisrc = "cd_ripper.exe"; var xpidoc = "readme_cdrip"; initinstall("my cd ripper", "cdrip", "1.0.1.7"); f = getfolder("program"); setpackagefolder(f); addfile(xpisrc); addfile(xpidoc); if (0 == getlasterror()) performinstall(); else cancelinstall(); the example above shows this minimal installation.
XTech 2005 Presentations - Archive of obsolete content
another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other.
... directions of the mozilla rdf engine: website scripting, standards conformance and perfomance - axel hecht this presentation showed new developments in the mozilla rdf engine.
panel.level - Archive of obsolete content
top the panel is shown in front of all other normal windows, including those of other applications.
... parent the panel is shown just above the window the panel is in, but behind other windows above it.
Attribute (XUL) - Archive of obsolete content
next noautofocus noautohide noinitialfocus nomatch norestorefocus object observes onbeforeaccept onbookmarkgroup onchange onclick onclosetab oncommand oncommandupdate ondialogaccept ondialogcancel ondialogclosure ondialogextra1 ondialogextra2 ondialoghelp onerror onerrorcommand onextra1 onextra2 oninput onload onnewtab onpageadvanced onpagehide onpagerewound onpageshow onpaneload onpopuphidden onpopuphiding onpopupshowing onpopupshown onsearchcomplete onselect ontextcommand ontextentered ontextrevert ontextreverted onunload onwizardback onwizardcancel onwizardfinish onwizardnext open ordinal orient pack pageid pageincrement pagestep parent parsetype persist persistence phase pickertooltiptext placeholder popup position predicat...
...e preference preference-editable primary priority properties querytype readonly ref rel removeelement resizeafter resizebefore rows screenx screeny searchbutton searchsessions searchlabel selected selectedindex seltype setfocus showcaret showcommentcolumn showpopup size sizemode sizetopopup smoothscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets template timeout title toolbarname tooltip tooltiptext tooltiptextnew top type uri useraction validate value var visuallyselected wait-cursor width windowtype wrap wraparound ...
state - Archive of obsolete content
ArchiveMozillaXULPropertystate
showing: a request has been made to open the popup, but it has not yet been shown.
... this state will occur during the popupshowing event.
Sorting and filtering a custom tree view - Archive of obsolete content
"cool, but rude", weapon: "sai"}); data.push({name: "splinter", description: "rat", weapon: "walking stick"}); data.push({name: "shredder", description: "armored man", weapon: "blades"}); data.push({name: "casey jones", description: "goalie masked man", weapon: "hockey stick"}); data.push({name: "april o'neil", description: "journalist", weapon: "none"}); } if (filtertext == "") { //show all of them table = data; } else { //filter out the ones we want to display table = []; data.foreach(function(element) { //we'll match on every property for (var i in element) { if (prepareforcomparison(element[i]).indexof(filtertext) != -1) { table.push(element); break; } } }); } sort(); //restore scroll position if (topvisiblerow) { settopvisiblerow...
..."ascending" : "descending"); tree.setattribute("sortresource", columnname); tree.view = new treeview(table); //set the appropriate attributes to show to indicator var cols = tree.getelementsbytagname("treecol"); for (var i = 0; i < cols.length; i++) { cols[i].removeattribute("sortdirection"); } document.getelementbyid(columnname).setattribute("sortdirection", order == 1 ?
Multiple Rules - Archive of obsolete content
« previousnext » all of the examples shown so far have used only a single rule.
...when used together in this example, the results are combined and only three results are shown.
Custom toolbar button - Archive of obsolete content
you will add the other directories and files that are shown in the diagram.
... (other directories and files also exist, but the diagram does not show them.) 1.
Adding HTML Elements - Archive of obsolete content
this must be entered exactly as shown or it won't work correctly.
...some examples of using html elements are shown below.
Adding Style Sheets - Archive of obsolete content
in this file, we'll add the style declarations, as shown below: #find-text { min-width: 15em; } #progmeter { margin: 4px; } .springspace { width: 10px; } .titlespace { height: 10px; } notice how these styles are equivalent to the styles we had before.
...an example is shown below: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> this might be the first lines of a bookmarks window.
Creating Dialogs - Archive of obsolete content
var somefile=document.getelementbyid('enterfile').value; window.opendialog("chrome://findfile/content/showdetails.xul","showmore", "chrome",somefile); in this example the dialog showdetails.xul is displayed.
...the following values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosure button, which is used for showing more information you can set code to execute when the buttons are pressed using the ondialogaccept, ondialogcancel, ondialoghelp and ondialogdisclosure attributes.
Creating a Skin - Archive of obsolete content
a simple skin the image below shows the current find files dialog.
... the following style rules added to findfile.css will cause the changes shown in the accompanying image.
Focus and Selection - Archive of obsolete content
the example below shows this.
...as the focused element is changed, the label will show the tagname of the element.
Introduction to RDF - Archive of obsolete content
the sample below shows a simple rdf template.
...rdf/xml file example below, a sample rdf/xml file is shown, listing a table with three records and three fields.
Keyboard Shortcuts - Archive of obsolete content
an example is shown below: <keyset> <key id="sample-key" modifiers="shift" key="r"/> </keyset> this sample defines a keyboard shortcut that is activated when the user presses the shift key and r.
...an example is shown below: <keyset> <key id="copy-key" modifiers="accel" key="c" oncommand="docopy();"/> </keyset> the function docopy will be called when the user presses the keys specified by the key element, which in this example, are the keys for copying to the clipboard (such as control + c).
Localization - Archive of obsolete content
you also need to add the locale to the chrome.manifest file, for example: locale findfile en-us locale/ declaring entities the entities are declared using a simple syntax as shown below: <!entity findlabel "find"> this example creates an entity with the name findlabel and the value "find".
...the entire xul file is shown below with the changes shown in red.
Manipulating Lists - Archive of obsolete content
deleting selected items the following example shows a method of deleting the selected items properly: example 4 : source view <script> function deleteselection(){ var list = document.getelementbyid('thelist'); var count = list.selectedcount; while (count--){ var item = list.selecteditems[0]; list.removeitemat(list.getindexofitem(item)); } } </script> <button label="delete" oncommand="deleteselection();"/> <listbox id="thelist"...
...the ensureindexisvisible() method is similar in that it also scrolls to show a row, but this method does not scroll if the item is already visible.
More Wizards - Archive of obsolete content
the function checkcode() is called whenever the first page is shown as indicated by the onpageshow attribute.
...mple source <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wizard id="thewizard" title="secret code wizard" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checkcode(){ document.getelementbyid('thewizard').canadvance = (document.getelementbyid('secretcode').value == "cabbage"); } </script> <wizardpage onpageshow="checkcode(); return true;"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> there is also a corresponding canrewind property that you can use to enable or disable the back button.
Open and Save Dialogs - Archive of obsolete content
getting the selected file finally, you can show the dialog by calling the show() function.
... var res = fp.show(); if (res != nsifilepicker.returncancel){ var thefile = fp.file; // --- do something with the file here --- } next, we'll see how to create a wizard.
RDF Datasources - Archive of obsolete content
the table below shows the resources (or fields) that you can retrieve from the history datasource.
...setting the ref attribute example the example below shows how to display a particular piece of an rdf datasource by setting the ref attribute.
Tabboxes - Archive of obsolete content
shown below is the general syntax of a tabbox: <tabbox id="tablist"> <tabs> <!-- tab elements go here --> </tabs> <tabpanels> <!-- tabpanel elements go here --> </tabpanels> </tabbox> the tab elements are placed inside a tabs element, which is much like a regular box.
...as shown by the image, the two options appear on the second tab.
The Box Model - Archive of obsolete content
thus, the two lines below are equivalent: <vbox></vbox> <box orient="vertical"></box> the following example shows how to place three buttons vertically.
...the example below shows a simple login prompt: example 2 : source view <vbox> <hbox> <label control="login" value="login:"/> <textbox id="login"/> </hbox> <hbox> <label control="pass" value="password:"/> <textbox id="pass"/> </hbox> <button id="ok" label="ok"/> <button id="cancel" label="cancel"/> </vbox> here four elements have been oriented vertically, two inner hbox tags and two butt...
Tree Box Objects - Archive of obsolete content
note: it is not necessary to run tree.boxobject.queryinterface(components.interfaces.nsitreeboxobject) as shown in the code examples on this page because: let boxobject = tree.treeboxobject; note: is equivalent to: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree you can also scroll the tree using four different methods, similar to those available for listboxes.
...for example if the tree shows 10 rows at a time, a page will be equivalent to 10 rows.
XUL Structure - Archive of obsolete content
in the listing above, two files have been shown.
... there are of course others, but for simplicity they aren't shown.
Using the Editor from XUL - Archive of obsolete content
nstexteditorfocuslistener editor responds to focus and blur events by showing and hiding the caret or selection as appropriate.
...the nseditorshellmouselistener essentially calls nseditorshell::handlemouseclickonelement to show property dialogs for items that you double-click on.
XUL Questions and Answers - Archive of obsolete content
how do i close the "showpopup" which is automatically opened when the "oncontextmenu" event is called?
... if you have a similar code base as the following: onbookmarkcontextmenu: function(event, id) { document.getelementbyid("bookmarkpopup").showpopup(document.getelementbyid(id), event.screenx + 6, event.screeny + 6, "popup", "bottomright", "bottomright"); } use the hidepopup() function to solve this issue.
The Implementation of the Application Object Model - Archive of obsolete content
the personal toolbar must show up in a tree widget (in which case it has to be faking a tree content model, complete with <tt><treeitem></tt> and <tt><treecell></tt> nodes), or it must be able to show up on a toolbar (complete with <tt><button></tt> nodes and popup trees attached to folder buttons).
...a picture (provided by chris waterson) of the xul/rdf architecture is shown below.
button - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
... disclosure a button to show more information.
iframe - Archive of obsolete content
attributes showcaret, src, type, transparent properties accessibletype, contentdocument, contentwindow, docshell, webnavigation examples <iframe src="table.php" flex="2" id="browsertable" name="table_frame"/> selecting an url from a menu <menulist oncommand="donav(this);"> <menupopup> <menuitem label="mozilla" value="http://mozilla.org" /> <menuitem label="slashdot" value="http://slashdot.org"/...
...> <menuitem label="sourceforge" value="http://sf.net" /> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> <iframe id="myframe" flex="1"/> <script> function donav(obj) { var url = obj.selecteditem.value; // note the firstchild is the menupopup element document.getelementbyid('myframe').setattribute('src', url); } </script> attributes showcaret type: boolean whether or not to cause a typing caret to be visible in the content area.
prefpane - Archive of obsolete content
to change the selected pane, use the prefwindow's showpane method.
...otherwise the dialog will show erratic behavior and not display correctly.
textbox - Archive of obsolete content
the default is 0, which doesn't show any decimal places.
...a workaround using javascript and the onkeypress event handler as shown in abstract below may be your solution.
toolbarbutton - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
... disclosure a button to show more information.
tree - Archive of obsolete content
ArchiveMozillaXULtree
hidecolumnpicker type: boolean when set to false, a drop-down will appear in the upper right corner of the tree, which the user may use to show and hide columns.
...for trees with focus, the caret's position is indicated by the focus ring, but unfocused trees won't show a focus ring, naturally.
treecol - Archive of obsolete content
attributes crop, cycler, dragging, editable, fixed, hidden, hideheader, ignoreincolumnpicker, label, primary, sort, sortactive, sortdirection, src, type, width properties accessibletype style classes treecol-image examples this example shows a checkbox in the first column, requires the style below.
... center the text will be cropped in the middle, showing both the start and end of the text normally.
Building XULRunner with Python - Archive of obsolete content
note this is complete and does not require the checkout of any other project specific .mozconfig files as sometimes shown.
... using python in xul applications add the following to yourprefs.js during development pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); html <script> tags specify that python is used withtype="application/x-python" attribute.
Custom app bundles for Mac OS X - Archive of obsolete content
this tutorial will show you how to package your xulrunner-based application in a way which is consistent with the expectations of mac os x users.
...rome) example.manifest defaults/ preferences/ app-prefs.js (this provides some default values for preferences) application bundle contents in addition to the standard directory hierarchy that's required of all mac os x applications, as shown above in application bundle layout, there are some specific rules for what content goes where: the top-level directory is given a name that ends with .app which designates the whole package as an application bundle.
Dialogs in XULRunner - Archive of obsolete content
here is a short list of the button attributes on dialog; see also creating dialogs at mozillazine knowledge base: buttons a comma separated list of buttons to show on dialog (accept, cancel, help, extra1, and extra2).
...tion dofileopen() { /* see: http://developer.mozilla.org/en/docs/xul_tutorial:open_and_save_dialogs */ var nsifilepicker = components.interfaces.nsifilepicker; var fp = components.classes["@mozilla.org/filepicker;1"].createinstance(nsifilepicker); fp.init(window, "open file", nsifilepicker.modeopen); fp.appendfilters(nsifilepicker.filtertext | nsifilepicker.filterall); var res = fp.show(); if (res == nsifilepicker.returnok) { var thefile = fp.file; alert(thefile.leafname); // --- do something with the file here --- } } xul does not currently support any other common dialogs.
XULRunner tips - Archive of obsolete content
to the root directory of dom inspector (where the install.rdf is) like this one: /home/username/.mozilla/firefox/numbersandletters/extensions/inspector@mozilla.org/ now create a javascript file with the following code and include it in the main window of your application: function startdomi() { // load the window datasource so that browser windows opened subsequent to dom // inspector show up in the dom inspector's window list.
... preferences needed for file download dialogs to use the unknown-content-type and file-downloads dialogs from a <browser> element, you need to add the following prefs: pref("browser.download.usedownloaddir", true); pref("browser.download.folderlist", 0); pref("browser.download.manager.showalertoncomplete", true); pref("browser.download.manager.showalertinterval", 2000); pref("browser.download.manager.retention", 2); pref("browser.download.manager.showwhenstarting", true); pref("browser.download.manager.usewindow", true); pref("browser.download.manager.closewhendone", true); pref("browser.download.manager.opendelay", 0); pref("browser.download.manager.focuswhenstarting", false); pre...
Archived Mozilla and build documentation - Archive of obsolete content
this tutorial walks you through the process of building a mozilla extension that adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e.
... help viewer help viewer: allows information to be shown to the user inside mozilla.
2006-10-26 - Archive of obsolete content
tony inquires why tinderbox is showing that the fx 1.5.0.x (linux) has failed since october 20.
... gavin replies that "[t]he log file shows a "no space left on device" error when trying to link the final executable." learn the traffic magic of search engine cloaking mark describes the magic of search engine cloaker.
2006-10-27 - Archive of obsolete content
tony inquires why tinderbox is showing that the fx 1.5.0.x (linux) has failed since october 20.
... gavin replies that "[t]he log file shows a "no space left on device" error when trying to link the final executable." learn the traffic magic of search engine cloaking mark describes the magic of search engine cloaker.
Extentsions FAQ - Archive of obsolete content
<https://bugzilla.mozilla.org/show_bug.cgi?id=312818> "thunderbird requires domain in addresses and doesn't always add default" there is an extension that allows what you want attached to one of the comments in this bug.
... what you described was a bug (https://bugzilla.mozilla.org/show_bug.cgi?id=147670).
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
the rss 2.0 specification clearly states that “entity-encoded html is allowed“ and even provides examples showing exactly the syntax above (using cdata and unencoded html).
... an example using the most popular element of the rss content module is shown below: <?xml version="1.0"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" > <channel> <title>example</title> <description>an rss example with slash</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>a link in here</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/114</guid> <pubdate>sun, 15 may 2005 13:02:08 -0500</pubdate> <link>http://www.example.com/blog/2005/05/15/114</link> <content:encoded...
How RSS Works - Archive of obsolete content
an ipradio show would be at the server end of rss syndication.
... an iptv show would be at the server end of rss syndication.
Introduction to SSL - Archive of obsolete content
to authenticate the binding between a public key and the server identified by the certificate that contains the public key, an ssl-enabled client must receive a "yes" answer to the four questions shown in figure 2.
... to authenticate the binding between the public key and the person or other entity identified by the certificate that contains the public key, an ssl-enabled server must receive a "yes" answer to the first four questions shown in figure 3.
Building a Theme - Archive of obsolete content
the file preview.png is shown as a preview of the theme in the themes panel of the add-ons window.
...by default, the right pane should show the dom node, which has useful styling information like the css class and node id.
Using workers in extensions - Archive of obsolete content
« previous this article shows you how to use worker threads in extensions to perform tasks in the background without blocking the user interface.
...that file, ticker_worker.js, is shown here: var symbol = ""; function refreshinformation() { if (!symbol) { throw "no symbol set!"; } var fullurl = "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=" + symbol; function inforeceived() { var output = httprequest.responsetext; if (output) { postmessage(output.trim()); } httprequest = null; } var httprequest = new xmlhttpreque...
-ms-content-zoom-chaining - Archive of obsolete content
a bounce effect is shown when the user hits a zoom limit during page manipulation.
...no bounce effect is shown.
-ms-scroll-chaining - Archive of obsolete content
no bounce effect is shown.
... none a bounce effect is shown when the user hits a scroll limit during any manipulation.
-ms-scrollbar-arrow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows.
... </div> </body> the following image shows the result: specifications not part of any specification.
::-ms-clear - Archive of obsolete content
the clear button is only shown on focused, non-empty text controls.
...*/ /* the cross can be hidden by setting the display attribute as "none" */ } result the following screenshot shows what the feature will look like: specifications not part of any specification.
::-ms-ticks-after - Archive of obsolete content
these ticks are not shown by default.
... to show them, set the control's display property to block.
::-ms-ticks-before - Archive of obsolete content
these ticks are not shown by default.
... to show them, set the control's display property to block.
Displaying notifications (deprecated) - Archive of obsolete content
this lets you configure the event listeners before the notification is shown, if you need to be notified when the notification is dismissed.
...t.createelement("p"); e.innerhtml = "<strong>the notification was clicked.</strong>"; document.body.appendchild(e); }; notification.onclose = function() { var e = document.createelement("p"); e.innerhtml = "<strong>the notification was closed.</strong>"; document.body.appendchild(e); }; displaying the notification once the notification is configured the way you want it to be, call its show() method to display the notification: notification.show(); on android, for example, the resulting notification panel looks like this: when the user taps on the "hey, check this out!" notification here, the resulting changes to the document look like this: if you're using firefox mobile, you can see this example live by tapping the button below.
Object.prototype.__noSuchMethod__ - Archive of obsolete content
test of __nosuchmethod__ var o = { __nosuchmethod__: function(id, args) { console.log(id, '(' + args.join(', ') + ')'); } }; o.foo(1, 2, 3); o.bar(4, 5); o.baz(); // output // foo (1, 2, 3) // bar (4, 5) // baz () using __nosuchmethod__ to simulate multiple inheritance an example of code that implements a primitive form of multiple inheritance is shown below.
... } } // if we get here, the method hasn't been found throw new typeerror; } // used to add a parent for multiple inheritance function addparent(obj, parent) { // if the object isn't initialized, initialize it if (!obj.__parents_) { obj.__parents_ = []; obj.__nosuchmethod__ = nomethod; } // add the parent obj.__parents_.push(parent); } an example of using this idea is shown below.
XForms Custom Controls Examples - Archive of obsolete content
a full example showing a complete form can be found on xforms:custom_controls.
... output showing images <binding id="output-image" extends="chrome://xforms/content/xforms.xml#xformswidget-base"> <content> <html:div> <html:img anonid="content"/> </html:div> </content> <implementation implements="nsixformsuiwidget"> <method name="refresh"> <body> var img = document.getanonymouselementbyattribute(this, "anonid", "content"); img.setattribute("src", this.stringvalue); return true; </body> </method> </implementation> </binding> output showing xhtml <binding id="output-xhtml" extends="chrome://xforms/content/xforms-xhtml.xml#xformswidget-output"> <content> <children includes="label"/> <xhtml:div class="xf-value" anonid="content"></xhtml:div> <children/> </content> <implementation implements="nsixformsuiwid...
Troubleshooting XForms Forms - Archive of obsolete content
any instance, no controls get bound if no controls show with either inline instance or an <xf:instance src="...">, check the following: as with inline instance, make sure the instance of the form control ref binding expression matches the namespace of the data.
...so with an instance like this: <xf:instance id="ins2" xmlns=""> <data> <value>42</value> </data> </xf:instance> you should use <output ref="instance('ins2')/value"/> to show the contents of the value element.
XForms Output Element - Archive of obsolete content
introduction serves to show the instance data that the element is bound to in a read-only manner (see the spec).
... image if the bound instance node contains an image then you are free to use this representation to show the image instead of the byte sequence of the image data (fx 3.0 only, xhtml/xul).
XForms Upload Element - Archive of obsolete content
visually, the upload control is shown as a file picker dialog that hides disallowed (filtered) file types.
... representations the xforms upload element is represented by visually combining three widgets: a text field that shows the uri of the selected file, a button to open the file picker dialog which allows the user to select a file, and a button to clear the text field and the reference to the file from the bound node (xhtml only).
Examples - Game development
canvas airport simulation animated map showing planes taking off and landing at airports, along with flight path patterns.
... webgl filters demo showing webgl filters being used to add effects to html elements.
Game distribution - Game development
mobile devices are where html5 technology can truly shine and show its advantages.
...such exposure may just provide promotion for your game, or if you have adverts shown beside your game (or other money making options) it may also provide monetization.
Game promotion - Game development
and you can use your own game as an example, especially in a tutorial when you're showing how to do something you've implemented already.
...sending out weekly newsletters and organizing online competitions or local meetups will show others that you're passionate about what you do and that they can rely on you.
3D collision detection - Game development
if you have entities that will be rotating, you can either modify the dimensions of the bounding box so it still wraps the object, or opt to use another bounding geometry type, such as spheres (which are invariant to rotation.) the animated gif below shows a graphic example of an aabb that adapts its size to fit the rotating entity.
...the diagram below shows the test we'd perform over the x-axis — basically, do the ranges aminx–amaxx and bminx–bmaxx overlap?
Building up a basic demo with PlayCanvas - Game development
games and demos playcanvas has a few well-known demos published that showcase its possibilities.
... visualizations like the star lord and bmw i8 also take advantage of the engine and showcase what's possible.
Building up a basic demo with Three.js - Game development
let's explain values we are setting for the code above: the value we set for the field of view, 70, is something we can experiment with: the higher the value, the greater the amount of scene the camera will show.
...to show animation, we need to make changes to these values inside the render loop, so they update on each frame.
3D games on the Web - Game development
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.
...see the building up a basic demo with playcanvas subpage for higher-level details, and further articles showing how to create demos using the playcanvas library, and the online editor.
Audio for Web games - Game development
testing and support here's a table that shows what mobile platforms support the features talked about above.
...isplaying the play button: trackels.foreach((el, i) => { // get children const anchor = el.queryselector('a'); const loadtext = el.queryselector('p'); const playbutton = el.queryselector('button'); // load file loadfile(anchor.href).then((track) => { // set loading to false el.dataset.loading = 'false'; // hide loading text loadtext.style.display = 'none'; // show button playbutton.style.display = 'inline-block'; // allow play on click playbutton.addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } playtrack(track); playbutton.dataset.playing = true; }) }) }) note: you can see this demo in a...
Unconventional controls - Game development
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.
...the last value is grabstrength, which is a float between 0 and 1 — when reaching 1 (fist fully clenched), we show an alert for now (in a full game this could be replaced with the shooting logic.) that's it — everything you needed for a working leap motion example in javascript is here already.
Animations and tweens - Game development
we will show the sprites sequentially to create the illusion of animation.
...update the first line inside update() as shown below: function update() { game.physics.arcade.collide(ball, paddle, ballhitpaddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } then we can create the ballhitpaddle() function (having ball and paddle as default parameters), playing the wobble animation when it is called.
Build the brick field - Game development
add the initbricks() function at the end of our games code, just before the closing </script> tag, as shown below.
...fill in the contents as shown below: for(c=0; c<brickinfo.count.col; c++) { for(r=0; r<brickinfo.count.row; r++) { var brickx = 0; var bricky = 0; newbrick = game.add.sprite(brickx, bricky, 'brick'); game.physics.enable(newbrick, phaser.physics.arcade); newbrick.body.immovable = true; newbrick.anchor.set(0.5); bricks.add(newbrick); } } here we're looping thro...
Physics - Game development
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.
... 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); } funct...
Player paddle and controls - Game development
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, the paddle.
...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.
Scaling - Game development
update your existing preload() function as follows: function preload() { game.scale.scalemode = phaser.scalemanager.show_all; game.scale.pagealignhorizontally = true; game.scale.pagealignvertically = true; } scalemode has a few different options available for how the canvas can be scaled: no_scale — nothing is scaled.
... show_all — scales the canvas, but keeps the aspect ratio untouched, so images won't be skewed like in the previous mode.
Tutorials - Game development
2d maze game with device orientation this tutorial shows how to create a 2d maze game using html5, incorporating fundamentals such as collision detection and sprite placement on a <canvas>.
... 2d platform game with phaser this tutorial series shows how to create a simple platform game using phaser, covering fundamentals such as sprites, collisions, physics, collectables, and more.
Assessment: Accessibility troubleshooting - Learn web development
the show/hide comment control the show/hide comment control button is not current keyboard-accessible.
... the table the data table is not currently very accessible — it is hard for screenreader users to associate data rows and columns together, and the table also has no kind of summary to make it clear what it shows.
Accessibility - Learn web development
here we'll show how to use it at a basic level to improve accessibility.
...this article shows how.
Cascade and inheritance - Learn web development
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.
... the following table shows a few isolated examples to get you in the mood.
Images, media, and form elements - Learn web development
if the user enters something unexpected, or leaves a required field blank, the browser can show an error message.
... for consistency it is a good idea to set margins and padding to 0 on all elements, then add these back in when styling particular controls button, input, select, textarea { box-sizing: border-box; padding: 0; margin: 0; } other useful settings in addition to the rules mentioned above, you should also set overflow: auto on <textarea>s to stop ie showing a scrollbar when there is no need for one: textarea { overflow: auto; } putting it all together into a "reset" as a final step, we can wrap up the various properties discussed above into the following "form reset" to provide a consistent base to work from.
Attribute selectors - Learn web development
this lesson will show you how to use these very useful selectors.
... (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.
Pseudo-classes and pseudo-elements - Learn web development
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?
... :placeholder-shown matches an input element that is showing placeholder text.
Sizing items in CSS - Learn web development
to see the example change when you change the viewport size you will need to load the example in a new browser window that you can resize (as the embedded <iframe> that contains the example shown above is its viewport).
...for example, if you want a full-page hero section to show before the rest of your content, making that part of your page 100vh high will push the rest of the content below the viewport, meaning that it will only appear once the document is scrolled.
The box model - Learn web development
the below diagram shows these layers: the standard css box model in the standard box model, if you give a box a width and a height attribute, this defines the width and height of the content box.
...this is shown in the image below.
Legacy layout methods - Learn web development
working through the process of creating a grid with floats shows you how this works and also introduces some more advanced concepts to build on the things you learned in the lesson on floats and clearing.
... add these now, as shown in the following snippet: <div class="container"> <div class="row"> <div class="one column">1</div> <div class="one column">2</div> <div class="one column">3</div> /* and so on */ </div> </div> next, give the containers on the second row classes explaining the number of columns they should span, like so: <div class="row"> <div class="one column">13</div> <div class="si...
Styling lists - Learn web development
if you get really stuck, press the show solution button to see a potential answer.
...="code" class="css-input" style="width: 90%;height: 10em;padding: 10px;border: 1px solid #0095dd;"></textarea> <h2>output</h2> <div class="output" style="width: 90%;height: 12em;padding: 10px;border: 1px solid #0095dd;overflow: auto;"></div> <div class="controls"> <input id="reset" type="button" value="reset" style="margin: 10px 10px 0 0;"> <input id="solution" type="button" value="show solution" style="margin: 10px 0 0 10px;"> </div> </div> var htmlinput = document.queryselector(".html-input"); var cssinput = document.queryselector(".css-input"); var reset = document.getelementbyid("reset"); var htmlcode = htmlinput.value; var csscode = cssinput.value; var output = document.queryselector(".output"); var solution = document.getelementbyid("solution"); var styleelem = docume...
How do you make sure your website works properly? - Learn web development
you might be surprised at how many problems come up: images don't show up, pages don't load or load slowly, and so on.
...it's not showing the image we expected!
How do you upload your files to a web server? - Learn web development
this article shows you how to publish your site online using file transfer tools.
...respectively, these are a log of messages showing the connection status between your computer and the sftp server, and a live log of every interaction between your sftp client and the server.
Common questions - Learn web development
this article shows how to publish your site online with ftp tools — one of the most common ways to get a website online so others can access it from their computers.
... 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.
Test your skills: Form validation - Learn web development
to help, you might want to consider adding some simple css to show when a form field is valid or invalid.
... again, to help you might want to consider adding some simple css to show when a form field is valid or invalid.
Publishing your website - Learn web development
then the program shows you your local files and the web server's files in two windows, and provides a way for you to transfer files back and forth.
... deploy a website: a nice tutorial from codecademy that goes a bit further and shows some additional techniques.
Getting started with the Web - Learn web development
in installing basic software, we show you step-by-step how to install just the software you need to begin some basic web development.
...what information are you showcasing?
Document and website structure - Learn web development
a "typical website" could be structured something like this: html for structuring content the simple example shown above isn't pretty, but it is perfectly fine for illustrating a typical website layout example.
... now try to sketch a rough sitemap — have a bubble for each page on your site, and draw lines to show the typical workflow between pages.
What’s in the head? Metadata in HTML - Learn web development
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.
...this can be done by adding the lang attribute to the opening html tag (as seen in the meta-example.html and shown below.) <html lang="en-us"> this is useful in many ways.
Mozilla splash page - Learn web development
next, create a 1200px wide landscape version of red-panda.jpg, and a 600px wide portrait version that shows the panda in more of a close up shot.
... example the following screenshots show what the splash page should look like after being correctly marked up, on a wide and narrow screen display.
Video and audio content - Learn web development
a webm file containing a movie which has a main video track and one alternate angle track, plus audio for both english and spanish, in addition to audio for an english commentary track can be conceptualized as shown in the diagram below.
... others may not be able to hear the audio because they are in noisy environments (like a crowded bar when a sports game is being shown).
General asynchronous programming concepts - Learn web development
let's look at a couple of examples that show what we mean by blocking.
... a "click me for alert" button that when clicked shows an alert message.
Asynchronous JavaScript - Learn web development
introducing asynchronous javascript in this article we briefly recap the problems associated with sychronous javascript, and take a first look at some of the different asynchronous javascript techniques you'll encounter, showing how they can help us solve such problems.
...this article shows you how promises work, where you'll see them in use in webapis, and how to write your own.
Build your own function - Learn web development
the main part we want to focus on here is the function's structure and usage, but we wanted to show something interesting for this example.
... improving the function with parameters as it stands, the function is still not very useful — we don't want to just show the same default message every time.
Client-side web APIs - Learn web development
this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter.
...this article shows you how to do common tasks such as creating custom playback controls.
Basic math in JavaScript — numbers and operators - Learn web development
enter the below two lines as shown: typeof myint; typeof myfloat; you should get "number" returned in both cases — this makes things a lot easier for us than if different numbers had different data types, and we had to deal with them in different ways.
...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!
Handling text — strings in JavaScript - Learn web development
html provides structure and meaning to our text, css allows us to precisely style it, and javascript contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more.
... pretty much all of the programs we've shown you so far in the course have involved some string manipulation.
Object building practice - Learn web development
let's bounce some balls in this article we will write a classic "bouncing balls" demo, to show you how useful objects can be in javascript.
...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).
Measuring performance - Learn web development
these tools show you how fast or slow your web app or site load.
...for example, the firefox network monitor returns detailed information on all the assets downloaded form the network, along with a time graph that shows how long each one took to download.
What is web performance? - Learn web development
even if an operation is going to take a long time (because of latency or whatever), it is possible to keep the user engaged while they wait by showing a loading spinner, or a series of useful hints and tips (or jokes, or whatever else you think might be appropriate).
... such an approach is much better than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up.
The "why" of web performance - Learn web development
performant sites have been shown to increase visitor retention and user satisfaction.
... slow content has been shown to lead to site abandonment, with some visitors leaving to never return.
Server-side website programming - Learn web development
the dynamic websites – server-side programming topic is a series of modules that show how to create dynamic websites; websites that deliver customised information in response to http requests.
...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.
Introduction to client-side frameworks - Learn web development
when we remember that the application has to let the user to do all of these things through the browser, however, some cracks start to show.
...let's say that our state is an array of objects structured like this: const state = [ { id: 'todo-0', name: 'learn some frameworks!' } ] how do we show one of those tasks to our user?
Getting started with Svelte - Learn web development
on the right side you have three tabs: the result tab shows your app output, and provides a console at the bottom.
... the css output tab shows the css generated by svelte.
Creating our first Vue component - Learn web development
add an id to the checkbox, and a for attribute mapping the checkbox to the label, as shown below.
...to it): import uniqueid from 'lodash.uniqueid'; export default { props: { label: { required: true, type: string }, done: { default: false, type: boolean } }, data() { return { isdone: this.done, id: uniqueid('todo-') }; } }; next, bind the id to both our checkbox’s id attribute and the label’s for attribute, updating the existing id and for attributes as shown: <template> <div> <input type="checkbox" :id="id" :checked="isdone" /> <label :for="id">{{label}}</label> </div> </template> summary and that will do for this article.
Getting started with Vue - Learn web development
we also need to remove the lines from inside the <script> element that import and register the component: delete these lines now: import helloworld from './components/helloworld.vue' components: { helloworld } your rendered app should no longer show an error, just a blank page, as we currently have no visible content inside <template>.
...add it like so: <template> <div id="app"> <h1>to-do list</h1> </div> </template> app.vue will now show our heading, as you'd expect.
Adding a new todo form: Vue events, methods, and models - Learn web development
update your v-model attribute to chain lazy and trim as shown above, and then test your app again.
... replace the console.log() in the onsubmit() method with the following: this.$emit("todo-added"); next, go back to app.vue and add a methods property to your component object containing an addtodo() method, as shown below.
Understanding client-side web development tools - Learn web development
we finish up by providing a complete toolchain example showing you how to get productive.
...we push the code to github, deploy it using netlify, and even show you how to add a simple test into the process.
Learn web development
we have started keeping learning area release notes to show what has changed — keep checking back frequently!
...this topic provides a general introduction to how the server-side works and detailed tutorials showing how to build up a server-side app using two popular frameworks: django (python) and express (node.js).
Accessibility API cross-reference
<p> <p> shows percentage completion for task progressbar progress_bar n/a progressbar page showing properties of something propertypage n/a n/a n/a your average, run-of-the-mill button pushbutton push_button push_button button <button> only one radio button in a group is selectable.
... n/a n/a sensitive don't speak for this item, it will take care of text-to-speech on its own selfvoicing n/a n/a object can be resized n/a resizable resizable this object and all of its ancestors are visible n/a showing showing this text object can only contain 1 line of text n/a single_line single_line tells accessibility aid "don't add event listener - this object doesn't generate any".
Mozilla accessibility architecture
above: a diagram showing that the msaa tree is a subset of the dom tree.
...domnodeinserted w3c dom mutation event 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_menustart 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) ...
Chrome registration
this example shows how a different overlay can be used for different applications: overlay chrome://browser/content/browser.xul chrome://myaddon/content/ffoverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} overlay chrome://messenger/content/mailwindowoverlay.xul chrome://myaddon/content/tboverlay.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6} overlay chrome://songbird/content/xul/layoutbaseove...
.../ override chrome://global/content/neterror.xhtml jar:embedder.jar!/global/content/neterror.xhtml content inspector jar:inspector.jar!/content/inspector/ instructions supported in bootstrapped add-ons the following instructions are supported in bootstrapped extensions: manifest content locale skin override debugging a chrome manifest file the chrome list extension shows all registered chrome.
Debugging a hang on OS X (Archived)
when it's done parsing the data, click the "show text report" button; a new window will open with a couple of rows with stacktraces for all the threads in the sampled application.
... the final data will show where the application spent all its time when it was hung, and hopefully your bug will be easier to fix now!
Experimental features in Firefox
this also changes the console warning; if the upgrade succeeds, the message indicates that the request was upgraded, instead of showing a warning.
... compatibility panel a side panel for the page inspector that shows you information detailing your app's cross-browser compatibility status.
Message manager overview
communicate with frame scripts using message-passing apis there are various types of frame message managers, as depicted in this diagram: this diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open.
...the diagram below shows the setup that would result from having two child processes: with the gppmm, you can broadcast messages to the cipmm and all cpmms.
Firefox and the "about" protocol
tation for each tool about:downloads displays all downloads done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking displays networking information about:newtab start page when opening a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information about installed plugins about:policies lists out the firefox for e...
...see firefox reader view for clutter-free web pages about:rights displays rights information about:robots special page showing notes about robots about:serviceworkers displays currently running service workers about:studies lists the shield studies that are installed about:sessionrestore session restoration (displayed after a firefox crash) about:support troubleshooting information (also available through firefox menu > ?
Firefox UI considerations for web developers
one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space.
... examples consider again the example top sites box shown at the top of the page, repeated below: let's look at some examples among the icons shown here (note that this discussion is based on the site designs as of early january, 2019).
Using the Browser API
MozillaGeckoChromeAPIBrowser APIUsing
when this fires, we set the value inside the url bar input to be equal to the event object detail property — this is so that the url displayed continues to match the website being shown when the user navigates back and forth through the history.
...we switch the class values on the element to toggle the show/hide.
mozbrowsercontextmenu
systemtargets an array containing one or more menusystem objects (see the menusystem object, below), containing details of the standard menu(s) that will be shown.
...r = document.queryselector("iframe"); browser.addeventlistener("mozbrowsercontextmenu", function(event) { console.log("asking for menu:" + json.stringify(event.details)); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserloadend
example in this example the mozbrowserloadstart and mozbrowserloadend events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate.
....backgroundcolor); controls.style.background = e.detail.backgroundcolor; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserloadstart
example in this example the mozbrowserloadend and mozbrowserloadstart events are used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate.
...tlistener('mozbrowserloadstart',function() { stopreload.textcontent = 'x'; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
Embedding Tips
the nsicontextmenulistener::onshowcontextmenu() method will be called with the dom node that the context applies, the dom event plus some flag combinations that assist in determining what menu to display (document, link, image, selected text etc.) how do i implement tool tips?
...methods to hide or show the tool tips will automatically be called upon it when the user hovers over an item with title text.
How Mozilla determines MIME Types
when encountering a non-text byte, the helper app dialog will be shown, showing the mime type corresponding to the extension of the file.
...when loading an uri with a type that mozilla can not handle, a helper app dialog shows up, and the displayed information comes from these sources: ask the os for a handler of the given <extension, mime type> pair.
IPDL Tutorial
the following artificial example shows how these specifiers are used and how these specifiers change the generated abstract actor classes.
...a proper protocol with a synchronous message is shown below.
JavaScript-DOM Prototypes in Mozilla
all the methods that are supposed to show up on this jsobject are actually not properties of the object itself, but rather properties of the prototype of the jsobject for the wrapper (unless the c++ object's class info has the flag nsixpcscriptable::dont_share_prototype set, but lets assume that's not the case here).
... here is a diagram that shows the prototype layout of a htmldivelement in mozilla: htmldivelement.prototype | |.__proto__ | htmlelement.prototype | |.__proto__ | element.prototype | |.__proto__ | node.prototype | |.__proto__ | object.prototype ...
Downloads.jsm
examples downloading to a local file this example downloads an html file without showing progress, handling errors programmatically.
... to demonstrate the logging, a new download is started while a message box is being shown.
OS.File for the main thread
} ); }; r.readasarraybuffer(b); }, 'image/png'); }; //var path = os.path.tofileuri(os.path.join(os.contants.path.desktopdir, 'my.png')); //do it like this for images on disk var path = 'https://mozorg.cdn.mozilla.net/media/img/firefox/channel/toggler-beta.png?2013-06'; //do like this for images online img.src = path; example: append to file this example shows how to use open, write, and close to append to a file.
...this example also shows the resolve value of open (an instance of os.file, this is a file, so you can do any of the methods on it found here), write (a number indicating bytes written), and close (undefined, meaning there is no resolve value).
Examples
let lastpromise = newpromise.then(function onfulfill(){ }) .catch(function onreject(arejectreason) { console.warn('newpromise failed with reason: ', arejectreason); }); using a promise returned by a function (verbose) this example uses a verbose syntax, showing all the involved promises.
... make user defined promise return after multiple images finish loading (promise.all and promise.defer) this example shows how to use promise.all to wait to create multiple promises with promise.defer() and return at the end of it.
Localization and Plurals
this page is to help explain how to localize these strings so that the correct plural form is shown to the user.
... the following 3 file snippets show how to use pluralform with your .xul, .properties, .js files.
Localizing with Koala
if the sidebar with the results of the comparison doesn't show up automatically: open the projects sidebar by choosing view > tabs & sidebars > projects from the menu.
... koala will show you a message if the "hg add" was successful.
Creating localizable web content
if the screenshot shows the application that the website directly relates to (firefox on mozilla.com/firefox, personas on getpersonas.com), try to use screenshots from the localized version.
... if however the screenshot shows a third-party application or website, it's acceptable to use the english version if it's not available in the target language.
Localization formats
hp echo ___("getting started")?></h1> function ___($str) { return $array[$str]; } advantage to .lang simple work-flow allowing the web developer to place the file in svn and it can appear on the staging server .lang syntax is like simplified .po, which many localizers who are familiar with linux and other projects understand mozilla has a basic tool called main.lang checker, which can show any untranslated files to the localizer no need to compile to .mo file so a localizer can see his/her changes more quickly creating simple diffs .lang files will be cached which will reduce any slowness effect disadvantage to .lang no plural forms no context for localizers unless you provide good comments no styling by localizers if it is needed may be slower because file is not compil...
... in the case of download day, someone created entity-like identifiers in the msgid, which we have shown above with the "certificate_intro" key.
Basics
the context menu won't show up.
...the following example shows the i-th step of the multiplication of a matrix a by a vector x (notice how ai1 , ...
Extras
they are not portable and are meant to showcase a few interesting upshots from building natively upon the browser environment.
...the title attribute as a tooltip (from xhtml) html content <p>mouse over either log to see a tooltip showing the title <math display="block"> <mrow> <mrow> <msub title="base-a log"> <mi>log</mi> <mi>a</mi> </msub> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mo>=</mo> <mfrac> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> rather than repeating the instructions, some css might be used to provide a visual cue.
MathML Screenshots
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.
Mozilla Quirks Mode Behavior
should look into tablequirkcolorrule, re-describe, and figure out when it changed.] obsolete since gecko 37 the empty-cells property defaulted to hide in quirks mode but show (according to css2.1) in standards mode (see bug 33244) (though the correct fix would be to specify it on the html table element in quirk.css).
... this quirk has been removed in firefox 37 and empty-cells also defaults to show in quirks mode (bug 1020400).
DMD
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.
...by default, records show up to 8 stack frames.
Leak-hunting strategies and tips
this can mean there will be xpconnect wrapper objects showing up as owning the leaked objects, but it doesn't mean it's xpconnect's fault (although that has been known to happen, it's rare).
...it may just involve setting the xpc_shutdown_heap_dump environment variable to a file name, but i haven't tested that.) post-processing of stack traces on mac and linux, the stack traces generated by our internal debugging tools don't have very good symbol information (since they just show the results of dladdr).
Reporting a Performance Problem
visit https://profiler.firefox.com/ click on "enable profiler menu button" the profiler toolbar button will show up in the top right of the url bar as a small stopwatch icon you can right-click on the button and remove it from the toolbar when you're done with it.
... make sure you are selecting the process that is using up the cpu since all of the processes are shown.
javascript.options.strict
var name2= "peter"; document.getelementbyid("sample").innerhtml = name1; </script> </body> </html> possible values and their effects: true: show javascript errors and warnings.
... false: show javascript errors only.
Preference reference
if set to true, the data is stored as content preference.browser.pagethumbnails.capturing_disabledthe preference browser.pagethumbnails.capturing_disabled controls whether the application creates screenshots of visited pages which will be shown if the web page is shown in the grid of the "new tab page" (about:newtab) which offers the most often visited pages for fast navigation.browser.search.context.loadinbackgroundbrowser.search.context.loadinbackground controls whether a search from the context menu with "search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreground or keep focus o...
... javascript.options.showinconsolethe preference javascript.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console.javascript.options.stricttechnical review completed.mail.tabs.drawintitlebarstarting in thunderbird 17.0, the tabs are drawn in the title bar.
Profile Manager
locked profiles some profiles may be shown as locked in the main window.
... properties - shows a dialog that displays the profile's path and last-modified date.
AsyncTestUtils extended framework
helper.js"); load("../../mailnews/resources/asynctestutils.js"); load("../../mailnews/resources/messagegenerator.js"); load("../../mailnews/resources/messagemodifier.js"); load("../../mailnews/resources/messageinjection.js"); if the directory where you are adding the tests does not have a head_*.js file that has the two following lines, add them at the top of your test file (before the lines shown above): load("../../mailnews/resources/maildirservice.js"); load("../../mailnews/resources/mailtestutils.js"); at the bottom of the test file, add the following: var tests =[ // list your tests here ]; function run_test() { configure_message_injection({mode: "local"}); async_run_tests(tests); } asynchronous testing basics why do we need it?
...for example, all our default tags are actually things like $label1 and $label2, but that is not what we show to the user.
NSPR Contributor Guide
if you snatched it from somewhere else, tell us where; show us where the right to incorporate it into nspr exists.
...we will see that your documentation is transcribed into the appropriate word processor and the derived html shows up on mozilla.org test cases you should provide test cases for all new features and new libraries.
Introduction to Network Security Services
figure 1, below, shows a simplified view of the relationships among the three shared libraries listed above and nspr, which provides low-level cross platform support for operations such as threading and i/o.
...the names of these libraries are platform-dependent, as shown in the following table.
NSS Memory allocation
but leak analysis tools only record the allocation of memory from the heap, not memory from the arena free list, so they will always show the first allocation (from the heap) and not the most recent allocation (from the arena free list).
... consequently, when the arena free list is in use, the allocation call stacks shown will typically not be the stack of the code that most recently allocated that arena, but rather will be the stack of the code that first allocated that arena from the heap, and then placed it on the free list.
NSS 3.14 release notes
support for tls 1.1 (rfc 4346) has been added (https://bugzilla.mozilla.org/show_bug.cgi?id=565047).
... when connecting to a server, the record layer version of the initial clienthello will be at most { 3, 1 } (tls 1.0), even when attempting to negotiate tls 1.1 (https://bugzilla.mozilla.org/show_bug.cgi?id=774547) the choice of client_version sent during renegotiations has changed.
NSS tools : modutil
modutil -list [modulename] -dbdir [sql:]directory listing the modules shows the module name, their status, and other associated security databases for certificates and keys.
...mozilla nss bug 836477 https://bugzilla.mozilla.org/show_bug.cgi?id=836477 visible links 1.
NSS tools : pk12util
the certificates and keys in the file can be printed (listed) in a human-readable pretty-print format that shows information for every certificate and any public keys in the .p12 file.
...mozilla nss bug 836477 https://bugzilla.mozilla.org/show_bug.cgi?id=836477 ...
NSS tools : ssltab
the following examples show the output from commonly used combinations of options.
...both formats are shown for each record.
NSS tools : ssltap
the following examples show the output from commonly used combinations of options.
...both formats are shown for each record.
NSS Tools certutil
ids are displayed in hexadecimal ("0x" is not shown).
...6:c6:52:4a:d4:67:be:8d:fc:dd:52:51:8e:a2:d7:15: 71:3e certificate trust flags: ssl flags: valid ca trusted ca email flags: valid ca trusted ca object signing flags: valid ca trusted ca validating a certificate this example validates a certificate: certutil -v -n jsmith@netscape.com -b 9803201212z -u sr -e -l -d certdir the certificate database tool shows results similar to certificate:'jsmith@netscape.com' is valid.
certutil
ids are displayed in hexadecimal ("0x" is not shown).
...use the -h option to show the complete list of arguments for each command option.
NSS tools : signtool
then run signtool with standard input redirected from your file as follows: signtool -g mytestcert inputfile the prompts show up on the screen, but the responses will be automatically read from the file.
...dule (this module is internally loaded) slots: 2 slots attached status: loaded slot: communicator internal cryptographic services version 4.0 token: communicator generic crypto svcs slot: communicator user private key and certificate services token: communicator certificate db ----------------------------------------------- this unix example shows that netscape signing tool is using a fips-140-1 module: signtool -d "c:\netscape\users\jsmith" -m using certificate directory: c:\netscape\users\jsmith enter password or pin for "communicator certificate db": [password will not echo] listing of pkcs11 modules ----------------------------------------------- 1.
NSS tools : ssltap
MozillaProjectsNSStoolsssltap
the following examples show the output from commonly used combinations of options.
...both formats are shown for each record.
Rhino Debugger
if a property is itself a javascript object the property may be expanded to show its sub-properties.
...if a variable is itself a javascript object the variable may be expanded to show its sub-properties.
Rhino Examples
examples have been provided that show how to control the javascript engine and how to implement scriptable host objects.
...the liveconnect.js script shows a sample usage of liveconnect (java-to-javascript connectivity).
Scripting Java
this article shows how to use rhino to reach beyond javascript into java.
...if we just view the method object by itself we can see the various overloaded forms of the method: js> f.listfiles function listfiles() {/* java.io.file[] listfiles() java.io.file[] listfiles(java.io.filenamefilter) java.io.file[] listfiles(java.io.filefilter) */} this output shows that the file class defines three overloaded methods listfiles: one that takes no arguments, another with a filenamefilter argument, and a third with a filefilter argument.
Introduction to the JavaScript shell
007: name "print" 00010: pushobj 00011: getvar 0 00014: uint16 2 00017: add 00018: call 1 00021: pop 00022: stop source notes: 0: 0 [ 0] newline 1: 3 [ 3] decl offset 0 2: 7 [ 4] newline 3: 18 [ 11] xdelta 4: 18 [ 0] pcbase offset 11 dissrc([function]) disassembles the javascript bytecode for the entire program, or for the specified function, showing the source lines.
... notes([function]) shows the source notes for the specified function.
Running Automated JavaScript Tests
for a smoke test or if you are not changing language-level functionality, you may wish to use jstests.py path_to_js_shell --exclude=test262 other options allow you to show the test command lines being run, command output and return codes, run tests named in a given file, exclude tests named in a given file, hide the progress bar, change the timeout, run skipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind.
...n use --filter=pattern command-line argument, where pattern is a regexp pattern that is tested against file:///{path_to_obj_dir}/dist/test-stage/jsreftest/tests/jsreftest.html?test={relative_path_to_test_from_js/src/tests} string: ./mach jstestbrowser --filter=pattern running jstests on treeherder when viewing treeherder after a push to the mozilla repositories, jstests run in the browser are shown as r(j) meaning "javascript reftests".
Thread Sanitizer
runtime suppressions to prevent races from showing up at runtime, tsan also provides a runtime suppression list.
...however, unlike compile-time blacklisting, runtime suppressions do have a performance impact, especially if the race in question keeps showing up a lot.
Web Replay
timeline the timeline is shown above the developer tools and provides several features to help with navigating the recording: the timeline changes color depending on whether the tab is currently recording (red) or replaying (blue).
... the current position within the recording is shown on the timeline with a progress indicator.
AT Development
references at apis implementation references shows how gecko handles atk, iaccessible2, msaa and universal access api accessible web specifications references provides the map of reflecting web specification to at apis.
... xforms references - gecko documentation showing how xforms controls are mapped to at apis.
Frecency algorithm
places with this value can show up in autocomplete results.
... invalid places have a frecency value of zero, and will not show up in autocomplete results.
Querying Places
1 const unsigned short results_as_full_visit = 2 (not yet implemented -- see bug 320831) attribute unsigned short sortingmode attribute autf8string sortingannotation attribute unsigned short resulttype attribute boolean excludeitems attribute boolean excludequeries attribute boolean excludereadonlyfolders attribute boolean expandqueries attribute boolean includehidden attribute boolean showsessions attribute unsigned long maxresults const unsigned short query_type_history = 0 const unsigned short query_type_bookmarks = 1 const unsigned short query_type_unified = 2 (not yet implemented -- see bug 378798) attribute unsigned short querytype complex queries you can pass one or more nsinavhistoryquery objects to executequeries().
...this corresponds to the open and closed state in a tree view, and can also be mapped to showing and hiding menus.
Avoiding leaks in JavaScript XPCOM components
, " + // doubles first private_data to 2 fns1[1]() + ", " + // doubles first private_data to 4 fns2[1]() + ", " + // doubles second private_data to 0 fns1[0]() + ", " + // increments first private_data to 5 fns2[0]() + ", " + // increments second private_data to 1 fns1[1]() + "."; // doubles first private_data to 10 } this shows that closures are quite powerful.
... function _filterradiogroup(anode) { switch (anode.localname) { case "radio": return nodefilter.filter_accept; case "template": case "radiogroup": return nodefilter.filter_reject; default: return nodefilter.filter_skip; } } var iterator = this.ownerdocument.createtreewalker(this, nodefilter.show_element, _filterradiogroup, true); while (iterator.nextnode()) radiochildren.push(iterator.currentnode); return this.mradiochildren = radiochildren; in this example, the iterator object is an xpcom object that is wrapped so the javascript code can use it.
Building the WebLock UI
if the weblock component is being installed in 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.
...ist-style-image: url("chrome://weblock/wl-lock.gif"); } statusbarpanel#weblock-status[status="unlocked"] { list-style-image: url("chrome://weblock/wl-un.gif"); } the style rules are distinguished by the state of the status attribute on the element in the xul with the id "weblock-status." as you can see above, when the status of the element is set to "locked", the image wl-lock.gif is used to show the state, and when the web locking is unlocked, it uses wl-un.gif.
Component Internals
the illustration below shows the basic relationship between the shared library containing the component implementation code you write and the xpcom framework itself.
... another, even more basic view of this relationship of components to the files and interfaces that define them is shown in onion peel view of xpcom component creation in the next chapter.
Creating the Component Code
using xpcom utilities to make things easier shows some simpler and more elegant ways to create an xpcom component using generic macros, and this chapter is more about learning the basics.
...web lock user interface shows the icon that is used to activate the web lock mode (leftmost in the status bar) once you have installed the weblock component and the extra user interface.
Packaging WebLock
the sample installation script shown below uses the mozilla xpinstall technology to manipulate an installer and talk to mozilla'schrome registry as high-level javascript objects.
... the next section shows how this process of downloading, copying and registering the necessary files from the xpi can be achieved with an xpinstall installation script.
Setting up the Gecko SDK
we also link against a number of libraries in the object/library modules line: nspr4.lib plds4.lib plc4.lib embedstring.lib xpcomglue.lib both of these settings are shown below: the last change you need to make to set up the gecko sdk in your project is to change the "use run-time library" setting to "multithreaded dll." since this change is configuration dependent, you must make set the release configuration run-time library to the release multithreaded dll runtime and the debug configuration to the debug multithreaded dll runtime (this needs clarification): ...
... i used xpcomviewer, to make sure the class and the interface were showing.
Introduction to XPCOM for the DOM
if you are concerned that it could return ns_nointerface, return ns_ok, as the previous example shows.
... the interface inheritance shows that the top-level interface is nsisupports.
Components.utils.reportError
to show them, set the preference 'javascript.options.showinconsole' to true, or use nsconsoleservice instead to show a message.
... firefox 4: the preference 'javascript.options.showinconsole' is set to true by default in this version.
nsIAccessibleEvent
constants constant gecko version description 1.7 - 1.8.1 1.9 - 1.9.2 2.0 event_show 0x8002 0x0001 an object has been created.
... event_asynch_show 0x0004 a hidden object is shown -- this is a layout occurrence and is thus asynchronous.
nsIAutoCompleteInput
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.
nsIContentViewer
[noscript,notxpcom,nostdcall] void setnavigationtiming(in nsdomnavigationtimingptr atiming); void setpagemode(in boolean apagemode, in nsiprintsettings aprintsettings); void show(); void stop(); void unload(); obsolete since gecko 1.8 attributes attribute type description container nsisupports domdocument nsidomdocument enablerendering boolean obsolete since gecko 2.0 historyentry nsishentry get the history entry that this viewer will save itself into when destroyed.
...[noscript,notxpcom,nostdcall] void setnavigationtiming( in nsdomnavigationtimingptr atiming ); parameters atiming missing description return value missing description setpagemode() void setpagemode( in boolean apagemode, in nsiprintsettings aprintsettings ); parameters apagemode missing description aprintsettings missing description show() void show(); parameters none.
nsIDebug
assertion() shows an assertion and triggers optional behavior based on the xpcom_debug_break environment variable, defaulting to calling break() on windows and os/2 and warning on other platforms.
... warning() shows a warning.
nsIFileView
showhiddenfiles boolean if true hidden files will be shown.
... showonlydirectories boolean if true only directory entries will be returned.
nsILivemarkService
name the name to show when displaying the livemark.
... name the name to show when displaying the livemark.
nsIMemoryReporter
note: the amount field should be given a value 100 times the actual percentage; this number will be divided by 100 when shown.
... this allows a fractional percentage to be shown even though amount is an integer.
nsIMessenger
withoutwarning if true, no warning is shown to the user before the delete.
... withoutwarning if true, no warning is shown to the user before the delete.
nsIMsgHeaderParser
exceptions thrown missing exception missing description native code only!unquotephraseoraddr this function removes the quoting if you want to show the names to users.
... preserveintegrity set to true, quote will not be removed return value user friendly names exceptions thrown missing exception missing description unquotephraseoraddrwstring() this function removes the quoting if you want to show the names to users.
nsISound
event_menu_popup 6 a popup menu is shown.
... _moz_menupopup the system sound when a popup menu is shown.
nsIUpdateItem
ring id, in astring version, in astring installlocationkey, in astring minappversion, in astring maxappversion, in astring name, in astring downloadurl, in astring xpihash, in astring iconurl, in astring updateurl, in astring updatekey, in long type, in astring targetappid); attributes attribute type description iconurl astring the url of the icon that can be shown for this item.
... iconurl the url of the icon that can be shown for the item.
nsIWebProgressListener
location_change_error_page 0x00000002 this flag indicates that awebprogress redirected from the requested document to an internal page to show error status, such as about:neterror, about:certerror and so on.
... this example here shows you how to detect what flags are popping up where.
nsIXPConnect
nsistackframe createstackframelocation(in pruint32 alanguage, in string afilename, in string afunctionname, in print32 alinenumber, in nsistackframe acaller); void debugdump(in short depth); void debugdumpevalinjsstackframe(in pruint32 aframenumber, in string asourcetext); void debugdumpjsstack(in prbool showargs, in prbool showlocals, in prbool showthisprops); void debugdumpobject(in nsisupports acomobj, in short depth); [noscript,notxpcom] prbool definedomquickstubs(in jscontextptr cx, in jsobjectptr proto, in pruint32 flags, in pruint32 interfacecount, [array, size_is(interfacecount)] in nsiidptr interfacearray); jsval evalinsandboxobject(in astring source, in jscontextp...
... description exceptions thrown missing exception missing description debugdumpevalinjsstackframe() void debugdumpevalinjsstackframe( in pruint32 aframenumber, in string asourcetext ); parameters aframenumber missing description asourcetext missing description exceptions thrown missing exception missing description debugdumpjsstack() void debugdumpjsstack( in prbool showargs, in prbool showlocals, in prbool showthisprops ); parameters showargs missing description showlocals missing description showthisprops missing description exceptions thrown missing exception missing description debugdumpobject() void debugdumpobject( in nsisupports acomobj, in short depth ); parameters acomobj missing description depth missing description ...
nsIZipWriter
what it does is shows a file picker dialog and asks you to pick a folder.
..._sync: 0x40, pr_excl: 0x80}; //https://developer.mozilla.org/docs/pr_open#parameters var fu = cu.import('resource://gre/modules/fileutils.jsm').fileutils; var fp = cc['@mozilla.org/filepicker;1'].createinstance(ci.nsifilepicker); fp.init(window, 'select directory to compile', ci.nsifilepicker.modegetfolder); fp.appendfilters(ci.nsifilepicker.filterall | ci.nsifilepicker.filtertext); var rv = fp.show(); if (rv == ci.nsifilepicker.returnok) { var dir = fp.file; //dir must exist, as the user selected it.
Setting HTTP request headers
it takes 3 parameters (as we've shown in the example code above).
...while the previous version we showed before was good for learning, in an actual real-world application, you'd probably want to code it more like the following.
XPCOM Thread Synchronization
quick reference: difference between nsautolock api and new api old construction note: this is deprecated code that is shown only to compare with approved code.
... } old usage note: this is deprecated code that is shown only to compare with approved code.
Troubleshooting XPCOM components registration
these parsing errors should show up in the error console if chrome errors are enabled.
...this will ensure that undefined symbols show an error at link time instead of failing at run time.
Cached compose window FAQ
we could just hide it on send, and then show it on the next compose.
... see http://bugzilla.mozilla.org/show_bug.cgi?id=104989 ...
Creating a gloda message query
you may also see new messages show up if new messages are indexed that meet the constraints.
... the max number of messages which are returned is governed by a preference: "mailnews.database.global.search.msg.limit" although you can deal with the messages as they show up via the listener, the list of messages in the collection is available in collection.items.
Gloda examples
a) show all messages in a conversation regardless of the folder in which they are stored, b) search messages by subject assuming that you have a message (glodamessage) in the conversation already, this is straight forward using glodamessage.conversation.getmessagescollection() alistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items...
...collection are purged from the system */ onitemsremoved: function _onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ onquerycompleted: function _onquerycompleted(acollection) { var items = acollection.items; for (msg of items) { alert(msg.subject); }; } }; collection = id_q.getcollection(mylistener); show all messages where the from, to and cc values include a specified email address at present there doesn't appear to be any way of going directly from an email address to email addresses that it involves.
Mail event system
in this example, there is a dialog open that shows properties for this folder including the message count.
...rhasfired = false; // the listening function that will react to changes function myonintpropertychanged(item, property, oldvalue, newvalue) { listenerhasfired=true; var propertystring = property.getunicode(); dump("onintpropertychanged has fired with property + " + propertystring + "!\n"); if (propertystring == "totalmessages") { totalmessageslistenerhasfired=true; //now show us visually var folder = item.queryinterface(components.interfaces.nsimsgfolder); dump("the folder " + folder.prettyname + " now has " + newvalue + " messages."); } else if (propertystring == "testproperty") { dump("recieved integer test property fired on folder " + folder.prettyname + " with values " + oldvalue + " and " + newvalue + "\n"); } // set up the ...
Building a Thunderbird extension 5: XUL
this shows how the thunderbird architecture allows extensions to modify the user experience without modifying the installation files.
...in the next section you will learn how to use javascript to modify your label so that it shows the current date.
Using the Multiple Accounts API
(you may have noticed that identities 2 and 3 are shared between a few accounts...more on that later) servers servers are show in the folder pane, and in any place where the user must browse or choose folders, such as the new folder dialog, search, filters, etc.
... the view shows a flat, unified view of all the servers.
Debugging Tips
printing cdata and ctype currently console.log doesn't show type information of cdata.
... running the following code shows only partial value information.
Blocking By Domain - Plugins
criteria in order to improve firefox security and performance, there are two major categories of sites mozilla may choose to add to plugin domain blocking: sites commonly embedded in a 3rd-party context web sites which are commonly embedded into other sites using iframes can have a large impact on browser security and also cause many sites to show plugin activation prompts.
...in order to improve site performance and reduce the number of plugin prompts that users see, popular sites that show unnecessary plugin prompts or slow the browser down with unnecessary plugins will be added to the plugin block list.
Flash Activation: Browser Comparison - Plugins
the user can click on the flash object or the location bar icon to activate flash: users have the choice to allow flash just for the current session, or to remember their choice: google chrome in-page ui is displayed when the site attempts to use flash without fallback content: a user can click the plugin element to show a prompt for allowing flash: if the site provides fallback content for an object element, chrome will display that content and will not prompt the user to enable flash.
...the user can click the flash object to show activation options: users have the choice to allow flash just for the current session, or to remember their choice: site authoring tips if a flash element is very small, hidden, or covered by other content, users will probably not notice that flash is required and will become confused.
DOM Inspector FAQ - Firefox Developer Tools
you can hide anonymous nodes in inspector by unchecking the view > show anonymous content menu item.
... the good news is, you can hide these whitespace nodes in inspector by unchecking the view > show whitespace nodes menu item.
DOM Property Viewer - Firefox Developer Tools
the left-hand side shows the property's name, and the right-hand side shows its value.
... refreshing the display if the dom changes you can hit the refresh button to update the display: filtering there is a search box within the toolbar: this filters the list to show only items which match the search term.
Debug worker threads - Firefox Developer Tools
the debugger shows the source code for all running worker threads — web workers, service workers, etc.
... you can set a breakpoint (or logpoint) on any active worker thread: when execution is paused in a worker thread, the context of the debugger is updated to show the correct breakpoints, call stack, etc., just as you'd expect.
Search - Firefox Developer Tools
for example, if i enter "load" when viewing the above list, i get the following: only the functions with load in their name are shown.
... if the string exists in any of the files in the project, the search will return a list showing a list by file and line number.
Set a breakpoint - Firefox Developer Tools
when you first choose to set a conditional breakpoint, a text entry line will appear into which you add the condition you want it to break on: once you've entered your condition and pressed enter/return, the line number will be highlighted in orange: breakpoints list once you've set some breakpoints, the breakpoints list in the right-hand column shows the filename and line number for each one: unsetting a breakpoint once a breakpoint has been set, you can unset it again in various ways: click on the line number highlight.
... note: there is also a new option in the context menu for the actual code in the source pane — hide inline preview/show inline preview — which allows you to turn the inline variables on/off.
Tutorial: Set a breakpoint - Firefox Developer Tools
this page shows how you can try out the debugger api yourself using firefox’s scratchpad.
... this shows how any number of debugger-based tools can observe a single web page simultaneously.
Eyedropper - Firefox Developer Tools
underneath the magnifying glass it shows the color value for the current pixel using whichever scheme you've selected in settings > inspector > default color unit: you can use it in one of two ways: to select a color from the page and copy it to the clipboard to change a color value in the inspector's rules view to a color you've selected from the page copying a color to the clipboard open the eyedropper in one of these two ways: select "eyedropper" under the "web developer" menu open the page inspector tab and click the eyedropper button in its toolbar as you move the mou...
... changing a color value in the rules view color values appearing in the inspector's rules view have color samples next to them: clicking the sample shows a color picker popup.
Basic operations - Firefox Developer Tools
the diff shows you where memory was allocated or freed between the two snapshots.
...the tool then shows you the differences between the two snapshots: when you're looking at a comparison, you can't use the dominators view or the tree map view.
Network Monitor - Firefox Developer Tools
the network monitor shows you all the network requests firefox makes (for example, when it loads a page, or due to xmlhttprequests), how long each request takes, and details of each request.
...when it first opens, the network monitor does not show request information.
Select an element - Firefox Developer Tools
the selected element is shown in the html pane and its css is displayed in the css pane.
... the highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: with the context menu to open the inspector and select an element immediately, activate the context menu over the element in the page and select "inspect element": with the html pane when the inspector is open, as you move the mouse around the elements listed in the html pane, the corresponding elements are highlighted in the page.
Select and highlight elements - Firefox Developer Tools
the selected element is shown in the html pane and its css is displayed in the css pane.
... the highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: with the context menu to open the inspector and select an element immediately, activate the context menu over the element in the page and select "inspect element": with the html pane when the inspector is open, as you move the mouse around the elements listed in the html pane, the corresponding elements are highlighted in the page.
Page inspector keyboard shortcuts - Firefox Developer Tools
enter return enter step forward through the attributes of a node tab tab tab step backward through the attributes of a node shift + tab shift + tab shift + tab (when an attribute is selected) start editing the attribute enter return enter hide/show the selected node h h h focus on the search box in the html pane ctrl + f cmd + f ctrl + f edit as html f2 f2 f2 stop editing html f2 / ctrl +enter f2 / cmd + return f2 / ctrl + enter copy the selected node's outer html ctrl + c cmd + c ctrl + c scroll the selected node into view s s s find...
... show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter or space open mdn reference page about current property (computed view only, when a property is selected) f1 f1 f1 open current css file in style editor (computed view only, when more information is shown for a property and a css f...
Paint Flashing Tool - Firefox Developer Tools
that's where the paint flashing tool helps: by showing you the areas that the browser repaints in response to an event, you can see whether it is repainting more than it needs to.
...the example below shows two different ways to move an element using a css transition.
Frame rate - Firefox Developer Tools
the frame rate graph in the performance tool shows you the frame rate over the course of a recording.
...the intensive javascript article shows how you can use strategies like this to fix responsiveness problems caused by long-running synchronous javascript.
Performance - Firefox Developer Tools
the tool then shows you an overview of the things the browser was doing to render your site over the profile, and a graph of the frame rate over the profile.
... you get four sub-tools to examine aspects of the profile in more detail: the waterfall shows the different operations the browser was performing, such as executing layout, javascript, repaints, and 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.
Responsive Design Mode - Firefox Developer Tools
on the right end of the screen, three buttons allow you to: camera button - take a screenshot settings button - opens the rdm settings menu close button - closes rdm mode and returns to regular browsing the settings menu includes the following commands: left-align viewport - when checked moves the rdm viewport to the left side of the browser window show user agent - when checked displays the user agent string the final two options define when the page is reloaded: reload when touch simulation is toggled: when this option is enabled, the page is reloaded whenever you toggle touch support.
...for example: developer toolbox with rdm you can show or hide the developer tools toolbox independently of toggling responsive design mode itself: while responsive design mode is enabled, you can continue browsing as you normally would in the resized content area.
IndexedDB - Firefox Developer Tools
note: the data shown in an indexeddb database is a snapshot of the data as it was when you opened the storage inspector tool.
... indexes — array of indexes present in the object store as shown below.
Style Editor - Firefox Developer Tools
this means that if you use, for example, sass, then the style editor will show you, and allow you to edit, sass files, rather than the css that is generated from them: for this to work, you must: use a css preprocessor that understands the source map revision 3 proposal.
... viewing original sources now, if you check "show original sources" in the style editor settings, the links next to css rules in the rules view will link to the original sources in the style editor.
AudioParam - Web APIs
examples first, a basic example showing a gainnode having its gain value set.
... var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var gainnode = audioctx.creategain(); gainnode.gain.value = 0; next, an example showing a dynamicscompressornode having some param values maniuplated.
Manipulating video using canvas - Web APIs
the document content the html document used to render this content is shown below.
... manipulating the video frame data the computeframe() method, shown below, is responsible for actually fetching a frame of data and performing the chroma-keying effect.
Applying styles and colors - Web APIs
the example below draws three different paths, demonstrating each of these three linejoin property settings; the output is shown above.
...the blue lines show where the start and endpoints for each of the lines in the zig-zag pattern are.
Basic usage of canvas - Web APIs
the rendering context the <canvas> element creates a fixed-size drawing surface that exposes one or more rendering contexts, which are used to create and manipulate the content shown.
...as shown here, it is initially blank.
Using channel messaging - Web APIs
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.
Channel Messaging API - Web APIs
examples we have published a channel messaging basic demo on github (run it live too), which shows a really simple single message transfer between a page and an embedded <iframe>.
... you can also see a multimessaging demo (run this live), which shows a slightly more complex setup that can send multiple messages between main page and iframe.
ConstantSourceNode.offset - Web APIs
to access the offset parameter's current value, access the parameter's value property, as shown in the syntax box above.
... example this example shows how to set up a constantsourcenode so its offset is used as the input to a pair of gainnodes; this snippet is derived from the complete example you can find in controlling multiple parameters with constantsourcenode.
Using light sensors - Web APIs
the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below.
...you are working in a dark environment'); bodybg.backgroundcolor="lightgrey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild.
Document.execCommand() - Web APIs
syntax document.execcommand(acommandname, ashowdefaultui, avalueargument) return value a boolean that is false if the command is unsupported or disabled.
... ashowdefaultui a boolean indicating whether the default user interface should be shown.
Document.popupNode - Web APIs
typically, this property will be checked during a popupshowing event handler for a context menu to initialize the menu based on the context.
...in these other cases, for example when calling the popup's showpopup method, you may wish to set the popupnode property directly beforehand.
Document - Web APIs
WebAPIDocument
globaleventhandlers.onshow is an eventhandler representing the code to be called when the show event is raised.
... mozilla also define some non-standard methods: document.execcommandshowhelp()obsolete since gecko 14 this method never did anything and always threw an exception, so it was removed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11).
Events and the DOM - Web APIs
the event interface itself is described, as well as the interfaces for event registration on nodes in the dom, and event listeners, and several longer examples that show how the various event interfaces relate to one another.
...the following simple example shows how an event object is passed to the event handler function, and can be used from within one such function.
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
the following figure shows the recently created text node object inside the document tree.
...the following figure shows the table object tree structure for the table created in the sample.
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
</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 characters didn’t exist at all: this is so that whitespace characters don't impact the layout of your page.
... the firefox devtools html inspector will highlight text nodes, and also show you exactly what area the elements are taking up — useful if you are wondering what is causing the problem, and are maybe thinking you've got some extra margin in there or something!
Element - Web APIs
WebAPIElement
show fired when a contextmenu event was fired on/bubbled to an element that has a contextmenu attribute.
... also available via the onshow property.
Comparison of Event Targets - Web APIs
for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitoriginaltarget will show the text node.
...r some reason <small> event.originaltarget</small> contains the target before retargetting (may contain anonymous targets)</td> </tr> </thead> <tr> <td id="target"></td> <td id="currenttarget"></td> <td id="relatedtarget"></td> <td id="explicitoriginaltarget"></td> <td id="originaltarget"></td> </tr> </table> <p>clicking on the text will show the difference between explicitoriginaltarget, originaltarget, and target</p> <script> function handleclicks(e) { document.getelementbyid('target').innerhtml = e.target; document.getelementbyid('currenttarget').innerhtml = e.currenttarget; document.getelementbyid('relatedtarget').innerhtml = e.relatedtarget; document.getelementbyid('explicitoriginaltarget').inn...
FileSystemEntry - Web APIs
chrome shows a read-only list of all the files and folders stored the origin of your app.
...the snippet below shows you how you can remove a file by name.
FontFace.display - Web APIs
WebAPIFontFacedisplay
swap period if the font face is still not loaded, the fallback font will be shown.
... failure period if the font face still is not loaded, the fallback font will be shown and no swap will occur.
FullscreenOptions.navigationUI - Web APIs
"show" the browser will present page navigation controls and possibly other user interface; the dimensions of the element (and the perceived size of the screen) will be clamped to leave room for this user interface.
... let elem = document.documentelement; elem.requestfullscreen({ navigationui: "show" }).then({}).catch(err => { alert(`an error occurred while trying to switch into full-screen mode: ${err.message} (${err.name})`); }); the promise's resolve handler does nothing, but if the promise is rejected, an error message is displayed by calling alert().
Using the Gamepad API - Web APIs
for example, the first code example above you be rewritten as shown below: window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; console.log("gamepad connected at index %d: %s.
...gp = gamepads[0]; if (buttonpressed(gp.buttons[0])) { b--; } else if (buttonpressed(gp.buttons[2])) { b++; } if (buttonpressed(gp.buttons[1])) { a++; } else if (buttonpressed(gp.buttons[3])) { a--; } ball.style.left = a * 2 + "px"; ball.style.top = b * 2 + "px"; start = requestanimationframe(gameloop); } complete example: displaying gamepad state this example shows how to use the gamepad object, as well as the gamepadconnected and gamepaddisconnected events in order to display the state of all gamepads connected to the system.
Using the Geolocation API - Web APIs
if sucessful, the available hyperlink is populated with an openstreetmap.org url that will show their location.
... body { padding: 20px; background-color:#ffffc9 } button { margin: .5rem 0; } html <button id = "find-me">show my location</button><br/> <p id = "status"></p> <a id = "map-link" target="_blank"></a> javascript function geofindme() { const status = document.queryselector('#status'); const maplink = document.queryselector('#map-link'); maplink.href = ''; maplink.textcontent = ''; function success(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; status.textcontent = ''; maplink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; maplink.textcontent = `latitude: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve ...
Geolocation API - Web APIs
if sucessful, the available hyperlink is populated with an openstreetmap.org url that will show their location.
... body { padding: 20px; background-color:#ffffc9 } button { margin: .5rem 0; } html <button id = "find-me">show my location</button><br/> <p id = "status"></p> <a id = "map-link" target="_blank"></a> javascript function geofindme() { const status = document.queryselector('#status'); const maplink = document.queryselector('#map-link'); maplink.href = ''; maplink.textcontent = ''; function success(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; status.textcontent = ''; maplink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; maplink.textcontent = `latitude: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve ...
GlobalEventHandlers.onanimationcancel - Web APIs
we'll use this to show information about the events we receive.
... function handlecancelevent(event) { log("animation canceled", event); }; then we add a method to handle toggle display between "flex" and "none" and establish it as the handler for a click event on the "hide/show" the box button: document.getelementbyid('togglebox').addeventlistener('click', function() { if (box.style.display == "none") { box.style.display = "flex"; document.getelementbyid("togglebox").innerhtml = "hide the box"; } else { box.style.display = "none"; document.getelementbyid("togglebox").innerhtml = "show the box"; } }); toggling the box to display: none has the eff...
GlobalEventHandlers.onmousedown - Web APIs
html <div class="container"> <div class="view" hidden></div> <img src="https://udn.realityripple.com/samples/90/a34a525ace.jpg"> </div> css .container { width: 320px; height: 213px; background: black; } .view { position: absolute; width: 100px; height: 100px; background: white; border-radius: 50%; } img { mix-blend-mode: darken; } javascript function showview(event) { view.removeattribute('hidden'); view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; event.preventdefault(); } function moveview(event) { view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; } function hideview(event) { view.setattribute('hidden', ''); } const container = document.queryselector('...
....container'); const view = document.queryselector('.view'); container.onmousedown = showview; container.onmousemove = moveview; document.onmouseup = hideview; result specification specification status comment html living standardthe definition of 'onmousedown' in that specification.
GlobalEventHandlers.onmousemove - Web APIs
ound: #ffd; border: 1px #886 solid; border-radius: 5px; } javascript const tooltip = new (function() { const node = document.createelement('div'); node.classname = 'tooltip'; node.setattribute('hidden', ''); document.body.appendchild(node); this.follow = function(event) { node.style.left = event.clientx + 20 + 'px'; node.style.top = event.clienty + 10 + 'px'; }; this.show = function(event) { node.textcontent = event.target.dataset.tooltip; node.removeattribute('hidden'); }; this.hide = function() { node.setattribute('hidden', ''); }; })(); const links = document.queryselectorall('a'); links.foreach(link => { link.onmouseover = tooltip.show; link.onmousemove = tooltip.follow; link.onmouseout = tooltip.hide; }); result draggable elemen...
...ts we also have an example available showing the use of the onmousemove event handler with draggable objects — view the example in action.
HTMLCanvasElement.toDataURL() - Web APIs
color in this example): html <img class="grayscale" src="mypicture.png" alt="description of my picture" /> javascript window.addeventlistener('load', removecolors); function showcolorimg() { this.style.display = 'none'; this.nextsibling.style.display = 'inline'; } function showgrayimg() { this.previoussibling.style.display = 'inline'; this.style.display = 'none'; } function removecolors() { var aimages = document.getelementsbyclassname('grayscale'), nimgslen = aimages.length, ocanvas = document.createelement('canvas'), octx = ocanvas.getconte...
...etimagedata(0, 0, nwidth, nheight); apix = oimgdata.data; npixlen = apix.length; for (npixel = 0; npixel < npixlen; npixel += 4) { apix[npixel + 2] = apix[npixel + 1] = apix[npixel] = (apix[npixel] + apix[npixel + 1] + apix[npixel + 2]) / 3; } octx.putimagedata(oimgdata, 0, 0); ograyimg = new image(); ograyimg.src = ocanvas.todataurl(); ograyimg.onmouseover = showcolorimg; ocolorimg.onmouseout = showgrayimg; octx.clearrect(0, 0, nwidth, nheight); ocolorimg.style.display = "none"; ocolorimg.parentnode.insertbefore(ograyimg, ocolorimg); } } specifications specification status comment html living standardthe definition of 'htmlcanvaselement.todataurl' in that specification.
HTMLDialogElement.close() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
...cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script> note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLDialogElement.returnValue - Web APIs
examples the following example displays a button to open a <dialog> containing a form via the showmodal() method.
...put(returnvalue) { if (returnvalue === 'cancel' || returnvalue == null) { // user canceled the dialog, do nothing } else if (returnvalue === 'confirm') { // user chose a favorite animal, do something with it } } // “update details” button opens the <dialog> modally updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); handleuserinput(dialog.returnvalue); }); })(); </script> note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLImageElement - Web APIs
htmlimageelement.naturalheight read only returns an integer value representing the intrinsic height of the image in css pixels, if it is available; else, it shows 0.
... htmlimageelement.naturalwidth read only an integer value representing the intrinsic width of the image in css pixels, if it is available; otherwise, it will show 0.
HTMLTrackElement - Web APIs
htmltrackelement.readystate read only returns an unsigned short that show the readiness state of the track: constant value description none 0 indicates that the text track's cues have not been obtained.
...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).
File drag and drop - Web APIs
the following code snippet shows how this is done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior.
... this example shows how to write the name of each dragged file to the console.
ImageCapture.grabFrame() - Web APIs
it shows how to use the promise returned by grabframe() to copy the returned frame to a <canvas> element.
... for simplicy it does not show how to instantiate the imagecapture object.
ImageCapture.takePhoto() - Web APIs
it shows how to use the promise returned by takephoto() to copy the returned blob to an <img> element.
... for simplicy it does not show how to instantiate the imagecapture object.
ImageCapture - Web APIs
this example shows, roughly, a mediastreamtrack extracted from a device's mediastream.
...finally, it shows how to apply the results of these calls to a canvas object.
Browser storage limits and eviction criteria - Web APIs
note: in firefox, you can find your profile folder by entering about:support in the url bar, and pressing the show in...
... button (e.g., show in finder on mac os x) next to the profile folder title.
Timing element visibility with the Intersection Observer API - Web APIs
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="#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.
... finally, we set the id of the <div> which will show the timer we'll present in the ad to show how long it's been visible, giving it the class "timer".
Intersection Observer API - Web APIs
the code snippet below shows a callback which keeps a counter of how many times elements transition from not intersecting the root to intersecting by at least 75%.
...at timing element visibility with the intersection observer api, you can find a more extensive example showing how to time how long a set of elements (such as ads) are visible to the user and to react to that information by recording statistics or by updating elements..
Key Values - Web APIs
gdk_key_cancel (0xff69) "contextmenu" [3] shows the context menu.
... keycode_tv_audio_description_mix_up (253) "tvcontentsmenu" displays or hides the media contents available for playback (this may be a channel guide showing the currently airing programs, or a list of media files to play).
KeyboardEvent.which - Web APIs
example <html> <head> <title>charcode/keycode/which example</title> <script type="text/javascript"> function showkeypress(evt) { alert("onkeypress handler: \n" + "keycode property: " + evt.keycode + "\n" + "which property: " + evt.which + "\n" + "charcode property: " + evt.charcode + "\n" + "character key pressed: " + string.fromcharcode(evt.charcode) + "\n" ); } function keydown(evt) { alert("onkeydown handler: \n" + "keycode property: " + evt.keycode + "\n" ...
...+ "which property: " + evt.which + "\n" ); } </script> </head> <body onkeypress="showkeypress(event);" onkeydown="keydown(event);" > <p>please press any key.</p> </body> </html> specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.which' in that specification.
LargestContentfulPaint - Web APIs
examples the following example shows how to create a performanceobserver that listens for largest-contentful-paint entries and logs the lcp value to the console.
...// https://bugs.webkit.org/show_bug.cgi?id=209216 try { let lcp; const po = new performanceobserver((entrylist) => { const entries = entrylist.getentries(); const lastentry = entries[entries.length - 1]; // update `lcp` to the latest value, using `rendertime` if it's available, // otherwise using `loadtime`.
LayoutShift - Web APIs
examples the following example shows how to capture layout shifts and log them to the console.
...// https://bugs.webkit.org/show_bug.cgi?id=209216 try { let cumulativelayoutshiftscore = 0; const observer = new performanceobserver((list) => { for (const entry of list.getentries()) { // only count layout shifts without recent user input.
Locks.mode - Web APIs
WebAPILockmode
example the following examples show how the mode property is passed in the call to lockmanager.request().
... // should show "exclusive" (the default) navigator.locks.request("my_resource", show_lock_properties); // should show "exclusive" navigator.locks.request("my_resource", {mode: "exclusive"}, show_lock_properties); // should show "shared" navigator.locks.request("my_resource", {mode: "shared"}, show_lock_properties); function show_lock_properties(lock) { console.log(`the lock name is: ${lock.name}`); console.log(`the lock mode is: ${lock.mode}`); } specifications specification status comment web locks apithe definition of 'mode' in that specification.
Locks.name - Web APIs
WebAPILockname
example the following examples show how the name property passed in the call to lockmanager.request().
... navigator.locks.request("net_db_sync", show_lock_properties); function show_lock_properties(lock) { console.log(`the lock name is: ${lock.name}`); console.log(`the lock mode is: ${lock.mode}`); } specifications specification status comment web locks apithe definition of 'name' in that specification.
Lock - Web APIs
WebAPILock
examples the following examples show how the mode and name properties are passed in the call to lockmanager.request().
... navigator.locks.request("net_db_sync", show_lock_properties); navigator.locks.request("another_lock", {mode: "shared"}, show_lock_properties); function show_lock_properties(lock) { console.log(`the lock name is: ${lock.name}`); console.log(`the lock mode is: ${lock.mode}`); } specifications specification status comment web locks apithe definition of 'lock' in that specification.
LockManager.request() - Web APIs
examples general example the following example shows the basic use of the request() method with an asynchronous function as the callback.
...}); mode example the following example shows how to use the mode option for readers and writers.
MediaDevices.getUserMedia() - Web APIs
browsers are required to display an indicator that shows that a camera or microphone is in use, above and beyond any hardware indicator that may exist.
... they must also show an indicator that permission has been granted to use a device for input, even if the device is not actively recording at the moment.
MediaRecorder.onerror - Web APIs
stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { return err.name; /* return the error name */ } recorder.ondataavailable = function(event) { bufferlist.push(event.data); }; recorder.onerror = function(event) { let error = event.error; switch(error.name) { case invalidstateerror: shownotification("you can't record the video right " + "now.
... try again later."); break; case securityerror: shownotification("recording the specified source " + "is not allowed due to security " + "restrictions."); break; default: shownotification("a problem occurred while trying " + "to record the video."); break; } }; /* this would be a good place to create a worker to handle writing the buffers to disk periodically */ recorder.start(100); /* 100ms time slices per buffer */ return recorder; } specifications specification status comment mediastream recordingthe definition of 'mediarecorder.onerror' in that specification.
Recording a media element - Web APIs
notice that the playback panel doesn't have autoplay set (so the playback doesn't start as soon as media arrives), and it has controls set, which tells it to show the user controls to play, pause, and so forth.
... result when put all together with the rest of the html and the css not shown above, it looks and works like this: you can take a look at all the code, including the parts hidden above because they aren't critical to the explanation of how the apis are being used.
Transcoding assets for Media Source Extensions - Web APIs
this article takes you through the requirements and shows you a toolchain you can use to encode your assets appropriately.
... run the following commands (shown with sample output): $ python mp4-dash-encode.py -b 5 -v bunny_fragmented.mp4 encoding 5 bitrates, min bitrate = 500.0 max bitrate = 2000.0 media source: video: resolution=640x360 encoding bitrate: 500, resolution: 256x144 encoding bitrate: 875, resolution: 384x216 encoding bitrate: 1250, resolution: 480x270 encoding bitrate: 1625, resolution: 560x316 encoding bitrate: 2000, resolution: 640x360...
MouseEvent.pageX - Web APIs
WebAPIMouseEventpageX
let's take a look at a simple example that shows you the mouse's position relative to the page's origin.
... css the css used for this example is shown below.
Navigator.sendBeacon() - Web APIs
the following example shows theoretical analytics code that attempts to submit data to a server with a synchronous xmlhttprequest in an unload handler.
... the following example shows a theoretical analytics code pattern that submits data to a server using the sendbeacon() method.
Node.firstChild - Web APIs
WebAPINodefirstChild
<p id="para-01"> <span>first span</span> </p> <script> var p01 = document.getelementbyid('para-01'); console.log(p01.firstchild.nodename); </script> in the above, the console will show '#text' because a text node is inserted to maintain the whitespace between the end of the opening <p> and <span> tags.
... <p id="para-01"><span>first span</span></p> <script> var p01 = document.getelementbyid('para-01'); console.log(p01.firstchild.nodename); </script> now the console will show 'span'.
NodeFilter.acceptNode() - Web APIs
example var nodeiterator = document.createnodeiterator( // node to use as root document.getelementbyid('someid'), // only consider nodes that are text nodes (nodetype 3) nodefilter.show_text, // object containing the function to use for the acceptnode method // of the nodefilter { acceptnode: function(node) { // logic to determine whether to accept, reject or skip node // in this case, only accept nodes that have content // other than whitespace if ( !
... /^\s*$/.test(node.data) ) { return nodefilter.filter_accept; } } }, false ); // show the content of every non-empty text node that is a child of root var node; while ((node = iterator.nextnode())) { alert(node.data); } specifications specification status comment domthe definition of 'nodefilter.acceptnode()' in that specification.
NodeFilter - Web APIs
example const nodeiterator = document.createnodeiterator( // node to use as root document.getelementbyid('someid'), // only consider nodes that are text nodes (nodetype 3) nodefilter.show_text, // object containing the function to use for the acceptnode method // of the nodefilter { acceptnode: function(node) { // logic to determine whether to accept, reject or skip node // in this case, only accept nodes that have content // other than whitespace if ( !
... /^\s*$/.test(node.data) ) { return nodefilter.filter_accept } } }, false ); // show the content of every non-empty text node that is a child of root let node; while ((node = nodeiterator.nextnode())) { alert(node.data) } specifications specification status comment domthe definition of 'nodefilter' in that specification.
NodeIterator.expandEntityReferences - Web APIs
this takes precedence over the value of the nodeiterator.whattoshow method and the associated filter.
... syntax expand = nodeiterator.expandentityreferences; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); expand = nodeiterator.expandentityreferences; specifications specification status comment document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.expandentityreferences' in that specification.
Notification - Web APIs
notification.onshow a handler for the show event.
...} we no longer show a live sample on this page, as chrome and firefox no longer allow notification permissions to be requested from cross-origin <iframe>s, with other browsers to follow.
Notifications API - Web APIs
concepts and usage on supported platforms, showing a system notification generally involves two things.
... service worker additions serviceworkerregistration includes the serviceworkerregistration.shownotification() and serviceworkerregistration.getnotifications() method, for controlling the display of notifications.
OrientationSensor.populateMatrix() - Web APIs
the rotation matrix is shown below.
...this is not something that would ever be shown to a user.
OrientationSensor - Web APIs
this is not something that would ever be shown to a user.
...the rotation maxtrix is shown below.
PageTransitionEvent - Web APIs
the pagetransitionevent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.
... example html <!doctype html> <html> <body> </body> </html> javascript window.addeventlistener('pageshow', myfunction); function myfunction(event) { if (event.persisted) { alert("the page was cached by the browser"); } else { alert("the page was not cached by the browser"); } } specifications specification status comment html living standardthe definition of 'pagetransitionevent' in that specification.
PaymentItem - Web APIs
this can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth.
... the user agent may show this information but is not required to do so.
PaymentRequest: merchantvalidation event - Web APIs
request.addeventlistener("merchantvalidation", event => { event.complete(async () => { const merchantserverurl = window.location.origin + '/validate?url=' + encodeuricomponent(event.validationurl); // get validation data, and complete validation; return await fetch(merchantserverurl).then(response => response.text()); }, false); }; const response = await request.show(); how merchant server handles the validation depends on the server implementation and payment method documentation.
... up the handler for this event: request.onmerchantvalidation = event => { event.complete(async () => { const merchantserverurl = window.location.origin + '/validate?url=' + encodeuricomponent(event.validationurl); // get validation data, and complete validation; return await fetch(merchantserverurl).then(response => response.text()); }); }; const response = await request.show(); for more information, see merchant validation in payment processing concepts.
PaymentRequest.onshippingaddresschange - Web APIs
to make sure an updated address is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show().
...var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('shippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of clarity.
PaymentRequest: paymentmethodchange event - Web APIs
this code creates a new paymentrequest, adds a handler for the paymentmethodchange event by calling the request's addeventlistener(), then calls show() to present the payment interface to the user.
... const options = { requestshipping: true }; const paymentrequest = new paymentrequest(paymentmethods, detailsforshipping("ground"), options); paymentrequest.addeventlistener("paymentmethodchange", handlepaymentchange, false); paymentrequest.show() .then(response => response.complete("success")) .catch(err => console.log("error handling payment request: " + err)); the event handler function itself, handlepaymentchange(), looks like this: handlepaymentchange = event => { const detailsupdate = {}; if (event.methodname === "https://apple.com/apple-pay") { const servicefeeinfo = calculateservicefee(event.methoddetails); object...
PaymentResponse.details - Web APIs
syntax var detailsobject = paymentresponse.details; example the following example extracts the details from the paymentresponse object to the promise returned from paymentrequest.show().
... payment.show().then(paymentresponse => { var paymentdata = { // payment method string method: paymentresponse.methodname, // payment details as you requested details: paymentresponse.details, // shipping address information address: todict(paymentresponse.shippingaddress) }; // send information to the server }); specifications specification status comment payment request api candidate recommendation initial definition.
PaymentResponse.methodName - Web APIs
example the following example extracts the method name from the paymentresponse object to the promise returned from paymentrequest.show().
... payment.show().then(paymentresponse => { var paymentdata = { // payment method string method: paymentresponse.methodname, // payment details as you requested details: paymentresponse.details, // shipping address information address: todict(paymentresponse.shippingaddress) }; // send information to the server }); specifications specification status comment payment request api candidate recommendation initial definition.
performance.clearMarks() - Web APIs
return value void example the following example shows both uses of the clearmarks() method.
... // create a small helper to show how many performancemark entries there are.
performance.clearMeasures() - Web APIs
return value void example the following example shows both uses of the clearmeasures() method.
... // create a small helper to show how many performancemeasure entries there are.
PerformanceEntry.entryType - Web APIs
syntax var type = entry.entrytype; return value the return value depends on the subtype of the performanceentry object and affects the value of the performanceentry.name property as shown by the table below.
... longtask performancelongtasktiming domstring reports instances of long tasks example the following example shows the use of the entrytype property.
PerformanceEntry.name - Web APIs
syntax var name = entry.name; return value the return value depends on the subtype of the performanceentry object and the value of performanceentry.entrytype, as shown by the table below.
... example the following example shows the use of the name property.
PerformanceEventTiming - Web APIs
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.processingstart - entry.starttime; // synchronous event processing time (between s...
...// 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.
Using the Performance API - Web APIs
the following code example shows the use of domhighrestimestamp and the performance.now() method.
...vigation = perf.navigation; o.innerhtml += "<p>peformance.navigation = " + json.stringify(navigation) + "</p>"; } } specifications the interfaces described in this document are defined in the high resolution time standard which has two levels: high-resolution time level 2; editors draft; work in progress high-resolution time; w3c recommendation 17 december 2012 interoperability as shown in the performance interface's browser compatibility table, most of the performance interfaces are broadly implemented by desktop browsers.
Permissions.query() - Web APIs
WebAPIPermissionsquery
uservisibleonly: (push only, not supported in firefox — see the browser support section below) indicates whether you want to show a notification for every message or be able to send silent push notifications.
... example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state == 'granted') { showlocalnewswithgeolocation(); } else if (result.state == 'prompt') { showbuttontoenablelocalnews(); } // don't do anything if the permission was denied.
Using the Permissions API - Web APIs
the geolocation.getcurrentposition() function is then run, which prompts the user for permission; it runs the revealposition() function if permission is granted (which shows the map), or the positiondenied() function if permission is denied (which makes the "enable geolocation" button appear).
... chrome: hamburger menu > settings > show advanced settings.
Pointer events - Web APIs
the following example shows pointer capture being set on an element.
...</div> </body> </html> the following example shows a pointer capture being released (when a pointercancel event occurs.
RTCError - Web APIs
WebAPIRTCError
datachannel.addeventlistener("error", (event) => { let error = event.error; if (error.errordetail === "sdp-syntax-error") { let errline = error.sdplinenumber; let errmessage = error.message; let alertmessage = `a syntax error occurred interpreting line ${errline} of the sdp: ${errmessage}`; showmyalertmessage("data channel error", alertmessage); } else { terminatemyconnection(); } }); if the error is an sdp syntax error—indicated by its errordetail property being sdp-syntax-error—, a message string is constructed to present the error message and the line number within the sdp at which the error occurred.
... this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use.
RTCErrorEvent.error - Web APIs
datachannel.addeventlistener("error", (event) => { let error = event.error; if (error.errordetail === "sdp-syntax-error") { let errline = error.sdplinenumber; let errmessage = error.message; let alertmessage = `a syntax error occurred interpreting line ${errline} of the sdp: ${errmessage}`; showmyalertmessage("data channel error", alertmessage); } else { terminatemyconnection(); } }); if the error is an sdp syntax error—indicated by its errordetail property being sdp-syntax-error—, a message string is constructed to present the error message and the line number within the sdp at which the error occurred.
... this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use.
RTCPeerConnection.createDataChannel() - Web APIs
examples this example shows how to create a data channel and set up handlers for the open and message events to send and receive messages on it (for brievity, the example assumes onnegotiationneeded is set up).
...ata); } } alternatively, more symmetrical out-of-band negotiation can be used, using an agreed-upon id (0 here): // both sides var pc = new rtcpeerconnection(options); var channel = pc.createdatachannel("chat", {negotiated: true, id: 0}); channel.onopen = function(event) { channel.send('hi!'); } channel.onmessage = function(event) { console.log(event.data); } for a more thorough example showing how the connection and channel are established, see a simple rtcdatachannel sample.
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
the findreportentry() function shown below examines an rtcstatsreport, returning the rtcstats-based statistics record which contains the specified key — and for which the key has the specified value.
... the remainder of the networkteststop() function constructs the html used to display the output of the collected and computed results to the user, then append it to the element statsbox, which we're using to show the status updates to the user.
ReadableStreamDefaultReader.read() - Web APIs
examples example 1 - simple example this example shows the basic api usage, but doesn't try to deal with complications like stream chunks not ending on line boundaries for example.
...current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } example 2 - handling text line by line this example shows how you might fetch a text file and handle it as a stream of text lines.
Resource Timing API - Web APIs
this would be a nice place to have a diagram showing the relationships between these segments of the resource loading time.
... implementation status as shown in the performanceresourcetiming interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers.
Screen Wake Lock API - Web APIs
it's a good idea to show some feedback on the interface to show if wake lock is active and a way for the user to disable it if they wish.
...sync () => { try { wakelock = await navigator.wakelock.request('screen'); // change up our interface to reflect wake lock active statuselem.textcontent = 'wake lock is active!'; } catch (err) { // if wake lock request fails - usually system related, such as battery statuselem.textcontent = `${err.name}, ${err.message}`; } } releasing wake lock the following example shows how to release the previously acquired wake lock.
ServiceWorkerRegistration - Web APIs
serviceworkerregistration.shownotification() displays the notification with the requested title.
... notifications api living standard adds the shownotification() method and the getnotifications() method.
Storage Access API - Web APIs
</iframe> the api is designed to limit the potential storage exceptions to origins for which the user has shown an intent to interact.
...prompting heuristics currently vary across the two implementers of the storage access api — safari shows prompts for all embedded tracking content that has not previously received storage access, while firefox only prompts users after a tracking origin has requested storage access on more than a threshold number of sites.
TreeWalker.expandEntityReferences - Web APIs
this takes precedence over the value of the treewalker.whattoshow method and the associated filter.
... syntax expand = treewalker.expandentityreferences; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); expand = treewalker.expandentityreferences; specifications document object model (dom) level 2 traversal and range specificationthe definition of 'treewalker.expandentityreferences' in that specification.
UIEvent.layerX - Web APIs
WebAPIUIEventlayerX
examples <html> <head> <title>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: ...
...absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>this is an un-positioned div so clicking it will return layerx/layery values almost the same as pagex/pagey values.</span> </div> <div id="d2"> <span>this is a positioned div so clicking it will return layerx/layery values that are relative to the top-left corner of this positioned element.
UIEvent.layerY - Web APIs
WebAPIUIEventlayerY
example <html> <head> <title>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: ...
...absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>this is an un-positioned div so clicking it will return layerx/layery values almost the same as pagex/pagey values.</span> </div> <div id="d2"> <span>this is a positioned div so clicking it will return layerx/layery values that are relative to the top-left corner of this positioned element.
UIEvent.pageY - Web APIs
WebAPIUIEventpageY
example <html> <head> <title>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position:...
... absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>this is an un-positioned div so clicking it will return layerx/layery values almost the same as pagex/pagey values.</span> </div> <div id="d2"> <span>this is a positioned div so clicking it will return layerx/layery values that are relative to the top-left corner of this positioned element.
VTTCue() - Web APIs
WebAPIVTTCueVTTCue
text a domstring providing the text that will be shown during the time span indicated by starttime and endtime.
... example // create a cue that is shown from 2 to 3 seconds and uses the given text.
VTTCue - Web APIs
WebAPIVTTCue
example html <video controls src="https://udn.realityripple.com/samples/c6/f8a3489533.webm"></video> css video { width: 320px; height: 180px; } javascript let video = document.queryselector('video'); video.addeventlistener('loadedmetadata', () => { const track = video.addtexttrack("captions", "简体中文subtitles", "zh_cn"); track.mode = "showing"; const cuecn = new vttcue(0, 2.500, '字幕会在0至2.5秒间显示'); track.addcue(cuecn); const cueen = new vttcue(2.6, 4, 'subtitles will display between 2.6 and 4 seconds'); track.addcue(cueen); }); result chrome: please open in jsfiddle to view the live sample.
... embed live sample can not show subtitles in chrome.
VisualViewport - Web APIs
examples hiding an overlaid box on zoom this example, taken from the visual viewport readme, shows how to write a simple bit of code that will hide an overlaid box (which might contain an advert, say) when the user zooms in.
... var bottombar = document.getelementbyid('bottombar'); var viewport = window.visualviewport; function resizehandler() { if (viewport.scale > 1.3) bottombar.style.display = "none"; else bottombar.style.display = "block"; } window.visualviewport.addeventlistener('resize', resizehandler); simulating position: device-fixed this example, also taken from the visual viewport readme, shows how to use this api to simulate position: device-fixed, which fixes elements to the visual viewport.
Visual Viewport API - Web APIs
the visual viewport lets web developers solve this by positioning elements relative to what's shown on screen.
...it shows a function called viewporthandler().
Clearing with colors - Web APIs
« previousnext » an example showing how to clear a webgl rendering context to a solid color.
... <p>a very simple webgl program that shows some color.</p> <!-- text within a canvas element is displayed only if canvas is not supported.
Matrix math for the web - Web APIs
the style is not shown, but it's set to a fixed width and height and is centered on the page.
... let transformmatrix = mdn.multiplyarrayofmatrices([ rotatearoundzaxis(math.pi * 0.5), // step 3: rotate around 90 degrees translate(0, 200, 0), // step 2: move down 100 pixels scale(0.8, 0.8, 0.8), // step 1: scale down ]); view on jsfiddle finally, a fun step to show how matrices work is to reverse the steps to bring the matrix back to the original identity matrix.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
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.
... perfect negotiation with the updated api as shown in the section implementing perfect negotiation, we can eliminate this problem by introducing a variable (here called makingoffer) which we use to indicate that we are in the process of sending an offer, and making use of the updated setlocaldescription() method: let makingoffer = false; pc.onnegotiationneeded = async () => { try { makingoffer = true; await pc.setlocaldescription(); ...
Taking still photos with WebRTC - Web APIs
this article shows how to use webrtc to access the camera on a computer or mobile phone with webrtc support and take a photo with it.
... we also have an <img> element into which we will draw the image — this is the final display shown to the user.
WebRTC API - Web APIs
this guide shows how to do so.
... taking still photos with webrtc this article shows how to use webrtc to access the camera on a computer or mobile phone with webrtc support and take a photo with it.
Lighting a WebXR setting - Web APIs
reflection of light a diagram showing how the angle of reflection corresponds to the angle of incidence.
... a photo taken by nasa's cassini spacecraft showing specular reflection of light from a lake of liquid methane on the surface of saturn's moon titan.
Rendering and the WebXR frame animation callback - Web APIs
the division of time into 60 hz blocks with each block being used at least in part to render the scene is shown in the diagram below.
...as a result, you wind up with the visual effect of the top part of the screen showing the new frame, while the bottom part of the frame shows some combination of the previous frame and possibly even the frame before that one.
Migrating from webkitAudioContext - Web APIs
the example below shows old code which downloads an audio file over the network, and then decoded it using createbuffer(): var xhr = new xmlhttprequest(); xhr.open("get", "/path/to/audio.ogg", true); xhr.responsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { var decodedbuffer = context.createbuffer(xhr.response, false); if (decodedbuffer) { // decoding was successful, do something useful with the ...
... if you need to count the number of playing source nodes, you can maintain the count by handling the ended event on the source nodes, as shown above.
Visualizations with Web Audio API - Web APIs
draw(); this code gives us a result like the following: note: the examples listed in this article have shown usage of analysernode.getbytefrequencydata() and analysernode.getbytetimedomaindata().
... for working examples showing analysernode.getfloatfrequencydata() and analysernode.getfloattimedomaindata(), refer to our voice-change-o-matic-float-data demo (see the source code too) — this is exactly the same as the original voice-change-o-matic, except that it uses float data, not unsigned byte data.
Web Authentication API - Web APIs
figure 1 - a diagram showing the sequence of actions for a web authentication registration and the essential data associated with each action.
... figure 2 - similar to figure 1, a diagram showing the sequence of actions for a web authentication and the essential data associated with each action.
Window: popstate event - Web APIs
it happens after the new location has loaded (if needed), displayed, made visible, and so on, after the pageshow event is sent, but before the persisted user state information is restored and the hashchange event is sent.
... if new-entry's document is already fully loaded and ready—that is, its readystate is complete—and the document is not already visible, it's made visible and the pageshow event is fired at the document with the pagetransitionevent's persisted attribute set to true.
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
html <p>live example</p> <button onclick="delayedalert();">show an alert box after two seconds</button> <p></p> <button onclick="clearalert();">cancel alert before it happens</button> javascript var timeoutid; function delayedalert() { timeoutid = window.settimeout(window.alert, 2*1000, 'that was really slow!'); } function clearalert() { window.cleartimeout(timeoutid); } result see also cleartimeout() example.
...and as shown below, using call to set this doesn't work either.
Worker.prototype.postMessage() - Web APIs
example the following code snippet shows the creation of a worker object using the worker() constructor.
... transfer example this example shows a firefox add-on that transfers an arraybuffer from the main thread to the chromeworker, and then the chromeworker transfers it back to the main thread.
Using XMLHttpRequest - Web APIs
the download events are fired on the xmlhttprequest object itself, as shown in the above sample.
... the upload events are fired on 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.
XMLHttpRequest.mozBackgroundRequest - Web APIs
if true, no load group is associated with the request, with security dialogs prevented from being shown to the user.
... in cases in where a security dialog (such as authentication or a bad certificate notification) would normally be shown, this request fails instead.
XRInputSource.targetRaySpace - Web APIs
<<<--- needs diagram showing targetrayspace relative to gripspace and world space --->>> to obtain an xrspace representing the input controller's position and orientation in virtual space, use the gripspace property.
... example this fragment of code shows part of a function to be called once every frame.
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
examples below are some examples showing how to use getoffsetreferencespace().
...in this example, we'll show code that lets the user look around by right-clicking and moving the mouse to change the viewing angle.
XRSystem: devicechange event - Web APIs
this is shown in the example below.
... example the example shown here handles the devicechange event by toggling the availability of the "enter xr" button based on whether or not any immersive devices are currently available.
XRSystem: isSessionSupported() - Web APIs
if no session is already underway, we request the vr session and, if successful, set up the session in a method called onsessionstarted(), not shown.
...('immersive-vr') .then((issupported) => { if (issupported) { userbutton.addeventlistener('click', onbuttonclicked); userbutton.innerhtml = 'enter xr'; userbutton.disabled = false; } }); } function onbuttonclicked() { if (!xrsession) { navigator.xr.requestsession('immersive-vr') .then((session) => { xrsession = session; // onsessionstarted() not shown for reasons of brevity and clarity.
XRSystem: requestSession() - Web APIs
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().
...ersivebutton.innerhtml = 'enter xr'; immersivebutton.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; // onsessionstarted() not shown for reasons of brevity and clarity.
XRSystem - Web APIs
WebAPIXRSystem
examples the following example shows how to use both issessionsupported() and requestsession().
...ebutton.addeventlistener("click", onbuttonclicked); navigator.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(() => { // onsessionstarted() not shown for reasons of brevity and clarity.
XRTargetRayMode - Web APIs
the target ray can be anything from a simple line (ideally fading over distance) to an animated effect, such as the science-fiction "phaser" style shown in the screenshot above.
... examples this fragment of code shows part of a function to be called once every frame.
mssitemodejumplistitemremoved - Web APIs
the mssitemodejumplistitemremoved event occurs when mssitemodeshowjumplist is called and an item has been removed from a jump list by the user.
... syntax event property object.oncandidatewindowhide = handler; addeventlistener method object.addeventlistener("mssitemodejumplistitemremoved", handler, usecapture) general info synchronous no bubbles no cancelable no note this event is raised once for every item that has been removed since the last time mssitemodeshowjumplist was called.
Using the group role - Accessibility
examples example 1: using the group role with a html tree view the snippet below shows how the group role is added directly into the html source code.
.../> <span role="treeitem" tabindex="0">cats</span> </div> <div id="catgroup" role="group"> <div id="siamese" role="treeitem"> <span tabindex="-1">siamese</span> </div> <div id="tabby" role="treeitem"> <span tabindex="-1">tabby</span> </div> </div> </div> </div> example 2: using the group role with a html drop-down menu the snippet below shows how the group role is added directly into the html source code.
Using the link role - Accessibility
examples this example shows how to implement a fake link using a <span> element.
...but this shows that it can be done.
ARIA annotations - Accessibility
below we'll introduce the new features associated with aria annotations, and have a look at some code examples that show them in action.
...as an example, let’s say you have a poll/voting ui widget that shows numbers of votes, but you want to summarize the purpose of the widget in a clear description because the ui does not make it clear: <section aria-description="choose your favourite fruit — the fruit with the highest number of votes will be added to the lunch options next week."> <p>pick your favourite fruit:</p> <form> <ul> <li><label>apple: <input type="radio" name="fruit" valu...
ARIA: figure role - Accessibility
examples we could extend the initial example on the page to also identify a paragraph that provides a descriptive label for the figure by referencing its id in aria-labelledby: <div role="figure" aria-labelledby="figure-1"> <img src="diagram.png" alt="diagram showing the four layers of awesome and their relative priority order — music, cats, nature, and ice cream"> <pre><code> let awesome = ['music', 'cats', 'nature', 'ice cream']; </code></pre> <p id="figure-1">figure 1: the four layers of awesome.</p> </div> best practices only use role="figure" if you have to — for example if you don't have control over your html but are able...
...for example, our above example should be rewritten as follows: <figure> <img src="diagram.png" alt="diagram showing the four layers of awesome and their relative priority order — music, cats, nature, and ice cream"> <pre><code> let awesome = ['music', 'cats', 'nature', 'ice cream']; </code></pre> <figcaption>figure 1: the four layers of awesome.</figcaption> </figure> specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'figure' in that specification.
ARIA: listbox role - Accessibility
examples example 1: a single select listbox that uses aria-activedescendant the snippet below shows how the listbox role is added directly into the html source code.
...a non-active selection is often shown with a lighter background colour.
ARIA: textbox role - Accessibility
examples example 1: adding the role in the html code for single line input the snippet below shows how the textbox role is added directly into the html source code.
... <div role="textbox" contenteditable="true"></div> example 2: adding the role in the html code for multi-line input the snippet below shows how the textbox role is added directly into the html source code.
Web applications and ARIA FAQ - Accessibility
user interface library (yui) for more information about javascript toolkit accessibility: steve faulkner's wai-aria implementation in javascript ui libraries can you show me an example of aria in action?
...instead, use javascript to dynamically add aria to your page, as shown in the answer to can you show me an example of aria in action?
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
community member ben millard has pointed out in a blog post that controls can be embedded in labels as shown in the above example using html 4, simply by embedding the input into the label.
...it is very useful and shows that some techniques that have been available for years escape even the gurus sometimes.
Architecture - Accessibility
the new system makes it easier to show caret positions etc., which will be an improvement in ia2 over msaa.
...you can test this in a given editor by pressing the end key on a line, to see whether the caret is shown past the end of the line.
HTML To MSAA - Accessibility
remarks the table below shows how gecko maps html elements to msaa.
.../a n/a n/a n/a fieldset role_system_ grouping text equivalent from child legend element n/a n/a labelled_by (1003), points to legend element n/a n/a hr role_system_ separator n/a n/a n/a n/a n/a n/a img, input @type=image role_system_ graphic from @alt attribute, empty @alt attribute means name can't be calculated at all n/a state_system_ animated if image has more than one frame n/a "showlongdesc" if @longdesc attribute is presented n/a if @usemap attribute is used then image accessible has children for each map item input @type=button, submit, reset role_system_ pushbutton from @value attribute, @alt attribute, default label, @src attribute, @data attribute n/a state_system_ default if @type attribute has value "submit" n/a "press" n/a input @type=text, textarea role_system...
Accessibility Information for Web Authors - Accessibility
rather than providing a complex technical report, wave 4.0 shows the original web page with embedded icons and indicators that reveal the accessibility information within your page.
... this document tackles such difficulties and shows several interactive desktop-style widgets such as tree views, menu bars and spreadsheets which are accessible both with the keyboard and assistive technologies such as screen readers, screen magnifiers and alternative input devices.
Accessibility
here we'll show how to use it at a basic level to improve accessibility.
...this article shows how.
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
the -moz-force-broken-image-icon extended css property can be used to force the broken image icon to be shown even when a broken image has an alt attribute.
... syntax values <integer> a value of 1 means that the broken image icon is shown even if the image has an alt attribute.
-webkit-line-clamp - CSS: Cascading Style Sheets
in most cases you will also want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines.
... an ellipsis will be shown at the point where the text is clamped.
:-moz-ui-invalid - CSS: Cascading Style Sheets
however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid.
...see the :invalid pseudo-class for an example that shows how to override the default style.
:focus-visible - CSS: Cascading Style Sheets
(many browsers show a “focus ring” by default in this case.) this selector is useful to provide a different focus indicator based on the user’s input modality (mouse vs.
...ass="focus-only" value=":focus only"><br> <button class="focus-only">:focus only</button><br> <input class="focus-visible-only" value=":focus-visible only"><br> <button class="focus-visible-only">:focus-visible only</button> input, button { margin: 10px; } .focus-only:focus { outline: 2px solid black; } .focus-visible-only:focus-visible { outline: 4px dashed darkorange; } selectively showing the focus indicator a custom control, such as a custom element button, can use :focus-visible to selectively apply a focus indicator only on keyboard-focus.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
some css that's not important (the style of the "run" button itself) isn't shown here, for brevity.
... the following demo shows how you'd achieve the aforementioned javascript technique: .slidein { animation-duration: 5s; animation-name: slidein; animation-iteration-count: infinite; } .stopped { animation-name: none; } @keyframes slidein { 0% { margin-left: 0%; } 50% { margin-left: 50%; } 100% { margin-left: 0%; } } <h1 id="watchme">click me to stop</h1> let watchme = document.getel...
Using CSS animations - CSS: Cascading Style Sheets
receiving the events the events get delivered to the listener() function, which is shown below.
... the html just for the sake of completeness, here’s the html that displays the page content, including the list into which the script inserts information about the received events: <h1 id="watchme">watch me move</h1> <p> this example shows how to use css animations to make <code>h1</code> elements move across the page.
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
if your browser does not yet support these keywords both paragraphs will be rendered as normal paragraphs in block flow; the below screenshots show the expected rendering.
...after laying 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.
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
flex line wrapping is re-done after collapsing, however, so the cross-size of a flex container with multiple lines might or might not change.” - collapsed items this behaviour is useful if you want to target flex items using javascript to show and hide content for example.
...in the case of an item being shown and hidden it could well cause the items to end up in a different row.
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
i am using floats for older browsers and grid for new ones.</div> </div> the image below shows the media object in a non-supporting browser on the left, and a supporting one on the right: using feature queries the above example is very simple, and we can get away without needing to write code that would be a problem to browsers that do not support grid, and legacy code is not an issue to our grid supporting browsers.
...rd"><h2>five</h2> <p>we can use css grid to overwrite older methods.</p> </li> <li class="card"><h2>six</h2> <p>we can use css grid to overwrite older methods.</p> </li> </ul> </div> overwriting other values of display due to the problems of creating grids of items using floats, many of us would use a different method to the floated method shown above to layout a set of cards.
Grid template areas - CSS: Cascading Style Sheets
for example, if i wish to create the layout shown below i can identify four main areas.
..., auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" "sd sd sd ft ft ft ft ft ft"; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> </div> the value of grid-template-areas must show a complete grid, otherwise it is invalid (and the property is ignored).
Layout using named grid lines - CSS: Cascading Style Sheets
.item2 { grid-column: col-start 7 / span 3; } <div class="wrapper"> <div class="item1">i am placed from col-start line 1 to col-start 5</div> <div class="item2">i am placed from col-start line 7 spanning 3 lines</div> </div> if you take a look at this layout in the firefox grid highlighter you can see how the column lines are shown, and how our items are placed against these lines.
... .main-header, .main-footer { grid-column: col-start / span 12; } .side1 { grid-column: col-start / span 3; grid-row: 2; } .content { grid-column: col-start 4 / span 6; grid-row: 2; } .side2 { grid-column: col-start 10 / span 3; grid-row: 2; } once again, the grid highlighter is helpful to show us how the grid we have placed our items on works.
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
i would suggest at this point you should implement the new specification only, unless you have data to show a large number of users who would benefit from a fallback version.
...at some point browsers need to implement a spec to show that it works, and to discover any problems that only become apparent when the spec is in use alongside other properties in the real world.
Basic Shapes - CSS: Cascading Style Sheets
the firefox shapes inspector helpfully shows the reference box in use when you inspect a shape.
...the screenshot below shows the shape highlighted in the tool.
Using CSS transforms - CSS: Cascading Style Sheets
setting perspective this example shows a cube with the perspective set at different positions.
... changing the perspective origin this example shows cubes with popular perspective-origin values.
Pseudo-classes - CSS: Cascading Style Sheets
ure :focus :focus-visible :focus-within :has() :host :host() :host-context() :hover :indeterminate :in-range :invalid :is() :lang() :last-child :last-of-type :left :link :local-link :not() :nth-child() :nth-col() :nth-last-child() :nth-last-col() :nth-last-of-type() :nth-of-type() :only-child :only-of-type :optional :out-of-range :past :placeholder-shown :read-only :read-write :required :right :root :scope :state() :target :target-within :user-invalid :valid :visited :where() specifications specification status comment fullscreen api living standard defined :fullscreen.
... selectors level 4 working draft defined :any-link, :blank, :local-link, :scope, :drop, :current, :past, :future, :placeholder-shown, :user-invalid, :nth-col(), :nth-last-col(), :is() and :where().
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
in each case, we show what the source image looks like rendered in a 150x150 box, and provide a link to the svg source.
... note: the screenshots below show the expected rendering.
clip-path - CSS: Cascading Style Sheets
WebCSSclip-path
the clip-path css property creates a clipping region that sets what part of an element should be shown.
... parts that are inside the region are shown, while those outside are hidden.
contain - CSS: Cascading Style Sheets
WebCSScontain
rder: 3px solid black; } article { border: 1px solid black; } float interference if we were to insert another image at the bottom of the first article, a large portion of the dom tree may be re-laid out or repainted, and this would also interfere with the layout of the second article: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg" alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; } as you can see, because of the way floats work, the first image ends up inside the area of the second article: fixing with contain if...
... we give each article the contain property with a value of content, when new elements are inserted the browser understands it only needs to recalculate the containing element's subtree, and not anything outside it: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg" alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; contain: content; } this also means that the first image no longer floats down to the second article, and instead stays inside it's containing element's bounds: specifications specification status ...
cursor - CSS: Cascading Style Sheets
WebCSScursor
the cursor css property sets the type of mouse cursor, if any, to show when the mouse pointer is over an element.
... in some environments, an equivalent bidirectional resize cursor is shown.
line-height - CSS: Cascading Style Sheets
s below have the same resultant line height */ div { line-height: 1.2; font-size: 10pt; } /* number/unitless */ div { line-height: 1.2em; font-size: 10pt; } /* length */ div { line-height: 120%; font-size: 10pt; } /* percentage */ div { font: 10pt/1.2 georgia,"bitstream charter",serif; } /* font shorthand */ it is often more convenient to set line-height by using the font shorthand as shown above, but this requires the font-family property to be specified as well.
... prefer unitless numbers for line-height values this example shows why it is better to use <number> values instead of <length> values.
overflow - CSS: Cascading Style Sheets
WebCSSoverflow
in about:config, set layout.css.overflow.moz-scrollbars.enabled to true description overflow options include clipping, showing scrollbars, or displaying the content flowing out of its container into the surrounding area.
... p { overflow: scroll; /* always show scrollbars */ } overflow: scroll sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
scrollbar-color - CSS: Cascading Style Sheets
dark show a dark scrollbar, which can be either a dark variant of scrollbar provided by the platform, or a custom scrollbar with dark colors.
... light show a light scrollbar, which can be either a light variant of scrollbar provided by the platform, or a custom scrollbar with light colors.
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown.
... none no scrollbar shown, however the element will still be scrollable.
Used value - CSS: Cascading Style Sheets
example this example computes and displays the used width value of three elements (updates on resize): html <div id="no-width"> <p>no explicit width.</p> <p class="show-used-width">..</p> <div id="width-50"> <p>explicit width: 50%.</p> <p class="show-used-width">..</p> <div id="width-inherit"> <p>explicit width: inherit.</p> <p class="show-used-width">..</p> </div> </div> </div> css #no-width { width: auto; } #width-50 { width: 50%; } #width-inherit { width: inherit; } /* make results easier to see */ div { border:...
... 1px solid red; padding: 8px; } javascript function updateusedwidth(id) { var div = document.queryselector(`#${id}`); var par = div.queryselector('.show-used-width'); var wid = window.getcomputedstyle(div)["width"]; par.textcontent = `used width: ${wid}.`; } function updateallusedwidths() { updateusedwidth("no-width"); updateusedwidth("width-50"); updateusedwidth("width-inherit"); } updateallusedwidths(); window.addeventlistener('resize', updateallusedwidths); result difference from computed value css 2.0 defined only computed value as the last step in a property's calculation.
Cross-browser audio basics - Developer guides
such browsers can be covered using a simple link to the media file, as we showed earlier, or via a fallback written in a plugin technology such as adobe flash or microsoft silverlight.
... var myaudio = document.getelementbyid('my-audio'); var play = document.getelementbyid('play'); var pause = document.getelementbyid('pause'); // associate functions with the 'onclick' events play.onclick = playaudio; pause.onclick = pauseaudio; function playaudio() { myaudio.play(); } function pauseaudio() { myaudio.pause(); } } media loading events above we have shown how you can create a very simple audio player, but what if we want to show progress, buffering and only activate the buttons when the media is ready to play?
Rich-Text Editing in Mozilla - Developer guides
eftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextnode(odoc.innerhtml); odoc.innerhtml = ""; var opre = document.createelement("pre"); odoc.contenteditable = false; opre.id = "sourcetext"; opre.contenteditable = true; opre.appendchild(ocontent); odoc.appendchild(opre); }...
...meakqubgsuspvbsyfjjvds6njlb0khr4akbcmfscgbqaocwjf5gwquvyksfbwze+awibv0ghfog2ewidchjwriqo9e2fx4xd5r+b0ddaenbxbhbhn2dgwdaqfjjyvhcqyrfgoidgiqjawtcqmriwwmfgicnvcaaamoak+blaortluyt7i5uiuhads=" /> </div> <div id="textbox" contenteditable="true"><p>lorem ipsum</p></div> <p id="editmode"><input type="checkbox" name="switchmode" id="switchbox" onchange="setdocmode(this.checked);" /> <label for="switchbox">show html</label></p> <p><input type="submit" value="send" /></p> </form> </body> </html> note: if you want to see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example.
A hybrid approach - Developer guides
luckily, we aren’t technically constrained to using client-side techniques here: another option is to use server-side user-agent detection to show the user the proper content.
...for example, an often-criticized point about responsive web design is that full-resolution images are sent to all devices, including phones that show the images scaled down anyway.
User input and controls - Developer guides
simple pointer lock demo we've written a simple pointer lock demo to show you how to use it to set up a simple control system.
... contenteditable demo this is a working example showing how contenteditable can be used to create an editable document section, the state of which is then saved using localstorage.
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
it's generally used as a focus indicator, to show which element will receive input events.
... let's take a look at an example, starting by looking at the results we're trying to achieve: html the html responsible for creating the above example is shown here: <div class="wrapper"> <div class="box boxleft"> <p> this is the first box.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
additional line can be used to show building names and room numbers.
...for example: 〒381-0000 長野県長野市某町123 "〒" and following seven digits shows the postal code.
HTML attribute: step - HTML: Hypertext Markup Language
WebHTMLAttributesstep
as we included an invalid value, supporting browsers will show the value as invalid.
... the number spinner, if present, will only show valid float values of 1.2 and greater note: when the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and stepmismatch for more information.
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
examples all headings the following code shows all the heading levels, in use.
... <h1>heading level 1</h1> <h2>heading level 2</h2> <h3>heading level 3</h3> <h4>heading level 4</h4> <h5>heading level 5</h5> <h6>heading level 6</h6> here is the result of this code: example page the following code shows a few headings with some content under them.
<dfn>: The Definition element - HTML: Hypertext Markup Language
WebHTMLElementdfn
this is shown in the first example below.
... this is shown in the example under links to definitions below.
<img>: The Image Embed element - HTML: Hypertext Markup Language
WebHTMLElementimg
the above example shows usage of the <img> element: the src attribute is required, and contains the path to the image you want to embed.
... <img src="https://udn.realityripple.com/samples/6c/98485e5d8a.png" alt="mdn logo"> image link this example builds upon the previous one, showing how to turn the image into a link.
<input type="button"> - HTML: Hypertext Markup Language
WebHTMLElementinputbutton
the example below shows this in action.
... examples the below example shows a very simple drawing app created using a <canvas> element and some simple css and javascript (we'll hide the css for brevity).
<input type="email"> - HTML: Hypertext Markup Language
WebHTMLElementinputemail
then, as the user types, the list is filtered to show only matching values.
...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.
<input type="url"> - HTML: Hypertext Markup Language
WebHTMLElementinputurl
if maxlength exceeds size, the input box's contents will scroll as needed to show the current selection or insertion point as the content is manipulated.
...then, as the user types, the list is adjusted to show only matching values.
<link>: The External Resource Link element - HTML: Hypertext Markup Language
WebHTMLElementlink
target defines the frame or window name that has the defined linking relationship or that will show the rendering of any linked resource.
... rev the value of this attribute shows the relationship of the current document to the linked document, as defined by the href attribute.
<script>: The Script element - HTML: Hypertext Markup Language
WebHTMLElementscript
examples basic usage these examples show how to import (an external) script using the <script> element.
... <script src="javascript.js"></script> and the following examples show how to put (an inline) script inside the <script> element.
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
WebHTMLElementsummary
examples below are some examples showing <summary> in use.
... basic example a simple example showing the use of <summary> in a <details> element: <details open> <summary>overview</summary> <ol> <li>cash on hand: $500.00</li> <li>current invoice: $75.30</li> <li>due date: 5/6/19</li> </ol> </details> summaries as headings you can use heading elements in <summary>, like this: <details open> <summary><h4>overview</h4></summary> <ol> <li>cash on hand: $500.00</li> <li>current invoice: $75.30</li> <li>due date: 5/6/19</li> </ol> </details> this currently has some spacing issues that could be addressed using css.
<tr>: The Table Row element - HTML: Hypertext Markup Language
WebHTMLElementtr
basic example this simple example shows a table listing people's names along with various information about membership in a club or service.
... table { border: 1px solid black; } th, td { border: 1px solid black; } result row and column spanning now, let's introduce another column that shows the date the user's membership ended, along with a super-heading above the "joined" and "canceled" dates called "membership dates".
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementtt
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.
... permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes examples basic example this example uses <tt> to show text entered into, and output by, a terminal application.
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
WebHTMLElementu
here are some examples that show what you should do instead in several cases.
... non-semantic underlines to underline text without implying any semantic meaning, use a <span> element with the text-decoration property set to "underline", as shown below.
inputmode - HTML: Hypertext Markup Language
devices may or may not show a minus key (-).
...devices may or may not show a minus key.
itemscope - HTML: Hypertext Markup Language
<div itemscope itemtype="http://schema.org/movie"> <h1 itemprop="name">avatar</h1> <span>director: <span itemprop="director">james cameron</span> (born august 16, 1954)</span> <span itemprop="genre">science fiction</span> <a href="https://youtu.be/0ay1xikx7by" itemprop="trailer">trailer</a> </div> structured data the following table shows the structured data from the preceding example.
...try it on the html shown above.
Global attributes - HTML: Hypertext Markup Language
dragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting.
...this attribute must not be used to hide content that could legitimately be shown.
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
to ensure that your page uses full standards mode, make sure that your page has a doctype like in this example: <!doctype html> <html lang="en"> <head> <meta charset=utf-8> <title>hello world!</title> </head> <body> </body> </html> the doctype shown in the example, <!doctype html>, is the simplest possible, and the one recommended by html5.
...note however that serving your pages as application/xhtml+xml will cause internet explorer 8 to show a download dialog box for an unknown format instead of displaying your page, as the first version of internet explorer with support for xhtml is internet explorer 9.
HTTP authentication - HTTP
this page is an introduction to the http framework for authentication, and shows how to restrict access to your server using the http "basic" schema.
... in the case of a "basic" authentication like shown in the figure, the exchange must happen over an https (tls) connection to be secure.
MIME types (IANA media types) - HTTP
example reserved for use as a placeholder in examples showing how to use mime types.
... with the exception of multipart/form-data, used in the post method of html forms, and multipart/byteranges, used with 206 partial content to send part of a document, http doesn't handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a "save as" window if it doesn't know how to display the document).
Upgrade - HTTP
WebHTTPHeadersUpgrade
for example, the client might send a get request as shown, listing the preferred protocols to switch to (in this case "example/1" and "foo/2"): get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 note: connection: upgrade must be set whenever upgrade is sent.
... syntax connection: upgrade upgrade: protocol_name[/protocol_version] notes: the connection header with type upgrade must always be sent with the upgrade header (as shown above).
Enumerability and ownership of properties - JavaScript
enumerable properties show up in for...in loops unless the property's key is a symbol.
...there are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available.
Keyed collections - JavaScript
the following code shows some basic operations with a map.
... the following code shows some basic operations with a set.
Loops and iteration - JavaScript
the syntax of the continue statement looks like the following: continue [label]; example 1 the following example shows a while loop with a continue statement that executes when the value of i is 3.
... for (variable of object) statement the following example shows the difference between a for...of loop and a for...in loop.
Array.prototype.map() - JavaScript
value: 20}, {key: 3, value: 30}] let reformattedarray = kvarray.map(obj => { let robj = {} robj[obj.key] = obj.value return robj }) // reformattedarray is now [{1: 10}, {2: 20}, {3: 30}], // kvarray is still: // [{key: 1, value: 10}, // {key: 2, value: 20}, // {key: 3, value: 30}] mapping an array of numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it.
... let numbers = [1, 4, 9] let doubles = numbers.map(function(num) { return num * 2 }) // doubles is now [2, 8, 18] // numbers is still [1, 4, 9] using map generically this example shows how to use map on a string to get an array of bytes in the ascii encoding representing the character values: let map = array.prototype.map let a = map.call('hello world', function(x) { return x.charcodeat(0) }) // a now equals [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] using map generically queryselectorall this example shows how to iterate through a collection of objects collected by queryselectorall.
Date.prototype.toLocaleTimeString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocaletimestringsupportslocales() { try { new date().tolocaletimestring('i'); } catch (e) { return e​.name === 'rangeerror'; } return false; } using locales this example shows some of the variations in localized time formats.
...ns argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // an application may want to use utc and make that visible var options = { timezone: 'utc', timezonename: 'short' }; console.log(date.tolocaletimestring('en-us', options)); // → "3:00:00 am gmt" // sometimes even the us needs 24-hour time console.log(date.tolocaletimestring('en-us', { hour12: false })); // → "19:00:00" // show only hours and minutes, use options with the default locale - use an empty array console.log(date.tolocaletimestring([], { hour: '2-digit', minute: '2-digit' })); // → "20:01" specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tolocaletimestring' in that specification.
Date - JavaScript
examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
... let date = new date(98, 1) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) // deprecated method; 98 maps to 1998 here as well date.setyear(98) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) date.setfullyear(98) // sat feb 01 0098 00:00:00 gmt+0000 (bst) calculating elapsed time the following examples show how to determine the elapsed time between two javascript dates in milliseconds.
FinalizationRegistry.prototype.unregister() - JavaScript
examples using unregister this example shows registering a target object using that same object as the unregister token, then later unregistering it via unregister: class thingy { #cleanup = label => { // ^^^^^−−−−− held value console.error( `the \`release\` method was never called for the object with the label "${label}"` ); }; #registry = new finalizationregistry(this.#cleanu...
... */ release() { this.#registry.unregister(this); // ^^^^−−−−− unregister token } } this example shows registering a target object using a different object as its unregister token: { // ^^^^−−−−− held value console.error( `the \`release\` method was never called for the \`thingy\` for the file "${file.name}"` ); }; #registry = new finalizationregistry(this.#cleanup); /** * constructs a `thingy` instance for the given file.
Intl.ListFormat - JavaScript
examples using format the following example shows how to create a list formatter using the english language.
...w intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).format(list)); // > motorcycle, bus and car console.log(new intl.listformat('en-gb', { style: 'short', type: 'disjunction' }).format(list)); // > motorcycle, bus or car console.log(new intl.listformat('en-gb', { style: 'narrow', type: 'unit' }).format(list)); // > motorcycle bus car using formattoparts the following example shows how to create a list formatter returning formatted parts const list = ['motorcycle', 'bus', 'car']; console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).formattoparts(list)); // [ { "type": "element", "value": "motorcycle" }, // { "type": "literal", "value": ", " }, // { "type": "element", "value": "bus" }, // { "type": "literal", "value": ", and " }, // { "...
Intl.RelativeTimeFormat - JavaScript
examples basic format usage the following example shows how to use a relative time formatter for the english language.
...rtf.format(1, "day"); // > "in 1 day" using formattoparts the following example shows how to create a relative time formatter returning formatted parts const rtf = new intl.relativetimeformat("en", { numeric: "auto" }); // format relative time using the day unit.
Object.prototype.hasOwnProperty() - JavaScript
properties the following example differentiates between direct properties and properties inherited through the prototype chain: o = new object(); o.prop = 'exists'; o.hasownproperty('prop'); // returns true o.hasownproperty('tostring'); // returns false o.hasownproperty('hasownproperty'); // returns false iterating over the properties of an object the following example shows how to iterate over the properties of an object without executing on inherited properties.
... note that the for...in loop is already only iterating enumerable items, so one should not assume based on the lack of non-enumerable properties shown in the loop that hasownproperty itself is confined strictly to enumerable items (as with object.getownpropertynames()).
WebAssembly.Table() constructor - JavaScript
we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null.
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too.
WebAssembly.Table.prototype.set() - JavaScript
we then print out the table length and contents of the two indexes (retrieved via table.prototype.get()) to show that the length is two, and the indexes currently contain no function references (they currently return null).
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too.
WebAssembly.Table - JavaScript
we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null.
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too.
for...of - JavaScript
the following example shows the difference between a for...of loop and a for...in loop when used with an array.
...the object's elements 3, 5, 7 are shown, but none of the object's properties.
for - JavaScript
function showoffsetpos(sid) { var nleft = 0, ntop = 0; for ( var oitnode = document.getelementbyid(sid); /* initialization */ oitnode; /* condition */ nleft += oitnode.offsetleft, ntop += oitnode.offsettop, oitnode = oitnode.offsetparent /* final-expression */ ); /* semicolon */ console.log('offset position of \'' + sid + '\' element:\n left: ' + nleft + 'px;\n top: ' + ntop + 'px;')...
...; } /* example call: */ showoffsetpos('content'); // output: // "offset position of "content" element: // left: 0px; // top: 153px;" note: this is one of the few cases in javascript where the semicolon is mandatory.
import - JavaScript
let module = await import('/modules/my-module.js'); examples standard import the code below shows how to import from a secondary module to assist in processing an ajax json request.
...ction () { callback(this.responsetext) }; xhr.open('get', url, true); xhr.send(); } export function getusefulcontents(url, callback) { getjson(url, data => callback(json.parse(data))); } the main program: main.js import { getusefulcontents } from '/modules/file.js'; getusefulcontents('http://www.example.com', data => { dosomethinguseful(data); }); dynamic import this example shows how to load functionality on to a page based on a user action, in this case a button click, and then call a function within that module.
let - JavaScript
ole.log(this.y); // undefined emulating private members in dealing with constructors it is possible to use the let bindings to share one or more private members without using closures: var thing; { let privatescope = new weakmap(); let counter = 0; thing = function() { this.someproperty = 'foo'; privatescope.set(this, { hidden: ++counter, }); }; thing.prototype.showpublic = function() { return this.someproperty; }; thing.prototype.showprivate = function() { return privatescope.get(this).hidden; }; } console.log(typeof privatescope); // "undefined" var thing = new thing(); console.log(thing); // thing {someproperty: "foo"} thing.showpublic(); // "foo" thing.showprivate(); // 1 the same privacy pattern with closures over local variables c...
... 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.
display - Web app manifests
the display mode changes how much of browser ui is shown to the user and can range from browser (when the full browser window is shown) to fullscreen (when the app is full-screened).
... values the possible values are: display mode description fallback display mode fullscreen all of the available display area is used and no user agent chrome is shown.
Autoplay guide for media and Web Audio APIs - Web media technologies
}).catch(error => { if (error.name === "notallowederror") { showplaybutton(videoelem); } else { // handle a load or playback error } }); } the first thing we do with the result of play() is make sure it's not undefined.
...if that's the case, we should present a user interface to let the user manually start playback; that's handled here by a function showplaybutton().
Digital video concepts - Web media technologies
the table below shows examples of three chroma subsampling models.
... the second column shows 4:2:2 subsampling.
Web Performance
in this guide, we'll show you how to analyze your application's script bundles, so you know what you're using, as well how to detect if your app contains duplicated scripts between bundles.
...of course, since this feature isn't available everywhere, we'll also show you how you can configure your tooling to use this feature in a widely compatible fashion.
Introduction to progressive web apps - Progressive web apps (PWAs)
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.
... control what is shown to the user in situations where there is no connectivity.
Progressive loading - Progressive web apps (PWAs)
we should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded.
...you could try to make your apps more bulletproof by making them work without javascript — either using <noscript> to show the image with final src already assigned, or by wrapping <img> tags with <a> elements pointing at the target images, so the user can click and access them when desired.
The building blocks of responsive design - Progressive web apps (PWAs)
ebkit-flex; display: -moz-flex; display: -ms-flexbox; display: flex; } nav button { font-size: 6.8vw; -webkit-flex: 1; -moz-flex: 1; -ms-flex: 1; flex: 1; border-left: 1px solid rgba(100,100,100,0.4); } nav button:first-child { border-left: 0; } } in this last set of rules, we change the display value of the <nav> to flex to make it show (it was set to none in the default css at the top of the stylesheet, as it wasn't needed for the other views.) we then use absolute positioning and z-index to make it take up no space in the document flow, and sit on top of the x-cards (this is why we gave the x-cards that top-margin earlier).
...if you want a solution that works across general web apps, you could use the screen orientation api, and/or provide a message asking the user to rotate their screen if they are using the wrong orientation (for example, if window.innerwidth is larger than window.innerheight, assume the game is landscape mode and show a "please rotate" message.) viewport one last problem to mention for our example app is concerned with mobile browsers and media queries.
overflow - SVG: Scalable Vector Graphics
when scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is clipped.
...s a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <foreignobject>, <iframe>, <image>, <marker>, <pattern>, <symbol>, <svg>, and <text> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg" overflow="auto"> <text y="20">this text is wider than the svg, so there should be a scrollbar shown.</text> </svg> usage notes value visible | hidden | scroll | auto default value visible animatable yes for a description of the values, please see the css overflow property.
stroke-linejoin - SVG: Scalable Vector Graphics
s="http://www.w3.org/2000/svg"> <!-- effect of the "miter" value --> <path d="m1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- effect of the "miter" value on a sharp angle where de default miter limit is exceeded --> <path d="m7,5 l0.75,-3 l0.75,3" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- the following red dotted line show where the miter value falls back to the bevel value --> <path d="m0,0 h10" stroke="red" stroke-dasharray="0.05" stroke-width="0.025"/> <!-- the following pink lines highlight the position of the path for each stroke --> <g> <path d="m1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0...
.../2000/svg"> <!-- effect of the "miter-clip" value --> <path d="m1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- effect of the "miter-clip" value on a sharp angle where de default miter limit is exceeded --> <path d="m7,5 l0.75,-3 l0.75,3" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- the following red dotted line show where the clip should happen --> <path d="m0,0 h10" stroke="red" stroke-dasharray="0.05" stroke-width="0.025"/> <!-- the following pink lines highlight the position of the path for each stroke --> <g> <path d="m1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circl...
Namespaces crash course - SVG: Scalable Vector Graphics
this is done by putting the namespace prefix and a colon before the parameter name as shown on the <script> element in the example above.
...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.
Basic Transformations - SVG: Scalable Vector Graphics
use the rotate() transformation for this: <svg width="31" height="31"> <rect x="12" y="-10" width="20" height="20" transform="rotate(45)" /> </svg> this example shows a square that is rotated by 45 degrees.
... <svg width="40" height="50" style="background-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40) rotate(45)" /> </svg> this example shows again the small square shown above that this time is also rotated by 45 degrees.
Fills and Strokes - SVG: Scalable Vector Graphics
in the example above, the path is shown in pink, and the stroke in black.
...can all be set this way, in addition to the gradient and pattern versions of those shown below.
Getting started - SVG: Scalable Vector Graphics
it will render as shown in the following screenshot.
...if your server is not configured to send the correct headers with the svg files it serves, then firefox will most likely show the markup of the files as text or encoded garbage, or even ask the viewer to choose an application to open them.
Gradients in SVG - SVG: Scalable Vector Graphics
setting these three attributes will allow you to move the gradient around and change its size, as shown in the second rect above.
...objectboundingbox is the default, so that's what has been shown so far.
Introduction - SVG: Scalable Vector Graphics
« previousnext » svg is an xml language, similar to xhtml, which can be used to draw vector graphics, such as the ones shown to the right.
...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).
Patterns - SVG: Scalable Vector Graphics
WebSVGTutorialPatterns
anything we had drawn outside that box wouldn't have been shown.
...all three of the preceding examples are shown below on a rectangle that has been slightly elongated to a height of 300px, but i should note that it's not an exhaustive picture, and there are other options available depending on your application.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
overview this article and its associated example shows how to use inline svg to provide a background picture for a form.
... it shows how javascript and css can be used to manipulate the picture in the same way you would script regular html.
SVG fonts - SVG: Scalable Vector Graphics
let's show an example declaration (the one from the specification), and explain the details.
...it also shows how glyphs are created: by simply adding any graphical svg content inside.
Securing your site - Web security
this article showcases best practices to use when storing passwords.
...this article explains some of those and shows how to configure your server to serve files with the correct mime types.
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
the xml document can be a separate xml file loaded as shown in figure 1, or it can be part of the existing page.
...the cloned dom can then be easily inserted into the xml document using node.appendchild(), as shown in figure 2.
WebAssembly
in this article we show you how to use webassembly via the webassembly javascript api.
...this is the low-level textual representation of a .wasm module shown in browser developer tools when debugging.
2015 MDN Fellowship Program - Archive of obsolete content
activities and deliverables write a demonstration web application (new or existing) to showcase service worker functionality.
Communicating With Other Scripts - Archive of obsolete content
before firefox 30 here's an example showing how to use custom dom events to send a message from a content script to a page script, before firefox 30.
Reddit Example - Archive of obsolete content
this is the complete add-on script: var data = require("sdk/self").data; var button = require("sdk/ui/button/action").actionbutton({ id: "reddit-panel", label: "reddit panel", icon: "./icon-16.png", onclick: function() { reddit_panel.show(); } }); var reddit_panel = require("sdk/panel").panel({ width: 240, height: 320, contenturl: "http://www.reddit.com/.mobile?keep_extension=true", contentscriptfile: [data.url("jquery-2.1.0.min.js"), data.url("panel.js")] }); reddit_panel.port.on("click", function(url) { require("sdk/tabs").open(url); }); this code supplies two content scripts to the panel's ...
Content Scripts - Archive of obsolete content
the following add-on shows a content script added by page-mod receiving a customevent sent from a context-menu item when the context menu item is clicked.
Private Properties - Archive of obsolete content
also shown here is how to generalize the idea of using weakmaps, from associating one or more private properties with an object, to associating one or more namespaces with each object.
Contributor's Guide - Archive of obsolete content
we will show how to do each of these things using the built-in components object provided by xulrunner application such as firefox and thunderbird.
Working with Events - Archive of obsolete content
uire("sdk/ui"); var panels = require("sdk/panel"); var self = require("sdk/self"); var panel = panels.panel({ contenturl: self.data.url("panel.html") }); panel.on("*", function(e) { console.log("event " + e + " was emitted"); }); var button = ui.actionbutton({ id: "my-button", label: "my button", icon: "./icon-16.png", onclick: handleclick }); function handleclick(state) { panel.show({ position: button }); } this wildcard feature does not yet work for the tabs or windows modules.
page-mod - Archive of obsolete content
for example: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*", contentscriptfile: data.url("show.js"), contentscriptoptions: { showoptions: true, numbers: [1, 2], greeting: "hello!" } }); the values are accessible to content scripts via the self.options property: // show.js if (self.options.showoptions) { window.alert(self.options.greeting); var sum = self.options.numbers[0] + self.options.numbers[1]; window.alert(sum); } the values can be any json-serial...
private-browsing - Archive of obsolete content
owser windows, generate any events for private browser windows, or let the add-on open any private browser windows the tabs module will not list any tabs that belong to private browser windows, and the add-on won't receive any events for such tabs any ui components will not be displayed in private browser windows any menus or menu items created using the context-menu will not be shown in context menus that belong to private browser windows the page-mod module will not attach content scripts to documents belonging to private browser windows any panel objects will not be shown if the active window is a private browser window the selection module will not include any selections made in private browser windows add-ons that have opted in will see private wind...
request - Archive of obsolete content
the example below shows how to use request to get the most recent tweet from the @mozhacks account: var request = require("sdk/request").request; var latesttweetrequest = request({ url: "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=mozhacks&count=1", oncomplete: function (response) { var tweet = response.json[0]; console.log("user: " + tweet.user.screen_name); console.log("tweet:...
ui - Archive of obsolete content
from firefox 30 onwards, you can attach panels to toggle buttons, by passing the button into the panel's constructor or its show() method: frame a frame enables you to create an html iframe, using bundled html, css and javascript.
event/target - Archive of obsolete content
for example, a panel instance emits an show event when the panel is shown.
platform/xpcom - Archive of obsolete content
ervice for a component, construct a service, giving it: a constructor for the object implementing the service a contract id and/or a class id var service = service({ contract: contractid, component: alertservice }); after this, xpcom users can access the service implementation by supplying the contract id: var alertservice = cc[contractid].getservice(ci.nsialertsservice); alertservice.showalertnotification(...); the service interface is identical to the factory interface, so refer to the factory interface documentation for details.
system/environment - Archive of obsolete content
se you can set the value of an environment variable by setting the property: env.foo = 'foo'; env.path += ':/my/path/' you can unset an environment variable by deleting the property: delete env.foo; limitations there is no way to enumerate existing environment variables, also env won't have any enumerable properties: console.log(object.keys(env)); // [] environment variable will be unset, show up as non-existing if it's set to null, undefined or ''.
Release notes - Archive of obsolete content
added a browserwindow parameter to sidebar.show() and sidebar.hide(), to control the window for which the sidebar will be shown or hidden.
cfx - Archive of obsolete content
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.
cfx to jpm - Archive of obsolete content
there is a known bug in simple options handling which may require the workaround described in https://bug635044.bugzilla.mozilla.org/show_bug.cgi?id=1243467 commands and command options permanently removed commands jpm has dropped support for all the "internal" cfx commands.
console - Archive of obsolete content
especially when debug logging shows up in a production environment, the noise can make it harder, not easier, to debug issues.
jpm-mobile - Archive of obsolete content
jpm usage is: jpm-mobile [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version number installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already.
package.json - Archive of obsolete content
these json objects will be used to localizations for the add-on's meta data shown within the add-ons manager.
Add a Context Menu Item - Archive of obsolete content
context the context describes the circumstances in which the item should be shown.
Adding a Button to the Toolbar - Archive of obsolete content
to attach the panel, pass the button to the panel's show() method.
Implementing the widget - Archive of obsolete content
data.url('widget/pencil-on.png') : data.url('widget/pencil-off.png'); }); widget.port.on('right-click', function() { console.log('show annotation list'); }); } the annotator is inactive by default.
Overview - Archive of obsolete content
the annotation-list panel shows a list of all stored annotations.
Listen for Page Load - Archive of obsolete content
the script adds a red border to the tab's document: require("sdk/tabs").on("ready", runscript); function runscript(tab) { tab.attach({ contentscript: "if (document.body) document.body.style.border = '5px solid red';" }); } (this example is only to show the idea: to implement something like this, you should instead use page-mod, and specify "*" as the match-pattern.) learning more to learn more about working with tabs in the sdk, see the tabs api reference.
Unit Testing - Archive of obsolete content
to show the module in use, edit the "index.js" file as follows: var base64 = require("./base64"); var button = require("sdk/ui/button/action").actionbutton({ id: "base64", label: "base64", icon: "./icon-16.png", onclick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); to run this example you'll als...
Localization - Archive of obsolete content
t the localized string to appear, and assign the identifier to it: <html> <body> <h1 data-l10n-id="hello_id"></h1> </body> </html> then you can use this html file to build your interface, for example inside a panel: var button = require("sdk/ui/button/action").actionbutton({ id: "localized-hello", label: "localized hello", icon: "./icon-16.png", onclick: function() { hello.show(); } }); var hello = require("sdk/panel").panel({ height: 75, width: 150, contenturl: require("sdk/self").data.url("my-panel.html") }); given locale files for "en-us" and "fr" which provide translations of hello_id, the panel will now display "hello!" or "bonjour !", according to the current locale: the translation is inserted into the node which has the data-l10n-id attribute set.
Alerts and Notifications - Archive of obsolete content
this works on windows, linux and (if growl is installed) mac os x: function popup(title, text) { try { components.classes['@mozilla.org/alerts-service;1'] .getservice(components.interfaces.nsialertsservice) .showalertnotification(null, title, text, false, '', null); } catch(e) { // prevents runtime error on platforms that don't implement nsialertsservice } } if you need to display a comparable alert on a platform that doesn't support nsialertsservice, you can do this: function popup(title, msg) { var image = null; var win = components.classes['@mozilla.org/embedcomp/window-watcher;1'] ...
Finding window handles - Archive of obsolete content
that means if you use the top level nsibasewindow as a param, null will be returned in the chain and cause crash of firefox, that's a bug of firefox.(https://bugzilla.mozilla.org/show_bug.cgi?id=489045) now, let's move forward.
HTML to DOM - Archive of obsolete content
as an example, i will show a browser overlay .xul file, and some javascript code to access it.
JavaScript Debugger Service - Archive of obsolete content
, exc) { // your function here } }; // triggered when jsd.errorhook[onerror] returns false jsd.debughook = { onexecute: function(frame, type, rv) { // your function here } }; jsd.enumeratescripts({ // the enumeratescript method will be called once for every script jsd knows about enumeratescript: function(script) { // your function here } }); a simple stack trace here, we will show how to implement a simple javascript stack trace using the jsd.
Miscellaneous - Archive of obsolete content
the meaning of the action preference is shown in the following table mousewheel.withxxxkey.action result 0 scroll by lines.
On page load - Archive of obsolete content
basic onpageload for a browser window var myextension = { init: function() { // the event can be domcontentloaded, pageshow, pagehide, load or unload.
Preferences - Archive of obsolete content
s.nsiprefservice); prefservice.savepreffile(null); checking for existence of a key if you try to get the value of a nonexistent preference, an error will be thrown: error: ns_error_unexpected: component returned failure code: 0x8000ffff (ns_error_unexpected) [nsiprefbranch.getcharpref] to avoid such errors, you should check whether the key exists or not using nsiprefservice.getpreftype(), as shown below: var prefservicebranch = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice).getbranch(""); if(prefservicebranch.getpreftype('extensions.myext.key')){ //key exist!
Scrollbar - Archive of obsolete content
this example shows how to style the scrollbars in your xul application.
StringView - Archive of obsolete content
the following table shows the behavior of the stringview constructor.
Toolbar - Archive of obsolete content
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.
View Source for XUL Applications - Archive of obsolete content
importing gviewsourceutils xul applications wanting to show the source code for documents should import the viewsourceutils.js script instead of attempting to open the viewsource.xul window themselves: <script type="application/javascript" src="chrome://global/content/viewsourceutils.js"/> viewsourceutils.js exposes a gviewsourceutils global into the scope of the window that imports that script.
Code snippets - Archive of obsolete content
this snippets shows a possible way to start from.
Custom about: URLs - Archive of obsolete content
tregistrar); components.utils.import("resource://gre/modules/services.jsm"); // globals const aboutpage_description = 'this is my custom about page'; const aboutpage_id = 'aa132730-2278-11e5-867f-0800200c9a66'; // make sure you generate a unique id from https://www.famkruithof.net/uuid/uuidgen const aboutpage_word = 'myaboutpage' const aboutpage_uri = 'data:text/html,hi this is the page that is shown when navigate to about:myaboutpage'; // const aboutpage_uri = 'chrome://myaboutaddon/content/index.html'; class aboutpage { static get classid() { return components.id(`{${aboutpage_id}}`); } static get classdescription() { return aboutpage_description; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { ret...
Inline options - Archive of obsolete content
<setting pref="extensions.throbberrestored.showtxtontoolbar" title="show text on toolbar button" type="bool" oninputchanged="alert('new value is = ' + this.value); this.style.backgroundcolor='red';"> if labels on other toolbar buttons are visible (like by using add-on "classic theme restorer") then show label on throbber toolbar button </setting> note in order for the oninputchanged to execute, the setting must have a pref attrib...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
- #include "nsastring.h"- #include "nsstring.h"- #include "nsreadableutils.h"- #include "nsescape.h" + #include "nsstringapi.h" on windows, if you see the following error, you are including a header you shouldn't be: nsstringfwd.h(60) : fatal error c1001: internal compiler error to debug this error, make in the failing directory, adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showincludes the frozen string api is similar but not identical to the nonfrozen string api.
Appendix: What you should know about open-source software licenses - Archive of obsolete content
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/lgpl/gpl) gpl linux kernel, gimp lgpl gtk+, openoffice.org modified bsd license this license permits free duplication, distribution, and modification...
Chapter 1: Introduction to Extensions - Archive of obsolete content
extensions (these can do anything) yes yes theming (this changes the look of the browser) no yes let's build an extension table 1 shows the various customization options available to a user in firefox.
Adding Events and Commands - Archive of obsolete content
commands are heavily used in firefox, as a quick look into the dom inspector should show.
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
this menu allows hiding and showing any toolbar.
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
if you detect your add-on is going to be uninstalled at this stage, it's a good time to show the uninstall feedback form.
Connecting to Remote Content - Archive of obsolete content
after that, the xslt stylesheet can be imported into an xslt processor as shown below.
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
endchild(newitem); }; var jsontemplatebtn = ["xul:toolbarbutton", { id: "mytestbutton", class: "toolbarbutton-1", type: "menu", label: "test button label", tooltiptext: "test button tooltip", removable: true, key: "mytestbutton123" }, [ "menupopup", { onpopupshowing: function(event) { addentrytopopup(this, document, window); } }, null ] ]; var capturednodes = {}; var toolbox = doc.getelementbyid("navigator-toolbox"); var palette = toolbox.palette; var domfragment = jsontodom(jsontemplatebtn, document, capturednodes); palette.appendchild(domfragment); alert("capturednodes contains any created nodes that have optionally...
Handling Preferences - Archive of obsolete content
the contents of the file are fairly simple: // amount of messages shown to the user.
Intercepting Page Loads - Archive of obsolete content
asubject.cancel(components.results.ns_binding_aborted); } } } this example shows how you can obtain the url for the request, analyze it using regular expressions, and perform actions on it such as modifying http headers, or even canceling the request.
JavaScript Object Management - Archive of obsolete content
this message has been shown 5 times." keep the counter as a variable in the browseroverlay object, and increment it every time the message is going to be shown.
The Essentials of an Extension - Archive of obsolete content
dtd is the most efficient way of showing text in xul, so you should use it whenever possible.
Signing an extension - Archive of obsolete content
show the certificate list in your database.
Supporting search suggestions in search plugins - Archive of obsolete content
if the request for the suggest url does not return data before 500ms have elapsed, no search suggestions will be shown.
Firefox addons developer guide - Archive of obsolete content
for example, here: https://developer.mozilla.org/en/firefox_addons_developer_guide/let's_build_a_firefox_extension#init_method the text of the paragraph should begin "the <code>init()</code> method is as shown...".
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
the new design clearly shows what some experts have been saying: that standards-based design can be visually compelling and preserve the interface conventions we've come to expect from web pages.
Creating reusable content with CSS and XBL - Archive of obsolete content
this wiki does not support javascript in pages, so it is not possible to show the demonstration here.
Install.js - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Localizing an extension - Archive of obsolete content
create a properties file the first thing we do is create a property file for the literal strings used by the javascript code in stockwatcher2.js: changestring=chg: openstring=open: lowstring=low: highstring=high: volumestring=vol: the stockwatcher2.properties file shown above maps five keys (changestring, openstring, lowstring, highstring, and volumestring) to the corresponding text in english.
Defining Cross-Browser Tooltips - Archive of obsolete content
a quick check of various user agents showed that title attribute contents were displayed as a "tooltip" in: gecko-based browsers (mozilla firefox, netscape 6+, etc.) internet explorer 5.5+/win internet explorer 5.x/mac safari opera 6.x+ of these, only ie/win treated alt text as a "tooltip"; the other browsers did not reproduce this behavior.
Source code directories overview - Archive of obsolete content
it shows how to embed the mozilla browser in a mac application as well as some sample file-handling code from apple.
Visualizing an audio spectrum - Archive of obsolete content
note: you can use the audionode called analysernode to perform real-time fft analysis on an audio stream, rather than the code shown below.
Creating a Firefox sidebar extension - Archive of obsolete content
chrome/locale/emptysidebar.dtd <!entity emptysidebar.title "emptysidebar"> <!entity openemptysidebar.commandkey "e"> <!entity openemptysidebar.modifierskey "shift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3.
Adding the structure - Archive of obsolete content
the lock icon in mozilla that shows whether or not a loaded document was encrypted with ssl).
Conclusion - Archive of obsolete content
how could you modify tinderstatus to show the status of both the trunk and the branch?
Tinderbox - Archive of obsolete content
by checking for build failures first and test failures second, we make sure to show users the worst possible situation, i.e.
Creating a Mozilla Extension - Archive of obsolete content
this tutorial walks you through the process of building a mozilla extension that adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e.
Creating a Microsummary - Archive of obsolete content
in each step of revising the transform sheet and other code in this tutorial, new material added will be shown in boldface so you can follow along more easily.
Getting Started - Archive of obsolete content
the description shows up below the preview image.
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
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 folder control click application icon(firefox icon), choose show package contents.
Download Manager improvements in Firefox 3 - Archive of obsolete content
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.
Drag and Drop Example - Archive of obsolete content
the final code is shown below: <window title="widget dragger" id="test-window" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <script src="chrome://global/content/nsdraganddrop.js"/> <script src="chrome://global/content/nstransferable.js"/> <script src="dragboard.js"/> <stack id="board" style="width:300px; height: 300px; max-width: 300px; ma...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
the example below shows how to set the data to be dragged from the element's label attribute.
Layout FAQ - Archive of obsolete content
how do you find out if there are any reflows that are pending and wait to show the view until afterwards, but if none are pending, show the view immediately?
Layout System Overview - Archive of obsolete content
in both cases, the content is manipulated by the user (via the dom) and the resulting visual impacts must be shown as quickly as possible, without disconcerting flicker or other artifacts that might bother the user.
Code snippets - Archive of obsolete content
tabs from other computers this snippet shows how to load all tabs from other computers.
Help Viewer - Archive of obsolete content
help viewer: allows information to be shown to the user inside mozilla.
Helper Apps (and a bit of Save As) - Archive of obsolete content
calls show() on the nsihelperapplauncherdialog, which asynchronously puts up the helper app dialog.
JavaScript crypto - Archive of obsolete content
do not select this value unless you can show that your random number generator is secure.
Twitter - Archive of obsolete content
user info jetpack.lib.twitter.users.show({ id: "mozlabs", success: function (data, status) console.log(data.tosource()), error: function (xhr, errmsg, errobj) console.error(xhr.responsetext) }); friends of a user jetpack.lib.twitter.statuses.friends({ id: "mozlabs", page: 3, success: function (data, status) console.log(data.tosource()), error: function (xhr, errmsg, errobj) console.error(xhr.responsetext) }); trends jetp...
First run - Archive of obsolete content
jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack.
Me - Archive of obsolete content
ArchiveMozillaJetpackMetaMe
inside the function, this is the jetpack's content.function example jetpack.me.onfirstrun(function(){ jetpack.notifications.show("oh boy, i'm installed!");}); ...
First Run - Archive of obsolete content
jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack.
slideBar - Archive of obsolete content
iconhref oficon to show in the slidebaruri htmlhtml content for the featurehtml/xml urlurl to load content for the featureuri widthwidth of the content area and the selected slide sizeint persistdefault slide behavior when being selectedbool autoreloadautomatically reload content on selectbool onclickcallback when the icon is clickedfunction onselectcallback when the feature is selectedfunction onreadycallback when feat...
jspage - Archive of obsolete content
a||!this.retrieve("tween:options")){this.set("tween",a);}this.store("tween",new fx.tween(this,this.retrieve("tween:options"))); }return this.retrieve("tween");}};element.implement({tween:function(a,c,b){this.get("tween").start(arguments);return this;},fade:function(c){var e=this.get("tween"),d="opacity",a; c=$pick(c,"toggle");switch(c){case"in":e.start(d,1);break;case"out":e.start(d,0);break;case"show":e.set(d,1);break;case"hide":e.set(d,0);break;case"toggle":var b=this.retrieve("fade:flag",this.get("opacity")==1); e.start(d,(b)?0:1);this.store("fade:flag",!b);a=true;break;default:e.start(d,arguments);}if(!a){this.eliminate("fade:flag");}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getstyle("background-color")); a=(a=="transparent")?"#fff":a;}var b=thi...
Makefile.mozextension.2 - Archive of obsolete content
which is why the code shown below is corrupt - so you may wanna click on edit and view source instead !!
Measuring add-on startup performance - Archive of obsolete content
the about:startup page shows 3 different time measurements: main, sessionrestored and firstpaint.
Mozilla Application Framework - Archive of obsolete content
lxr a web interface to the mozilla codebase that shows you every file in the repository as well as a line-by-line breakdown of who changed which line when in each file bonsai a web interface to the checkin log that you can query for checkins between certain dates, of certain files, or by certain developers.
LIR - Archive of obsolete content
it return a quad 8 retd void return a double 9 livei void extend live range of an int 10 liveq void 64 bit extend live range of a quad 11 lived void extend live range of a double 12 file void source filename for debug symbols 13 line void source line number for debug symbols 14 comment void a comment shown, on its own line, in lir dumps 15 not in use load 16 not in use 17 ldc2i integer load char and sign-extend to an int 18 lds2i integer load short and sign-extend to an int 19 lduc2ui integer load unsigned char and zero-extend to an unsigned int 20 ldus2ui integer load unsigned short and zero-extend to an...
Nanojit - Archive of obsolete content
the conversion from lir to a program like one shown above is the task of the parser.
New Skin Notes - Archive of obsolete content
--dria the edit section links are gone (they are only shown in normal skin if you set the appropriate preference).
PyDOM - Archive of obsolete content
an event handler like: <button onclick="print foo"/> should be able to reference 'foo' via globals as shown.
Remotely debugging Firefox for Metro - Archive of obsolete content
on the desktop next, the desktop shows you a dialog that looks something like this: this is asking whether you want to debug web content running in a browser tab, or to debug the browser code itself.
Rsyncing the CVS Repository - Archive of obsolete content
optionally, the --progress option will show the progress for each file, and a percentage of the total files that are transferred.
Table Layout Regression Tests - Archive of obsolete content
execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
Cmdline tests - Archive of obsolete content
two use cases for the cmdline testsuite: use case 1: test the interactive cmdline debugger test contents: start avmshell -d test.abc, set breakpoint on a line, 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 av...
The new nsString class implementation (1999) - Archive of obsolete content
in addition to the nsstrimpl api shown above, nsstring, nsautostring and nscstring all offer additional api's (that all degrade to those found in nsstrimpl) for construction, searching and comparison.
Treehydra Manual - Archive of obsolete content
in this example, we show how to access the gimple just after function inlining is performed.
Using cross commit - Archive of obsolete content
otherwise cross-commit will end up waiting forever for you to type a cvs checkin message in an editor that it never shows you!
Using Breakpoints in Venkman - Archive of obsolete content
the log result checkbox tells venkman you want the result of the script to show up in the interactive session view.
Using XPInstall to Install Plugins - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Windows Install - Archive of obsolete content
windows install example this example shows the installation of a xpi in which user profile information is contained.
Methods - Archive of obsolete content
parts of this page show the use of the xpinstall api.
File Object - Archive of obsolete content
parts of this page show the use of the xpinstall api.
InstallVersion Object - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Methods - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Install Object - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Methods - Archive of obsolete content
parts of this page show the use of the xpinstall api.
WinProfile Object - Archive of obsolete content
parts of this page show the use of the xpinstall api.
enumKeys - Archive of obsolete content
the following example shows how to use enumkeys to find the plugins subdirectory below the various mozilla-based browser installations.
Methods - Archive of obsolete content
parts of this page show the use of the xpinstall api.
WinReg Object - Archive of obsolete content
parts of this page show the use of the xpinstall api.
XPInstall API reference - Archive of obsolete content
parts of this page show the use of the xpinstall api.
XPInstall - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Directions of the Mozilla RDF engine - Archive of obsolete content
presentation download summary this presentation showed new developments in the mozilla rdf engine.
Mozilla E4X - Archive of obsolete content
another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other.
crop - Archive of obsolete content
ArchiveMozillaXULAttributecrop
center the text will be cropped in the middle, showing both the start and end of the text normally.
datepicker.type - Archive of obsolete content
grid a datepicker that displays a calendar grid where one month is shown at a time.
decimalplaces - Archive of obsolete content
the default is 0, which doesn't show any decimal places.
disablechrome - Archive of obsolete content
this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing.
dlgtype - Archive of obsolete content
disclosure a button to show more information.
grippyhidden - Archive of obsolete content
when set to false, the default, the grippy will be shown.
hidecolumnpicker - Archive of obsolete content
« xul reference home hidecolumnpicker type: boolean when set to false, a drop-down will appear in the upper right corner of the tree, which the user may use to show and hide columns.
hideseconds - Archive of obsolete content
« xul reference home hideseconds type: boolean indicates whether to show the seconds field.
label - Archive of obsolete content
ert(document.getelementbyid('the-big-label').value)"/> <label id="mylabel" value="my label"/> <button label="click me" oncommand="document.getelementbyid('mylabel').setattribute('value','value changed');" /> <checkbox label="my checkbox" id="mycheckbox"/> <button label="another click" oncommand="document.getelementbyid('mycheckbox').setattribute('label','still not checked');"/> <button label="show label of checkbox" oncommand="alert( document.getelementbyid('mycheckbox').getattribute('label') )"/> ...
maxrows - Archive of obsolete content
« xul reference home maxrows type: integer the number of rows to show in the results list at a time.
popup.left - Archive of obsolete content
« xul reference home left type: integer overrides the horizontal position of the popup specified by the showpopup method.
popup.top - Archive of obsolete content
« xul reference home top type: integer overrides the vertical position of the popup specified by the showpopup method.
popupalign - Archive of obsolete content
the example below shows how to create the traditional buttons with attached left mouse menus that exist in the 4.x communicator product.
prefpane.selected - Archive of obsolete content
to change the selected pane, use the prefwindow's showpane method.
progressmeter.value - Archive of obsolete content
for instance, if no maximum value has been set, setting the value to "0" shows an empty bar, "100" shows a bar at full length and "25" shows the first quarter of the bar.
toolbarname - Archive of obsolete content
« xul reference home toolbarname not in seamonkey 1.x type: string the name of the toolbar, which is listed on the show/hide toolbars menu.
IO - Archive of obsolete content
ArchiveMozillaXULFileGuideIO
open and save dialogs you can show a dialog to the user to allow them to select a file to open or enter a filename for saving.
swapDocShells - Archive of obsolete content
during the swap, pagehide and pageshow events are fired on both browsers.
Methods - Archive of obsolete content
but removecurrentnotification 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.getattributen...
MenuButtons - Archive of obsolete content
this is accomplished by dividing the button into two parts, one with the label and image to carry out the default command and the second to show the menu.
Special per-platform menu considerations - Archive of obsolete content
menu_mac_show_all selecting this item will show the windows for all applications.
Popup Guide - Archive of obsolete content
events when popups are opened or closed the popupshowing and popupshown events are fired when a menu or popup is opened.
buttons - Archive of obsolete content
disclosure: a button to show more information.
currentIndex - Archive of obsolete content
for trees with focus, the caret's position is indicated by the focus ring, but unfocused trees won't show a focus ring, naturally.
currentPane - Archive of obsolete content
to change the current pane, use the showpane method.
Property - Archive of obsolete content
tspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart 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 treeboxobject type uri useraction value valuenumber view ...
Bindings - Archive of obsolete content
« previousnext » we can add more triples to the previous example to show more information.
Building Hierarchical Trees - Archive of obsolete content
as shown in the snippet of the data below, the street is a seq, so it will become a container.
Introduction - Archive of obsolete content
the local store is a datasource which is usually used to hold state information such as window sizes, which columns in a tree are showing, and which tree items are open.
RDF Modifications - Archive of obsolete content
however, this does show that the template builder can update the output upon changes without rebuilding the entire template.
Rule Compilation - Archive of obsolete content
if you show the vbox by setting the hidden state to false, the template builder will be invoked and the content will be generated.
SQLite Templates - Archive of obsolete content
this simple example shows how to display a listbox containing the values in one column in a database table.
Simple Example - Archive of obsolete content
« previousnext » let's look a more useful example, this time for a template that will show a list of photos.
Sorting Results - Archive of obsolete content
for instance, if a list of photos was displayed in a two column tree showing the title and description, you could sort by either title or description.
Static Content - Archive of obsolete content
« previousnext » creating a menuitem in the filter list to show all items is fairly easy.
Using Multiple Queries to Generate More Results - Archive of obsolete content
here is an example which generates two sets of results and shows them together.
Complete - Archive of obsolete content
this diagram shows all the directories but only a few of the files.
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
restart seamonkey and type the chrome url: chrome://myapp/content/myapp.xul, the browser should show you the content of the xul file.
Tree Widget Changes - Archive of obsolete content
this is shown in the example above.
Additional Install Features - Archive of obsolete content
it will also show any errors that occured.
Advanced Rules - Archive of obsolete content
complete tree example the following example shows a complete tree with conditions and an action.
Anonymous Content - Archive of obsolete content
declaring scrollbar example the example below shows how a scrollbar might be declared (it has been simplified a bit from the real thing): <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <binding id="scrollbarbinding"> <content> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollba...
Box Model Details - Archive of obsolete content
as shown in the image, there are two buttons which expand vertically to fit their container, which in this case is the hbox.
Creating an Installer - Archive of obsolete content
parts of this page show the use of the xpinstall api.
Cross Package Overlays - Archive of obsolete content
the following example shows how: <rdf:seq about="urn:mozilla:stylesheets"> <rdf:li resource="chrome://messenger/content/messenger.xul"/> </rdf:seq> <rdf:seq about="chrome://messenger/content/messenger.xul"> <rdf:li>chrome://blueswayedshoes/skin/myskinfile.css</rdf:li> </rdf:seq> next, we'll see how to create an installer for a xul application.
Custom Tree Views - Archive of obsolete content
the following example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="name" flex="1"/> <treecol id="datecol" label="date" flex="1"/> </treecols> <treechildren/> </tree> to assign data to be displayed in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information.
Groupboxes - Archive of obsolete content
a simple groupbox example the example below shows a simple groupbox: example 1 : source view <groupbox> <caption label="answer"/> <description value="banana"/> <description value="tangerine"/> <description value="phone booth"/> <description value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed surrounded by a box with the label answer.
Install Scripts - Archive of obsolete content
the final script for installing the find files component is shown below: source initinstall("find files","/xulplanet/find files","0.5.0.0"); finddir = getfolder("chrome","findfile"); setpackagefolder(finddir); adddirectory("findfile"); registerchrome(install.content | install.delayed_chrome, getfolder(finddir, "content")); registerchrome(install.skin | install.delayed_chrome, getfolder(finddir, "skin")); registerchrome(install.locale | install.delayed_...
Introduction to XBL - Archive of obsolete content
the following example shows the basic skeleton of an xbl file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="binding1"> <!-- content, property, method and event descriptions go here --> </binding> <binding id="binding2"> <!-- content, property, method and event descriptions go here --> </binding> </bindings> the bindings element is the root element of an xbl file and cont...
List Controls - Archive of obsolete content
to show the choices, click the arrow button on the menulist.
Manifest Files - Archive of obsolete content
if the 'chrome:extension' field is true, the application is a mozilla firefox extension and it will show up in the extensions window of the browser.
More Tree Features - Archive of obsolete content
the user can choose to show the column by selecting it from the drop-down on the end of the header row.
Popup Menus - Archive of obsolete content
the sample below shows how we might do this: example 1 : source view <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <box context="clipmenu"> <label value="context click for menu"/> </box> here, the menupopup has been associated with a box.
Progress Meters - Archive of obsolete content
a script will show and hide it as necessary.
Property Files - Archive of obsolete content
an example is shown below: notfoundalert=no files were found matching the criteria.
Scrolling Menus - Archive of obsolete content
example - scrolling list of buttons the following example shows how to create a scrolling list of buttons (you will need to resize the window to see the arrow buttons): example 1 : source view <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yellow"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/> <button label...
Skinning XUL Files by Hand - Archive of obsolete content
the following table shows the basic format for these two common types of style definitions: class id element.class { attribute: value; } element#id { attribute: value; } menu.baseline { border: 0px; font-size: 9pt; } menu#edit { color: red; } other style subgroups contextualsubgroups -- elements appearing within other elements, such as italicized te...
Stack Positioning - Archive of obsolete content
when drawing the child elements, the elements are shown in the order that they appear in the stack.
Templates - Archive of obsolete content
the example below shows how we might set other attributes of a button using a datasource.
Tree Selection - Archive of obsolete content
the syntax of the onselect() event handler is shown below.
Tree View Details - Archive of obsolete content
they are added near the end of the complete example, shown here: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementlist" flex="1"> <treecols> <treecol id="element" label="element" primary="true" flex="1"/> </treecols> <treechildren/> </tree> <script> <![cdata[ var treeview = { child...
Updating Commands - Archive of obsolete content
the following example shows the command updaters used in the mozilla browser to update the edit menu commands.
Using Spacers - Archive of obsolete content
our find file example the code to add a spacer is shown below.
Urlbar-icons - Archive of obsolete content
(the url bar is also known as the address bar and the navigation bar.) example the default contents of browser.xul: <hbox id="urlbar-icons"> <button be="" chromedir="ltr" class="urlbar-icon" click="" for="" id="safebrowsing-urlbar-icon" img="" level="safe" might="" onclick="godocommand('safebrowsing-show-warning');" page="" style="-moz-user-focus:" tooltiptext="this" type="menu"> <img class="urlbar-icon" id="star-button" onclick="placesstarbutton.onclick(event);" /> <img address="" chromedir="ltr" class="urlbar-icon" id="go-button" in="" location="" onclick="handleurlbarcommand(event);" p="" the="" to="" tooltiptext="go" /> </button> </hbox> ...
Using multiple DTDs - Archive of obsolete content
multiple dtds if you want to use multiple dtds with your xul file, you can simply list all of the dtds inside your dtd declaration: <!doctype window [ <!entity % commondtd system "chrome://myextensions/locale/common.dtd"> %commondtd; <!entity % mainwindowdtd system "chrome://myextension/locale/mainwindow.dtd"> %mainwindowdtd; ]> you can now access the entities declared in the dtds as shown above.
Writing Skinnable XUL and CSS - Archive of obsolete content
i'll show you the evil rule i put into the global skin a few months back that was making trees slow.
XUL Changes for Firefox 1.5 - Archive of obsolete content
the pageshow and pagehide events are used when switching from a page in the cache, while the load and unload events are used only when the page is loaded or unloaded.
Accessibility/XUL Accessibility Reference - Archive of obsolete content
this table is designed to show how to expose text properly for various xul element types.
caption - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
checkbox - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
datepicker - Archive of obsolete content
grid a datepicker that displays a calendar grid where one month is shown at a time.
description - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
dialogheader - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
editor - Archive of obsolete content
attributes editortype, src, type properties accessibletype, commandmanager, contentdocument, contentwindow, docshell, editingsession, editortype, webbrowserfind, webnavigation methods geteditor, gethtmleditor, makeeditable examples this example shows how to made the editor editable by setting the designmode property of the loaded html document: <script language="javascript"> function initeditor(){ // this function is called to set up the editor var editor = document.getelementbyid("myeditor"); editor.contentdocument.designmode = 'on'; } </script> <editor id="myeditor" editortype="html" src="about:blank" flex="1" type="content-primary"...
label - Archive of obsolete content
ArchiveMozillaXULlabel
center the text will be cropped in the middle, showing both the start and end of the text normally.
listcell - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
listitem - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
menu - Archive of obsolete content
ArchiveMozillaXULmenu
center the text will be cropped in the middle, showing both the start and end of the text normally.
menubar - Archive of obsolete content
when set to false, the default, the grippy will be shown.
menuitem - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
menulist - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
menuseparator - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
notificationbox - Archive of obsolete content
events alertactive type: event fired when a notification element is shown.
progressmeter - Archive of obsolete content
for instance, if no maximum value has been set, setting the value to "0" shows an empty bar, "100" shows a bar at full length and "25" shows the first quarter of the bar.
promptBox - Archive of obsolete content
a tab may have multiple prompts on it; the tabmodalpromptshowing attribute on the tabbrowser will tell you how many prompts a given tab has.
radio - Archive of obsolete content
ArchiveMozillaXULradio
center the text will be cropped in the middle, showing both the start and end of the text normally.
scrollbox - Archive of obsolete content
examples the following shows the xul for a bunch of labels.
<statusbarpanel> - Archive of obsolete content
center the text will be cropped in the middle, showing both the start and end of the text normally.
tab - Archive of obsolete content
ArchiveMozillaXULtab
center the text will be cropped in the middle, showing both the start and end of the text normally.
timepicker - Archive of obsolete content
hideseconds type: boolean indicates whether to show the seconds field.
window - Archive of obsolete content
this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing.
wizard - Archive of obsolete content
s <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wizard id="thewizard" title="secret code wizard" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checkcode(){ document.getelementbyid('thewizard').canadvance = (document.getelementbyid('secretcode').value == "cabbage"); } </script> <wizardpage onpageshow="checkcode();"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
javascript.options.showinconsole).
How to enable locale switching in a XULRunner application - Archive of obsolete content
here is a code snippet showing how this is done: the definition of the xul control: <listbox id="locale-listbox"> <!-- generated list items go in here --> </listbox> <button label="&switchlocale.button;" oncommand="changelocale()"/> the javascript code to populate the control: try { // query available and selected locales var chromeregservice = components.classes["@mozilla.org/chrome/chrome-registry;1"].getservice()...
MacFAQ - Archive of obsolete content
this button is used to show/hide the toolbar.
xulauncher - Archive of obsolete content
############################################################## echo " content $xulname file:$xulname/ ">$xulmanifest # create prefs.js file ############################################################################## echo " pref(\"toolkit.defaultchromeuri\", \"chrome://$xulname/content/$xulfile\"); /* debugging prefs */ pref(\"browser.dom.window.dump.enabled\", true); pref(\"javascript.options.showinconsole\", true); pref(\"javascript.options.strict\", true); pref(\"nglayout.debug.disable_xul_cache\", true); pref(\"nglayout.debug.disable_xul_fastload\", true); ">$xulprefs # copy xul file to right location and run it ############################################################################## cp $xulfile $xuldir xulrunner $xulappini $@ ...
XUL Explorer - Archive of obsolete content
indicator in the statusbar shows errors.
calIFileType - Archive of obsolete content
description the description to show to the user in the filter list.
nsIContentPolicy - Archive of obsolete content
if you do any of these things in your shouldload() implementation, expect unpredictable behavior, possibly including crashes, content not showing up, content showing up doubled, etc.
2006-11-22 - Archive of obsolete content
if anyone has experience with these issues, and is comfortable helping out in the mozilla/accessible module, would you please take a look at https://bugzilla.mozilla.org/show_bug.cgi?id=166994 he stated that he almost had it working a couple of years ago.
2006-11-03 - Archive of obsolete content
firing pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab.
2006-11-04 - Archive of obsolete content
pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab.
2006-12-01 - Archive of obsolete content
discussions firefox 2.0 should re-implement modal window.open to support web 2.0 a plea to re-implement the option to show modal windows, using window.open(), from inside an untrusted script.
2006-10-06 - Archive of obsolete content
https://bugzilla.mozilla.org/show_bug.cgi?id=354866 taking moz180-linux-tbox down temporarily oct 6th early afternoon (pdt) on october 5th rob helmer announced that: he will be taking the 1.8.0 branch (en-us and l10n) linux tinderbox down tomorrow afternoon (oct 6th, pdt) in order to clone the disks and create a staging server for the release automation work.
2006-10-27 - Archive of obsolete content
gavin responded to tony's posting saying that the log file shows a "no space left on device" error when trying to link the final executable.
2006-11-03 - Archive of obsolete content
he has created the following bug entry https://bugzilla.mozilla.org/show_bug.cgi?id=331404.
2006-11-24 - Archive of obsolete content
proposal for (wcap) calendar subscription a proposal shows a possible integration into lightning.
Monitoring plugins - Archive of obsolete content
here is an example that shows the runtime in an alert box to the user if the runtime exceeds half a second in length: observe: function(subject, topic, data) { if (topic == "experimental-notify-plugin-call" ) { if (data > 0.500) { alert("runtime is: " + data); } } } note: this is just a simplified example and the use of alert() is discouraged as the component can send hundreds of notification...
NPSavedData - Archive of obsolete content
see instance destruction for a code example that shows how to use npsaveddata.
The First Install Problem - Archive of obsolete content
the example registry key shows the suggested "key creation" at work for an example application called scobe scrubobat (which doesn't really exist!).
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
an example using the most popular element of the rss slash module is shown below: <?xml version="1.0"> <rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" > <channel> <title>example</title> <description>an rss example with slash</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>...
Why Well-Formed Web RSS Module is Popular - Syndicating Your Comments - Archive of obsolete content
an example using the most popular element of the well-formed web rss module is shown below: <?xml version="1.0"> <rss version="2.0" xmlns:wfw="http://wellformedweb.org/commentapi/" > <channel> <title>example</title> <description>an rss example with wfw</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>i like root beer</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:articl...
Syndicating content with RSS - Archive of obsolete content
when you make a blog, an internet radio show, or an internet television show, you are syndicating.
Why use RSS - Archive of obsolete content
people are using it to syndicate all sorts of things: news articles, blogs, bookmarks, internet radio shows, internet television shows, software updates, e-mails, mailing lists, music playlists, and more.
Getting Started - Archive of obsolete content
it guides you, step-by-step, through the basics of rss and shows you working examples in action.
title - Archive of obsolete content
why can't i get any tang?</description> </item> </channel> </rss> attributes none sub-elements none parent elements the table below shows a list of rss elements that this element can be a child of.
NSPR Release Engineering Guide - Archive of obsolete content
feature complete update ...pr/include/prinit.h with release numbers build all targets, debug and optimized on all platforms using local directories run the test suite on all targets verify release numbers show up in binaries resolve testing anomalies tag the tree with nsprpub_release_x_y_z_beta beta release checkout a whole new tree using the tag from above build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /share/builds/components/nspr20/.vx.y.z 1 run e...
TCP/IP Security - Archive of obsolete content
the four tcp/ip layers, from highest to lowest, are shown below.
Common Firefox theme issues and solutions - Archive of obsolete content
ork around this issue, you need to either rename any of the following files that are in your chrome://browser/skin/ folder and fix any references to those files, or copy them to the folder chrome://browser/skin/lion/: keyhole-circle.png toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows.
Theme changes in Firefox 3.5 - Archive of obsolete content
to do this only for 3.5 use a css selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } private browsing: show private browsing state by coloring the url bar, or by adding an icon to the toolbox/tabbrowserbar.
Theme changes in Firefox 3 - Archive of obsolete content
the rule that's needed to show and hide the go button and other location bar icons is: #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button { visibility: collapse; } images to add add the following images: chrome://global/skin/icons/information-16.png used when presenting information notices.
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
« previousnext » this article shows how to take an existing extension and update it so that it can be used in additional mozilla applications.
Using Firebug and jQuery (Screencast) - Archive of obsolete content
$("div.c-body").show(); - show all comments, even ones that've been buried.
Using the W3C DOM - Archive of obsolete content
the following examples show how to modify the text of a span element that already exists in the html file.
Browser Feature Detection - Archive of obsolete content
this article has generally never been more than a way to show off firefox web compatibility, rather than something truly informative in a broader sense.
-ms-scrollbar-3dlight-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-3dlight-color property for a <textarea> element.
-ms-scrollbar-base-color - Archive of obsolete content
</div> </body> the following image shows the result.
-ms-scrollbar-darkshadow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-darkshadow-color property for a <textarea> element.
-ms-scrollbar-face-color - Archive of obsolete content
</div> </body> this image shows the result: specifications not part of any specification.
-ms-scrollbar-highlight-color - Archive of obsolete content
</div> </body> this image shows the result: specifications not part of any specification.
-ms-scrollbar-shadow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-shadow-color property for a <textarea> element.
-ms-scrollbar-track-color - Archive of obsolete content
</div> </body> the following image shows the result.
::-ms-check - Archive of obsolete content
the screenshot to the left shows what will happen when you check the buttons if you don't have access to internet explorer or edge.
E4X for templating - Archive of obsolete content
} ret+=h(k, arr[k], it, lev); ++it; } } return ret; } the following real case example iterates over an array of the lines in an e4x child element to produce an xmllist of multiple vbox's representing each line: <vbox> {foreach(e(someel.somechild[0]).split('\n'), function (line) <description>{line}</description> )} </vbox> the following example shows iteration over an e4x object itself: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem}</row> <row><image src="chrome://myext/skin/images/fillerrow.jpg" /></row> </>)} or if the e4x child element had its own children and text: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem.text()} {elem.somechild}</row> <row><image src="chrome://myext/skin/images/fill...
Processing XML with E4X - Archive of obsolete content
ame().uri); // alerts "http://www.w3.org/1999/xhtml" to access elements that are within a non-default namespace, first create a namespace object encapsulating the uri for that namespace: var svgns = new namespace('http://www.w3.org/2000/svg'); this can now be used in e4x queries by using namespace::localname in place of a normal element specifier: var svg = xhtml..svgns::svg; alert(svg); // shows the <svg> portion of the document using generators/iterators with e4x as of javascript 1.7, it is possible to use generators and iterators, giving more options for traversing e4x.
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
see https://bugzilla.mozilla.org/show_bug.cgi?id=1336740 and https://bugzilla.mozilla.org/show_bug.cgi?id=578700.
Debug.setNonUserCodeExceptions - Archive of obsolete content
example the following code shows how to set this property.
Enumerator.atEnd - Archive of obsolete content
example in following code, the atend method is used to determine if the end of a list of drives has been reached: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; if (drv.isready) { var freegb = drv.freespace / bytespergb; var totalg...
Enumerator.item - Archive of obsolete content
example function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; if (drv.isready) { var freegb = drv.freespace / bytespergb; var totalg...
Enumerator.moveFirst - Archive of obsolete content
example in following example, the movefirst method is used to evaluate members of the drivescollection from the beginning of the list: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; if (drv.isready) { var freegb = drv.freespace / bytespergb; var totalg...
Enumerator.moveNext - Archive of obsolete content
example in following example, the movenext method is used to move to the next drive in the drives collection: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; if (drv.isready) { var freegb = drv.freespace / bytespergb; var totalg...
Enumerator - Archive of obsolete content
example the following code shows the usage of the enumerator object: var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); document.write(fso.drives); var e = new enumerator(fso.drives); var drivestring = ""; e.movefirst(); while (e.atend() == false) { var drv = e.item(); drivestring += drv.path + " - "; if (drv.isready){ var freegb = drv.freespace / bytesperg...
JavaArray - Archive of obsolete content
var javastring = new java.lang.string("hello world!"); var bytearray = javastring.getbytes(); example: instantiating a javaarray in javascript with the newinstance method in javascript 1.4, you can use a javaclass object as the argument for the newinstance method which creates the array, as shown in the following code: var dogs = java.lang.reflect.array.newinstance(java.lang.string, 5); in javascript 1.1, use a class object returned by java.lang.class.forname as the argument for the newinstance method, as shown in the following code: var datatype = java.lang.class.forname("java.lang.string"); var dogs = java.lang.reflect.array.newinstance(datatype, 5); ...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
in addition, this example shows how the differences between browsers in handling inline content in text/xml or application/xhtml+xml can be problematic.
RDF: Resource Description Framework for metadata - Archive of obsolete content
ArchiveWebRDF
documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine.
Server-Side JavaScript - Archive of obsolete content
server-side javascript is another way in which, as this article quotes eich, "mozilla wants to 'get people thinking about javascript as a more general-purpose language' and show them that 'it really is a platform for writing full applications.'" many vendors today are embedding mozilla rhino or mozilla spidermonkey into web server environments.
Writing JavaScript for XHTML - Archive of obsolete content
this article shows some of the reasons alongside with strategies to remedy the problems.
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.
Implementation Status - Archive of obsolete content
d 8.1.7 range partial 316355; 343523; 8.1.8 trigger supported 8.1.9 submit supported 8.1.10 select partial @selection does not work, select inside repeat may not work correctly, select that mixes itemsets with items may show them in the wrong order 282840; 371595; 372127; 8.1.11 select1 partial there are some resize issues, select/deselect/valuechange firing in wrong order.
Mozilla XForms Specials - Archive of obsolete content
labelposition for xforms:input elements bound to a boolean node we support an attribute labelposition in the namespace http://www.mozilla.org/projects/xfor...009/extensions, which allows the form author to define on which side of the checkbox the label will be shown.
Requests For Enhancement - Archive of obsolete content
ArchiveWebXFormsRFE
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%.
XForms Styling - Archive of obsolete content
=== example === here's a small example that shows equivalent styles for chiba and mozilla xforms.
XForms Alert Element - Archive of obsolete content
introduction this message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec).
XForms Secret Element - Archive of obsolete content
any other xform control bound to that data will show that data 'as is'.
XForms Textarea Element - Archive of obsolete content
introduction serves to show/change multiline text (see the spec).
Displaying a graphic with audio samples - Archive of obsolete content
the following example shows how to take samples from an audio stream and display them behind an image (in this case, the mozilla logo), giving the impression that the image is built from the samples.
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
see bug 110360, which explains the problem and shows when the fix was applied.
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
in those cases where it is necessary to author documents in "quirks" mode, but the breaking of table inheritance is not desired, authors can use gecko's standards support to overcome the table-font rule shown above.
Web Standards - Archive of obsolete content
tools firebug extension web developer extension markup validation service (w3c) css validation service (w3c) examples mozilla 1.0 demos - showing off what can be done with web standards.
Common causes of memory leaks in extensions - Extensions
the following example shows how to unload your modules again (bootstrap.js): components.utils.import("resource://gre/modules/services.jsm"); function startup(data, reason) { // this assumes your add-on did register some chrome components.utils.import("chrome://myaddon/content/mymodule.jsm"); } function shutdown(data, reason) { // no need to do regular clean up when the application is closed // unless you need to...
Building up a basic demo with A-Frame - Game development
add the <a-animation> element seen below to the <a-box> element as a child, as shown: <a-box color="#0095dd" rotation="20 40 0" position="0 1 0"> <a-animation attribute="rotation" from="20 0 0" to="20 360 0" direction="alternate" dur="4000" repeat="indefinite" easing="ease"> </a-animation> </a-box> as with any other entities, you can define key properties for the animation.
Building up a basic demo with Babylon.js - Game development
to show actual animation, we need to make changes to these values inside the rendering loop at the end of our code, so they are updated on every frame.
Building up a basic demo with PlayCanvas editor - Game development
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.
Mobile touch controls - Game development
the preventdefault() function is needed to prevent the browser from moving — without it you'd have the default behaviour, and the canvas would be dragged around the page, which would show the browser scroll bars and look messy.
Implementing controls using the Gamepad API - Game development
demo the full version of the hungry fridge game was built first, and then to showcase the gamepad api in action and show the javascript source code, a simple demo was created.
Crisp pixel art look with image-rendering - Game development
developers have been manually scaling up graphics so they are shown with blocks that represent pixels.
Square tilemaps implementation: Static maps - Game development
tileatlas, // image (tile - 1) * map.tsize, // source x 0, // source y map.tsize, // source width map.tsize, // source height c * map.tsize, // target x r * map.tsize, // target y map.tsize, // target width map.tsize // target height ); } } } demo our static tilemap implementation demo pulls the above code together to show what an implementation of this map looks like.
WebRTC data channels - Game development
this article explains more about this, and shows you how to use libraries to implement data channels in your game.
Techniques for game development - Game development
this article explains what this can do for you, and shows how to use libraries that make this easy.
asm.js - Game development
we will show what asm.js code looks like and explain how it helps and how you can use it.
Tools for game development - Game development
this article shows how to make use of shumway, and how to contribute fixes and bugs to the project.
Game over - Game development
for now we'll keep it simple, showing an alert message and restarting the game by reloading the page.
Move the ball - Game development
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 line: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } now comes the important part: we want to add a small value to x and y after every frame has been drawn to make it appear that the ball is moving.
Track the score and win - Game development
the first parameter is the text itself — the code above shows the current number of points — and the last two parameters are the coordinates where the text will be placed on the canvas.
Collision detection - Game development
first, add a new line inside your update() function that checks for collision detection between ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, paddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the positions of all the bricks in the group.
Initialize the framework - Game development
update the src value of the first <script> element as shown above.
Load the assets and print them on screen - Game development
now, to show it on the screen we will use another phaser method called add.sprite(); add the following new code line inside the create() function as shown: function create() { ball = game.add.sprite(50, 50, 'ball'); } this will add the ball to the game and render it on the screen.
Move the ball - Game development
add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } the code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame.
Win the game - Game development
if there are no more bricks left alive, then we show a winning message, restarting the game once the alert is dismissed.
Touch Event Horizon - Game development
this article is for touch event horizon and a game related to it touch gestures and events link the example game github repository live demo setting up the canvas counting the taps touchstart, touchend collecting the bonus touchmove future developments summary this tutorial shows how to use touch events to create a game on a <canvas>.
API - MDN Web Docs Glossary: Definitions of Web-related terms
gps), which can then be used in conjunction with the google maps apis to for example plot the user's location on a custom map and show them what tourist attractions are in their area.
Entity - MDN Web Docs Glossary: Definitions of Web-related terms
to display these characters as text, replace them with their corresponding character entities, as shown in the following table.
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
the image below shows the line numbers of the grid, assuming the language is left-to-right.
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
the image below shows the first row track on a grid.
Hotlink - MDN Web Docs Glossary: Definitions of Web-related terms
for example, an image hosted on site1.com is shown directly on site2.com.
Media (Audio-visual presentation) - MDN Web Docs Glossary: Definitions of Web-related terms
the term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, tv shows, or any other form of content that is presented over a period of time.
Media - MDN Web Docs Glossary: Definitions of Web-related terms
media (audio-visual presentation) the term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, tv shows, or any other form of content that is presented over a period of time.
Normative - MDN Web Docs Glossary: Definitions of Web-related terms
specifications might also contain sections that are marked as non-normative or informative, which means those are provided there for the purpose of helping the reader understand the specifications better or to showcase an example or best practice, which need not be followed as a rule.
Response header - MDN Web Docs Glossary: Definitions of Web-related terms
the following shows a few response headers after a get request.
Round Trip Time (RTT) - MDN Web Docs Glossary: Definitions of Web-related terms
64 bytes from 216.58.194.174: icmp_seq=2 ttl=55 time=24.287 ms 64 bytes from 216.58.194.174: icmp_seq=3 ttl=55 time=34.904 ms 64 bytes from 216.58.194.174: icmp_seq=4 ttl=55 time=26.119 ms --- google.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 23.781/26.828/34.904/4.114 ms in the above example, the average round trip time is shown on the final line as 26.8ms.
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
if you follow those rules closely when doing seo for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads).
SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms
an spa (single-page application) is a web app implemention that loads only a single web document, and then updates the body content of that single document via javascript apis such as xmlhttprequest and fetch when different content is to be shown.
Signature (security) - MDN Web Docs Glossary: Definitions of Web-related terms
a signature, or digital signature, is a protocol showing that a message is authentic.
Signature - MDN Web Docs Glossary: Definitions of Web-related terms
signature (security) a signature, or digital signature, is a protocol showing that a message is authentic.
Speed index - MDN Web Docs Glossary: Definitions of Web-related terms
speed index (si) is a page load performance metric that shows you how quickly the contents of a page are visibly populated.
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
if you really want to show a symbol, we need to call .tostring() on it.
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
whitespace is a set of characters which is used to show horizontal or vertical spaces between other characters.
Array - MDN Web Docs Glossary: Definitions of Web-related terms
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.
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
(for example, firefox does not support it per https://bugzilla.mozilla.org/show_bug.cgi?id=109553.) other methods, like put or delete are not cacheable and their result cannot be cached.
non-normative - MDN Web Docs Glossary: Definitions of Web-related terms
software specifications often contains information marked as non-normative or informative, which means that those are provided there for the purpose of helping the readers to understand the specification better or to show an example or a best practice, and not needed to be followed as a rule.
Test your skills: WAI-ARIA - Learn web development
the problem we have now is that when the dom changes to show a new decription, screenreaders cannot see what has changed.
A cool-looking box - Learn web development
example the following screenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch.
Creating fancy letterheaded paper - Learn web development
example the following screenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch.
Fundamental CSS comprehension - Learn web development
example the following screenshot shows an example of what the finished design should look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch.
CSS selectors - Learn web development
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.
Styling tables - Learn web development
zebra striping we wanted to dedicate a separate section to showing you how to implement zebra stripes — alternating rows of color that make the different data rows in your table easier to parse and read.
CSS values and units - Learn web development
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.
CSS building blocks - Learn web development
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.
Test your skills: Grid Layout - Learn web development
use the grid-area and grid-template-areas properties to lay the items out as shown in the image.
Beginner's guide to media queries - Learn web development
in this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive.
Positioning - Learn web development
let's put together a simple example to show what we mean.
Supporting older browsers - Learn web development
float and clear as shown above, the float and clear properties cease to affect the layout if floated or cleared items become flex or grid items.
CSS layout - Learn web development
in this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive.
Getting started with CSS - Learn web development
the .css extension shows that this is a css file.
How CSS is structured - Learn web development
body { font: 1em/150% helvetica, arial, sans-serif; padding: 1em; margin: 0 auto; max-width: 33em; } @media (min-width: 70em) { body { font-size: 130%; } } h1 { font-size: 1.5em; } div p, #id:first-line { background-color: red; border-radius: 3px; } div p { margin: 0; padding: 1em; } div p + p { padding-top: 0; } the next example shows the equivalent css in a more compressed format.
How CSS works - Learn web development
the visual display of the page is shown on the screen (this stage is called painting).
Using your new knowledge - Learn web development
working with css the following live example shows a biography, which has been styled using css.
What is CSS? - Learn web development
for example "i want the main heading on my page to be shown as large red text." the following code shows a very simple css rule that would achieve the styling described above: h1 { color: red; font-size: 5em; } the rule opens with a selector .
CSS FAQ - Learn web development
LearnCSSHowtoCSS FAQ
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.
Fundamental text and font styling - Learn web development
this takes up to four values, as shown in the example below: text-shadow: 4px 4px 5px red; the four properties are as follows: the horizontal offset of the shadow from the original text — this can take most available css length and size units, but you'll most commonly use px; positive values move the shadow right, and negative values left.
Typesetting a community school homepage - Learn web development
example the following screenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch.
How can we design for all types of users? - Learn web development
they can, for instance, feature a graph, or show a person's gesture, or any other information.
What is the difference between webpage, website, web server, and search engine? - Learn web development
here is an instance of firefox showing a google search box as its default startup page: next steps dig deeper: what is a web server see how web pages are linked into a web site: understanding links on the web ...
How do I start to design my website? - Learn web development
again, there are so many web services already available for showcasing photos that it isn't worth the effort to build a new site just to spread the word about how cute our cats are.
What is a URL? - Learn web development
an anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot.
What is a Domain Name? - Learn web development
alternatively, if you use a system with a built-in shell, type a whois command into it, as shown here for mozilla.org: $ whois mozilla.org domain name:mozilla.org domain id: d1409563-lror creation date: 1998-01-24t05:00:00z updated date: 2013-12-08t01:16:57z registry expiry date: 2015-01-23t05:00:00z sponsoring registrar:markmonitor inc.
How do you set up a local testing server? - Learn web development
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 HTML5 input types - Learn web development
the below screenshots show a non-empty search field in firefox 71, safari 13, and chrome 79 on macos, and edge 18 and chrome 79 on windows 10.
Example 3 - Learn web development
elect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; // ------------- // // event binding // // ------------- // window.addevent...
Example 4 - Learn web development
elect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previousel...
Example 5 - Learn web development
elect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previousel...
Your first form - Learn web development
forms allow users to enter data, which is generally sent to a web server for processing and storage (see sending form data later in the module), or used on the client-side to immediately update the interface in some way (for example, add another item to a list, or show or hide a ui feature).
CSS basics - Learn web development
add the following lines (shown below), replacing the font-family assignment with your font-family selection from what will your website look like?.
Dealing with files - Learn web development
open up your index.html file, and insert the following code into the file exactly as shown.
Installing basic software - Learn web development
overview: getting started with the web next in installing basic software, we show you what tools you need to do simple web development and how to install them properly.
The web and web standards - Learn web development
testing tools that can be used to run tests to show whether your code is behaving as you intended it to.
What will your website look like? - Learn web development
write a title and a few paragraphs and think of an image you'd like to show on your page.
Using data attributes - Learn web development
for example to show the parent data on the article you can use generated content in css with the attr() function: article::before { content: attr(data-parent); } you can also use the attribute selectors in css to change styles according to the data: article[data-columns='3'] { width: 400px; } article[data-columns='4'] { width: 600px; } you can see all this working together in this jsbin example.
Creating hyperlinks - Learn web development
this article shows the syntax required to make a link, and discusses link best practices.
Marking up a letter - Learn web development
example the following screenshot shows an example of what the letter might look like after being marked up.
Structuring a page of content - Learn web development
example the following screenshot shows an example of what the homepage might look like after being marked up.
HTML table advanced features and accessibility - Learn web development
the following markup shows a simple nested table: <table id="table1"> <tr> <th>title1</th> <th>title2</th> <th>title3</th> </tr> <tr> <td id="nested"> <table id="table2"> <tr> <td>cell1</td> <td>cell2</td> <td>cell3</td> </tr> </table> </td> <td>cell2</td> <td>cell3</td> </tr> <tr> <td>cell4</td> <td>cell5</td> <td...
Assessment: Structuring planet data - Learn web development
ensure all the content is placed into the right cells — in the raw data, each row of planet data is shown next to its associated planet.
JavaScript building blocks - Learn web development
in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime.
Introduction to web APIs - Learn web development
the following code provides a simple example of how this would be used: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xmlhttprequest(); request.open('get', requesturl); request.responsetype = 'json'; request.send(); request.onload = function() { const superheroes = request.response; populateheader(superheroes); showheroes(superheroes); } note: you can see this code in action in our ajax.html example (see it live also).
Manipulating documents - Learn web development
in this article we'll focus mostly on manipulating the document, but we'll show a few other useful bits besides.
Silly story generator - Learn web development
will generate another random silly story if you press the button again (and again...) the following screenshot shows an example of what the finished program should output: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do.
Object-oriented JavaScript for beginners - Learn web development
there are lots of things you could know about a person (their address, height, shoe size, dna profile, passport number, significant personality traits ...) , but in this case we are only interested in showing their name, age, gender, and interests, and we also want to be able to write a short introduction about them based on this data, and get them to say hello.
Test your skills: Object-oriented JavaScript - Learn web development
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.
Introducing JavaScript objects - Learn web development
inheritance in javascript with most of the gory details of oojs now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes.
Aprender y obtener ayuda - Learn web development
this is more the kind of thinking you do while you are in the shower, or during a coffee break.
Ember interactivity: Events, classes and state - Learn web development
add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='what needs to be done?' placeholder='what needs to be done?' autofocus {{on 'keydown' this.onkeydown}} > this new attribute is inside double curly braces, which tells you it is part of ember's dynamic templating syntax.
Framework main features - Learn web development
the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expression represents an html <header> element with a <h1> element inside.
Accessibility in React - Learn web development
this shows you that the browser's focus has moved.
Getting started with React - Learn web development
if you were to rename the app function to app, your browser would show you an error.
React resources - Learn web development
this screenshot shows our finished application as it appears in react devtools: on the left, we see all of the components that make up our application, including some unique keys for the things that are rendered from arrays.
Deployment and next steps - Learn web development
total 5 (delta 3), reused 0 (delta 0) to gitlab.com:opensas/mdn-svelte-todo.git 7dac9f3..5725f46 master -> master whenever there's a job running gitlab will display an icon showing the process of the job.
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
we will use this requirement as an excuse to show a very powerful feature that svelte provides us to add functionality to regular html elements: actions.
Using Vue computed properties - Learn web development
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.
Focus management with Vue refs - Learn web development
to give users a better experience, we'll add code to control the focus so that it gets set to the edit field when the edit form is shown.
Rendering a list of Vue components - Learn web development
update the label="my todo item" attribute to :label="item.label", and the :done="false" attribute to :done="item.done", as seen in context below: <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done"></to-do-item> </li> </ul> now when you look at your running app, it'll show the todo items with their proper names, and if you inspect the source code you'll see that the inputs all have unique ids, taken from the object in the app component.
Styling Vue components with CSS - Learn web development
the images below show the look of the app before and after the reset is applied.
Strategies for carrying out testing - Learn web development
safari has a similar mode too, which can be enabled by going to safari > preferences, and checking show develop menu, then choosing develop > enter responsive design mode.
Tools and testing - Learn web development
we finish up by providing a complete toolchain example showing you how to get productive.
Chrome Worker Modules
that is, the following will not show human-readable stacks: try { mymodule.foo(); } catch (ex) { log("exception raised at " + ex.filename) log("stack: " + ex.stack); } rather, you should use properties modulename and modulestack, as follows: try { mymodule.foo(); } catch (ex) { log("exception raised at " + ex.modulename) log("stack: " + ex.modulestack); } subtleties you shouldn’t mix both styles exports...
Accessibility Features in Firefox
this will show the html source for only the selected text, which is useful for understanding accessibility problems in some web sites.
Accessibility Information for Core Gecko Developers
this document shows several interactive desktop-style widgets that are accessible by keyboards and assistive technologies, and outlines a plan being developed by ibm, mozilla, and the wai protocols and formats working group (pfwg) to address the issue of dhtml accessibility.
Accessibility/LiveRegionDevGuide
in iaccessible2, there are two separate event types, namely event_object_show and event_object_hide.
Index
the content you add to a listing is therefore vital: from making effective use of keywords in your descriptions, to get visibility in external search engine results, through having an icon that attracts a user’s attention from a category list, to screenshots that show how useful your add-on is.
Building SpiderMonkey with UBSan
the stack trace should show a function such as __ubsan_handle_load_invalid_value or __ubsan_handle_type_mismatch being called by the buggy c++ code.
Continuous Integration
the sheriffs' role is to "keep the tree green", or in other words, to keep the code in our respositories in a good state, to the extent that the state is reflected in the output shown on treeherder.
Debugging JavaScript
this shows any javascript errors in your app, as well as any logging calls from the console api.
HTTP logging
mac os x these instructions show how to log http traffic in firefox on mac os x.
The Firefox codebase: CSS Guidelines
remember that while a tab content's scrollbar still shows on the right in rtl, an overflow scrollbar will show on the left.
Creating Custom Events That Can Pass Data
var event = document.createevent("nsdommyevent"); event.initevent("nsdommyevent", true, true); window.dispatchevent(event); dispatching your event in c++ the following shows how to dispatch your event in c++: nscomptr<nsiwindowwatcher> wwatcher (do_getservice("@mozilla.org/embedcomp/window-watcher;1")); // the window watcher will be able to give me a handle to the window nscomptr<nsidomwindow> awindow; // a handle to the window nscomptr<nsidomdocument> adoc; // a handle to the document nscomptr<nsidomeventtarget> twindow; // the targe...
Reviewer Checklist
the first line should be a short description (since only the first line is shown in the log), and additional description, if needed, should be present, properly wrapped, in later lines.
Developer guide
treeherder treeherder shows the status of the tree (whether or not it currently builds successfully).
Index
one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space.
Storage access policy: Block cookies from trackers
this indicator is shown as a shield icon in the domain column.
Site Identity Button
if the site identity button on your site shows something you do not expect (for example, an orange warning triangle when you expect a green padlock) you can find out the cause of the problem by looking in the web console in the firefox developer tools: ensure your web console is displaying messages in the 'security' category force-refresh the page on your site that is causing problems watch for any security messages that may appear a downgraded security ui will be due to one of these three problems: mixed content - while your page has been served over tls, but sub...
Firefox
one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space.
mozbrowsercaretstatechanged
this is used by the embedder to show a context menu for clipboard actions.
mozbrowserclose
document.queryselector("iframe"); browser.addeventlistener("mozbrowserclose", function() { console.log("browser window has been closed; iframe will be destroyed."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserdocumentfirstpaint
xample var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserdocumentfirstpaint", function() { console.log("first content painted."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsererror
e var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsererror", function( event ) { console.log("an error occurred:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserfindchange
rfindchange", function(event) { console.log("currently highlighted: " + event.details.activematchordinal + " out of " + event.details.numberofmatches); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserfirstpaint
example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserfirstpaint", function(event) { console.log("first content painted."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsericonchange
ocument.queryselector("iframe"); browser.addeventlistener("mozbrowsericonchange", function( event ) { console.log("the url of the new favicon is:" + event.details.href); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserlocationchange
var browser = document.queryselector("iframe"); browser.addeventlistener('mozbrowserlocationchange', function (event) { urlbar.value = event.detail.url; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsermanifestchange
r = document.queryselector("iframe"); browser.addeventlistener("mozbrowsermanifestchange", function(event) { console.log("new manifest url: " + event.details.href); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsermetachange
its name is " + event.details.name + ", and its content is " + event.details.content + "."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsertitlechange
ector("iframe"); browser.addeventlistener("mozbrowsertitlechange", function( event ) { console.log("the title of the document is:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowserusernameandpasswordrequired ...
Browser API
mozbrowsershowmodalprompt sent when alert(), confirm(), or prompt() are called within a browser <iframe>.
ChromeWorker
promiseworker github :: promiseworker - shows how to uses promises as an twist on postmessage feature of chromeworker ...
Script security
(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.
Gecko versions and application versions
the following table shows the various versions of gecko and what versions of common applications are based on them.
How to get a stacktrace with WinDbg
windbg will show "busy" at the bottom of the application window until the download is complete.
How to Report a Hung Firefox
check the cpu usage of the firefox process(es): is it idle, using 100% of a core (which may show up as 50%, 25% in your monitoring tool if you have a multi-core processor) or neither?
Integrated Authentication
<i>this document is incomplete ...</i> flow diagram the diagram below shows how various components interact.
Internationalized Domain Names (IDN) Support in Mozilla Browsers
it was shown to be language independent, superior in compression, compact in code size, round-trip safe, and superior for encoding chinese/japanese/korean characters.
Add-on Manager
these pages show you how to load pages such as services page etc.
Widget Wrappers
nb: this property is writable, and will toggle all the widgets' nodes' disabled states label for api-provided widgets, the label of the widget tooltiptext for api-provided widgets, the tooltip of the widget showinprivatebrowsing for api-provided widgets, whether the widget is visible in private browsing single wrapper properties all of a wrapper's properties are read-only unless otherwise indicated.
NetUtil.jsm
example this example shows the basic code consumers would need to implement to be correct.
Promise
warning: if the onfulfill callback throws an exception, the onreject callback is not invoked and the exception won't be caught, nor shown in the console (you will see a promise chain failed error).
Sqlite.jsm
this example shows multiple rows of a table being returned using the onrow function parameter.
XPCOMUtils.jsm
examples definelazygetter var myservices = {}; cu.import('resource://gre/modules/xpcomutils.jsm'); //set it up xpcomutils.definelazygetter(myservices, 'as', function () { return cc['@mozilla.org/alerts-service;1'].getservice(ci.nsialertsservice) }); //when you need to use it myservices.as.showalertnotification('chrome://branding/content/icon64.png', 'this was lazyloaded', 'this is a notification from myservices.as', null, null); ...
Index
this page is to help explain how to localize these strings so that the correct plural form is shown to the user.
L10n testing with xcode
a window will then appear showing the diff between the imported xliff file and the existing resources in the project folder.
Localizing extension metadata on addons.mozilla.org
any field that is blank will just show up in the default locale.
Localizing with Mercurial
your config file should have the following settings: [ui] username = your real name <user@example.com> merge = internal:merge [defaults] commit = -v [diff] git = 1 showfunc = 1 unified = 8 to configure hg, follow these steps: create a new file in your favorite text editor.
QA phase
also at this point, you shouldn't have any uncommitted changes (i.e., running the hg status command should show nothing).
Localization technical reviews
more intl.properties checkpoints, cont we also check the plural rule for the locale, that the general.useragent.locale is set to the locale code, that accept-lang shows the locale code(s) (like ab, ab-cd,...) and is followed by en and en-us, and finally that intl.menuitems.insertseparatorbeforeaccesskeys = true, where "true" should be left untranslated.
MathML Demo: <mfrac> - fractions
and this is an example where the bevelled attribute is set inside the radical y 2 - t 2 1 ( 1 + | y 2 - t 2 | 2 ) and this shows a combination with a background image at a desired opacity mathml background image html content <div class="background"></div> <math display="block"> <mrow> <msub> <mi>z</mi> <mi>&alpha;</mi> </msub> <mrow> <mo>(</mo> <mi>f</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mn>1</mn> <mrow> <mn>2</mn> <mi>i</mi> <mo>&thinspace;</mo> <mi>cos</mi> <mo>(</mo> <mfrac> <...
MathML Demo: <mo> - operator, fence, separator, or accent
( 1 2 3 4 5 ) + 1 given the symmetric restriction on fences, it is very difficult for latex to produce the product of a fenced row vector and a fenced column vector as shown below.
MathML Demo: <msqrt>, <mroot> - radicals
about all you can do with them is see how the rendering stretches them in various ways: horizontally sin ⁡ x ⁢ cos ⁡ y vertically 1 2 3 4 and det ( 1 2 3 4 ) 2 as well as 2 x ⁢ y ⁢ z ⁢ w 2 1 2 3 4 and 2 ⌈ det ( 1 2 3 4 ) ⌉ the formula of binet shows how the n-th term in the fibonacci series can be expressed using roots f n = 1 5 [ ( 1 + 5 2 ) n - ( 1 - 5 2 ) n ] ...
Mozilla Port Blocking
if a user attempts to access a uri on a blocked port, mozilla shows one of the following alerts to the user or in the error console.
Investigating leaks using DMD heap scan mode
together, these lines show a chain of strong references from an object the cycle collector thinks needs to be kept alive, 0x7f0899b4e550, to the object 0x7f0897082c00 that you asked about.
GPU performance
amd gpu shaderanalyzer - will compile a shader and show the machine code and give static pipeline estimations.
Memory reporting
because you want to show them separately in about:memory.
Power profiling overview
intel processor basics processor layout the following diagram (from the intel power governor documentation) shows how machines using recent intel processors are constructed.
Refcount tracing and balancing
but, more specifically, it shows you that: ns_newfoo() "leaks" a refcount.
TraceMalloc
however, it cannot distinguish between owning and non-owning pointers, which means that non-owning pointers that are nulled out by destructors may show up in leaksoup as cycles.
perf
the following example shows how to invoke it for this purpose.
tools/power/rapl
once sampling is finished — either because the user interrupted it, or because the requested number of samples has been taken — the following summary data is shown: 10 samples taken over a period of 10.000 seconds distribution of 'total' values: mean = 8.85 w std dev = 3.50 w 0th percentile = 5.17 w (min) 5th percentile = 5.17 w 25th percentile = 5.17 w 50th percentile = 8.13 w 75th percentile = 11.16 w 95th percentile = 14.63 w 100th percentile = 14.63 w (max) the distribution data is omitted if there was zero or one ...
browser.pagethumbnails.capturing_disabled
the preference browser.pagethumbnails.capturing_disabled controls whether the application creates screenshots of visited pages which will be shown if the web page is shown in the grid of the "new tab page" (about:newtab) which offers the most often visited pages for fast navigation.
browser.urlbar.trimURLs
false all parts of the url are shown.
mail.tabs.drawInTitlebar
false the tabs are drawn in a separate tab bar, and the title bar shows the title of the current tab (e.g.
L20n Javascript API
these errors include: context.runtimeerror, when an entity is missing or broken in all supported locales; in this case, l20n will show the the best available fallback of the requested entity in the ui: the source string as found in the resource, or the identifier.
L20n
what l20n looks like here is a simple, straightforward example showing an english string being provided: <brandname "firefox"> <about "about {{ brandname }}"> here is the same string being provided in slovenian: <brandname { nominative: "firefox", genitive: "firefoxa", dative: "firefoxu", accusative: "firefox", locative: "firefoxu", instrumental: "firefoxom" }> <about "o {{ brandname.locative }}"> for developers documentation for developers...
McCoy
https://fireclipse.svn.sourceforge.net/svnroot/fireclipse/trunk/fireclipseextensions/chromebug/mccoy/signontheline/ bug 396525 - patch to mccoy https://bugzilla.mozilla.org/show_bug.cgi?id=396525 signing update manifests before you release your add-on in order to verify the update manifests applications need to already have information from you for how to verify it.
Midas
examples this example shows the basic structure described in the notes section : <html> <head> <title>simple edit box</title> </head> <body> <iframe id="midasform" src="about:blank" onload="this.contentdocument.designmode='on';" ></iframe> </body> </html> methods document.execcommand executes the given command.
NSPR release procedure
after you have run repackage.sh, follow the instructions in to upload the files to ftp.mozilla.org's staging server, so that they eventually show up on ftp.mozilla.org.
Optimizing Applications For NSPR
no failure attributable to the flaw has shown up in any tests or products - yet.
Anonymous Shared Memory
the pseudo-code below shows the use of a file-mapped shared memory by a parent and child processes.
I/O Functions
pr_open pr_delete pr_getfileinfo pr_getfileinfo64 pr_rename pr_access type praccesshow functions that act on file descriptors pr_close pr_read pr_write pr_writev pr_getopenfileinfo pr_getopenfileinfo64 pr_seek pr_seek64 pr_available pr_available64 pr_sync pr_getdesctype pr_getspecialfd pr_createpipe directory i/o functions pr_opendir pr_readdir pr_closedir pr_mkdir pr_rmdir socket manipulation functions the network programming interface presente...
PRIntervalTime
interval has expired ...> as long as the interval and the elapsed time (now - epoch) do not exceed half the namespace allowed by a printervaltime (231-1), the expression shown above provides the expected result even if the signs of now and epoch differ.
PR_Access
syntax #include <prio.h> prstatus pr_access( const char *name, praccesshow how); parameters the function has the following parameters: name the pathname of the file whose accessibility is to be determined.
An overview of NSS Internals
the signature is verified if it can be shown that the signature data block must have been produced by the owner of the public key (because only that owner has the associated private key).
NSS Certificate Download Specification
when it is downloaded the user will be shown a sequence of dialogs that will guide them through the process of accepting the certificate authority and deciding if they wish to trust sites certified by the ca.
JSS Provider Notes
the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens cryptomanager manager = cryptomanager.getinstance(); cryptotoken tokena = manager.gettokenbyname("tokena"); cryptotoken tokenb = manager.gettokenbyname("tokenb"); // create an rsa keypairgenerator using tokena manager.setthreadtoken(tokena); keypairgenerator rsakpg = keypairgenerator.getinstance("r...
Mozilla-JSS JCA Provider notes
the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens cryptomanager manager = cryptomanager.getinstance(); cryptotoken tokena = manager.gettokenbyname("tokena"); cryptotoken tokenb = manager.gettokenbyname("tokenb"); // create an rsa keypairgenerator using tokena manager.setthreadtoken(tokena); keypairgenerator rsakpg = keypairgenerator.getinstance("mozil...
NSS 3.16.2 release notes
the default is to show a non-ascii character as ".".
NSS 3.19.1 release notes
this has been shown to break some applications.
NSS 3.20 release notes
in future versions of the tls implementation, a tls client might show a preference for certain dhe parameters, and the nss tls server side implementation might select a matching entry from the set of parameters that have been configured as preferred on the server side.
NSS Sample Code Utilities_1
this code shows the following: extract seed from noise file read der encoding from a file extract the password from a text file get the module password print as ascii or hexadecimal sample code #include <prlog.h> #include <termios.h> #include <base64.h> #include <unistd.h> #include <sys/stat.h> #include <prprf.h> #include "util.h" /* * these utility functions are adapted from those found in * the sectool library used by the nss security tools and * other nss test applications.
NSS Sample Code sample2
this example shows the use of a raw key.
NSS Sample Code sample4
-1 -2 -5 * * there are many ways to setup a public/private key to use - this * example shows one of them.
Utilities for nss samples
it shows the following: read der from a file.
NSS Sample Code
see https://bugzilla.mozilla.org/show_bug.cgi?id=490238 you are welcome to download the new samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update samples_branch the new samples: /docs/mozilla/projects/nss/new_nss_samples ...
NSS sources building testing
once the test suite has completed, a summary will be printed that shows the number of failures.
nss tech note3
the following table shows the oids recognized in the extended key usage extension, and how they map to cert types and key usages for ca and non-ca certs.
nss tech note4
also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way.
nss tech note8
all callers computed the expiration times explicitly, as shown above.
New NSS Samples
see https://bugzilla.mozilla.org/show_bug.cgi?id=490238 how to download the samples: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update samples_branch samples list: sample code 1: hashing sample code 2: init nss database sample code 3: encrypt/decrypt and mac using token sample code 4: encrypt/decrypt and mac using session objects sample code 5: encrypt/decrypt/mac output public key as a csr sample code 6: encrypt/decrypt/mac generating a pkcs#11 csr common code used by these samples: sampl...
PKCS11 FAQ
MozillaProjectsNSSPKCS11FAQ
however, these are not the services nss calls to get to other pkcs #11 modules, which show up separately under cryptographic modules.
PKCS11 Implement
the nss interprets the combination of the ckf_login_required and ckf_user_pin_initialized flags as shown in table 1.1.
Migration to HG
however, below is a brief summary that shows how to checkout the source code and build both nspr and nss: mkdir workarea cd workarea hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss cd nss # set use_64=1 on 64 bit architectures # set build_opt=1 to get an optimized build make nss_build_all note that the jss project has been given a private copy of the former mo...
NSS tools : crlutil
mozilla nss bug 836477 - https://bugzilla.mozilla.org/show_bug.cgi?id=836477 visible links 1.
gtstd.html
figure 2.1 relationships among nss libraries, cryptographic modules, slots, and tokens as shown in the figure, ssl communicates with pkcs #11 modules through the pkcs #11 interface.
sslcrt.html
returns the function returns one of these values: kt_null = 0 kt_rsa kt_dh kt_fortezza kt_kea_size comparing secitem objects secitem_compareitem compares two secitem objects and returns a seccomparison enumerator that shows the difference between them.
ssltyp.html
as long as you use the form shown here, your code will not need revision.
NSS Tools
the ssltap tool does not decrypt data, but it shows things like the type of ssl message (clienthello, serverhello, etc) and connection data (protocol version, cipher suite, etc).
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
modutil -list [modulename] -dbdir [sql:]directory listing the modules shows the module name, their status, and other associated security databases for certificates and keys.
NSS tools : pk12util
the certificates and keys in the file can be printed (listed) in a human-readable pretty-print format that shows information for every certificate and any public keys in the .p12 file.
Rhino documentation
examples a set of examples showing how to control the javascript engine and build javascript host objects.
Rhino shell
(the system command prompt is shown as $.) the first invocation executes a script specified on the command line itself.
SpiderMonkey Build Documentation
you must configure and build in a separate build directory, as shown above.
Creating JavaScript tests
these tests will also show up as infrequent oranges on our heavily loaded test machines, lowering the value of our test suite for everyone.
How to embed the JavaScript engine
a bare bones tutorial hello world sample embedding application the following code is a very simple application that shows how to embed spidermonkey and run a simple javascript script.
Index
15 jsapi cookbook spidermonkey this article shows the jsapi equivalent for a tiny handful of common javascript idioms.
Functions
flat closures and null closures have been removed: https://bugzilla.mozilla.org/show_bug.cgi?id=730497 https://bugzilla.mozilla.org/show_bug.cgi?id=739808 name lookups in order of speed, fastest to slowest.
Self-hosted builtins in SpiderMonkey
to include self-hosted frames in stack traces (in debug builds only), set the environment variable moz_show_all_js_frames.
SpiderMonkey Internals
a look at the places where jsshell.msg is used in js.cpp shows how error messages can be handled in jsapi applications.
JSAPI Cookbook
this article shows the jsapi equivalent for a tiny handful of common javascript idioms.
JSAPI User Guide
it amounts to about 80 lines of code, as shown below.
JS::CompileOptions
extrawarningsoption bool show extra warning.
JS_PreventExtensions
for example, a proxy might refuse to be made non-extensible; this refusal would show up in the post-call value of *succeeded.
JS_ReportError
an example is shown in the jsapi phrasebook.
Setting up CDT to work on SpiderMonkey
unfortunately, there are also large parts that are not properly indexed, leading to errors and warnings being shown for perfectly valid code, but i find that the parts that do work do so nicely enough to make it totally worth it.
SpiderMonkey: The Mozilla JavaScript runtime
jsapi cookbook shows the jsapi translation of some commonly used javascript expressions and statements.
TPS Bookmark Lists
kmark item, in the current folder, where this livemark should be moved to (i.e., this livemark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one) example: { livemark: "livemarkone", feeduri: "http://rss.wunderground.com/blog/jeffmasters/rss.xml", siteuri: "http://www.wunderground.com/blog/jeffmasters/show.html" } folder objects valid properties are: folder: the folder's name.
Zest tools
it is being developed alongside zest and can be expected to showcase the latest zest features.
Exploitable crashes
additionally, mozilla developers make heavy use of two tools in particular to find exploitable situations before they show up as exploitable crash reports.
Gecko events
is supported: yes event_asynch_show a hidden object is shown -- this is a layout occurance and is thus asynchronous is supported: yes event_asynch_hide an object is hidden -- this is a layout occurance and is thus asynchronous is supported: yes event_asynch_significant_change an object had a significant layout change which could affect the type of accessible object -- this is a layout occurance and is thus asynchronous is sup...
ROLE_ALERT
mapped to at-spi: role_alert atk: atk_role_alert msaa/ia2: role_system_alert ua: nsaccessibilitywindowrole events event_alert - fires when the widget is shown.
XUL Accessibility
introduction this article shows how xul control elements are mapped to accessibility api.
Accessibility API Implementation Details
xforms accessibilitythis article provides a quick guide to how accessibility is handled in gecko for xforms.xul accessibilitythis article shows how xul control elements are mapped to accessibility api.
History Service Design
typed means the page as a typed visit, hidden means the page should not be shown in autocomplete, while frecency is the relevance the page will have in locationbar queries.
The Publicity Stream API
it is suggested that the list be processed and condensed into an attractive, cohesive format for users (eg., multiple tweets show as 'adam tweeted 4 times').
XML Extras
thad hoffman has written a document that shows how you can mimic xml data islands in mozilla.
XPCOM glue
MozillaTechXPCOMGlue
use this when you have a custom application where you want to embed gecko to show webpages in your own window.
How to build an XPCOM component in JavaScript
this tutorial will show you what you need to do to get a component working in as few and as simple steps as possible.
How To Pass an XPCOM Object to a New Window
to access the xpcom object from the window's code, you can access the window.arguments[] array, as shown in the example below: components.utils.reporterror(string(window.arguments[0])); this will produce output similar to "[xpconnect wrapped nsimyxpcomobject]".
Components.utils.evalInSandbox
any exceptions raised by the evaluated code will show as originating from the above url.
HOWTO
moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript("chrome://myall/content/file.jsm"); see: http://mxr.mozilla.org/comm-central/...figutils.js#54 solution 2 append the following at the top of your js file which you want to run in xpcshell { // <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> // <https://bugzilla.mozilla.org/show_bug.cgi?id=546628> let cc = components.classes; let ci = components.interfaces; // register resource://app/ uri let ios = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice); let reshandler = ios.getprotocolhandler("resource") .queryinterface(ci.nsiresprotocolhandler); let mozdir = cc["@mozilla.org/file/directory_service;1"] .getservice(ci.nsiproperti...
Profiling XPCShell
then, the next lines shows the amount of time spend in the functions in that file.
IAccessible2
thus, if there's a reorder/show/hide event the at knows which part of the internal structure has been invalidated and can refetch just that part.
nsIAccessibilityService
must be one of: event_reorder (change) event_show (make visible or create) or event_hide (destroy or hide) ...
nsIAccessibleRelation
this relation can be used on the objid_client accessible for a top level window to show where the content areas are.
nsIBrowserSearchService
if a confirmation dialog is shown, it will offer the option to begin using the newly added engine right away; if no confirmation dialog is shown, the new engine will be used right away automatically.
nsIClipboardDragDropHooks
otherwise, false to show the drag is canceled (does not go to operating system).
nsIDOMEvent
for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitoriginaltarget will show the text node.
nsIDOMParser
cases where these values matter: if you don't specify the document uri by calling init() after creating the parser via createinstance() the created documents will use a moz-nullprincipal:{<guid>} uri, which will show in the error console in parsing errors, in particular.
nsIDOMWindow
scrollbars nsidombarprop the object that controls whether or not scrollbars are shown in the window.
nsIDOMWindowInternal
g name, in domstring options) nsidomwindow nsisupports aextraargument) void close() void updatecommands(in domstring action) boolean find([optional] in domstring str,[optional] in boolean casesensitive, [optional] in boolean backwards, [optional] in boolean wraparound, [optional] in boolean wholeword, [optional] in boolean searchinframes, [optional] in boolean showdialog) domstring atob(in domstring aasciistring) domstring btoa(in domstring abase64data) nsivariant showmodaldialog(in nsivariant aargs, [optional] in domstring aoptions) void postmessage(in domstring message, in domstring targetorigin) attributes attribute type description window nsidomwindowinternal readonly: the window...
nsIDOMWindowUtils
boolean dispatchdomeventviapresshell( in nsidomnode atarget, in nsidomevent aevent, in boolean atrusted ); parameters atarget aevent atrusted return value boolean to show if the event was successful elementfrompoint() retrieve the element at point ax, ay in the window's document.
nsIDownloadProgressListener
rather, only fill in the code for the ones you need, and leave the others blank as shown.
nsIHttpChannel
the value of nsirequest.status() will be ns_ok even when processing a 404 file not found response because such a response may include a message body that (in some cases) should be shown to the user.
nsIHttpHeaderVisitor
example this example shows how to detect flash content.
nsIINIParser
// get all sections in the ini file var sectenum = iniparser.getsections(); // save the sections in an array var sections = []; while (sectenum && sectenum.hasmore()) { var section = sectenum.getnext(); // add an array entry for each section sections.push(section); } enumerating keys this example shows how to fetch the values for all the keys in the section named "setting".
nsILoginManagerStorage
pports newlogindata); void removealllogins(); void removelogin(in nsilogininfo alogin); void searchlogins(out unsigned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); attributes attribute type description uibusy boolean true when a master password prompt is being shown.
nsIMessageListener
undefined return values show up as undefined values in the array.
nsIMsgCustomColumnHandler
last changed in gecko 1.9 (firefox 3) inherits from: nsitreeview this interface is meant to be implemented by extensions, as shown in the tutorial.
nsIMsgFolder
showdeletedmessages boolean readonly server nsimsgincomingserver readonly: this folder's parent server.
nsIMsgIdentity
bccothers boolean bcclist astring dobcc boolean dobcclist astring draftfolder astring stationeryfolder astring showsavemsgdlg boolean directoryserver astring overrideglobalpref boolean autocompletetomydomain boolean if this is false, don't append the user's domain to an autocomplete address with no matches.
nsIMsgMessageService
e.g., header=filter return the nsiuri that gets run example for example, the next piece of code shows the selected message code on a dialog: (taken from mozillazine) var content = ""; var messageuri = getfirstselectedmessage(); var msgservice = messenger.messageservicefromuri(messageuri); var msgstream = components.classes["@mozilla.org/network/sync-stream-listener;1"].createinstance(); var consumer = msgstream.queryinterface(components.interfaces.nsiinputstream); var scriptinput =...
nsIMsgProtocolInfo
showcomposemsglink boolean true if compose ui actions should be enabled for the account type.
nsINavBookmarkObserver
using onbeforeitemremoved() in gecko 1.9.1 if you wish to support onbeforeitemremoved() in applications based on gecko 1.9.1, you must implement your observer's queryinterface() method to match on both nsinavbookmarkobserver and nsinavbookmarkobserver_mozilla_1_9_1_additions, as shown below.
nsINavHistoryObserver
using onbeforedeleteuri() in gecko 1.9.1 if you wish to support onbeforedeleteuri() in applications based on gecko 1.9.1, you must implement your observer's queryinterface() method to match on both nsinavhistoryobserver and nsinavhistoryobserver_mozilla_1_9_1_additions, as shown below.
nsINavHistoryQueryOptions
showsessions boolean separate/group history items based on session information.
nsIProtocolHandler
typically, this flag is used by protocols that show highly untrusted content in a viewing area that the user expects to have a lot of control over, such as an email reader.
nsIScriptError2
you may pass null if you are lazy; that will prevent showing the source line in javascript console.
nsIXULRuntime
if a component encounters startup errors that might prevent the app from showing proper ui, it should set this flag to true.
nsIZipReader
if you show filenames from the findentries() result in the user interface, the character matching is only fine on utf-8 zip archives.
nsMsgFolderFlagType
const nsmsgfolderflagtype mail = 0x00000004; /** @} */ /** whether this is a directory: newshosts are always directories; * newsgroups can be directories if we are in ``show all groups'' mode; * mail folders will have this bit if they are really directories, not files.
nsMsgSearchAttrib
lue junkscoreorigin = 47; const nsmsgsearchattribvalue label = 48; /* mail only...can search by label */ const nsmsgsearchattribvalue hdrproperty = 49; // uses nsimsgsearchterm::hdrproperty const nsmsgsearchattribvalue folderflag = 50; // uses nsimsgsearchterm::status const nsmsgsearchattribvalue uint32hdrproperty = 51; // uses nsimsgsearchterm::hdrproperty // 52 is for showing customize - in ui headers start from 53 onwards up until 99.
NS_ENSURE_ARG_POINTER
summary macro returns ns_error_invalid_pointer if the macro argument evaluates to false and shows a warning (ns_warning) in this case.
NS ENSURE SUCCESS
summary macro returns return-value if ns_failed(nsresult) evaluates to true, and shows a warning on stderr in that case.
NS_WARNING
summary macro shows a warning on the console (stderr) and in debug logs (nspr logging).
nsMsgViewCommandType
markallread 10 mark all messages currently shown as read expandall 11 expand all threads.
nsMsgViewFlagsType
for example, the 'unread only' view would use the flag: components.interfaces.nsmsgviewflagstype.kunreadonly constants name value description knone 0x0 kthreadeddisplay 0x1 kshowignored 0x8 kunreadonly 0x10 kexpandall 0x20 kgroupbysort 0x40 ...
nsMsgViewType
for example, to request the 'show all threads' view use the constant: components.interfaces.nsmsgviewtype.eshowallthreads constants name value description eshowallthreads 0 eshowthreadswithunread 2 eshowwatchedthreadswithunread 3 eshowquicksearchresults 4 eshowvirtualfolderresults 5 eshowsearch 6 ...
XPCOM reference
for example, to request the 'show all threads' view use the constant:nsstaticmoduleinfothis data structure is used by ns_initxpcom3 to specify static xpcom modules.standard xpcom componentsthere are a number of components provided in the standard implementation of xpcom; these are as follows.xpcom glue classesthese "glue" classes are provided to make it easier to use xpcom from c++ code.xpcom interface referencethis is a referenc...
Getting Started Guide
all these cases show that automatically addrefing on `output' makes nscomptrs and raw-pointers act differently from the point of view of the clients.
Using the clipboard
the code is put together below, with additional error checking: var copytext = "text to copy"; var trans = transferable(sourcewindow); trans.adddataflavor("text/unicode"); trans.settransferdata("text/unicode", supportsstring(copytext), copytext.length * 2); services.clipboard.setdata(trans, null, services.clipboard.kglobalclipboard); the complete function shown below copies some text to the clipboard as html, as well as making it a clickable hyperlink.
XPCOM
this article will show you how to use the available interfaces in several mozilla products.aggregating the in-memory datasourcealready_addrefedalready_addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail.
XUL Overlays
MozillaTechXULOverlays
the following snippet shows a dialog with custom ui elements at the top and a reference to the overlay's ok and cancel buttons at the bottom: <box align="horizontal" id="bx1" flex="100%" style="margin-bottom: 1em; width: 100%;"> <html:input type="checkbox" id="dialog.newwindow"/> <html:label for="dialog.newwindow">&openwin.label;</html:label> <spring flex="100%"/> </box> <box id="okcancelbuttons"/> for more detail, see...
Test-Info
test-info has several sub-commands; the "report" sub-command is used by the test-info tasks mozilla-central$ mach help test-info report to reproduce test-info(all): mozilla-central$ mach test-info report --show-tests --show-summary --show-activedata running test-info on try to run these tasks on try, use something like: mach try fuzzy -q test-info contact information test-info is maintained by :gbrown.
Events
msgcreatedbview onactivecreatedview onactivemessagesloaded the active messages in the folder have been loaded oncreatedview a folder view has been created, but not yet shown.
LDAP Support
in thunderbird, the type down window can be customized to show arbitrary ldap fields.
MailNews Filters
out the new action here add new action to the rulesactiontable add string for the new action to the filter editor dtd file add new action to the filter editor js code add new action to the xbl widget in the filter editor if your action has a parameter, add code to initialize the ui editing an existing filter here and to save to the filter here add your action to filter.properties so it will show up in the filter log.
Mail composition back end
compose - this program shows the use of the createandsendmessage interface (createandsendmessage) compose2 - this program shows the use of the createandsendmessage interface (sendmessagefile) sendlater - this program shows the use of the nsimsgsendlater interface sendpage - this program shows the use of the createandsendmessage interface (sendwebpage) last modified: wed nov 1, 2000 rhp@netscape.com ...
The libmime module
the easiest way to do this is to make use of the mime_superclass macro that was defined at the top of the file, as shown below.
Building a Thunderbird extension 1: introduction
this tutorial will introduce you to the components of a thunderbird extension and will show you how to build your own.
Building a Thunderbird extension 3: install manifest
:name>my first extension</em:name> <em:version>1.0</em:version> <em:creator>jenzed</em:creator> <em:targetapplication> <description> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <em:minversion>1.5</em:minversion> <em:maxversion>5.0.*</em:maxversion> </description> </em:targetapplication> </description> </rdf> the following items (shown in bold) should be customized for your application: <em:id>myfirstext@jen.zed</em:id>: this is the id of the extension.
customDBHeaders Preference
user_pref( "mailnews.customdbheaders", "x-superfluous x-other"); adding a column the reply-to column tutorial does a good job of explaining how to add a column with an overlay, so i'll just show you my overlay file: <?xml version="1.0" ?> <overlay id="colsuperfluousoverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type='application/javascript' src='chrome://superfluous/content/superfluous.js'/> <tree id="threadtree"> <treecols id="threadcols"> <splitter class="tree-splitter" /> <treecol id="colsuperfluous" persist="hidden ordinal widt...
Using the Mozilla symbol server
the debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.
Working with windows in chrome code
the dom tree, as shown by the dom inspector, can look like this: #document window main-window ...
Add to iPhoto
if (document.getelementbyid("contentareacontextmenu")) { document.getelementbyid("contentareacontextmenu").addeventlistener("popupshowing", iphoto.onpopup, false); } responding when the context menu is clicked when the user right-clicks an image, our handler gets called: onpopup: function() { var node = iphoto.getcurrentnode(); var item = document.getelementbyid("add-to-iphoto_menuitem"); if (item) { item.hidden = (node == null); // hide it if we're not on an image } } this code finds the image node the user ...
Using COM from js-ctypes
ult; primative_hr = spvoice.speak(spvoiceptr, atext, aflags, 0); checkhresult(primative_hr, "cocreateinstance"); } catch (ex) { console.error('ex occured:', ex); } finally { if (spvoice) { spvoice.release(spvoiceptr); } couninitialize(); } } main(); lib.close(); other examples shgetpropertystoreforwindow - this examples shows that coinit is not needed, some winapi functions return the interface.
Using C struct and pointers
in this example, we show how to use c structs and pointers with js-ctypes.
Using Objective-C from js-ctypes
k; // global flags bl.flags = block_const.block_has_stret; bl.reserved = 0; bl.invoke = afunctypeptr; // create descriptor var desc = block_descriptor_1(); desc.reserved = 0; desc.size = block_literal_1.size; // set descriptor into block literal bl.descriptor = desc.address(); return bl; } an example of this function in use can be seen here: _ff-addon-snippet-objc_monitorevents - shows how to monitor and block mouse and key events on mac os x ...
Standard OS Libraries
components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("user32.dll"); /* note: if you go to getcursorpos page on msdn, it says first argument is of structure point, so lets create that structure, * the link here shows that that x and y are type long which is ctypes.long */ // https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805%28v=vs.85%29.aspx var point = new ctypes.structtype("tagpoint", [ { "x": ctypes.long }, { "y": ctypes.long } ]); /* declare the signature of the function we are going to call */ var getcursorpos = lib.declare('getcursorpos', ctypes.winapi_abi, ctypes.bool, ...
Using js-ctypes
osx from javascript!') }; var rez = cfusernotificationdisplaynotice(0, kcfusernotificationcautionalertlevel, null, null, null, mycfstrs.head, mycfstrs.body, null); console.info('rez:', rez, rez.tostring(), uneval(rez)); // cfusernotificationdisplaynotice does not block till user clicks dialog, it will return immediately if (rez.tostring() == '0') { console.log('notification was succesfully shown!!'); } else { console.error('failed to show notification...
Library
the syntax for this is seen in firefox codebase here: //github.com/realityripple/uxp/blob/master/js/src/ctypes/library.cpp?offset=0#271 this shows that we can also supply only two arguments to the declare function.
Mozilla
all the methods that are supposed to show up on this jsobject are actually not properties of the object itself, but rather properties of the prototype of the jsobject for the wrapper (unless the c++ object's class info has the flag nsixpcscriptable::dont_share_prototype set, but lets assume that's not the case here).
Version, UI, and Status Information - Plugins
the user might appreciate seeing the percentage completed of the current operation or the url of a button or other link object when the cursor is over it, all of which the browser shows.
Color vision simulation - Firefox Developer Tools
the following table shows a colorful image of a cat's face, and what it looks like in the various simulations.
DOM Inspector internals - Firefox Developer Tools
the tooltip used for the inspect menus—the one used to show a document's title (if any) and its uri for a given menuitem—is also defined here.
Inspecting web app manifests - Firefox Developer Tools
when you open the application panel’s manifest view on a page that doesn't have an app manifest successfully deployed, you'll get the following output shown: deploying a manifest to get a manifest deployed successfully, you need to include a <link> element in the <head> of your document that points to your .webmanifest file: <link rel="manifest" href="/manifest.webmanifest"> the .webmanifest extension is recommended in the spec, and should be served with an application/manifest+json mime type, although browsers generally tend to support manifests with other appropriate extensions like .json (mime type: application/json).
Application - Firefox Developer Tools
finding an example if you want to test this functionality and you don't have a handy pwa available, you can grab one of our simple examples to use: add to homescreen demo: shows pictures of foxes (source code | live version) js13kpwa demo: show information on entries to the js13k annual competition (source code | live version) how to debug service workers inspect web app manifests ...
Break on DOM mutation - Firefox Developer Tools
the panel on the right shows that execution is "paused on dom mutation" and you, as with any other breakpoint, you can see the call stack and view any watch expressions you may have set up.
Set a conditional breakpoint - Firefox Developer Tools
conditional breakpoints are shown as orange arrows laid over the line number.
Set a logpoint - Firefox Developer Tools
(either press esc or select the elipsis menu (...) and then click show split console.) when should you use logpoints?
Source map errors - Firefox Developer Tools
this message will show an error message, the resource url, and the source map url: here, the resource url tells us that bundle.js mentions a source map, and the source map url tells us where to find the source map data (in this case, relative to the resource).
Using the Debugger map scopes feature - Firefox Developer Tools
right-click on the source code and the context menu now includes an option to jump to original location as shown below.
JSON viewer - Firefox Developer Tools
arrays and objects are shown collapsed, and you can expand them using the "+" icons.
Tree map view - Firefox Developer Tools
for the treemaps shown in the memory tool, things on the heap are divided at the top level into four categories: objects: javascript and dom objects, such as function, object, or array, and dom types like window and htmldivelement.
Edit CSS filters - Firefox Developer Tools
you can save the current filter to the preset list: click to edit the filter, display the preset list by clicking the icon as shown below.
Edit Shape Paths in CSS - Firefox Developer Tools
a solid line shows the outline of the shape that is wrapping the text.
Examine and edit the box model - Firefox Developer Tools
viewing the box model with the select element button pressed, if you hover over an element in the page, the box model for the element is shown overlaid on the page: it's also shown overlaid if you hover over an element's markup in the html pane: if the element is inline and is split over multiple line boxes, the highlighter shows each individual line box that together make up the element: the box model view when an element's selected, you can get a detailed look at the box model in the box model view: if you hover over a value, you'll see a tooltip telling you which rule the value comes from: if you hover over part of the box model in the box model view, the corresponding part of the page is highlighted: editing the box model you can also edit the values in the box...
Examine Event Listeners - Firefox Developer Tools
the inspector shows the word "event" next to elements in the html pane, that have event listeners bound to them: click the icon, then you'll see a popup listing all the event listeners bound to this element: each line contains: a right-pointing arrowhead; click to expand the row and show the listener function source code a curved arrow pointing to a stack; click it to show the code for the handler in the debugger the name of the event for which a handler was attached to this element the name and line number for the listener; you can also click here to expand the row and view the listener function source code a label indicating whether the event bubbles a label indicating the system that defines the event.
Inspect and select colors - Firefox Developer Tools
in the css pane's rules view, if a rule contains a color value, you'll see a sample of the color next to the value: a color sample is also shown for css custom properties (variables) that represent colors.
Reposition elements in the page - Firefox Developer Tools
if the element is absolutely positioned, dashed lines are shown representing the offset parent.
Use the Inspector API - Firefox Developer Tools
.markdirty() - marks that the page has been changed by the inspector - a warning will be shown when leaving the page, since changes made through the inspector are rewritten on reload.
How to - Firefox Developer Tools
select a tool to switch between the waterfall, call tree, and flame chart tools, use the buttons in the toolbar: configure markers displayed to control which markers are shown in the waterfall, use the button in the toolbar: zoom in to zoom into a slice of the recording, select that slice in the recording overview: ...
Cookies - Firefox Developer Tools
note: some of the columns are not shown by default — to change the column display, right-click on the existing table headings and use the resulting context menu to show/hide the columns.
Extension Storage - Firefox Developer Tools
this storage type is only shown when debugging extensions.
Toolbox - Firefox Developer Tools
the array may include the following tools: web console javascript debugger page inspector style editor profiler network monitor note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools support remote debugging yet, so if the debugging target is not the firefox instance that launched the window, not all the hosted tools will be shown).
Web Console Helpers - Firefox Developer Tools
let's take a look at the contents of that node by using the $() and inspect() functions: inspect($("#title")) this automatically generates rich output for the object, showing you the contents of the dom node that matches the css selector "#title", which is of course the element with id "title".
Rich output - Firefox Developer Tools
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.
Split console - Firefox Developer Tools
while you're in another tool in the toolbox, just press esc or select the "show split console" command in the toolbar menu.
The JavaScript input interpreter - Firefox Developer Tools
click anywhere in the area containing the echoed code to show the whole snippet; click again in that area to collapse it.
Web Console UI Tour - Firefox Developer Tools
show timestamps: when enabled, timestamps are shown on the left-hand side of each message row to say when the messages were logged.
Firefox Developer Tools
opens the menu that includes docking options, the ability to show or hide the split console, and developer tools settings.
AbsoluteOrientationSensor - Web APIs
this is not something that would ever be shown to a user.
AbsoluteOrientationSensor - Web APIs
this is not something that would ever be shown to a user.
AbstractWorker.onerror - Web APIs
}; example the following code snippet shows creation of a worker object using the worker() constructor and setting up of an onerror handler on the resulting object: var myworker = new worker('worker.js'); myworker.onerror = function() { console.log('there is an error with your worker!'); } specifications specification status comment html living standardthe definition of 'abstractworker.onerror' in that specification.
AbstractWorker - Web APIs
this code snippet demonstrates the creation of a new worker using the worker() constructor; it also shows how to then send a message to the worker.
Accelerometer.Accelerometer() - Web APIs
this is not something that would ever be shown to a user.
Accelerometer.x - Web APIs
WebAPIAccelerometerx
this is not something that would ever be shown to a user.
Accelerometer.y - Web APIs
WebAPIAccelerometery
this is not something that would ever be shown to a user.
Accelerometer.z - Web APIs
WebAPIAccelerometerz
this is not something that would ever be shown to a user.
Accelerometer - Web APIs
this is not something that would ever be shown to a user.
AmbientLightSensor.AmbientLightSensor() - Web APIs
this is not something that would ever be shown to a user.
AmbientLightSensor.illuminance - Web APIs
this is not something that would ever be shown to a user.
AmbientLightSensor - Web APIs
this is not something that would ever be shown to a user.
AnalyserNode.fftSize - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.frequencyBinCount - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.getByteFrequencyData() - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.getByteTimeDomainData() - Web APIs
return value void | none example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.getFloatFrequencyData() - Web APIs
example const audioctx = new audiocontext(); const analyser = audioctx.createanalyser(); // float32array should be the same length as the frequencybincount const mydataarray = new float32array(analyser.frequencybincount); // fill the float32array with data returned from getfloatfrequencydata() analyser.getfloatfrequencydata(mydataarray); drawing a spectrum the following example shows basic usage of an audiocontext to connect a mediaelementaudiosourcenode to an analysernode.
AnalyserNode.getFloatTimeDomainData() - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.maxDecibels - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.minDecibels - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.smoothingTimeConstant - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode - Web APIs
basic usage the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
Animation.finish() - Web APIs
WebAPIAnimationfinish
examples the following example shows how to use the finish() method and catch an invalidstate error.
Animation.playState - Web APIs
the tear animations tears.foreach(function(el) { el.animate( tearsfalling, { delay: getrandommsrange(-1000, 1000), // randomized for each tear duration: getrandommsrange(2000, 6000), // randomized for each tear iterations: infinity, easing: 'cubic-bezier(0.6, 0.04, 0.98, 0.335)' }); el.pause(); }); // play the tears falling when the ending needs to be shown.
Attr.localName - Web APIs
WebAPIAttrlocalName
example the following example shows "id" in an alert dialog.
AudioBuffer - Web APIs
example the following simple example shows how to create an audiobuffer and fill it with random white noise.
AudioBufferSourceNode.start() - Web APIs
source.start(audioctx.currenttime + 1,3,10); for a more complete example showing start() in use, check out our audiocontext.decodeaudiodata() example, you can also run the code example live, or view the source.
AudioNode - Web APIs
WebAPIAudioNode
example this simple snippet of code shows the creation of some audio nodes, and how the audionode properties and methods can be used.
AudioProcessingEvent - Web APIs
example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
BaseAudioContext.createAnalyser() - Web APIs
example the following example shows basic usage of an audiocontext to create an analyser node, then use requestanimationframe() to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
BaseAudioContext.createBiquadFilter() - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BaseAudioContext.createChannelMerger() - Web APIs
example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
BaseAudioContext.createChannelSplitter() - Web APIs
example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
BaseAudioContext.createConvolver() - Web APIs
example the following example shows basic usage of an audiocontext to create a convolver node.
BaseAudioContext.createGain() - Web APIs
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
BaseAudioContext.createOscillator() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
BaseAudioContext.createScriptProcessor() - Web APIs
example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
BaseAudioContext.createWaveShaper() - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
BasicCardRequest.supportedNetworks - Web APIs
legal values are defined in the w3c's document card network identifiers approved for use with payment request api, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties.
BasicCardRequest.supportedTypes - Web APIs
legal values are defined in basiccardtype enum, and are currently: credit debit prepaid example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties.
BeforeInstallPromptEvent.prompt() - Web APIs
the prompt() method of the beforeinstallpromptevent interface allows a developer to show the install prompt at a time of their own choosing.
BeforeInstallPromptEvent - Web APIs
methods beforeinstallpromptevent.prompt() allows a developer to show the install prompt at a time of their own choosing.
BeforeUnloadEvent - Web APIs
some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction.
BiquadFilterNode.Q - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BiquadFilterNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BiquadFilterNode.frequency - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BiquadFilterNode.gain - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BiquadFilterNode.type - Web APIs
not used example the following example shows basic usage of an audiocontext to create a biquad filter node.
BiquadFilterNode - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
BluetoothCharacteristicProperties - Web APIs
examples the following example shows how tell if a gatt characteristic supports value change notifications.
BluetoothDevice - Web APIs
methods bluetoothdevice.watchadvertisments() a promise that resolves to undefined or is rejected with an error if advetisments can’t shown for any reason.
CSSStyleValue.parse() - Web APIs
the second code block shows the structure of the returned object as it would be rendered in a developer tools console.
CSSUnitValue.CSSUnitValue() - Web APIs
examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors.
CSSUnitValue - Web APIs
examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors.
Using the CSS Painting API - Web APIs
using the paint worklet to use the paint worklet, we need to register it using addmodule() and include it in our css, ensuring the css selector matches a dom node in our html registering the worklet the setup and design of our paint worklet took place in the external script shown above.
Using the CSS Typed Object Model - Web APIs
while we used the css background shorthand property, the inherited object.prototype.tostring() method, shows we returned only the image, 'url("https://mdn.mozillademos.org/files/16793/magicwand.png")'.
Cache - Web APIs
WebAPICache
the code snippet also shows a best practice for versioning caches used by the service worker.
CacheStorage - Web APIs
need to save clone to put one copy in cache // and serve second one let responseclone = response.clone(); caches.open('v1').then(function (cache) { cache.put(event.request, responseclone); }); return response; }).catch(function () { return caches.match('/sw-test/gallery/mylittlevader.jpg'); }); } })); }); this snippet shows how the api can be used outside of a service worker context, and uses the await operator for much more readable code.
CanvasRenderingContext2D.arc() - Web APIs
const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.arc(100, 75, 50, 0, 2 * math.pi); ctx.stroke(); result different shapes demonstrated this example draws various shapes to show what is possible with arc().
CanvasRenderingContext2D.bezierCurveTo() - Web APIs
examples how beziercurveto works this example shows how a cubic bézier curve is drawn.
CanvasRenderingContext2D.drawWindow() - Web APIs
constant value description drawwindow_draw_caret 0x01 show the caret if appropriate when drawing.
CanvasRenderingContext2D.quadraticCurveTo() - Web APIs
examples how quadraticcurveto works this example shows how a quadratic bézier curve is drawn.
A basic ray-caster - Web APIs
after every interval an update function will repaint the canvas showing the current view.
Basic animations - Web APIs
ctx.drawimage(moon, -3.5, -3.5); ctx.restore(); ctx.restore(); ctx.beginpath(); ctx.arc(150, 150, 105, 0, math.pi * 2, false); // earth orbit ctx.stroke(); ctx.drawimage(sun, 0, 0, 300, 300); window.requestanimationframe(draw); } init(); <canvas id="canvas" width="300" height="300"></canvas> screenshotlive sample an animated clock this example draws an animated clock, showing your current time.
Compositing example - Web APIs
the new shape is drawn behind the canvas content.', 'where both shapes overlap the color is determined by adding color values.', 'only the new shape is shown.', 'shapes are made transparent where both overlap and drawn normal everywhere else.', 'the pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer.
Drawing shapes with canvas - Web APIs
shape example <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); ctx.fillrect(25, 25, 100, 100); ctx.clearrect(45, 45, 60, 60); ctx.strokerect(50, 50, 50, 50); } } this example's output is shown below.
Drawing text - Web APIs
the following code snippet shows how you can measure a text and get its width.
Canvas tutorial - Web APIs
the images on this page show examples of <canvas> implementations which will be created in this tutorial.
ChannelMergerNode - Web APIs
example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
ChannelSplitterNode - Web APIs
example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
Clients - Web APIs
WebAPIClients
examples the following example shows an existing chat window or creates a new one when the user clicks a notification.
Comment - Web APIs
WebAPIComment
the comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view.
Console.dirxml() - Web APIs
WebAPIConsoledirxml
if it is not possible to display as an element the javascript object view is shown instead.
Console.timeEnd() - Web APIs
WebAPIConsoletimeEnd
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
Console.timeLog() - Web APIs
WebAPIConsoletimeLog
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
Console.timeStamp() - Web APIs
WebAPIConsoletimeStamp
you can optionally supply an argument to label the timestamp, and this label will then be shown alongside the marker.
console - Web APIs
WebAPIConsole
stack traces the console object also supports outputting a stack trace; this will show you the call path taken to reach the point at which you call console.trace().
ContentIndex.getAll() - Web APIs
examples the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
ContentIndex - Web APIs
ed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } retrieving items within the current index the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
ContentIndexEvent - Web APIs
examples this example shows the sevice worker script listening for the contentdelete event and logs the removed content index id.
Content Index API - Web APIs
ed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } retrieving items within the current index the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
ConvolverNode - Web APIs
convolvernode example the following example shows basic usage of an audiocontext to create a convolver node.
DOMMatrix - Web APIs
WebAPIDOMMatrix
these are aliases for specific components of a 4×4 matrix, as shown below.
DOMMatrixReadOnly.flipX() - Web APIs
note that the x co-ordinate of the viewbox attribute is negative, showing us content from both sides of the x-axis.
DOMMatrixReadOnly.scale() - Web APIs
dommatrix.scale(scale[, originx][, originy]) we'll show an example of how you can deal with the cross-browser support implications of this in the examples section, below.
DOMMatrixReadOnly - Web APIs
these are aliases for specific components of a 4×4 matrix, as shown below.
DataTransfer.addElement() - Web APIs
return value void example this example shows the use of the addelement() method function change_drag_node(event, node) { var dt = event.datatransfer; dt.addelement(node); } specifications this method is not defined in any web standard.
DataTransfer.clearData() - Web APIs
example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods.
DataTransfer.dropEffect - Web APIs
example this example shows the use of the dropeffect and effectallowed properties.
DataTransfer.effectAllowed - Web APIs
example this example shows the use of the effectallowed and dropeffect properties.
DataTransfer.getData() - Web APIs
example this example shows the use of the datatransfer object's getdata() and setdata() methods.
DataTransfer.items - Web APIs
example this example shows the use of the items and types properties.
DataTransfer.mozClearDataAt() - Web APIs
return value void example this example shows the use of the mozcleardataat() method in a dragend event handler.
DataTransfer.mozCursor - Web APIs
example this example shows the use of the mozcursor property.
DataTransfer.mozGetDataAt() - Web APIs
example this example shows the use of the mozgetdataat() method in a drop event handler.
DataTransfer.mozItemCount - Web APIs
example this example shows the use of the mozitemcount property.
DataTransfer.mozSetDataAt() - Web APIs
return value void example this example shows the use of the mozsetdataat() method in a dragstart handler.
DataTransfer.mozSourceNode - Web APIs
example this example shows the use of the mozsourcenode property in the dragend event handler.
DataTransfer.mozTypesAt() - Web APIs
example this example shows the use of the moztypesat() method in a drop event handler.
DataTransfer.mozUserCancelled - Web APIs
example this example shows the use of the mozusercancelled property in the dragend event handler.
DataTransfer.setData() - Web APIs
return value void example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods.
DataTransfer.setDragImage() - Web APIs
return value void example this example shows how to use the setdragimage() method.
DataTransfer.types - Web APIs
example this example shows the use of the types and items properties.
DataTransferItem.getAsFile() - Web APIs
example this example shows the use of the getasfile() method in a drop event handler.
DataTransferItem.getAsString() - Web APIs
example this example shows the use of the getasstring() method as an inline function in a drop event handler.
DataTransferItem.kind - Web APIs
example this example shows the use of the kind property.
DataTransferItem.type - Web APIs
example this example shows the use of the type property.
DataTransferItem.webkitGetAsEntry() - Web APIs
<p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
DataTransferItemList.DataTransferItem() - Web APIs
example this example shows how to use drag and drop.
DataTransferItemList.add() - Web APIs
example this example shows the use of the add() method.
DataTransferItemList.clear() - Web APIs
return value undefined example this example shows the use of the clear() method.
DataTransferItemList.length - Web APIs
example this example shows the use of the length property.
DataTransferItemList.remove() - Web APIs
example this example shows the use of the remove() method.
DedicatedWorkerGlobalScope.onmessage - Web APIs
}; example the following code snippet shows creation of a worker object using the worker() constructor.
DedicatedWorkerGlobalScope.postMessage() - Web APIs
example the following code snippet shows worker.js, in which an onmessage handler is used to handle messages from the main script.
Document.cookie - Web APIs
WebAPIDocumentcookie
examples example #1: simple usage document.cookie = "name=oeschger"; document.cookie = "favorite_food=tripe"; function alertcookie() { alert(document.cookie); } <button onclick="alertcookie()">show cookies</button> example #2: get a sample cookie named test2 document.cookie = "test1=hello"; document.cookie = "test2=world"; const cookievalue = document.cookie .split('; ') .find(row => row.startswith('test2')) .split('=')[1]; function alertcookievalue() { alert(cookievalue); } <button onclick="alertcookievalue()">show cookie value</button> example #3: do something only onc...
Document.createEntityReference() - Web APIs
prior to gecko 7.0 this method showed up as present, due to bug bug 9850, it always only returned null.
Document.getElementsByTagName() - Web APIs
<p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html> notes when called on an html document, getelementsbytagname() lower-cases its argument before proceeding.
Document.getElementsByTagNameNS() - Web APIs
lid green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html> potential workaround for other browsers which do not support if the desired browser did not support xpath, another approach (such as traversing the dom through all i...
Document.lastModified - Web APIs
here is a possible example of how to show an alert message when the page changes (see also: javascript cookies api): if (date.parse(document.lastmodified) > parsefloat(document.cookie.replace(/(?:(?:^|.*;)\s*last_modif\s*\=\s*([^;]*).*$)|^.*$/, "$1") || "0")) { document.cookie = "last_modif=" + date.now() + "; expires=fri, 31 dec 9999 23:59:59 gmt; path=" + location.pathname; alert("this page has changed!"); } …the same example, ...
Document.requestStorageAccess() - Web APIs
the user is never shown a prompt in this case, and calling requeststorageaccess() won’t have any side effects besides changing the value returned by document.hasstorageaccess().
Document: wheel event - Web APIs
examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel.
Element.attributes - Web APIs
getelementbyid("result"); // first, let's verify that the paragraph has some attributes if (paragraph.hasattributes()) { var attrs = paragraph.attributes; var output = ""; for(var i = attrs.length - 1; i >= 0; i--) { output += attrs[i].name + "->" + attrs[i].value; } result.value = output; } else { result.value = "no attributes to show"; } } </script> </head> <body> <p id="paragraph" style="color: green;">sample paragraph</p> <form action=""> <p> <input type="button" value="show first attribute name and value" onclick="listattributes();"> <input id="result" type="text" value=""> </p> </form> </body> </html> specifications specification status comment domthe definiti...
Element.classList - Web APIs
WebAPIElementclassList
see https://bugzilla.mozilla.org/show_bug.cgi?id=814014 polyfill the legacy onpropertychange event can be used to create a living classlist mockup thanks to a element.prototype.classname property that fires the specified event once it is changed.
Element.clientTop - Web APIs
WebAPIElementclientTop
syntax var top = element.clienttop; example in the following illustration, the client area is show in white.
Element: contextmenu event - Web APIs
as a result, the first paragraph will do nothing when right-clicked, while the second paragraph will show the standard context menu offered by your browser.
Element.getAttribute() - Web APIs
examples const div1 = document.getelementbyid('div1'); const align = div1.getattribute('align'); alert(align); // shows the value of align for the element with id="div1" description lower casing when called on an html element in a dom flagged as an html document, getattribute() lower-cases its argument before proceeding.
Element.innerHTML - Web APIs
WebAPIElementinnerHTML
for example: const name = "<img src='x' onerror='alert(1)'>"; el.innerhtml = name; // shows the alert for that reason, it is recommended that you do not use innerhtml when inserting plain text; instead, use node.textcontent.
Element: mouseout event - Web APIs
bubbles yes cancelable yes interface mouseevent event handler property onmouseout examples the following examples show the use of the mouseout event.
Element.name - Web APIs
WebAPIElementname
ement.name let fcontrol = htmlformelement.elementname let controlcollection = htmlformelement.elements.elementname example <form action="" name="forma"> <input type="text" value="foo"> </form> <script type="text/javascript"> // get a reference to the first element in the form let formelement = document.forms['forma'].elements[0] // give it a name formelement.name = 'inputa' // show the value of the input alert(document.forms['forma'].elements['inputa'].value) </script> notes in internet explorer (ie), the name property of dom objects created using document.createelement() can't be set or modified.
Element.outerHTML - Web APIs
WebAPIElementouterHTML
for example: var div = document.createelement("div"); div.outerhtml = "<div class=\"test\">test</div>"; console.log(div.outerhtml); // output: "<div></div>" also, while the element will be replaced in the document, the variable whose outerhtml property was set will still hold a reference to the original element: var p = document.getelementsbytagname("p")[0]; console.log(p.nodename); // shows: "p" p.outerhtml = "<div>this div replaced a paragraph.</div>"; console.log(p.nodename); // still "p"; the returned value will contain html escaped attributes: var anc = document.createelement("a"); anc.href = "https://developer.mozilla.org?a=b&c=d"; console.log(anc.outerhtml); // output: "<a href='https://developer.mozilla.org?a=b&amp;c=d'></a>" specification specification sta...
Element.requestFullscreen() - Web APIs
currently, the only option is navigationui, which controls whether or not to show navigation ui while the element is in full-screen mode.
Element.setAttribute() - Web APIs
html <button>hello world</button> javascript var b = document.queryselector("button"); b.setattribute("name", "hellobutton"); b.setattribute("disabled", ""); this demonstrates two things: the first call to setattribute() above shows changing the name attribute's value to "hellobutton".
Element.slot - Web APIs
WebAPIElementslot
here is one such example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> in our javascript file we get a reference to the <span> shown above, then log a reference to the name of the corresponding <slot> element.
Element: wheel event - Web APIs
examples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel.
Event.currentTarget - Web APIs
instead, you can either directly console.log(event.currenttarget) to be able to view it in the console or use the debugger statement, which will pause the execution of your code thus showing you the value of event.currenttarget.
Event.explicitOriginalTarget - Web APIs
for example, mouse events are retargeted to their parent node when they happen over text nodes (see bug 185889), and in that case currenttarget will show the parent and explicitoriginaltarget will show the text node.
EventListener - Web APIs
this is shown in the example below.
EventTarget.removeEventListener() - Web APIs
example this example shows how to add a mouseover-based event listener that removes a click-based event listener.
ExtendableEvent - Web APIs
the code snippet also shows a best practice for versioning caches used by the service worker.
FetchEvent.navigationPreload - Web APIs
example the following example shows the implementation of a fetch event that uses a preloaded response.
Using Fetch - Web APIs
the following example shows one way to do this by creating a line iterator (for simplicity, it assumes the text is utf-8, and doesn't handle fetch errors).
File.type - Web APIs
WebAPIFiletype
syntax var name = file.type; value a string, containing the media type(mime) indicating the type of the file, for example "image/png" for png images example <input type="file" multiple onchange="showtype(this)"> function showtype(fileinput) { var files = fileinput.files; for (var i = 0; i < files.length; i++) { var name = files[i].name; var type = files[i].type; alert("filename: " + name + " , type: " + type); } } note: based on the current implementation, browsers won't actually read the bytestream of a file to determine its media type.
FileError - Web APIs
WebAPIFileError
the objects have a code that shows the type of error that occurred.
FileReader() - Web APIs
example the following code snippet shows creation of a filereader object using the filereader() constructor and subsequent usage of the object: function printfile(file) { var reader = new filereader(); reader.onload = function(evt) { console.log(evt.target.result); }; reader.readastext(file); } specifications specification status comment file api working draft initial definition ...
FileSystemDirectoryReader.readEntries() - Web APIs
<p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
FileSystemEntry.copyTo() - Web APIs
example this example shows how a temporary log file might be moved into a more permanent "log" directory.
FileSystemEntry.fullPath - Web APIs
example this example shows a function which is called with a file system; it then gets a filesystemfileentry for a file named data.json and returns its full path.
FileSystemEntry.isDirectory - Web APIs
example this example shows how this property might be used to determine whether to process the entry as a directory or file.
FileSystemEntry.isFile - Web APIs
example this example shows how this property might be used to determine whether to process the entry as a directory or file.
FileSystemEntry.moveTo() - Web APIs
example this example shows how a temporary log file might be moved into a more permanent "log" directory when it exceeds a megabyte in size.
FileSystemEntry.name - Web APIs
example this example shows a function called isfilewithextension() which returns true if the specified filesystementry is both a file and the file's name ends with a given extension.
FileSystemEntrySync - Web APIs
chrome shows a read-only list of all the files and folders stored the origin of your app.
Using FormData Objects - Web APIs
typically this is used as shown in our simple formdata event demo — in the javascript we reference a form: const formelem = document.queryselector('form'); in our submit event handler we use preventdefault to stop the default form submission, then invoke a formdata constructor to trigger the formdata event: formelem.addeventlistener('submit', (e) => { // on form submission, prevent default e.preventdefault(); // c...
FormData.has() - Web APIs
WebAPIFormDatahas
example the following line creates an empty formdata object: var formdata = new formdata(); the following snippet shows the results of testing for the existence of username in the formdata object, before and after appending a username value to it with formdata.append: formdata.has('username'); // returns false formdata.append('username', 'chris'); formdata.has('username'); // returns true specifications specification status comment xmlhttprequestthe definition of 'has()' in that speci...
Using the Frame Timing API - Web APIs
the call tree shows where the application is spending most of its time, whereas the flame chart shows the state of the javascript stack for the code at every millisecond during the performance profile.
Fullscreen API - Web APIs
shows an overlay button which can not be disabled.samsung internet android full support 10.0 full support 10.0 full support 1.0prefixed prefixed implemented with the vendor prefix: webkitoptions parameterchrome full support ...
GainNode.gain - Web APIs
WebAPIGainNodegain
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
GainNode - Web APIs
WebAPIGainNode
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
GeolocationPositionError - Web APIs
specifications note that this is primarily intended for debugging use and not to be shown directly in a user interface.
GlobalEventHandlers.onanimationend - Web APIs
we'll use this to show information about the events we receive.
GlobalEventHandlers.onanimationstart - Web APIs
we'll use this to show information about the events we receive.
GlobalEventHandlers.ondragend - Web APIs
example this example shows two ways to use the ondragend attribute handler to set an element's dragend event handler.
GlobalEventHandlers.onpointercancel - Web APIs
example this example shows two ways to use onpointercancel to handle an element's pointercancel events.
GlobalEventHandlers.onpointerdown - Web APIs
#target { width: 400px; height: 30px; text-align: center; font: 16px "open sans", "helvetica", sans-serif; color: white; background-color: blue; border: 2px solid darkblue; cursor: pointer; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } result the resulting output is shown below.
GlobalEventHandlers.onpointerenter - Web APIs
example this example shows two ways to use onpointerenter to set an element's pointerenter event handler.
GlobalEventHandlers.onpointerleave - Web APIs
example this example shows two ways to use onpointerleave to set an element's pointerleave event handler.
GlobalEventHandlers.onpointermove - Web APIs
example this example shows two ways to use onpointermove to set an element's pointermove event handler.
GlobalEventHandlers.onpointerout - Web APIs
example this example shows two ways to use onpointerout to set an element's pointerout event handler.
GlobalEventHandlers.onpointerover - Web APIs
example this example shows two ways to use onpointerover to set an element's pointerover event handler.
GlobalEventHandlers.onpointerup - Web APIs
example this example shows two ways to use onpointerup to set an element's pointerup event handler.
GlobalEventHandlers.ontouchcancel - Web APIs
example this example shows two ways to use ontouchcancel to set an element's touchcancel event handler.
GlobalEventHandlers.ontouchend - Web APIs
example this example shows two ways to use ontouchend to set an element's touchend event handler.
GlobalEventHandlers.ontouchmove - Web APIs
example this example shows two ways to use ontouchmove to set an element's touchmove event handler.
GlobalEventHandlers.ontouchstart - Web APIs
example this example shows two ways to use ontouchstart to set an element's touchstart event handler.
GlobalEventHandlers.ontransitioncancel - Web APIs
in addition, we also use a click event to make the box dissappear (display: none;), showing how it triggers the transitioncancel event to fire.
GlobalEventHandlers.onwheel - Web APIs
examples this example shows how to scale an element using the mouse (or other pointing device) wheel.
GlobalEventHandlers - Web APIs
globaleventhandlers.onshow is an eventhandler representing the code to be called when the show event is raised.
Gyroscope.Gyroscope() - Web APIs
this is not something that would ever be shown to a user.
Gyroscope.x - Web APIs
WebAPIGyroscopex
this is not something that would ever be shown to a user.
Gyroscope.y - Web APIs
WebAPIGyroscopey
this is not something that would ever be shown to a user.
Gyroscope.z - Web APIs
WebAPIGyroscopez
this is not something that would ever be shown to a user.
Gyroscope - Web APIs
WebAPIGyroscope
this is not something that would ever be shown to a user.
HTMLBodyElement - Web APIs
windoweventhandlers.onpageshow is an eventhandler representing the code to be called when the pageshow event is raised.
HTMLCollection - Web APIs
for example, assuming there is one <form> element in the document and its id is myform: var elem1, elem2; // document.forms is an htmlcollection elem1 = document.forms[0]; elem2 = document.forms.item(0); alert(elem1 === elem2); // shows: "true" elem1 = document.forms.myform; elem2 = document.forms.nameditem("myform"); alert(elem1 === elem2); // shows: "true" elem1 = document.forms["named.item.with.periods"]; specifications specification status comment domthe definition of 'htmlcollection' in that specification.
HTMLDetailsElement - Web APIs
htmldetailselement.open is a boolean reflecting the open html attribute, indicating whether or not the element’s contents (not counting the <summary>) is to be shown to the user.
HTMLDialogElement: cancel event - Web APIs
ss="result"></div> css button, div { margin: .5rem; } js const result = document.queryselector('.result'); const dialog = document.queryselector('.example-dialog'); dialog.addeventlistener('cancel', (event) => { result.textcontent = 'dialog was canceled'; }); const opendialog = document.queryselector('.open-dialog'); opendialog.addeventlistener('click', () => { if (typeof dialog.showmodal === 'function') { dialog.showmodal(); result.textcontent = ''; } else { result.textcontent = 'the dialog api is not supported by this browser'; } }); const closebutton = document.queryselector('.close'); closebutton.addeventlistener('click', () => { dialog.close(); }); result specifications specification status html living standardthe...
HTMLDialogElement: close event - Web APIs
lass="result"></div> css button, div { margin: .5rem; } js const result = document.queryselector('.result'); const dialog = document.queryselector('.example-dialog'); dialog.addeventlistener('close', (event) => { result.textcontent = 'dialog was closed'; }); const opendialog = document.queryselector('.open-dialog'); opendialog.addeventlistener('click', () => { if (typeof dialog.showmodal === 'function') { dialog.showmodal(); result.textcontent = ''; } else { result.textcontent = 'the dialog api is not supported by this browser'; } }); const closebutton = document.queryselector('.close'); closebutton.addeventlistener('click', () => { dialog.close(); }); result specifications specification status html living standardthe def...
HTMLElement.hidden - Web APIs
html the html for the two boxes are shown here.
HTMLElement.offsetHeight - Web APIs
example the example image above shows a scrollbar and an offsetheight which fits on the window.
HTMLElement.offsetLeft - Web APIs
example var colortable = document.getelementbyid("t1"); var toleft = colortable.offsetleft; if (toleft > 5) { // large left offset: do something here } this example shows a 'long' sentence that wraps within a div with a blue border, and a red box that one might think should describe the boundaries of the span.
HTMLFrameSetElement - Web APIs
windoweventhandlers.onpageshow is an eventhandler representing the code to be called when the pageshow event is raised.
HTMLImageElement.decode() - Web APIs
examples the following example shows how to use the decode() method to control when an image is appended to the dom.
HTMLImageElement.loading - Web APIs
example the addimagetolist() function shown below adds a photo thumbnail to a list of items, using lazy-loading to avoid loading the image from the network until it's actually needed.
HTMLImageElement.x - Web APIs
html in this example, we see a table showing information about users of a web site, including their user id, their full name, and their avatar image.
HTMLImageElement.y - Web APIs
html in this example, we see a table showing information about users of a web site, including their user id, their full name, and their avatar image.
HTMLInputElement.webkitEntries - Web APIs
example this example shows how to create a file selection <input> element and process the selected files.
HTMLMediaElement.controlsList - Web APIs
the controlslist property of the htmlmediaelement interface returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls.
HTMLMediaElement - Web APIs
htmlmediaelement.controlslist read only returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls.
HTMLVideoElement - Web APIs
htmlvideoelement.poster is a domstring that reflects the poster html attribute, which specifies an image to show while no video data is available.
Using microtasks in JavaScript with queueMicrotask() - Web APIs
element.addeventlistener("load", () => console.log("loaded data")); console.log("fetching data..."); element.getdata(); console.log("data fetched"); executing this code twice in a row gives the results shown in the table below: results when data isn't cached (left) vs.
Recommended Drag Types - Web APIs
the following example shows how to create an area for receiving dropped files: <listbox ondragenter="return checkdrag(event)" ondragover="return checkdrag(event)" ondrop="dodrop(event)"/> <script> function checkdrag(event) { return event.datatransfer.types.contains("application/x-moz-file"); } function dodrop(event) { var file = event.datatransfer.mozgetdataat("application/x-moz-file", 0); if (fi...
History.state - Web APIs
WebAPIHistorystate
the next line logs the value to the console again, showing that history.state now has a value.
IDBDatabase.name - Web APIs
WebAPIIDBDatabasename
example this example shows a database connection being opened, the resulting idbdatabase object being stored in a db variable, and the name property then being logged.
IDBDatabase.onabort - Web APIs
}; example this example shows an idbopendbrequest.onupgradeneeded block that creates a new object store; it also includes onerror and onabort functions to handle non-success cases.
IDBDatabase.onclose - Web APIs
example db.onclose = function(event) { myappshowalert('the database "' + db.name + '" has unexpectedly closed.'); }; specifications specification status comment indexed database api draftthe definition of 'onclose' in that specification.
IDBDatabase.onerror - Web APIs
} example this example shows an idbopendbrequest.onupgradeneeded block that creates a new object store; it also includes onerror and onabort functions to handle non-success cases.
IDBDatabase.onversionchange - Web APIs
} example this example shows an idbopendbrequest.onupgradeneeded block that creates a new object store; it also includes onerror and onabort functions to handle non-success cases, and an onversionchange function to notify when a database structure change has occurred.
IDBObjectStore - Web APIs
example this example shows a variety of different uses of object stores, from updating the data structure with idbobjectstore.createindex inside an onupgradeneeded function, to adding a new item to our object store with idbobjectstore.add.
IDBOpenDBRequest.onupgradeneeded - Web APIs
inside the event handler function you can include code to upgrade the database structure, as shown in the example below.
IDBRequest.transaction - Web APIs
ase var updatetitlerequest = objectstore.put(data); // log the transaction that originated this request console.log("the transaction that originated this request is " + updatetitlerequest.transaction); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; this example shows how a the transaction property can be used during a version upgrade to access existing object stores:​ var openrequest = indexeddb.open('db', 2); console.log(openrequest.transaction); // will log "null".
ImageCapture() constructor - Web APIs
example the following example shows how to use a call to mediadevices.getusermedia() to retrieve the mediastreamtrack needed by the imagecapture() constructor.
ImageCapture.getPhotoCapabilities() - Web APIs
this example also shows how the imagecapture object is created using a mediastreamtrack retrieved from a device's mediastream.
ImageCapture.getPhotoSettings() - Web APIs
this example also shows how the imagecapture object is created using a mediastreamtrack retrieved from a device's mediastream.
InstallEvent - Web APIs
the code snippet also shows a best practice for versioning caches used by the service worker.
compareVersion - Web APIs
parts of this page show the use of the xpinstall api.
getVersion - Web APIs
parts of this page show the use of the xpinstall api.
IntersectionObserver.unobserve() - Web APIs
example this snippet simply shows an observer being created, an element being observed, and then being unobserved.
KeyboardEvent.altKey - Web APIs
syntax var altkeypressed = instanceofkeyboardevent.altkey return value boolean examples <html> <head> <title>altkey example</title> <script type="text/javascript"> function showchar(e){ alert( "key keydown: " + string.fromcharcode(e.charcode) + "\n" + "charcode: " + e.charcode + "\n" + "alt key keydown: " + e.altkey + "\n" ); } </script> </head> <body onkeydown="showchar(event);"> <p> press any character key, with or without holding down the alt key.<br /> you can also use the shift key together with the alt key.
KeyboardEvent.ctrlKey - Web APIs
syntax var ctrlkeypressed = instanceofkeyboardevent.ctrlkey return value a boolean example <html> <head> <title>ctrlkey example</title> <script type="text/javascript"> function showchar(e){ alert( "key pressed: " + e.key + "\n" + "ctrl key pressed: " + e.ctrlkey + "\n" ); } </script> </head> <body onkeypress="showchar(event);"> <p>press any character key, with or without holding down the ctrl key.<br /> you can also use the shift key together with the ctrl key.</p> </body> </html> specifications specification status comment document object model (dom) level 3 events specificationthe definiti...
KeyboardEvent.shiftKey - Web APIs
syntax var shiftkeypressed = instanceofkeyboardevent.shiftkey return value a boolean example <html> <head> <title>shiftkey example</title> <script type="text/javascript"> function showchar(e){ alert( "key pressed: " + string.fromcharcode(e.charcode) + "\n" + "charcode: " + e.charcode + "\n" + "shift key pressed: " + e.shiftkey + "\n" + "alt key pressed: " + e.altkey + "\n" ); } </script> </head> <body onkeypress="showchar(event);"> <p>press any character key, with or without holding down the shift key.<br /> you can also use the shift key together with the alt key.</p> </body> </html> specifications sp...
KeyboardEvent - Web APIs
a list of the constants identifying the locations is shown above in keyboard locations.
Keyboard API - Web APIs
these keys are shown below.
LinearAccelerationSensor.LinearAccelerationSensor() - Web APIs
this is not something that would ever be shown to a user.
LinearAccelerationSensor.x - Web APIs
this is not something that would ever be shown to a user.
LinearAccelerationSensor.y - Web APIs
this is not something that would ever be shown to a user.
LinearAccelerationSensor.z - Web APIs
this is not something that would ever be shown to a user.
LinearAccelerationSensor - Web APIs
this is not something that would ever be shown to a user.
LocalFileSystem - Web APIs
example the following is a code snippet that shows how you can request a file system storage.
Magnetometer.Magnetometer() - Web APIs
this is not something that would ever be shown to a user.
Magnetometer.x - Web APIs
WebAPIMagnetometerx
this is not something that would ever be shown to a user.
Magnetometer.y - Web APIs
WebAPIMagnetometery
this is not something that would ever be shown to a user.
Magnetometer.z - Web APIs
WebAPIMagnetometerz
this is not something that would ever be shown to a user.
Magnetometer - Web APIs
this is not something that would ever be shown to a user.
MediaDevices.getDisplayMedia() - Web APIs
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.
MediaImage - Web APIs
its contents can be displayed by the user agent in appropriate contexts, like player interface to show the current playing video or audio track.
MediaPositionState.duration - Web APIs
for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls.
MediaPositionState.playbackRate - Web APIs
for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls.
MediaPositionState.position - Web APIs
for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls.
MediaRecorder() - Web APIs
example this example shows how to create a media recorder for a specified stream, whose audio bit rate is set to 128 kbit/sec and whose video bit rate is set to 2.5 mbit/sec.
MediaSource.activeSourceBuffers - Web APIs
the activesourcebuffers read-only property of the mediasource interface returns a sourcebufferlist object containing a subset of the sourcebuffer objects contained within sourcebuffers — the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks.
MediaSource - Web APIs
mediasource.activesourcebuffers read only returns a sourcebufferlist object containing a subset of the sourcebuffer objects contained within mediasource.sourcebuffers — the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks.
MediaStream.onaddtrack - Web APIs
example this example adds a listener which, when a new track is added to the stream, appends a new item to a list of tracks; the new item shows the track's kind ("audio" or "video") and label.
MediaStreamTrack.applyConstraints() - Web APIs
examples the following shows how to specify a basic and advanced set of constraints.
MediaStreamTrack.enabled - Web APIs
usage notes if the mediastreamtrack represents the video input from a camera, disabling the track by setting enabled to false also updates device activity indicators to show that the camera is not currently recording or streaming.
MediaStreamTrack: mute event - Web APIs
the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'mute' in that specification.
MediaStreamTrack: unmute event - Web APIs
the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'unmute' in that specification.
MediaStream Recording API - Web APIs
for more information to learn more about using the mediastream recording api, see using the mediastream recording api, which shows how to use the api to record audio clips.
MediaTrackConstraints.cursor - Web APIs
in addition, see example: constraint exerciser in capabilities, constraints, and settings for a complete example showing how constraints are used.
MediaTrackConstraints.displaySurface - Web APIs
in addition, see example: constraint exerciser in capabilities, constraints, and settings for a complete example showing how constraints are used.
MediaTrackSettings.logicalSurface - Web APIs
since the window that contains the surface has to be scrolled to show the rest of the contents, the surface is a logical one.
MediaTrackSupportedConstraints.frameRate - Web APIs
javascript let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().framerate) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } html <div id="result"> </div> css #result { font: 14px "arial", sans-serif; } result the output, showing if your browser supports the framerate constraint, is: while this example is trivial, you can replace the simple output of "supported" vs.
MessageEvent - Web APIs
the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
Microdata DOM API - Web APIs
code example this sample shows how the getitems() method can be used to obtain a list of all the top-level microdata items of a particular type given in the document: var cats = document.getitems("http://example.com/feline"); once an element representing an item has been obtained, its properties can be extracted using the properties idl attribute.
msFirstPaint - Web APIs
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.
NavigationPreloadManager - Web APIs
await self.registration.navigationpreload.enable(); } }()); }); using a preloaded response the following example shows the implementation of a fetch event that uses a preloaded response.
Navigator.getUserMedia() - Web APIs
your callback can then assign the stream to the desired object (such as an <audio> or <video> element), as shown in the following example: function(stream) { var video = document.queryselector('video'); video.srcobject = stream; video.onloadedmetadata = function(e) { // do something with the video here.
Navigator.permissions - Web APIs
examples navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showmap(); } else if (result.state === 'prompt') { showbuttontoenablemap(); } // don't do anything if the permission was denied.
Navigator.registerProtocolHandler() - Web APIs
for example, web+burger, as shown in the example below.
Navigator.wakeLock - Web APIs
while a screen wake lock is active, the user agent will try to prevent the device from dimming the screen, turning it off completely, or showing a screensaver.
Navigator - Web APIs
WebAPINavigator
navigator.wakelock read only returns a wakelock interface you can use to request screen wake locks and prevent screen from dimming, turning off, or showing a screen saver.
Navigator.onLine - Web APIs
until firefox 41, all other conditions return a true value; testing actual behavior on nightly 68 on windows shows that it only looks for lan connection like chrome and safari giving false positives.
Node.getRootNode() - Web APIs
WebAPINodegetRootNode
examples the first simple example returns a reference to the html/document node: rootnode = node.getrootnode(); this more complex example shows the difference between returning a normal root, and a root incuding the shadow root.
Node.nodeValue - Web APIs
WebAPINodenodeValue
the following table shows the return values for different elements: node value of nodevalue cdatasection content of the cdata section comment content of the comment document null documentfragment null documenttype null element null namednodemap null entityreference null notation null p...
Node.removeChild() - Web APIs
WebAPINoderemoveChild
with the first syntax form shown, you may reuse the removed node later in your code, via the oldchild object reference.
Node.textContent - Web APIs
WebAPINodetextContent
in contrast, innertext only shows “human-readable” elements.
NodeIterator.detach() - Web APIs
syntax nodeiterator.detach(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); nodeiterator.detach(); // detaches the iterator nodeiterator.nextnode(); // throws an invalid_state_err exception specifications specification status comment domthe definition of 'nodeiterator.detach' in that specification.
NodeIterator.filter - Web APIs
syntax nodefilter = nodeiterator.filter; example const nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); nodefilter = nodeiterator.filter; specifications specification status comment domthe definition of 'nodeiterator.filter' in that specification.
NodeIterator.nextNode() - Web APIs
syntax node = nodeiterator.nextnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // returns the next node specifications specification status comment domthe definition of 'nodeiterator.nextnode' in that specification.
NodeIterator.pointerBeforeReferenceNode - Web APIs
syntax flag = nodeiterator.pointerbeforereferencenode; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); flag = nodeiterator.pointerbeforereferencenode; specifications specification status comment domthe definition of 'nodeiterator.pointerbeforereferencenode' in that specification.
NodeIterator.previousNode() - Web APIs
syntax node = nodeiterator.previousnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // returns the next node previousnode = nodeiterator.previousnode(); // same result, since we backtracked to the previous node specifications specification status comment domthe definition of...
NodeIterator.referenceNode - Web APIs
syntax node = nodeiterator.referencenode; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); node = nodeiterator.referencenode; specifications specification status comment domthe definition of 'nodeiterator.referencenode' in that specification.
NodeIterator.root - Web APIs
WebAPINodeIteratorroot
syntax root = nodeiterator.root; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); root = nodeiterator.root; // document.body in this case specifications specification status comment domthe definition of 'nodeiterator.root' in that specification.
Notification.Notification() - Web APIs
syntax var mynotification = new notification(title, options); parameters title defines a title for the notification, which is shown at the top of the notification window.
Notification.close() - Web APIs
note: this api shouldn't be used just to have the notification removed from the screen after a fixed delay since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown.
Notification.requestPermission() - Web APIs
} we no longer show a live sample on this page, as chrome and firefox no longer allow notification permissions to be requested from cross-origin <iframe>s, with other browsers to follow.
NotificationEvent.action - Web APIs
example self.registration.shownotification("new articles available", { actions: [{action: "get", title: "get now."}] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'get') { synchronizereader(); } else { clients.openwindow("/reader"); } }, false); specifications specification status comment notifications apithe de...
OfflineAudioContext: complete event - Web APIs
event handler property offlineaudiocontext.oncomplete examples when processing is complete, you might want to use the oncomplete handler the prompt the user that the audio can now be played, and enable the play button: let offlineaudioctx = new offlineaudiocontext(); offlineaudioctx.addeventlistener('complete', () => { console.log('offline audio processing now complete'); showmodaldialog('song processed and ready to play'); playbtn.disabled = false; }) you can also set up the event handler using the offlineaudiocontext.oncomplete property: let offlineaudioctx = new offlineaudiocontext(); offlineaudioctx.oncomplete = function() { console.log('offline audio processing now complete'); showmodaldialog('song processed and ready to play'); playbtn.disabled = false...
OfflineAudioContext.oncomplete - Web APIs
offlineaudioctx.oncomplete = function() { console.log('offline audio processing now complete'); showmodaldialog('song processed and ready to play'); playbtn.disabled = false; } specifications specification status comment web audio apithe definition of 'oncomplete' in that specification.
OscillatorNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.frequency - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.onended - Web APIs
}; example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.start() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.stop() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.type - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode - Web APIs
examples the following example shows basic usage of an audiocontext to create an oscillator node and to start playing a tone on it.
PageTransitionEvent.persisted - Web APIs
syntax window.addeventlistener('pageshow', function(event) { if (event.persisted) { console.log('page was loaded from cache.'); } }); value a boolean.
PaintWorklet.registerPaint - Web APIs
examples the following shows registering an example worklet module.
PasswordCredential - Web APIs
examples this example shows how to set up an htmlformelement to caputure data which we'll use to create a passwordcredential object.
PaymentAddress.addressLine - Web APIs
for example, the addressline array for the mozilla space in london would have the following entries: example showing addressline entries for an address in london index addressline[] value 0 metal box factory 1 suite 441, 4th floor 2 30 great guildford street these, combined with additional values for other properties of the paymentaddress, would represent the full address, which is: mozilla metal box factory suite 441, 4th floor 30 great guildford...
PaymentDetailsBase - Web APIs
this can be delivered to the payment interface using either paymentdetailsupdateevent.updatewith() or by returning it from the optional detailsupdate promise provided to the paymentrequest.show() call that begins the user interaction.
PaymentDetailsUpdate - Web APIs
this can be done either by calling the paymentrequestupdateevent.updatewith() method or by using the paymentrequest.show() method's detailspromise parameter to provide a promise that returns a paymentdetailsupdate that updates the payment information before the user interface is even enabled for the first time.
PaymentMethodChangeEvent.methodDetails - Web APIs
ev.updatewith(newstuff); }; const response = await request.show(); note that the methoddetails property is being used by the calculatediscount() function to compute any payment discount, then updatewith() is called to update the event with the computed update.
PaymentMethodChangeEvent.methodName - Web APIs
ev.updatewith(newstuff); }; const response = await request.show(); specifications specification status comment payment request apithe definition of 'paymentmethodchangeevent.methodname' in that specification.
PaymentRequest.abort() - Web APIs
the paymentrequest.abort() method of the paymentrequest interface causes the user agent to end the payment request and to remove any user interface that might be shown.
PaymentRequest.onmerchantvalidation - Web APIs
or the paymentrequest object request looks like this: request.onmerchantvalidation = ev => { ev.complete(async () => { const merchantserverurl = window.location.origin + '/validation?url=' + encodeuricomponent(ev.validationurl); // get validation data, and complete validation; return await fetch(merchantserverurl).then(r => r.text()); }) }; const response = await request.show(); for more information, see merchant validation in payment processing concepts.
PaymentRequest.onshippingoptionchange - Web APIs
to make sure an updated option is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show().
PaymentRequest.shippingAddress - Web APIs
var payment = new paymentrequest(supportedinstruments, details, options); payment.addeventlistener('shippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for brevity.
PaymentResponse.onpayerdetailchange - Web APIs
const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a handler for payerdetailchange events, to // request corrections as needed.
PaymentResponse: payerdetailchange event - Web APIs
const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a handler for payerdetailchange events, to // request corrections as needed.
PaymentResponse.shippingAddress - Web APIs
var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('shippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity.
PaymentResponse.shippingOption - Web APIs
var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('shippingoptionchange', function(evt) { evt.updatewith(new promise(function(resolve, reject) { updatedetails(details, request.shippingoption, resolve, reject); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity.
PaymentResponse - Web APIs
this method should only be called after the promise returned by the paymentrequest.show() method.
PaymentValidationErrors - Web APIs
when validation of the paymentresponse returned by the paymentrequest.show() or paymentresponse.retry() methods fails, your code creates a paymentvalidationerrors object to pass into retry() so that the user agent knows what needs to be fixed and what if any error messages to display to the user.
performance.mark() - Web APIs
WebAPIPerformancemark
return value void example the following example shows how to use mark() to create and retrieve performancemark entries.
performance.measure() - Web APIs
return value void example the following example shows how measure() is used to create a new measure performance entry in the browser's performance entry buffer.
PerformanceEntry.duration - Web APIs
example the following example shows the use of the duration property.
PerformanceEntry.startTime - Web APIs
example the following example shows the use of the starttime property.
PerformanceEntry.toJSON() - Web APIs
example the following example shows the use of the tojson() method.
PerformancePaintTiming - Web APIs
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\'...
PerformanceResourceTiming - Web APIs
an alphabetical listing is shown in the navigation, at left.
Performance API - Web APIs
user timing level 2 working draft implementation status as shown in the performance interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers.
Permissions.revoke() - Web APIs
uservisibleonly: (push only, not supported in firefox — see the browser compatibility section below) indicates whether you want to show a notification for every message or be able to send silent push notifications.
Permissions - Web APIs
example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showlocalnewswithgeolocation(); } else if (result.state === 'prompt') { showbuttontoenablelocalnews(); } // don't do anything if the permission was denied.
PhotoCapabilities - Web APIs
this example also shows how the imagecapture object is created using a mediastreamtrack retrieved from a device's mediastream.
Pointer Lock API - Web APIs
simple example walkthrough we've written a simple pointer lock demo to show you how to use it to set up a simple control system (see source code).
Pinch zoom gestures - Web APIs
this example shows how to detect the pinch/zoom gesture, which uses pointer events to detect whether the user moves two pointers closer or farther apart from each other.
PushManager.getSubscription() - Web APIs
var pushbutton = document.queryselector('.js-push-button'); pushbutton.disabled = false; if (!subscription) { // we aren’t subscribed to push, so set ui // to allow the user to enable push return; } // keep your server in sync with the latest subscriptionid sendsubscriptiontoserver(subscription); showcurlcommand(subscription); // set your ui to show they have subscribed for // push messages pushbutton.textcontent = 'disable push messages'; ispushenabled = true; }) .catch(function(err) { window.demo.debug.log('error during getsubscription()', err); }); }); specifications specification status comment push api...
PushSubscription.getKey() - Web APIs
subbtn.disabled = false; if (!subscription) { console.log('not yet subscribed to push') // we aren't subscribed to push, so set ui // to allow the user to enable push return; } // set your ui to show they have subscribed for // push messages subbtn.textcontent = 'unsubscribe from push messaging'; ispushenabled = true; // initialize status, which includes setting ui elements for subscribed status // and updating subscribers list via push var endpoint = subscription.endpoint; var key = subscription.getkey('p256dh'); var auth = subscription.getkey('auth'); ...
Push API - Web APIs
WebAPIPush API
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.
RTCDataChannel.bufferedAmount - Web APIs
*/ function showbufferedamount(channel) { let el = document.getelementbyid("buffersize"); el.innerhtml = channel.bufferedamount + " bytes"; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.bufferedamount' in that specification.
RTCDataChannelEvent.channel - Web APIs
example the first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic.
RTCErrorEvent - Web APIs
it's based on the standard event interface, but adds rtc-specific information describing the error, as shown below.
RTCIceCandidate.candidate - Web APIs
function handlenewicecandidate(candidatesdp) { var candidateobj = new rtcicecandidate(candidatesdp); mypeerconnection.addicecandidate(candidateobj).catch({ /* handle the error thrown by addicecandidate() */ }); } the handlenewicecandidate() function shown here passes the received candidate's sdp text into rtcicecandidate() to receive an rtcicecanddiate object in return, which represents the candidate.
RTCIceCandidate.relatedPort - Web APIs
see the example, which shows a bit of this.
RTCIceCandidate.type - Web APIs
if (candidate.type == "host") { showhostcontrols(); } else { hidehostcontrols(); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.type' in that specification.
RTCIceCandidatePair - Web APIs
example in this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair.
RTCIceCandidatePairStats.selected - Web APIs
example the function shown in this example identifies the currently-selected candidate pair from a statistics report by first iterating over each report, looking for a transport report; when one is found, that transport's selectedcandidatepairid is used to get the rtcicecandidatepair describing the connection.
RTCIceServer - Web APIs
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.
RTCIceTransport.getSelectedCandidatePair() - Web APIs
example in this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair.
RTCIceTransport.onselectedcandidatepairchange - Web APIs
example in this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair.
RTCInboundRtpStreamStats.qpSum - Web APIs
example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream.
RTCOfferOptions.iceRestart - Web APIs
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.
RTCOutboundRtpStreamStats.qpSum - Web APIs
example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream.
RTCPeerConnection.addIceCandidate() - Web APIs
examples this code snippet shows how to signal ice candidates across an arbitrary signaling channel.
RTCPeerConnection.addTrack() - Web APIs
here's an example showing a function that uses getusermedia() to obtain a stream from a user's camera and microphone, then adds each track from the stream to the peer connection, without specifying a stream for each track: async opencall(pc) { const gumstream = await navigator.mediadevices.getusermedia( {video: true, audio: true}); for (const track of gumstream.gettracks()) { pc.addtr...
RTCPeerConnection.getSenders() - Web APIs
example in this example, a setmuting() function is shown.
RTCPeerConnection.onsignalingstatechange - Web APIs
you may also, as always, set up a handler for the signalingstatechange event using addeventlistener(): myrtcpeerconnection.addeventlistener("signalingstatechange", mysignalingstatechangehandler); or, using an anonymous (inline) handler: myrtcpeerconnection.addeventlistener("signalingstatechange", event => { /* handle the event here */ }); example this snippet shows a handler for signalingstatechange that looks for the "have-local-pranswer" signaling state—indicating that a remote offer has been received and a local description of type "pranswer" has been applied in response.
RTCPeerConnection.setLocalDescription() - Web APIs
providing your own offer or answer the example below shows the implementation of a handler for the negotiationneeded event that explicitly creates an offer, rather than letting setlocaldescription() do it.
RTCPeerConnection: track event - Web APIs
examples this example shows code that creates a new rtcpeerconnection, then adds a new track event handler.
RTCPeerConnectionIceErrorEvent.address - Web APIs
pc.addeventlistener("icecandidateerror", (event) => { let networkinfo = `[local interface: ${event.address}:${event.port}`; let iceserverinfo = `[ice server: ${event.url}`; showmessage(errortext, iceserverinfo, networkinfo); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceerrorevent.address' in that specification.
RTCRtpCapabilities - Web APIs
don't be surprised to see these show up ijn the list; be prepared to ignore them if you're only interested in the actual codecs used for the media itself.
RTCRtpStreamStats.qpSum - Web APIs
example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcrtpstreamstats object, returning 0 if the object doesn't describe an rtp stream.
RTCRtpTransceiver.currentDirection - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
RTCRtpTransceiver.direction - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
RTCRtpTransceiverDirection - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
ReadableStream.ReadableStream() - Web APIs
const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement('li'); listitem.textcontent = string; list1.appendchild(listitem); }, 1000); button.addeventlistener('click', function() { clearinterval(interval); fetchstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is...
ReadableStream.cancel() - Web APIs
var searchterm = "service workers"; // chars to show either side of the result in the match var contextbefore = 30; var contextafter = 30; var caseinsensitive = true; var url = 'https://html.spec.whatwg.org/'; console.log(`searching '${url}' for '${searchterm}'`); fetch(url).then(response => { console.log('received headers'); var decoder = new textdecoder(); var reader = response.body.getreader(); var tomatch = caseinsensitive ?
ReadableStreamDefaultController.close() - Web APIs
const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement('li'); listitem.textcontent = string; list1.appendchild(listitem); }, 1000); button.addeventlistener('click', function() { clearinterval(interval); fetchstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is...
ReadableStreamDefaultController.enqueue() - Web APIs
const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement('li'); listitem.textcontent = string; list1.appendchild(listitem); }, 1000); button.addeventlistener('click', function() { clearinterval(interval); fetchstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is...
ReadableStreamDefaultController - Web APIs
const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement('li'); listitem.textcontent = string; list1.appendchild(listitem); }, 1000); button.addeventlistener('click', function() { clearinterval(interval); fetchstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is...
RelativeOrientationSensor.RelativeOrientationSensor() - Web APIs
this is not something that would ever be shown to a user.
RelativeOrientationSensor - Web APIs
this is not something that would ever be shown to a user.
ResizeObserver - Web APIs
this shows that you can respond to changes in an element’s size, even if they have nothing to do with the viewport.
Resize Observer API - Web APIs
this shows that you can respond to changes in an element’s size, even if they have nothing to do with the viewport.
Using the Resource Timing API - Web APIs
this document shows the use of resource timing interfaces.
Response.redirected - Web APIs
see the example disallowing redirects, which shows this being done.
getBBox() - Web APIs
example html <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <g id="group_text_1"> <text x="5" y="16" transform="scale(2, 2)">hello world!</text> <text x="8" y="32" transform="translate(0 20) scale(1.25 1)">hello world again!</text> </g> <!-- shows bbox in green --> <rect id="rect_1" stroke="#00ff00" stroke-width="3" fill="none"> </rect> <!-- shows boundingclientrect in red --> <rect id="rect_2" stroke="#ff0000" stroke-width="3" fill="none"></rect> </svg> javascript var rectbbox = document.queryselector('#rect_1'); var rectboundingclientrect = document.queryselector('#rect_2'); var groupelement = document.queryselector('#gro...
SVGTransformList - Web APIs
<svg id="my-svg" viewbox="0 0 300 280" xmlns="http://www.w3.org/2000/svg" version="1.1"> <desc>example showing how to transform svg elements that using svgtransform objects</desc> <script type="application/ecmascript"> <![cdata[ function transformme(evt) { // svg root element to access the createsvgtransform() function var svgroot = evt.target.parentnode; // svgtransformlist of the element that has been clicked on var tfmlist = evt.target.transform.baseval; // crea...
ScriptProcessorNode.bufferSize - Web APIs
example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
ScriptProcessorNode.onaudioprocess - Web APIs
} example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
ScriptProcessorNode - Web APIs
examples the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
Selection.rangeCount - Web APIs
syntax value = sel.rangecount example the following example will show the rangecount every second.
Selection API - Web APIs
see also key quote generator: a simple demo showing typical usage of the selection api to capture the current selection at any point and copy selections into a list (see it live also).
Sensor - Web APIs
WebAPISensor
this is not something that would ever be shown to a user.
Using server-sent events - Web APIs
note: you can find a full example that uses the code shown in this article on github — see simple sse demo using php.
ServiceWorkerGlobalScope: activate event - Web APIs
bubbles no cancelable no interface extendableevent event handler property serviceworkerglobalscope.onactivate examples the following snippet shows how you could use an activate event handler to upgrade a cache.
ServiceWorkerGlobalScope: install event - Web APIs
bubbles no cancelable no interface extendableevent event handler property serviceworkerglobalscope.oninstall examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', ...
ServiceWorkerGlobalScope: notificationclick event - Web APIs
the notificationclick event is fired to indicate that a system notification spawned by serviceworkerregistration.shownotification() has been clicked.
ServiceWorkerGlobalScope.onactivate - Web APIs
}; examples the following snippet shows how you could use an activate event handler to upgrade a cache.
ServiceWorkerGlobalScope.oninstall - Web APIs
}; examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/galler...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
the serviceworkerglobalscope.onnotificationclick property is an event handler called whenever the notificationclick event is dispatched on the serviceworkerglobalscope object, that is when a user clicks on a displayed notification spawned by serviceworkerregistration.shownotification().
onnotificationclose - Web APIs
the serviceworkerglobalscope.onnotificationclose property is an event handler called whenever the notificationclose event is dispatched on the serviceworkerglobalscope object, that is when a user closes a displayed notification spawned by serviceworkerregistration.shownotification().
Service Worker API - Web APIs
for a complete tutorial to show how to build up your first basic example, read using service workers.
SharedWorker() - Web APIs
examples the following code snippet shows creation of a sharedworker object using the sharedworker() constructor and subsequent usage of the object: var myworker = new sharedworker('worker.js'); myworker.port.start(); first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value])...
SharedWorker.port - Web APIs
WebAPISharedWorkerport
example the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
SharedWorker - Web APIs
the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
SharedWorkerGlobalScope: connect event - Web APIs
bubbles no cancelable no interface messageevent event handler property sharedworkerglobalscope.onconnect examples this example shows a shared worker file — when a connection to the worker occurs from a main thread via a messageport, the onconnect event handler fires.
SharedWorkerGlobalScope.onconnect - Web APIs
}; examples this example shows a shared worker file — when a connection to the worker occurs from a main thread via a messageport, the onconnect event handler fires.
Slottable: assignedSlot - Web APIs
here is one such example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> in our javascript file we get a reference to the <span> shown above, then log a reference to the original <slot> element the <span> was inserted in.
Storage API - Web APIs
the diagram below shows a site storage pool with three storage units within, showing how storage units can have different data types stored within and may have different quotas (maximum storage limits).
Using the Storage Access API - Web APIs
accessing a user's cookies in an embedded cross-origin iframe in this example we show how an embedded cross-origin <iframe> can access a user’s cookies under a storage access policy that blocks third-party cookies.
StyleSheet.ownerNode - Web APIs
syntax noderef = stylesheet.ownernode example <html lang="en"> <head> <link rel="stylesheet" href="example.css"> </head> <body> <button onclick="alert(document.stylesheets[0].ownernode)">show example.css’s ownernode</button> </body> </html> // displays "object htmllinkelement" notes for style sheets that are included by other style sheets, such as with @import, the value of this property is null.
SubmitEvent.submitter - Web APIs
let form = document.queryselector("form"); form.addeventlistener("submit", (event) => { let submitter = event.submitter; let handler = submitter.id; if (handler) { processorder(form, handler); } else { showalertmessage("an unknown or unaccepted payment type was selected.
SubmitEvent - Web APIs
let form = document.queryselector("form"); form.addeventlistener("submit", (event) => { let submitter = event.submitter; let handler = submitter.id; if (handler) { processorder(form, handler); } else { showalertmessage("an unknown or unaccepted payment type was selected.
TextDecoder - Web APIs
examples representing text with typed arrays this example shows how to decode a chinese/japanese character , as represented by five different typed arrays: uint8array, int8array, uint16array, int16array, and int32array.
TextEncoder.prototype.encodeInto() - Web APIs
if you are working with c++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size.
Multi-touch interaction - Web APIs
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.
TreeWalker.currentNode - Web APIs
syntax node = treewalker.currentnode; treewalker.currentnode = node; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); root = treewalker.currentnode; // the root element as it is the first element!
TreeWalker.filter - Web APIs
WebAPITreeWalkerfilter
syntax nodefilter = treewalker.filter; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); nodefilter = treewalker.filter; // document.body in this case specifications specification status comment domthe definition of 'treewalker.filter' in that specification.
TreeWalker.firstChild() - Web APIs
syntax node = treewalker.firstchild; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.firstchild(); // returns the first child of the root element, or null if none specifications specification status comment domthe definition of 'treewalker.firstchild' in that specification.
TreeWalker.lastChild() - Web APIs
syntax node = treewalker.lastchild(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.lastchild(); // returns the last visible child of the root element specifications specification status comment domthe definition of 'treewalker.lastchild' in that specification.
TreeWalker.nextNode() - Web APIs
syntax node = treewalker.nextnode(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.nextnode(); // returns the first child of root, as it is the next node in document order specifications specification status comment domthe definition of 'treewalker.nextnode' in that specification.
TreeWalker.nextSibling() - Web APIs
syntax node = treewalker.nextsibling(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); treewalker.firstchild(); var node = treewalker.nextsibling(); // returns null if the first child of the root element has no sibling specifications specification status comment domthe definition of 'treewalker.nextsibling' in that specification.
TreeWalker.parentNode() - Web APIs
syntax node = treewalker.parentnode(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.parentnode(); // returns null as there is no parent specifications specification status comment domthe definition of 'treewalker.parentnode' in that specification.
TreeWalker.previousNode() - Web APIs
syntax node = treewalker.previousnode(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.previousnode(); // returns null as there is no parent specifications specification status comment domthe definition of 'treewalker.previousnode' in that specification.
TreeWalker.previousSibling() - Web APIs
syntax node = treewalker.previoussibling(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.previoussibling(); // returns null as there is no previous sibiling specifications specification status comment domthe definition of 'treewalker.previoussibling' in that specification.
TreeWalker.root - Web APIs
WebAPITreeWalkerroot
syntax root = treewalker.root; example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); root = treewalker.root; // document.body in this case specifications specification status comment domthe definition of 'treewalker.root' in that specification.
UDP Socket API - Web APIs
//todo: docs are missing, see https://bugzilla.mozilla.org/show_bug.cgi?id=745283 ...
URLSearchParams() - Web APIs
examples the following example shows how to create a urlsearchparams object from a url string.
URLSearchParams.append() - Web APIs
as shown in the example below, if the same key is appended multiple times it will appear in the parameter string multiple times for each value.
URL API - Web APIs
WebAPIURL API
you can also look up the values of individual parameters with the urlsearchparams object's get() method: let addr = new url("https://mysite.com/login?user=someguy&page=news"); try { loginuser(addr.searchparams.get("user")); gotopage(addr.searchparams.get("page")); } catch(err) { showerrormessage(err); } for example, in the above snippet, the username and target page are taken from the query and passed to appropriate functions that are used by the site's code to log in and route the user to their desired destination within the site.
USB.requestDevice() - Web APIs
WebAPIUSBrequestDevice
the number of filters does not specifiy the number of devices shown by the user agent.
USBDevice.claimInterface() - Web APIs
example the following example shows claiminterface() in the context of connecting to a usb device.
USBDevice.clearHalt() - Web APIs
example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer.
USBDevice.opened - Web APIs
WebAPIUSBDeviceopened
it shows how to test that a device is open before calling usbdevice.controltransferout to set a specified led color.
User Timing API - Web APIs
interoperability as shown in the performance interface's browser compatibility table, the user timing methods are broadly implemented by desktop and mobile browsers (the only exceptions are desktop safari and mobile safari, however the safari technology preview 24 has support).
VideoPlaybackQuality.creationTime - Web APIs
if that exceeds 10% (0.1), a function called lostframesthresholdexceeded() is called to, perhaps, update a quality indicator to show an increase in frame loss.
VideoPlaybackQuality.totalVideoFrames - Web APIs
if that exceeds 10% (0.1), a function called lostframesthresholdexceeded() is called to, perhaps, update a quality indicator to show an increase in frame loss.
WEBGL_depth_texture - Web APIs
incorrectly stated as the target parameter in the specification, see https://www.khronos.org/bugzilla/show_bug.cgi?id=674.
WakeLockSentinel.type - Web APIs
examples this example shows an asynchronous function that acquires a wakelocksentinel, then logs the type to the console.
WaveShaperNode.curve - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
WaveShaperNode.oversample - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
WaveShaperNode - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
WebGLProgram - Web APIs
this is shown in the code below.
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
example this code — a snippet taken from the full example a basic 2d webgl animation example — shows the use of enablevertexarray() to activate the attribute that will be used by the webgl layer to pass individual vertexes from the vertex buffer into the vertex shader function.
WebGLRenderingContext.makeXRCompatible() - Web APIs
*/ outputcanvas.addeventlistener("webglcontextrestored", (event) => { loadsceneresources(currentscene); }); async function onstartedxrsession(xrsession) { try { await gl.makexrcompatible(); } catch(err) { switch(err) { case aborterror: showsimplemessagebox("unable to transfer the game to your xr headset.", "cancel"); break; case invalidstateerror: showsimplemessagebox("you don't appear to have a compatible xr headset available.", "cancel"); break; default: handlefatalerror(err); break; } xrsession.end(); } } async function handlestartbuttonclick(event) { if (event.targ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
examples this example shows how to send your vertex attributes to the shader program.
Clearing by clicking - Web APIs
<p>a very simple webgl program that still shows some color and user interaction.</p> <p>you can repeatedly click the empty canvas or the button below to change color.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="color-switcher">press here to switch color</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto;...
Simple color animation - Web APIs
<p>a simple webgl program that shows color animation.</p> <p>you can click the button below to toggle the color animation on or off.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="animation-onoff"> press here to <strong>[verb goes here]</strong> the animation </button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; ...
WebGL by example - Web APIs
next » webgl by example is a series of live samples with short explanations that showcase webgl concepts and capabilities.
Compressed texture formats - Web APIs
this site shows which formats are supported in the used browser.
Adding 2D content to a WebGL context - Web APIs
if that's false, we know the shader failed to compile, so show an alert with log information obtained from the compiler using gl.getshaderinfolog(), then delete the shader and return null to indicate a failure to load the shader.
WebGL: 2D and 3D graphics for the web - Web APIs
WebAPIWebGL API
webgl by example a series of live samples with short explanations that showcase webgl concepts and capabilities.
WebRTC Statistics API - Web APIs
the table below shows the statistic categories and the corresponding dictionaries; for each statistic category, the full hierarchy of rtcstats-based dictionaries are listed, so you can easily find all the available values.
Writing a WebSocket server in C# - Web APIs
in this article i will show you how to write one in c#.
Writing WebSocket servers - Web APIs
fin and opcode details are shown only for the client: client: fin=1, opcode=0x1, msg="hello" server: (process complete message immediately) hi.
Writing a WebSocket server in Java - Web APIs
introduction this example shows you how to create a websocket api server using oracle java.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
not only does your app need to determine what to show the user during these periods, but it needs to cleanly recover when tracking resumes.
Starting up and shutting down a WebXR session - Web APIs
by calling freeresources() in the end event handler, we call it both when the user clicks a button that triggers a shutdown such as by calling the shutdownxr() function shown above and when the session ends automatically, whether due to an error or some other reason.
Using the Web Animations API - Web APIs
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 changes at an offset from her spinning.
Web Audio API best practices - Web APIs
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 have access to the data directly, which means more precision, and more precise manipulation.
Controlling multiple parameters with ConstantSourceNode - Web APIs
the diagram below shows how this works; an input value, n, is set as the value of the constantsourcenode.offset property.
Example and tutorial: Simple synth keyboard - Web APIs
several octaves not shown for brevity ...
Using IIR filters - Web APIs
this should have shown you how to use the basics, and helped you to understand what it's useful for and how it works.
Using the Web Audio API - Web APIs
it also provides a psychedelic lightshow (see violent theremin source code).
Web Audio API - Web APIs
this should have shown you how to use the basics, and helped you to understand what it's useful for and how it works.using the web audio apigreat!
Web Workers API - Web APIs
workernavigator represents the identity and state of the user agent (the client): examples we have created a couple of simple demos to show basic usage: basic dedicated worker example (run dedicated worker).
Window: beforeunload event - Web APIs
according to the specification, to show the confirmation dialog an event handler should call preventdefault() on the event.
Window.close() - Web APIs
WebAPIWindowclose
syntax window.close(); examples closing a window opened with window.open() this example shows a method which opens a window and a second one which closes the window; this demonstrates how to use window.close() to close a window opened by calling window.open().
Window.dialogArguments - Web APIs
the dialogarguments property returns the parameters that were passed into the window.showmodaldialog() method.
window.dump() - Web APIs
WebAPIWindowdump
however, this use of dump is not affected by the preference mentioned below -- it will always be shown.
Window.find() - Web APIs
WebAPIWindowfind
syntax window.find(astring, acasesensitive, abackwards, awraparound, awholeword, asearchinframes, ashowdialog); astring the text string for which to search.
Window.innerHeight - Web APIs
graphical example the following figure shows the difference between outerheight and innerheight.
Window.locationbar - Web APIs
syntax objref = window.locationbar example the following complete html example shows how the visible property of the locationbar object is used.
Window.onbeforeinstallprompt - Web APIs
window.addeventlistener("beforeinstallprompt", function(beforeinstallpromptevent) { beforeinstallpromptevent.preventdefault(); // prevents immediate prompt display // shows prompt after a user clicks an "install" button installbutton.addeventlistener("click", function(mouseevent) { // you should not use the mouseevent here, obviously beforeinstallpromptevent.prompt(); }); installbutton.hidden = false; // make button operable }); ...
Window.open() - Web APIs
WebAPIWindowopen
tip: for accessibility reasons, it is strongly recommended to set this feature always on scrollbars if this feature is on, the new secondary window will show horizontal and/or vertical scrollbar(s) if the document doesn't fit into the window's viewport.
Window.outerHeight - Web APIs
graphical example the following figure shows the difference between outerheight and innerheight.
Window.pageYOffset - Web APIs
note that the frame's contents have been scrolled to show the section named "overview", and that the value of the pageyoffset property is shown with the corresponding value.
Window: pagehide event - Web APIs
for example, when the user clicks the browser's back button, the current page receives a pagehide event before the previous page is shown.
Window.personalbar - Web APIs
syntax objref =window.personalbar example fixme: https://bugzilla.mozilla.org/show_bug.cgi?id=790023 the following complete html example shows the way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
Window.prompt() - Web APIs
WebAPIWindowprompt
can be omitted if there is nothing to show in the prompt window.
Window.scrollbars - Web APIs
WebAPIWindowscrollbars
syntax objref = window.scrollbars example the following complete html example shows how the visible property of the scrollbars object is used.
Window.statusbar - Web APIs
WebAPIWindowstatusbar
syntax objref = window.statusbar example the following complete html example shows a way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
Window.toolbar - Web APIs
WebAPIWindowtoolbar
syntax objref = window.toolbar example the following complete html example shows way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
Window: unhandledrejection event - Web APIs
examples here we have a few examples showing ways you can make use of the unhandledrejection event.
WindowEventHandlers.onbeforeunload - Web APIs
window.addeventlistener('beforeunload', function (e) { // cancel the event e.preventdefault(); // if you prevent default behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascript to render content, the j...
WindowEventHandlers - Web APIs
windoweventhandlers.onpageshow is an eventhandler representing the code to be called when the pageshow event is raised.
WindowOrWorkerGlobalScope.caches - Web APIs
example the following example shows how you'd use a cache in a service worker context to store assets offline.
WindowOrWorkerGlobalScope.setInterval() - Web APIs
the following example shows a possible replacement: // enable the passage of the 'this' object through the javascript timers var __nativest__ = window.settimeout, __nativesi__ = window.setinterval; window.settimeout = function (vcallback, ndelay /*, argumenttopass1, argumenttopass2, etc.
Worker() - Web APIs
WebAPIWorkerWorker
examples the following code snippet shows creation of a worker object using the worker() constructor and subsequent usage of the object: var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see our basic dedicated worker example (run dedicated worker).
Worker.onmessage - Web APIs
WebAPIWorkeronmessage
} example the following code snippet shows creation of a worker object using the worker() constructor.
Worker.terminate() - Web APIs
WebAPIWorkerterminate
example the following code snippet shows creation of a worker object using the worker() constructor, which is then immediately terminated.
WorkerGlobalScope.onclose - Web APIs
}; example the following code snippet shows an onclose handler set inside a worker: self.onclose = function() { console.log('your worker instance has been closed'); } specifications this feature is no longer defined in any specifications.
WorkerGlobalScope.onerror - Web APIs
}; example the following code snippet shows an onerror handler set inside a worker: self.onerror = function() { console.log('there is an error inside your worker!'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onerror' in that specification.
WorkerGlobalScope.onlanguagechange - Web APIs
}; example the following code snippet shows an onlanguagechange handler set inside a worker: self.onlanguagechange = function() { console.log('your preferred language settings have been changed'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onlanguagechange' in that specification.
WorkerGlobalScope.onoffline - Web APIs
}; example the following code snippet shows an onoffline handler set inside a worker: self.onoffline = function() { console.log('your worker is now offline'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onoffline' in that specification.
WorkerGlobalScope.ononline - Web APIs
}; example the following code snippet shows an ononline handler set inside a worker: self.ononline = function() { console.log('your worker is now online'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.ononline' in that specification.
WorkerNavigator.permissions - Web APIs
examples self.navigator.permissions.query({name:'notifications'}).then(function(result) { if (result.state === 'granted') { shownotification(); } else if (result.state === 'prompt') { requestnotificationpermission() } }); specification specification status comment permissions working draft initial definition.
WritableStream.WritableStream() - Web APIs
it shows the creation of the writablestream with a custom sink and an api-supplied queuing strategy.
WritableStream.getWriter() - Web APIs
it shows the creation of the writablestream with a custom sink and an api-supplied queuing strategy.
WritableStream - Web APIs
it shows the creation of the writablestream with a custom sink and an api-supplied queueing strategy.
WritableStreamDefaultWriter.WritableStreamDefaultWriter() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
WritableStreamDefaultWriter.close() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
WritableStreamDefaultWriter.ready - Web APIs
example the following example shows two uses of the ready property.
WritableStreamDefaultWriter.write() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
WritableStreamDefaultWriter - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
Sending and Receiving Binary Data - Web APIs
}; oreq.send(); receiving binary data in older browsers the load_binary_resource() function shown below loads binary data from the specified url, returning it to the caller.
XMLHttpRequest.getAllResponseHeaders() - Web APIs
the code shows how to obtain the raw header string, as well as how to convert it into an array of individual headers and then how to take that array and create a mapping of header names to their values.
XPathEvaluator.createExpression() - Web APIs
example the following example shows the use of the evaluate() method.
XPathEvaluator.evaluate() - Web APIs
example the following example shows the use of the evaluate() method.
XPathEvaluator - Web APIs
example the following example shows the use of the xpathevaluator interface.
XPathExpression.evaluate() - Web APIs
example the following example shows the use of the evaluate() method.
XPathExpression - Web APIs
example the following example shows the use of the xpathexpression interface.
XPathResult.booleanValue - Web APIs
example the following example shows the use of the booleanvalue property.
XPathResult.invalidIteratorState - Web APIs
example the following example shows the use of the invaliditeratorstate property.
XPathResult.iterateNext() - Web APIs
example the following example shows the use of the iteratenext() method.
XPathResult.numberValue - Web APIs
example the following example shows the use of the numbervalue property.
XPathResult.resultType - Web APIs
example the following example shows the use of the resulttype property.
XPathResult.singleNodeValue - Web APIs
example the following example shows the use of the singlenodevalue property.
XPathResult.snapshotItem() - Web APIs
example the following example shows the use of the snapshotitem() method.
XPathResult.snapshotLength - Web APIs
example the following example shows the use of the snapshotlength property.
XPathResult.stringValue - Web APIs
example the following example shows the use of the stringvalue property.
XREnvironmentBlendMode - Web APIs
this is primarily used by fully-immersive vr headsets, which totally obscure the surrounding environment, with none of the real world shown to the user at all.
XRInputSource.gripSpace - Web APIs
as shown in the diagram above, the coordinate system is oriented as follows: the x-axis is perpendicular to the palm of the user's hand, with the direction extending outward from the back of the hand being +x if the controller is in the user's right hand or -x if the controller is in the left hand.
XRInputSource.targetRayMode - Web APIs
example this fragment of code shows part of a function to be called once every frame.
XRInputSourceArray.length - Web APIs
let sources = xrsession.inputsources; if (sources.length === 0) { showalertdialog("you need to have at least one controller to play super duper shark jump fest 9000.", [ { label: "shop now", url: "https://www.amazon.com/s?k=vr+controllers" }, { label: "quit" handler: quitgame } ]); } here, if length is 0, a hypothetical showalertdialog() function is called with a prompt string explaining th...
XRInputSourceEvent.frame - Web APIs
examples this code shows a handler for the selectstart 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.
XRInputSourceEvent.inputSource - Web APIs
example the snippet below shows a handler for the select event which looks specifically for events which happen on gaze input devices.
XRInputSourcesChangeEvent - Web APIs
examples the following example shows how to set up an event handler which uses inputsourceschange events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame.
XRRigidTransform() - Web APIs
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.
XRRigidTransform.inverse - Web APIs
*/ } this outline of a renderer's core code shows how the pose's view gets represented by taking its transform's inverse's matrix as the model view matrix used to transform objects based on the viewer's position and orientation.
XRSession.cancelAnimationFrame() - Web APIs
the pausexr() function shown at the bottom can be called to suspend the webvr session, in essence, by canceling any pending animation frame callback.
XRSession.environmentBlendMode - Web APIs
this is primarily used by fully-immersive vr headsets, which totally obscure the surrounding environment, with none of the real world shown to the user at all.
XRSession.visibilityState - Web APIs
usage notes it's important to keep in mind that because an immersive webxr session is potentially being shown using a different display than the html document in which it's running (such as when being shown on a headset), the value of a session's visibilitystate may not necessarily be the same as the owning document's visibilitystate.
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
this method of dividing the frame buffer between views is shown in the following diagram.
XRWebGLLayer - Web APIs
examples binding the layer to a webgl context this snippet, taken from drawing a frame in movement, orientation, and motion: a webxr example, shows how the xrwebgllayer is obtained from the xrsession object's rendering state and is then bound as the current rendering webgl framebuffer by calling the webgl bindframebuffer() function.
XSLT Basic Example - Web APIs
figure 1 shows the source of the basic xslt example.
msWriteProfilerMark - Web APIs
notes mswriteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being rendered, building a waterfall view for every one of our impressions showing latency per object, which can be useful for more accurately debugging real users perf issues.
msthumbnailclick - Web APIs
icon window.external.mssitemodecleariconoverlay(); // pinned icons on your taskbar can be instructed to trigger specific events on your site from the taskbar // add an event handlerdocument.addeventlistener('msthumbnailclick', onbuttonclicked, false); // add the buttons var btnplay = window.external.mssitemodeaddthumbbarbutton(iconuri, tooltip); // refresh the taskbar window.external.mssitemodeshowthumbbar(); // call a javascript function when the button is pressed function onbuttonclicked(e) { switch (e.buttonid) { case btnplay: play(); break;} } see also microsoft api extensions ...
Web APIs
WebAPI
ard keyboardevent keyboardlayoutmap keyframeeffect keyframeeffectoptions l largestcontentfulpaint layoutshift layoutshiftattribution linearaccelerationsensor linkstyle localfilesystem localfilesystemsync localmediastream location lock lockmanager lockedfile m midiaccess midiconnectionevent midiinput midiinputmap midimessageevent midioutputmap mscandidatewindowhide mscandidatewindowshow mscandidatewindowupdate msgestureevent msgraphicstrust msmanipulationevent msrangecollection mssitemodeevent magnetometer mathmlelement mediacapabilities mediacapabilitiesinfo mediaconfiguration mediadecodingconfiguration mediadeviceinfo mediadevices mediaelementaudiosourcenode mediaencodingconfiguration mediaerror mediaimage mediakeymessageevent mediakeysession mediakeystatusmap me...
ARIA live regions - Accessibility
advanced use case: clock as an illustration of aria-atomic, consider a site with a simple clock, showing hours and minutes.
Using the alert role - Accessibility
examples example 1: adding the role in the html code the snippet below shows how the alert role is added directly into the html source code.
Using the alertdialog role - Accessibility
examples example 1: a basic alert dialog the code snippet below shows how to mark up an alert dialog that only provides a message and an ok button.
Using the aria-describedby attribute - Accessibility
<div role="application" aria-labelledby="calendar" aria-describedby="info"> <h1 id="calendar">calendar</h1> <p id="info"> this calendar shows the game schedule for the boston red sox.
Using the aria-orientation attribute - Accessibility
examples example 1: the snippet below shows a simple slider that is oriented vertically.
Using the aria-valuemax attribute - Accessibility
examples example 1: the snippet below shows a simple slider with a maximum value of 10.
Using the aria-valuemin attribute - Accessibility
examples example 1: the snippet below shows a simple slider with a minimum value of 1.
Using the aria-valuenow attribute - Accessibility
examples example 1: the snippet below shows a simple slider with a current value of 4.
Using the aria-valuetext attribute - Accessibility
examples example 1: the snippet below shows a simple slider for selecting a day of the week.
Using the log role - Accessibility
examples example 1: adding the role in the html code the snippet below shows how the log role is added directly into the html source code.
Using the slider role - Accessibility
<label id="day-label">days</label> <div class="day-slider"> <div id="day-handle" class="day-slider-handle" role="slider" aria-labelledby="day-label" aria-valuemin="1" aria-valuemax="7" aria-valuenow="2" aria-valuetext="monday"> </div> </div> the code snippet below shows a function that responds to user input and updates the aria-valuenow and aria-valuetext attributes: var daynames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; var updateslider = function (newvalue) { var handle = document.getelementbyid("day-handle"); handle.setattribute("aria-valuenow", newvalue.tostring()); handle.setattribute("aria-valuetext", ...
Using the status role - Accessibility
examples example 1: adding the status role in html the snippet below shows how the status role is added directly into the html source code.
ARIA: tabpanel role - Accessibility
examples fill in a simple example that nicely shows a typical usage of the property, then perhaps some more complex examples.
ARIA: timer role - Accessibility
as an illustration of aria-atomic, consider a site with a simple clock, showing hours and minutes.
ARIA: article role - Accessibility
</div> this example shows two articles side by side on one page that could be structured similarly and are related.
ARIA: document role - Accessibility
<button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it.
ARIA: tab role - Accessibility
parent = parent.parentnode; // remove all current selected tabs parent .queryselectorall('[aria-selected="true"]') .foreach(t => t.setattribute("aria-selected", false)); // set this tab as selected target.setattribute("aria-selected", true); // hide all tab panels grandparent .queryselectorall('[role="tabpanel"]') .foreach(p => p.setattribute("hidden", true)); // show the selected panel grandparent.parentnode .queryselector(`#${target.getattribute("aria-controls")}`) .removeattribute("hidden"); } best practices it is recommended to use a button element with the role tab for their built-in functional and accessible features instead, as opposed to needing to add them yourself.
Accessibility documentation index - Accessibility
91 html to msaa accessibility the table below shows how gecko maps html elements to msaa.
Keyboard-navigable JavaScript widgets - Accessibility
(for a full description of the keyboard support that is normally expected for typical widgets, see the wai-aria authoring practices.) the example below shows this technique used with a nested menu control.
Web Accessibility: Understanding Colors and Luminance - Accessibility
for more information as to how an opthamologist uses this test, see red desaturation red environment: studies have shown that for those who suffer traumatic brain injury, cognitive function is reduced in a red environment.
Perceivable - Accessibility
use native <button>s to provide accessible keyboard controls, as shown in video player styling basics.
-webkit-touch-callout - CSS: Cascading Style Sheets
the -webkit-touch-callout css property controls the display of the default callout shown when you touch and hold a touch target.
:-moz-ui-valid - CSS: Cascading Style Sheets
however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid.
:-moz-window-inactive - CSS: Cascading Style Sheets
html <div id="mybox"> <p>this is a box!</p> </div> css #mybox { background: linear-gradient(to bottom, yellow, cyan); width: 200px; height: 200px; } #mybox:-moz-window-inactive { background: cyan; } result the result of this code is shown below.
::-webkit-file-upload-button - CSS: Cascading Style Sheets
the screenshot to the left shows what the button will look like if you are without access to chrome, opera or safari.
::-webkit-search-cancel-button - CSS: Cascading Style Sheets
the clear button is only shown on non-empty search <input> elements.
::-webkit-search-results-button - CSS: Cascading Style Sheets
the search results button is only shown on search <input> elements that have a results attribute.
::after (:after) - CSS: Cascading Style Sheets
WebCSS::after
this shows how flexible ::before and ::after can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with details and summary elements) is likely to be more appropriate.
::backdrop - CSS: Cascading Style Sheets
/* backdrop is only displayed when dialog is opened with dialog.showmodal() */ dialog::backdrop { background: rgba(255,0,0,.25); } all full-screen elements are placed in a last-in/first out (lifo) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen.
::grammar-error - CSS: Cascading Style Sheets
rties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow syntax ::grammar-error examples simple document grammar check in this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown.
::spelling-error - CSS: Cascading Style Sheets
operties can be used in a rule with ::spelling-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow syntax ::spelling-error examples simple document spell check in this example, eventual supporting browsers should highlight any flagged spelling errors with the styles shown.
:checked - CSS: Cascading Style Sheets
WebCSS:checked
" id="expand-btn">toggle hidden rows</label> css /* hide the toggle checkbox */ #expand-toggle { display: none; } /* hide expandable content by default */ .expandable { visibility: collapse; background: #ddd; } /* style the button */ #expand-btn { display: inline-block; margin-top: 12px; padding: 5px 11px; background-color: #ff7; border: 1px solid; border-radius: 3px; } /* show hidden content when the checkbox is checked */ #expand-toggle:checked ~ * .expandable { visibility: visible; } /* style the button when the checkbox is checked */ #expand-toggle:checked ~ #expand-btn { background-color: #ccc; } result image gallery you can use the :checked pseudo-class to build an image gallery with full-size images that show only when the user clicks on a thumbnail.
:disabled - CSS: Cascading Style Sheets
WebCSS:disabled
/* selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic shipping form.
:first-of-type - CSS: Cascading Style Sheets
syntax :first-of-type examples styling the first paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:first-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted.
:hover - CSS: Cascading Style Sheets
WebCSS:hover
syntax :hover examples basic example html <a href="#">try hovering over this link.</a> css a { background-color: powderblue; transition: background-color .5s; } a:hover { background-color: gold; } result image gallery you can use the :hover pseudo-class to build an image gallery with full-size images that show only when the mouse moves over a thumbnail.
:last-of-type - CSS: Cascading Style Sheets
syntax :last-of-type examples styling the last paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:last-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted.
:state() - CSS: Cascading Style Sheets
WebCSS:state
examples fill in a simple example that nicely shows a typical usage of the selector, then perhaps some more complex examples.
:target - CSS: Cascading Style Sheets
WebCSS:target
once targeted, the css changes their display so that they are shown.
:where() - CSS: Cascading Style Sheets
WebCSS:where
examples comparing :where() and :is() this example shows how :where() works, and also illustrates the difference between :where() and :is().
system - CSS: Cascading Style Sheets
"; } ul { list-style: abc; } result numeric counter with numeric symbols as shown in the following example, if digits from 0 to 9 are specified as symbols, this counter style will render symbols same as the decimal counter style.
font-stretch - CSS: Cascading Style Sheets
keyword to numeric mapping the table below shows the mapping between keyword values and numeric percentages: keyword percentage ultra-condensed 50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% variable fonts most fo...
display-mode - CSS: Cascading Style Sheets
display mode description fallback display mode fullscreen all of the available display area is used and no user agent chrome is shown.
prefers-reduced-motion - CSS: Cascading Style Sheets
in windows 10: settings > ease of access > display > show animations in windows.
@media - CSS: Cascading Style Sheets
WebCSS@media
: 10pt; } } @media screen { body { font-size: 13px; } } @media screen, print { body { line-height: 1.2; } } @media only screen and (min-width: 320px) and (max-width: 480px) and (resolution: 150dpi) { body { line-height: 1.4; } } introduced in media queries level 4 is a new range syntax that allows for less verbose media queries when testing for any feature accepting a range, as shown in the below examples: @media (height > 600px) { body { line-height: 1.4; } } @media (400px <= width <= 700px) { body { line-height: 1.4; } } for more examples, please see using media queries.
marks - CSS: Cascading Style Sheets
WebCSS@pagemarks
to have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box.
CSS Box Alignment - CSS: Cascading Style Sheets
the below image shows an alignment container with two alignment subjects inside.
Handling Overflow in Multicol - CSS: Cascading Style Sheets
the example below shows this overflow behaviour.
Spanning and Balancing Columns - CSS: Cascading Style Sheets
things to watch out for if the spanning element is inside another element which has margins, padding and a border or a background color, it is possible to end up with the top of the box appearing above the spanner and the rest displaying below, as shown in the next example.
Using feature queries - CSS: Cascading Style Sheets
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.
Typical use cases of Flexbox - CSS: Cascading Style Sheets
this has now been made straightforward using the alignment properties in flexbox, as the following live example shows.
CSS Fonts - CSS: Cascading Style Sheets
WebCSSCSS Fonts
basic example the following example shows a simple use of basic font properties to style a paragraph of text.
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
therefore if you have some unwrapped text for some reason in your grid, be aware that it might show up somewhere unexpected as it will be auto-placed according to the auto-placement rules.
Basic Concepts of grid layout - CSS: Cascading Style Sheets
the features shown in this overview will then be explained in greater detail in the rest of this guide.
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
the first area, is showing the default behavior of align-self, which is to stretch.
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
auto-placement and writing modes in the example already shown, you can see how writing mode changes the direction in which items place themselves onto the grid.
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
sites such as the css zen garden showcased this ability.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
.wrapper { display: grid; grid-gap: 20px; grid-template-areas: "header" "nav" "content" "sidebar" "ad" "footer"; } after setting up a mobile layout we will get this single column at all screen sizes, we can now add a media query and redefine our layout for the circumstance of having enough screen real estate to show two columns.
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
in our case, if we remove position: relative from the wrapper above, positioning context is from the viewport, as shown in this image.
CSS Grid Layout - CSS: Cascading Style Sheets
basic example the example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto.
Using CSS gradients - CSS: Cascading Style Sheets
this only makes sense if the gradients are partially transparent allowing subsequent gradients to show through the transparent areas, or if you include different background-sizes, optionally with different background-position property values, for each gradient image.
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
the below diagram shows the inline and block directions in a horizontal writing mode: this diagram shows block and inline in a vertical writing mode: browser support logical properties and values can be thought of as a couple of groups in terms of current browser support.
CSS Overflow - CSS: Cascading Style Sheets
basic example the following interactive example shows how changing the value of the overflow property, changes how the overflow of a fixed height box is dealt with.
Stacking with floated blocks - CSS: Cascading Style Sheets
this behavior can be shown with an added rule to the above list: the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant non-positioned inline elements descendant positioned elements, in order of appearance in the html note: if an opacity value is applied to the non-positioned block (div #4), then something strange happens: ...
Stacking context example 1 - CSS: Cascading Style Sheets
and this example shows what happens when a parent element does not create a stacking context.
Stacking context example 3 - CSS: Cascading Style Sheets
« css « understanding css z-index stacking context example 3 this last example shows problems that arise when mixing several positioned elements in a multi-level html hierarchy and when z-indexes are assigned using class selectors.
CSS Scrollbars - CSS: Cascading Style Sheets
droidfirefox for androidopera for androidsafari on iossamsung internetscrollbar-colorchrome no support noedge no support nofirefox full support 64notes full support 64notes notes on macos, you need to set the general > show scroll bars setting in system preferences to "always" for this property to have any effect.
Shapes from box values - CSS: Cascading Style Sheets
the examples shown above show one such use case.
Shapes From Images - CSS: Cascading Style Sheets
many demos do this as it helps to show the shape we are following, however the shape-outside property is not related to the image that is displayed on the page and so you do not need to display an image to use an image to create a shape.
CSS Shapes - CSS: Cascading Style Sheets
basic example the example below shows an image that has been floated left, and the shape-outside property applied with a value of circle(50%).
Using CSS transitions - CSS: Cascading Style Sheets
the relevant portions are shown here: a { color: #fff; background-color: #333; transition: all 1s ease-out; } a:hover, a:focus { color: #333; background-color: #fff; } this css establishes the look of the menu, with the background and text colors both changing when the element is in its :hover and :focus states.
CSS Layout cookbook - CSS: Cascading Style Sheets
css grid contribute a recipe as with all of mdn we would love you to contribute a recipe in the same format as the ones shown above.
Mozilla CSS extensions - CSS: Cascading Style Sheets
-moz-inline-gridobsolete since gecko 62 -moz-inline-stackobsolete since gecko 62 -moz-inline-table -moz-gridobsolete since gecko 62 -moz-grid-groupobsolete since gecko 62 -moz-grid-lineobsolete since gecko 62 -moz-groupbox -moz-deckobsolete since gecko 62 -moz-popupobsolete since gecko 62 -moz-stackobsolete since gecko 62 -moz-markerobsolete since gecko 62 empty-cells -moz-show-background (default value in quirks mode) font -moz-button -moz-info -moz-desktop -moz-dialog (also a color) -moz-document -moz-workspace -moz-window -moz-list -moz-pull-down-menu -moz-field (also a color) font-family -moz-fixed image-rendering -moz-crisp-edges <length> -moz-calc list-style-type -moz-arabic-indic -moz-bengali -moz-cjk-earthly-branch ...
Value definition syntax - CSS: Cascading Style Sheets
they are not shown in the value definition, and are implicitly defined.
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
mal syntax none | auto | button | textfield | menulist-button | <compat-auto>where <compat-auto> = searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar examples the following would make an element look like a menulist button: .exampleone { appearance: menulist-button; } see also this jsfiddle for an example showing how you might use appearance: none to apply custom styling to radio buttons and checkboxes.
background-position-x - CSS: Cascading Style Sheets
]#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.
background-position-y - CSS: Cascading Style Sheets
]#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.
border-image-slice - CSS: Cascading Style Sheets
plies to ::first-letter.inheritednopercentagesrefer to the size of the border imagecomputed valueone to four percentage(s) (as specified) or absolute length(s), plus the keyword fill if specifiedanimation typeby computed value type formal syntax <number-percentage>{1,4} && fill?where <number-percentage> = <number> | <percentage> examples adjustable border width and slice the folowing example shows a simple <div> with a border image set on it.
box-pack - CSS: Cascading Style Sheets
WebCSSbox-pack
-webkit-box or -webkit-inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax start | center | end | justify examples div.example { border-style: solid; display: -moz-box; /* mozilla */ display: -webkit-box; /* webkit */ /* make this box taller than the children, so there is room for the box-pack */ height: 300px; /* make this box wide enough to show the contents are centered horizontally */ width: 300px; /* children should be oriented vertically */ -moz-box-orient: vertical; /* mozilla */ -webkit-box-orient: vertical; /* webkit */ /* align children to the horizontal center of this box */ -moz-box-align: center; /* mozilla */ -webkit-box-align: center; /* webkit */ /* pack children to the bottom of this box */ -moz-b...
box-sizing - CSS: Cascading Style Sheets
formal definition initial valuecontent-boxapplies toall elements that accept width or heightinheritednocomputed valueas specifiedanimation typediscrete formal syntax content-box | border-box examples box sizes with content-box and border-box this example shows how different box-sizing values alter the rendered size of two otherwise identical elements.
caret-color - CSS: Cascading Style Sheets
on the other hand, the mouse cursor image shown when hovering over text where the cursor property is auto, or when hovering over an element where the cursor property is text or vertical-text, though it sometimes looks like a caret, is not a caret (it’s a cursor).
color-adjust - CSS: Cascading Style Sheets
formal definition initial valueeconomyapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax economy | exact examples preserving low contrast in this example, a box is shown which uses a background-image and a translucent linear-gradient() function atop a black background color to have a dark blue gradient behind medium red text.
<color> - CSS: Cascading Style Sheets
stringtotest; return image.style.color !== "rgb(255, 255, 255)"; } inputelem.addeventlistener('change', () => { if(validtextcolor(inputelem.value)) { divelem.style.backgroundcolor = inputelem.value; divelem.textcontent = ''; } else { divelem.style.backgroundcolor = 'white'; divelem.textcontent = 'invalid color value'; } }); result rgb syntax variations this example shows the many ways in which a single color can be created with the various rgb color syntaxes.
content - CSS: Cascading Style Sheets
WebCSScontent
html <div id="replaced">mozilla</div> css #replaced { content: url("https://mdn.mozillademos.org/files/12668/mdn.svg"); } #replaced::after { /* will not show if element replacement is supported */ content: " (" attr(id) ")"; } result specifications specification status comment css generated content module level 3the definition of 'content' in that specification.
cross-fade() - CSS: Cascading Style Sheets
the 75% value is the inverse, showing the first image at 75% and the second at 25%.
filter - CSS: Cascading Style Sheets
WebCSSfilter
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples applying filter functions examples of using the predefined functions are shown below.
font-smooth - CSS: Cascading Style Sheets
formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | never | always | <absolute-size> | <length>where <absolute-size> = xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large examples basic usage example the following example shows the safari/chromium and firefox equivalents that turn on font-smoothing on macos.
font-stretch - CSS: Cascading Style Sheets
keyword to numeric mapping the table below shows the mapping between keyword values and numeric percentages: keyword percentage ultra-condensed 50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% description some font...
font-weight - CSS: Cascading Style Sheets
meaning of relative weights when lighter or bolder is specified, the below chart shows how the absolute font weight of the element is determined.
image-set() - CSS: Cascading Style Sheets
WebCSSimage-set
examples background-image: image-set( "cat.png" 1x, "cat-2x.png" 2x, "cat-print.png" 600dpi); this example shows how to use image-set() to provide two alternative background-image options, chosen depending on the resolution needed: a normal version and a high-resolution version.
image() - CSS: Cascading Style Sheets
if not, the svg example will be shown.
justify-self - CSS: Cascading Style Sheets
the second, third, and fourth grid items are then given different values of justify-self, to show how these override the justify-items value.
line-height-step - CSS: Cascading Style Sheets
:root { font-size: 12pt; --my-grid: 18pt; line-height-step: var(--my-grid); } h1 { font-size: 20pt; margin-top: calc(2 * var(--my-grid)); } the result of these rules is shown below in the following screenshot: specifications specification status comment css rhythmic sizingthe definition of 'line-height-step' in that specification.
list-style-type - CSS: Cascading Style Sheets
none no item marker is shown.
max-block-size - CSS: Cascading Style Sheets
see the example in writing-mode, which shows the different writing modes in action.
object-position - CSS: Cascading Style Sheets
areas of the box which aren't covered by the replaced element's object will show the element's background.
orphans - CSS: Cascading Style Sheets
WebCSSorphans
the orphans css property sets the minimum number of lines in a block container that must be shown at the bottom of a page, region, or column.
Guide to scroll anchoring - CSS: Cascading Style Sheets
that will show a purple overlay on top of the anchor node.
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.
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.
overflow-x - CSS: Cascading Style Sheets
the overflow-x css property sets what shows when content overflows a block-level element's left and right edges.
overflow-y - CSS: Cascading Style Sheets
the overflow-y css property sets what shows when content overflows a block-level element's top and bottom edges.
perspective-origin - CSS: Cascading Style Sheets
| [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]where <length-percentage> = <length> | <percentage> examples changing the perspective origin this example shows cubes with popular perspective-origin values.
perspective - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies totransformable elementsinheritednocomputed valuethe absolute length or noneanimation typea lengthcreates stacking contextyes formal syntax none | <length> examples setting perspective this example shows a cube with the perspective set at different positions.
place-self - CSS: Cascading Style Sheets
the second, third, and fourth grid items are then given different values of place-self, to show how these override the default placements.
text-overflow - CSS: Cascading Style Sheets
-visible">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-clip">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-ellipsis">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-string">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> result note: live results in the following table may be shown incorrectly due to a limitation of the mdn editor which removes the all contents of style attributes which have text-overflow properties with string value.
text-rendering - CSS: Cascading Style Sheets
html <p class="small">lyowat - ff fi fl ffl</p> <p class="big">lyowat - ff fi fl ffl</p> css .small { font: 19.9px "constantia", "times new roman", "georgia", "palatino", serif; } .big { font: 20px "constantia", "times new roman", "georgia", "palatino", serif; } result optimizespeed vs optimizelegibility this example shows the difference between the appearance of optimizespeed and optimizelegibility (in your browser; other browsers may vary).
text-size-adjust - CSS: Cascading Style Sheets
to map the extra-wide layout back to the original device size, they either show only part of the whole render or scale the viewport down to fit.
matrix3d() - CSS: Cascading Style Sheets
a1a2a3a4b1b2b3b4c1c2c3c4d1d2d3d4 examples cube squashing example the following example shows a 3d cube created from dom elements and transforms, which can be hovered/focused to apply a matrix3d() transform to it.
transition-timing-function - CSS: Cascading Style Sheets
step-start equal to steps(1, jump-start) step-end equal to steps(1, jump-end) accessibility concerns some animations can be helpful such as to guide users to understand what actions are expected, to show relationships within the user interface, and to inform users as to what actions have occurred.
visibility - CSS: Cascading Style Sheets
the visibility css property shows or hides an element without changing the layout of a document.
widows - CSS: Cascading Style Sheets
WebCSSwidows
the widows css property sets the minimum number of lines in a block container that must be shown at the top of a page, region, or column.
will-change - CSS: Cascading Style Sheets
.slide { will-change: transform; } formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <animateable-feature>#where <animateable-feature> = scroll-position | contents | <custom-ident> examples via script this is an example showing how to apply the will-change property through scripting, which is probably what you should be doing in most cases.
Demos of open web technologies
reveal with clip-path ambient shadow with custom properties luminiscent vial css-based single page application (source code) transformations impress.js (source code) games ioquake3 (source code) kai 'opua (source code) web apis notifications api html5 notifications (source code) web audio api web audio fireworks oscope.js - javascript oscilloscope html5 web audio showcase (source code) html5 audio visualizer (source code) graphical filter editor and visualizer (source code) file api slide my text - presentation from plain text files web workers web worker fractals photo editor coral generator raytracer hotcold touch typing ...
Ajax - Developer guides
WebGuideAJAX
this article will show some ajax i/o techniques.
Setting up adaptive streaming media sources - Developer guides
note: if you use webm you can use the methods shown in this tutorial dash adaptive streaming for html 5 video.
Media buffering, seeking, and time ranges - Developer guides
this should give you results similar to the following, where the light grey bar represents the buffered progress and green bar shows the played progress: note: you can see the buffering code running live on js bin.
Creating a cross-browser video player - Developer guides
in addition, the fullscreen button will use the fullscreen api, another w3c api that controls the ability of web browsers to show apps using your computer's full screen.
Audio and Video Delivery - Developer guides
showing fallback content when no source could be decoded another way to show the fallback content of a video, when none of the sources could be decoded in the current browser, is to add an error handler on the last source element.
Challenge solutions - Developer guides
solution add a rule with an id selector of #second and a declaration color: blue;, as shown below: #second { color: blue; } a more specific selector, p#second also works.
Creating and triggering events - Developer guides
the following shows an example with document.createevent(): // create the event.
Overview of events and handlers - Developer guides
douglas crockford explains this change effectively in several lectures, notably his talk, an inconvenient api: the theory of the dom, which shows the change in flow from the original browser flow to the event driven browser.
Constraint validation - Developer guides
:placeholder-shown css pseudo-class see :placeholder-shown :valid :invalid css pseudo-classes the :valid and :invalid pseudo-classes are used to represent <input> elements whose content validates and fails to validate respectively according to the input's type setting.
Using HTML sections and outlines - Developer guides
using html5 elements in non-html5 browsers sections and headings elements can be made to work in most non-html5 browsers with a couple of extra steps, and in this section we'll show you how.
XHTML - Developer guides
WebGuideHTMLXHTML
the following example shows an html document and corresponding "xhtml" document, and the accompanying http content-type headers they should be served with.
Index - Developer guides
WebGuideIndex
this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element.
Parsing and serializing XML - Developer guides
if the document is html, the code shown above will return a document.
Writing forward-compatible websites - Developer guides
to avoid this, fully qualify global variable access using "window.", like so: <script> function localname() { alert('function localname has been called'); } </script> <div onclick="window.localname()">clicking me should show an alert<div> don't concatenate scripts you don't control the "use strict;" directive in ecmascript, when used on the file level, applies to everything in the file.
HTML attribute: accept - HTML: Hypertext Markup Language
including the multiple attribute, as shown above, specifies that multiple files can be chosen at once.
HTML attribute: min - HTML: Hypertext Markup Language
WebHTMLAttributesmin
as we included an invalid value, supporting browsers will show the value as invalid.
HTML attribute: multiple - HTML: Hypertext Markup Language
<select multiple name="drawfs" id="drawfs"> <option>grumpy</option> <option>happy</option> <option>sleepy</option> <option>bashful</option> <option>sneezy</option> <option>dopey</option> <option>doc</option> </select> when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
consider the html5 boilerplate apache server configuration file for cors images, shown below: <ifmodule mod_setenvif.c> <ifmodule mod_headers.c> <filesmatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$"> setenvif origin ":" is_cors header set access-control-allow-origin "*" env=is_cors </filesmatch> </ifmodule> </ifmodule> in short, this configures the server to allow graphic files (those with the extensions ".bmp", ".cur", ".gif", ".ico", ".jpg", ".jpeg", ...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
WebHTMLElementabbr
html <p>ashok's joke made me <abbr title="laugh out loud">lol</abbr> big time.</p> result defining an abbreviation you can use <abbr> in tandem with <dfn> to more formally define an abbreviation, as shown here.
<article>: The Article Contents element - HTML: Hypertext Markup Language
WebHTMLElementarticle
a given document 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.
<big>: The Bigger Text element - HTML: Hypertext Markup Language
WebHTMLElementbig
examples here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern css syntax instead.
<button>: The Button element - HTML: Hypertext Markup Language
WebHTMLElementbutton
example <button name="button">press me</button> accessibility concerns icon buttons buttons that only show an icon to represent do not have an accessible name.
<cite>: The Citation element - HTML: Hypertext Markup Language
WebHTMLElementcite
usage notes in the context of the <cite> element, a creative work that might be cited could be, for example, one of the following: a book a research paper an essay a poem a musical score a song a play or film script a film a television show a game a sculpture a painting a theatrical production a play an opera a musical an exhibition a legal case report a computer program a web site a web page a blog post or comment a forum post or comment a tweet a facebook post a written or oral statement and so forth.
<command>: The HTML Command element - HTML: Hypertext Markup Language
WebHTMLElementcommand
label the name of the command as shown to the user.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
WebHTMLElementdetails
you can use an event listener for the toggle event to detect when the widget changes state: details.addeventlistener("toggle", event => { if (details.open) { /* the element was toggled open */ } else { /* the element was toggled closed */ } }); examples a simple disclosure example this example shows a <details> element with no provided summary.
<input type="checkbox"> - HTML: Hypertext Markup Language
WebHTMLElementinputcheckbox
if they are completely unrelated, then you can just deal with them all separately, as shown above.
<input type="number"> - HTML: Hypertext Markup Language
WebHTMLElementinputnumber
mobile browsers further help with the user experience by showing a special keyboard more suited for entering numbers when the user tries to enter a value.
<input type="password"> - HTML: Hypertext Markup Language
WebHTMLElementinputpassword
it may simply fill in a new suggested password, or it might show the user an interface for creating one.
<input type="range"> - HTML: Hypertext Markup Language
WebHTMLElementinputrange
range control mockups since browsers have this flexibility, and to date none support all of the features html defines for range controls, here are some mockups to show you what you might get on macos in a browser which supports them.
<input type="text"> - HTML: Hypertext Markup Language
WebHTMLElementinputtext
>submit</button> </div> </form> div { margin-bottom: 10px; position: relative; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } this renders like so: if you try to submit the form with no search term entered into it, the browser will show an error message.
<menu> - HTML: Hypertext Markup Language
WebHTMLElementmenu
label the name of the menu as shown to the user.
<menuitem> - HTML: Hypertext Markup Language
WebHTMLElementmenuitem
label the name of the command as shown to the user.
theme-color - HTML: Hypertext Markup Language
WebHTMLElementmetanametheme-color
example <meta name="theme-color" content="#4285f4"> the following image shows the effect that the <meta> element above will have on a document displayed in chrome running on an android mobile device.
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnextid
html "0.c" - from january 23, 1991 though november 23, 1992 this early version of html introduced <nextid> in a non-sgml compliant form that simply used the numeric value alone as an "attribute." html "0.d" - from november 26, 1992 through may 24, 1993 during this span, next and the oldest surviving dtd's show <nextid> to take only a number for a value of its newly-introduced attribute n.
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnoembed
show an alternative content <embed type="vide/webm" src="/media/examples/flower.mp4" width="200" height="200"> <noembed> <h1>alternative content</h1> </noembed> </embed> ...
<object> - HTML: Hypertext Markup Language
WebHTMLElementobject
standbyhtml 4 onlyobsolete since html5 a message that the browser can show while loading the object's implementation and data.
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
WebHTMLElementprogress
the html <progress> element displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
WebHTMLElementrb
usage notes ruby annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters.
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
WebHTMLElementrp
usage notes ruby annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters.
<ruby> - HTML: Hypertext Markup Language
WebHTMLElementruby
ruby annotations are for showing pronunciation of east asian characters.
<th> - HTML: Hypertext Markup Language
WebHTMLElementth
but, if a column's width is too narrow to show a particular cell properly, it will be widened when displayed.
<title>: The Document Title element - HTML: Hypertext Markup Language
WebHTMLElementtitle
the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab.
draggable - HTML: Hypertext Markup Language
for other elements, the event ondragstart must be set for drag and drop to work, as shown in this comprehensive example.
itemprop - HTML: Hypertext Markup Language
examples the example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data.
itemtype - HTML: Hypertext Markup Language
try it on the html shown above specifications specification status comment html microdatathe definition of 'itemtype' in that specification.
title - HTML: Hypertext Markup Language
html <div title="cooltip"> <p>hovering here will show “cooltip”.</p> <p title="">hovering here will show nothing.</p> </div> result accessibility concerns use of the title attribute is highly problematic for: people using touch-only devices people navigating with keyboards people navigating with assistive technology such as screen readers or magnifiers people experiencing fine motor control impairment people with cognitive concerns...
Microdata - HTML: Hypertext Markup Language
try it on the html shown above.
Preloading content with rel="preload" - HTML: Hypertext Markup Language
this shows how preloading content can be combined with the philosophy of progressive enhancement.
Evolution of HTTP - HTTP
high-traffic web sites showed the most rapid adoption, saving considerably on data transfer overheads and subsequent budgets.
Identifying resources on the Web - HTTP
an anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot.
HTTP conditional requests - HTTP
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.
Using HTTP cookies - HTTP
WebHTTPCookies
a simple cookie is set like this: set-cookie: <cookie-name>=<cookie-value> this shows the server sending headers to tell the client to store a pair of cookies: http/2.0 200 ok content-type: text/html set-cookie: yummy_cookie=choco set-cookie: tasty_cookie=strawberry [page content] then, with every subsequent request to the server, the browser sends back all previously stored cookies to the server using the cookie header.
Access-Control-Allow-Headers - HTTP
access-control-allow-headers: x-custom-header multiple headers this example shows access-control-allow-headers when it specifies support for multiple headers.
CSP: sandbox - HTTP
allow-popups allows popups (like from window.open, target="_blank", showmodaldialog).
Feature-Policy: layout-animations - HTTP
the http feature-policy header layout-animations directive controls whether the current document is allowed to show layout animations.
Feature-Policy - HTTP
layout-animations controls whether the current document is allowed to show layout animations.
Server-Timing - HTTP
for example, you could only show metrics to authenticated users and nothing to the public.
Firefox user agent string reference - HTTP
h the following format: mozilla/5.0 (linux; <android version>) applewebkit/537.36 (khtml, like gecko) version/4.0 focus/<firefoxversion> chrome/<chrome rev> safari/<webkit rev> firefox tv version user agent string v3.0 mozilla/5.0 (linux; android 7.1.2) applewebkit/537.36 (khtml, like gecko) version/4.0 focus/3.0 chrome/59.0.3017.125 safari/537.36 firefox for echo show from version 1.1, firefox for echo show uses a user agent string with the following format: mozilla/5.0 (linux; <android version>) applewebkit/537.36 (khtml, like gecko) version/4.0 focus/<firefoxversion> chrome/<chrome rev> safari/<webkit rev> firefox for echo show version user agent string v1.1 mozilla/5.0 (linux; android 5.1.1) applewebkit/537.36 (khtml, like gecko)...
HEAD - HTTP
WebHTTPMethodsHEAD
if the response to a head request shows that a cached url response is now outdated, the cached copy is invalidated even if no get request was made.
Network Error Logging - HTTP
the reporting group referenced above is defined in the usual manner within the report-to header, for example: report-to: { "group": "nel", "max_age": 31556952, "endpoints": [ { "url": "https://example.com/csp-reports" } ] } error reports in these examples, the entire reporting api payload is shown.
HTTP Public Key Pinning (HPKP) - HTTP
extracting the base64 encoded public key information note: while the example below shows how to set a pin on a server certificate, it is recommended to place the pin on the intermediate certificate of the ca that issued the server certificate, to ease certificates renewals and rotations.
Redirections in HTTP - HTTP
temporary redirections are also used when creating, updating, or deleting resources, to show temporary progress pages.
HTTP
WebHTTP
a typical http session shows and explains the flow of a usual http session.
JavaScript data types and data structures - JavaScript
special primitive type having additional usage for its value: if object is not inherited, then null is shown; object : typeof instance === "object".
Grammar and types - JavaScript
using special characters in strings in addition to ordinary characters, you can also include special characters in strings, as shown in the following example.
Indexed collections - JavaScript
in addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object: let obj = {} // ...
Introduction - JavaScript
single-line input in the web console the web console shows you information about the currently loaded web page, and also includes a javascript interpreter that you can use to execute javascript expressions in the current page.
Iterators and generators - JavaScript
function* makeiterator() { yield 1; yield 2; } const it = makeiterator(); for (const ititem of it) { console.log(ititem); } console.log(it[symbol.iterator]() === it) // true; // this example show us generator(iterator) is iterable object, // which has the @@iterator method return the it (itself), // and consequently, the it object can iterate only _once_.
JavaScript modules - JavaScript
you'll still get syntax errors shown in the devtools, but you'll not be able to use some of the debugging techniques you might have expected to use.
Numbers and dates - JavaScript
you cannot change the values of these properties and you use them as follows: var biggestnum = number.max_value; var smallestnum = number.min_value; var infinitenum = number.positive_infinity; var neginfinitenum = number.negative_infinity; var notanum = number.nan; you always refer to a property of the predefined number object as shown above, and not as a property of a number object you create yourself.
Unicode property escapes - JavaScript
as shown in this example, it might be a bit clumsy to work with non latin texts.
Text formatting - JavaScript
caution: if you edit this page, do not include any characters above u+ffff, until mdn bug 857438 is fixed ( https://bugzilla.mozilla.org/show_bug.cgi?id=857438 ).
JavaScript Guide - JavaScript
the javascript guide shows you how to use javascript and gives an overview of the language.
TypeError: setting getter-only property "x" - JavaScript
examples property with no setter the example below shows how to set a getter for a property.
Warning: unreachable code after return statement - JavaScript
warnings will not be shown for semicolon-less returns if these statements follow it: throw break var function examples invalid cases function f() { var x = 3; x += 4; return x; // return exits the function immediately x -= 3; // so this line will never run; it is unreachable } function f() { return // this is treated like `return;` 3 + 4; // so the function returns, and this line is ne...
Array.prototype.reduce() - JavaScript
it is almost always safer to provide an initialvalue, because there can be up to four possible output types without initialvalue, as shown in the following example: let maxcallback = ( acc, cur ) => math.max( acc.x, cur.x ); let maxcallback2 = ( max, cur ) => math.max( max, cur ); // reduce without initialvalue [ { x: 2 }, { x: 22 }, { x: 42 } ].reduce( maxcallback ); // nan [ { x: 2 }, { x: 22 } ].reduce( maxcallback ); // 22 [ { x: 2 } ].reduce( maxcallback ); // { x: 2 } [ ...
Array.prototype.find() - JavaScript
hat 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: // declare array with no elements at indexes 2, 3, and 4 const array = [0,1,,,,5,6]; // shows all indexes, not just those with assigned values array.find(function(value, index) { console.log('visited index ', index, ' with value ', value); }); // shows all indexes, includ...
Array.prototype.flatMap() - JavaScript
fc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 examples map() and flatmap() let arr1 = [1, 2, 3, 4]; arr1.map(x => [x * 2]); // [[2], [4], [6], [8]] arr1.flatmap(x => [x * 2]); // [2, 4, 6, 8] // only one level is flattened arr1.flatmap(x => [[x * 2]]); // [[2], [4], [6], [8]] while the above could have been achieved by using map itself, here is an example that better showcases the use of flatmap.
Array.prototype.push() - JavaScript
array.prototype.push can work on an object just fine, as this example shows.
Array.prototype.sort() - JavaScript
as the output shows, when a compare function is used, numbers sort correctly whether they are numbers or numeric strings.
BigInt.prototype.toLocaleString() - JavaScript
english locale using locales this example shows some of the variations in localized number formats.
Date() constructor - JavaScript
examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
Date.prototype.toLocaleDateString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocaledatestringsupportslocales() { try { new date().tolocaledatestring('i'); } catch (e) { return e.name === 'rangeerror'; } return false; } using locales this example shows some of the variations in localized date formats.
Date.prototype.toLocaleString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocalestringsupportslocales() { try { new date().tolocalestring('i'); } catch (e) { return e instanceof rangeerror; } return false; } using locales this example shows some of the variations in localized date and time formats.
Function.prototype.bind() - JavaScript
the methods shown below are not the best way to do things, and probably should not be used in any production environment.
Function.displayName - JavaScript
console, it should display as something like "function my function()": var a = function() {}; a.displayname = 'my function'; a; // "function my function()" when defined, the displayname property returns the display name of a function: function dosomething() {} console.log(dosomething.displayname); // "undefined" var popup = function(content) { console.log(content); }; popup.displayname = 'show popup'; console.log(popup.displayname); // "show popup" defining a displayname in function expressions you can define a function with a display name in a function expression: var object = { somemethod: function() {} }; object.somemethod.displayname = 'somemethod'; console.log(object.somemethod.displayname); // logs "somemethod" try { somemethod } catch(e) { console.log(e); } // referenc...
Generator.prototype.next() - JavaScript
examples using next() the following example shows a simple generator and the object that the next method returns: function* gen() { yield 1; yield 2; yield 3; } const g = gen(); // "generator { }" g.next(); // "object { value: 1, done: false }" g.next(); // "object { value: 2, done: false }" g.next(); // "object { value: 3, done: false }" g.next(); // "object { value: undefined, done: true }" using next() with a li...
Generator.prototype.return() - JavaScript
examples using return() the following example shows a simple generator and the return method.
Generator.prototype.throw() - JavaScript
examples using throw() the following example shows a simple generator and an error that is thrown using the throw method.
Intl.Collator() constructor - JavaScript
amples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0 note that the results shown in the code above can vary between browsers and browser versions.
Intl.Collator - JavaScript
amples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0 note that the results shown in the code above can vary between browsers and browser versions.
Intl.DateTimeFormat - JavaScript
var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // tolocalestring without arguments depends on the implementation, // the default locale, and the default time zone console.log(new intl.datetimeformat().format(date)); // → "12/19/2012" if run with en-us locale (language) and time zone america/los_angeles (utc-0800) using locales this example shows some of the variations in localized date and time formats.
Intl.ListFormat() constructor - JavaScript
examples using format the following example shows how to create a list formatter using the english language.
Intl​.ListFormat.prototype​.format() - JavaScript
examples using format the following example shows how to create a list formatter using the english language.
Intl.Locale.prototype.calendar - JavaScript
the following table shows all the valid unicode calendar key strings, along with a description of the calendar era they represent.
Intl.Locale.prototype.hourCycle - JavaScript
examples these examples will show you how to add hour cycle data to your locale object.
Intl.NumberFormat - JavaScript
var number = 3500; console.log(new intl.numberformat().format(number)); // → '3,500' if in us english locale using locales this example shows some of the variations in localized number formats.
Intl.PluralRules - JavaScript
examples using locales this example shows some of the variations in localized plural rules.
Intl.RelativeTimeFormat() constructor - JavaScript
examples basic format usage the following example shows how to create a relative time formatter using the english language.
Intl.RelativeTimeFormat.prototype.format() - JavaScript
examples basic format usage the following example shows how to create a relative time formatter using the english language.
Map - JavaScript
console.log(key + ' = ' + value) }) // 0 = zero // 1 = one relation with array objects let kvarray = [['key1', 'value1'], ['key2', 'value2']] // use the regular map constructor to transform a 2d key-value array into a map let mymap = new map(kvarray) mymap.get('key1') // returns "value1" // use array.from() to transform a map into a 2d key-value array console.log(array.from(mymap)) // will show you exactly the same array as kvarray // a succinct way to do the same, using the spread syntax console.log([...mymap]) // or use the keys() or values() iterators, and convert them to an array console.log(array.from(mymap.keys())) // ["key1", "key2"] cloning and merging maps just like arrays, maps can be cloned: let original = new map([ [1, 'one'] ]) let clone = new map(original) consol...
Math.ceil() - JavaScript
examples using math.ceil() the following example shows example usage of math.ceil().
Number.prototype.toLocaleString() - JavaScript
using locales this example shows some of the variations in localized number formats.
Number - JavaScript
sign values to numeric variables the following example uses the number object's properties to assign values to several numeric variables: const biggestnum = number.max_value const smallestnum = number.min_value const infinitenum = number.positive_infinity const neginfinitenum = number.negative_infinity const notanum = number.nan integer range for number the following example shows the minimum and maximum integer values that can be represented as number object.
Object.defineProperties() - JavaScript
enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object.
Object.freeze() - JavaScript
the following example shows that a frozen object is not constant (freeze is shallow).
Object.getOwnPropertyDescriptor() - JavaScript
enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object.
Object.getOwnPropertyDescriptors() - JavaScript
enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object.
Object.prototype.propertyIsEnumerable() - JavaScript
examples a basic use of propertyisenumerable the following example shows the use of propertyisenumerable on objects and arrays: var o = {}; var a = []; o.prop = 'is enumerable'; a[0] = 'is enumerable'; o.propertyisenumerable('prop'); // returns true a.propertyisenumerable(0); // returns true user-defined vs.
RegExp.prototype.compile() - JavaScript
examples using compile() the following example shows how to recompile a regular expression with a new pattern and a new flag.
RegExp.prototype.exec() - JavaScript
description consider the following example: // match "quick brown" followed by "jumps", ignoring characters in between // remember "brown" and "jumps" // ignore case let re = /quick\s(brown).+?(jumps)/ig; let result = re.exec('the quick brown fox jumps over the lazy dog'); the following table shows the results for this script: object property/index description example result [0] the full string of characters matched "quick brown fox jumps" [1], ...[n] the parenthesized substring matches, if any.
Set - JavaScript
console.log([...myset]) // will show you exactly the same array as myarray remove duplicate elements from the array // use to remove duplicate elements from the array const numbers = [2,3,4,4,2,3,3,4,4,5,5,6,6,7,5,32,3,4,5] console.log([...new set(numbers)]) // [2, 3, 4, 5, 6, 7, 32] relation with strings let text = 'india' let myset = new set(text) // set ['i', 'n', 'd', 'i', 'a'] myset.size // 5 //case sensitive & dupl...
String.prototype.search() - JavaScript
examples using search() the following example searches a string with two different regex objects to show a successful search (positive value) vs.
TypedArray.prototype.map() - JavaScript
const numbers = new uint8array([1, 4, 9]); const roots = numbers.map(math.sqrt); // roots is now: uint8array [1, 2, 3], // numbers is still uint8array [1, 4, 9] mapping a typed array of numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it.
WeakRef - JavaScript
examples using a weakref object this example starts a counter shown in a dom element, stopping when the element doesn't exist anymore: class counter { constructor(element) { // remember a weak reference to the dom element this.ref = new weakref(element); this.start(); } start() { if (this.timer) { return; } this.count = 0; const tick = () => { // get the element from the weak reference, if it still exists c...
WebAssembly.Global() constructor - JavaScript
examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor.
WebAssembly.Global - JavaScript
examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor.
WebAssembly.Module.exports() - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method, invoke an exported function from inside it, then show how we can return information on the available exports on a module using webassembly.module.exports.
encodeURI() - JavaScript
the following example shows all the parts that a uri "scheme" can possibly contain.
eval() - JavaScript
with using function() as shown above, you can minify the code string passed to runcodewithdatefunction() far more efficiently because the function arguments names can be minified too as seen in the minified code below.
Iteration protocols - JavaScript
however, it is easy to create an object that satisfies both the iterator and iterable protocols (as shown in the example below).
Logical AND (&&) - JavaScript
true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using and the following code shows examples of the && (logical and) operator.
Logical NOT (!) - JavaScript
examples using not the following code shows examples of the !
Logical OR (||) - JavaScript
true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using or the following code shows examples of the || (logical or) operator.
Spread syntax (...) - JavaScript
therefore, it may be unsuitable for copying multidimensional arrays, as the following example shows.
in operator - JavaScript
examples basic usage the following examples show some uses of the in operator.
yield - JavaScript
function* countapplesales () { let salelist = [3, 7, 5] for (let i = 0; i < salelist.length; i++) { yield salelist[i] } } once a generator function is defined, it can be used by constructing an iterator as shown.
continue - JavaScript
examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3.
debugger - JavaScript
syntax debugger; examples using the debugger statement the following example shows code where a debugger statement has been inserted, to invoke a debugger (if one exists) when the function is called.
return - JavaScript
starting with firefox 40, a warning is shown in the console if unreachable code is found after a return statement.
switch - JavaScript
this shows you that it will traverse in the order that you put the case clauses, and it does not have to be numerically sequential.
try...catch - JavaScript
the following example shows one use case for the finally-block.
Template literals (Template strings) - JavaScript
they will show up as undefined element in the “cooked” array: function latex(str) { return { "cooked": str[0], "raw": str.raw[0] } } latex`\unicode` // { cooked: undefined, raw: "\\unicode" } note that the escape sequence restriction is only dropped from tagged templates—not from untagged template literals: let bad = `bad escape sequence: \unicode`; specifications specification ...
screenshots - Web app manifests
type object mandatory no the screenshots member defines an array of screenshots intended to showcase the application.
MathML attribute reference - MathML
the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well.
Authoring MathML - MathML
in particular, your content won't show up properly on planet.
Proving the Pythagorean theorem - MathML
proof: we can prove the theorem algebraically by showing that the area of the big square equals the area of the inner square (hypotenuse squared) plus the area of the four triangles: ( a + b ) 2 = c 2 + 4 ⋅ ( 1 2 a b ) a 2 + 2 a b + b 2 = c 2 + 2 a ba 2 + b 2 = c 2 ...
Examples - MathML
pythagorean theorem small example showing a proof of the pythagorean theorem.
Web audio codec guide - Web media technologies
[3] although the nyquist–shannon sampling theorem shows that audio bandwidth can be as much as one half of the sampling rate, opus doesn't allow encoding outside a maximum 20 khz audio frequency band, since the human ear can't percieve anything above the 20 khz point anyway.
Media container formats (file types) - Web media technologies
in the example shown here, a video is offered to the browser in two formats: webm and mp4.
Image file type and format guide - Web media technologies
for example, if you're displaying a diagram best displayed with svg, but wish to offer a fallback to a png or gif of the diagram, you would do something like this: <picture> <source srcset="diagram.svg" type="image/svg+xml"> <source srcset="diagram.png" type="image/png"> <img src="diagram.gif" width="620" height="540" alt="diagram showing the data channels"> </picture> you can specify as many <source>s as you wish, though typically 2 or 3 is all you need.
The "codecs" parameter in common media types - Web media technologies
the table below shows some examples: examples of classic webm mime types with codecs parameter mime type description video/webm;codecs="vp8" a webm video with vp8 video in it; no audio is specified.
Using images in HTML - Web media technologies
WebMediaimages
areas of the box which aren't covered by the replaced element's object will show the element's background.
OpenSearch description format
(see image, the green plus sign.) thus if a search box is not shown in the user's ui, they will receive no indication.
Populating the page: how browsers work - Web Performance
rather, the "recalculate style" in developer tools shows the total time it takes to parse css, construct the cssom tree, and recursively calculate computed styles.
Recommended Web Performance Timings: How long is too long? - Web Performance
if you wait three or four seconds without communicating to the user that a load is happening and showing some progress, the typical site will lose potential visitors, and those visitors will take a long time to come back if they ever do.
Graphic design for responsive sites - Progressive web apps (PWAs)
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.
Structural overview of progressive web apps - Progressive web apps (PWAs)
the app displays its title, a description, and then a place for the app content to be shown (a <section> element with the id content.
SVG Event Attributes - SVG: Scalable Vector Graphics
WebSVGAttributeEvents
dragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting graphical event attributes onactivate, onfocusin, onfocusout ...
fill-rule - SVG: Scalable Vector Graphics
the following eight elements: <altglyph>, <path>, <polygon>, <polyline>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- default value for fill-rule --> <polygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity.
requiredFeatures - SVG: Scalable Vector Graphics
browser supports the onbegin, onend, onrepeat and onload attributes http://www.w3.org/tr/svg11/feature#cursor the browser supports the <cursor> element http://www.w3.org/tr/svg11/feature#hyperlinking the browser supports the <a> element http://www.w3.org/tr/svg11/feature#xlinkattribute the browser supports the xlink:type, xlink:href, xlink:role, xlink:arcrole, xlink:title, xlink:show and xlink:actuate attributes http://www.w3.org/tr/svg11/feature#externalresourcesrequired the browser supports the externalresourcesrequired attribute http://www.w3.org/tr/svg11/feature#view the browser supports the <view> element http://www.w3.org/tr/svg11/feature#script the browser supports the <script> element http://www.w3.org/tr/svg11/feature#animation the browser sup...
spreadMethod - SVG: Scalable Vector Graphics
the outer thirds show the difference between the three spread methods.
stitchTiles - SVG: Scalable Vector Graphics
sometimes the result will show clear discontinuities at the tile borders.
stroke-opacity - SVG: Scalable Vector Graphics
it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath.
<altGlyph> - SVG: Scalable Vector Graphics
WebSVGElementaltGlyph
rendering, cursor, display, dominant-baseline, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, transform, vector-effect, visibility xlink attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate dom interface this element implements the svgaltglyphelement interface.
<feComposite> - SVG: Scalable Vector Graphics
" /> <use xlink:href="#red50" filter="url(#xornoflood)" /> <text x="15" y="275">xor</text> </g> <g transform="translate(900,25)"> <use xlink:href="#red100" filter="url(#arithmeticnoflood)" /> <use xlink:href="#red50" filter="url(#arithmeticnoflood)" /> <text x="-25" y="275">arithmetic</text> </g> </g> </g> </svg> result this image shows just the desired effect.
<feDiffuseLighting> - SVG: Scalable Vector Graphics
example the following example show the effect of the <fediffuselighting> element on a circle with each light source available.
<switch> - SVG: Scalable Vector Graphics
WebSVGElementswitch
svg <switch> example this example demonstrates showing different text content depending on the browser's language settings.
<text> - SVG: Scalable Vector Graphics
WebSVGElementtext
this is different than being hidden by default, as setting the display property won't show the text.
<tref> - SVG: Scalable Vector Graphics
WebSVGElementtref
0%" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <text id="referencedtext"> referenced character data </text> </defs> <text x="100" y="100" font-size="45" > inline character data </text> <text x="100" y="200" font-size="45" fill="red" > <tref xlink:href="#referencedtext"/> </text> <!-- show outline of canvas using 'rect' element --> <rect x="1" y="1" width="998" height="298" fill="none" stroke-width="2" /> </svg> specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font>' in that specification.
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
hyperlinking module a only xlink:href, xlink:show, xlink:target and xlink:title attributes implemented.
Basic shapes - SVG: Scalable Vector Graphics
all the basic shapes are shown in the image to the right.
SVG and CSS - SVG: Scalable Vector Graphics
simplified structure the svg structure shown above could be written much more concise by referencing the individual parts of the flower via <use> elements.
Tools for SVG - SVG: Scalable Vector Graphics
however, the resulting svg often shows some quirks, that make it necessary to post-process it for general applicability.
Mixed content - Web security
the mixed content resource that was loaded via http will show up in red, along with the text "mixed content", which links to this page.
How to turn off form autocompletion - Web security
when form data is cached in session history, the information filled in by the user is shown in the case where the user has submitted the form and clicked the back button to go back to the original form page.
Tutorials
how do i make my content show up in such-and-such a place on the screen?
Using custom elements - Web Components
working through some simple examples at this point, let's go through some more simple examples to show you how custom elements are created in more detail.
Using shadow DOM - Web Components
note: as this blog post shows, it is actually fairly easy to work around closed shadow doms, and the hassle to completely hide them is often more than it's worth.
Using templates and slots - Web Components
the following set of code snippets show how to use <slot> together with <template> and some javascript to: create a <element-details> element with named slots in its shadow root design the <element-details> element in such a way that, when used in documents, it is rendered from composing the element’s content together with content from its shadow root—that is, pieces of the element’s content are used to fill in named slots in...
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
examples set the parameter 'color' to the string 'red': <?xslt-param name="color" value="red"?> set the parameter 'columns' to the number 2: <?xslt-param name="columns" select="2"?> set the parameter 'books' to a nodeset containing all <book> elements in the null namespace: <?xslt-param name="books" select="//book"?> set the parameter 'show-toc' to boolean true: <?xslt-param name="show-toc" select="true()"?> the select attribute context the following context is used to parse and evaluate the expression in the select attribute.
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
once the transformation is complete, the result is appended to the document, as shown in this example.
Compiling a New C/C++ Module to WebAssembly - WebAssembly
add a <button> element as shown below, just above the first opening <script type='text/javascript'> tag.
Loading and running WebAssembly code - WebAssembly
}); aside on instantiate() overloads the webassembly.instantiate() function has two overload forms — the one shown above takes the byte code to compile as an argument and returns a promise that resolves to an object containing both the compiled module object, and an instantiated instance of it.
Compiling from Rust to WebAssembly - WebAssembly
it's only a little bit complex, and shows a realistic use-case.
Understanding WebAssembly text format - WebAssembly
note: the emscripten pthreads support page shows how to take advantage of this new functionality from emscripten.
Using the WebAssembly JavaScript API - WebAssembly
this example (see our instantiate-streaming.html demo on github, and view it live also) shows how to use instantiatestreaming() to fetch a wasm module, import a javascript function into it, compile and instantiate it, and access its exported function — all in one step.